Ads API .NET library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros
Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities Class Reference

Utility methods to upload operations for a batch job, and download the results. More...

Inheritance diagram for Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities:
Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase

Public Member Functions

delegate bool WaitCallback (ApiBatchJob batchJob, long waitedMilliseconds)
 Wait callback to be used when calling WaitForPendingJob(long,int,WaitCallback) method. More...
 
 BatchJobUtilities (AdsUser user)
 Initializes a new instance of the BatchJobUtilities class. More...
 
 BatchJobUtilities (AdsUser user, bool useChunking, int chunkSize)
 Initializes a new instance of the BatchJobUtilities class. More...
 
void Upload (string url, IEnumerable< Operation > operations)
 Uploads the operations to a specified URL. More...
 
void Upload (string url, IEnumerable< Operation > operations, bool resumePreviousUpload)
 Uploads the operations to a specified URL. More...
 
BatchUploadProgress StreamUpload (BatchUploadProgress uploadProgress, IEnumerable< Operation > operations)
 Uploads the operations to a specified URL in a streamed manner. More...
 
BatchJobMutateResponse Download (string url)
 Downloads the batch job results from a specified URL. More...
 
bool WaitForPendingJob (long batchJobId)
 Wait for the job to complete. More...
 
bool WaitForPendingJob (long batchJobId, int numMilliSecondsToWait)
 Wait for the job to complete. More...
 
bool WaitForPendingJob (long batchJobId, int numMilliSecondsToWait, WaitCallback callback)
 Wait for the job to complete. More...
 
void TryToCancelJob (long batchJobId)
 Try to cancel a job. More...
 
void Upload (string url, Operation[] operations)
 Uploads the operations to a specified URL. More...
 
void Upload (string url, Operation[] operations, bool resumePreviousUpload)
 Uploads the operations to a specified URL. More...
 
BatchUploadProgress StreamUpload (BatchUploadProgress uploadProgress, Operation[] operations)
 Uploads the operations to a specified URL in a streamed manner. More...
 
- Public Member Functions inherited from Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase
 BatchJobUtilitiesBase (AdsUser user)
 Initializes a new instance of the BatchJobUtilitiesBase class. More...
 
 BatchJobUtilitiesBase (AdsUser user, bool useChunking, int chunkSize)
 Initializes a new instance of the BatchJobUtilitiesBase class. More...
 
string GetResumableUploadUrl (string url)
 Generates a resumable upload URL for a job. This method should be used prior to calling the Upload() method when using API version >=v201601. More...
 
BatchUploadProgress BeginStreamUpload (string url)
 Begins a streamed upload. More...
 
BatchUploadProgress EndStreamUpload (BatchUploadProgress uploadProgress)
 Completes a streamed upload. More...
 

Protected Member Functions

string GetPostBody (IEnumerable< Operation > operations)
 Gets the post body for sending a request. More...
 
- Protected Member Functions inherited from Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase
void Init (AdsUser user, bool useChunking, int chunkSize)
 Initializes the class. More...
 
void Upload (string url, byte[] postBody, long startOffset)
 Uploads the operations to a specified URL. More...
 
void Upload (string url, byte[] data, long startOffset, long?totalUploadSize)
 Uploads the operations to a specified URL. More...
 
BatchUploadProgress StreamUpload (BatchUploadProgress uploadProgress, string postBody)
 Performs a streamed upload. More...
 
string DownloadResults (string url)
 Downloads the batch job results from a specified URL. More...
 
virtual int GetUploadProgress (string url)
 Gets the upload progress. More...
 
virtual void UploadChunk (string url, byte[] postBody, int start, int end, long startOffset, long?totalUploadSize)
 Uploads a chunk of data for the batch job. More...
 
ParseResponse< T > (string contents)
 Parses the XML response from the server into a type object. More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase
static string GetPayload (long bytesUploaded, string postBody)
 Gets the payload. More...
 
static string GetTextToLog (byte[] bytesToDecode, int start, int numBytes)
 Attempt to convert a byte array into a UTF-8 string for logging. More...
 
- Protected Attributes inherited from Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase
AdsFeatureUsageRegistry featureUsageRegistry = AdsFeatureUsageRegistry.Instance
 The registry for saving feature usage information.. More...
 
const
AdsFeatureUsageRegistry.Features 
FEATURE_ID
 The feature ID for this class. More...
 
const int POLL_INTERVAL_SECONDS_BASE = 30
 The polling interval base to be used for exponential backoff. More...
 
const string POSTAMBLE = "</mutate>"
 The postamble for streamed uploads. More...
 
const int CHUNK_SIZE_ALIGN = 256 * 1024
 The minimal chunk size to be used for resumable upload (256KB). More...
 
int CHUNK_SIZE
 The chunk size to be used for resumable upload. More...
 
- Properties inherited from Google.Api.Ads.AdWords.Util.BatchJob.BatchJobUtilitiesBase
AdsUser User [get]
 Returns the user associated with this object. More...
 

Detailed Description

Utility methods to upload operations for a batch job, and download the results.

Constructor & Destructor Documentation

Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.BatchJobUtilities ( AdsUser  user)
inline

