diff --git a/package.json b/package.json index e6c5e52..269bb84 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mira-sdk", - "version": "1.0.0", + "version": "1.1.0", "description": "SDK for project-mira", "main": "index.js", "scripts": { diff --git a/sdk/angular/package.json b/sdk/angular/package.json index be3be8b..fb0ac5f 100644 --- a/sdk/angular/package.json +++ b/sdk/angular/package.json @@ -1,6 +1,6 @@ { "name": "@irohalab/mira-sdk-angular", - "version": "0.1.1", + "version": "0.2.0", "scripts": { "ng": "ng", "start": "ng serve", diff --git a/sdk/angular/projects/mira-sdk-angular/package.json b/sdk/angular/projects/mira-sdk-angular/package.json index 0f773eb..02f03dd 100644 --- a/sdk/angular/projects/mira-sdk-angular/package.json +++ b/sdk/angular/projects/mira-sdk-angular/package.json @@ -1,6 +1,6 @@ { "name": "@irohalab/mira-sdk-angular", - "version": "0.1.1", + "version": "0.2.0", "peerDependencies": { "@angular/common": "^18.2.0", "@angular/core": "^18.2.0" diff --git a/sdk/angular/projects/mira-sdk-angular/src/.openapi-generator/FILES b/sdk/angular/projects/mira-sdk-angular/src/.openapi-generator/FILES index 6055009..b919cd0 100644 --- a/sdk/angular/projects/mira-sdk-angular/src/.openapi-generator/FILES +++ b/sdk/angular/projects/mira-sdk-angular/src/.openapi-generator/FILES @@ -9,6 +9,7 @@ encoder.ts git_push.sh index.ts model/entityBase.ts +model/getMainItemByIdResponse.ts model/getOnAirItemListResponse.ts model/imageInfo.ts model/itemEntity.ts diff --git a/sdk/angular/projects/mira-sdk-angular/src/api/default.service.ts b/sdk/angular/projects/mira-sdk-angular/src/api/default.service.ts index b5ab1ba..fda7047 100644 --- a/sdk/angular/projects/mira-sdk-angular/src/api/default.service.ts +++ b/sdk/angular/projects/mira-sdk-angular/src/api/default.service.ts @@ -17,6 +17,8 @@ import { HttpClient, HttpHeaders, HttpParams, import { CustomHttpParameterCodec } from '../encoder'; import { Observable } from 'rxjs'; +// @ts-ignore +import { GetMainItemByIdResponse } from '../model/getMainItemByIdResponse'; // @ts-ignore import { GetOnAirItemListResponse } from '../model/getOnAirItemListResponse'; @@ -94,6 +96,78 @@ export class DefaultMira implements DefaultMiraInterface { return httpParams; } + /** + * get a MainItem by id + * @param id MainItem id + * @param coverImage populate coverImage if true + * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. + * @param reportProgress flag to report request and response progress. + */ + public getMainItemById(id: number, coverImage?: string, observe?: 'body', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable; + public getMainItemById(id: number, coverImage?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getMainItemById(id: number, coverImage?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable>; + public getMainItemById(id: number, coverImage?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable { + if (id === null || id === undefined) { + throw new Error('Required parameter id was null or undefined when calling getMainItemById.'); + } + + let localVarQueryParameters = new HttpParams({encoder: this.encoder}); + if (coverImage !== undefined && coverImage !== null) { + localVarQueryParameters = this.addToHttpParams(localVarQueryParameters, + coverImage, 'coverImage'); + } + + let localVarHeaders = this.defaultHeaders; + + let localVarHttpHeaderAcceptSelected: string | undefined = options && options.httpHeaderAccept; + if (localVarHttpHeaderAcceptSelected === undefined) { + // to determine the Accept header + const httpHeaderAccepts: string[] = [ + 'application/json' + ]; + localVarHttpHeaderAcceptSelected = this.configuration.selectHeaderAccept(httpHeaderAccepts); + } + if (localVarHttpHeaderAcceptSelected !== undefined) { + localVarHeaders = localVarHeaders.set('Accept', localVarHttpHeaderAcceptSelected); + } + + let localVarHttpContext: HttpContext | undefined = options && options.context; + if (localVarHttpContext === undefined) { + localVarHttpContext = new HttpContext(); + } + + let localVarTransferCache: boolean | undefined = options && options.transferCache; + if (localVarTransferCache === undefined) { + localVarTransferCache = true; + } + + + let responseType_: 'text' | 'json' | 'blob' = 'json'; + if (localVarHttpHeaderAcceptSelected) { + if (localVarHttpHeaderAcceptSelected.startsWith('text')) { + responseType_ = 'text'; + } else if (this.configuration.isJsonMime(localVarHttpHeaderAcceptSelected)) { + responseType_ = 'json'; + } else { + responseType_ = 'blob'; + } + } + + let localVarPath = `/public/item/main/${this.configuration.encodeParam({name: "id", value: id, in: "path", style: "simple", explode: false, dataType: "number", dataFormat: undefined})}`; + return this.httpClient.request('get', `${this.configuration.basePath}${localVarPath}`, + { + context: localVarHttpContext, + params: localVarQueryParameters, + responseType: responseType_, + withCredentials: this.configuration.withCredentials, + headers: localVarHeaders, + observe: observe, + transferCache: localVarTransferCache, + reportProgress: reportProgress + } + ); + } + /** * get a list of on air MainItems with cover image * @param type type of MainItem, must be either anime or real diff --git a/sdk/angular/projects/mira-sdk-angular/src/api/default.serviceInterface.ts b/sdk/angular/projects/mira-sdk-angular/src/api/default.serviceInterface.ts index 5a5b8f4..75c1f5f 100644 --- a/sdk/angular/projects/mira-sdk-angular/src/api/default.serviceInterface.ts +++ b/sdk/angular/projects/mira-sdk-angular/src/api/default.serviceInterface.ts @@ -12,6 +12,7 @@ import { HttpHeaders } from '@angular/comm import { Observable } from 'rxjs'; +import { GetMainItemByIdResponse } from '../model/models'; import { GetOnAirItemListResponse } from '../model/models'; @@ -23,6 +24,14 @@ export interface DefaultMiraInterface { defaultHeaders: HttpHeaders; configuration: MiraConfiguration; + /** + * + * get a MainItem by id + * @param id MainItem id + * @param coverImage populate coverImage if true + */ + getMainItemById(id: number, coverImage?: string, extraHttpRequestParams?: any): Observable; + /** * * get a list of on air MainItems with cover image diff --git a/sdk/angular/projects/mira-sdk-angular/src/model/getMainItemByIdResponse.ts b/sdk/angular/projects/mira-sdk-angular/src/model/getMainItemByIdResponse.ts new file mode 100644 index 0000000..4f52f54 --- /dev/null +++ b/sdk/angular/projects/mira-sdk-angular/src/model/getMainItemByIdResponse.ts @@ -0,0 +1,24 @@ +/** + * mira Item API + * Item API for Project-Mira + * + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +import { MainItem } from './mainItem'; + + +export interface GetMainItemByIdResponse { + /** + * a MainItem + */ + data: Array; + /** + * result code, 0 is successful. + */ + status: number; +} + diff --git a/sdk/angular/projects/mira-sdk-angular/src/model/models.ts b/sdk/angular/projects/mira-sdk-angular/src/model/models.ts index 94b96f1..6c0f9ba 100644 --- a/sdk/angular/projects/mira-sdk-angular/src/model/models.ts +++ b/sdk/angular/projects/mira-sdk-angular/src/model/models.ts @@ -1,4 +1,5 @@ export * from './entityBase'; +export * from './getMainItemByIdResponse'; export * from './getOnAirItemListResponse'; export * from './imageInfo'; export * from './itemEntity'; diff --git a/sdk/angular/projects/mira-sdk-angular/src/model/onAirItem.ts b/sdk/angular/projects/mira-sdk-angular/src/model/onAirItem.ts index f3fd7ba..3936dd7 100644 --- a/sdk/angular/projects/mira-sdk-angular/src/model/onAirItem.ts +++ b/sdk/angular/projects/mira-sdk-angular/src/model/onAirItem.ts @@ -22,6 +22,8 @@ export interface OnAirItem { publicTime?: string; type: ItemType; subType?: ItemSubType; + name?: string; + name_cn?: string; coverImage?: ImageInfo; } export namespace OnAirItem { diff --git a/specification/items.yml b/specification/items.yml index 10e614d..618c811 100644 --- a/specification/items.yml +++ b/specification/items.yml @@ -38,6 +38,43 @@ paths: status: type: integer description: 'result code, 0 is successful.' + /public/item/main/{id}: + get: + description: get a MainItem by id + operationId: getMainItemById + parameters: + - name: id + in: path + required: true + description: MainItem id + schema: + type: integer + - name: coverImage + in: query + required: false + description: 'populate coverImage if true' + schema: + type: string + responses: + '200': + description: Successfully returned a MainItem. + content: + application/json: + schema: + title: GetMainItemByIdResponse + type: object + required: + - data + - status + properties: + data: + type: array + items: + $ref: '#/components/schemas/MainItem' + description: a MainItem + status: + type: integer + description: 'result code, 0 is successful.' components: schemas: ItemType: @@ -178,6 +215,10 @@ components: $ref: '#/components/schemas/ItemType' subType: $ref: '#/components/schemas/ItemSubType' + name: + type: string + name_cn: + type: string coverImage: $ref: '#/components/schemas/ImageInfo' EntityBase: