diff --git a/oss/source/api.ts b/oss/source/api.ts index b609e7a..7c89a6e 100644 --- a/oss/source/api.ts +++ b/oss/source/api.ts @@ -2,5 +2,6 @@ /* eslint-disable */ -export * from './api/ossapi'; +export * from "./api/buckets-api" +export * from "./api/objects-api" diff --git a/oss/source/api/buckets-api.ts b/oss/source/api/buckets-api.ts new file mode 100644 index 0000000..a9d971e --- /dev/null +++ b/oss/source/api/buckets-api.ts @@ -0,0 +1,422 @@ +/* tslint:disable */ +/* eslint-disable */ + +import type { AxiosPromise, AxiosInstance } from 'axios'; +import {ApsServiceRequestConfig, IApsConfiguration, SdkManager, ApiResponse} from "@aps_sdk/autodesk-sdkmanager"; +import { assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +import { COLLECTION_FORMATS, RequestArgs, BaseApi, RequiredError, OssApiError } from '../base'; +import { Bucket } from '../model'; +import { Buckets } from '../model'; +import { CreateBucketsPayload } from '../model'; +import { Reason } from '../model'; +import { Region } from '../model'; +/** + * BucketsApi - axios parameter creator + * @export + */ +export const BucketsApiAxiosParamCreator = function (apsConfiguration?: IApsConfiguration) { + return { + /** + * Creates a bucket. Buckets are virtual container within the Object Storage Service (OSS), which you can use to store and manage objects (files) in the cloud. The application creating the bucket is the owner of the bucket. **Note:** Do not use this operation to create buckets for BIM360 Document Management. Use `POST projects/{project_id}/storage _ instead. For details, see `Upload Files to BIM 360 Document Management `_. + * @summary Create Bucket + * @param {CreateBucketsPayload} policyKey + * @param {Region} [xAdsRegion] Specifies where the bucket must be stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createBucket: async (accessToken: string, policyKey: CreateBucketsPayload, xAdsRegion: Region, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'policyKey' is not null or undefined + assertParamExists('createBucket', 'policyKey', policyKey) + const localVarPath = `/oss/v2/buckets`; + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (xAdsRegion != null) { + localVarHeaderParameter['x-ads-region'] = typeof xAdsRegion === 'string' + ? xAdsRegion + : JSON.stringify(xAdsRegion); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0-beta1'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(policyKey, localVarRequestOptions, apsConfiguration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Deletes the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. The initial processing of a bucket deletion request can be time-consuming. So, we recommend only deleting buckets containing a few objects, like those typically used for acceptance testing and prototyping. **Note:** Bucket keys will not be immediately available for reuse. + * @summary Delete Bucket + * @param {string} bucketKey The bucket key of the bucket to delete. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteBucket: async (accessToken: string, bucketKey: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('deleteBucket', 'bucketKey', bucketKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns detailed information about the specified bucket. **Note:** Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Get Bucket Details + * @param {string} bucketKey The bucket key of the bucket to query. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getBucketDetails: async (accessToken: string, bucketKey: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('getBucketDetails', 'bucketKey', bucketKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/details` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list of buckets owned by the application. + * @summary List Buckets + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getBuckets: async (accessToken: string, region?: Region, limit?: number, startAt?: string, options: ApsServiceRequestConfig = {}): Promise => { + const localVarPath = `/oss/v2/buckets`; + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (region !== undefined) { + localVarQueryParameter['region'] = region; + } + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit; + } + + if (startAt !== undefined) { + localVarQueryParameter['startAt'] = startAt; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * BucketsApi - functional programming interface + * @export + */ +export const BucketsApiFp = function(sdkManager?: SdkManager) { + const localVarAxiosParamCreator = BucketsApiAxiosParamCreator(sdkManager.apsConfiguration) + return { + /** + * Creates a bucket. Buckets are virtual container within the Object Storage Service (OSS), which you can use to store and manage objects (files) in the cloud. The application creating the bucket is the owner of the bucket. **Note:** Do not use this operation to create buckets for BIM360 Document Management. Use `POST projects/{project_id}/storage _ instead. For details, see `Upload Files to BIM 360 Document Management `_. + * @summary Create Bucket + * @param {CreateBucketsPayload} policyKey + * @param {Region} [xAdsRegion] Specifies where the bucket must be stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createBucket(accessToken: string, policyKey: CreateBucketsPayload, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createBucket(accessToken, policyKey, xAdsRegion, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Deletes the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. The initial processing of a bucket deletion request can be time-consuming. So, we recommend only deleting buckets containing a few objects, like those typically used for acceptance testing and prototyping. **Note:** Bucket keys will not be immediately available for reuse. + * @summary Delete Bucket + * @param {string} bucketKey The bucket key of the bucket to delete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteBucket(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteBucket(accessToken, bucketKey, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Returns detailed information about the specified bucket. **Note:** Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Get Bucket Details + * @param {string} bucketKey The bucket key of the bucket to query. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getBucketDetails(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getBucketDetails(accessToken, bucketKey, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Returns a list of buckets owned by the application. + * @summary List Buckets + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getBuckets(accessToken: string, region?: Region, limit?: number, startAt?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getBuckets(accessToken, region, limit, startAt, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + } +}; + +/** + * BucketsApi - interface + * @export + * @interface BucketsApi + */ +export interface BucketsApiInterface { + /** + * Creates a bucket. Buckets are virtual container within the Object Storage Service (OSS), which you can use to store and manage objects (files) in the cloud. The application creating the bucket is the owner of the bucket. **Note:** Do not use this operation to create buckets for BIM360 Document Management. Use `POST projects/{project_id}/storage _ instead. For details, see `Upload Files to BIM 360 Document Management `_. + * @summary Create Bucket + * @param {CreateBucketsPayload} policyKey + * @param {Region} [xAdsRegion] Specifies where the bucket must be stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApiInterface + */ + createBucket(accessToken: string,policyKey: CreateBucketsPayload, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise; + + /** + * Deletes the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. The initial processing of a bucket deletion request can be time-consuming. So, we recommend only deleting buckets containing a few objects, like those typically used for acceptance testing and prototyping. **Note:** Bucket keys will not be immediately available for reuse. + * @summary Delete Bucket + * @param {string} bucketKey The bucket key of the bucket to delete. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApiInterface + */ + deleteBucket(accessToken: string,bucketKey: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Returns detailed information about the specified bucket. **Note:** Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Get Bucket Details + * @param {string} bucketKey The bucket key of the bucket to query. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApiInterface + */ + getBucketDetails(accessToken: string,bucketKey: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Returns a list of buckets owned by the application. + * @summary List Buckets + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApiInterface + */ + getBuckets(accessToken: string,region?: Region, limit?: number, startAt?: string, options?: ApsServiceRequestConfig): Promise; + +} + +/** + * BucketsApi - object-oriented interface + * @export + * @class BucketsApi + * @extends {BaseApi} + */ +export class BucketsApi extends BaseApi implements BucketsApiInterface { + private logger = this.sdkManager.logger; + /** + * Creates a bucket. Buckets are virtual container within the Object Storage Service (OSS), which you can use to store and manage objects (files) in the cloud. The application creating the bucket is the owner of the bucket. **Note:** Do not use this operation to create buckets for BIM360 Document Management. Use `POST projects/{project_id}/storage _ instead. For details, see `Upload Files to BIM 360 Document Management `_. + * @summary Create Bucket + * @param {CreateBucketsPayload} policyKey + * @param {Region} [xAdsRegion] Specifies where the bucket must be stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApi + */ + public async createBucket(accessToken: string, policyKey: CreateBucketsPayload, xAdsRegion: Region, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into createBucket "); + try { + const request = await BucketsApiFp(this.sdkManager).createBucket(accessToken, policyKey, xAdsRegion, options); + const response = await request(this.axios); + this.logger.logInfo(`createBucket Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`createBucket Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`createBucket Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`createBucket Request failed with no response received: ${error.request}`); + throw new OssApiError(`createBucket Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Deletes the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. The initial processing of a bucket deletion request can be time-consuming. So, we recommend only deleting buckets containing a few objects, like those typically used for acceptance testing and prototyping. **Note:** Bucket keys will not be immediately available for reuse. + * @summary Delete Bucket + * @param {string} bucketKey The bucket key of the bucket to delete. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApi + */ + public async deleteBucket(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into deleteBucket "); + try { + const request = await BucketsApiFp(this.sdkManager).deleteBucket(accessToken, bucketKey, options); + const response = await request(this.axios); + this.logger.logInfo(`deleteBucket Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`deleteBucket Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`deleteBucket Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`deleteBucket Request failed with no response received: ${error.request}`); + throw new OssApiError(`deleteBucket Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Returns detailed information about the specified bucket. **Note:** Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Get Bucket Details + * @param {string} bucketKey The bucket key of the bucket to query. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApi + */ + public async getBucketDetails(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into getBucketDetails "); + try { + const request = await BucketsApiFp(this.sdkManager).getBucketDetails(accessToken, bucketKey, options); + const response = await request(this.axios); + this.logger.logInfo(`getBucketDetails Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`getBucketDetails Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`getBucketDetails Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`getBucketDetails Request failed with no response received: ${error.request}`); + throw new OssApiError(`getBucketDetails Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Returns a list of buckets owned by the application. + * @summary List Buckets + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BucketsApi + */ + public async getBuckets(accessToken: string, region?: Region, limit?: number, startAt?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into getBuckets "); + try { + const request = await BucketsApiFp(this.sdkManager).getBuckets(accessToken, region, limit, startAt, options); + const response = await request(this.axios); + this.logger.logInfo(`getBuckets Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`getBuckets Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`getBuckets Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`getBuckets Request failed with no response received: ${error.request}`); + throw new OssApiError(`getBuckets Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } +} + diff --git a/oss/source/api/objects-api.ts b/oss/source/api/objects-api.ts new file mode 100644 index 0000000..1ce6dbd --- /dev/null +++ b/oss/source/api/objects-api.ts @@ -0,0 +1,2127 @@ +/* tslint:disable */ +/* eslint-disable */ + +import type { AxiosPromise, AxiosInstance } from 'axios'; +import {ApsServiceRequestConfig, IApsConfiguration, SdkManager, ApiResponse} from "@aps_sdk/autodesk-sdkmanager"; +import { assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; +import { COLLECTION_FORMATS, RequestArgs, BaseApi, RequiredError, OssApiError } from '../base'; +import { Access } from '../model'; +import { BatchcompleteuploadObject } from '../model'; +import { BatchcompleteuploadResponse } from '../model'; +import { Batchsigneds3downloadObject } from '../model'; +import { Batchsigneds3downloadResponse } from '../model'; +import { Batchsigneds3uploadObject } from '../model'; +import { Batchsigneds3uploadResponse } from '../model'; +import { BucketObjects } from '../model'; +import { Completes3uploadBody } from '../model'; +import { CreateObjectSigned } from '../model'; +import { CreateSignedResource } from '../model'; +import { ObjectDetails } from '../model'; +import { ObjectFullDetails } from '../model'; +import { Reason } from '../model'; +import { Region } from '../model'; +import { Result } from '../model'; +import { Signeds3downloadResponse } from '../model'; +import { Signeds3uploadResponse } from '../model'; +import { With } from '../model'; +/** + * ObjectsApi - axios parameter creator + * @export + */ +export const ObjectsApiAxiosParamCreator = function (apsConfiguration?: IApsConfiguration) { + return { + /** + * Requests OSS to start reconstituting the set of objects that were uploaded using signed S3 upload URLs. You must call this operation only after all the objects have been uploaded. You can specify up to 25 objects in this operation. + * @summary Complete Batch Upload to S3 Signed URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + batchCompleteUpload: async (accessToken: string, bucketKey: string, requests?: BatchcompleteuploadObject, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('batchCompleteUpload', 'bucketKey', bucketKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/batchcompleteupload` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0-beta1'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(requests, localVarRequestOptions, apsConfiguration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates and returns signed URLs to download a set of objects directly from S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start download the objects before the signed URLs expire. The download itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Batch Generate Signed S3 Download URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + batchSignedS3Download: async (accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('batchSignedS3Download', 'bucketKey', bucketKey) + // verify required parameter 'requests' is not null or undefined + assertParamExists('batchSignedS3Download', 'requests', requests) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/batchsigneds3download` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (publicResourceFallback !== undefined) { + localVarQueryParameter['public-resource-fallback'] = publicResourceFallback; + } + + if (minutesExpiration !== undefined) { + localVarQueryParameter['minutesExpiration'] = minutesExpiration; + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0-beta1'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(requests, localVarRequestOptions, apsConfiguration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates and returns signed URLs to upload a set of objects directly to S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start uploading the objects before the signed URLs expire. The upload itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. If required, you can request an array of signed URLs for each object, which lets you upload the objects in chunks. Once you upload all chunks you must call the `Complete Batch Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even if you requested a single signed URL for an object. If an upload fails after the validity period of a signed URL has elapsed, you can call this operation again to obtain fresh signed URLs. However, you must use the same ``uploadKey`` that was returned when you originally called this operation. + * @summary Batch Generate Signed S3 Upload URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {Batchsigneds3uploadObject} [requests] An array of objects representing each request for a signed upload URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + batchSignedS3Upload: async (accessToken: string, bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('batchSignedS3Upload', 'bucketKey', bucketKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/batchsigneds3upload` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (useAcceleration !== undefined) { + localVarQueryParameter['useAcceleration'] = useAcceleration; + } + + if (minutesExpiration !== undefined) { + localVarQueryParameter['minutesExpiration'] = minutesExpiration; + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0-beta1'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(requests, localVarRequestOptions, apsConfiguration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Requests OSS to assemble and reconstitute the object that was uploaded using signed S3 upload URL. You must call this operation only after all parts/chunks of the object has been uploaded. + * @summary Complete Upload to S3 Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} contentType Must be ``application/json``. + * @param {Completes3uploadBody} body + * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. + * @param {string} [xAdsUserDefinedMetadata] Custom metadata to be stored with the object, which can be retrieved later on download or when retrieving object details. Must be a JSON object that is less than 100 bytes. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + completeSignedS3Upload: async (accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('completeSignedS3Upload', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('completeSignedS3Upload', 'objectKey', objectKey) + // verify required parameter 'contentType' is not null or undefined + assertParamExists('completeSignedS3Upload', 'contentType', contentType) + // verify required parameter 'body' is not null or undefined + assertParamExists('completeSignedS3Upload', 'body', body) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3upload` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (contentType != null) { + localVarHeaderParameter['Content-Type'] = String(contentType); + } + + if (xAdsMetaContentType != null) { + localVarHeaderParameter['x-ads-meta-Content-Type'] = String(xAdsMetaContentType); + } + + if (xAdsMetaContentDisposition != null) { + localVarHeaderParameter['x-ads-meta-Content-Disposition'] = String(xAdsMetaContentDisposition); + } + + if (xAdsMetaContentEncoding != null) { + localVarHeaderParameter['x-ads-meta-Content-Encoding'] = String(xAdsMetaContentEncoding); + } + + if (xAdsMetaCacheControl != null) { + localVarHeaderParameter['x-ads-meta-Cache-Control'] = String(xAdsMetaCacheControl); + } + + if (xAdsUserDefinedMetadata != null) { + localVarHeaderParameter['x-ads-user-defined-metadata'] = String(xAdsUserDefinedMetadata); + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0-beta1'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, apsConfiguration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Creates a copy of an object within the bucket. + * @summary Copy Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} newObjName A URL-encoded human friendly name to identify the copied object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + copyTo: async (accessToken: string, bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('copyTo', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('copyTo', 'objectKey', objectKey) + // verify required parameter 'newObjName' is not null or undefined + assertParamExists('copyTo', 'newObjName', newObjName) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/copyto/{newObjName}` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))) + .replace(`{${"newObjName"}}`, encodeURIComponent(String(newObjName))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (xAdsAcmNamespace != null) { + localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); + } + + if (xAdsAcmCheckGroups != null) { + localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); + } + + if (xAdsAcmGroups != null) { + localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Generates a signed URL that can be used to download or upload an object within the specified expiration time. If the object the signed URL points to is deleted or expires before the signed URL expires, the signed URL will no longer be valid. In addition to this operation that generates OSS signed URLs, OSS provides operations to generate S3 signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. Only the application that owns the bucket containing the object can call this operation. + * @summary Generate OSS Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {Access} [access] + * @param {boolean} [useCdn] ``true`` : Returns a Cloudfront URL to the object instead of an Autodesk URL (one that points to a location on https://developer.api.autodesk.com). Applications can interact with the Cloudfront URL exactly like with any classic public resource in OSS. They can use GET requests to download objects or PUT requests to upload objects. ``false`` : (Default) Returns an Autodesk URL (one that points to a location on https://developer.api.autodesk.com) to the object. + * @param {CreateSignedResource} [createSignedResource] + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createSignedResource: async (accessToken: string, bucketKey: string, objectKey: string, access?: Access, useCdn?: boolean, createSignedResource?: CreateSignedResource, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('createSignedResource', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('createSignedResource', 'objectKey', objectKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signed` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (access !== undefined) { + localVarQueryParameter['access'] = access; + } + + if (useCdn !== undefined) { + localVarQueryParameter['useCdn'] = useCdn; + } + + + + localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0-beta1'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = serializeDataIfNeeded(createSignedResource, localVarRequestOptions, apsConfiguration) + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Deletes an object from the bucket. + * @summary Delete Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS API Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteObject: async (accessToken: string, bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('deleteObject', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('deleteObject', 'objectKey', objectKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (xAdsAcmNamespace != null) { + localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); + } + + if (xAdsAcmCheckGroups != null) { + localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); + } + + if (xAdsAcmGroups != null) { + localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Delete an object using an OSS signed URL to access it. Only applications that own the bucket containing the object can call this operation. + * @summary Delete Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteSignedResource: async (accessToken: string, hash: string, xAdsRegion?: Region, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'hash' is not null or undefined + assertParamExists('deleteSignedResource', 'hash', hash) + const localVarPath = `/oss/v2/signedresources/{hash}` + .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (xAdsRegion != null) { + localVarHeaderParameter['x-ads-region'] = typeof xAdsRegion === 'string' + ? xAdsRegion + : JSON.stringify(xAdsRegion); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns detailed information about the specified object. + * @summary Get Object Details + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {With} [_with] + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getObjectDetails: async (accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: With, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('getObjectDetails', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('getObjectDetails', 'objectKey', objectKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/details` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (_with !== undefined) { + localVarQueryParameter['with'] = _with; + } + + if (ifModifiedSince != null) { + localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' + ? ifModifiedSince + : JSON.stringify(ifModifiedSince); + } + + if (xAdsAcmNamespace != null) { + localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); + } + + if (xAdsAcmCheckGroups != null) { + localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); + } + + if (xAdsAcmGroups != null) { + localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a list objects in the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary List Objects + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [beginsWith] Filters the results by the value you specify. Only the objects with their ``objectKey`` beginning with the specified string are returned. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getObjects: async (accessToken: string, bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('getObjects', 'bucketKey', bucketKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (limit !== undefined) { + localVarQueryParameter['limit'] = limit; + } + + if (beginsWith !== undefined) { + localVarQueryParameter['beginsWith'] = beginsWith; + } + + if (startAt !== undefined) { + localVarQueryParameter['startAt'] = startAt; + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Downloads an object using an OSS signed URL. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Download Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} [range] The byte range to download, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the requested data only if the ``If-None-Match`` header differs from the ETag value of the object on OSS, which indicates that the object on OSS is newer. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [acceptEncoding] The compression format your prefer to receive the data. Possible values are: - ``gzip`` - Use the gzip format **Note:** You cannot use ``Accept-Encoding:gzip`` with a Range header containing an end byte range. OSS will not honor the End byte range if ``Accept-Encoding: gzip`` header is used. + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getSignedResource: async (accessToken: string, hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: Region, responseContentDisposition?: string, responseContentType?: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'hash' is not null or undefined + assertParamExists('getSignedResource', 'hash', hash) + const localVarPath = `/oss/v2/signedresources/{hash}` + .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (region !== undefined) { + localVarQueryParameter['region'] = region; + } + + if (responseContentDisposition !== undefined) { + localVarQueryParameter['response-content-disposition'] = responseContentDisposition; + } + + if (responseContentType !== undefined) { + localVarQueryParameter['response-content-type'] = responseContentType; + } + + if (range != null) { + localVarHeaderParameter['Range'] = String(range); + } + + if (ifNoneMatch != null) { + localVarHeaderParameter['If-None-Match'] = String(ifNoneMatch); + } + + if (ifModifiedSince != null) { + localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' + ? ifModifiedSince + : JSON.stringify(ifModifiedSince); + } + + if (acceptEncoding != null) { + localVarHeaderParameter['Accept-Encoding'] = String(acceptEncoding); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns an empty response body and a 200 response code if the object exists. + * @summary Check Object Existence + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {HeadObjectDetailsWithEnum} [_with] **Not applicable to this operation** The optional information you can request for. To request more than one of the following, specify this parameter multiple times in the request. Possible values: - ``createdDate`` - ``lastAccessedDate`` - ``lastModifiedDate`` - ``userDefinedMetadata`` + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + headObjectDetails: async (accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('headObjectDetails', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('headObjectDetails', 'objectKey', objectKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/details` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'HEAD', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (_with !== undefined) { + localVarQueryParameter['with'] = _with; + } + + if (ifModifiedSince != null) { + localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' + ? ifModifiedSince + : JSON.stringify(ifModifiedSince); + } + + if (xAdsAcmNamespace != null) { + localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); + } + + if (xAdsAcmCheckGroups != null) { + localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); + } + + if (xAdsAcmGroups != null) { + localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Gets a signed URL to download an object directly from S3, bypassing OSS servers. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the download before the signed URL expires. The download itself can take longer. If the download fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL. Only applications that have read access to the object can call this operation. You can use range headers with the signed download URL to download the object in chunks. This ability lets you download chunks in parallel, which can result in faster downloads. If the object you want to download was uploaded in chunks and is still assembling on OSS, you will receive multiple S3 URLs instead of just one. Each URL will point to a chunk. If you prefer to receive a single URL, set the ``public-resource-fallback`` query parameter to ``true``. This setting will make OSS fallback to returning a single signed OSS URL, if assembling is still in progress. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Download URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the signed URL only if the ``If-None-Match`` header differs from the ETag value of the object on S3. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The signed URL is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseCacheControl] The value of the Cache-Control header you want to receive when you download the object using the signed URL. If you do not specify a value, the Cache-Control header defaults to the value stored with OSS. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useCdn] ``true`` : Returns a URL that points to a CloudFront edge location. ``false`` : (Default) Returns a URL that points directly to the S3 object. + * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signedS3Download: async (accessToken: string, bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('signedS3Download', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('signedS3Download', 'objectKey', objectKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3download` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (responseContentType !== undefined) { + localVarQueryParameter['response-content-type'] = responseContentType; + } + + if (responseContentDisposition !== undefined) { + localVarQueryParameter['response-content-disposition'] = responseContentDisposition; + } + + if (responseCacheControl !== undefined) { + localVarQueryParameter['response-cache-control'] = responseCacheControl; + } + + if (publicResourceFallback !== undefined) { + localVarQueryParameter['public-resource-fallback'] = publicResourceFallback; + } + + if (minutesExpiration !== undefined) { + localVarQueryParameter['minutesExpiration'] = minutesExpiration; + } + + if (useCdn !== undefined) { + localVarQueryParameter['useCdn'] = useCdn; + } + + if (redirect !== undefined) { + localVarQueryParameter['redirect'] = redirect; + } + + if (ifNoneMatch != null) { + localVarHeaderParameter['If-None-Match'] = String(ifNoneMatch); + } + + if (ifModifiedSince != null) { + localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' + ? ifModifiedSince + : JSON.stringify(ifModifiedSince); + } + + if (xAdsAcmScopes != null) { + localVarHeaderParameter['x-ads-acm-scopes'] = String(xAdsAcmScopes); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Gets a signed URL to upload an object directly to S3, bypassing OSS servers. You can also request an array of signed URLs which lets you upload an object in chunks. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the upload before the signed URL expires. The upload itself can take longer. If the upload fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL (or an array of signed URLs as the case may be). However, you must use the same ``uploadKey`` that was returned when you originally called this operation. Only applications that own the bucket can call this operation. **Note:** Once you upload all chunks you must call the `Complete Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even when using a single signed URL. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Upload URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {number} [parts] The number of parts you intend to chunk the object for uploading. OSS will return that many signed URLs, one URL for each chunk. If you do not specify a value you\'ll get only one URL to upload the entire object. + * @param {number} [firstPart] The index of the first chunk to be uploaded. + * @param {string} [uploadKey] The ``uploadKey`` of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. If you do not specify a value, OSS will initiate a new upload entirely. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signedS3Upload: async (accessToken: string, bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, useAcceleration?: boolean, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'bucketKey' is not null or undefined + assertParamExists('signedS3Upload', 'bucketKey', bucketKey) + // verify required parameter 'objectKey' is not null or undefined + assertParamExists('signedS3Upload', 'objectKey', objectKey) + const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3upload` + .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) + .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (parts !== undefined) { + localVarQueryParameter['parts'] = parts; + } + + if (firstPart !== undefined) { + localVarQueryParameter['firstPart'] = firstPart; + } + + if (uploadKey !== undefined) { + localVarQueryParameter['uploadKey'] = uploadKey; + } + + if (minutesExpiration !== undefined) { + localVarQueryParameter['minutesExpiration'] = minutesExpiration; + } + + if (useAcceleration !== undefined) { + localVarQueryParameter['useAcceleration'] = useAcceleration; + } + + if (xAdsAcmScopes != null) { + localVarHeaderParameter['x-ads-acm-scopes'] = String(xAdsAcmScopes); + } + + + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Replaces an object that already exists on OSS, using an OSS signed URL. The signed URL must fulfil the following conditions: - The signed URL is valid (it has not expired as yet). - It was generated with ``write`` or ``readwrite`` for the ``access`` parameter. + * @summary Replace Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {number} contentLength The size of the data contained in the request body, in bytes. + * @param {File} body The object to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [ifMatch] The current value of the ``sha1`` attribute of the object you want to replace. OSS checks the ``If-Match`` header against the ``sha1`` attribute of the object in OSS. If they match, OSS allows the object to be overwritten. Otherwise, it means that the object on OSS has been modified since you retrieved the ``sha1`` and the request fails. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadSignedResource: async (accessToken: string, hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, ifMatch?: string, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'hash' is not null or undefined + assertParamExists('uploadSignedResource', 'hash', hash) + // verify required parameter 'contentLength' is not null or undefined + assertParamExists('uploadSignedResource', 'contentLength', contentLength) + // verify required parameter 'body' is not null or undefined + assertParamExists('uploadSignedResource', 'body', body) + const localVarPath = `/oss/v2/signedresources/{hash}` + .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new URLSearchParams(); + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (contentType != null) { + localVarHeaderParameter['Content-Type'] = String(contentType); + } + + if (contentLength != null) { + localVarHeaderParameter['Content-Length'] = typeof contentLength === 'string' + ? contentLength + : JSON.stringify(contentLength); + } + + if (contentDisposition != null) { + localVarHeaderParameter['Content-Disposition'] = String(contentDisposition); + } + + if (xAdsRegion != null) { + localVarHeaderParameter['x-ads-region'] = typeof xAdsRegion === 'string' + ? xAdsRegion + : JSON.stringify(xAdsRegion); + } + + if (ifMatch != null) { + localVarHeaderParameter['If-Match'] = String(ifMatch); + } + + + if (body !== undefined) { + localVarFormParams.set('body', body as any); + } + + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Performs a resumable upload using an OSS signed URL. Use this operation to upload an object in chunks. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Upload Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} contentRange The byte range to upload, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} sessionId An ID to uniquely identify the file upload session. + * @param {File} body The chunk to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadSignedResourcesChunk: async (accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, options: ApsServiceRequestConfig = {}): Promise => { + // verify required parameter 'hash' is not null or undefined + assertParamExists('uploadSignedResourcesChunk', 'hash', hash) + // verify required parameter 'contentRange' is not null or undefined + assertParamExists('uploadSignedResourcesChunk', 'contentRange', contentRange) + // verify required parameter 'sessionId' is not null or undefined + assertParamExists('uploadSignedResourcesChunk', 'sessionId', sessionId) + // verify required parameter 'body' is not null or undefined + assertParamExists('uploadSignedResourcesChunk', 'body', body) + const localVarPath = `/oss/v2/signedresources/{hash}/resumable` + .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); + const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); + let baseOptions; + if (apsConfiguration) { + baseOptions = apsConfiguration.baseOptions; + } + + const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new URLSearchParams(); + + await setBearerAuthToObject(localVarHeaderParameter, accessToken) + + if (contentType != null) { + localVarHeaderParameter['Content-Type'] = String(contentType); + } + + if (contentRange != null) { + localVarHeaderParameter['Content-Range'] = String(contentRange); + } + + if (contentDisposition != null) { + localVarHeaderParameter['Content-Disposition'] = String(contentDisposition); + } + + if (xAdsRegion != null) { + localVarHeaderParameter['x-ads-region'] = typeof xAdsRegion === 'string' + ? xAdsRegion + : JSON.stringify(xAdsRegion); + } + + if (sessionId != null) { + localVarHeaderParameter['Session-Id'] = String(sessionId); + } + + + if (body !== undefined) { + localVarFormParams.set('body', body as any); + } + + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * ObjectsApi - functional programming interface + * @export + */ +export const ObjectsApiFp = function(sdkManager?: SdkManager) { + const localVarAxiosParamCreator = ObjectsApiAxiosParamCreator(sdkManager.apsConfiguration) + return { + /** + * Requests OSS to start reconstituting the set of objects that were uploaded using signed S3 upload URLs. You must call this operation only after all the objects have been uploaded. You can specify up to 25 objects in this operation. + * @summary Complete Batch Upload to S3 Signed URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async batchCompleteUpload(accessToken: string, bucketKey: string, requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.batchCompleteUpload(accessToken, bucketKey, requests, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Creates and returns signed URLs to download a set of objects directly from S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start download the objects before the signed URLs expire. The download itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Batch Generate Signed S3 Download URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async batchSignedS3Download(accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.batchSignedS3Download(accessToken, bucketKey, requests, publicResourceFallback, minutesExpiration, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Creates and returns signed URLs to upload a set of objects directly to S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start uploading the objects before the signed URLs expire. The upload itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. If required, you can request an array of signed URLs for each object, which lets you upload the objects in chunks. Once you upload all chunks you must call the `Complete Batch Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even if you requested a single signed URL for an object. If an upload fails after the validity period of a signed URL has elapsed, you can call this operation again to obtain fresh signed URLs. However, you must use the same ``uploadKey`` that was returned when you originally called this operation. + * @summary Batch Generate Signed S3 Upload URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {Batchsigneds3uploadObject} [requests] An array of objects representing each request for a signed upload URL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async batchSignedS3Upload(accessToken: string, bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.batchSignedS3Upload(accessToken, bucketKey, useAcceleration, minutesExpiration, requests, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Requests OSS to assemble and reconstitute the object that was uploaded using signed S3 upload URL. You must call this operation only after all parts/chunks of the object has been uploaded. + * @summary Complete Upload to S3 Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} contentType Must be ``application/json``. + * @param {Completes3uploadBody} body + * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. + * @param {string} [xAdsUserDefinedMetadata] Custom metadata to be stored with the object, which can be retrieved later on download or when retrieving object details. Must be a JSON object that is less than 100 bytes. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async completeSignedS3Upload(accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.completeSignedS3Upload(accessToken, bucketKey, objectKey, contentType, body, xAdsMetaContentType, xAdsMetaContentDisposition, xAdsMetaContentEncoding, xAdsMetaCacheControl, xAdsUserDefinedMetadata, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Creates a copy of an object within the bucket. + * @summary Copy Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} newObjName A URL-encoded human friendly name to identify the copied object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async copyTo(accessToken: string, bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.copyTo(accessToken, bucketKey, objectKey, newObjName, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Generates a signed URL that can be used to download or upload an object within the specified expiration time. If the object the signed URL points to is deleted or expires before the signed URL expires, the signed URL will no longer be valid. In addition to this operation that generates OSS signed URLs, OSS provides operations to generate S3 signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. Only the application that owns the bucket containing the object can call this operation. + * @summary Generate OSS Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {Access} [access] + * @param {boolean} [useCdn] ``true`` : Returns a Cloudfront URL to the object instead of an Autodesk URL (one that points to a location on https://developer.api.autodesk.com). Applications can interact with the Cloudfront URL exactly like with any classic public resource in OSS. They can use GET requests to download objects or PUT requests to upload objects. ``false`` : (Default) Returns an Autodesk URL (one that points to a location on https://developer.api.autodesk.com) to the object. + * @param {CreateSignedResource} [createSignedResource] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createSignedResource(accessToken: string, bucketKey: string, objectKey: string, access?: Access, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.createSignedResource(accessToken, bucketKey, objectKey, access, useCdn, createSignedResource, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Deletes an object from the bucket. + * @summary Delete Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS API Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteObject(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteObject(accessToken, bucketKey, objectKey, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Delete an object using an OSS signed URL to access it. Only applications that own the bucket containing the object can call this operation. + * @summary Delete Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteSignedResource(accessToken: string, hash: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteSignedResource(accessToken, hash, xAdsRegion, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Returns detailed information about the specified object. + * @summary Get Object Details + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {With} [_with] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: With, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Returns a list objects in the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary List Objects + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [beginsWith] Filters the results by the value you specify. Only the objects with their ``objectKey`` beginning with the specified string are returned. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getObjects(accessToken: string, bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getObjects(accessToken, bucketKey, limit, beginsWith, startAt, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Downloads an object using an OSS signed URL. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Download Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} [range] The byte range to download, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the requested data only if the ``If-None-Match`` header differs from the ETag value of the object on OSS, which indicates that the object on OSS is newer. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [acceptEncoding] The compression format your prefer to receive the data. Possible values are: - ``gzip`` - Use the gzip format **Note:** You cannot use ``Accept-Encoding:gzip`` with a Range header containing an end byte range. OSS will not honor the End byte range if ``Accept-Encoding: gzip`` header is used. + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getSignedResource(accessToken: string, hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: Region, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getSignedResource(accessToken, hash, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region, responseContentDisposition, responseContentType, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Returns an empty response body and a 200 response code if the object exists. + * @summary Check Object Existence + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {HeadObjectDetailsWithEnum} [_with] **Not applicable to this operation** The optional information you can request for. To request more than one of the following, specify this parameter multiple times in the request. Possible values: - ``createdDate`` - ``lastAccessedDate`` - ``lastModifiedDate`` - ``userDefinedMetadata`` + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async headObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.headObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Gets a signed URL to download an object directly from S3, bypassing OSS servers. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the download before the signed URL expires. The download itself can take longer. If the download fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL. Only applications that have read access to the object can call this operation. You can use range headers with the signed download URL to download the object in chunks. This ability lets you download chunks in parallel, which can result in faster downloads. If the object you want to download was uploaded in chunks and is still assembling on OSS, you will receive multiple S3 URLs instead of just one. Each URL will point to a chunk. If you prefer to receive a single URL, set the ``public-resource-fallback`` query parameter to ``true``. This setting will make OSS fallback to returning a single signed OSS URL, if assembling is still in progress. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Download URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the signed URL only if the ``If-None-Match`` header differs from the ETag value of the object on S3. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The signed URL is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseCacheControl] The value of the Cache-Control header you want to receive when you download the object using the signed URL. If you do not specify a value, the Cache-Control header defaults to the value stored with OSS. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useCdn] ``true`` : Returns a URL that points to a CloudFront edge location. ``false`` : (Default) Returns a URL that points directly to the S3 object. + * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async signedS3Download(accessToken: string, bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.signedS3Download(accessToken, bucketKey, objectKey, ifNoneMatch, ifModifiedSince, xAdsAcmScopes, responseContentType, responseContentDisposition, responseCacheControl, publicResourceFallback, minutesExpiration, useCdn, redirect, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Gets a signed URL to upload an object directly to S3, bypassing OSS servers. You can also request an array of signed URLs which lets you upload an object in chunks. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the upload before the signed URL expires. The upload itself can take longer. If the upload fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL (or an array of signed URLs as the case may be). However, you must use the same ``uploadKey`` that was returned when you originally called this operation. Only applications that own the bucket can call this operation. **Note:** Once you upload all chunks you must call the `Complete Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even when using a single signed URL. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Upload URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {number} [parts] The number of parts you intend to chunk the object for uploading. OSS will return that many signed URLs, one URL for each chunk. If you do not specify a value you\'ll get only one URL to upload the entire object. + * @param {number} [firstPart] The index of the first chunk to be uploaded. + * @param {string} [uploadKey] The ``uploadKey`` of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. If you do not specify a value, OSS will initiate a new upload entirely. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async signedS3Upload(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, useAcceleration?: boolean, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.signedS3Upload(accessToken, bucketKey, objectKey, xAdsAcmScopes, parts, firstPart, uploadKey, minutesExpiration, useAcceleration, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Replaces an object that already exists on OSS, using an OSS signed URL. The signed URL must fulfil the following conditions: - The signed URL is valid (it has not expired as yet). - It was generated with ``write`` or ``readwrite`` for the ``access`` parameter. + * @summary Replace Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {number} contentLength The size of the data contained in the request body, in bytes. + * @param {File} body The object to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [ifMatch] The current value of the ``sha1`` attribute of the object you want to replace. OSS checks the ``If-Match`` header against the ``sha1`` attribute of the object in OSS. If they match, OSS allows the object to be overwritten. Otherwise, it means that the object on OSS has been modified since you retrieved the ``sha1`` and the request fails. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async uploadSignedResource(accessToken: string, hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, ifMatch?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadSignedResource(accessToken, hash, contentLength, body, contentType, contentDisposition, xAdsRegion, ifMatch, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + /** + * Performs a resumable upload using an OSS signed URL. Use this operation to upload an object in chunks. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Upload Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} contentRange The byte range to upload, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} sessionId An ID to uniquely identify the file upload session. + * @param {File} body The chunk to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async uploadSignedResourcesChunk(accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = await localVarAxiosParamCreator.uploadSignedResourcesChunk(accessToken, hash, contentRange, sessionId, body, contentType, contentDisposition, xAdsRegion, options); + return createRequestFunction(localVarAxiosArgs, sdkManager); + }, + } +}; + +/** + * ObjectsApi - interface + * @export + * @interface ObjectsApi + */ +export interface ObjectsApiInterface { + /** + * Requests OSS to start reconstituting the set of objects that were uploaded using signed S3 upload URLs. You must call this operation only after all the objects have been uploaded. You can specify up to 25 objects in this operation. + * @summary Complete Batch Upload to S3 Signed URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + batchCompleteUpload(accessToken: string,bucketKey: string, requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig): Promise; + + /** + * Creates and returns signed URLs to download a set of objects directly from S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start download the objects before the signed URLs expire. The download itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Batch Generate Signed S3 Download URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + batchSignedS3Download(accessToken: string,bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig): Promise; + + /** + * Creates and returns signed URLs to upload a set of objects directly to S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start uploading the objects before the signed URLs expire. The upload itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. If required, you can request an array of signed URLs for each object, which lets you upload the objects in chunks. Once you upload all chunks you must call the `Complete Batch Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even if you requested a single signed URL for an object. If an upload fails after the validity period of a signed URL has elapsed, you can call this operation again to obtain fresh signed URLs. However, you must use the same ``uploadKey`` that was returned when you originally called this operation. + * @summary Batch Generate Signed S3 Upload URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {Batchsigneds3uploadObject} [requests] An array of objects representing each request for a signed upload URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + batchSignedS3Upload(accessToken: string,bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig): Promise; + + /** + * Requests OSS to assemble and reconstitute the object that was uploaded using signed S3 upload URL. You must call this operation only after all parts/chunks of the object has been uploaded. + * @summary Complete Upload to S3 Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} contentType Must be ``application/json``. + * @param {Completes3uploadBody} body + * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. + * @param {string} [xAdsUserDefinedMetadata] Custom metadata to be stored with the object, which can be retrieved later on download or when retrieving object details. Must be a JSON object that is less than 100 bytes. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + completeSignedS3Upload(accessToken: string,bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Creates a copy of an object within the bucket. + * @summary Copy Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} newObjName A URL-encoded human friendly name to identify the copied object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + copyTo(accessToken: string,bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Generates a signed URL that can be used to download or upload an object within the specified expiration time. If the object the signed URL points to is deleted or expires before the signed URL expires, the signed URL will no longer be valid. In addition to this operation that generates OSS signed URLs, OSS provides operations to generate S3 signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. Only the application that owns the bucket containing the object can call this operation. + * @summary Generate OSS Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {Access} [access] + * @param {boolean} [useCdn] ``true`` : Returns a Cloudfront URL to the object instead of an Autodesk URL (one that points to a location on https://developer.api.autodesk.com). Applications can interact with the Cloudfront URL exactly like with any classic public resource in OSS. They can use GET requests to download objects or PUT requests to upload objects. ``false`` : (Default) Returns an Autodesk URL (one that points to a location on https://developer.api.autodesk.com) to the object. + * @param {CreateSignedResource} [createSignedResource] + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + createSignedResource(accessToken: string,bucketKey: string, objectKey: string, access?: Access, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig): Promise; + + /** + * Deletes an object from the bucket. + * @summary Delete Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS API Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + deleteObject(accessToken: string,bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Delete an object using an OSS signed URL to access it. Only applications that own the bucket containing the object can call this operation. + * @summary Delete Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + deleteSignedResource(accessToken: string,hash: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise; + + /** + * Returns detailed information about the specified object. + * @summary Get Object Details + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {With} [_with] + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + getObjectDetails(accessToken: string,bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: With, options?: ApsServiceRequestConfig): Promise; + + /** + * Returns a list objects in the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary List Objects + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [beginsWith] Filters the results by the value you specify. Only the objects with their ``objectKey`` beginning with the specified string are returned. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + getObjects(accessToken: string,bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Downloads an object using an OSS signed URL. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Download Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} [range] The byte range to download, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the requested data only if the ``If-None-Match`` header differs from the ETag value of the object on OSS, which indicates that the object on OSS is newer. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [acceptEncoding] The compression format your prefer to receive the data. Possible values are: - ``gzip`` - Use the gzip format **Note:** You cannot use ``Accept-Encoding:gzip`` with a Range header containing an end byte range. OSS will not honor the End byte range if ``Accept-Encoding: gzip`` header is used. + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + getSignedResource(accessToken: string,hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: Region, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Returns an empty response body and a 200 response code if the object exists. + * @summary Check Object Existence + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {HeadObjectDetailsWithEnum} [_with] **Not applicable to this operation** The optional information you can request for. To request more than one of the following, specify this parameter multiple times in the request. Possible values: - ``createdDate`` - ``lastAccessedDate`` - ``lastModifiedDate`` - ``userDefinedMetadata`` + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + headObjectDetails(accessToken: string,bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig): Promise; + + /** + * Gets a signed URL to download an object directly from S3, bypassing OSS servers. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the download before the signed URL expires. The download itself can take longer. If the download fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL. Only applications that have read access to the object can call this operation. You can use range headers with the signed download URL to download the object in chunks. This ability lets you download chunks in parallel, which can result in faster downloads. If the object you want to download was uploaded in chunks and is still assembling on OSS, you will receive multiple S3 URLs instead of just one. Each URL will point to a chunk. If you prefer to receive a single URL, set the ``public-resource-fallback`` query parameter to ``true``. This setting will make OSS fallback to returning a single signed OSS URL, if assembling is still in progress. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Download URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the signed URL only if the ``If-None-Match`` header differs from the ETag value of the object on S3. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The signed URL is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseCacheControl] The value of the Cache-Control header you want to receive when you download the object using the signed URL. If you do not specify a value, the Cache-Control header defaults to the value stored with OSS. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useCdn] ``true`` : Returns a URL that points to a CloudFront edge location. ``false`` : (Default) Returns a URL that points directly to the S3 object. + * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + signedS3Download(accessToken: string,bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig): Promise; + + /** + * Gets a signed URL to upload an object directly to S3, bypassing OSS servers. You can also request an array of signed URLs which lets you upload an object in chunks. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the upload before the signed URL expires. The upload itself can take longer. If the upload fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL (or an array of signed URLs as the case may be). However, you must use the same ``uploadKey`` that was returned when you originally called this operation. Only applications that own the bucket can call this operation. **Note:** Once you upload all chunks you must call the `Complete Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even when using a single signed URL. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Upload URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {number} [parts] The number of parts you intend to chunk the object for uploading. OSS will return that many signed URLs, one URL for each chunk. If you do not specify a value you\'ll get only one URL to upload the entire object. + * @param {number} [firstPart] The index of the first chunk to be uploaded. + * @param {string} [uploadKey] The ``uploadKey`` of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. If you do not specify a value, OSS will initiate a new upload entirely. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + signedS3Upload(accessToken: string,bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, useAcceleration?: boolean, options?: ApsServiceRequestConfig): Promise; + + /** + * Replaces an object that already exists on OSS, using an OSS signed URL. The signed URL must fulfil the following conditions: - The signed URL is valid (it has not expired as yet). - It was generated with ``write`` or ``readwrite`` for the ``access`` parameter. + * @summary Replace Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {number} contentLength The size of the data contained in the request body, in bytes. + * @param {File} body The object to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [ifMatch] The current value of the ``sha1`` attribute of the object you want to replace. OSS checks the ``If-Match`` header against the ``sha1`` attribute of the object in OSS. If they match, OSS allows the object to be overwritten. Otherwise, it means that the object on OSS has been modified since you retrieved the ``sha1`` and the request fails. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + uploadSignedResource(accessToken: string,hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, ifMatch?: string, options?: ApsServiceRequestConfig): Promise; + + /** + * Performs a resumable upload using an OSS signed URL. Use this operation to upload an object in chunks. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Upload Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} contentRange The byte range to upload, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} sessionId An ID to uniquely identify the file upload session. + * @param {File} body The chunk to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApiInterface + */ + uploadSignedResourcesChunk(accessToken: string,hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig): Promise; + +} + +/** + * ObjectsApi - object-oriented interface + * @export + * @class ObjectsApi + * @extends {BaseApi} + */ +export class ObjectsApi extends BaseApi implements ObjectsApiInterface { + private logger = this.sdkManager.logger; + /** + * Requests OSS to start reconstituting the set of objects that were uploaded using signed S3 upload URLs. You must call this operation only after all the objects have been uploaded. You can specify up to 25 objects in this operation. + * @summary Complete Batch Upload to S3 Signed URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async batchCompleteUpload(accessToken: string, bucketKey: string, requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into batchCompleteUpload "); + try { + const request = await ObjectsApiFp(this.sdkManager).batchCompleteUpload(accessToken, bucketKey, requests, options); + const response = await request(this.axios); + this.logger.logInfo(`batchCompleteUpload Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`batchCompleteUpload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`batchCompleteUpload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`batchCompleteUpload Request failed with no response received: ${error.request}`); + throw new OssApiError(`batchCompleteUpload Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Creates and returns signed URLs to download a set of objects directly from S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start download the objects before the signed URLs expire. The download itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary Batch Generate Signed S3 Download URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async batchSignedS3Download(accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into batchSignedS3Download "); + try { + const request = await ObjectsApiFp(this.sdkManager).batchSignedS3Download(accessToken, bucketKey, requests, publicResourceFallback, minutesExpiration, options); + const response = await request(this.axios); + this.logger.logInfo(`batchSignedS3Download Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`batchSignedS3Download Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`batchSignedS3Download Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`batchSignedS3Download Request failed with no response received: ${error.request}`); + throw new OssApiError(`batchSignedS3Download Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Creates and returns signed URLs to upload a set of objects directly to S3. These signed URLs expire in 2 minutes by default, but you can change this duration if needed. You must start uploading the objects before the signed URLs expire. The upload itself can take longer. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. If required, you can request an array of signed URLs for each object, which lets you upload the objects in chunks. Once you upload all chunks you must call the `Complete Batch Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even if you requested a single signed URL for an object. If an upload fails after the validity period of a signed URL has elapsed, you can call this operation again to obtain fresh signed URLs. However, you must use the same ``uploadKey`` that was returned when you originally called this operation. + * @summary Batch Generate Signed S3 Upload URLs + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {Batchsigneds3uploadObject} [requests] An array of objects representing each request for a signed upload URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async batchSignedS3Upload(accessToken: string, bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into batchSignedS3Upload "); + try { + const request = await ObjectsApiFp(this.sdkManager).batchSignedS3Upload(accessToken, bucketKey, useAcceleration, minutesExpiration, requests, options); + const response = await request(this.axios); + this.logger.logInfo(`batchSignedS3Upload Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`batchSignedS3Upload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`batchSignedS3Upload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`batchSignedS3Upload Request failed with no response received: ${error.request}`); + throw new OssApiError(`batchSignedS3Upload Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Requests OSS to assemble and reconstitute the object that was uploaded using signed S3 upload URL. You must call this operation only after all parts/chunks of the object has been uploaded. + * @summary Complete Upload to S3 Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} contentType Must be ``application/json``. + * @param {Completes3uploadBody} body + * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. + * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. + * @param {string} [xAdsUserDefinedMetadata] Custom metadata to be stored with the object, which can be retrieved later on download or when retrieving object details. Must be a JSON object that is less than 100 bytes. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async completeSignedS3Upload(accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into completeSignedS3Upload "); + try { + const request = await ObjectsApiFp(this.sdkManager).completeSignedS3Upload(accessToken, bucketKey, objectKey, contentType, body, xAdsMetaContentType, xAdsMetaContentDisposition, xAdsMetaContentEncoding, xAdsMetaCacheControl, xAdsUserDefinedMetadata, options); + const response = await request(this.axios); + this.logger.logInfo(`completeSignedS3Upload Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`completeSignedS3Upload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`completeSignedS3Upload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`completeSignedS3Upload Request failed with no response received: ${error.request}`); + throw new OssApiError(`completeSignedS3Upload Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Creates a copy of an object within the bucket. + * @summary Copy Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} newObjName A URL-encoded human friendly name to identify the copied object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async copyTo(accessToken: string, bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into copyTo "); + try { + const request = await ObjectsApiFp(this.sdkManager).copyTo(accessToken, bucketKey, objectKey, newObjName, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); + const response = await request(this.axios); + this.logger.logInfo(`copyTo Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`copyTo Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`copyTo Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`copyTo Request failed with no response received: ${error.request}`); + throw new OssApiError(`copyTo Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Generates a signed URL that can be used to download or upload an object within the specified expiration time. If the object the signed URL points to is deleted or expires before the signed URL expires, the signed URL will no longer be valid. In addition to this operation that generates OSS signed URLs, OSS provides operations to generate S3 signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. Only the application that owns the bucket containing the object can call this operation. + * @summary Generate OSS Signed URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {Access} [access] + * @param {boolean} [useCdn] ``true`` : Returns a Cloudfront URL to the object instead of an Autodesk URL (one that points to a location on https://developer.api.autodesk.com). Applications can interact with the Cloudfront URL exactly like with any classic public resource in OSS. They can use GET requests to download objects or PUT requests to upload objects. ``false`` : (Default) Returns an Autodesk URL (one that points to a location on https://developer.api.autodesk.com) to the object. + * @param {CreateSignedResource} [createSignedResource] + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async createSignedResource(accessToken: string, bucketKey: string, objectKey: string, access?: Access, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into createSignedResource "); + try { + const request = await ObjectsApiFp(this.sdkManager).createSignedResource(accessToken, bucketKey, objectKey, access, useCdn, createSignedResource, options); + const response = await request(this.axios); + this.logger.logInfo(`createSignedResource Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`createSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`createSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`createSignedResource Request failed with no response received: ${error.request}`); + throw new OssApiError(`createSignedResource Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Deletes an object from the bucket. + * @summary Delete Object + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS API Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async deleteObject(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into deleteObject "); + try { + const request = await ObjectsApiFp(this.sdkManager).deleteObject(accessToken, bucketKey, objectKey, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); + const response = await request(this.axios); + this.logger.logInfo(`deleteObject Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`deleteObject Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`deleteObject Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`deleteObject Request failed with no response received: ${error.request}`); + throw new OssApiError(`deleteObject Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Delete an object using an OSS signed URL to access it. Only applications that own the bucket containing the object can call this operation. + * @summary Delete Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async deleteSignedResource(accessToken: string, hash: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into deleteSignedResource "); + try { + const request = await ObjectsApiFp(this.sdkManager).deleteSignedResource(accessToken, hash, xAdsRegion, options); + const response = await request(this.axios); + this.logger.logInfo(`deleteSignedResource Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`deleteSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`deleteSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`deleteSignedResource Request failed with no response received: ${error.request}`); + throw new OssApiError(`deleteSignedResource Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Returns detailed information about the specified object. + * @summary Get Object Details + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {With} [_with] + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async getObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: With, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into getObjectDetails "); + try { + const request = await ObjectsApiFp(this.sdkManager).getObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); + const response = await request(this.axios); + this.logger.logInfo(`getObjectDetails Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`getObjectDetails Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`getObjectDetails Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`getObjectDetails Request failed with no response received: ${error.request}`); + throw new OssApiError(`getObjectDetails Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Returns a list objects in the specified bucket. Only the application that owns the bucket can call this operation. All other applications that call this operation will receive a \"403 Forbidden\" error. + * @summary List Objects + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {number} [limit] The number of items you want per page. Acceptable values = 1-100. Default = 10. + * @param {string} [beginsWith] Filters the results by the value you specify. Only the objects with their ``objectKey`` beginning with the specified string are returned. + * @param {string} [startAt] The ID of the last item that was returned in the previous result set. It enables the system to return subsequent items starting from the next one after the specified ID. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async getObjects(accessToken: string, bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into getObjects "); + try { + const request = await ObjectsApiFp(this.sdkManager).getObjects(accessToken, bucketKey, limit, beginsWith, startAt, options); + const response = await request(this.axios); + this.logger.logInfo(`getObjects Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`getObjects Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`getObjects Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`getObjects Request failed with no response received: ${error.request}`); + throw new OssApiError(`getObjects Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Downloads an object using an OSS signed URL. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Download Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} [range] The byte range to download, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the requested data only if the ``If-None-Match`` header differs from the ETag value of the object on OSS, which indicates that the object on OSS is newer. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [acceptEncoding] The compression format your prefer to receive the data. Possible values are: - ``gzip`` - Use the gzip format **Note:** You cannot use ``Accept-Encoding:gzip`` with a Range header containing an end byte range. OSS will not honor the End byte range if ``Accept-Encoding: gzip`` header is used. + * @param {Region} [region] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async getSignedResource(accessToken: string, hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: Region, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into getSignedResource "); + try { + const request = await ObjectsApiFp(this.sdkManager).getSignedResource(accessToken, hash, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region, responseContentDisposition, responseContentType, options); + const response = await request(this.axios); + this.logger.logInfo(`getSignedResource Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`getSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`getSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`getSignedResource Request failed with no response received: ${error.request}`); + throw new OssApiError(`getSignedResource Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Returns an empty response body and a 200 response code if the object exists. + * @summary Check Object Existence + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The requested data is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. + * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of ``true``. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. + * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. + * @param {HeadObjectDetailsWithEnum} [_with] **Not applicable to this operation** The optional information you can request for. To request more than one of the following, specify this parameter multiple times in the request. Possible values: - ``createdDate`` - ``lastAccessedDate`` - ``lastModifiedDate`` - ``userDefinedMetadata`` + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async headObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into headObjectDetails "); + try { + const request = await ObjectsApiFp(this.sdkManager).headObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); + const response = await request(this.axios); + this.logger.logInfo(`headObjectDetails Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`headObjectDetails Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`headObjectDetails Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`headObjectDetails Request failed with no response received: ${error.request}`); + throw new OssApiError(`headObjectDetails Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Gets a signed URL to download an object directly from S3, bypassing OSS servers. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the download before the signed URL expires. The download itself can take longer. If the download fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL. Only applications that have read access to the object can call this operation. You can use range headers with the signed download URL to download the object in chunks. This ability lets you download chunks in parallel, which can result in faster downloads. If the object you want to download was uploaded in chunks and is still assembling on OSS, you will receive multiple S3 URLs instead of just one. Each URL will point to a chunk. If you prefer to receive a single URL, set the ``public-resource-fallback`` query parameter to ``true``. This setting will make OSS fallback to returning a single signed OSS URL, if assembling is still in progress. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Download URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [ifNoneMatch] The last known ETag value of the object. OSS returns the signed URL only if the ``If-None-Match`` header differs from the ETag value of the object on S3. If not, it returns a 304 \"Not Modified\" HTTP status. + * @param {string} [ifModifiedSince] A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). The signed URL is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {string} [responseContentType] The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. + * @param {string} [responseContentDisposition] The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. + * @param {string} [responseCacheControl] The value of the Cache-Control header you want to receive when you download the object using the signed URL. If you do not specify a value, the Cache-Control header defaults to the value stored with OSS. + * @param {boolean} [publicResourceFallback] Specifies how to return the signed URLs, in case the object was uploaded in chunks, and assembling of chunks is not yet complete. - ``true`` : Return a single signed OSS URL. - ``false`` : (Default) Return multiple signed S3 URLs, where each URL points to a chunk. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useCdn] ``true`` : Returns a URL that points to a CloudFront edge location. ``false`` : (Default) Returns a URL that points directly to the S3 object. + * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async signedS3Download(accessToken: string, bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into signedS3Download "); + try { + const request = await ObjectsApiFp(this.sdkManager).signedS3Download(accessToken, bucketKey, objectKey, ifNoneMatch, ifModifiedSince, xAdsAcmScopes, responseContentType, responseContentDisposition, responseCacheControl, publicResourceFallback, minutesExpiration, useCdn, redirect, options); + const response = await request(this.axios); + this.logger.logInfo(`signedS3Download Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`signedS3Download Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`signedS3Download Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`signedS3Download Request failed with no response received: ${error.request}`); + throw new OssApiError(`signedS3Download Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Gets a signed URL to upload an object directly to S3, bypassing OSS servers. You can also request an array of signed URLs which lets you upload an object in chunks. This signed URL expires in 2 minutes by default, but you can change this duration if needed. You must start the upload before the signed URL expires. The upload itself can take longer. If the upload fails after the validity period of the signed URL has elapsed, you can call this operation again to obtain a fresh signed URL (or an array of signed URLs as the case may be). However, you must use the same ``uploadKey`` that was returned when you originally called this operation. Only applications that own the bucket can call this operation. **Note:** Once you upload all chunks you must call the `Complete Upload to S3 Signed URL `_ operation to indicate completion. This instructs OSS to assemble the chunks and reconstitute the object on OSS. You must call this operation even when using a single signed URL. In addition to this operation that generates S3 signed URLs, OSS provides an operation to generate OSS signed URLs. S3 signed URLs allow direct upload/download from S3 but are restricted to bucket owners. OSS signed URLs also allow upload/download and can be configured for access by other applications, making them suitable for sharing objects across applications. + * @summary Generate Signed S3 Upload URL + * @param {string} bucketKey The bucket key of the bucket that contains the objects you are operating on. + * @param {string} objectKey The URL-encoded human friendly name of the object. + * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance + * @param {number} [parts] The number of parts you intend to chunk the object for uploading. OSS will return that many signed URLs, one URL for each chunk. If you do not specify a value you\'ll get only one URL to upload the entire object. + * @param {number} [firstPart] The index of the first chunk to be uploaded. + * @param {string} [uploadKey] The ``uploadKey`` of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. If you do not specify a value, OSS will initiate a new upload entirely. + * @param {number} [minutesExpiration] The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. + * @param {boolean} [useAcceleration] ``true`` : (Default) Generates a faster S3 signed URL using Transfer Acceleration. ``false``: Generates a standard S3 signed URL. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async signedS3Upload(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, useAcceleration?: boolean, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into signedS3Upload "); + try { + const request = await ObjectsApiFp(this.sdkManager).signedS3Upload(accessToken, bucketKey, objectKey, xAdsAcmScopes, parts, firstPart, uploadKey, minutesExpiration, useAcceleration, options); + const response = await request(this.axios); + this.logger.logInfo(`signedS3Upload Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`signedS3Upload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`signedS3Upload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`signedS3Upload Request failed with no response received: ${error.request}`); + throw new OssApiError(`signedS3Upload Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Replaces an object that already exists on OSS, using an OSS signed URL. The signed URL must fulfil the following conditions: - The signed URL is valid (it has not expired as yet). - It was generated with ``write`` or ``readwrite`` for the ``access`` parameter. + * @summary Replace Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {number} contentLength The size of the data contained in the request body, in bytes. + * @param {File} body The object to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param {string} [ifMatch] The current value of the ``sha1`` attribute of the object you want to replace. OSS checks the ``If-Match`` header against the ``sha1`` attribute of the object in OSS. If they match, OSS allows the object to be overwritten. Otherwise, it means that the object on OSS has been modified since you retrieved the ``sha1`` and the request fails. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async uploadSignedResource(accessToken: string, hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, ifMatch?: string, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into uploadSignedResource "); + try { + const request = await ObjectsApiFp(this.sdkManager).uploadSignedResource(accessToken, hash, contentLength, body, contentType, contentDisposition, xAdsRegion, ifMatch, options); + const response = await request(this.axios); + this.logger.logInfo(`uploadSignedResource Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`uploadSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`uploadSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`uploadSignedResource Request failed with no response received: ${error.request}`); + throw new OssApiError(`uploadSignedResource Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } + + /** + * Performs a resumable upload using an OSS signed URL. Use this operation to upload an object in chunks. **Note:** The signed URL returned by `Generate OSS Signed URL `_ contains the ``hash`` URI parameter as well. + * @summary Upload Object Using Signed URL + * @param {string} hash The ID component of the signed URL. **Note:** The signed URL returned by Generate OSS Signed URL </en/docs/data/v2/reference/http/signedresources-:id-GET/>_ contains ``hash`` as a URI parameter. + * @param {string} contentRange The byte range to upload, specified in the form ``bytes=<START_BYTE>-<END_BYTE>``. + * @param {string} sessionId An ID to uniquely identify the file upload session. + * @param {File} body The chunk to upload. + * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. + * @param {string} [contentDisposition] The suggested file name to use when this object is downloaded as a file. + * @param {Region} [xAdsRegion] Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @param accessToken bearer access token + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof ObjectsApi + */ + public async uploadSignedResourcesChunk(accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig) { + this.logger.logInfo("Entered into uploadSignedResourcesChunk "); + try { + const request = await ObjectsApiFp(this.sdkManager).uploadSignedResourcesChunk(accessToken, hash, contentRange, sessionId, body, contentType, contentDisposition, xAdsRegion, options); + const response = await request(this.axios); + this.logger.logInfo(`uploadSignedResourcesChunk Request completed successfully with status code: ${response.status}`); + return new ApiResponse(response,response.data); + } catch (error) { + if (error.response) { + this.logger.logError(`uploadSignedResourcesChunk Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); + throw new OssApiError(`uploadSignedResourcesChunk Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); + } else if (error.request) { + this.logger.logError(`uploadSignedResourcesChunk Request failed with no response received: ${error.request}`); + throw new OssApiError(`uploadSignedResourcesChunk Request failed with no response received: ${error.request}`, error); + } + throw error; + } + } +} + +/** + * @export + */ +export const HeadObjectDetailsWithEnum = { + CreatedDate: 'createdDate', + LastAccessedDate: 'lastAccessedDate', + LastModifiedDate: 'lastModifiedDate', + UserDefinedMetadata: 'userDefinedMetadata' +} as const; +export type HeadObjectDetailsWithEnum = typeof HeadObjectDetailsWithEnum[keyof typeof HeadObjectDetailsWithEnum]; diff --git a/oss/source/api/ossapi.ts b/oss/source/api/ossapi.ts deleted file mode 100644 index ad710d5..0000000 --- a/oss/source/api/ossapi.ts +++ /dev/null @@ -1,2629 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import type { AxiosPromise, AxiosInstance } from 'axios'; -import {ApsServiceRequestConfig, IApsConfiguration, SdkManager, ApiResponse} from "@aps_sdk/autodesk-sdkmanager"; -import { assertParamExists, setBearerAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; -import { COLLECTION_FORMATS, RequestArgs, BaseApi, RequiredError, OssApiError } from '../base'; -import { BatchcompleteuploadObject } from '../model'; -import { BatchcompleteuploadResponse } from '../model'; -import { Batchsigneds3downloadObject } from '../model'; -import { Batchsigneds3downloadResponse } from '../model'; -import { Batchsigneds3uploadObject } from '../model'; -import { Batchsigneds3uploadResponse } from '../model'; -import { Bucket } from '../model'; -import { BucketObjects } from '../model'; -import { Buckets } from '../model'; -import { Completes3uploadBody } from '../model'; -import { CreateBucketsPayload } from '../model'; -import { CreateObjectSigned } from '../model'; -import { CreateSignedResource } from '../model'; -import { ObjectDetails } from '../model'; -import { ObjectFullDetails } from '../model'; -import { Reason } from '../model'; -import { Result } from '../model'; -import { Signeds3downloadResponse } from '../model'; -import { Signeds3uploadResponse } from '../model'; -/** - * OSSApi - axios parameter creator - * @export - */ -export const OSSApiAxiosParamCreator = function (apsConfiguration?: IApsConfiguration) { - return { - /** - * Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. An object will not be accessible until you complete the object creation process, either with this endpoint or the single Complete Upload endpoint. This endpoint accepts batch sizes of up to 25. Any larger and the request will fail. - * @param {string} bucketKey URL-encoded bucket key - * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - batchCompleteUpload: async (accessToken: string, bucketKey: string, requests?: BatchcompleteuploadObject, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('batchCompleteUpload', 'bucketKey', bucketKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/batchcompleteupload` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(requests, localVarRequestOptions, apsConfiguration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Gets one or more signed URLs to download objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer of the data can exceed 60 seconds. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. - * @param {boolean} [publicResourceFallback] Indicates that for each requested object, OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - batchSignedS3Download: async (accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('batchSignedS3Download', 'bucketKey', bucketKey) - // verify required parameter 'requests' is not null or undefined - assertParamExists('batchSignedS3Download', 'requests', requests) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/batchsigneds3download` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (publicResourceFallback !== undefined) { - localVarQueryParameter['public-resource-fallback'] = publicResourceFallback; - } - - if (minutesExpiration !== undefined) { - localVarQueryParameter['minutesExpiration'] = minutesExpiration; - } - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(requests, localVarRequestOptions, apsConfiguration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. As with the Batch Get Download URL endpoint, the requests within the batch are evaluated independently and individual requests can be rejected even if the overall request returns a 200 response code. You can request a maximum of 25 URLs in a single request. - * @param {string} bucketKey URL-encoded bucket key - * @param {boolean} [useAcceleration] Whether or not to generate an accelerated signed URL (ie: URLs of the form ...s3-accelerate.amazonaws.com... vs ...s3.amazonaws.com...). When not specified, defaults to true. Providing non-boolean values will result in a 400 error. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {Batchsigneds3uploadObject} [requests] An array of objects, each of which represents a signed URL / URLs to retrieve. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - batchSignedS3Upload: async (accessToken: string, bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('batchSignedS3Upload', 'bucketKey', bucketKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/batchsigneds3upload` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (useAcceleration !== undefined) { - localVarQueryParameter['useAcceleration'] = useAcceleration; - } - - if (minutesExpiration !== undefined) { - localVarQueryParameter['minutesExpiration'] = minutesExpiration; - } - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(requests, localVarRequestOptions, apsConfiguration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} contentType Must be exactly `application/json`. - * @param {Completes3uploadBody} body - * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. - * @param {string} [xAdsUserDefinedMetadata] This parameter allows setting any custom metadata to be stored with the object, which can be retrieved later on download or when getting the object details. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - completeSignedS3Upload: async (accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('completeSignedS3Upload', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('completeSignedS3Upload', 'objectKey', objectKey) - // verify required parameter 'contentType' is not null or undefined - assertParamExists('completeSignedS3Upload', 'contentType', contentType) - // verify required parameter 'body' is not null or undefined - assertParamExists('completeSignedS3Upload', 'body', body) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3upload` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (contentType != null) { - localVarHeaderParameter['Content-Type'] = String(contentType); - } - - if (xAdsMetaContentType != null) { - localVarHeaderParameter['x-ads-meta-Content-Type'] = String(xAdsMetaContentType); - } - - if (xAdsMetaContentDisposition != null) { - localVarHeaderParameter['x-ads-meta-Content-Disposition'] = String(xAdsMetaContentDisposition); - } - - if (xAdsMetaContentEncoding != null) { - localVarHeaderParameter['x-ads-meta-Content-Encoding'] = String(xAdsMetaContentEncoding); - } - - if (xAdsMetaCacheControl != null) { - localVarHeaderParameter['x-ads-meta-Cache-Control'] = String(xAdsMetaCacheControl); - } - - if (xAdsUserDefinedMetadata != null) { - localVarHeaderParameter['x-ads-user-defined-metadata'] = String(xAdsUserDefinedMetadata); - } - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(body, localVarRequestOptions, apsConfiguration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Copies an object to another object name in the same bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} newObjName URL-encoded Object key to use as the destination - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - copyTo: async (accessToken: string, bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('copyTo', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('copyTo', 'objectKey', objectKey) - // verify required parameter 'newObjName' is not null or undefined - assertParamExists('copyTo', 'newObjName', newObjName) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/copyto/{newObjName}` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))) - .replace(`{${"newObjName"}}`, encodeURIComponent(String(newObjName))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (xAdsAcmNamespace != null) { - localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); - } - - if (xAdsAcmCheckGroups != null) { - localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); - } - - if (xAdsAcmGroups != null) { - localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. - * @param {CreateBucketXAdsRegionEnum} xAdsRegion The region where the bucket resides Acceptable values: `US`, `EMEA` - * @param {CreateBucketsPayload} policyKey Length of time for objects in the bucket to exist; `transient` (24h), `temporary` (30d), or `persistent` (until delete request). - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createBucket: async (accessToken: string, xAdsRegion: CreateBucketXAdsRegionEnum, policyKey: CreateBucketsPayload, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'xAdsRegion' is not null or undefined - assertParamExists('createBucket', 'xAdsRegion', xAdsRegion) - // verify required parameter 'policyKey' is not null or undefined - assertParamExists('createBucket', 'policyKey', policyKey) - const localVarPath = `/oss/v2/buckets`; - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (xAdsRegion != null) { - localVarHeaderParameter['x-ads-region'] = String(xAdsRegion); - } - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(policyKey, localVarRequestOptions, apsConfiguration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {CreateSignedResourceAccessEnum} [access] Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` - * @param {boolean} [useCdn] When this is provided, OSS will return a URL that does not point to https://developer.api.autodesk.com.... , but instead points towards an alternate domain. A client can then interact with this public resource exactly as they would for a classic public resource in OSS, i.e. make a GET request to download an object or a PUT request to upload an object. - * @param {CreateSignedResource} [createSignedResource] - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - createSignedResource: async (accessToken: string, bucketKey: string, objectKey: string, access?: CreateSignedResourceAccessEnum, useCdn?: boolean, createSignedResource?: CreateSignedResource, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('createSignedResource', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('createSignedResource', 'objectKey', objectKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signed` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (access !== undefined) { - localVarQueryParameter['access'] = access; - } - - if (useCdn !== undefined) { - localVarQueryParameter['useCdn'] = useCdn; - } - - - - localVarHeaderParameter['Content-Type'] = 'application/json'; - localVarHeaderParameter['User-Agent'] = 'APS SDK/OSS/TypeScript/1.0.0'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(createSignedResource, localVarRequestOptions, apsConfiguration) - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Delete the bucket with the specified key - * @param {string} bucketKey URL-encoded bucket key - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteBucket: async (accessToken: string, bucketKey: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('deleteBucket', 'bucketKey', bucketKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Deletes an object from the bucket. - * @param {string} bucketKey URL-encoded key of the bucket containing the object. - * @param {string} objectKey URL-encoded key of the object to delete. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteObject: async (accessToken: string, bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('deleteObject', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('deleteObject', 'objectKey', objectKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (xAdsAcmNamespace != null) { - localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); - } - - if (xAdsAcmCheckGroups != null) { - localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); - } - - if (xAdsAcmGroups != null) { - localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Delete a signed URL. A successful call to this endpoint requires bucket owner access. - * @param {string} hash Hash of signed resource - * @param {DeleteSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - deleteSignedResource: async (accessToken: string, hash: string, region?: DeleteSignedResourceRegionEnum, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'hash' is not null or undefined - assertParamExists('deleteSignedResource', 'hash', hash) - const localVarPath = `/oss/v2/signedresources/{hash}` - .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (region !== undefined) { - localVarQueryParameter['region'] = region; - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * This endpoint will return the details about the specified bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getBucketDetails: async (accessToken: string, bucketKey: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('getBucketDetails', 'bucketKey', bucketKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/details` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * This endpoint will return the buckets owned by the application. This endpoint supports pagination. - * @param {GetBucketsRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [startAt] Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getBuckets: async (accessToken: string, region?: GetBucketsRegionEnum, limit?: number, startAt?: string, options: ApsServiceRequestConfig = {}): Promise => { - const localVarPath = `/oss/v2/buckets`; - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (region !== undefined) { - localVarQueryParameter['region'] = region; - } - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (startAt !== undefined) { - localVarQueryParameter['startAt'] = startAt; - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns object details in JSON format. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {GetObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate`, `userDefinedMetadata` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getObjectDetails: async (accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: GetObjectDetailsWithEnum, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('getObjectDetails', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('getObjectDetails', 'objectKey', objectKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/details` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (_with !== undefined) { - localVarQueryParameter['with'] = _with; - } - - if (ifModifiedSince != null) { - localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' - ? ifModifiedSince - : JSON.stringify(ifModifiedSince); - } - - if (xAdsAcmNamespace != null) { - localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); - } - - if (xAdsAcmCheckGroups != null) { - localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); - } - - if (xAdsAcmGroups != null) { - localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * List objects in a bucket. It is only available to the bucket creator. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [beginsWith] Provides a way to filter the based on object key name - * @param {string} [startAt] Key to use as an offset to continue pagination. This is typically the last bucket key found in a preceding GET buckets response - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getObjects: async (accessToken: string, bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('getObjects', 'bucketKey', bucketKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (limit !== undefined) { - localVarQueryParameter['limit'] = limit; - } - - if (beginsWith !== undefined) { - localVarQueryParameter['beginsWith'] = beginsWith; - } - - if (startAt !== undefined) { - localVarQueryParameter['startAt'] = startAt; - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Download an object using a signed URL. - * @param {string} hash Hash of signed resource - * @param {string} [range] A range of bytes to download from the specified object. - * @param {string} [ifNoneMatch] The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [acceptEncoding] When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. - * @param {GetSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [responseContentDisposition] Value of the Content-Disposition HTTP header you expect to receive. If the parameter is not provided, the value associated with the object is used. - * @param {string} [responseContentType] Value of the Content-Type HTTP header you expect to receive in the download response. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getSignedResource: async (accessToken: string, hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: GetSignedResourceRegionEnum, responseContentDisposition?: string, responseContentType?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'hash' is not null or undefined - assertParamExists('getSignedResource', 'hash', hash) - const localVarPath = `/oss/v2/signedresources/{hash}` - .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (region !== undefined) { - localVarQueryParameter['region'] = region; - } - - if (responseContentDisposition !== undefined) { - localVarQueryParameter['response-content-disposition'] = responseContentDisposition; - } - - if (responseContentType !== undefined) { - localVarQueryParameter['response-content-type'] = responseContentType; - } - - if (range != null) { - localVarHeaderParameter['Range'] = String(range); - } - - if (ifNoneMatch != null) { - localVarHeaderParameter['If-None-Match'] = String(ifNoneMatch); - } - - if (ifModifiedSince != null) { - localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' - ? ifModifiedSince - : JSON.stringify(ifModifiedSince); - } - - if (acceptEncoding != null) { - localVarHeaderParameter['Accept-Encoding'] = String(acceptEncoding); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Returns an empty response body and a 200 response code if the object exists. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {HeadObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - headObjectDetails: async (accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('headObjectDetails', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('headObjectDetails', 'objectKey', objectKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/details` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'HEAD', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (_with !== undefined) { - localVarQueryParameter['with'] = _with; - } - - if (ifModifiedSince != null) { - localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' - ? ifModifiedSince - : JSON.stringify(ifModifiedSince); - } - - if (xAdsAcmNamespace != null) { - localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); - } - - if (xAdsAcmCheckGroups != null) { - localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); - } - - if (xAdsAcmGroups != null) { - localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Upload an object to this bucket using the body of a POST request, as multipart form data. If during the upload, OSS determines that the combination of bucket key + object key already exists, then the uploaded content will overwrite the existing object. Even if it is possible to upload multiple files in the same request, it is better to create one request for each and paralellize the uploads. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} contentLength Indicates the size of the request body. Since the multipart type is complex, this is usually computed after building the body and getting its length. - * @param {string} xAdsObjectName The key of the object being uploaded. Must be URL-encoded, and it must be 3-1024 characters including any UTF-8 encoding for foreign character support. If an object with this key already exists in the bucket, the object will be overwritten. - * @param {number} xAdsObjectSize The size in bytes of the file to upload. - * @param {string} [contentType] Must be the multipart type followed by the boundary used; example: \'multipart/form-data, boundary=AaB03x\'. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {string} [xAdsMetaCacheControl] The value of this header will be stored with the uploaded object. The value will be used as the \'Cache-Control\' header in the response when the object is downloaded. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - postUpload: async (accessToken: string, bucketKey: string, contentLength: number, xAdsObjectName: string, xAdsObjectSize: number, contentType?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, xAdsMetaCacheControl?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('postUpload', 'bucketKey', bucketKey) - // verify required parameter 'contentLength' is not null or undefined - assertParamExists('postUpload', 'contentLength', contentLength) - // verify required parameter 'xAdsObjectName' is not null or undefined - assertParamExists('postUpload', 'xAdsObjectName', xAdsObjectName) - // verify required parameter 'xAdsObjectSize' is not null or undefined - assertParamExists('postUpload', 'xAdsObjectSize', xAdsObjectSize) - const localVarPath = `/oss/v2/buckets/{bucketKey}` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (contentType != null) { - localVarHeaderParameter['Content-Type'] = String(contentType); - } - - if (contentLength != null) { - localVarHeaderParameter['Content-Length'] = typeof contentLength === 'string' - ? contentLength - : JSON.stringify(contentLength); - } - - if (xAdsObjectName != null) { - localVarHeaderParameter['x-ads-object-name'] = String(xAdsObjectName); - } - - if (xAdsObjectSize != null) { - localVarHeaderParameter['x-ads-object-size'] = typeof xAdsObjectSize === 'string' - ? xAdsObjectSize - : JSON.stringify(xAdsObjectSize); - } - - if (xAdsAcmNamespace != null) { - localVarHeaderParameter['x-ads-acm-namespace'] = String(xAdsAcmNamespace); - } - - if (xAdsAcmCheckGroups != null) { - localVarHeaderParameter['x-ads-acm-check-groups'] = String(xAdsAcmCheckGroups); - } - - if (xAdsAcmGroups != null) { - localVarHeaderParameter['x-ads-acm-groups'] = String(xAdsAcmGroups); - } - - if (xAdsMetaCacheControl != null) { - localVarHeaderParameter['x-ads-meta-Cache-Control'] = String(xAdsMetaCacheControl); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Gets a signed URL to a download an object directly from S3, bypassing OSS servers. This signed URL expires in 60 seconds, so the request must begin within that time frame; the actual data transfer can take longer. Note that resumable uploads store each chunk individually; after the upload completes, an async process merges all the chunks and creates the definitive OSS file. If you request a signed URL before the async process completes, the response returns a map of S3 URLs, one per chunk; the key is the byte range of the total file to which the chunk corresponds. If you need a single URL in the response, you can use OSS signed resource functionality by setting the \'public-resource-fallback\' query parameter to true. Lastly, note that ranged downloads can be used with the returned URL. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [ifNoneMatch] If the value of this header matches the ETag of the object, an entity will not be returned from the server; instead a 304 (not modified) response will be returned without any message-body. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {string} [responseContentType] Value of the Content-Type header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseContentDisposition] Value of the Content-Disposition header that the client expects to receive. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseCacheControl] Value of the Cache-Control header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {boolean} [publicResourceFallback] Indicates that OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {boolean} [useCdn] This will generate a CloudFront URL for the S3 object. - * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - signedS3Download: async (accessToken: string, bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('signedS3Download', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('signedS3Download', 'objectKey', objectKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3download` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (responseContentType !== undefined) { - localVarQueryParameter['response-content-type'] = responseContentType; - } - - if (responseContentDisposition !== undefined) { - localVarQueryParameter['response-content-disposition'] = responseContentDisposition; - } - - if (responseCacheControl !== undefined) { - localVarQueryParameter['response-cache-control'] = responseCacheControl; - } - - if (publicResourceFallback !== undefined) { - localVarQueryParameter['public-resource-fallback'] = publicResourceFallback; - } - - if (minutesExpiration !== undefined) { - localVarQueryParameter['minutesExpiration'] = minutesExpiration; - } - - if (useCdn !== undefined) { - localVarQueryParameter['useCdn'] = useCdn; - } - - if (redirect !== undefined) { - localVarQueryParameter['redirect'] = redirect; - } - - if (ifNoneMatch != null) { - localVarHeaderParameter['If-None-Match'] = String(ifNoneMatch); - } - - if (ifModifiedSince != null) { - localVarHeaderParameter['If-Modified-Since'] = typeof ifModifiedSince === 'string' - ? ifModifiedSince - : JSON.stringify(ifModifiedSince); - } - - if (xAdsAcmScopes != null) { - localVarHeaderParameter['x-ads-acm-scopes'] = String(xAdsAcmScopes); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Gets a signed URL to upload an object in a single request, or an array of signed URLs with which to upload an object in multiple parts. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {number} [parts] For a multipart upload, the number of chunk upload URLs to return. If X is provided, the response will include chunk URLs from 1 to X. If none provided, the response will include only a single URL with which to upload an entire object. - * @param {number} [firstPart] Index of first part in the parts collection. - * @param {string} [uploadKey] The identifier of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. This must match the `uploadKey` returned by a previous call to this endpoint where the client requested more than one part URL. If none provided, OSS will initiate a new upload entirely. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - signedS3Upload: async (accessToken: string, bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'bucketKey' is not null or undefined - assertParamExists('signedS3Upload', 'bucketKey', bucketKey) - // verify required parameter 'objectKey' is not null or undefined - assertParamExists('signedS3Upload', 'objectKey', objectKey) - const localVarPath = `/oss/v2/buckets/{bucketKey}/objects/{objectKey}/signeds3upload` - .replace(`{${"bucketKey"}}`, encodeURIComponent(String(bucketKey))) - .replace(`{${"objectKey"}}`, encodeURIComponent(String(objectKey))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (parts !== undefined) { - localVarQueryParameter['parts'] = parts; - } - - if (firstPart !== undefined) { - localVarQueryParameter['firstPart'] = firstPart; - } - - if (uploadKey !== undefined) { - localVarQueryParameter['uploadKey'] = uploadKey; - } - - if (minutesExpiration !== undefined) { - localVarQueryParameter['minutesExpiration'] = minutesExpiration; - } - - if (xAdsAcmScopes != null) { - localVarHeaderParameter['x-ads-acm-scopes'] = String(xAdsAcmScopes); - } - - - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Upload an object using a signed URL. If the signed resource is available and its expiration period is valid, you can overwrite the existing object via a signed URL upload using the \'access\' query parameter with value \'write\' or \'readwrite\'. - * @param {string} hash Hash of signed resource - * @param {number} contentLength Indicates the size of the request body. - * @param {File} body The object to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourceXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [ifMatch] If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - uploadSignedResource: async (accessToken: string, hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourceXAdsRegionEnum, ifMatch?: string, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'hash' is not null or undefined - assertParamExists('uploadSignedResource', 'hash', hash) - // verify required parameter 'contentLength' is not null or undefined - assertParamExists('uploadSignedResource', 'contentLength', contentLength) - // verify required parameter 'body' is not null or undefined - assertParamExists('uploadSignedResource', 'body', body) - const localVarPath = `/oss/v2/signedresources/{hash}` - .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new URLSearchParams(); - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (contentType != null) { - localVarHeaderParameter['Content-Type'] = String(contentType); - } - - if (contentLength != null) { - localVarHeaderParameter['Content-Length'] = typeof contentLength === 'string' - ? contentLength - : JSON.stringify(contentLength); - } - - if (contentDisposition != null) { - localVarHeaderParameter['Content-Disposition'] = String(contentDisposition); - } - - if (xAdsRegion != null) { - localVarHeaderParameter['x-ads-region'] = String(xAdsRegion); - } - - if (ifMatch != null) { - localVarHeaderParameter['If-Match'] = String(ifMatch); - } - - - if (body !== undefined) { - localVarFormParams.set('body', body as any); - } - - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = localVarFormParams.toString(); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - /** - * Resumable upload for signed URLs. - * @param {string} hash Hash of the signed resource - * @param {string} contentRange Byte range of a segment being uploaded - * @param {string} sessionId Unique identifier of a session of a file being uploaded - * @param {File} body The chunk to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourcesChunkXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - uploadSignedResourcesChunk: async (accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourcesChunkXAdsRegionEnum, options: ApsServiceRequestConfig = {}): Promise => { - // verify required parameter 'hash' is not null or undefined - assertParamExists('uploadSignedResourcesChunk', 'hash', hash) - // verify required parameter 'contentRange' is not null or undefined - assertParamExists('uploadSignedResourcesChunk', 'contentRange', contentRange) - // verify required parameter 'sessionId' is not null or undefined - assertParamExists('uploadSignedResourcesChunk', 'sessionId', sessionId) - // verify required parameter 'body' is not null or undefined - assertParamExists('uploadSignedResourcesChunk', 'body', body) - const localVarPath = `/oss/v2/signedresources/{hash}/resumable` - .replace(`{${"hash"}}`, encodeURIComponent(String(hash))); - const localVarUrlObj = new URL(localVarPath, apsConfiguration.baseAddress); - let baseOptions; - if (apsConfiguration) { - baseOptions = apsConfiguration.baseOptions; - } - - const localVarRequestOptions = { method: 'PUT', ...baseOptions, ...options}; - const localVarHeaderParameter = {} as any; - const localVarQueryParameter = {} as any; - const localVarFormParams = new URLSearchParams(); - - await setBearerAuthToObject(localVarHeaderParameter, accessToken) - - if (contentType != null) { - localVarHeaderParameter['Content-Type'] = String(contentType); - } - - if (contentRange != null) { - localVarHeaderParameter['Content-Range'] = String(contentRange); - } - - if (contentDisposition != null) { - localVarHeaderParameter['Content-Disposition'] = String(contentDisposition); - } - - if (xAdsRegion != null) { - localVarHeaderParameter['x-ads-region'] = String(xAdsRegion); - } - - if (sessionId != null) { - localVarHeaderParameter['Session-Id'] = String(sessionId); - } - - - if (body !== undefined) { - localVarFormParams.set('body', body as any); - } - - - localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; - - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = localVarFormParams.toString(); - - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } -}; - -/** - * OSSApi - functional programming interface - * @export - */ -export const OSSApiFp = function(sdkManager?: SdkManager) { - const localVarAxiosParamCreator = OSSApiAxiosParamCreator(sdkManager.apsConfiguration) - return { - /** - * Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. An object will not be accessible until you complete the object creation process, either with this endpoint or the single Complete Upload endpoint. This endpoint accepts batch sizes of up to 25. Any larger and the request will fail. - * @param {string} bucketKey URL-encoded bucket key - * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async batchCompleteUpload(accessToken: string, bucketKey: string, requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.batchCompleteUpload(accessToken, bucketKey, requests, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Gets one or more signed URLs to download objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer of the data can exceed 60 seconds. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. - * @param {boolean} [publicResourceFallback] Indicates that for each requested object, OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async batchSignedS3Download(accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.batchSignedS3Download(accessToken, bucketKey, requests, publicResourceFallback, minutesExpiration, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. As with the Batch Get Download URL endpoint, the requests within the batch are evaluated independently and individual requests can be rejected even if the overall request returns a 200 response code. You can request a maximum of 25 URLs in a single request. - * @param {string} bucketKey URL-encoded bucket key - * @param {boolean} [useAcceleration] Whether or not to generate an accelerated signed URL (ie: URLs of the form ...s3-accelerate.amazonaws.com... vs ...s3.amazonaws.com...). When not specified, defaults to true. Providing non-boolean values will result in a 400 error. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {Batchsigneds3uploadObject} [requests] An array of objects, each of which represents a signed URL / URLs to retrieve. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async batchSignedS3Upload(accessToken: string, bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.batchSignedS3Upload(accessToken, bucketKey, useAcceleration, minutesExpiration, requests, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} contentType Must be exactly `application/json`. - * @param {Completes3uploadBody} body - * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. - * @param {string} [xAdsUserDefinedMetadata] This parameter allows setting any custom metadata to be stored with the object, which can be retrieved later on download or when getting the object details. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async completeSignedS3Upload(accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.completeSignedS3Upload(accessToken, bucketKey, objectKey, contentType, body, xAdsMetaContentType, xAdsMetaContentDisposition, xAdsMetaContentEncoding, xAdsMetaCacheControl, xAdsUserDefinedMetadata, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Copies an object to another object name in the same bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} newObjName URL-encoded Object key to use as the destination - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async copyTo(accessToken: string, bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.copyTo(accessToken, bucketKey, objectKey, newObjName, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. - * @param {CreateBucketXAdsRegionEnum} xAdsRegion The region where the bucket resides Acceptable values: `US`, `EMEA` - * @param {CreateBucketsPayload} policyKey Length of time for objects in the bucket to exist; `transient` (24h), `temporary` (30d), or `persistent` (until delete request). - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createBucket(accessToken: string, xAdsRegion: CreateBucketXAdsRegionEnum, policyKey: CreateBucketsPayload, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createBucket(accessToken, xAdsRegion, policyKey, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {CreateSignedResourceAccessEnum} [access] Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` - * @param {boolean} [useCdn] When this is provided, OSS will return a URL that does not point to https://developer.api.autodesk.com.... , but instead points towards an alternate domain. A client can then interact with this public resource exactly as they would for a classic public resource in OSS, i.e. make a GET request to download an object or a PUT request to upload an object. - * @param {CreateSignedResource} [createSignedResource] - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async createSignedResource(accessToken: string, bucketKey: string, objectKey: string, access?: CreateSignedResourceAccessEnum, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.createSignedResource(accessToken, bucketKey, objectKey, access, useCdn, createSignedResource, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Delete the bucket with the specified key - * @param {string} bucketKey URL-encoded bucket key - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteBucket(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteBucket(accessToken, bucketKey, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Deletes an object from the bucket. - * @param {string} bucketKey URL-encoded key of the bucket containing the object. - * @param {string} objectKey URL-encoded key of the object to delete. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteObject(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteObject(accessToken, bucketKey, objectKey, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Delete a signed URL. A successful call to this endpoint requires bucket owner access. - * @param {string} hash Hash of signed resource - * @param {DeleteSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async deleteSignedResource(accessToken: string, hash: string, region?: DeleteSignedResourceRegionEnum, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.deleteSignedResource(accessToken, hash, region, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * This endpoint will return the details about the specified bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getBucketDetails(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getBucketDetails(accessToken, bucketKey, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * This endpoint will return the buckets owned by the application. This endpoint supports pagination. - * @param {GetBucketsRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [startAt] Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getBuckets(accessToken: string, region?: GetBucketsRegionEnum, limit?: number, startAt?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getBuckets(accessToken, region, limit, startAt, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Returns object details in JSON format. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {GetObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate`, `userDefinedMetadata` - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: GetObjectDetailsWithEnum, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * List objects in a bucket. It is only available to the bucket creator. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [beginsWith] Provides a way to filter the based on object key name - * @param {string} [startAt] Key to use as an offset to continue pagination. This is typically the last bucket key found in a preceding GET buckets response - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getObjects(accessToken: string, bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getObjects(accessToken, bucketKey, limit, beginsWith, startAt, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Download an object using a signed URL. - * @param {string} hash Hash of signed resource - * @param {string} [range] A range of bytes to download from the specified object. - * @param {string} [ifNoneMatch] The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [acceptEncoding] When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. - * @param {GetSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [responseContentDisposition] Value of the Content-Disposition HTTP header you expect to receive. If the parameter is not provided, the value associated with the object is used. - * @param {string} [responseContentType] Value of the Content-Type HTTP header you expect to receive in the download response. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getSignedResource(accessToken: string, hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: GetSignedResourceRegionEnum, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getSignedResource(accessToken, hash, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region, responseContentDisposition, responseContentType, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Returns an empty response body and a 200 response code if the object exists. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {HeadObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async headObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.headObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Upload an object to this bucket using the body of a POST request, as multipart form data. If during the upload, OSS determines that the combination of bucket key + object key already exists, then the uploaded content will overwrite the existing object. Even if it is possible to upload multiple files in the same request, it is better to create one request for each and paralellize the uploads. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} contentLength Indicates the size of the request body. Since the multipart type is complex, this is usually computed after building the body and getting its length. - * @param {string} xAdsObjectName The key of the object being uploaded. Must be URL-encoded, and it must be 3-1024 characters including any UTF-8 encoding for foreign character support. If an object with this key already exists in the bucket, the object will be overwritten. - * @param {number} xAdsObjectSize The size in bytes of the file to upload. - * @param {string} [contentType] Must be the multipart type followed by the boundary used; example: \'multipart/form-data, boundary=AaB03x\'. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {string} [xAdsMetaCacheControl] The value of this header will be stored with the uploaded object. The value will be used as the \'Cache-Control\' header in the response when the object is downloaded. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async postUpload(accessToken: string, bucketKey: string, contentLength: number, xAdsObjectName: string, xAdsObjectSize: number, contentType?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, xAdsMetaCacheControl?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.postUpload(accessToken, bucketKey, contentLength, xAdsObjectName, xAdsObjectSize, contentType, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, xAdsMetaCacheControl, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Gets a signed URL to a download an object directly from S3, bypassing OSS servers. This signed URL expires in 60 seconds, so the request must begin within that time frame; the actual data transfer can take longer. Note that resumable uploads store each chunk individually; after the upload completes, an async process merges all the chunks and creates the definitive OSS file. If you request a signed URL before the async process completes, the response returns a map of S3 URLs, one per chunk; the key is the byte range of the total file to which the chunk corresponds. If you need a single URL in the response, you can use OSS signed resource functionality by setting the \'public-resource-fallback\' query parameter to true. Lastly, note that ranged downloads can be used with the returned URL. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [ifNoneMatch] If the value of this header matches the ETag of the object, an entity will not be returned from the server; instead a 304 (not modified) response will be returned without any message-body. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {string} [responseContentType] Value of the Content-Type header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseContentDisposition] Value of the Content-Disposition header that the client expects to receive. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseCacheControl] Value of the Cache-Control header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {boolean} [publicResourceFallback] Indicates that OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {boolean} [useCdn] This will generate a CloudFront URL for the S3 object. - * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async signedS3Download(accessToken: string, bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.signedS3Download(accessToken, bucketKey, objectKey, ifNoneMatch, ifModifiedSince, xAdsAcmScopes, responseContentType, responseContentDisposition, responseCacheControl, publicResourceFallback, minutesExpiration, useCdn, redirect, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Gets a signed URL to upload an object in a single request, or an array of signed URLs with which to upload an object in multiple parts. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {number} [parts] For a multipart upload, the number of chunk upload URLs to return. If X is provided, the response will include chunk URLs from 1 to X. If none provided, the response will include only a single URL with which to upload an entire object. - * @param {number} [firstPart] Index of first part in the parts collection. - * @param {string} [uploadKey] The identifier of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. This must match the `uploadKey` returned by a previous call to this endpoint where the client requested more than one part URL. If none provided, OSS will initiate a new upload entirely. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async signedS3Upload(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.signedS3Upload(accessToken, bucketKey, objectKey, xAdsAcmScopes, parts, firstPart, uploadKey, minutesExpiration, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Upload an object using a signed URL. If the signed resource is available and its expiration period is valid, you can overwrite the existing object via a signed URL upload using the \'access\' query parameter with value \'write\' or \'readwrite\'. - * @param {string} hash Hash of signed resource - * @param {number} contentLength Indicates the size of the request body. - * @param {File} body The object to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourceXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [ifMatch] If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async uploadSignedResource(accessToken: string, hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourceXAdsRegionEnum, ifMatch?: string, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.uploadSignedResource(accessToken, hash, contentLength, body, contentType, contentDisposition, xAdsRegion, ifMatch, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - /** - * Resumable upload for signed URLs. - * @param {string} hash Hash of the signed resource - * @param {string} contentRange Byte range of a segment being uploaded - * @param {string} sessionId Unique identifier of a session of a file being uploaded - * @param {File} body The chunk to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourcesChunkXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async uploadSignedResourcesChunk(accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourcesChunkXAdsRegionEnum, options?: ApsServiceRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.uploadSignedResourcesChunk(accessToken, hash, contentRange, sessionId, body, contentType, contentDisposition, xAdsRegion, options); - return createRequestFunction(localVarAxiosArgs, sdkManager); - }, - } -}; - -/** - * OSSApi - interface - * @export - * @interface OSSApi - */ -export interface OSSApiInterface { - /** - * Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. An object will not be accessible until you complete the object creation process, either with this endpoint or the single Complete Upload endpoint. This endpoint accepts batch sizes of up to 25. Any larger and the request will fail. - * @param {string} bucketKey URL-encoded bucket key - * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - batchCompleteUpload(accessToken: string,bucketKey: string, requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig): Promise; - - /** - * Gets one or more signed URLs to download objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer of the data can exceed 60 seconds. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. - * @param {boolean} [publicResourceFallback] Indicates that for each requested object, OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - batchSignedS3Download(accessToken: string,bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig): Promise; - - /** - * Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. As with the Batch Get Download URL endpoint, the requests within the batch are evaluated independently and individual requests can be rejected even if the overall request returns a 200 response code. You can request a maximum of 25 URLs in a single request. - * @param {string} bucketKey URL-encoded bucket key - * @param {boolean} [useAcceleration] Whether or not to generate an accelerated signed URL (ie: URLs of the form ...s3-accelerate.amazonaws.com... vs ...s3.amazonaws.com...). When not specified, defaults to true. Providing non-boolean values will result in a 400 error. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {Batchsigneds3uploadObject} [requests] An array of objects, each of which represents a signed URL / URLs to retrieve. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - batchSignedS3Upload(accessToken: string,bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig): Promise; - - /** - * Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} contentType Must be exactly `application/json`. - * @param {Completes3uploadBody} body - * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. - * @param {string} [xAdsUserDefinedMetadata] This parameter allows setting any custom metadata to be stored with the object, which can be retrieved later on download or when getting the object details. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - completeSignedS3Upload(accessToken: string,bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Copies an object to another object name in the same bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} newObjName URL-encoded Object key to use as the destination - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - copyTo(accessToken: string,bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. - * @param {CreateBucketXAdsRegionEnum} xAdsRegion The region where the bucket resides Acceptable values: `US`, `EMEA` - * @param {CreateBucketsPayload} policyKey Length of time for objects in the bucket to exist; `transient` (24h), `temporary` (30d), or `persistent` (until delete request). - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - createBucket(accessToken: string,xAdsRegion: CreateBucketXAdsRegionEnum, bucketPayload : CreateBucketsPayload, options?: ApsServiceRequestConfig): Promise; - - /** - * This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {CreateSignedResourceAccessEnum} [access] Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` - * @param {boolean} [useCdn] When this is provided, OSS will return a URL that does not point to https://developer.api.autodesk.com.... , but instead points towards an alternate domain. A client can then interact with this public resource exactly as they would for a classic public resource in OSS, i.e. make a GET request to download an object or a PUT request to upload an object. - * @param {CreateSignedResource} [createSignedResource] - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - createSignedResource(accessToken: string,bucketKey: string, objectKey: string, access?: CreateSignedResourceAccessEnum, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig): Promise; - - /** - * Delete the bucket with the specified key - * @param {string} bucketKey URL-encoded bucket key - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - deleteBucket(accessToken: string,bucketKey: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Deletes an object from the bucket. - * @param {string} bucketKey URL-encoded key of the bucket containing the object. - * @param {string} objectKey URL-encoded key of the object to delete. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - deleteObject(accessToken: string,bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Delete a signed URL. A successful call to this endpoint requires bucket owner access. - * @param {string} hash Hash of signed resource - * @param {DeleteSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - deleteSignedResource(accessToken: string,hash: string, region?: DeleteSignedResourceRegionEnum, options?: ApsServiceRequestConfig): Promise; - - /** - * This endpoint will return the details about the specified bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - getBucketDetails(accessToken: string,bucketKey: string, options?: ApsServiceRequestConfig): Promise; - - /** - * This endpoint will return the buckets owned by the application. This endpoint supports pagination. - * @param {GetBucketsRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [startAt] Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - getBuckets(accessToken: string,region?: GetBucketsRegionEnum, limit?: number, startAt?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Returns object details in JSON format. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {GetObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate`, `userDefinedMetadata` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - getObjectDetails(accessToken: string,bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: GetObjectDetailsWithEnum, options?: ApsServiceRequestConfig): Promise; - - /** - * List objects in a bucket. It is only available to the bucket creator. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [beginsWith] Provides a way to filter the based on object key name - * @param {string} [startAt] Key to use as an offset to continue pagination. This is typically the last bucket key found in a preceding GET buckets response - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - getObjects(accessToken: string,bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Download an object using a signed URL. - * @param {string} hash Hash of signed resource - * @param {string} [range] A range of bytes to download from the specified object. - * @param {string} [ifNoneMatch] The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [acceptEncoding] When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. - * @param {GetSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [responseContentDisposition] Value of the Content-Disposition HTTP header you expect to receive. If the parameter is not provided, the value associated with the object is used. - * @param {string} [responseContentType] Value of the Content-Type HTTP header you expect to receive in the download response. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - getSignedResource(accessToken: string,hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: GetSignedResourceRegionEnum, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Returns an empty response body and a 200 response code if the object exists. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {HeadObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - headObjectDetails(accessToken: string,bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig): Promise; - - /** - * Upload an object to this bucket using the body of a POST request, as multipart form data. If during the upload, OSS determines that the combination of bucket key + object key already exists, then the uploaded content will overwrite the existing object. Even if it is possible to upload multiple files in the same request, it is better to create one request for each and paralellize the uploads. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} contentLength Indicates the size of the request body. Since the multipart type is complex, this is usually computed after building the body and getting its length. - * @param {string} xAdsObjectName The key of the object being uploaded. Must be URL-encoded, and it must be 3-1024 characters including any UTF-8 encoding for foreign character support. If an object with this key already exists in the bucket, the object will be overwritten. - * @param {number} xAdsObjectSize The size in bytes of the file to upload. - * @param {string} [contentType] Must be the multipart type followed by the boundary used; example: \'multipart/form-data, boundary=AaB03x\'. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {string} [xAdsMetaCacheControl] The value of this header will be stored with the uploaded object. The value will be used as the \'Cache-Control\' header in the response when the object is downloaded. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - postUpload(accessToken: string,bucketKey: string, contentLength: number, xAdsObjectName: string, xAdsObjectSize: number, contentType?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, xAdsMetaCacheControl?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Gets a signed URL to a download an object directly from S3, bypassing OSS servers. This signed URL expires in 60 seconds, so the request must begin within that time frame; the actual data transfer can take longer. Note that resumable uploads store each chunk individually; after the upload completes, an async process merges all the chunks and creates the definitive OSS file. If you request a signed URL before the async process completes, the response returns a map of S3 URLs, one per chunk; the key is the byte range of the total file to which the chunk corresponds. If you need a single URL in the response, you can use OSS signed resource functionality by setting the \'public-resource-fallback\' query parameter to true. Lastly, note that ranged downloads can be used with the returned URL. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [ifNoneMatch] If the value of this header matches the ETag of the object, an entity will not be returned from the server; instead a 304 (not modified) response will be returned without any message-body. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {string} [responseContentType] Value of the Content-Type header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseContentDisposition] Value of the Content-Disposition header that the client expects to receive. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseCacheControl] Value of the Cache-Control header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {boolean} [publicResourceFallback] Indicates that OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {boolean} [useCdn] This will generate a CloudFront URL for the S3 object. - * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - signedS3Download(accessToken: string,bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig): Promise; - - /** - * Gets a signed URL to upload an object in a single request, or an array of signed URLs with which to upload an object in multiple parts. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {number} [parts] For a multipart upload, the number of chunk upload URLs to return. If X is provided, the response will include chunk URLs from 1 to X. If none provided, the response will include only a single URL with which to upload an entire object. - * @param {number} [firstPart] Index of first part in the parts collection. - * @param {string} [uploadKey] The identifier of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. This must match the `uploadKey` returned by a previous call to this endpoint where the client requested more than one part URL. If none provided, OSS will initiate a new upload entirely. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - signedS3Upload(accessToken: string,bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, options?: ApsServiceRequestConfig): Promise; - - /** - * Upload an object using a signed URL. If the signed resource is available and its expiration period is valid, you can overwrite the existing object via a signed URL upload using the \'access\' query parameter with value \'write\' or \'readwrite\'. - * @param {string} hash Hash of signed resource - * @param {number} contentLength Indicates the size of the request body. - * @param {File} body The object to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourceXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [ifMatch] If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - uploadSignedResource(accessToken: string,hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourceXAdsRegionEnum, ifMatch?: string, options?: ApsServiceRequestConfig): Promise; - - /** - * Resumable upload for signed URLs. - * @param {string} hash Hash of the signed resource - * @param {string} contentRange Byte range of a segment being uploaded - * @param {string} sessionId Unique identifier of a session of a file being uploaded - * @param {File} body The chunk to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourcesChunkXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApiInterface - */ - uploadSignedResourcesChunk(accessToken: string,hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourcesChunkXAdsRegionEnum, options?: ApsServiceRequestConfig): Promise; - -} - -/** - * OSSApi - object-oriented interface - * @export - * @class OSSApi - * @extends {BaseApi} - */ -export class OSSApi extends BaseApi implements OSSApiInterface { - private logger = this.sdkManager.logger; - /** - * Instructs OSS to complete the object creation process for numerous objects after their bytes have been uploaded directly to S3. An object will not be accessible until you complete the object creation process, either with this endpoint or the single Complete Upload endpoint. This endpoint accepts batch sizes of up to 25. Any larger and the request will fail. - * @param {string} bucketKey URL-encoded bucket key - * @param {BatchcompleteuploadObject} [requests] An array of objects, each of which represents an upload to complete. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async batchCompleteUpload(accessToken: string, bucketKey: string, requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into batchCompleteUpload "); - try { - const request = await OSSApiFp(this.sdkManager).batchCompleteUpload(accessToken, bucketKey, requests, options); - const response = await request(this.axios); - this.logger.logInfo(`batchCompleteUpload Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`batchCompleteUpload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`batchCompleteUpload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`batchCompleteUpload Request failed with no response received: ${error.request}`); - throw new OssApiError(`batchCompleteUpload Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Gets one or more signed URLs to download objects. The signed URLs can be used to download the objects directly from S3, skipping OSS servers. Be aware that expiration time for the signed URL(s) is just 60 seconds. So, a request to the URL(s) must begin within 60 seconds; the transfer of the data can exceed 60 seconds. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {Batchsigneds3downloadObject} requests An array of objects representing each request for a signed download URL. - * @param {boolean} [publicResourceFallback] Indicates that for each requested object, OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async batchSignedS3Download(accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into batchSignedS3Download "); - try { - const request = await OSSApiFp(this.sdkManager).batchSignedS3Download(accessToken, bucketKey, requests, publicResourceFallback, minutesExpiration, options); - const response = await request(this.axios); - this.logger.logInfo(`batchSignedS3Download Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`batchSignedS3Download Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`batchSignedS3Download Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`batchSignedS3Download Request failed with no response received: ${error.request}`); - throw new OssApiError(`batchSignedS3Download Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Requests a batch of S3 signed URL with which to upload multiple objects or chunks of multiple objects. As with the Batch Get Download URL endpoint, the requests within the batch are evaluated independently and individual requests can be rejected even if the overall request returns a 200 response code. You can request a maximum of 25 URLs in a single request. - * @param {string} bucketKey URL-encoded bucket key - * @param {boolean} [useAcceleration] Whether or not to generate an accelerated signed URL (ie: URLs of the form ...s3-accelerate.amazonaws.com... vs ...s3.amazonaws.com...). When not specified, defaults to true. Providing non-boolean values will result in a 400 error. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {Batchsigneds3uploadObject} [requests] An array of objects, each of which represents a signed URL / URLs to retrieve. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async batchSignedS3Upload(accessToken: string, bucketKey: string, useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into batchSignedS3Upload "); - try { - const request = await OSSApiFp(this.sdkManager).batchSignedS3Upload(accessToken, bucketKey, useAcceleration, minutesExpiration, requests, options); - const response = await request(this.axios); - this.logger.logInfo(`batchSignedS3Upload Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`batchSignedS3Upload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`batchSignedS3Upload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`batchSignedS3Upload Request failed with no response received: ${error.request}`); - throw new OssApiError(`batchSignedS3Upload Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Instructs OSS to complete the object creation process after the bytes have been uploaded directly to S3. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} contentType Must be exactly `application/json`. - * @param {Completes3uploadBody} body - * @param {string} [xAdsMetaContentType] The Content-Type value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentDisposition] The Content-Disposition value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaContentEncoding] The Content-Encoding value for the uploaded object to record within OSS. - * @param {string} [xAdsMetaCacheControl] The Cache-Control value for the uploaded object to record within OSS. - * @param {string} [xAdsUserDefinedMetadata] This parameter allows setting any custom metadata to be stored with the object, which can be retrieved later on download or when getting the object details. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async completeSignedS3Upload(accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into completeSignedS3Upload "); - try { - const request = await OSSApiFp(this.sdkManager).completeSignedS3Upload(accessToken, bucketKey, objectKey, contentType, body, xAdsMetaContentType, xAdsMetaContentDisposition, xAdsMetaContentEncoding, xAdsMetaCacheControl, xAdsUserDefinedMetadata, options); - const response = await request(this.axios); - this.logger.logInfo(`completeSignedS3Upload Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`completeSignedS3Upload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`completeSignedS3Upload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`completeSignedS3Upload Request failed with no response received: ${error.request}`); - throw new OssApiError(`completeSignedS3Upload Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Copies an object to another object name in the same bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} newObjName URL-encoded Object key to use as the destination - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async copyTo(accessToken: string, bucketKey: string, objectKey: string, newObjName: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into copyTo "); - try { - const request = await OSSApiFp(this.sdkManager).copyTo(accessToken, bucketKey, objectKey, newObjName, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); - const response = await request(this.axios); - this.logger.logInfo(`copyTo Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`copyTo Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`copyTo Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`copyTo Request failed with no response received: ${error.request}`); - throw new OssApiError(`copyTo Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Use this endpoint to create a bucket. Buckets are arbitrary spaces created and owned by applications. Bucket keys are globally unique across all regions, regardless of where they were created, and they cannot be changed. The application creating the bucket is the owner of the bucket. - * @param {CreateBucketXAdsRegionEnum} xAdsRegion The region where the bucket resides Acceptable values: `US`, `EMEA` - * @param {CreateBucketsPayload} policyKey Length of time for objects in the bucket to exist; `transient` (24h), `temporary` (30d), or `persistent` (until delete request). - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async createBucket(accessToken: string, xAdsRegion: CreateBucketXAdsRegionEnum, policyKey: CreateBucketsPayload, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into createBucket "); - try { - const request = await OSSApiFp(this.sdkManager).createBucket(accessToken, xAdsRegion, policyKey, options); - const response = await request(this.axios); - this.logger.logInfo(`createBucket Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`createBucket Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`createBucket Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`createBucket Request failed with no response received: ${error.request}`); - throw new OssApiError(`createBucket Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * This endpoint creates a signed URL that can be used to download an object within the specified expiration time. Be aware that if the object the signed URL points to is deleted or expires before the signed URL expires, then the signed URL will no longer be valid. A successful call to this endpoint requires bucket owner access. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {CreateSignedResourceAccessEnum} [access] Access for signed resource Acceptable values: `read`, `write`, `readwrite`. Default value: `read` - * @param {boolean} [useCdn] When this is provided, OSS will return a URL that does not point to https://developer.api.autodesk.com.... , but instead points towards an alternate domain. A client can then interact with this public resource exactly as they would for a classic public resource in OSS, i.e. make a GET request to download an object or a PUT request to upload an object. - * @param {CreateSignedResource} [createSignedResource] - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async createSignedResource(accessToken: string, bucketKey: string, objectKey: string, access?: CreateSignedResourceAccessEnum, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into createSignedResource "); - try { - const request = await OSSApiFp(this.sdkManager).createSignedResource(accessToken, bucketKey, objectKey, access, useCdn, createSignedResource, options); - const response = await request(this.axios); - this.logger.logInfo(`createSignedResource Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`createSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`createSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`createSignedResource Request failed with no response received: ${error.request}`); - throw new OssApiError(`createSignedResource Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Delete the bucket with the specified key - * @param {string} bucketKey URL-encoded bucket key - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async deleteBucket(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into deleteBucket "); - try { - const request = await OSSApiFp(this.sdkManager).deleteBucket(accessToken, bucketKey, options); - const response = await request(this.axios); - this.logger.logInfo(`deleteBucket Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`deleteBucket Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`deleteBucket Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`deleteBucket Request failed with no response received: ${error.request}`); - throw new OssApiError(`deleteBucket Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Deletes an object from the bucket. - * @param {string} bucketKey URL-encoded key of the bucket containing the object. - * @param {string} objectKey URL-encoded key of the object to delete. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async deleteObject(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into deleteObject "); - try { - const request = await OSSApiFp(this.sdkManager).deleteObject(accessToken, bucketKey, objectKey, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, options); - const response = await request(this.axios); - this.logger.logInfo(`deleteObject Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`deleteObject Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`deleteObject Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`deleteObject Request failed with no response received: ${error.request}`); - throw new OssApiError(`deleteObject Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Delete a signed URL. A successful call to this endpoint requires bucket owner access. - * @param {string} hash Hash of signed resource - * @param {DeleteSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async deleteSignedResource(accessToken: string, hash: string, region?: DeleteSignedResourceRegionEnum, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into deleteSignedResource "); - try { - const request = await OSSApiFp(this.sdkManager).deleteSignedResource(accessToken, hash, region, options); - const response = await request(this.axios); - this.logger.logInfo(`deleteSignedResource Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`deleteSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`deleteSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`deleteSignedResource Request failed with no response received: ${error.request}`); - throw new OssApiError(`deleteSignedResource Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * This endpoint will return the details about the specified bucket. - * @param {string} bucketKey URL-encoded bucket key - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async getBucketDetails(accessToken: string, bucketKey: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into getBucketDetails "); - try { - const request = await OSSApiFp(this.sdkManager).getBucketDetails(accessToken, bucketKey, options); - const response = await request(this.axios); - this.logger.logInfo(`getBucketDetails Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`getBucketDetails Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`getBucketDetails Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`getBucketDetails Request failed with no response received: ${error.request}`); - throw new OssApiError(`getBucketDetails Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * This endpoint will return the buckets owned by the application. This endpoint supports pagination. - * @param {GetBucketsRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [startAt] Key to use as an offset to continue pagination This is typically the last bucket key found in a preceding GET buckets response - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async getBuckets(accessToken: string, region?: GetBucketsRegionEnum, limit?: number, startAt?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into getBuckets "); - try { - const request = await OSSApiFp(this.sdkManager).getBuckets(accessToken, region, limit, startAt, options); - const response = await request(this.axios); - this.logger.logInfo(`getBuckets Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`getBuckets Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`getBuckets Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`getBuckets Request failed with no response received: ${error.request}`); - throw new OssApiError(`getBuckets Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Returns object details in JSON format. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {GetObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate`, `userDefinedMetadata` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async getObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: GetObjectDetailsWithEnum, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into getObjectDetails "); - try { - const request = await OSSApiFp(this.sdkManager).getObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); - const response = await request(this.axios); - this.logger.logInfo(`getObjectDetails Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`getObjectDetails Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`getObjectDetails Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`getObjectDetails Request failed with no response received: ${error.request}`); - throw new OssApiError(`getObjectDetails Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * List objects in a bucket. It is only available to the bucket creator. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} [limit] Limit to the response size, Acceptable values: 1-100 Default = 10 - * @param {string} [beginsWith] Provides a way to filter the based on object key name - * @param {string} [startAt] Key to use as an offset to continue pagination. This is typically the last bucket key found in a preceding GET buckets response - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async getObjects(accessToken: string, bucketKey: string, limit?: number, beginsWith?: string, startAt?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into getObjects "); - try { - const request = await OSSApiFp(this.sdkManager).getObjects(accessToken, bucketKey, limit, beginsWith, startAt, options); - const response = await request(this.axios); - this.logger.logInfo(`getObjects Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`getObjects Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`getObjects Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`getObjects Request failed with no response received: ${error.request}`); - throw new OssApiError(`getObjects Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Download an object using a signed URL. - * @param {string} hash Hash of signed resource - * @param {string} [range] A range of bytes to download from the specified object. - * @param {string} [ifNoneMatch] The value of this header is compared to the ETAG of the object. If they match, the body will not be included in the response. Only the object information will be included. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [acceptEncoding] When gzip is specified, a gzip compressed stream of the object’s bytes will be returned in the response. Cannot use “Accept-Encoding:gzip” with Range header containing an end byte range. End byte range will not be honored if “Accept-Encoding: gzip” header is used. - * @param {GetSignedResourceRegionEnum} [region] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [responseContentDisposition] Value of the Content-Disposition HTTP header you expect to receive. If the parameter is not provided, the value associated with the object is used. - * @param {string} [responseContentType] Value of the Content-Type HTTP header you expect to receive in the download response. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async getSignedResource(accessToken: string, hash: string, range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: GetSignedResourceRegionEnum, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into getSignedResource "); - try { - const request = await OSSApiFp(this.sdkManager).getSignedResource(accessToken, hash, range, ifNoneMatch, ifModifiedSince, acceptEncoding, region, responseContentDisposition, responseContentType, options); - const response = await request(this.axios); - this.logger.logInfo(`getSignedResource Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`getSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`getSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`getSignedResource Request failed with no response received: ${error.request}`); - throw new OssApiError(`getSignedResource Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Returns an empty response body and a 200 response code if the object exists. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey URL-encoded object name - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message body. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {HeadObjectDetailsWithEnum} [_with] Extra information in details; multiple uses are supported Acceptable values: `createdDate`, `lastAccessedDate`, `lastModifiedDate` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async headObjectDetails(accessToken: string, bucketKey: string, objectKey: string, ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into headObjectDetails "); - try { - const request = await OSSApiFp(this.sdkManager).headObjectDetails(accessToken, bucketKey, objectKey, ifModifiedSince, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, _with, options); - const response = await request(this.axios); - this.logger.logInfo(`headObjectDetails Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`headObjectDetails Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`headObjectDetails Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`headObjectDetails Request failed with no response received: ${error.request}`); - throw new OssApiError(`headObjectDetails Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Upload an object to this bucket using the body of a POST request, as multipart form data. If during the upload, OSS determines that the combination of bucket key + object key already exists, then the uploaded content will overwrite the existing object. Even if it is possible to upload multiple files in the same request, it is better to create one request for each and paralellize the uploads. - * @param {string} bucketKey URL-encoded bucket key - * @param {number} contentLength Indicates the size of the request body. Since the multipart type is complex, this is usually computed after building the body and getting its length. - * @param {string} xAdsObjectName The key of the object being uploaded. Must be URL-encoded, and it must be 3-1024 characters including any UTF-8 encoding for foreign character support. If an object with this key already exists in the bucket, the object will be overwritten. - * @param {number} xAdsObjectSize The size in bytes of the file to upload. - * @param {string} [contentType] Must be the multipart type followed by the boundary used; example: \'multipart/form-data, boundary=AaB03x\'. - * @param {string} [xAdsAcmNamespace] This header is used to let the OSS Api Proxy know if ACM is used to authorize access to the given object. If this authorization is used by your service, then you must provide the name of the namespace you want to validate access control policies against. - * @param {string} [xAdsAcmCheckGroups] Informs the OSS Api Proxy know if your service requires ACM authorization to also validate against Oxygen groups. If so, you must pass this header with a value of \'true\'. Otherwise, the assumption is that checking authorization against Oxygen groups is not required. - * @param {string} [xAdsAcmGroups] Use this header to pass the Oxygen groups you want the OSS Api Proxy to use for group validation for the given user in the OAuth2 token. - * @param {string} [xAdsMetaCacheControl] The value of this header will be stored with the uploaded object. The value will be used as the \'Cache-Control\' header in the response when the object is downloaded. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async postUpload(accessToken: string, bucketKey: string, contentLength: number, xAdsObjectName: string, xAdsObjectSize: number, contentType?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, xAdsMetaCacheControl?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into postUpload "); - try { - const request = await OSSApiFp(this.sdkManager).postUpload(accessToken, bucketKey, contentLength, xAdsObjectName, xAdsObjectSize, contentType, xAdsAcmNamespace, xAdsAcmCheckGroups, xAdsAcmGroups, xAdsMetaCacheControl, options); - const response = await request(this.axios); - this.logger.logInfo(`postUpload Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`postUpload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`postUpload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`postUpload Request failed with no response received: ${error.request}`); - throw new OssApiError(`postUpload Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Gets a signed URL to a download an object directly from S3, bypassing OSS servers. This signed URL expires in 60 seconds, so the request must begin within that time frame; the actual data transfer can take longer. Note that resumable uploads store each chunk individually; after the upload completes, an async process merges all the chunks and creates the definitive OSS file. If you request a signed URL before the async process completes, the response returns a map of S3 URLs, one per chunk; the key is the byte range of the total file to which the chunk corresponds. If you need a single URL in the response, you can use OSS signed resource functionality by setting the \'public-resource-fallback\' query parameter to true. Lastly, note that ranged downloads can be used with the returned URL. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [ifNoneMatch] If the value of this header matches the ETag of the object, an entity will not be returned from the server; instead a 304 (not modified) response will be returned without any message-body. - * @param {string} [ifModifiedSince] If the requested object has not been modified since the time specified in this field, an entity will not be returned from the server; instead, a 304 (not modified) response will be returned without any message-body. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {string} [responseContentType] Value of the Content-Type header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseContentDisposition] Value of the Content-Disposition header that the client expects to receive. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {string} [responseCacheControl] Value of the Cache-Control header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value corresponding to the object. - * @param {boolean} [publicResourceFallback] Indicates that OSS should return an OSS Signed Resource if the object is unmerged, rather than a map of S3 signed URLs for the chunks of the object. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param {boolean} [useCdn] This will generate a CloudFront URL for the S3 object. - * @param {boolean} [redirect] Generates a HTTP redirection response (Temporary Redirect 307​) using the generated URL. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async signedS3Download(accessToken: string, bucketKey: string, objectKey: string, ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into signedS3Download "); - try { - const request = await OSSApiFp(this.sdkManager).signedS3Download(accessToken, bucketKey, objectKey, ifNoneMatch, ifModifiedSince, xAdsAcmScopes, responseContentType, responseContentDisposition, responseCacheControl, publicResourceFallback, minutesExpiration, useCdn, redirect, options); - const response = await request(this.axios); - this.logger.logInfo(`signedS3Download Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`signedS3Download Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.developerMessage}`); - throw new OssApiError(`signedS3Download Request failed with status : ${error.response.status} and error message: ${error.response.data.developerMessage}`, error); - } else if (error.request) { - this.logger.logError(`signedS3Download Request failed with no response received: ${error.request}`); - throw new OssApiError(`signedS3Download Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Gets a signed URL to upload an object in a single request, or an array of signed URLs with which to upload an object in multiple parts. - * @param {string} bucketKey URL-encoded bucket key - * @param {string} objectKey The URL-encoded key of the object for which to create a signed URL. - * @param {string} [xAdsAcmScopes] Optional OSS-compliant scope reference to increase bucket search performance - * @param {number} [parts] For a multipart upload, the number of chunk upload URLs to return. If X is provided, the response will include chunk URLs from 1 to X. If none provided, the response will include only a single URL with which to upload an entire object. - * @param {number} [firstPart] Index of first part in the parts collection. - * @param {string} [uploadKey] The identifier of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. This must match the `uploadKey` returned by a previous call to this endpoint where the client requested more than one part URL. If none provided, OSS will initiate a new upload entirely. - * @param {number} [minutesExpiration] The custom expiration time within the 1 to 60 minutes range, if not specified, default is 2 minutes. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async signedS3Upload(accessToken: string, bucketKey: string, objectKey: string, xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into signedS3Upload "); - try { - const request = await OSSApiFp(this.sdkManager).signedS3Upload(accessToken, bucketKey, objectKey, xAdsAcmScopes, parts, firstPart, uploadKey, minutesExpiration, options); - const response = await request(this.axios); - this.logger.logInfo(`signedS3Upload Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`signedS3Upload Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`signedS3Upload Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`signedS3Upload Request failed with no response received: ${error.request}`); - throw new OssApiError(`signedS3Upload Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Upload an object using a signed URL. If the signed resource is available and its expiration period is valid, you can overwrite the existing object via a signed URL upload using the \'access\' query parameter with value \'write\' or \'readwrite\'. - * @param {string} hash Hash of signed resource - * @param {number} contentLength Indicates the size of the request body. - * @param {File} body The object to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourceXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param {string} [ifMatch] If-Match header containing a SHA-1 hash of the bytes in the request body can be sent by the calling service or client application with the request. If present, OSS will use the value of If-Match header to verify that a SHA-1 calculated for the uploaded bytes server side matches what was sent in the header. If not, the request is failed with a status 412 Precondition Failed and the data is not written. - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async uploadSignedResource(accessToken: string, hash: string, contentLength: number, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourceXAdsRegionEnum, ifMatch?: string, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into uploadSignedResource "); - try { - const request = await OSSApiFp(this.sdkManager).uploadSignedResource(accessToken, hash, contentLength, body, contentType, contentDisposition, xAdsRegion, ifMatch, options); - const response = await request(this.axios); - this.logger.logInfo(`uploadSignedResource Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`uploadSignedResource Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`uploadSignedResource Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`uploadSignedResource Request failed with no response received: ${error.request}`); - throw new OssApiError(`uploadSignedResource Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } - - /** - * Resumable upload for signed URLs. - * @param {string} hash Hash of the signed resource - * @param {string} contentRange Byte range of a segment being uploaded - * @param {string} sessionId Unique identifier of a session of a file being uploaded - * @param {File} body The chunk to upload. - * @param {string} [contentType] The MIME type of the object to upload; can be any type except \'multipart/form-data\'. This can be omitted, but we recommend adding it. - * @param {string} [contentDisposition] The suggested default filename when downloading this object to a file after it has been uploaded. - * @param {UploadSignedResourcesChunkXAdsRegionEnum} [xAdsRegion] The region where the bucket resides Acceptable values: `US`, `EMEA` Default is `US` - * @param accessToken bearer access token - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof OSSApi - */ - public async uploadSignedResourcesChunk(accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourcesChunkXAdsRegionEnum, options?: ApsServiceRequestConfig) { - this.logger.logInfo("Entered into uploadSignedResourcesChunk "); - try { - const request = await OSSApiFp(this.sdkManager).uploadSignedResourcesChunk(accessToken, hash, contentRange, sessionId, body, contentType, contentDisposition, xAdsRegion, options); - const response = await request(this.axios); - this.logger.logInfo(`uploadSignedResourcesChunk Request completed successfully with status code: ${response.status}`); - return new ApiResponse(response,response.data); - } catch (error) { - if (error.response) { - this.logger.logError(`uploadSignedResourcesChunk Request failed with status : ${error.response.status} and statusText : ${error.response.statusText} and error message: ${error.response.data.reason}`); - throw new OssApiError(`uploadSignedResourcesChunk Request failed with status : ${error.response.status} and error message: ${error.response.data.reason}`, error); - } else if (error.request) { - this.logger.logError(`uploadSignedResourcesChunk Request failed with no response received: ${error.request}`); - throw new OssApiError(`uploadSignedResourcesChunk Request failed with no response received: ${error.request}`, error); - } - throw error; - } - } -} - -/** - * @export - */ -export const CreateBucketXAdsRegionEnum = { - Us: 'US', - Emea: 'EMEA' -} as const; -export type CreateBucketXAdsRegionEnum = typeof CreateBucketXAdsRegionEnum[keyof typeof CreateBucketXAdsRegionEnum]; -/** - * @export - */ -export const CreateSignedResourceAccessEnum = { - Read: 'read', - Write: 'write', - Readwrite: 'readwrite' -} as const; -export type CreateSignedResourceAccessEnum = typeof CreateSignedResourceAccessEnum[keyof typeof CreateSignedResourceAccessEnum]; -/** - * @export - */ -export const DeleteSignedResourceRegionEnum = { - Us: 'US', - Emea: 'EMEA' -} as const; -export type DeleteSignedResourceRegionEnum = typeof DeleteSignedResourceRegionEnum[keyof typeof DeleteSignedResourceRegionEnum]; -/** - * @export - */ -export const GetBucketsRegionEnum = { - Us: 'US', - Emea: 'EMEA' -} as const; -export type GetBucketsRegionEnum = typeof GetBucketsRegionEnum[keyof typeof GetBucketsRegionEnum]; -/** - * @export - */ -export const GetObjectDetailsWithEnum = { - CreatedDate: 'createdDate', - LastAccessedDate: 'lastAccessedDate', - LastModifiedDate: 'lastModifiedDate', - UserDefinedMetadata: 'userDefinedMetadata' -} as const; -export type GetObjectDetailsWithEnum = typeof GetObjectDetailsWithEnum[keyof typeof GetObjectDetailsWithEnum]; -/** - * @export - */ -export const GetSignedResourceRegionEnum = { - Us: 'US', - Emea: 'EMEA' -} as const; -export type GetSignedResourceRegionEnum = typeof GetSignedResourceRegionEnum[keyof typeof GetSignedResourceRegionEnum]; -/** - * @export - */ -export const HeadObjectDetailsWithEnum = { - CreatedDate: 'createdDate', - LastAccessedDate: 'lastAccessedDate', - LastModifiedDate: 'lastModifiedDate' -} as const; -export type HeadObjectDetailsWithEnum = typeof HeadObjectDetailsWithEnum[keyof typeof HeadObjectDetailsWithEnum]; -/** - * @export - */ -export const UploadSignedResourceXAdsRegionEnum = { - Us: 'US', - Emea: 'EMEA' -} as const; -export type UploadSignedResourceXAdsRegionEnum = typeof UploadSignedResourceXAdsRegionEnum[keyof typeof UploadSignedResourceXAdsRegionEnum]; -/** - * @export - */ -export const UploadSignedResourcesChunkXAdsRegionEnum = { - Us: 'US', - Emea: 'EMEA' -} as const; -export type UploadSignedResourcesChunkXAdsRegionEnum = typeof UploadSignedResourcesChunkXAdsRegionEnum[keyof typeof UploadSignedResourcesChunkXAdsRegionEnum]; diff --git a/oss/source/custom-code/OSSFileTransfer.ts b/oss/source/custom-code/OSSFileTransfer.ts index f218b64..6cad955 100644 --- a/oss/source/custom-code/OSSFileTransfer.ts +++ b/oss/source/custom-code/OSSFileTransfer.ts @@ -1,7 +1,7 @@ import { IAuthClient, SdkManager, ApiResponse, ApsServiceRequestConfig } from "@aps_sdk/autodesk-sdkmanager"; import { IFileTransferConfigurations } from './FileTransferConfigurations'; -import { OSSApi } from "../api"; -import { Completes3uploadBody, ObjectStatusEnum, Signeds3downloadResponse, Signeds3uploadResponse } from "../model"; +import { ObjectsApi } from "../api"; +import { Completes3uploadBody, DownloadStatus, Signeds3downloadResponse, Signeds3uploadResponse } from "../model"; import { OssApiError, RequestArgs } from "../base"; import { createRequestFunctionOss } from "../common"; import { WriteStream, createWriteStream } from "fs"; @@ -17,7 +17,7 @@ class Constants { export class OSSFileTransfer implements IOSSFileTransfer { public configuration: IFileTransferConfigurations; - public ossApi: OSSApi; + public objectApi: ObjectsApi; public authentication: IAuthClient; private maxRetryOnTokenExpiry: number; @@ -36,7 +36,8 @@ export class OSSFileTransfer implements IOSSFileTransfer { this.sdkManager = sdkmanager; this.configuration = configuration; - this.ossApi = new OSSApi(this.sdkManager); + this.objectApi = new ObjectsApi(this.sdkManager); + this.maxChunkCountAllowed = this.configuration.getMaxChunkCountAllowed(); this.maxRetryOnUrlExpiry = this.configuration.getMaxRetryOnUrlExpiry(); this.maxRetryOnTokenExpiry = this.configuration.getMaxRetryOnTokenExpiry(); @@ -108,7 +109,7 @@ export class OSSFileTransfer implements IOSSFileTransfer { onProgress?.(percentCompleted); this.logger.logInfo(`${requestId} Number of chunks uploaded : ${chunksUploaded}`); } - var completeResponse = await this.ossApi.completeSignedS3Upload( + var completeResponse = await this.objectApi.completeSignedS3Upload( accessToken, bucketKey, objectKey, @@ -201,7 +202,7 @@ export class OSSFileTransfer implements IOSSFileTransfer { this.logger.logInfo(`${requestId} Refreshing URL attempt:${attemptcount}.`); try { - var response = await this.ossApi.signedS3Upload(accessToken, bucketKey, objectKey, projectScope, parts, firstPart, uploadKey); + var response = await this.objectApi.signedS3Upload(accessToken, bucketKey, objectKey, projectScope, parts, firstPart, uploadKey); return ([response.content, accessToken]); } catch (e) { @@ -252,8 +253,8 @@ export class OSSFileTransfer implements IOSSFileTransfer { this.logger.logInfo(`${requestId} Get signed URL to download directly from S3 attempt: ${attemptCount}`); try { - var objectStatusEnumString: string = ObjectStatusEnum.Complete; - var response = await this.ossApi.signedS3Download(accessToken, bucketKey, objectKey, requestId); + var objectStatusEnumString: string = DownloadStatus.Complete; + var response = await this.objectApi.signedS3Download(accessToken, bucketKey, objectKey, requestId); if (response.content.status != objectStatusEnumString) { this.logger.logError(`${requestId} File not available for download yet.`); throw new OssApiError(`${requestId} File not available for download yet.`); diff --git a/oss/source/custom-code/OssClient.ts b/oss/source/custom-code/OssClient.ts index dbd778c..43f6893 100644 --- a/oss/source/custom-code/OssClient.ts +++ b/oss/source/custom-code/OssClient.ts @@ -1,17 +1,21 @@ import { SdkManager, ApiResponse, ApsServiceRequestConfig } from "@aps_sdk/autodesk-sdkmanager"; -import { CreateBucketXAdsRegionEnum, CreateSignedResourceAccessEnum, DeleteSignedResourceRegionEnum, GetBucketsRegionEnum, GetObjectDetailsWithEnum, GetSignedResourceRegionEnum, HeadObjectDetailsWithEnum, OSSApi, UploadSignedResourceXAdsRegionEnum, UploadSignedResourcesChunkXAdsRegionEnum } from "../api"; import { OSSFileTransfer } from "./OSSFileTransfer"; +import { BucketsApi,ObjectsApi } from "../api"; import { FileTransferConfigurations } from "./FileTransferConfigurations"; -import { CreateBucketsPayload, ObjectDetails, ObjectFullDetails, Bucket, Buckets, BucketObjects, BatchcompleteuploadResponse, BatchcompleteuploadObject, Batchsigneds3downloadObject, Batchsigneds3downloadResponse, Batchsigneds3uploadObject, Batchsigneds3uploadResponse, Completes3uploadBody, CreateObjectSigned, CreateSignedResource, Signeds3downloadResponse, Signeds3uploadResponse } from "../model"; +import { CreateBucketsPayload, ObjectDetails, ObjectFullDetails, Bucket, Buckets, BucketObjects, BatchcompleteuploadResponse, BatchcompleteuploadObject, Batchsigneds3downloadObject, Batchsigneds3downloadResponse, Batchsigneds3uploadObject, Batchsigneds3uploadResponse, Completes3uploadBody, CreateObjectSigned, CreateSignedResource, Signeds3downloadResponse, Signeds3uploadResponse, Region, With, Access } from "../model"; import * as fs from "fs"; export class OssClient { - public ossApi: OSSApi; + public objectApi: ObjectsApi; + public bucketApi: BucketsApi; + public ossFileTransfer: OSSFileTransfer; constructor(sdkManager: SdkManager) { - this.ossApi = new OSSApi(sdkManager); + this.objectApi = new ObjectsApi(sdkManager); + this.bucketApi = new BucketsApi(sdkManager); + this.ossFileTransfer = new OSSFileTransfer(new FileTransferConfigurations(3), sdkManager); } @@ -38,7 +42,7 @@ export class OssClient { * @memberof OSSApiInterface */ public async batchCompleteUpload(accessToken: string, bucketKey: string, optionalArgs?: { requests?: BatchcompleteuploadObject, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.batchCompleteUpload(accessToken, bucketKey, optionalArgs?.requests, optionalArgs?.options); + const response = await this.objectApi.batchCompleteUpload(accessToken, bucketKey, optionalArgs?.requests, optionalArgs?.options); return response.content; } /** @@ -51,7 +55,7 @@ export class OssClient { * @throws {RequiredError} */ public async batchSignedS3Download(accessToken: string, bucketKey: string, requests: Batchsigneds3downloadObject, optionalArgs?: { publicResourceFallback?: boolean, minutesExpiration?: number, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.batchSignedS3Download(accessToken, bucketKey, requests, optionalArgs?.publicResourceFallback, optionalArgs?.minutesExpiration, optionalArgs?.options); + const response = await this.objectApi.batchSignedS3Download(accessToken, bucketKey, requests, optionalArgs?.publicResourceFallback, optionalArgs?.minutesExpiration, optionalArgs?.options); return response.content; } /** @@ -66,7 +70,7 @@ export class OssClient { * @memberof OSSApi */ public async batchSignedS3Upload(accessToken: string, bucketKey: string, optionalArgs?: { useAcceleration?: boolean, minutesExpiration?: number, requests?: Batchsigneds3uploadObject, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.batchSignedS3Upload(accessToken, bucketKey, optionalArgs?.useAcceleration, optionalArgs?.minutesExpiration, optionalArgs?.requests, optionalArgs?.options); + const response = await this.objectApi.batchSignedS3Upload(accessToken, bucketKey, optionalArgs?.useAcceleration, optionalArgs?.minutesExpiration, optionalArgs?.requests, optionalArgs?.options); return response.content; } @@ -85,7 +89,7 @@ export class OssClient { * @throws {RequiredError} */ public async completeSignedS3Upload(accessToken: string, bucketKey: string, objectKey: string, contentType: string, body: Completes3uploadBody, optionalArgs?: { xAdsMetaContentType?: string, xAdsMetaContentDisposition?: string, xAdsMetaContentEncoding?: string, xAdsMetaCacheControl?: string, xAdsUserDefinedMetadata?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.completeSignedS3Upload(accessToken, bucketKey, objectKey, contentType, body, optionalArgs?.xAdsMetaContentType, optionalArgs?.xAdsMetaContentDisposition, optionalArgs?.xAdsMetaContentEncoding, optionalArgs?.xAdsMetaCacheControl, optionalArgs?.xAdsUserDefinedMetadata, optionalArgs?.options); + const response = await this.objectApi.completeSignedS3Upload(accessToken, bucketKey, objectKey, contentType, body, optionalArgs?.xAdsMetaContentType, optionalArgs?.xAdsMetaContentDisposition, optionalArgs?.xAdsMetaContentEncoding, optionalArgs?.xAdsMetaCacheControl, optionalArgs?.xAdsUserDefinedMetadata, optionalArgs?.options); return response.content; } @@ -101,7 +105,7 @@ export class OssClient { * @throws {RequiredError} */ public async copyTo(accessToken: string, bucketKey: string, objectKey: string, newObjName: string, optionalArgs?: { xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.copyTo(accessToken, bucketKey, objectKey, newObjName, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?.options); + const response = await this.objectApi.copyTo(accessToken, bucketKey, objectKey, newObjName, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?.options); return response.content; } @@ -114,8 +118,8 @@ export class OssClient { * @throws {RequiredError} * @memberof OSSApiInterface */ - public async createBucket(accessToken: string, xAdsRegion: CreateBucketXAdsRegionEnum, bucketPayload: CreateBucketsPayload, optionalArgs?: { options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.createBucket(accessToken, xAdsRegion, bucketPayload, optionalArgs?.options); + public async createBucket(accessToken: string, xAdsRegion: Region, bucketPayload: CreateBucketsPayload, optionalArgs?: { options?: ApsServiceRequestConfig }): Promise { + const response = await this.bucketApi.createBucket(accessToken, bucketPayload, xAdsRegion, optionalArgs?.options); return response.content; } @@ -129,8 +133,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async createSignedResource(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { access?: CreateSignedResourceAccessEnum, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.createSignedResource(accessToken, bucketKey, objectKey, optionalArgs?.access, optionalArgs?.useCdn, optionalArgs?.createSignedResource, optionalArgs?.options); + public async createSignedResource(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { access?: Access, useCdn?: boolean, createSignedResource?: CreateSignedResource, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.createSignedResource(accessToken, bucketKey, objectKey, optionalArgs?.access, optionalArgs?.useCdn, optionalArgs?.createSignedResource, optionalArgs?.options); return response.content; } /** @@ -142,7 +146,7 @@ export class OssClient { * @memberof OSSApiInterface */ public async deleteBucket(accessToken: string, bucketKey: string, optionalArgs?: { options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.deleteBucket(accessToken, bucketKey, optionalArgs?.options); + const response = await this.bucketApi.deleteBucket(accessToken, bucketKey, optionalArgs?.options); return response.content; } @@ -160,7 +164,7 @@ export class OssClient { * @memberof OSSApiInterface */ public async deleteObject(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { AdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.deleteObject(accessToken, bucketKey, objectKey, optionalArgs?.AdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?.options); + const response = await this.objectApi.deleteObject(accessToken, bucketKey, objectKey, optionalArgs?.AdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?.options); return response.content; } @@ -171,8 +175,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async deleteSignedResource(accessToken: string, hash: string, optionalArgs?: { region?: DeleteSignedResourceRegionEnum, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.deleteSignedResource(accessToken, hash, optionalArgs?.region, optionalArgs?.options); + public async deleteSignedResource(accessToken: string, hash: string, optionalArgs?: { region?: Region, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.deleteSignedResource(accessToken, hash, optionalArgs?.region, optionalArgs?.options); return response.content; } /** @@ -184,7 +188,7 @@ export class OssClient { * @memberof OSSApiInterface */ public async getBucketDetails(accessToken: string, bucketKey: string, optionalArgs?: { options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.getBucketDetails(accessToken, bucketKey, optionalArgs?.options); + const response = await this.bucketApi.getBucketDetails(accessToken, bucketKey, optionalArgs?.options); return response.content; } /** @@ -197,8 +201,8 @@ export class OssClient { * @throws {RequiredError} * @memberof OSSApiInterface */ - public async getBuckets(accessToken: string, optionalArgs?: { region?: GetBucketsRegionEnum, limit?: number, startAt?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.getBuckets(accessToken, optionalArgs?.region, optionalArgs?.limit, optionalArgs?.startAt, optionalArgs?.options); + public async getBuckets(accessToken: string, optionalArgs?: { region?: Region, limit?: number, startAt?: string, options?: ApsServiceRequestConfig }): Promise { + const response = await this.bucketApi.getBuckets(accessToken, optionalArgs?.region, optionalArgs?.limit, optionalArgs?.startAt, optionalArgs?.options); return response.content; } @@ -217,8 +221,8 @@ export class OssClient { * @memberof OSSApiInterface */ - public async getObjectDetails(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: GetObjectDetailsWithEnum, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.getObjectDetails(accessToken, bucketKey, objectKey, optionalArgs?.ifModifiedSince, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?._with, optionalArgs?.options); + public async getObjectDetails(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: With, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.getObjectDetails(accessToken, bucketKey, objectKey, optionalArgs?.ifModifiedSince, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?._with, optionalArgs?.options); return response.content; } /** @@ -233,7 +237,7 @@ export class OssClient { * @memberof OSSApiInterface */ public async getObjects(accessToken: string, bucketKey: string, optionalArgs?: { limit?: number, beginsWith?: string, startAt?: string }): Promise { - const response = await this.ossApi.getObjects(accessToken, bucketKey, optionalArgs?.limit, optionalArgs?.beginsWith, optionalArgs?.startAt); + const response = await this.objectApi.getObjects(accessToken, bucketKey, optionalArgs?.limit, optionalArgs?.beginsWith, optionalArgs?.startAt); return response.content; } @@ -250,8 +254,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async getSignedResource(accessToken: string, hash: string, optionalArgs?: { range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: GetSignedResourceRegionEnum, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.getSignedResource(accessToken, hash, optionalArgs?.range, optionalArgs?.ifNoneMatch, optionalArgs?.ifModifiedSince, optionalArgs?.acceptEncoding, optionalArgs?.region, optionalArgs?.responseContentDisposition, optionalArgs?.responseContentType, optionalArgs?.options); + public async getSignedResource(accessToken: string, hash: string, optionalArgs?: { range?: string, ifNoneMatch?: string, ifModifiedSince?: string, acceptEncoding?: string, region?: Region, responseContentDisposition?: string, responseContentType?: string, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.getSignedResource(accessToken, hash, optionalArgs?.range, optionalArgs?.ifNoneMatch, optionalArgs?.ifModifiedSince, optionalArgs?.acceptEncoding, optionalArgs?.region, optionalArgs?.responseContentDisposition, optionalArgs?.responseContentType, optionalArgs?.options); return response.content; } /** @@ -266,8 +270,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async headObjectDetails(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: HeadObjectDetailsWithEnum, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.headObjectDetails(accessToken, bucketKey, objectKey, optionalArgs?.ifModifiedSince, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?._with, optionalArgs?.options); + public async headObjectDetails(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { ifModifiedSince?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, _with?: With, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.headObjectDetails(accessToken, bucketKey, objectKey, optionalArgs?.ifModifiedSince, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?._with, optionalArgs?.options); return response.content; } /** @@ -284,10 +288,10 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async postUpload(accessToken: string, bucketKey: string, contentLength: number, xAdsObjectName: string, xAdsObjectSize: number, optionalArgs?: { contentType?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, xAdsMetaCacheControl?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.postUpload(accessToken, bucketKey, contentLength, xAdsObjectName, xAdsObjectSize, optionalArgs?.contentType, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?.xAdsMetaCacheControl, optionalArgs?.options); - return response.content; - } + // public async postUpload(accessToken: string, bucketKey: string, contentLength: number, xAdsObjectName: string, xAdsObjectSize: number, optionalArgs?: { contentType?: string, xAdsAcmNamespace?: string, xAdsAcmCheckGroups?: string, xAdsAcmGroups?: string, xAdsMetaCacheControl?: string, options?: ApsServiceRequestConfig }): Promise { + // const response = await this.bucketApi.postUpload(accessToken, bucketKey, contentLength, xAdsObjectName, xAdsObjectSize, optionalArgs?.contentType, optionalArgs?.xAdsAcmNamespace, optionalArgs?.xAdsAcmCheckGroups, optionalArgs?.xAdsAcmGroups, optionalArgs?.xAdsMetaCacheControl, optionalArgs?.options); + // return response.content; + // } /** * Gets a signed URL to a download an object directly from S3, bypassing OSS servers. This signed URL expires in 60 seconds, so the request must begin within that time frame; the actual data transfer can take longer. Note that resumable uploads store each chunk individually; after the upload completes, an async process merges all the chunks and creates the definitive OSS file. If you request a signed URL before the async process completes, the response returns a map of S3 URLs, one per chunk; the key is the byte range of the total file to which the chunk corresponds. If you need a single URL in the response, you can use OSS signed resource functionality by setting the \'public-resource-fallback\' query parameter to true. Lastly, note that ranged downloads can be used with the returned URL. * @param {string} bucketKey URL-encoded bucket key @@ -306,7 +310,7 @@ export class OssClient { * @throws {RequiredError} */ public async signedS3Download(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { ifNoneMatch?: string, ifModifiedSince?: string, xAdsAcmScopes?: string, responseContentType?: string, responseContentDisposition?: string, responseCacheControl?: string, publicResourceFallback?: boolean, minutesExpiration?: number, useCdn?: boolean, redirect?: boolean, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.signedS3Download(accessToken, bucketKey, objectKey, optionalArgs?.ifNoneMatch, optionalArgs?.ifModifiedSince, optionalArgs?.xAdsAcmScopes, optionalArgs?.responseContentType, optionalArgs?.responseContentDisposition, optionalArgs?.responseCacheControl, optionalArgs?.publicResourceFallback, optionalArgs?.minutesExpiration, optionalArgs?.useCdn, optionalArgs?.redirect, optionalArgs?.options); + const response = await this.objectApi.signedS3Download(accessToken, bucketKey, objectKey, optionalArgs?.ifNoneMatch, optionalArgs?.ifModifiedSince, optionalArgs?.xAdsAcmScopes, optionalArgs?.responseContentType, optionalArgs?.responseContentDisposition, optionalArgs?.responseCacheControl, optionalArgs?.publicResourceFallback, optionalArgs?.minutesExpiration, optionalArgs?.useCdn, optionalArgs?.redirect, optionalArgs?.options); return response.content; } /** @@ -321,8 +325,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async signedS3Upload(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.signedS3Upload(accessToken, bucketKey, objectKey, optionalArgs?.xAdsAcmScopes, optionalArgs?.parts, optionalArgs?.firstPart, optionalArgs?.uploadKey, optionalArgs?.minutesExpiration, optionalArgs?.options); + public async signedS3Upload(accessToken: string, bucketKey: string, objectKey: string, optionalArgs?: { xAdsAcmScopes?: string, parts?: number, firstPart?: number, uploadKey?: string, minutesExpiration?: number, useAcceleration?: boolean, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.signedS3Upload(accessToken, bucketKey, objectKey, optionalArgs?.xAdsAcmScopes, optionalArgs?.parts, optionalArgs?.firstPart, optionalArgs?.uploadKey, optionalArgs?.minutesExpiration, optionalArgs.useAcceleration, optionalArgs?.options); return response.content; } /** @@ -337,8 +341,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async uploadSignedResource(accessToken: string, hash: string, contentLength: number, body: File, optionalArgs?: { contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourceXAdsRegionEnum, ifMatch?: string, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.uploadSignedResource(accessToken, hash, contentLength, body, optionalArgs?.contentType, optionalArgs?.contentDisposition, optionalArgs?.xAdsRegion, optionalArgs?.ifMatch, optionalArgs?.options); + public async uploadSignedResource(accessToken: string, hash: string, contentLength: number, body: File, optionalArgs?: { contentType?: string, contentDisposition?: string, xAdsRegion?: Region, ifMatch?: string, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.uploadSignedResource(accessToken, hash, contentLength, body, optionalArgs?.contentType, optionalArgs?.contentDisposition, optionalArgs?.xAdsRegion, optionalArgs?.ifMatch, optionalArgs?.options); return response.content; } /** @@ -353,8 +357,8 @@ export class OssClient { * @param {*} [options] Override http request option. * @throws {RequiredError} */ - public async uploadSignedResourcesChunk(accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, optionalArgs?: { contentType?: string, contentDisposition?: string, xAdsRegion?: UploadSignedResourcesChunkXAdsRegionEnum, options?: ApsServiceRequestConfig }): Promise { - const response = await this.ossApi.uploadSignedResourcesChunk(accessToken, hash, contentRange, sessionId, body, optionalArgs?.contentType, optionalArgs?.contentDisposition, optionalArgs?.xAdsRegion, optionalArgs?.options); + public async uploadSignedResourcesChunk(accessToken: string, hash: string, contentRange: string, sessionId: string, body: File, optionalArgs?: { contentType?: string, contentDisposition?: string, xAdsRegion?: Region, options?: ApsServiceRequestConfig }): Promise { + const response = await this.objectApi.uploadSignedResourcesChunk(accessToken, hash, contentRange, sessionId, body, optionalArgs?.contentType, optionalArgs?.contentDisposition, optionalArgs?.xAdsRegion, optionalArgs?.options); return response.content; } } \ No newline at end of file diff --git a/oss/source/model/access.ts b/oss/source/model/access.ts new file mode 100644 index 0000000..7b23271 --- /dev/null +++ b/oss/source/model/access.ts @@ -0,0 +1,20 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * Access for signed resource Acceptable values: read, write, readwrite Default value: read + * @export + * @enum {string} + */ + +export const Access = { + Read: 'Read', + Write: 'Write', + ReadWrite: 'ReadWrite' +} as const; + +export type Access = typeof Access[keyof typeof Access]; + + + diff --git a/oss/source/model/batch-completed-results-parts.ts b/oss/source/model/batch-completed-results-parts.ts new file mode 100644 index 0000000..912f2c4 --- /dev/null +++ b/oss/source/model/batch-completed-results-parts.ts @@ -0,0 +1,39 @@ +/* tslint:disable */ +/* eslint-disable */ + +import { Status } from './status'; + +/** + * + * @export + * @interface BatchCompletedResultsParts + */ +export interface BatchCompletedResultsParts { + /** + * The index of the first part in the multipart upload. + * @type {number} + * @memberof BatchCompletedResultsParts + */ + 'firstPart'?: number; + /** + * + * @type {Status} + * @memberof BatchCompletedResultsParts + */ + 'status'?: Status; + /** + * The size of the corresponding part detected in S3. + * @type {number} + * @memberof BatchCompletedResultsParts + */ + 'size'?: number; + /** + * The eTag of the detected part in S3. + * @type {string} + * @memberof BatchCompletedResultsParts + */ + 'eTag'?: string; +} + + + diff --git a/oss/source/model/batch-completed-results.ts b/oss/source/model/batch-completed-results.ts new file mode 100644 index 0000000..9454eee --- /dev/null +++ b/oss/source/model/batch-completed-results.ts @@ -0,0 +1,79 @@ +/* tslint:disable */ +/* eslint-disable */ + +import { BatchCompletedResultsParts } from './batch-completed-results-parts'; + +/** + * + * @export + * @interface BatchCompletedResults + */ +export interface BatchCompletedResults { + /** + * If this attribute is not returned, completion has succeeded. If the value of this attribute is \"error\", completion failed.\' + * @type {string} + * @memberof BatchCompletedResults + */ + 'status'?: string; + /** + * The bucket key of the bucket the object was uploaded to. + * @type {string} + * @memberof BatchCompletedResults + */ + 'bucketKey'?: string; + /** + * The URL-encoded human friendly name of the object. + * @type {string} + * @memberof BatchCompletedResults + */ + 'objectKey'?: string; + /** + * An identifier (URN) that uniquely and persistently identifies the object. + * @type {string} + * @memberof BatchCompletedResults + */ + 'objectId'?: string; + /** + * The total amount of storage space occupied by the object, in bytes. + * @type {number} + * @memberof BatchCompletedResults + */ + 'size'?: number; + /** + * The format of the data stored within the object, expressed as a MIME type. This attribute is returned only if it was specified when the object was uploaded. + * @type {string} + * @memberof BatchCompletedResults + */ + 'contentType'?: string; + /** + * The Content-Disposition value for the uploaded object as recorded within OSS. This attribute is returned only if it was specified when the object was uploaded. + * @type {string} + * @memberof BatchCompletedResults + */ + 'contentDisposition'?: string; + /** + * The Content-Encoding value for the uploaded object as recorded within OSS. This attribute is returned only if it was specified when the object was uploaded. + * @type {string} + * @memberof BatchCompletedResults + */ + 'contentEncoding'?: string; + /** + * The Cache-Control value for the uploaded object as recorded within OSS. This attribute is returned only if it was specified when the object was uploaded. + * @type {string} + * @memberof BatchCompletedResults + */ + 'cacheControl'?: string; + /** + * An array containing the status of each part, indicating any issues with eTag or size mismatch issues. + * @type {Array} + * @memberof BatchCompletedResults + */ + 'parts'?: Array; + /** + * The reason for the failure, if the status is ``error``. + * @type {string} + * @memberof BatchCompletedResults + */ + 'reason'?: string; +} + diff --git a/oss/source/model/batch-copy-objects.ts b/oss/source/model/batch-copy-objects.ts deleted file mode 100644 index 796c122..0000000 --- a/oss/source/model/batch-copy-objects.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchCopyObjects - */ -export interface BatchCopyObjects { - /** - * The key to be given to the copied object. - * @type {string} - * @memberof BatchCopyObjects - */ - 'objectKey': string; - /** - * The SHA-1 hash of the object to be copied. - * @type {string} - * @memberof BatchCopyObjects - */ - 'sha1': string; -} - diff --git a/oss/source/model/batch-copy.ts b/oss/source/model/batch-copy.ts deleted file mode 100644 index 63b089a..0000000 --- a/oss/source/model/batch-copy.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { BatchCopyObjects } from './batch-copy-objects'; - -/** - * - * @export - * @interface BatchCopy - */ -export interface BatchCopy { - /** - * An array of objects indicating the objects to copy and the keys to assign to the copies. - * @type {Array} - * @memberof BatchCopy - */ - 'objects'?: Array; -} - diff --git a/oss/source/model/batch-delete-details.ts b/oss/source/model/batch-delete-details.ts deleted file mode 100644 index aa62e2e..0000000 --- a/oss/source/model/batch-delete-details.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchDeleteDetails - */ -export interface BatchDeleteDetails { - /** - * The ID of the batch delete process. - * @type {string} - * @memberof BatchDeleteDetails - */ - 'uuid': string; - /** - * The ISO8601 date in which the process was created. - * @type {string} - * @memberof BatchDeleteDetails - */ - 'created': string; - /** - * The ISO8601 date in which the actual deletion process was initiated. - * @type {string} - * @memberof BatchDeleteDetails - */ - 'initiated'?: string; - /** - * The ISO8601 date in which the process was completed. - * @type {string} - * @memberof BatchDeleteDetails - */ - 'completed'?: string; - /** - * The state of the batch deletion process; can be \'CREATED\' (scheduled but not started), \'INITIATED\' (started but deletion not completed), or \'COMPLETED\' (deletion complete, full report of results should be available) - * @type {string} - * @memberof BatchDeleteDetails - */ - 'status': BatchDeleteDetailsStatusEnum; - /** - * The URL to poll to check for completion. Will return 200 OK when process is completed and 404 NOT FOUND otherwise. This should be taken as an opaque URL with no expected pattern as it could be subject to change. - * @type {string} - * @memberof BatchDeleteDetails - */ - 'poll': string; - /** - * A map from each object key in the original request, to the deletion status of that object key. The state can be \'Pending\' (object has not yet been processed), \'Deleted\' (object successfully deleted), \'NotFound\' (object not found), or \'Error\' (object could not be deleted because of an unexpected error; user may want to manually verify the object and issue a new delete request). - * @type {object} - * @memberof BatchDeleteDetails - */ - 'objectKeys': object; -} - -export const BatchDeleteDetailsStatusEnum = { - Created: 'CREATED', - Initiated: 'INITIATED', - Completed: 'COMPLETED' -} as const; - -export type BatchDeleteDetailsStatusEnum = typeof BatchDeleteDetailsStatusEnum[keyof typeof BatchDeleteDetailsStatusEnum]; - - diff --git a/oss/source/model/batch-delete-list-processes.ts b/oss/source/model/batch-delete-list-processes.ts deleted file mode 100644 index d35d11d..0000000 --- a/oss/source/model/batch-delete-list-processes.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchDeleteListProcesses - */ -export interface BatchDeleteListProcesses { - /** - * The ID of the batch delete process. - * @type {string} - * @memberof BatchDeleteListProcesses - */ - 'uuid': string; - /** - * The ISO8601 date in which the process was created. - * @type {string} - * @memberof BatchDeleteListProcesses - */ - 'created': string; - /** - * The ISO8601 date in which the actual deletion process was initiated. - * @type {string} - * @memberof BatchDeleteListProcesses - */ - 'initiated'?: string; - /** - * The ISO8601 date in which the process was completed. - * @type {string} - * @memberof BatchDeleteListProcesses - */ - 'completed'?: string; - /** - * The state of the batch deletion process; can be \'CREATED\' (scheduled but not started), \'INITIATED\' (started but deletion not completed), or \'COMPLETED\' (deletion complete, full report of results should be available) - * @type {string} - * @memberof BatchDeleteListProcesses - */ - 'status': BatchDeleteListProcessesStatusEnum; - /** - * The URL to poll to check for completion. Will return 200 OK when process is completed and 404 NOT FOUND otherwise. This should be taken as an opaque URL with no expected pattern as it could be subject to change. - * @type {string} - * @memberof BatchDeleteListProcesses - */ - 'poll': string; -} - -export const BatchDeleteListProcessesStatusEnum = { - Created: 'CREATED', - Initiated: 'INITIATED', - Completed: 'COMPLETED' -} as const; - -export type BatchDeleteListProcessesStatusEnum = typeof BatchDeleteListProcessesStatusEnum[keyof typeof BatchDeleteListProcessesStatusEnum]; - - diff --git a/oss/source/model/batch-delete-list.ts b/oss/source/model/batch-delete-list.ts deleted file mode 100644 index d6709d2..0000000 --- a/oss/source/model/batch-delete-list.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { BatchDeleteListProcesses } from './batch-delete-list-processes'; - -/** - * - * @export - * @interface BatchDeleteList - */ -export interface BatchDeleteList { - /** - * List of batch delete processes for the bucket. - * @type {Array} - * @memberof BatchDeleteList - */ - 'processes': Array; -} - diff --git a/oss/source/model/batch-delete-results.ts b/oss/source/model/batch-delete-results.ts deleted file mode 100644 index 136860b..0000000 --- a/oss/source/model/batch-delete-results.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchDeleteResults - */ -export interface BatchDeleteResults { - /** - * The ID of the created process. - * @type {string} - * @memberof BatchDeleteResults - */ - 'uuid': string; - /** - * The ISO8601 date in which the process was created. - * @type {string} - * @memberof BatchDeleteResults - */ - 'created': string; - /** - * The state of the process. Will always be \'CREATED\'. - * @type {string} - * @memberof BatchDeleteResults - */ - 'status': string; - /** - * The URL to poll to check for completion. That URL will return 200 OK when the process is completed, and 404 NOT FOUND otherwise. This should be taken as an opaque URL with no expected pattern, as it could be subject to change. - * @type {string} - * @memberof BatchDeleteResults - */ - 'poll': string; -} - diff --git a/oss/source/model/batch-object-details-objects.ts b/oss/source/model/batch-object-details-objects.ts deleted file mode 100644 index ed5cf58..0000000 --- a/oss/source/model/batch-object-details-objects.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchObjectDetailsObjects - */ -export interface BatchObjectDetailsObjects { - /** - * The key of the object - * @type {string} - * @memberof BatchObjectDetailsObjects - */ - 'objectKey': string; - /** - * The size of the object in bytes - * @type {number} - * @memberof BatchObjectDetailsObjects - */ - 'size': number; - /** - * The URN of the object - * @type {string} - * @memberof BatchObjectDetailsObjects - */ - 'objectId'?: string; - /** - * The SHA1 hash of the object - * @type {string} - * @memberof BatchObjectDetailsObjects - */ - 'sha1'?: string; - /** - * Object content-type - * @type {string} - * @memberof BatchObjectDetailsObjects - */ - 'contentType'?: string; - /** - * URL to download the object - * @type {string} - * @memberof BatchObjectDetailsObjects - */ - 'location'?: string; - /** - * Epoch timestamp when the object was created. Only provided if the user requests this to be included in the query parameters. - * @type {number} - * @memberof BatchObjectDetailsObjects - */ - 'createdDate'?: number; - /** - * Epoch timestamp when the object was last accessed. Only provided if the user requests this to be included in the query parameters. - * @type {number} - * @memberof BatchObjectDetailsObjects - */ - 'lastAccessedDate'?: number; - /** - * Epoch timestamp when the object was last modified. Only provided if the user requests this to be included in the query parameters. - * @type {number} - * @memberof BatchObjectDetailsObjects - */ - 'lastModifiedDate'?: number; - /** - * When specified, the response will include the user defined metadata in a JSON field named userDefinedMetadata, if available. The user defined metadata can be set on file uploading. - * @type {string} - * @memberof BatchObjectDetailsObjects - */ - 'userDefinedMetadata'?: string; -} - diff --git a/oss/source/model/batch-object-details.ts b/oss/source/model/batch-object-details.ts deleted file mode 100644 index c4087f4..0000000 --- a/oss/source/model/batch-object-details.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { BatchObjectDetailsObjects } from './batch-object-details-objects'; - -/** - * - * @export - * @interface BatchObjectDetails - */ -export interface BatchObjectDetails { - /** - * Key of the bucket containing all the objects - * @type {string} - * @memberof BatchObjectDetails - */ - 'bucketKey'?: string; - /** - * Array of the information about each object. - * @type {Array} - * @memberof BatchObjectDetails - */ - 'objects'?: Array; -} - diff --git a/oss/source/model/batchcompleteupload-object-requests.ts b/oss/source/model/batchcompleteupload-object-requests.ts index fde7532..f525bc2 100644 --- a/oss/source/model/batchcompleteupload-object-requests.ts +++ b/oss/source/model/batchcompleteupload-object-requests.ts @@ -9,55 +9,55 @@ */ export interface BatchcompleteuploadObjectRequests { /** - * The key/name of the object for which to complete an upload. + * The URL-encoded human friendly name of the object for which to complete an upload. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ 'objectKey': string; /** - * The key of the upload to complete. + * The ID uniquely identifying the upload session that was returned when you obtained the signed upload URL. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ 'uploadKey': string; /** - * The size of the object for which to complete an upload. If provided, OSS will fail the upload completion if the size does not match that of the data found in S3. + * The expected size of the object. If provided, OSS will check this against the object in S3 and return an error if the size does not match. * @type {number} * @memberof BatchcompleteuploadObjectRequests */ 'size'?: number; /** - * The eTags of the parts uploaded to S3, exactly as returned by S3. The index of an eTag in the array corresponds to the number of the part in the entire object. If provided, OSS will fail the upload completion if any part does not match the data found in S3. + * An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate these eTags against the content in S3, and return an error if the eTags do not match. * @type {Array} * @memberof BatchcompleteuploadObjectRequests */ 'eTags'?: Array; /** - * The Content-Type value that OSS will store in the record for the uploaded object. + * The Content-Type value for the uploaded object to record within OSS. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ 'x-ads-meta-Content-Type'?: string; /** - * The Content-Disposition value that OSS will store in the record for the uploaded object. + * The Content-Disposition value for the uploaded object to record within OSS. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ 'x-ads-meta-Content-Disposition'?: string; /** - * The Content-Encoding value that OSS will store in the record for the uploaded object. + * The Content-Encoding value for the uploaded object to record within OSS. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ 'x-ads-meta-Content-Encoding'?: string; /** - * The Cache-Control value that OSS will store in the record for the uploaded object. + * The Cache-Control value for the uploaded object to record within OSS. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ 'x-ads-meta-Cache-Control'?: string; /** - * This parameter allows setting any custom metadata to be stored with the object, which can be retrieved later on download or when getting the object details. It has the following restrictions: - It must have a JSON format. - The maximum length is 100 bytes + * Custom metadata to be stored with the object, which can be retrieved later on download or when retrieving object details. Must be a JSON object that is less than 100 bytes. * @type {string} * @memberof BatchcompleteuploadObjectRequests */ diff --git a/oss/source/model/batchcompleteupload-response-results-value-parts.ts b/oss/source/model/batchcompleteupload-response-results-value-parts.ts deleted file mode 100644 index 57f0613..0000000 --- a/oss/source/model/batchcompleteupload-response-results-value-parts.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchcompleteuploadResponseResultsValueParts - */ -export interface BatchcompleteuploadResponseResultsValueParts { - /** - * The index of the part in the multipart upload. - * @type {number} - * @memberof BatchcompleteuploadResponseResultsValueParts - */ - 'firstPart'?: number; - /** - * Indicates whether this particular part uploaded to S3 is valid. Possible values are: - Pending: no part has been uploaded to S3 for this index. - Unexpected: the eTag of the part in S3 does not match the one provided in the request. - TooSmall: the chunk uploaded to S3 is smaller than 5MB, for any chunk except the final one. - Unexpected+TooSmall: the chunk is both too small and has an eTag mismatch. - Ok: The chunk has no issues. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValueParts - */ - 'status'?: BatchcompleteuploadResponseResultsValuePartsStatusEnum; - /** - * The size of the corresponding part detected in S3. - * @type {number} - * @memberof BatchcompleteuploadResponseResultsValueParts - */ - 'size'?: number; - /** - * The eTag of the detected part in S3. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValueParts - */ - 'eTag'?: string; -} - -export const BatchcompleteuploadResponseResultsValuePartsStatusEnum = { - Pending: 'Pending', - Unexpected: 'Unexpected', - TooSmall: 'TooSmall', - UnexpectedTooSmall: 'Unexpected+TooSmall', - Ok: 'Ok' -} as const; - -export type BatchcompleteuploadResponseResultsValuePartsStatusEnum = typeof BatchcompleteuploadResponseResultsValuePartsStatusEnum[keyof typeof BatchcompleteuploadResponseResultsValuePartsStatusEnum]; - - diff --git a/oss/source/model/batchcompleteupload-response-results-value.ts b/oss/source/model/batchcompleteupload-response-results-value.ts deleted file mode 100644 index 3f44127..0000000 --- a/oss/source/model/batchcompleteupload-response-results-value.ts +++ /dev/null @@ -1,79 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { BatchcompleteuploadResponseResultsValueParts } from './batchcompleteupload-response-results-value-parts'; - -/** - * - * @export - * @interface BatchcompleteuploadResponseResultsValue - */ -export interface BatchcompleteuploadResponseResultsValue { - /** - * A string indicating whether the object completion failed. If this is not present, assume the completion succeeded. If this is \"error\", then the object completion failed. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'status'?: string; - /** - * The key of the bucket into which the object was uploaded. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'bucketKey'?: string; - /** - * The key of the object. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'objectKey'?: string; - /** - * The URN of the object. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'objectId'?: string; - /** - * The size of the object in bytes, if successful. If unsuccessful due to a size mismatch, this is an object with information about the mismatch. - * @type {number} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'size'?: number; - /** - * The Content-Type stored for the object, if provided. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'contentType'?: string; - /** - * The Content-Disposition stored for the object, if provided. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'contentDisposition'?: string; - /** - * The Content-Encoding stored for the object, if provided. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'contentEncoding'?: string; - /** - * The Cache-Control stored for the object, if provided. - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'cacheControl'?: string; - /** - * An array containing the status of each part, indicating any issues in eTag mismatch or size issues. - * @type {Array} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'parts'?: Array; - /** - * The reason for the failure, if the status is \"error\". - * @type {string} - * @memberof BatchcompleteuploadResponseResultsValue - */ - 'reason'?: string; -} - diff --git a/oss/source/model/batchcompleteupload-response.ts b/oss/source/model/batchcompleteupload-response.ts index b626c1c..762e981 100644 --- a/oss/source/model/batchcompleteupload-response.ts +++ b/oss/source/model/batchcompleteupload-response.ts @@ -1,7 +1,7 @@ /* tslint:disable */ /* eslint-disable */ -import { BatchcompleteuploadResponseResultsValue } from './batchcompleteupload-response-results-value'; +import { BatchCompletedResults } from './batch-completed-results'; /** * @@ -11,9 +11,9 @@ import { BatchcompleteuploadResponseResultsValue } from './batchcompleteupload-r export interface BatchcompleteuploadResponse { /** * A map of the returned results; each key in the map corresponds to an object key in the batch, and the value includes the results for that object. - * @type {{ [key: string]: BatchcompleteuploadResponseResultsValue; }} + * @type {{ [key: string]: BatchCompletedResults; }} * @memberof BatchcompleteuploadResponse */ - 'results'?: { [key: string]: BatchcompleteuploadResponseResultsValue; }; + 'results': { [key: string]: BatchCompletedResults; }; } diff --git a/oss/source/model/batchdelete-request.ts b/oss/source/model/batchdelete-request.ts deleted file mode 100644 index d7fe9af..0000000 --- a/oss/source/model/batchdelete-request.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BatchdeleteRequest - */ -export interface BatchdeleteRequest { - /** - * - * @type {Array} - * @memberof BatchdeleteRequest - */ - 'objectKeys'?: Array; -} - diff --git a/oss/source/model/batchsigneds3download-object-requests.ts b/oss/source/model/batchsigneds3download-object-requests.ts index c3b8515..6f442e0 100644 --- a/oss/source/model/batchsigneds3download-object-requests.ts +++ b/oss/source/model/batchsigneds3download-object-requests.ts @@ -9,37 +9,37 @@ */ export interface Batchsigneds3downloadObjectRequests { /** - * The key of the object for which to create a download signed URL. + * The URL-encoded human friendly name of the object to download. * @type {string} * @memberof Batchsigneds3downloadObjectRequests */ 'objectKey'?: string; /** - * The value of the Content-Type header the client expects to receive from S3. If this attribute is not provided, it defaults to the value stored for the object itself. + * The value of the Content-Type header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Type header defaults to the value stored with OSS. * @type {string} * @memberof Batchsigneds3downloadObjectRequests */ 'response-content-type'?: string; /** - * The value of the Content-Disposition header the client expects to receive from S3. If this attribute is not provided, it defaults to the value stored for the object itself. + * The value of the Content-Disposition header you want to receive when you download the object using the signed URL. If you do not specify a value, the Content-Disposition header defaults to the value stored with OSS. * @type {string} * @memberof Batchsigneds3downloadObjectRequests */ 'response-content-disposition'?: string; /** - * The value of the Cache-Control header that the client expects to receive from S3. If this attribute is not provided, it defaults to the value stored for the object itself. + * The value of the Cache-Control header you want to receive when you download the object using the signed URL. If you do not specify a value, the Cache-Control header defaults to the value stored with OSS. * @type {string} * @memberof Batchsigneds3downloadObjectRequests */ 'response-cache-control'?: string; /** - * The value of the ETag of the object. If they match, the response body will show the status of this item as `skipped` with the reason `Not Modified`, as the client already has the data. + * The last known ETag value of the object. OSS returns the signed URL only if the ``If-None-Match`` header differs from the ETag value of the object on S3. If not, it returns a 304 \"Not Modified\" HTTP status. * @type {string} * @memberof Batchsigneds3downloadObjectRequests */ 'If-None-Match'?: string; /** - * If the requested object has not been modified since the time specified in this attribute, the response body will show the status of this item as `skipped` with the reason `Not Modified`, as the client still has the latest version of the data. + * A timestamp in the HTTP date format (Mon, DD Month YYYY HH:MM:SS GMT). A signed URL is returned only if the object has been modified since the specified timestamp. If not, a 304 (Not Modified) HTTP status is returned. * @type {string} * @memberof Batchsigneds3downloadObjectRequests */ diff --git a/oss/source/model/batchsigneds3download-object.ts b/oss/source/model/batchsigneds3download-object.ts index 588c24e..268576b 100644 --- a/oss/source/model/batchsigneds3download-object.ts +++ b/oss/source/model/batchsigneds3download-object.ts @@ -10,7 +10,7 @@ import { Batchsigneds3downloadObjectRequests } from './batchsigneds3download-obj */ export interface Batchsigneds3downloadObject { /** - * An array of objects, one for each object for which to generate a download signed URL. + * An array where each element is an object containing information needed to generate a signed S3 download URL. * @type {Array} * @memberof Batchsigneds3downloadObject */ diff --git a/oss/source/model/batchsigneds3upload-object-requests.ts b/oss/source/model/batchsigneds3upload-object-requests.ts index 02cca96..b1f0e5e 100644 --- a/oss/source/model/batchsigneds3upload-object-requests.ts +++ b/oss/source/model/batchsigneds3upload-object-requests.ts @@ -9,25 +9,25 @@ */ export interface Batchsigneds3uploadObjectRequests { /** - * The key/name of the object for which to create an S3 upload URL. If neither the \"part\" nor \"parts\" attribute is provided, OSS will return a single upload URL with which to upload the entire object. + * A URL-encoded human friendly name of the object to upload. * @type {string} * @memberof Batchsigneds3uploadObjectRequests */ 'objectKey': string; /** - * The index of an individual part for which to retrieve a chunk upload URL. + * The index of first chunk to be uploaded. * @type {number} * @memberof Batchsigneds3uploadObjectRequests */ 'firstPart'?: number; /** - * For a multipart upload, the number of chunk URLs to return. If X is provided, the response will include chunk URLs from 1 to X. If none provided, the response will include only a single URL with which to upload an entire object. + * The number of parts you intend to chunk the object for uploading. OSS will return that many signed URLs, one URL for each chunk. If you do not specify a value you\'ll get only one URL to upload the entire object. * @type {number} * @memberof Batchsigneds3uploadObjectRequests */ 'parts'?: number; /** - * The identifier of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. This must match the uploadKey returned by a previous call to this endpoint where the client requested more than one part URL. + * The ``uploadKey`` of a previously-initiated upload, in order to request more chunk upload URLs for the same upload. If you do not specify a value, OSS will initiate a new upload entirely. * @type {string} * @memberof Batchsigneds3uploadObjectRequests */ diff --git a/oss/source/model/batchsigneds3upload-object.ts b/oss/source/model/batchsigneds3upload-object.ts index 4cbe2cd..8f69bb5 100644 --- a/oss/source/model/batchsigneds3upload-object.ts +++ b/oss/source/model/batchsigneds3upload-object.ts @@ -10,7 +10,7 @@ import { Batchsigneds3uploadObjectRequests } from './batchsigneds3upload-object- */ export interface Batchsigneds3uploadObject { /** - * An array of objects, each of which represents a signed URL / URLs to retrieve. + * An array where each element is an object containing information needed to generate a signed S3 upload URL. * @type {Array} * @memberof Batchsigneds3uploadObject */ diff --git a/oss/source/model/batchsigneds3upload-response-results-value.ts b/oss/source/model/batchsigneds3upload-response-results-value.ts index 2683b5e..b311934 100644 --- a/oss/source/model/batchsigneds3upload-response-results-value.ts +++ b/oss/source/model/batchsigneds3upload-response-results-value.ts @@ -9,31 +9,31 @@ */ export interface Batchsigneds3uploadResponseResultsValue { /** - * Accompanies error state for the object and describes the error encountered + * Describes an error that was encountered. Returned only if the signed URL request for that object failed. * @type {string} * @memberof Batchsigneds3uploadResponseResultsValue */ 'reason'?: string; /** - * Appears when object is in error state + * Returned only if the signed URL request for that object failed. * @type {string} * @memberof Batchsigneds3uploadResponseResultsValue */ 'status'?: string; /** - * Time Stamp representing the upload abort date for which all parts must be uploaded for the object and the complete upload endpoint must be called. + * The deadline to call `Complete Batch Upload to S3 Signed URL `_ for the object. If not completed by this time, all uploaded data for this session will be discarded. * @type {string} * @memberof Batchsigneds3uploadResponseResultsValue */ 'uploadExpiration'?: string; /** - * The identifier of the upload session, to differentiate multiple attempts to upload data for the same object. This must be provided when re-requesting chunk URLs for the same blob if they expire, and when calling the Complete Upload endpoint. + * An ID that uniquely identifies the upload session. It allows OSS to differentiate between fresh upload attempts from attempts to resume uploading data for an active upload session, in case of network interruptions. You must provide this value when: - Re-requesting chunk URLs for an active upload session. - When calling the `Complete Batch Upload to S3 Signed URL `_ operation to end an active upload session. * @type {string} * @memberof Batchsigneds3uploadResponseResultsValue */ 'uploadKey': string; /** - * Time Stamp representing the expiration of the generated signed URLs. Note that when multiple parts/URLs are requested, there is a chance that this time stamp does not represent the expiration of all URLs in the group. Consider this expiration a very close approximation of the expiration of the URLs in the group + * The date and time, in the ISO 8601 format, indicating when the signed URLs will expire. * @type {string} * @memberof Batchsigneds3uploadResponseResultsValue */ diff --git a/oss/source/model/block-upload-request.ts b/oss/source/model/block-upload-request.ts deleted file mode 100644 index f52f2fa..0000000 --- a/oss/source/model/block-upload-request.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BlockUploadRequest - */ -export interface BlockUploadRequest { - /** - * - * @type {number} - * @memberof BlockUploadRequest - */ - 'fileSize'?: number; - /** - * - * @type {number} - * @memberof BlockUploadRequest - */ - 'blockSize'?: number; - /** - * - * @type {string} - * @memberof BlockUploadRequest - */ - 'sha1'?: string; - /** - * - * @type {Array} - * @memberof BlockUploadRequest - */ - 'blockHashes'?: Array; -} - diff --git a/oss/source/model/block-upload-response-missing-blocks.ts b/oss/source/model/block-upload-response-missing-blocks.ts deleted file mode 100644 index eb19dcb..0000000 --- a/oss/source/model/block-upload-response-missing-blocks.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BlockUploadResponseMissingBlocks - */ -export interface BlockUploadResponseMissingBlocks { - /** - * - * @type {string} - * @memberof BlockUploadResponseMissingBlocks - */ - 'blockHash'?: string; - /** - * - * @type {string} - * @memberof BlockUploadResponseMissingBlocks - */ - 'url'?: string; - /** - * - * @type {string} - * @memberof BlockUploadResponseMissingBlocks - */ - 'byteRange'?: string; -} - diff --git a/oss/source/model/block-upload-response.ts b/oss/source/model/block-upload-response.ts deleted file mode 100644 index 2231e0c..0000000 --- a/oss/source/model/block-upload-response.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { BlockUploadResponseMissingBlocks } from './block-upload-response-missing-blocks'; - -/** - * - * @export - * @interface BlockUploadResponse - */ -export interface BlockUploadResponse { - /** - * - * @type {string} - * @memberof BlockUploadResponse - */ - 'uploadKey'?: string; - /** - * - * @type {Array} - * @memberof BlockUploadResponse - */ - 'missingBlocks'?: Array; -} - diff --git a/oss/source/model/bucket-objects.ts b/oss/source/model/bucket-objects.ts index 487a78d..7d0f7db 100644 --- a/oss/source/model/bucket-objects.ts +++ b/oss/source/model/bucket-objects.ts @@ -4,7 +4,7 @@ import { ObjectDetails } from './object-details'; /** - * + * An array where each element represents an object in the bucket. * @export * @interface BucketObjects */ @@ -16,7 +16,7 @@ export interface BucketObjects { */ 'items'?: Array; /** - * Next possible request + * The URL to be used to retrieve the next page of results, if available. It will be present only when there are more items to be retrieved after the current set. * @type {string} * @memberof BucketObjects */ diff --git a/oss/source/model/bucket.ts b/oss/source/model/bucket.ts index aaa2557..9d39e9c 100644 --- a/oss/source/model/bucket.ts +++ b/oss/source/model/bucket.ts @@ -2,6 +2,7 @@ /* eslint-disable */ import { Permission } from './permission'; +import { PolicyKey } from './policy-key'; /** * @@ -10,34 +11,36 @@ import { Permission } from './permission'; */ export interface Bucket { /** - * The key of the Bucket + * Bucket key: An ID that uniquely identifies the bucket. * @type {string} * @memberof Bucket */ 'bucketKey'?: string; /** - * The owner of the Bucket + * The Client ID of the application that owns the bucket. * @type {string} * @memberof Bucket */ 'bucketOwner'?: string; /** - * The epoch time at which the bucket was created + * The time the bucket was created, represented as a Unix timestamp. * @type {string} * @memberof Bucket */ 'createdDate'?: string; /** - * + * An array of objects, where each object represents an application that can access the bucket. * @type {Array} * @memberof Bucket */ 'permissions'?: Array; /** - * The policy key - * @type {string} + * + * @type {PolicyKey} * @memberof Bucket */ - 'policyKey'?: string; + 'policyKey'?: PolicyKey; } + + diff --git a/oss/source/model/buckets-items.ts b/oss/source/model/buckets-items.ts index 11101b9..562badc 100644 --- a/oss/source/model/buckets-items.ts +++ b/oss/source/model/buckets-items.ts @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ +import { PolicyKey } from './policy-key'; /** * @@ -9,31 +10,24 @@ */ export interface BucketsItems { /** - * Bucket key + * Bucket key: An ID that uniquely identifies the bucket. * @type {string} * @memberof BucketsItems */ 'bucketKey': string; /** - * Timestamp in epoch time + * The time the bucket was created, represented as a Unix timestamp. * @type {number} * @memberof BucketsItems */ 'createdDate': number; /** - * Policy values: `transient`, `temporary` or `persistent` - * @type {string} + * + * @type {PolicyKey} * @memberof BucketsItems */ - 'policyKey': BucketsItemsPolicyKeyEnum; + 'policyKey': PolicyKey; } -export const BucketsItemsPolicyKeyEnum = { - Transient: 'transient', - Temporary: 'temporary', - Persistent: 'persistent' -} as const; - -export type BucketsItemsPolicyKeyEnum = typeof BucketsItemsPolicyKeyEnum[keyof typeof BucketsItemsPolicyKeyEnum]; diff --git a/oss/source/model/buckets-namespaces.ts b/oss/source/model/buckets-namespaces.ts deleted file mode 100644 index 24da508..0000000 --- a/oss/source/model/buckets-namespaces.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface BucketsNamespaces - */ -export interface BucketsNamespaces { - /** - * - * @type {Array} - * @memberof BucketsNamespaces - */ - 'namespaces'?: Array; -} - diff --git a/oss/source/model/buckets.ts b/oss/source/model/buckets.ts index 3a4f202..b578204 100644 --- a/oss/source/model/buckets.ts +++ b/oss/source/model/buckets.ts @@ -4,22 +4,22 @@ import { BucketsItems } from './buckets-items'; /** - * buckets json response + * * @export * @interface Buckets */ export interface Buckets { /** - * Array of items representing the buckets + * Array of objects, where each object represents a bucket. * @type {Array} * @memberof Buckets */ 'items': Array; /** - * Next possible request + * The URL to be used to retrieve the next page of results, if available. It will be present only when there are more items to be retrieved after the current set. * @type {string} * @memberof Buckets */ - 'next': string; + 'next'?: string; } diff --git a/oss/source/model/completes3upload-body.ts b/oss/source/model/completes3upload-body.ts index 98df9f5..0b459d4 100644 --- a/oss/source/model/completes3upload-body.ts +++ b/oss/source/model/completes3upload-body.ts @@ -9,19 +9,19 @@ */ export interface Completes3uploadBody { /** - * The identifier of the upload session, which was provided by OSS in the response to the request for the signed URL/s with which to upload the object. + * The ID uniquely identifying the upload session that was returned when you called `Get S3 Signed Upload URL `_. * @type {string} * @memberof Completes3uploadBody */ 'uploadKey': string; /** - * The expected size of the uploaded object. If provided, OSS will check this against the blob in S3 and return an error if the size does not match. + * The expected size of the object. If provided, OSS will check this against the object in S3 and return an error if the size does not match. * @type {number} * @memberof Completes3uploadBody */ 'size'?: number; /** - * An array of eTags. For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. + * An array of eTags. S3 returns an eTag to each upload request, be it for a chunk or an entire file. For a single-part upload, this array contains the expected eTag of the entire object. For a multipart upload, this array contains the expected eTag of each part of the upload; the index of an eTag in the array corresponds to its part number in the upload. If provided, OSS will validate these eTags against the content in S3, and return an error if the eTags do not match. * @type {Array} * @memberof Completes3uploadBody */ diff --git a/oss/source/model/completes3upload-response200.ts b/oss/source/model/completes3upload-response200.ts deleted file mode 100644 index 12354f7..0000000 --- a/oss/source/model/completes3upload-response200.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface Completes3uploadResponse200 - */ -export interface Completes3uploadResponse200 { - /** - * The key of the bucket into which the object has been uploaded. - * @type {string} - * @memberof Completes3uploadResponse200 - */ - 'bucketKey'?: string; - /** - * The full OSS URN of the object. - * @type {string} - * @memberof Completes3uploadResponse200 - */ - 'objectId'?: string; - /** - * The name of the object provided by the client. - * @type {string} - * @memberof Completes3uploadResponse200 - */ - 'objectKey'?: string; - /** - * The size of the object in bytes. - * @type {number} - * @memberof Completes3uploadResponse200 - */ - 'size'?: number; - /** - * The Content-Type of the object, specified in the request. - * @type {string} - * @memberof Completes3uploadResponse200 - */ - 'contentType'?: string; - /** - * The URL at which to download the object. - * @type {string} - * @memberof Completes3uploadResponse200 - */ - 'location'?: string; -} - diff --git a/oss/source/model/completes3upload-response400-parts.ts b/oss/source/model/completes3upload-response400-parts.ts deleted file mode 100644 index 52cc97a..0000000 --- a/oss/source/model/completes3upload-response400-parts.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface Completes3uploadResponse400Parts - */ -export interface Completes3uploadResponse400Parts { - /** - * The index of the part in the multipart upload. - * @type {number} - * @memberof Completes3uploadResponse400Parts - */ - 'part'?: number; - /** - * Indicates whether this particular part uploaded to S3 is valid. If no part has been uploaded to S3 for a particular index, the status will be \'Pending\'. If the eTag of the part in S3 does not match the one provided in the request, the status will be \'Unexpected\'. If the blob uploaded to S3 is smaller than the minimum chunk size (5MB for all parts except the final one), the status will be \'TooSmall\'. If both of the latter conditions are true, the status will be \'Unexpected+TooSmall\'. If none of these issues exist, the status will be \'Ok\'. - * @type {string} - * @memberof Completes3uploadResponse400Parts - */ - 'status'?: Completes3uploadResponse400PartsStatusEnum; - /** - * The size of the corresponding part detected in S3. - * @type {number} - * @memberof Completes3uploadResponse400Parts - */ - 'size'?: number; - /** - * The eTag of the detected part in S3. - * @type {string} - * @memberof Completes3uploadResponse400Parts - */ - 'eTag'?: string; -} - -export const Completes3uploadResponse400PartsStatusEnum = { - Ok: 'Ok', - Pending: 'Pending', - Unexpected: 'Unexpected', - TooSmall: 'TooSmall', - UnexpectedTooSmall: 'Unexpected+TooSmall' -} as const; - -export type Completes3uploadResponse400PartsStatusEnum = typeof Completes3uploadResponse400PartsStatusEnum[keyof typeof Completes3uploadResponse400PartsStatusEnum]; - - diff --git a/oss/source/model/completes3upload-response400-size.ts b/oss/source/model/completes3upload-response400-size.ts deleted file mode 100644 index bffcd6c..0000000 --- a/oss/source/model/completes3upload-response400-size.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * Describes any discrepancy between the expected object size provided by the user, and the actual object size detected in S3. This check is skipped entirely if the user provides to size parameter in the request. - * @export - * @interface Completes3uploadResponse400Size - */ -export interface Completes3uploadResponse400Size { - /** - * The expected object size provided in the request, in bytes. - * @type {number} - * @memberof Completes3uploadResponse400Size - */ - 'expected'?: number; - /** - * The actual size of the object in S3, in bytes. - * @type {number} - * @memberof Completes3uploadResponse400Size - */ - 'detected'?: number; -} - diff --git a/oss/source/model/completes3upload-response400.ts b/oss/source/model/completes3upload-response400.ts deleted file mode 100644 index 07e09b8..0000000 --- a/oss/source/model/completes3upload-response400.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { Completes3uploadResponse400Parts } from './completes3upload-response400-parts'; -import { Completes3uploadResponse400Size } from './completes3upload-response400-size'; - -/** - * - * @export - * @interface Completes3uploadResponse400 - */ -export interface Completes3uploadResponse400 { - /** - * Any top-level details about why the request was rejected. - * @type {string} - * @memberof Completes3uploadResponse400 - */ - 'reason': string; - /** - * The identifier of the upload the user attempted to complete, if one is provided. - * @type {string} - * @memberof Completes3uploadResponse400 - */ - 'uploadKey'?: string; - /** - * - * @type {Completes3uploadResponse400Size} - * @memberof Completes3uploadResponse400 - */ - 'size'?: Completes3uploadResponse400Size; - /** - * An array containing the status of each part, indicating any issues in eTag mismatch or size issues. - * @type {Array} - * @memberof Completes3uploadResponse400 - */ - 'parts'?: Array; -} - diff --git a/oss/source/model/copy-batch-results1.ts b/oss/source/model/copy-batch-results1.ts deleted file mode 100644 index d3d0831..0000000 --- a/oss/source/model/copy-batch-results1.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { ObjectDetails } from './object-details'; - -/** - * - * @export - * @interface CopyBatchResults1 - */ -export interface CopyBatchResults1 { - /** - * The key of the source object - * @type {string} - * @memberof CopyBatchResults1 - */ - 'from'?: string; - /** - * The key of the destination object - * @type {string} - * @memberof CopyBatchResults1 - */ - 'to'?: string; - /** - * - * @type {ObjectDetails} - * @memberof CopyBatchResults1 - */ - 'result'?: ObjectDetails; -} - diff --git a/oss/source/model/copy-batch-sha1-results1.ts b/oss/source/model/copy-batch-sha1-results1.ts deleted file mode 100644 index e812574..0000000 --- a/oss/source/model/copy-batch-sha1-results1.ts +++ /dev/null @@ -1,31 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { ObjectDetails } from './object-details'; - -/** - * - * @export - * @interface CopyBatchSha1Results1 - */ -export interface CopyBatchSha1Results1 { - /** - * The SHA-1 hash of the source object - * @type {string} - * @memberof CopyBatchSha1Results1 - */ - 'from'?: string; - /** - * The key of the destination object - * @type {string} - * @memberof CopyBatchSha1Results1 - */ - 'to'?: string; - /** - * - * @type {ObjectDetails} - * @memberof CopyBatchSha1Results1 - */ - 'result'?: ObjectDetails; -} - diff --git a/oss/source/model/create-buckets-payload-allow.ts b/oss/source/model/create-buckets-payload-allow.ts index 3bf4b12..9e7c848 100644 --- a/oss/source/model/create-buckets-payload-allow.ts +++ b/oss/source/model/create-buckets-payload-allow.ts @@ -9,13 +9,13 @@ */ export interface CreateBucketsPayloadAllow { /** - * The application key to grant access to + * The Client ID of the application. * @type {string} * @memberof CreateBucketsPayloadAllow */ 'authId': string; /** - * Acceptable values: `full` or `read` + * Specifies the level of permission the application has. Required when ``allow`` is specified. Possible values are: - ``full`` - Unrestricted access to objects within the bucket. - ``read_only`` - Read only access to the objects within the bucket. Modification or deletion of objects is not allowed. * @type {string} * @memberof CreateBucketsPayloadAllow */ diff --git a/oss/source/model/create-buckets-payload-bucket-key.ts b/oss/source/model/create-buckets-payload-bucket-key.ts deleted file mode 100644 index 2b6168a..0000000 --- a/oss/source/model/create-buckets-payload-bucket-key.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface CreateBucketsPayloadBucketKey - */ -export interface CreateBucketsPayloadBucketKey { - /** - * The application key to grant access to - * @type {string} - * @memberof CreateBucketsPayloadBucketKey - */ - 'authId': string; - /** - * Acceptable values: `full` or `read` - * @type {string} - * @memberof CreateBucketsPayloadBucketKey - */ - 'access': CreateBucketsPayloadBucketKeyAccessEnum; -} - -export const CreateBucketsPayloadBucketKeyAccessEnum = { - Full: 'full', - Read: 'read' -} as const; - -export type CreateBucketsPayloadBucketKeyAccessEnum = typeof CreateBucketsPayloadBucketKeyAccessEnum[keyof typeof CreateBucketsPayloadBucketKeyAccessEnum]; - - diff --git a/oss/source/model/create-buckets-payload-policy-key.ts b/oss/source/model/create-buckets-payload-policy-key.ts deleted file mode 100644 index 657c61e..0000000 --- a/oss/source/model/create-buckets-payload-policy-key.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface CreateBucketsPayloadPolicyKey - */ -export interface CreateBucketsPayloadPolicyKey { - /** - * The application key to grant access to - * @type {string} - * @memberof CreateBucketsPayloadPolicyKey - */ - 'authId': string; - /** - * Acceptable values: `full` or `read` - * @type {string} - * @memberof CreateBucketsPayloadPolicyKey - */ - 'access': CreateBucketsPayloadPolicyKeyAccessEnum; -} - -export const CreateBucketsPayloadPolicyKeyAccessEnum = { - Transient: 'transient', - Temporary: 'temporary', - Persistent: 'persistent' -} as const; - -export type CreateBucketsPayloadPolicyKeyAccessEnum = typeof CreateBucketsPayloadPolicyKeyAccessEnum[keyof typeof CreateBucketsPayloadPolicyKeyAccessEnum]; - - diff --git a/oss/source/model/create-buckets-payload.ts b/oss/source/model/create-buckets-payload.ts index 16b3b1b..3f1eb10 100644 --- a/oss/source/model/create-buckets-payload.ts +++ b/oss/source/model/create-buckets-payload.ts @@ -2,39 +2,33 @@ /* eslint-disable */ import { CreateBucketsPayloadAllow } from './create-buckets-payload-allow'; +import { PolicyKey } from './policy-key'; /** - * Bucket Payload Body Structure + * Request body structure for Create Bucket operation. * @export * @interface CreateBucketsPayload */ export interface CreateBucketsPayload { /** - * Bucket key + * Bucket key: A unique name you assign to a bucket. Bucket keys must be globally unique across all applications and regions. They must consist of only lower case characters, numbers 0-9, and underscores (_). **Note:** You cannot change a bucket key once the bucket is created. * @type {string} * @memberof CreateBucketsPayload */ 'bucketKey': string; /** - * + * An array of objects, where each object represents an application that can access the bucket. * @type {Array} * @memberof CreateBucketsPayload */ 'allow'?: Array; /** - * [Data retention policy](https://developer.autodesk.com/en/docs/data/v2/overview/retention-policy/) Acceptable values: `transient`, `temporary` or `persistent` - * @type {string} + * + * @type {PolicyKey} * @memberof CreateBucketsPayload */ - 'policyKey': CreateBucketsPayloadPolicyKeyEnum; + 'policyKey': PolicyKey; } -export const CreateBucketsPayloadPolicyKeyEnum = { - Transient: 'transient', - Temporary: 'temporary', - Persistent: 'persistent' -} as const; - -export type CreateBucketsPayloadPolicyKeyEnum = typeof CreateBucketsPayloadPolicyKeyEnum[keyof typeof CreateBucketsPayloadPolicyKeyEnum]; diff --git a/oss/source/model/create-object-grant-permissions.ts b/oss/source/model/create-object-grant-permissions.ts deleted file mode 100644 index 517e939..0000000 --- a/oss/source/model/create-object-grant-permissions.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface CreateObjectGrantPermissions - */ -export interface CreateObjectGrantPermissions { - /** - * The application to grant access to - * @type {string} - * @memberof CreateObjectGrantPermissions - */ - 'authId': string; - /** - * The application to grant access to - * @type {string} - * @memberof CreateObjectGrantPermissions - */ - 'access': string; -} - diff --git a/oss/source/model/create-object-grant.ts b/oss/source/model/create-object-grant.ts deleted file mode 100644 index 4d38e5a..0000000 --- a/oss/source/model/create-object-grant.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { CreateObjectGrantPermissions } from './create-object-grant-permissions'; - -/** - * Object grant Object json response - * @export - * @interface CreateObjectGrant - */ -export interface CreateObjectGrant { - /** - * Applications with access granted at creation time - * @type {Array} - * @memberof CreateObjectGrant - */ - 'permissions': Array; -} - diff --git a/oss/source/model/create-object-resetexpiration.ts b/oss/source/model/create-object-resetexpiration.ts deleted file mode 100644 index b74cccd..0000000 --- a/oss/source/model/create-object-resetexpiration.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * Object resetexpiration Object json response - * @export - * @interface CreateObjectResetexpiration - */ -export interface CreateObjectResetexpiration { - /** - * - * @type {string} - * @memberof CreateObjectResetexpiration - */ - 'bucketKey'?: string; - /** - * - * @type {string} - * @memberof CreateObjectResetexpiration - */ - 'objectId'?: string; - /** - * - * @type {string} - * @memberof CreateObjectResetexpiration - */ - 'objectKey'?: string; - /** - * - * @type {string} - * @memberof CreateObjectResetexpiration - */ - 'sha1'?: string; - /** - * - * @type {number} - * @memberof CreateObjectResetexpiration - */ - 'size'?: number; - /** - * - * @type {string} - * @memberof CreateObjectResetexpiration - */ - 'contentType'?: string; - /** - * - * @type {string} - * @memberof CreateObjectResetexpiration - */ - 'location'?: string; - /** - * Timestamp in epoch time - * @type {number} - * @memberof CreateObjectResetexpiration - */ - 'ceatedDate'?: number; - /** - * Timestamp in epoch time - * @type {number} - * @memberof CreateObjectResetexpiration - */ - 'lastAccessedDate'?: number; - /** - * Timestamp in epoch time - * @type {number} - * @memberof CreateObjectResetexpiration - */ - 'lastModifiedDate'?: number; -} - diff --git a/oss/source/model/create-signed-resource.ts b/oss/source/model/create-signed-resource.ts index 38f7e38..1f27ebb 100644 --- a/oss/source/model/create-signed-resource.ts +++ b/oss/source/model/create-signed-resource.ts @@ -3,37 +3,37 @@ /** - * + * Represents a signed URL to be generated. * @export * @interface CreateSignedResource */ export interface CreateSignedResource { /** - * Expiration time value. Default is 60 minutes. + * The time window (in minutes) the signed URL will remain usable. Acceptable values = 1-60 minutes. Default = 2 minutes. **Tip:** Use the smallest possible time window to minimize exposure of the signed URL. * @type {number} * @memberof CreateSignedResource */ 'minutesExpiration'?: number; /** - * If it is true, the public URL can only be used once and will expire immediately after use. When downloading an object, URL will expire once the download is complete. + * ``true`` : The signed URL will expire immediately after use. For example, when downloading an object, URL will expire once the download is complete. ``false`` : (Default) The signed URL will remain usable for the entire time window specified by ``minutesExpiration``. * @type {boolean} * @memberof CreateSignedResource */ 'singleUse'?: boolean; /** - * If set, the public URL will use that value as Content-Type when downloading + * The value to use as the Content-Type when downloading the object using the signed URL. If this attribute is not provided, it defaults to the value corresponding to the object. * @type {string} * @memberof CreateSignedResource */ 'contentType'?: string; /** - * If set, the public URL will use that value as Content-Disposition when downloading + * The value to use as the Content-Disposition when downloading the object using the signed URL. If this attribute is not provided, it defaults to the value corresponding to the object. * @type {string} * @memberof CreateSignedResource */ 'contentDisposition'?: string; /** - * If set, the public URL will be restricted to the specified IP addresses. downloads and uploads will be allowed or blocked based on the list of the IP addresses in the X-Forwarded-For header received from Apigee. + * Restricts the signed URL to the specified IP addresses. Downloads and uploads will be allowed only for the list of the IP addresses in the ``X-Forwarded-For`` header received from Apigee. If not specified, use of the signed URL is not restricted. * @type {string} * @memberof CreateSignedResource */ diff --git a/oss/source/model/download-results-params.ts b/oss/source/model/download-results-params.ts deleted file mode 100644 index a5bd705..0000000 --- a/oss/source/model/download-results-params.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * The values for the updatable params that were used in the creation of the returned S3 signed URL. - * @export - * @interface DownloadResultsParams - */ -export interface DownloadResultsParams { - /** - * The Content-Type value to expect when downloading the object, either echoing the response-content-type provided in this request, or defaulting to the Content-Type associated with the stored object record in OSS. - * @type {string} - * @memberof DownloadResultsParams - */ - 'Content-Type'?: string; - /** - * The Content-Disposition value to expect when downloading the object, either echoing the response-content-disposition provided in this request, or defaulting to the Content-Disposition associated with the stored object record in OSS. - * @type {string} - * @memberof DownloadResultsParams - */ - 'Content-Disposition'?: string; - /** - * The Cache-Control value to expect when downloading the object, either echoing the response-cache-control provided in this request, or defaulting to the Cache-Control associated with the stored object record in OSS. - * @type {string} - * @memberof DownloadResultsParams - */ - 'Cache-Control'?: string; -} - diff --git a/oss/source/model/download-results.ts b/oss/source/model/download-results.ts index b86853c..3a1d929 100644 --- a/oss/source/model/download-results.ts +++ b/oss/source/model/download-results.ts @@ -1,58 +1,51 @@ /* tslint:disable */ /* eslint-disable */ -import { DownloadResultsParams } from './download-results-params'; +import { DownloadStatus } from './download-status'; /** - * objectKeyN is a placeholder for the first object key for which the client requested a download signed URL. The attributes within contain the success data / error info for the request for that object. `results` will contain one such attribute for each requested object in the batch. + * objectKeyN is a placeholder for the first object key for which the client requested a download signed URL. The attributes within contain the success data / error information for the request for that object. `results` will contain one such attribute for each requested object in the batch. * @export * @interface DownloadResults */ export interface DownloadResults { /** - * Indicates the status of the object. `complete` indicates a raw upload or merged resumable upload; `chunked` indicates an unmerged resumable upload where the user provide `public-resource-fallback`=`false`; `fallback` indicates an unmerged resumable upload where the user provides `public-resource-fallback`=`true`. - * @type {string} + * + * @type {DownloadStatus} * @memberof DownloadResults */ - 'status'?: DownloadResultsStatusEnum; + 'status'?: DownloadStatus; /** - * The S3 signed URL with which to download the object. This attribute is returned when `status` is `complete` or `fallback`; in the latter case, this will return an OSS Signed Resource, not an S3 signed URL. + * A S3 signed URL with which to download the object. This attribute is returned when ``status`` is ``complete`` or ``fallback``; in the latter case, this will return an OSS signed URL, not an S3 signed URL. * @type {string} * @memberof DownloadResults */ 'url'?: string; /** - * A map of S3 signed URLs, one for each chunk of an unmerged resumable upload. This attribute is returned when `status` is `chunked`. The key of each entry is the byte range of the total file which the chunk comprises. + * A map of S3 signed URLs, one for each chunk of an unmerged resumable upload. This attribute is returned when ``status`` is ``chunked``. The key of each entry is the byte range of the total file which the chunk comprises. * @type {object} * @memberof DownloadResults */ 'urls'?: object; /** - * - * @type {DownloadResultsParams} + * The values that were requested for the following parameters when requesting the S3 signed URL. - ``Content-Type`` - ``Content-Disposition`` - ``Cache-Control``. + * @type {object} * @memberof DownloadResults */ - 'params'?: DownloadResultsParams; + 'params'?: object; /** - * The object size in bytes. + * The total amount of storage space occupied by the object, in bytes. * @type {number} * @memberof DownloadResults */ 'size'?: number; /** - * The calculated sha1 of the object, if available. + * A hash value computed from the data of the object, if available. * @type {string} * @memberof DownloadResults */ 'sha1'?: string; } -export const DownloadResultsStatusEnum = { - Complete: 'complete', - Chunked: 'chunked', - Fallback: 'fallback' -} as const; - -export type DownloadResultsStatusEnum = typeof DownloadResultsStatusEnum[keyof typeof DownloadResultsStatusEnum]; diff --git a/oss/source/model/download-status.ts b/oss/source/model/download-status.ts new file mode 100644 index 0000000..9c499e0 --- /dev/null +++ b/oss/source/model/download-status.ts @@ -0,0 +1,20 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * Indicates the upload status of the requested object. Possible values are: - ``complete`` - The upload process is finished. If the object was uploaded in chunks, assembly of chunks into the final object is also complete. - ``chunked`` - The object was uploaded in chunks, but assembly of chunks into the final object is still pending. `public-resource-fallback`` = ``false`` - ``fallback`` - The object was uploaded in chunks, but assembly of chunks into the final object is still pending. `public-resource-fallback`` = ``true`` + * @export + * @enum {string} + */ + +export const DownloadStatus = { + Complete: 'complete', + Chunked: 'chunked', + Fallback: 'fallback' +} as const; + +export type DownloadStatus = typeof DownloadStatus[keyof typeof DownloadStatus]; + + + diff --git a/oss/source/model/grant-allow.ts b/oss/source/model/grant-allow.ts deleted file mode 100644 index 62f2e2a..0000000 --- a/oss/source/model/grant-allow.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface GrantAllow - */ -export interface GrantAllow { - /** - * The application key to grant access to - * @type {string} - * @memberof GrantAllow - */ - 'authId': string; - /** - * Acceptable values: full, read, write - * @type {string} - * @memberof GrantAllow - */ - 'access': string; -} - diff --git a/oss/source/model/grant.ts b/oss/source/model/grant.ts deleted file mode 100644 index 44ae517..0000000 --- a/oss/source/model/grant.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { GrantAllow } from './grant-allow'; - -/** - * grant definition - * @export - * @interface Grant - */ -export interface Grant { - /** - * Objects representing applications to which the owner wants to grant access - * @type {Array} - * @memberof Grant - */ - 'allow': Array; -} - diff --git a/oss/source/model/index.ts b/oss/source/model/index.ts index 0b3cd48..cfc3f7e 100644 --- a/oss/source/model/index.ts +++ b/oss/source/model/index.ts @@ -1,17 +1,9 @@ -export * from './batch-copy'; -export * from './batch-copy-objects'; -export * from './batch-delete-details'; -export * from './batch-delete-list'; -export * from './batch-delete-list-processes'; -export * from './batch-delete-results'; -export * from './batch-object-details'; -export * from './batch-object-details-objects'; +export * from './access'; +export * from './batch-completed-results'; +export * from './batch-completed-results-parts'; export * from './batchcompleteupload-object'; export * from './batchcompleteupload-object-requests'; export * from './batchcompleteupload-response'; -export * from './batchcompleteupload-response-results-value'; -export * from './batchcompleteupload-response-results-value-parts'; -export * from './batchdelete-request'; export * from './batchsigneds3download-object'; export * from './batchsigneds3download-object-requests'; export * from './batchsigneds3download-response'; @@ -19,47 +11,26 @@ export * from './batchsigneds3upload-object'; export * from './batchsigneds3upload-object-requests'; export * from './batchsigneds3upload-response'; export * from './batchsigneds3upload-response-results-value'; -export * from './block-upload-request'; -export * from './block-upload-response'; -export * from './block-upload-response-missing-blocks'; export * from './bucket'; export * from './bucket-objects'; export * from './buckets'; export * from './buckets-items'; -export * from './buckets-namespaces'; export * from './completes3upload-body'; -export * from './completes3upload-response200'; -export * from './completes3upload-response400'; -export * from './completes3upload-response400-parts'; -export * from './completes3upload-response400-size'; -export * from './copy-batch-results1'; -export * from './copy-batch-sha1-results1'; export * from './create-buckets-payload'; export * from './create-buckets-payload-allow'; -export * from './create-buckets-payload-bucket-key'; -export * from './create-buckets-payload-policy-key'; -export * from './create-object-grant'; -export * from './create-object-grant-permissions'; -export * from './create-object-resetexpiration'; export * from './create-object-signed'; export * from './create-signed-resource'; export * from './download-results'; -export * from './download-results-params'; -export * from './grant'; -export * from './grant-allow'; -export * from './namespaces-response'; +export * from './download-status'; export * from './object-details'; export * from './object-full-details'; -export * from './object-full-details-deltas'; -export * from './object-status-enum'; export * from './permission'; -export * from './protect-bucket-object'; +export * from './permission-access'; +export * from './policy-key'; export * from './reason'; -export * from './resetexpiration'; +export * from './region'; export * from './result'; -export * from './revoke'; -export * from './revoke-revoke'; -export * from './signed'; export * from './signeds3download-response'; export * from './signeds3upload-response'; -export * from './transfer-object'; +export * from './status'; +export * from './with'; diff --git a/oss/source/model/namespaces-response.ts b/oss/source/model/namespaces-response.ts deleted file mode 100644 index 1e856f9..0000000 --- a/oss/source/model/namespaces-response.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface NamespacesResponse - */ -export interface NamespacesResponse { - /** - * The bucket key. - * @type {string} - * @memberof NamespacesResponse - */ - 'bucketKey': string; - /** - * An array of names representing the namespaces assigned to this bucket after the operation. - * @type {Array} - * @memberof NamespacesResponse - */ - 'namespaces': Array; -} - diff --git a/oss/source/model/object-details.ts b/oss/source/model/object-details.ts index 139319e..3d1a6b2 100644 --- a/oss/source/model/object-details.ts +++ b/oss/source/model/object-details.ts @@ -3,49 +3,49 @@ /** - * Object json response + * Represents an object within a bucket. * @export * @interface ObjectDetails */ export interface ObjectDetails { /** - * Bucket key + * The bucket key of the bucket that contains the object. * @type {string} * @memberof ObjectDetails */ 'bucketKey'?: string; /** - * Object URN + * An identifier (URN) that uniquely and persistently identifies the object. * @type {string} * @memberof ObjectDetails */ 'objectId'?: string; /** - * Object name + * A URL-encoded human friendly name to identify the object. * @type {string} * @memberof ObjectDetails */ 'objectKey'?: string; /** - * Object SHA1 + * A hash value computed from the data of the object. * @type {string} * @memberof ObjectDetails */ 'sha1'?: string; /** - * Object size + * The total amount of storage space occupied by the object, in bytes. * @type {number} * @memberof ObjectDetails */ 'size'?: number; /** - * Object content-type + * The format of the data stored within the object, expressed as a MIME type. * @type {string} * @memberof ObjectDetails */ 'contentType'?: string; /** - * URL to download the object + * A URL that points to the actual location of the object. * @type {string} * @memberof ObjectDetails */ diff --git a/oss/source/model/object-full-details-deltas.ts b/oss/source/model/object-full-details-deltas.ts deleted file mode 100644 index a68e407..0000000 --- a/oss/source/model/object-full-details-deltas.ts +++ /dev/null @@ -1,24 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface ObjectFullDetailsDeltas - */ -export interface ObjectFullDetailsDeltas { - /** - * - * @type {number} - * @memberof ObjectFullDetailsDeltas - */ - 'position'?: number; - /** - * - * @type {string} - * @memberof ObjectFullDetailsDeltas - */ - 'sha1'?: string; -} - diff --git a/oss/source/model/object-full-details.ts b/oss/source/model/object-full-details.ts index 8efb839..dbbc3d5 100644 --- a/oss/source/model/object-full-details.ts +++ b/oss/source/model/object-full-details.ts @@ -3,73 +3,73 @@ /** - * Object Details json response + * Represents detailed information about an object. * @export * @interface ObjectFullDetails */ export interface ObjectFullDetails { /** - * Bucket key + * The bucket key of the bucket that contains the object. * @type {string} * @memberof ObjectFullDetails */ 'bucketKey'?: string; /** - * Object URN + * An identifier (URN) that uniquely and persistently identifies the object. * @type {string} * @memberof ObjectFullDetails */ 'objectId'?: string; /** - * Object name + * A URL-encoded human friendly name to identify the object. * @type {string} * @memberof ObjectFullDetails */ 'objectKey'?: string; /** - * Object SHA1 + * A hash value computed from the data of the object. * @type {string} * @memberof ObjectFullDetails */ 'sha1'?: string; /** - * Object size + * The total amount of storage space occupied by the object, in bytes. * @type {number} * @memberof ObjectFullDetails */ 'size'?: number; /** - * Object content-type + * The format of the data stored within the object, expressed as a MIME type. * @type {string} * @memberof ObjectFullDetails */ 'contentType'?: string; /** - * URL to download the object + * A URL that points to the actual location of the object. * @type {string} * @memberof ObjectFullDetails */ 'location'?: string; /** - * Epoch timestamp when the object was created. Only provided if the user requests this to be included in the query parameters. + * The time the object was created, represented as a Unix timestamp. Only returned if explicitly requested using the ``with`` query string parameter. * @type {number} * @memberof ObjectFullDetails */ 'createdDate'?: number; /** - * Epoch timestamp when the object was last accessed. Only provided if the user requests this to be included in the query parameters. + * The time the object was last accessed, represented as a Unix timestamp. Only returned if explicitly requested using the ``with`` query string parameter. * @type {number} * @memberof ObjectFullDetails */ 'lastAccessedDate'?: number; /** - * Epoch timestamp when the object was last modified. Only provided if the user requests this to be included in the query parameters. + * The time the object was most recently modified, represented as a Unix timestamp. Only returned if explicitly requested using the ``with`` query string parameter. * @type {number} * @memberof ObjectFullDetails */ 'lastModifiedDate'?: number; /** - * When specified, the response will include the user defined metadata in a JSON field named userDefinedMetadata, if available. The user defined metadata can be set on file uploading. + * Any custom metadata, if available. Only returned if explicitly requested for using the ``with`` query string parameter. * @type {string} * @memberof ObjectFullDetails */ diff --git a/oss/source/model/object-status-enum.ts b/oss/source/model/object-status-enum.ts deleted file mode 100644 index 384322a..0000000 --- a/oss/source/model/object-status-enum.ts +++ /dev/null @@ -1,20 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @enum {string} - */ - -export const ObjectStatusEnum = { - Complete: 'complete', - Chunked: 'chunked', - Fallback: 'fallback' -} as const; - -export type ObjectStatusEnum = typeof ObjectStatusEnum[keyof typeof ObjectStatusEnum]; - - - diff --git a/oss/source/model/permission-access.ts b/oss/source/model/permission-access.ts new file mode 100644 index 0000000..bd254f3 --- /dev/null +++ b/oss/source/model/permission-access.ts @@ -0,0 +1,19 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * Specifies the level of permission the application has. Possible values are: - ``full`` - Unrestricted access to objects within the bucket. - ``read_only`` - Read only access to the objects within the bucket. Modification and deletion of objects is not allowed. + * @export + * @enum {string} + */ + +export const PermissionAccess = { + Full: 'full', + Read: 'read' +} as const; + +export type PermissionAccess = typeof PermissionAccess[keyof typeof PermissionAccess]; + + + diff --git a/oss/source/model/permission.ts b/oss/source/model/permission.ts index 9570db7..46a0a11 100644 --- a/oss/source/model/permission.ts +++ b/oss/source/model/permission.ts @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ +import { PermissionAccess } from './permission-access'; /** * @@ -9,16 +10,18 @@ */ export interface Permission { /** - * The authentication ID + * The Client ID of the application. * @type {string} * @memberof Permission */ 'authId'?: string; /** - * The authentication access type - * @type {string} + * + * @type {PermissionAccess} * @memberof Permission */ - 'access'?: string; + 'access'?: PermissionAccess; } + + diff --git a/oss/source/model/policy-key.ts b/oss/source/model/policy-key.ts new file mode 100644 index 0000000..41ae2d1 --- /dev/null +++ b/oss/source/model/policy-key.ts @@ -0,0 +1,20 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * Specifies the retention policy for the objects stored in the bucket. Possible values are: - ``transient`` - Objects are retained for 24 hours. - ``temporary`` - Objects are retained for 30 days. - ``persistent`` - Objects are retained until they are deleted. + * @export + * @enum {string} + */ + +export const PolicyKey = { + Transient: 'transient', + Temporary: 'temporary', + Persistent: 'persistent' +} as const; + +export type PolicyKey = typeof PolicyKey[keyof typeof PolicyKey]; + + + diff --git a/oss/source/model/protect-bucket-object.ts b/oss/source/model/protect-bucket-object.ts deleted file mode 100644 index 4f57c0f..0000000 --- a/oss/source/model/protect-bucket-object.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface ProtectBucketObject - */ -export interface ProtectBucketObject { - /** - * true or false indicating whether to protect the bucket from deletion - * @type {string} - * @memberof ProtectBucketObject - */ - 'protection': ProtectBucketObjectProtectionEnum; -} - -export const ProtectBucketObjectProtectionEnum = { - True: 'true', - False: 'false' -} as const; - -export type ProtectBucketObjectProtectionEnum = typeof ProtectBucketObjectProtectionEnum[keyof typeof ProtectBucketObjectProtectionEnum]; - - diff --git a/oss/source/model/region.ts b/oss/source/model/region.ts new file mode 100644 index 0000000..6d08d39 --- /dev/null +++ b/oss/source/model/region.ts @@ -0,0 +1,20 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * Specifies where the bucket containing the object stored. Possible values are: - ``US`` - (Default) Data center for the US region. - ``EMEA`` - Data center for the European Union, Middle East, and Africa. - ``APAC`` - (Beta) Data center for Australia. **Note:** Beta features are subject to change. Please do not use in production environments. + * @export + * @enum {string} + */ + +export const Region = { + Us: 'US', + Emea: 'EMEA', + Apac: 'APAC' +} as const; + +export type Region = typeof Region[keyof typeof Region]; + + + diff --git a/oss/source/model/resetexpiration.ts b/oss/source/model/resetexpiration.ts deleted file mode 100644 index 7b5fff1..0000000 --- a/oss/source/model/resetexpiration.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * resetexpiration definition - * @export - * @interface Resetexpiration - */ -export interface Resetexpiration { - /** - * - * @type {string} - * @memberof Resetexpiration - */ - 'bucketKey'?: string; - /** - * Object ID - * @type {string} - * @memberof Resetexpiration - */ - 'objectId'?: string; - /** - * Object name - * @type {string} - * @memberof Resetexpiration - */ - 'objectKey'?: string; - /** - * - * @type {string} - * @memberof Resetexpiration - */ - 'sha1'?: string; - /** - * - * @type {number} - * @memberof Resetexpiration - */ - 'size'?: number; - /** - * - * @type {string} - * @memberof Resetexpiration - */ - 'contentType'?: string; - /** - * URL to download the object - * @type {string} - * @memberof Resetexpiration - */ - 'location'?: string; - /** - * Timestamp in epoch time - * @type {number} - * @memberof Resetexpiration - */ - 'ceatedDate'?: number; - /** - * Timestamp in epoch time - * @type {number} - * @memberof Resetexpiration - */ - 'lastAccessedDate'?: number; - /** - * Timestamp in epoch time - * @type {number} - * @memberof Resetexpiration - */ - 'lastModifiedDate'?: number; -} - diff --git a/oss/source/model/revoke-revoke.ts b/oss/source/model/revoke-revoke.ts deleted file mode 100644 index 36dc77c..0000000 --- a/oss/source/model/revoke-revoke.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface RevokeRevoke - */ -export interface RevokeRevoke { - /** - * The application key to revoke from - * @type {string} - * @memberof RevokeRevoke - */ - 'authId': string; -} - diff --git a/oss/source/model/revoke.ts b/oss/source/model/revoke.ts deleted file mode 100644 index dcdb625..0000000 --- a/oss/source/model/revoke.ts +++ /dev/null @@ -1,19 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - -import { RevokeRevoke } from './revoke-revoke'; - -/** - * revoke definition - * @export - * @interface Revoke - */ -export interface Revoke { - /** - * Objects representing applications to which the owner wants to grant access at bucket creation time - * @type {Array} - * @memberof Revoke - */ - 'revoke': Array; -} - diff --git a/oss/source/model/signed.ts b/oss/source/model/signed.ts deleted file mode 100644 index f76faa3..0000000 --- a/oss/source/model/signed.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * signed definition - * @export - * @interface Signed - */ -export interface Signed { - /** - * Expiration time in minutes Default value: 60 - * @type {number} - * @memberof Signed - */ - 'minutesExpiration'?: number; -} - diff --git a/oss/source/model/signeds3download-response.ts b/oss/source/model/signeds3download-response.ts index 429e484..7bbcc2c 100644 --- a/oss/source/model/signeds3download-response.ts +++ b/oss/source/model/signeds3download-response.ts @@ -1,6 +1,7 @@ /* tslint:disable */ /* eslint-disable */ +import { DownloadStatus } from './download-status'; /** * @@ -9,49 +10,42 @@ */ export interface Signeds3downloadResponse { /** - * Indicates the status of the object. `complete` indicates a raw upload or merged resumable upload; `chunked` indicates an unmerged resumable upload where the user provide `public-resource-fallback`=`false`; `fallback` indicates an unmerged resumable upload where the user provides `public-resource-fallback`=`true`. - * @type {string} + * + * @type {DownloadStatus} * @memberof Signeds3downloadResponse */ - 'status': Signeds3downloadResponseStatusEnum; + 'status': DownloadStatus; /** - * The S3 signed URL with which to download the object. This attribute is returned when `status` is `complete` or `fallback`; in the latter case, this will return an OSS Signed Resource, not an S3 signed URL. + * A S3 signed URL with which to download the object. This attribute is returned when ``status`` is ``complete`` or ``fallback``; in the latter case, this will return an OSS signed URL, not an S3 signed URL. * @type {string} * @memberof Signeds3downloadResponse */ 'url'?: string; /** - * A map of S3 signed URLs, one for each chunk of an unmerged resumable upload. This attribute is returned when `status` is `chunked`. The key of each entry is the byte range of the total file which the chunk comprises. + * A map of S3 signed URLs, one for each chunk of an unmerged resumable upload. This attribute is returned when ``status`` is ``chunked``. The key of each entry is the byte range of the total file which the chunk comprises. * @type {object} * @memberof Signeds3downloadResponse */ 'urls'?: object; /** - * The values for the updatable params that were used in the creation of the returned S3 signed URL -- `Content-Type`, `Content-Disposition`, and `Cache-Control`. + * The values that were requested for the following parameters when requesting the S3 signed URL. - ``Content-Type`` - ``Content-Disposition`` - ``Cache-Control``. * @type {object} * @memberof Signeds3downloadResponse */ 'params': object; /** - * The object size in bytes. + * The total amount of storage space occupied by the object, in bytes. * @type {number} * @memberof Signeds3downloadResponse */ 'size': number; /** - * The calculated sha1 of the object, if available. + * A hash value computed from the data of the object, if available. * @type {string} * @memberof Signeds3downloadResponse */ 'sha1'?: string; } -export const Signeds3downloadResponseStatusEnum = { - Complete: 'complete', - Chunked: 'chunked', - Fallback: 'fallback' -} as const; - -export type Signeds3downloadResponseStatusEnum = typeof Signeds3downloadResponseStatusEnum[keyof typeof Signeds3downloadResponseStatusEnum]; diff --git a/oss/source/model/signeds3upload-response.ts b/oss/source/model/signeds3upload-response.ts index 8f575c1..1072121 100644 --- a/oss/source/model/signeds3upload-response.ts +++ b/oss/source/model/signeds3upload-response.ts @@ -9,16 +9,28 @@ */ export interface Signeds3uploadResponse { /** - * An array of signed URLs. For a single-part upload, this will only include a single URL. For a multipart upload, there will be one for each chunk of a multipart upload; the index of the URL in the array corresponds to the part number of the chunk. + * An ID that uniquely identifies the upload session. It allows OSS to differentiate between fresh upload attempts from attempts to resume uploading data for an active upload session, in case of network interruptions. You must provide this value when: - Re-requesting chunk URLs for an active upload session. - When calling the `Complete Upload to S3 Signed URL `_ operation to end an active upload session. + * @type {string} + * @memberof Signeds3uploadResponse + */ + 'uploadKey': string; + /** + * An array of signed URLs. For a single-part upload, this will contain only one URL. For a multipart upload, there will be one for each chunk of a multipart upload; the index of the URL in the array corresponds to the part number of the chunk. * @type {Array} * @memberof Signeds3uploadResponse */ 'urls': Array; /** - * The identifier of the upload session, to differentiate multiple attempts to upload data for the the same object. This must be provided when re-requesting chunk URLs for the same blob if they expire, and when calling the Complete Upload endpoint. + * The date and time, in the ISO 8601 format, indicating when the signed URLs will expire. * @type {string} * @memberof Signeds3uploadResponse */ - 'uploadKey': string; + 'urlExpiration'?: string; + /** + * The deadline to call `Complete Upload to S3 Signed URL `_ for the object. If not completed by this time, all uploaded data for this session will be discarded. + * @type {string} + * @memberof Signeds3uploadResponse + */ + 'uploadExpiration'?: string; } diff --git a/oss/source/model/status.ts b/oss/source/model/status.ts new file mode 100644 index 0000000..3eeb703 --- /dev/null +++ b/oss/source/model/status.ts @@ -0,0 +1,22 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * Indicates whether this particular part uploaded to S3 is valid. Possible values are: - ``Pending`` - No such part was uploaded to S3 for this index. - ``Unexpected`` - The eTag of the part in S3 does not match the one provided in the request. - ``TooSmall`` - A chunk uploaded to S3 is smaller than 5MB. Only the final chunk can be smaller than 5MB. - ``Unexpected+TooSmall`` - The chunk is both too small and has an eTag mismatch. - ``Ok`` - The chunk has no issues.\' + * @export + * @enum {string} + */ + +export const Status = { + Pending: 'Pending', + Unexpected: 'Unexpected', + TooSmall: 'TooSmall', + UnexpectedTooSmall: 'Unexpected+TooSmall', + Ok: 'Ok' +} as const; + +export type Status = typeof Status[keyof typeof Status]; + + + diff --git a/oss/source/model/transfer-object.ts b/oss/source/model/transfer-object.ts deleted file mode 100644 index 18e6d4f..0000000 --- a/oss/source/model/transfer-object.ts +++ /dev/null @@ -1,33 +0,0 @@ -/* tslint:disable */ -/* eslint-disable */ - - -/** - * - * @export - * @interface TransferObject - */ -export interface TransferObject { - /** - * Indicates whether to initiate, confirm, or cancel a transfer. - * @type {string} - * @memberof TransferObject - */ - 'operation': TransferObjectOperationEnum; - /** - * The key to which ownership of the bucket should be transferred. Required for the\'initiate\' operation, should not be provided otherwise. - * @type {string} - * @memberof TransferObject - */ - 'key'?: string; -} - -export const TransferObjectOperationEnum = { - Initiate: 'initiate', - Complete: 'complete', - Cancel: 'cancel' -} as const; - -export type TransferObjectOperationEnum = typeof TransferObjectOperationEnum[keyof typeof TransferObjectOperationEnum]; - - diff --git a/oss/source/model/with.ts b/oss/source/model/with.ts new file mode 100644 index 0000000..c2222bc --- /dev/null +++ b/oss/source/model/with.ts @@ -0,0 +1,21 @@ +/* tslint:disable */ +/* eslint-disable */ + + +/** + * **Not applicable for Head operation** The optional information you can request for. To request more than one of the following, specify this parameter multiple times in the request. Possible values: - ``createdDate`` - ``lastAccessedDate`` - ``lastModifiedDate`` - ``userDefinedMetadata`` + * @export + * @enum {string} + */ + +export const With = { + CreatedDate: 'createdDate', + LastAccessedDate: 'lastAccessedDate', + LastModifiedDate: 'lastModifiedDate', + UserDefinedMetadata: 'userDefinedMetadata' +} as const; + +export type With = typeof With[keyof typeof With]; + + +