Initializes a new instance of the BatchJobUtilities class.

Parameters
userAdWords user to be used along with this utilities object.
Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.BatchJobUtilities ( AdsUser  user,
bool  useChunking,
int  chunkSize 
)
inline

Initializes a new instance of the BatchJobUtilities class.

Parameters
userAdWords user to be used along with this utilities object.
useChunkingif the operations should be broken into smaller chunks before uploading to the server.
chunkSizeThe chunk size to use for resumable upload.
Exceptions
ArgumentExceptionThrown if chunkSize is not a multiple of 256KB.

Use chunking if your network is spotty for uploads, or if it has restrictions such as speed limits or timeouts. Chunking makes your upload reliable when the network is unreliable, but it is inefficient over a good connection, since an HTTPs request has to be made for every chunk being uploaded.

Member Function Documentation

BatchJobMutateResponse Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.Download ( string  url)
inline

Downloads the batch job results from a specified URL.

Parameters
urlThe download URL from a batch job.
Returns
The results from the batch job.
string Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.GetPostBody ( IEnumerable< Operation operations)
inlineprotected

Gets the post body for sending a request.

Parameters
operationsThe list of operations.
Returns
The POST body, for using in the web request.
BatchUploadProgress Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.StreamUpload ( BatchUploadProgress  uploadProgress,
IEnumerable< Operation operations 
)
inline

Uploads the operations to a specified URL in a streamed manner.

Parameters
uploadProgressThe upload progress tracker.
operationsThe list of operations.
Returns
The updated progress tracker.
BatchUploadProgress Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.StreamUpload ( BatchUploadProgress  uploadProgress,
Operation[]  operations 
)
inline

Uploads the operations to a specified URL in a streamed manner.

Parameters
uploadProgressThe upload progress tracker.
operationsThe list of operations.
Returns
The updated progress tracker.

Use this method as a workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=40793 if you are using VB.NET on Mono. Otherwise use StreamUpload(BatchUploadProgress, IEnumerable{Operation}) method.

void Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.TryToCancelJob ( long  batchJobId)
inline

Try to cancel a job.

Parameters
batchJobIdID of the batch job to cancel.
Exceptions
AdWordsApiExceptionThrown if an API error occurred when cancelling the job.
void Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.Upload ( string  url,
IEnumerable< Operation operations 
)
inline

Uploads the operations to a specified URL.

Parameters
urlThe temporary URL returned by a batch job.
operationsThe list of operations.
void Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.Upload ( string  url,
IEnumerable< Operation operations,
bool  resumePreviousUpload 
)
inline

Uploads the operations to a specified URL.

Parameters
urlThe temporary URL returned by a batch job.
operationsThe list of operations.
resumePreviousUploadTrue, if a previously interrupted upload should be resumed.
void Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.Upload ( string  url,
Operation[]  operations 
)
inline

Uploads the operations to a specified URL.

Parameters
urlThe temporary URL returned by a batch job.
operationsThe list of operations.

Use this method as a workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=40793 if you are using VB.NET on Mono. Otherwise use Upload(string, IEnumerable{Operation}) method.

void Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.Upload ( string  url,
Operation[]  operations,
bool  resumePreviousUpload 
)
inline

Uploads the operations to a specified URL.

Parameters
urlThe temporary URL returned by a batch job.
operationsThe list of operations.
resumePreviousUploadTrue, if a previously interrupted upload should be resumed.

Use this method as a workaround for https://bugzilla.xamarin.com/show_bug.cgi?id=40793 if you are using VB.NET on Mono. Otherwise use Upload(string, IEnumerable{Operation}, bool) method.

delegate bool Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.WaitCallback ( ApiBatchJob  batchJob,
long  waitedMilliseconds 
)

Wait callback to be used when calling WaitForPendingJob(long,int,WaitCallback) method.

Parameters
batchJobThe batchjob instance that was retrieved by the WaitForPendingJob(long,int,WaitCallback) method when polling for job status.
waitedMillisecondsThe time in milliseconds for which the WaitForPendingJob(long,int,WaitCallback) method has waited so far.
Returns
true, if the WaitForPendingJob(long,int,WaitCallback) method should be cancelled, false otherwise.
bool Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.WaitForPendingJob ( long  batchJobId)
inline

Wait for the job to complete.

Parameters
batchJobIdID of the job to wait for completion.
Returns
false, if the job is still pending, false otherwise.
bool Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.WaitForPendingJob ( long  batchJobId,
int  numMilliSecondsToWait 
)
inline

Wait for the job to complete.

Parameters
batchJobIdID of the job to wait for completion.
numMilliSecondsToWaitThe number of milliseconds to wait for job completion.
Returns
false, if the job is still pending, false otherwise.
bool Google.Api.Ads.AdWords.Util.BatchJob.v201809.BatchJobUtilities.WaitForPendingJob ( long  batchJobId,
int  numMilliSecondsToWait,
WaitCallback  callback 
)
inline

Wait for the job to complete.

Parameters
batchJobIdID of the job to wait for completion.
numMilliSecondsToWaitThe number of milliseconds to wait for job completion.
callbackThe callback to be called whenever the method polls the server for job status.
Returns
false, if the job is still pending, true otherwise.

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