Skip to content

Commit

Permalink
regenerate sdk, a lot of method name changed, enum name changed. no d…
Browse files Browse the repository at this point in the history
…uplicate models now. Add readme.md
  • Loading branch information
EverettSummer committed Apr 23, 2022
1 parent 7e84de7 commit c9b3e57
Show file tree
Hide file tree
Showing 96 changed files with 494 additions and 408 deletions.
257 changes: 191 additions & 66 deletions dist.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions scripts/publish.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh

cp sdk/typescript/inversify/README.md sdk/typescript/inversify/dist/
cp sdk/typescript/inversify/package.json sdk/typescript/inversify/dist/
cp sdk/typescript/inversify/tsconfig.json sdk/typescript/inversify/dist/
46 changes: 46 additions & 0 deletions sdk/typescript/inversify/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# bgm-sdk-inversify

A typescript sdk for bgm.tv API. for API reference, see: [https://bangumi.github.io/api/](https://bangumi.github.io/api/)

To use this SDK, you need to use with RxJS 6+ and Inversify.

## Install

```shell
npm install @irohalab/bgm-sdk-inversify --save
```

Optionally, install dependencies
```shell
npm install inversify reflect-metadata rxjs typescript --save,
```

## Usage

```typescript
import { DefaultService, DefaultServiceInterface, ApiServiceBinder } from '@irohalab/bgm-sdk-inversify';
import { injectable } from 'inversify';
import { Subject } from './subject';
import { lastValueFrom } from 'rxjs';

const TYPES = {
DefaultService: 'DefaultService'
}

@injectable()
export class YourInjectableService {
constructor(@inject(TYPES.DefaultService) private _bgmClient: DefaultService) {
}

async getSubject(bgmId: number): Promise<Subject> {
return await lastValueFrom(this._bgmClient.getSujectById(bgmId));
}
}

const container = new Container();
ApiServiceBinder.with(container);
container.bind<YourInjectableService>(YourInjectableService).to(ApiServiceBinder);
const yourService = container.get<YourInjectableService>(YourInjectableService);
const subject = await yourService.getSubject(324295);
```

2 changes: 1 addition & 1 deletion sdk/typescript/inversify/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@irohalab/bgm-sdk-inversify",
"version": "1.0.5",
"version": "1.1.0",
"description": "An SDK for bgm.tv API",
"keywords": [],
"author": "IrohaLab",
Expand Down
4 changes: 1 addition & 3 deletions sdk/typescript/inversify/src/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ model/revision.ts
model/stat.ts
model/statusCode.ts
model/subject.ts
model/subject1.ts
model/subjectBase.ts
model/subjectBaseAllOf.ts
model/subjectBaseAllOfImages.ts
model/subjectCollection.ts
model/subjectLegacy.ts
model/subjectRevision.ts
model/subjectRevisionAllOf.ts
model/subjectRevisionData.ts
Expand All @@ -81,14 +81,12 @@ model/subjectSmallAllOf.ts
model/subjectSmallAllOfRating.ts
model/subjectSmallAllOfRatingCount.ts
model/subjectType.ts
model/subjectType1.ts
model/subjectTypeName.ts
model/tag.ts
model/user.ts
model/userAvatar.ts
model/userCollection.ts
model/userGroup.ts
model/userGroup1.ts
model/userUsernameCollectionsStatusCollects.ts
model/userUsernameCollectionsSubjectTypeCollects.ts
model/userUsernameCollectionsSubjectTypeList.ts
Expand Down
111 changes: 55 additions & 56 deletions sdk/typescript/inversify/src/api/default.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Bangumi API
* 你可以在 <https://api.bgm.tv/v0/oauth/> 生成一个 Access Token ## 建议客户端开发者指定一个带有 APP 名称和版本的 User Agent,而非使用 HTTP 请求库默认的 UA 各种请求库的默认 UA 在未来可能会被禁用。
*
* The version of the OpenAPI document: 2022-04-20
* The version of the OpenAPI document: 2022-04-23
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -51,10 +51,9 @@ import { RelatedCharacter } from '../model/relatedCharacter';
import { RelatedPerson } from '../model/relatedPerson';
import { ResponseGroup } from '../model/responseGroup';
import { StatusCode } from '../model/statusCode';
import { Subject1 } from '../model/subject1';
import { Subject } from '../model/subject';
import { SubjectRevision } from '../model/subjectRevision';
import { SubjectType } from '../model/subjectType';
import { SubjectType1 } from '../model/subjectType1';
import { SubjectTypeName } from '../model/subjectTypeName';
import { User } from '../model/user';

Expand Down Expand Up @@ -463,9 +462,9 @@ export class DefaultService implements DefaultServiceInterface {
* @param offset
*/
public getIndexSubjectsByIndexId(indexId: number, type?: SubjectType1, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedIndexSubject>;
public getIndexSubjectsByIndexId(indexId: number, type?: SubjectType1, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedIndexSubject>>;
public getIndexSubjectsByIndexId(indexId: number, type?: SubjectType1, limit?: number, offset?: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
public getIndexSubjectsByIndexId(indexId: number, type?: SubjectType, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedIndexSubject>;
public getIndexSubjectsByIndexId(indexId: number, type?: SubjectType, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedIndexSubject>>;
public getIndexSubjectsByIndexId(indexId: number, type?: SubjectType, limit?: number, offset?: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (indexId === null || indexId === undefined){
throw new Error('Required parameter indexId was null or undefined when calling getIndexSubjectsByIndexId.');
}
Expand Down Expand Up @@ -772,57 +771,14 @@ export class DefaultService implements DefaultServiceInterface {
}


/**
* 条目搜索
*
* @param keywords 关键词 &lt;br&gt; 需要 URL Encode
* @param type 条目类型,参考 [SubjectType](#model-SubjectType)
* @param responseGroup 返回数据大小,参考 [ResponseGroup](#model-ResponseGroup) &lt;br&gt; 默认为 small
* @param start 开始条数
* @param maxResults 每页条数 &lt;br&gt; 最多 25
*/
public getSearchSubjectBykeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'body', headers?: Headers): Observable<InlineResponse2005>;
public getSearchSubjectBykeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<InlineResponse2005>>;
public getSearchSubjectBykeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (keywords === null || keywords === undefined){
throw new Error('Required parameter keywords was null or undefined when calling getSearchSubjectBykeywords.');
}

let queryParameters: string[] = [];
if (type !== undefined) {
queryParameters.push('type='+encodeURIComponent(String(type)));
}
if (responseGroup !== undefined) {
queryParameters.push('responseGroup='+encodeURIComponent(String(responseGroup)));
}
if (start !== undefined) {
queryParameters.push('start='+encodeURIComponent(String(start)));
}
if (maxResults !== undefined) {
queryParameters.push('maxResults='+encodeURIComponent(String(maxResults)));
}

headers['Accept'] = 'application/json';

const response: Observable<HttpResponse<InlineResponse2005>> = this.httpClient.get(`${this.basePath}/search/subject/${encodeURIComponent(String(keywords))}?${queryParameters.join('&')}`, headers);
if (observe === 'body') {
return response.pipe(
map((httpResponse: HttpResponse) => <InlineResponse2005>(httpResponse.response))
);
}
return response;
}


/**
* 获取条目
* cache with 300s
* @param subjectId
*/
public getSubjectById(subjectId: number, observe?: 'body', headers?: Headers): Observable<Subject1>;
public getSubjectById(subjectId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Subject1>>;
public getSubjectById(subjectId: number, observe?: 'body', headers?: Headers): Observable<Subject>;
public getSubjectById(subjectId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Subject>>;
public getSubjectById(subjectId: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (subjectId === null || subjectId === undefined){
throw new Error('Required parameter subjectId was null or undefined when calling getSubjectById.');
Expand All @@ -834,10 +790,10 @@ export class DefaultService implements DefaultServiceInterface {
}
headers['Accept'] = 'application/json';

const response: Observable<HttpResponse<Subject1>> = this.httpClient.get(`${this.basePath}/v0/subjects/${encodeURIComponent(String(subjectId))}`, headers);
const response: Observable<HttpResponse<Subject>> = this.httpClient.get(`${this.basePath}/v0/subjects/${encodeURIComponent(String(subjectId))}`, headers);
if (observe === 'body') {
return response.pipe(
map((httpResponse: HttpResponse) => <Subject1>(httpResponse.response))
map((httpResponse: HttpResponse) => <Subject>(httpResponse.response))
);
}
return response;
Expand Down Expand Up @@ -1088,9 +1044,9 @@ export class DefaultService implements DefaultServiceInterface {
* @param offset
*/
public getUserCollectionsByUsername1(username: string, subjectType?: SubjectType1, type?: CollectionType, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedUserCollection>;
public getUserCollectionsByUsername1(username: string, subjectType?: SubjectType1, type?: CollectionType, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedUserCollection>>;
public getUserCollectionsByUsername1(username: string, subjectType?: SubjectType1, type?: CollectionType, limit?: number, offset?: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
public getUserCollectionsByUsername1(username: string, subjectType?: SubjectType, type?: CollectionType, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedUserCollection>;
public getUserCollectionsByUsername1(username: string, subjectType?: SubjectType, type?: CollectionType, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedUserCollection>>;
public getUserCollectionsByUsername1(username: string, subjectType?: SubjectType, type?: CollectionType, limit?: number, offset?: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (username === null || username === undefined){
throw new Error('Required parameter username was null or undefined when calling getUserCollectionsByUsername1.');
}
Expand Down Expand Up @@ -1160,6 +1116,49 @@ export class DefaultService implements DefaultServiceInterface {
}


/**
* 条目搜索
*
* @param keywords 关键词 &lt;br&gt; 需要 URL Encode
* @param type 条目类型,参考 [SubjectType](#model-SubjectType)
* @param responseGroup 返回数据大小,参考 [ResponseGroup](#model-ResponseGroup) &lt;br&gt; 默认为 small
* @param start 开始条数
* @param maxResults 每页条数 &lt;br&gt; 最多 25
*/
public searchSubjectByKeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'body', headers?: Headers): Observable<InlineResponse2005>;
public searchSubjectByKeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<InlineResponse2005>>;
public searchSubjectByKeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe: any = 'body', headers: Headers = {}): Observable<any> {
if (keywords === null || keywords === undefined){
throw new Error('Required parameter keywords was null or undefined when calling searchSubjectByKeywords.');
}

let queryParameters: string[] = [];
if (type !== undefined) {
queryParameters.push('type='+encodeURIComponent(String(type)));
}
if (responseGroup !== undefined) {
queryParameters.push('responseGroup='+encodeURIComponent(String(responseGroup)));
}
if (start !== undefined) {
queryParameters.push('start='+encodeURIComponent(String(start)));
}
if (maxResults !== undefined) {
queryParameters.push('maxResults='+encodeURIComponent(String(maxResults)));
}

headers['Accept'] = 'application/json';

const response: Observable<HttpResponse<InlineResponse2005>> = this.httpClient.get(`${this.basePath}/search/subject/${encodeURIComponent(String(keywords))}?${queryParameters.join('&')}`, headers);
if (observe === 'body') {
return response.pipe(
map((httpResponse: HttpResponse) => <InlineResponse2005>(httpResponse.response))
);
}
return response;
}


/**
* 管理收藏
* 管理收藏。Content-type必须为multipart/form-data或application/x-www-form-urlencoded,参数都得放在body里。
Expand Down
41 changes: 20 additions & 21 deletions sdk/typescript/inversify/src/api/default.serviceInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Bangumi API
* 你可以在 <https://api.bgm.tv/v0/oauth/> 生成一个 Access Token ## 建议客户端开发者指定一个带有 APP 名称和版本的 User Agent,而非使用 HTTP 请求库默认的 UA 各种请求库的默认 UA 在未来可能会被禁用。
*
* The version of the OpenAPI document: 2022-04-20
* The version of the OpenAPI document: 2022-04-23
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down Expand Up @@ -42,10 +42,9 @@ import { RelatedCharacter } from '../model/relatedCharacter';
import { RelatedPerson } from '../model/relatedPerson';
import { ResponseGroup } from '../model/responseGroup';
import { StatusCode } from '../model/statusCode';
import { Subject1 } from '../model/subject1';
import { Subject } from '../model/subject';
import { SubjectRevision } from '../model/subjectRevision';
import { SubjectType } from '../model/subjectType';
import { SubjectType1 } from '../model/subjectType1';
import { SubjectTypeName } from '../model/subjectTypeName';
import { User } from '../model/user';
import HttpResponse from '../HttpResponse';
Expand Down Expand Up @@ -166,8 +165,8 @@ export interface DefaultServiceInterface {
* @param offset
*/

getIndexSubjectsByIndexId(indexId: number, type?: SubjectType1, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedIndexSubject>;
getIndexSubjectsByIndexId(indexId: number, type?: SubjectType1, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedIndexSubject>>;
getIndexSubjectsByIndexId(indexId: number, type?: SubjectType, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedIndexSubject>;
getIndexSubjectsByIndexId(indexId: number, type?: SubjectType, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedIndexSubject>>;
/**
* Get Person
* cache with 60s
Expand Down Expand Up @@ -251,25 +250,13 @@ export interface DefaultServiceInterface {
getRelatedSubjectsBySubjectId(subjectId: number, observe?: 'body', headers?: Headers): Observable<Array<PolApiV0ModelsSubjectRelatedSubject>>;
getRelatedSubjectsBySubjectId(subjectId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Array<PolApiV0ModelsSubjectRelatedSubject>>>;
/**
* 条目搜索
*
* @param keywords 关键词 &lt;br&gt; 需要 URL Encode
* @param type 条目类型,参考 [SubjectType](#model-SubjectType)
* @param responseGroup 返回数据大小,参考 [ResponseGroup](#model-ResponseGroup) &lt;br&gt; 默认为 small
* @param start 开始条数
* @param maxResults 每页条数 &lt;br&gt; 最多 25
*/

getSearchSubjectBykeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'body', headers?: Headers): Observable<InlineResponse2005>;
getSearchSubjectBykeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<InlineResponse2005>>;
/**
* 获取条目
* cache with 300s
* @param subjectId
*/

getSubjectById(subjectId: number, observe?: 'body', headers?: Headers): Observable<Subject1>;
getSubjectById(subjectId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Subject1>>;
getSubjectById(subjectId: number, observe?: 'body', headers?: Headers): Observable<Subject>;
getSubjectById(subjectId: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Subject>>;
/**
* Get Subject Revision
*
Expand Down Expand Up @@ -344,8 +331,8 @@ export interface DefaultServiceInterface {
* @param offset
*/

getUserCollectionsByUsername1(username: string, subjectType?: SubjectType1, type?: CollectionType, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedUserCollection>;
getUserCollectionsByUsername1(username: string, subjectType?: SubjectType1, type?: CollectionType, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedUserCollection>>;
getUserCollectionsByUsername1(username: string, subjectType?: SubjectType, type?: CollectionType, limit?: number, offset?: number, observe?: 'body', headers?: Headers): Observable<PagedUserCollection>;
getUserCollectionsByUsername1(username: string, subjectType?: SubjectType, type?: CollectionType, limit?: number, offset?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<PagedUserCollection>>;
/**
* 用户收视进度
*
Expand All @@ -356,6 +343,18 @@ export interface DefaultServiceInterface {
getUserProgressByUsername(username: string, subjectId?: number, observe?: 'body', headers?: Headers): Observable<Array<InlineResponse2003>>;
getUserProgressByUsername(username: string, subjectId?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<Array<InlineResponse2003>>>;
/**
* 条目搜索
*
* @param keywords 关键词 &lt;br&gt; 需要 URL Encode
* @param type 条目类型,参考 [SubjectType](#model-SubjectType)
* @param responseGroup 返回数据大小,参考 [ResponseGroup](#model-ResponseGroup) &lt;br&gt; 默认为 small
* @param start 开始条数
* @param maxResults 每页条数 &lt;br&gt; 最多 25
*/

searchSubjectByKeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'body', headers?: Headers): Observable<InlineResponse2005>;
searchSubjectByKeywords(keywords: string, type?: SubjectType, responseGroup?: ResponseGroup, start?: number, maxResults?: number, observe?: 'response', headers?: Headers): Observable<HttpResponse<InlineResponse2005>>;
/**
* 管理收藏
* 管理收藏。Content-type必须为multipart/form-data或application/x-www-form-urlencoded,参数都得放在body里。
* @param subjectId 条目 ID
Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/inversify/src/model/avatar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Bangumi API
* 你可以在 <https://api.bgm.tv/v0/oauth/> 生成一个 Access Token ## 建议客户端开发者指定一个带有 APP 名称和版本的 User Agent,而非使用 HTTP 请求库默认的 UA 各种请求库的默认 UA 在未来可能会被禁用。
*
* The version of the OpenAPI document: 2022-04-20
* The version of the OpenAPI document: 2022-04-23
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
Loading

0 comments on commit c9b3e57

Please sign in to comment.