Skip to content

Commit

Permalink
Merge pull request #80 from aziontech/generated-sdk
Browse files Browse the repository at this point in the history
Auto-generated SDK
  • Loading branch information
maxwelbm authored Mar 27, 2024
2 parents 87537ad + f633937 commit e46159a
Show file tree
Hide file tree
Showing 10 changed files with 219 additions and 22 deletions.
3 changes: 3 additions & 0 deletions storage/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions storage/docs/BucketUpdate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ObjectStorage.BucketUpdate

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**edgeAccess** | [**EdgeAccessEnum**](EdgeAccessEnum.md) | |


1 change: 1 addition & 0 deletions storage/docs/PaginatedBucketObjectList.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]


26 changes: 15 additions & 11 deletions storage/docs/StorageApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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

Expand All @@ -344,7 +344,7 @@ Name | Type | Description | Notes

## storageApiBucketsObjectsRetrieve

> File storageApiBucketsObjectsRetrieve(bucketName, objectKey)
> storageApiBucketsObjectsRetrieve(bucketName, objectKey)
Download object

Expand All @@ -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.');
}
});
```
Expand All @@ -383,7 +383,7 @@ Name | Type | Description | Notes

### Return type

**File**
null (empty response body)

### Authorization

Expand All @@ -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
Expand Down Expand Up @@ -456,7 +456,7 @@ Name | Type | Description | Notes

## storageApiBucketsPartialUpdate

> ResponseBucket storageApiBucketsPartialUpdate(name)
> ResponseBucket storageApiBucketsPartialUpdate(name, opts)
Update bucket info

Expand All @@ -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 {
Expand All @@ -490,6 +493,7 @@ apiInstance.storageApiBucketsPartialUpdate(name, (error, data, response) => {
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **String**| |
**bucketUpdate** | [**BucketUpdate**](BucketUpdate.md)| | [optional]

### Return type

Expand All @@ -501,6 +505,6 @@ Name | Type | Description | Notes

### HTTP request headers

- **Content-Type**: Not defined
- **Content-Type**: application/json
- **Accept**: application/json

25 changes: 14 additions & 11 deletions storage/src/api/StorageApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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}
*/
Expand All @@ -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 = {
};
Expand All @@ -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.
*/

Expand All @@ -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;
Expand All @@ -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,
Expand Down Expand Up @@ -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");
Expand All @@ -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(
Expand Down
7 changes: 7 additions & 0 deletions storage/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -83,6 +84,12 @@ export {
*/
BucketObject,

/**
* The BucketUpdate model constructor.
* @property {module:model/BucketUpdate}
*/
BucketUpdate,

/**
* The EdgeAccessEnum model constructor.
* @property {module:model/EdgeAccessEnum}
Expand Down
92 changes: 92 additions & 0 deletions storage/src/model/BucketUpdate.js
Original file line number Diff line number Diff line change
@@ -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 <code>BucketUpdate</code>.
* @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 <code>BucketUpdate</code> from a plain JavaScript object, optionally creating a new instance.
* Copies all relevant properties from <code>data</code> to <code>obj</code> 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 <code>BucketUpdate</code> 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 <code>BucketUpdate</code>.
* @param {Object} data The plain JavaScript object bearing properties of interest.
* @return {boolean} to indicate whether the JSON data is valid with respect to <code>BucketUpdate</code>.
*/
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;

12 changes: 12 additions & 0 deletions storage/src/model/PaginatedBucketObjectList.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand All @@ -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'])) {
Expand Down Expand Up @@ -112,6 +119,11 @@ PaginatedBucketObjectList.prototype['next'] = undefined;
*/
PaginatedBucketObjectList.prototype['previous'] = undefined;

/**
* @member {String} continuation_token
*/
PaginatedBucketObjectList.prototype['continuation_token'] = undefined;

/**
* @member {Array.<module:model/BucketObject>} results
*/
Expand Down
Loading

0 comments on commit e46159a

Please sign in to comment.