uploadappstoreapppolicydeclarationfile method

Future<UploadAppStoreAppPolicyDeclarationFileResponse> uploadappstoreapppolicydeclarationfile(
  1. UploadAppStoreAppPolicyDeclarationFileRequest request,
  2. String appStorePackageName,
  3. String packageName, {
  4. String? $fields,
  5. UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
  6. Media? uploadMedia,
})

Upload a policy declaration file for the hosted app.

Returns an ID to track the file.

request - The metadata request object.

Request parameters:

appStorePackageName - Required. Package name of the third-party app store.

packageName - Required. Package name of the app.

$fields - Selector specifying which fields to include in a partial response.

uploadMedia - The media to upload.

uploadOptions - Options for the media upload. Streaming Media without the length being known ahead of time is only supported via resumable uploads.

Completes with a UploadAppStoreAppPolicyDeclarationFileResponse.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<UploadAppStoreAppPolicyDeclarationFileResponse>
uploadappstoreapppolicydeclarationfile(
  UploadAppStoreAppPolicyDeclarationFileRequest request,
  core.String appStorePackageName,
  core.String packageName, {
  core.String? $fields,
  commons.UploadOptions uploadOptions = commons.UploadOptions.defaultOptions,
  commons.Media? uploadMedia,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'fields': ?$fields == null ? null : [$fields],
  };

  core.String url_;
  if (uploadMedia == null) {
    url_ =
        'androidpublisher/v3/appstore/' +
        commons.escapeVariable('$appStorePackageName') +
        '/apps/' +
        commons.escapeVariable('$packageName') +
        '/policyDeclarationFiles:upload';
  } else if (uploadOptions is commons.ResumableUploadOptions) {
    url_ =
        '/resumable/upload/androidpublisher/v3/appstore/' +
        commons.escapeVariable('$appStorePackageName') +
        '/apps/' +
        commons.escapeVariable('$packageName') +
        '/policyDeclarationFiles:upload';
  } else {
    url_ =
        '/upload/androidpublisher/v3/appstore/' +
        commons.escapeVariable('$appStorePackageName') +
        '/apps/' +
        commons.escapeVariable('$packageName') +
        '/policyDeclarationFiles:upload';
  }

  final response_ = await _requester.request(
    url_,
    'POST',
    body: body_,
    queryParams: queryParams_,
    uploadMedia: uploadMedia,
    uploadOptions: uploadOptions,
  );
  return UploadAppStoreAppPolicyDeclarationFileResponse.fromJson(
    response_ as core.Map<core.String, core.dynamic>,
  );
}