Skip to content

Commit

Permalink
add name and name_cn into onAirItem, add getMainItemById API
Browse files Browse the repository at this point in the history
  • Loading branch information
EverettSummer committed Sep 12, 2024
1 parent caecd24 commit d684282
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mira-sdk",
"version": "1.0.0",
"version": "1.1.0",
"description": "SDK for project-mira",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sdk/angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@irohalab/mira-sdk-angular",
"version": "0.1.1",
"version": "0.2.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
Expand Down
2 changes: 1 addition & 1 deletion sdk/angular/projects/mira-sdk-angular/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
74 changes: 74 additions & 0 deletions sdk/angular/projects/mira-sdk-angular/src/api/default.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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<GetMainItemByIdResponse>;
public getMainItemById(id: number, coverImage?: string, observe?: 'response', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpResponse<GetMainItemByIdResponse>>;
public getMainItemById(id: number, coverImage?: string, observe?: 'events', reportProgress?: boolean, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<HttpEvent<GetMainItemByIdResponse>>;
public getMainItemById(id: number, coverImage?: string, observe: any = 'body', reportProgress: boolean = false, options?: {httpHeaderAccept?: 'application/json', context?: HttpContext, transferCache?: boolean}): Observable<any> {
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,
<any>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<GetMainItemByIdResponse>('get', `${this.configuration.basePath}${localVarPath}`,
{
context: localVarHttpContext,
params: localVarQueryParameters,
responseType: <any>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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { HttpHeaders } from '@angular/comm

import { Observable } from 'rxjs';

import { GetMainItemByIdResponse } from '../model/models';
import { GetOnAirItemListResponse } from '../model/models';


Expand All @@ -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<GetMainItemByIdResponse>;

/**
*
* get a list of on air MainItems with cover image
Expand Down
Original file line number Diff line number Diff line change
@@ -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<MainItem>;
/**
* result code, 0 is successful.
*/
status: number;
}

1 change: 1 addition & 0 deletions sdk/angular/projects/mira-sdk-angular/src/model/models.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from './entityBase';
export * from './getMainItemByIdResponse';
export * from './getOnAirItemListResponse';
export * from './imageInfo';
export * from './itemEntity';
Expand Down
2 changes: 2 additions & 0 deletions sdk/angular/projects/mira-sdk-angular/src/model/onAirItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ export interface OnAirItem {
publicTime?: string;
type: ItemType;
subType?: ItemSubType;
name?: string;
name_cn?: string;
coverImage?: ImageInfo;
}
export namespace OnAirItem {
Expand Down
41 changes: 41 additions & 0 deletions specification/items.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit d684282

Please sign in to comment.