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

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

#include <UploadService.h>

Collaboration diagram for audacity::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, AudiocomTrace)
 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 129 of file UploadService.h.

Member Typedef Documentation

◆ CompletedCallback

Definition at line 134 of file UploadService.h.

◆ ProgressCallback

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

Definition at line 137 of file UploadService.h.

Constructor & Destructor Documentation

◆ UploadService()

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

Definition at line 571 of file UploadService.cpp.

572 : mServiceConfig(config), mOAuthService(service)
573{
574}

Member Function Documentation

◆ Upload()

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

Uploads the file to audio.com.

Definition at line 576 of file UploadService.cpp.

580{
581 if (!wxFileExists(fileName))
582 {
583 if (completedCallback)
584 completedCallback(UploadOperationCompleted {
586
587 return {};
588 }
589
590 auto operation = std::make_shared<AudiocomUploadOperation>(
591 mServiceConfig, fileName, projectName, isPublic,
592 std::move(completedCallback), std::move(progressCallback), trace);
593
595 [operation, this](std::string_view authToken) {
596 operation->InitiateUpload(authToken);
597 },
598 trace, false);
599
600 return UploadOperationHandle { operation };
601}
void ValidateAuth(AuthSuccessCallback completedHandler, AudiocomTrace, bool silent)
Attempt to authorize the user.

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

Here is the call graph for this function:

Member Data Documentation

◆ mOAuthService

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

Definition at line 152 of file UploadService.h.

Referenced by Upload().

◆ mServiceConfig

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

Definition at line 151 of file UploadService.h.

Referenced by Upload().


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