From f633937b697ba1905ae396e473894b01f6a9d215 Mon Sep 17 00:00:00 2001 From: PatrickMenoti Date: Wed, 27 Mar 2024 13:50:40 +0000 Subject: [PATCH] Auto-Generated SDK --- storage/.openapi-generator/FILES | 3 + storage/README.md | 1 + storage/docs/BucketUpdate.md | 9 ++ storage/docs/PaginatedBucketObjectList.md | 1 + storage/docs/StorageApi.md | 26 +++--- storage/src/api/StorageApi.js | 25 ++--- storage/src/index.js | 7 ++ storage/src/model/BucketUpdate.js | 92 +++++++++++++++++++ .../src/model/PaginatedBucketObjectList.js | 12 +++ storage/test/model/BucketUpdate.spec.js | 65 +++++++++++++ 10 files changed, 219 insertions(+), 22 deletions(-) create mode 100644 storage/docs/BucketUpdate.md create mode 100644 storage/src/model/BucketUpdate.js create mode 100644 storage/test/model/BucketUpdate.spec.js diff --git a/storage/.openapi-generator/FILES b/storage/.openapi-generator/FILES index 6d5a6fa..c0c49ea 100644 --- a/storage/.openapi-generator/FILES +++ b/storage/.openapi-generator/FILES @@ -5,6 +5,7 @@ README.md docs/Bucket.md docs/BucketCreate.md docs/BucketObject.md +docs/BucketUpdate.md docs/EdgeAccessEnum.md docs/ObjectResponseData.md docs/PaginatedBucketList.md @@ -23,6 +24,7 @@ src/index.js src/model/Bucket.js src/model/BucketCreate.js src/model/BucketObject.js +src/model/BucketUpdate.js src/model/EdgeAccessEnum.js src/model/ObjectResponseData.js src/model/PaginatedBucketList.js @@ -31,3 +33,4 @@ src/model/ResponseBucket.js src/model/StateEnum.js src/model/SuccessBucketOperation.js src/model/SuccessObjectOperation.js +test/model/BucketUpdate.spec.js diff --git a/storage/README.md b/storage/README.md index 9da16bf..28f7436 100644 --- a/storage/README.md +++ b/storage/README.md @@ -143,6 +143,7 @@ Class | Method | HTTP request | Description - [ObjectStorage.Bucket](docs/Bucket.md) - [ObjectStorage.BucketCreate](docs/BucketCreate.md) - [ObjectStorage.BucketObject](docs/BucketObject.md) + - [ObjectStorage.BucketUpdate](docs/BucketUpdate.md) - [ObjectStorage.EdgeAccessEnum](docs/EdgeAccessEnum.md) - [ObjectStorage.ObjectResponseData](docs/ObjectResponseData.md) - [ObjectStorage.PaginatedBucketList](docs/PaginatedBucketList.md) diff --git a/storage/docs/BucketUpdate.md b/storage/docs/BucketUpdate.md new file mode 100644 index 0000000..aec35f4 --- /dev/null +++ b/storage/docs/BucketUpdate.md @@ -0,0 +1,9 @@ +# ObjectStorage.BucketUpdate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**edgeAccess** | [**EdgeAccessEnum**](EdgeAccessEnum.md) | | + + diff --git a/storage/docs/PaginatedBucketObjectList.md b/storage/docs/PaginatedBucketObjectList.md index 5de9dd4..d47af67 100644 --- a/storage/docs/PaginatedBucketObjectList.md +++ b/storage/docs/PaginatedBucketObjectList.md @@ -7,6 +7,7 @@ Name | Type | Description | Notes **count** | **Number** | | [optional] **next** | **String** | | [optional] **previous** | **String** | | [optional] +**continuationToken** | **String** | | [optional] **results** | [**[BucketObject]**](BucketObject.md) | | [optional] diff --git a/storage/docs/StorageApi.md b/storage/docs/StorageApi.md index 45b57d3..bee909c 100644 --- a/storage/docs/StorageApi.md +++ b/storage/docs/StorageApi.md @@ -307,8 +307,8 @@ tokenAuth.apiKey = 'YOUR API KEY'; let apiInstance = new ObjectStorage.StorageApi(); let bucketName = "bucketName_example"; // String | let opts = { - 'page': 56, // Number | A page number within the paginated result set. - 'pageSize': 56 // Number | Number of results to return per page. + 'continuationToken': "continuationToken_example", // String | Token for next page. + 'maxObjectCount': 56 // Number | Number of results to return per page. }; apiInstance.storageApiBucketsObjectsList(bucketName, opts, (error, data, response) => { if (error) { @@ -325,8 +325,8 @@ apiInstance.storageApiBucketsObjectsList(bucketName, opts, (error, data, respons Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **bucketName** | **String**| | - **page** | **Number**| A page number within the paginated result set. | [optional] - **pageSize** | **Number**| Number of results to return per page. | [optional] + **continuationToken** | **String**| Token for next page. | [optional] + **maxObjectCount** | **Number**| Number of results to return per page. | [optional] ### Return type @@ -344,7 +344,7 @@ Name | Type | Description | Notes ## storageApiBucketsObjectsRetrieve -> File storageApiBucketsObjectsRetrieve(bucketName, objectKey) +> storageApiBucketsObjectsRetrieve(bucketName, objectKey) Download object @@ -368,7 +368,7 @@ apiInstance.storageApiBucketsObjectsRetrieve(bucketName, objectKey, (error, data if (error) { console.error(error); } else { - console.log('API called successfully. Returned data: ' + data); + console.log('API called successfully.'); } }); ``` @@ -383,7 +383,7 @@ Name | Type | Description | Notes ### Return type -**File** +null (empty response body) ### Authorization @@ -392,7 +392,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined -- **Accept**: application/octet-stream +- **Accept**: text/html, application/json, application/xml, text/plain, image/jpeg, image/png, image/gif, video/mp4, audio/mpeg, application/pdf, application/javascript, text/css, application/octet-stream ## storageApiBucketsObjectsUpdate @@ -456,7 +456,7 @@ Name | Type | Description | Notes ## storageApiBucketsPartialUpdate -> ResponseBucket storageApiBucketsPartialUpdate(name) +> ResponseBucket storageApiBucketsPartialUpdate(name, opts) Update bucket info @@ -475,7 +475,10 @@ tokenAuth.apiKey = 'YOUR API KEY'; let apiInstance = new ObjectStorage.StorageApi(); let name = "name_example"; // String | -apiInstance.storageApiBucketsPartialUpdate(name, (error, data, response) => { +let opts = { + 'bucketUpdate': new ObjectStorage.BucketUpdate() // BucketUpdate | +}; +apiInstance.storageApiBucketsPartialUpdate(name, opts, (error, data, response) => { if (error) { console.error(error); } else { @@ -490,6 +493,7 @@ apiInstance.storageApiBucketsPartialUpdate(name, (error, data, response) => { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **name** | **String**| | + **bucketUpdate** | [**BucketUpdate**](BucketUpdate.md)| | [optional] ### Return type @@ -501,6 +505,6 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: Not defined +- **Content-Type**: application/json - **Accept**: application/json diff --git a/storage/src/api/StorageApi.js b/storage/src/api/StorageApi.js index 65ff992..7666f0a 100644 --- a/storage/src/api/StorageApi.js +++ b/storage/src/api/StorageApi.js @@ -14,6 +14,7 @@ import ApiClient from "../ApiClient"; import BucketCreate from '../model/BucketCreate'; +import BucketUpdate from '../model/BucketUpdate'; import PaginatedBucketList from '../model/PaginatedBucketList'; import PaginatedBucketObjectList from '../model/PaginatedBucketObjectList'; import ResponseBucket from '../model/ResponseBucket'; @@ -283,8 +284,8 @@ export default class StorageApi { * * @param {String} bucketName * @param {Object} opts Optional parameters - * @param {Number} [page] A page number within the paginated result set. - * @param {Number} [pageSize] Number of results to return per page. + * @param {String} [continuationToken] Token for next page. + * @param {Number} [maxObjectCount] Number of results to return per page. * @param {module:api/StorageApi~storageApiBucketsObjectsListCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/PaginatedBucketObjectList} */ @@ -300,8 +301,8 @@ export default class StorageApi { 'bucket_name': bucketName }; let queryParams = { - 'page': opts['page'], - 'page_size': opts['pageSize'] + 'continuation_token': opts['continuationToken'], + 'max_object_count': opts['maxObjectCount'] }; let headerParams = { }; @@ -323,7 +324,7 @@ export default class StorageApi { * Callback function to receive the result of the storageApiBucketsObjectsRetrieve operation. * @callback module:api/StorageApi~storageApiBucketsObjectsRetrieveCallback * @param {String} error Error message, if any. - * @param {File} data The data returned by the service call. + * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ @@ -333,7 +334,6 @@ export default class StorageApi { * @param {String} bucketName * @param {String} objectKey * @param {module:api/StorageApi~storageApiBucketsObjectsRetrieveCallback} callback The callback function, accepting three arguments: error, data, response - * data is of type: {@link File} */ storageApiBucketsObjectsRetrieve(bucketName, objectKey, callback) { let postBody = null; @@ -359,8 +359,8 @@ export default class StorageApi { let authNames = ['tokenAuth']; let contentTypes = []; - let accepts = ['application/octet-stream']; - let returnType = File; + let accepts = ['text/html', 'application/json', 'application/xml', 'text/plain', 'image/jpeg', 'image/png', 'image/gif', 'video/mp4', 'audio/mpeg', 'application/pdf', 'application/javascript', 'text/css', 'application/octet-stream']; + let returnType = null; return this.apiClient.callApi( '/v4/storage/buckets/{bucket_name}/objects/{object_key}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, @@ -434,11 +434,14 @@ export default class StorageApi { * Update bucket info * * @param {String} name + * @param {Object} opts Optional parameters + * @param {module:model/BucketUpdate} [bucketUpdate] * @param {module:api/StorageApi~storageApiBucketsPartialUpdateCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ResponseBucket} */ - storageApiBucketsPartialUpdate(name, callback) { - let postBody = null; + storageApiBucketsPartialUpdate(name, opts, callback) { + opts = opts || {}; + let postBody = opts['bucketUpdate']; // verify the required parameter 'name' is set if (name === undefined || name === null) { throw new Error("Missing the required parameter 'name' when calling storageApiBucketsPartialUpdate"); @@ -455,7 +458,7 @@ export default class StorageApi { }; let authNames = ['tokenAuth']; - let contentTypes = []; + let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = ResponseBucket; return this.apiClient.callApi( diff --git a/storage/src/index.js b/storage/src/index.js index 6efdc9f..1654af8 100644 --- a/storage/src/index.js +++ b/storage/src/index.js @@ -16,6 +16,7 @@ import ApiClient from './ApiClient'; import Bucket from './model/Bucket'; import BucketCreate from './model/BucketCreate'; import BucketObject from './model/BucketObject'; +import BucketUpdate from './model/BucketUpdate'; import EdgeAccessEnum from './model/EdgeAccessEnum'; import ObjectResponseData from './model/ObjectResponseData'; import PaginatedBucketList from './model/PaginatedBucketList'; @@ -83,6 +84,12 @@ export { */ BucketObject, + /** + * The BucketUpdate model constructor. + * @property {module:model/BucketUpdate} + */ + BucketUpdate, + /** * The EdgeAccessEnum model constructor. * @property {module:model/EdgeAccessEnum} diff --git a/storage/src/model/BucketUpdate.js b/storage/src/model/BucketUpdate.js new file mode 100644 index 0000000..0eb1e64 --- /dev/null +++ b/storage/src/model/BucketUpdate.js @@ -0,0 +1,92 @@ +/** + * Object Storage + * REST API OpenAPI documentation for the Object Storage + * + * The version of the OpenAPI document: 1.0.0 (v1) + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +import ApiClient from '../ApiClient'; +import EdgeAccessEnum from './EdgeAccessEnum'; + +/** + * The BucketUpdate model module. + * @module model/BucketUpdate + * @version 1.0.0 (v1) + */ +class BucketUpdate { + /** + * Constructs a new BucketUpdate. + * @alias module:model/BucketUpdate + * @param edgeAccess {module:model/EdgeAccessEnum} + */ + constructor(edgeAccess) { + + BucketUpdate.initialize(this, edgeAccess); + } + + /** + * Initializes the fields of this object. + * This method is used by the constructors of any subclasses, in order to implement multiple inheritance (mix-ins). + * Only for internal use. + */ + static initialize(obj, edgeAccess) { + obj['edge_access'] = edgeAccess; + } + + /** + * Constructs a BucketUpdate from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/BucketUpdate} obj Optional instance to populate. + * @return {module:model/BucketUpdate} The populated BucketUpdate instance. + */ + static constructFromObject(data, obj) { + if (data) { + obj = obj || new BucketUpdate(); + + if (data.hasOwnProperty('edge_access')) { + obj['edge_access'] = EdgeAccessEnum.constructFromObject(data['edge_access']); + } + } + return obj; + } + + /** + * Validates the JSON data with respect to BucketUpdate. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @return {boolean} to indicate whether the JSON data is valid with respect to BucketUpdate. + */ + static validateJSON(data) { + // check to make sure all required properties are present in the JSON string + for (const property of BucketUpdate.RequiredProperties) { + if (!data.hasOwnProperty(property)) { + throw new Error("The required field `" + property + "` is not found in the JSON data: " + JSON.stringify(data)); + } + } + + return true; + } + + +} + +BucketUpdate.RequiredProperties = ["edge_access"]; + +/** + * @member {module:model/EdgeAccessEnum} edge_access + */ +BucketUpdate.prototype['edge_access'] = undefined; + + + + + + +export default BucketUpdate; + diff --git a/storage/src/model/PaginatedBucketObjectList.js b/storage/src/model/PaginatedBucketObjectList.js index 10423bb..cadea0f 100644 --- a/storage/src/model/PaginatedBucketObjectList.js +++ b/storage/src/model/PaginatedBucketObjectList.js @@ -57,6 +57,9 @@ class PaginatedBucketObjectList { if (data.hasOwnProperty('previous')) { obj['previous'] = ApiClient.convertToType(data['previous'], 'String'); } + if (data.hasOwnProperty('continuation_token')) { + obj['continuation_token'] = ApiClient.convertToType(data['continuation_token'], 'String'); + } if (data.hasOwnProperty('results')) { obj['results'] = ApiClient.convertToType(data['results'], [BucketObject]); } @@ -78,6 +81,10 @@ class PaginatedBucketObjectList { if (data['previous'] && !(typeof data['previous'] === 'string' || data['previous'] instanceof String)) { throw new Error("Expected the field `previous` to be a primitive type in the JSON string but got " + data['previous']); } + // ensure the json data is a string + if (data['continuation_token'] && !(typeof data['continuation_token'] === 'string' || data['continuation_token'] instanceof String)) { + throw new Error("Expected the field `continuation_token` to be a primitive type in the JSON string but got " + data['continuation_token']); + } if (data['results']) { // data not null // ensure the json data is an array if (!Array.isArray(data['results'])) { @@ -112,6 +119,11 @@ PaginatedBucketObjectList.prototype['next'] = undefined; */ PaginatedBucketObjectList.prototype['previous'] = undefined; +/** + * @member {String} continuation_token + */ +PaginatedBucketObjectList.prototype['continuation_token'] = undefined; + /** * @member {Array.} results */ diff --git a/storage/test/model/BucketUpdate.spec.js b/storage/test/model/BucketUpdate.spec.js new file mode 100644 index 0000000..46e1266 --- /dev/null +++ b/storage/test/model/BucketUpdate.spec.js @@ -0,0 +1,65 @@ +/** + * Object Storage + * REST API OpenAPI documentation for the Object Storage + * + * The version of the OpenAPI document: 1.0.0 (v1) + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', process.cwd()+'/src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require(process.cwd()+'/src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.ObjectStorage); + } +}(this, function(expect, ObjectStorage) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new ObjectStorage.BucketUpdate(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('BucketUpdate', function() { + it('should create an instance of BucketUpdate', function() { + // uncomment below and update the code to test BucketUpdate + //var instance = new ObjectStorage.BucketUpdate(); + //expect(instance).to.be.a(ObjectStorage.BucketUpdate); + }); + + it('should have the property edgeAccess (base name: "edge_access")', function() { + // uncomment below and update the code to test the property edgeAccess + //var instance = new ObjectStorage.BucketUpdate(); + //expect(instance).to.be(); + }); + + }); + +}));