Skip to content

Commit 63cd3f3

Browse files
committed
0.4.3 - Updated
1 parent a288330 commit 63cd3f3

File tree

11 files changed

+193
-85
lines changed

11 files changed

+193
-85
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cuculus/cuculus-api",
3-
"version": "0.4.1",
3+
"version": "0.4.3",
44
"main": "dist/index.js",
55
"types": "dist/index.d.ts",
66
"files": [

src/apis/PostsApi.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@ export interface DeletePostRequest {
4848
id: string;
4949
}
5050

51-
export interface DeleteRepostRequest {
52-
id: string;
53-
}
54-
5551
export interface GetFavoritedByRequest {
5652
id: string;
5753
}
@@ -261,44 +257,6 @@ export class PostsApi extends runtime.BaseAPI {
261257
await this.deletePostRaw(requestParameters, initOverrides);
262258
}
263259

264-
/**
265-
* リポスト解除
266-
*/
267-
async deleteRepostRaw(requestParameters: DeleteRepostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UserPost>> {
268-
if (requestParameters.id === null || requestParameters.id === undefined) {
269-
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteRepost.');
270-
}
271-
272-
const queryParameters: any = {};
273-
274-
const headerParameters: runtime.HTTPHeaders = {};
275-
276-
if (this.configuration && this.configuration.accessToken) {
277-
const token = this.configuration.accessToken;
278-
const tokenString = await token("bearer", []);
279-
280-
if (tokenString) {
281-
headerParameters["Authorization"] = `Bearer ${tokenString}`;
282-
}
283-
}
284-
const response = await this.request({
285-
path: `/v0/posts/{id}/repost`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
286-
method: 'DELETE',
287-
headers: headerParameters,
288-
query: queryParameters,
289-
}, initOverrides);
290-
291-
return new runtime.JSONApiResponse(response, (jsonValue) => UserPostFromJSON(jsonValue));
292-
}
293-
294-
/**
295-
* リポスト解除
296-
*/
297-
async deleteRepost(requestParameters: DeleteRepostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UserPost> {
298-
const response = await this.deleteRepostRaw(requestParameters, initOverrides);
299-
return await response.value();
300-
}
301-
302260
/**
303261
* ポストIDからお気に入りしたアカウント一覧を返す
304262
*/

src/apis/UsersApi.ts

Lines changed: 52 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,14 @@
1515

1616
import * as runtime from '../runtime';
1717
import type {
18+
Relationship,
1819
User,
1920
UserPost,
2021
UserWithFollows,
2122
} from '../models/index';
2223
import {
24+
RelationshipFromJSON,
25+
RelationshipToJSON,
2326
UserFromJSON,
2427
UserToJSON,
2528
UserPostFromJSON,
@@ -36,6 +39,10 @@ export interface DeleteFollowRequest {
3639
id: number;
3740
}
3841

42+
export interface GetRelationShipRequest {
43+
id: number;
44+
}
45+
3946
export interface GetUserByIdRequest {
4047
id: number;
4148
}
@@ -66,9 +73,9 @@ export interface GetUserPostsRequest {
6673
export class UsersApi extends runtime.BaseAPI {
6774

6875
/**
69-
* ユーザーIDをフォローする
76+
* ユーザーIDをフォローする。またはフォローリクエストを送る
7077
*/
71-
async createFollowRaw(requestParameters: CreateFollowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>> {
78+
async createFollowRaw(requestParameters: CreateFollowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Relationship>> {
7279
if (requestParameters.id === null || requestParameters.id === undefined) {
7380
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling createFollow.');
7481
}
@@ -92,14 +99,15 @@ export class UsersApi extends runtime.BaseAPI {
9299
query: queryParameters,
93100
}, initOverrides);
94101

95-
return new runtime.VoidApiResponse(response);
102+
return new runtime.JSONApiResponse(response, (jsonValue) => RelationshipFromJSON(jsonValue));
96103
}
97104

98105
/**
99-
* ユーザーIDをフォローする
106+
* ユーザーIDをフォローする。またはフォローリクエストを送る
100107
*/
101-
async createFollow(requestParameters: CreateFollowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void> {
102-
await this.createFollowRaw(requestParameters, initOverrides);
108+
async createFollow(requestParameters: CreateFollowRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Relationship> {
109+
const response = await this.createFollowRaw(requestParameters, initOverrides);
110+
return await response.value();
103111
}
104112

105113
/**
@@ -173,6 +181,44 @@ export class UsersApi extends runtime.BaseAPI {
173181
return await response.value();
174182
}
175183

184+
/**
185+
* ユーザーIDとの関係を取得する
186+
*/
187+
async getRelationShipRaw(requestParameters: GetRelationShipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Relationship>> {
188+
if (requestParameters.id === null || requestParameters.id === undefined) {
189+
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling getRelationShip.');
190+
}
191+
192+
const queryParameters: any = {};
193+
194+
const headerParameters: runtime.HTTPHeaders = {};
195+
196+
if (this.configuration && this.configuration.accessToken) {
197+
const token = this.configuration.accessToken;
198+
const tokenString = await token("bearer", []);
199+
200+
if (tokenString) {
201+
headerParameters["Authorization"] = `Bearer ${tokenString}`;
202+
}
203+
}
204+
const response = await this.request({
205+
path: `/v0/users/{id}/relationship`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
206+
method: 'GET',
207+
headers: headerParameters,
208+
query: queryParameters,
209+
}, initOverrides);
210+
211+
return new runtime.JSONApiResponse(response, (jsonValue) => RelationshipFromJSON(jsonValue));
212+
}
213+
214+
/**
215+
* ユーザーIDとの関係を取得する
216+
*/
217+
async getRelationShip(requestParameters: GetRelationShipRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Relationship> {
218+
const response = await this.getRelationShipRaw(requestParameters, initOverrides);
219+
return await response.value();
220+
}
221+
176222
/**
177223
* ユーザーIDからユーザーを取得する
178224
*/

src/models/HealthControllerCheck200ResponseInfoValue.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ import { exists, mapValues } from '../runtime';
1919
* @interface HealthControllerCheck200ResponseInfoValue
2020
*/
2121
export interface HealthControllerCheck200ResponseInfoValue {
22-
[key: string]: string | any;
22+
[key: string]: any | any;
2323
/**
2424
*
2525
* @type {string}
2626
* @memberof HealthControllerCheck200ResponseInfoValue
2727
*/
28-
status?: string;
28+
status: string;
2929
}
3030

3131
/**
3232
* Check if a given object implements the HealthControllerCheck200ResponseInfoValue interface.
3333
*/
3434
export function instanceOfHealthControllerCheck200ResponseInfoValue(value: object): boolean {
3535
let isInstance = true;
36+
isInstance = isInstance && "status" in value;
3637

3738
return isInstance;
3839
}
@@ -48,7 +49,7 @@ export function HealthControllerCheck200ResponseInfoValueFromJSONTyped(json: any
4849
return {
4950

5051
...json,
51-
'status': !exists(json, 'status') ? undefined : json['status'],
52+
'status': json['status'],
5253
};
5354
}
5455

src/models/Post.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export interface Post {
5151
*/
5252
author: User;
5353
/**
54-
* 本文|空orNullの場合はRTです
54+
* 本文|リポストの場合はUndefinedになります
5555
* @type {string}
5656
* @memberof Post
5757
*/
@@ -62,6 +62,18 @@ export interface Post {
6262
* @memberof Post
6363
*/
6464
postedAt: Date;
65+
/**
66+
* リポスト数
67+
* @type {number}
68+
* @memberof Post
69+
*/
70+
repostCount: number;
71+
/**
72+
* お気に入り数
73+
* @type {number}
74+
* @memberof Post
75+
*/
76+
favoriteCount: number;
6577
}
6678

6779
/**
@@ -72,6 +84,8 @@ export function instanceOfPost(value: object): boolean {
7284
isInstance = isInstance && "id" in value;
7385
isInstance = isInstance && "author" in value;
7486
isInstance = isInstance && "postedAt" in value;
87+
isInstance = isInstance && "repostCount" in value;
88+
isInstance = isInstance && "favoriteCount" in value;
7589

7690
return isInstance;
7791
}
@@ -92,6 +106,8 @@ export function PostFromJSONTyped(json: any, ignoreDiscriminator: boolean): Post
92106
'author': UserFromJSON(json['author']),
93107
'text': !exists(json, 'text') ? undefined : json['text'],
94108
'postedAt': (new Date(json['posted_at'])),
109+
'repostCount': json['repost_count'],
110+
'favoriteCount': json['favorite_count'],
95111
};
96112
}
97113

@@ -110,6 +126,8 @@ export function PostToJSON(value?: Post | null): any {
110126
'author': UserToJSON(value.author),
111127
'text': value.text,
112128
'posted_at': (value.postedAt.toISOString()),
129+
'repost_count': value.repostCount,
130+
'favorite_count': value.favoriteCount,
113131
};
114132
}
115133

src/models/Relationship.ts

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* tslint:disable */
2+
/* eslint-disable */
3+
/**
4+
* Cuculus API
5+
* The Cuculus API description
6+
*
7+
* The version of the OpenAPI document: 0.0.1
8+
*
9+
*
10+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11+
* https://openapi-generator.tech
12+
* Do not edit the class manually.
13+
*/
14+
15+
import { exists, mapValues } from '../runtime';
16+
/**
17+
*
18+
* @export
19+
* @interface Relationship
20+
*/
21+
export interface Relationship {
22+
/**
23+
*
24+
* @type {number}
25+
* @memberof Relationship
26+
*/
27+
id: number;
28+
/**
29+
* フォロー中
30+
* @type {boolean}
31+
* @memberof Relationship
32+
*/
33+
following: boolean;
34+
/**
35+
* フォローリクエスト中
36+
* @type {boolean}
37+
* @memberof Relationship
38+
*/
39+
followRequested: boolean;
40+
}
41+
42+
/**
43+
* Check if a given object implements the Relationship interface.
44+
*/
45+
export function instanceOfRelationship(value: object): boolean {
46+
let isInstance = true;
47+
isInstance = isInstance && "id" in value;
48+
isInstance = isInstance && "following" in value;
49+
isInstance = isInstance && "followRequested" in value;
50+
51+
return isInstance;
52+
}
53+
54+
export function RelationshipFromJSON(json: any): Relationship {
55+
return RelationshipFromJSONTyped(json, false);
56+
}
57+
58+
export function RelationshipFromJSONTyped(json: any, ignoreDiscriminator: boolean): Relationship {
59+
if ((json === undefined) || (json === null)) {
60+
return json;
61+
}
62+
return {
63+
64+
'id': json['id'],
65+
'following': json['following'],
66+
'followRequested': json['follow_requested'],
67+
};
68+
}
69+
70+
export function RelationshipToJSON(value?: Relationship | null): any {
71+
if (value === undefined) {
72+
return undefined;
73+
}
74+
if (value === null) {
75+
return null;
76+
}
77+
return {
78+
79+
'id': value.id,
80+
'following': value.following,
81+
'follow_requested': value.followRequested,
82+
};
83+
}
84+

src/models/User.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ export interface User {
5656
*/
5757
profileImageUrl: string;
5858
/**
59-
*
59+
* 非公開アカウントかどうか
6060
* @type {boolean}
6161
* @memberof User
6262
*/
63-
_protected: boolean;
63+
isPrivate: boolean;
6464
/**
6565
*
6666
* @type {string}
@@ -86,7 +86,7 @@ export function instanceOfUser(value: object): boolean {
8686
isInstance = isInstance && "createdAt" in value;
8787
isInstance = isInstance && "bio" in value;
8888
isInstance = isInstance && "profileImageUrl" in value;
89-
isInstance = isInstance && "_protected" in value;
89+
isInstance = isInstance && "isPrivate" in value;
9090
isInstance = isInstance && "url" in value;
9191
isInstance = isInstance && "verified" in value;
9292

@@ -109,7 +109,7 @@ export function UserFromJSONTyped(json: any, ignoreDiscriminator: boolean): User
109109
'createdAt': (new Date(json['created_at'])),
110110
'bio': json['bio'],
111111
'profileImageUrl': json['profile_image_url'],
112-
'_protected': json['protected'],
112+
'isPrivate': json['is_private'],
113113
'url': json['url'],
114114
'verified': json['verified'],
115115
};
@@ -130,7 +130,7 @@ export function UserToJSON(value?: User | null): any {
130130
'created_at': (value.createdAt.toISOString()),
131131
'bio': value.bio,
132132
'profile_image_url': value.profileImageUrl,
133-
'protected': value._protected,
133+
'is_private': value.isPrivate,
134134
'url': value.url,
135135
'verified': value.verified,
136136
};

0 commit comments

Comments
 (0)