From 9e97b281989b0a2135e02721783b3a87fd463179 Mon Sep 17 00:00:00 2001 From: Jason Rasmussen Date: Tue, 5 Sep 2023 21:08:11 -0400 Subject: [PATCH] chore: open api --- cli/src/api/open-api/api.ts | 97 ++++++++++++++++++++++++- mobile/openapi/README.md | 1 + mobile/openapi/doc/AssetApi.md | 58 ++++++++++++++- mobile/openapi/lib/api/asset_api.dart | 59 +++++++++++++-- mobile/openapi/test/asset_api_test.dart | 7 +- web/src/api/open-api/api.ts | 97 ++++++++++++++++++++++++- 6 files changed, 301 insertions(+), 18 deletions(-) diff --git a/cli/src/api/open-api/api.ts b/cli/src/api/open-api/api.ts index 2301c02e1..50710d8be 100644 --- a/cli/src/api/open-api/api.ts +++ b/cli/src/api/open-api/api.ts @@ -5528,6 +5528,51 @@ export const AssetApiAxiosParamCreator = function (configuration?: Configuration + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} deviceId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAssetIds: async (deviceId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'deviceId' is not null or undefined + assertParamExists('getAssetIds', 'deviceId', deviceId) + const localVarPath = `/asset/ids`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication cookie required + + // authentication api_key required + await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration) + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (deviceId !== undefined) { + localVarQueryParameter['deviceId'] = deviceId; + } + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6062,7 +6107,7 @@ export const AssetApiAxiosParamCreator = function (configuration?: Configuration }; }, /** - * Get all asset of a device that are in the database, ID only. + * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -6602,6 +6647,16 @@ export const AssetApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.getAssetById(id, key, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} deviceId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getAssetIds(deviceId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getAssetIds(deviceId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {*} [options] Override http request option. @@ -6719,7 +6774,7 @@ export const AssetApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** - * Get all asset of a device that are in the database, ID only. + * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -6896,6 +6951,15 @@ export const AssetApiFactory = function (configuration?: Configuration, basePath getAssetById(requestParameters: AssetApiGetAssetByIdRequest, options?: AxiosRequestConfig): AxiosPromise { return localVarFp.getAssetById(requestParameters.id, requestParameters.key, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {AssetApiGetAssetIdsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAssetIds(requestParameters: AssetApiGetAssetIdsRequest, options?: AxiosRequestConfig): AxiosPromise> { + return localVarFp.getAssetIds(requestParameters.deviceId, options).then((request) => request(axios, basePath)); + }, /** * * @param {*} [options] Override http request option. @@ -6984,7 +7048,7 @@ export const AssetApiFactory = function (configuration?: Configuration, basePath return localVarFp.getTimeBuckets(requestParameters.size, requestParameters.userId, requestParameters.albumId, requestParameters.personId, requestParameters.isArchived, requestParameters.isFavorite, requestParameters.key, options).then((request) => request(axios, basePath)); }, /** - * Get all asset of a device that are in the database, ID only. + * * @param {AssetApiGetUserAssetsByDeviceIdRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -7233,6 +7297,20 @@ export interface AssetApiGetAssetByIdRequest { readonly key?: string } +/** + * Request parameters for getAssetIds operation in AssetApi. + * @export + * @interface AssetApiGetAssetIdsRequest + */ +export interface AssetApiGetAssetIdsRequest { + /** + * + * @type {string} + * @memberof AssetApiGetAssetIds + */ + readonly deviceId: string +} + /** * Request parameters for getAssetStats operation in AssetApi. * @export @@ -7783,6 +7861,17 @@ export class AssetApi extends BaseAPI { return AssetApiFp(this.configuration).getAssetById(requestParameters.id, requestParameters.key, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {AssetApiGetAssetIdsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssetApi + */ + public getAssetIds(requestParameters: AssetApiGetAssetIdsRequest, options?: AxiosRequestConfig) { + return AssetApiFp(this.configuration).getAssetIds(requestParameters.deviceId, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {*} [options] Override http request option. @@ -7891,7 +7980,7 @@ export class AssetApi extends BaseAPI { } /** - * Get all asset of a device that are in the database, ID only. + * * @param {AssetApiGetUserAssetsByDeviceIdRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index fc0e4fd33..84f7c4cea 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -95,6 +95,7 @@ Class | Method | HTTP request | Description *AssetApi* | [**downloadFile**](doc//AssetApi.md#downloadfile) | **POST** /asset/download/{id} | *AssetApi* | [**getAllAssets**](doc//AssetApi.md#getallassets) | **GET** /asset | *AssetApi* | [**getAssetById**](doc//AssetApi.md#getassetbyid) | **GET** /asset/assetById/{id} | +*AssetApi* | [**getAssetIds**](doc//AssetApi.md#getassetids) | **GET** /asset/ids | *AssetApi* | [**getAssetSearchTerms**](doc//AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms | *AssetApi* | [**getAssetStats**](doc//AssetApi.md#getassetstats) | **GET** /asset/statistics | *AssetApi* | [**getAssetThumbnail**](doc//AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{id} | diff --git a/mobile/openapi/doc/AssetApi.md b/mobile/openapi/doc/AssetApi.md index f977c8ed4..8e912f549 100644 --- a/mobile/openapi/doc/AssetApi.md +++ b/mobile/openapi/doc/AssetApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**downloadFile**](AssetApi.md#downloadfile) | **POST** /asset/download/{id} | [**getAllAssets**](AssetApi.md#getallassets) | **GET** /asset | [**getAssetById**](AssetApi.md#getassetbyid) | **GET** /asset/assetById/{id} | +[**getAssetIds**](AssetApi.md#getassetids) | **GET** /asset/ids | [**getAssetSearchTerms**](AssetApi.md#getassetsearchterms) | **GET** /asset/search-terms | [**getAssetStats**](AssetApi.md#getassetstats) | **GET** /asset/statistics | [**getAssetThumbnail**](AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{id} | @@ -505,6 +506,61 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **getAssetIds** +> List getAssetIds(deviceId) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: cookie +//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; +// TODO Configure HTTP Bearer authorization: bearer +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = AssetApi(); +final deviceId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | + +try { + final result = api_instance.getAssetIds(deviceId); + print(result); +} catch (e) { + print('Exception when calling AssetApi->getAssetIds: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **deviceId** | **String**| | + +### Return type + +**List** + +### Authorization + +[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **getAssetSearchTerms** > List getAssetSearchTerms() @@ -1086,8 +1142,6 @@ Name | Type | Description | Notes -Get all asset of a device that are in the database, ID only. - ### Example ```dart import 'package:openapi/api.dart'; diff --git a/mobile/openapi/lib/api/asset_api.dart b/mobile/openapi/lib/api/asset_api.dart index 86ef067b9..12d837ffb 100644 --- a/mobile/openapi/lib/api/asset_api.dart +++ b/mobile/openapi/lib/api/asset_api.dart @@ -499,6 +499,58 @@ class AssetApi { return null; } + /// Performs an HTTP 'GET /asset/ids' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] deviceId (required): + Future getAssetIdsWithHttpInfo(String deviceId,) async { + // ignore: prefer_const_declarations + final path = r'/asset/ids'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + queryParams.addAll(_queryParams('', 'deviceId', deviceId)); + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] deviceId (required): + Future?> getAssetIds(String deviceId,) async { + final response = await getAssetIdsWithHttpInfo(deviceId,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + final responseBody = await _decodeBodyBytes(response); + return (await apiClient.deserializeAsync(responseBody, 'List') as List) + .cast() + .toList(); + + } + return null; + } + /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response]. Future getAssetSearchTermsWithHttpInfo() async { // ignore: prefer_const_declarations @@ -1122,10 +1174,7 @@ class AssetApi { return null; } - /// Get all asset of a device that are in the database, ID only. - /// - /// Note: This method returns the HTTP [Response]. - /// + /// Performs an HTTP 'GET /asset/{deviceId}' operation and returns the [Response]. /// Parameters: /// /// * [String] deviceId (required): @@ -1155,8 +1204,6 @@ class AssetApi { ); } - /// Get all asset of a device that are in the database, ID only. - /// /// Parameters: /// /// * [String] deviceId (required): diff --git a/mobile/openapi/test/asset_api_test.dart b/mobile/openapi/test/asset_api_test.dart index ecbfdf4c2..c7afa95ef 100644 --- a/mobile/openapi/test/asset_api_test.dart +++ b/mobile/openapi/test/asset_api_test.dart @@ -67,6 +67,11 @@ void main() { // TODO }); + //Future> getAssetIds(String deviceId) async + test('test getAssetIds', () async { + // TODO + }); + //Future> getAssetSearchTerms() async test('test getAssetSearchTerms', () async { // TODO @@ -117,8 +122,6 @@ void main() { // TODO }); - // Get all asset of a device that are in the database, ID only. - // //Future> getUserAssetsByDeviceId(String deviceId) async test('test getUserAssetsByDeviceId', () async { // TODO diff --git a/web/src/api/open-api/api.ts b/web/src/api/open-api/api.ts index 2301c02e1..50710d8be 100644 --- a/web/src/api/open-api/api.ts +++ b/web/src/api/open-api/api.ts @@ -5528,6 +5528,51 @@ export const AssetApiAxiosParamCreator = function (configuration?: Configuration + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @param {string} deviceId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAssetIds: async (deviceId: string, options: AxiosRequestConfig = {}): Promise => { + // verify required parameter 'deviceId' is not null or undefined + assertParamExists('getAssetIds', 'deviceId', deviceId) + const localVarPath = `/asset/ids`; + // use dummy base URL string because the URL constructor only accepts absolute URLs. + const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + + const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options}; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication cookie required + + // authentication api_key required + await setApiKeyToObject(localVarHeaderParameter, "x-api-key", configuration) + + // authentication bearer required + // http bearer authentication required + await setBearerAuthToObject(localVarHeaderParameter, configuration) + + if (deviceId !== undefined) { + localVarQueryParameter['deviceId'] = deviceId; + } + + + setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; @@ -6062,7 +6107,7 @@ export const AssetApiAxiosParamCreator = function (configuration?: Configuration }; }, /** - * Get all asset of a device that are in the database, ID only. + * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -6602,6 +6647,16 @@ export const AssetApiFp = function(configuration?: Configuration) { const localVarAxiosArgs = await localVarAxiosParamCreator.getAssetById(id, key, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, + /** + * + * @param {string} deviceId + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getAssetIds(deviceId: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise>> { + const localVarAxiosArgs = await localVarAxiosParamCreator.getAssetIds(deviceId, options); + return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); + }, /** * * @param {*} [options] Override http request option. @@ -6719,7 +6774,7 @@ export const AssetApiFp = function(configuration?: Configuration) { return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** - * Get all asset of a device that are in the database, ID only. + * * @param {string} deviceId * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -6896,6 +6951,15 @@ export const AssetApiFactory = function (configuration?: Configuration, basePath getAssetById(requestParameters: AssetApiGetAssetByIdRequest, options?: AxiosRequestConfig): AxiosPromise { return localVarFp.getAssetById(requestParameters.id, requestParameters.key, options).then((request) => request(axios, basePath)); }, + /** + * + * @param {AssetApiGetAssetIdsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getAssetIds(requestParameters: AssetApiGetAssetIdsRequest, options?: AxiosRequestConfig): AxiosPromise> { + return localVarFp.getAssetIds(requestParameters.deviceId, options).then((request) => request(axios, basePath)); + }, /** * * @param {*} [options] Override http request option. @@ -6984,7 +7048,7 @@ export const AssetApiFactory = function (configuration?: Configuration, basePath return localVarFp.getTimeBuckets(requestParameters.size, requestParameters.userId, requestParameters.albumId, requestParameters.personId, requestParameters.isArchived, requestParameters.isFavorite, requestParameters.key, options).then((request) => request(axios, basePath)); }, /** - * Get all asset of a device that are in the database, ID only. + * * @param {AssetApiGetUserAssetsByDeviceIdRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -7233,6 +7297,20 @@ export interface AssetApiGetAssetByIdRequest { readonly key?: string } +/** + * Request parameters for getAssetIds operation in AssetApi. + * @export + * @interface AssetApiGetAssetIdsRequest + */ +export interface AssetApiGetAssetIdsRequest { + /** + * + * @type {string} + * @memberof AssetApiGetAssetIds + */ + readonly deviceId: string +} + /** * Request parameters for getAssetStats operation in AssetApi. * @export @@ -7783,6 +7861,17 @@ export class AssetApi extends BaseAPI { return AssetApiFp(this.configuration).getAssetById(requestParameters.id, requestParameters.key, options).then((request) => request(this.axios, this.basePath)); } + /** + * + * @param {AssetApiGetAssetIdsRequest} requestParameters Request parameters. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof AssetApi + */ + public getAssetIds(requestParameters: AssetApiGetAssetIdsRequest, options?: AxiosRequestConfig) { + return AssetApiFp(this.configuration).getAssetIds(requestParameters.deviceId, options).then((request) => request(this.axios, this.basePath)); + } + /** * * @param {*} [options] Override http request option. @@ -7891,7 +7980,7 @@ export class AssetApi extends BaseAPI { } /** - * Get all asset of a device that are in the database, ID only. + * * @param {AssetApiGetUserAssetsByDeviceIdRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError}