Audacity 3.2.0
Public Types | Public Member Functions | Private Attributes | List of all members
cloud::audiocom::UploadService Class Referencefinal

Service, responsible for uploading audio files to audio.com. More...

#include <UploadService.h>

Collaboration diagram for cloud::audiocom::UploadService:
[legend]

Public Types

using CompletedCallback = std::function< void(const UploadOperationCompleted &)>
 
using ProgressCallback = std::function< void(uint64_t current, uint64_t total)>
 

Public Member Functions

 UploadService (const ServiceConfig &config, OAuthService &service)
 
UploadOperationHandle Upload (const wxString &fileName, const wxString &projectName, bool isPublic, CompletedCallback completedCallback, ProgressCallback progressCallback)
 Uploads the file to audio.com. More...
 

Private Attributes

const ServiceConfigmServiceConfig
 
OAuthServicemOAuthService
 

Detailed Description

Service, responsible for uploading audio files to audio.com.

Definition at line 126 of file UploadService.h.

Member Typedef Documentation

◆ CompletedCallback

Definition at line 131 of file UploadService.h.

◆ ProgressCallback

using cloud::audiocom::UploadService::ProgressCallback = std::function<void(uint64_t current, uint64_t total)>

Definition at line 134 of file UploadService.h.

Constructor & Destructor Documentation

◆ UploadService()

cloud::audiocom::UploadService::UploadService ( const ServiceConfig config,
OAuthService service 
)

Definition at line 567 of file UploadService.cpp.

568 : mServiceConfig(config), mOAuthService(service)
569{
570}
const ServiceConfig & mServiceConfig

Member Function Documentation

◆ Upload()

UploadOperationHandle cloud::audiocom::UploadService::Upload ( const wxString &  fileName,
const wxString &  projectName,
bool  isPublic,
CompletedCallback  completedCallback,
ProgressCallback  progressCallback 
)

Uploads the file to audio.com.

Definition at line 572 of file UploadService.cpp.

575{
576 if (!wxFileExists(fileName))
577 {
578 if (completedCallback)
579 completedCallback(UploadOperationCompleted {
581
582 return {};
583 }
584
585 auto operation = std::make_shared<AudiocomUploadOperation>(
586 mServiceConfig, fileName, projectName, isPublic,
587 std::move(completedCallback), std::move(progressCallback));
588
589 mOAuthService.ValidateAuth([operation, this](std::string_view authToken)
590 { operation->InitiateUpload(authToken); });
591
592 return UploadOperationHandle { operation };
593}
void ValidateAuth(std::function< void(std::string_view)> completedHandler)
Attempt to authorize the user.
@ FileNotFound
Specified file is not found.

References cloud::audiocom::UploadOperationCompleted::FileNotFound, mOAuthService, mServiceConfig, and cloud::audiocom::OAuthService::ValidateAuth().

Here is the call graph for this function:

Member Data Documentation

◆ mOAuthService

OAuthService& cloud::audiocom::UploadService::mOAuthService
private

Definition at line 148 of file UploadService.h.

Referenced by Upload().

◆ mServiceConfig

const ServiceConfig& cloud::audiocom::UploadService::mServiceConfig
private

Definition at line 147 of file UploadService.h.

Referenced by Upload().


The documentation for this class was generated from the following files: