atelino-sdk 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { deleteHitokotoById, type Options, postHitokoto } from './sdk.gen.js';
2
- export type { AtelinoInternalDtoCreateHitokotoRequest, AtelinoInternalDtoHitokotoIdRequest, AtelinoInternalDtoResponse, ClientOptions, DeleteHitokotoByIdData, DeleteHitokotoByIdError, DeleteHitokotoByIdErrors, DeleteHitokotoByIdResponse, DeleteHitokotoByIdResponses, PostHitokotoData, PostHitokotoError, PostHitokotoErrors, PostHitokotoResponse, PostHitokotoResponses } from './types.gen.js';
1
+ export { deleteHitokotoById, getHitokoto, getHitokotoById, getHitokotoList, type Options, postHitokoto } from './sdk.gen.js';
2
+ export type { AtelinoInternalDtoCreateHitokotoRequest, AtelinoInternalDtoHitokotoResponse, AtelinoInternalDtoResponse, ClientOptions, DeleteHitokotoByIdData, DeleteHitokotoByIdError, DeleteHitokotoByIdErrors, DeleteHitokotoByIdResponse, DeleteHitokotoByIdResponses, GetHitokotoByIdData, GetHitokotoByIdError, GetHitokotoByIdErrors, GetHitokotoByIdResponse, GetHitokotoByIdResponses, GetHitokotoData, GetHitokotoError, GetHitokotoErrors, GetHitokotoListData, GetHitokotoListError, GetHitokotoListErrors, GetHitokotoListResponse, GetHitokotoListResponses, GetHitokotoResponse, GetHitokotoResponses, PostHitokotoData, PostHitokotoError, PostHitokotoErrors, PostHitokotoResponse, PostHitokotoResponses } from './types.gen.js';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
- export { deleteHitokotoById, postHitokoto } from './sdk.gen.js';
2
+ export { deleteHitokotoById, getHitokoto, getHitokotoById, getHitokotoList, postHitokoto } from './sdk.gen.js';
package/dist/sdk.gen.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { Client, Options as Options2, TDataShape } from './client/index.js';
2
- import type { DeleteHitokotoByIdData, DeleteHitokotoByIdErrors, DeleteHitokotoByIdResponses, PostHitokotoData, PostHitokotoErrors, PostHitokotoResponses } from './types.gen.js';
2
+ import type { DeleteHitokotoByIdData, DeleteHitokotoByIdErrors, DeleteHitokotoByIdResponses, GetHitokotoByIdData, GetHitokotoByIdErrors, GetHitokotoByIdResponses, GetHitokotoData, GetHitokotoErrors, GetHitokotoListData, GetHitokotoListErrors, GetHitokotoListResponses, GetHitokotoResponses, PostHitokotoData, PostHitokotoErrors, PostHitokotoResponses } from './types.gen.js';
3
3
  export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
4
4
  /**
5
5
  * You can provide a client instance returned by `createClient()` instead of
@@ -13,15 +13,33 @@ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends
13
13
  */
14
14
  meta?: Record<string, unknown>;
15
15
  };
16
+ /**
17
+ * 随机获取一言
18
+ *
19
+ * 从数据库中随机获取一条一言记录,数据库异常则返回 500。
20
+ */
21
+ export declare const getHitokoto: <ThrowOnError extends boolean = false>(options?: Options<GetHitokotoData, ThrowOnError>) => import("./client/types.gen.js").RequestResult<GetHitokotoResponses, GetHitokotoErrors, ThrowOnError, "fields">;
16
22
  /**
17
23
  * 添加一言
18
24
  *
19
25
  * 创建一条新的一言记录。如果内容已存在,则返回 409 冲突错误;其他数据库异常返回 500。
20
26
  */
21
27
  export declare const postHitokoto: <ThrowOnError extends boolean = false>(options: Options<PostHitokotoData, ThrowOnError>) => import("./client/types.gen.js").RequestResult<PostHitokotoResponses, PostHitokotoErrors, ThrowOnError, "fields">;
28
+ /**
29
+ * 获取一言列表
30
+ *
31
+ * 从数据库中查询所有的一言记录,数据库异常则返回 500。
32
+ */
33
+ export declare const getHitokotoList: <ThrowOnError extends boolean = false>(options?: Options<GetHitokotoListData, ThrowOnError>) => import("./client/types.gen.js").RequestResult<GetHitokotoListResponses, GetHitokotoListErrors, ThrowOnError, "fields">;
22
34
  /**
23
35
  * 删除一言
24
36
  *
25
37
  * 传入一言的 ID,从数据库中删除对应的记录。若 ID 不存在则返回 404,数据库异常则返回 500。
26
38
  */
27
39
  export declare const deleteHitokotoById: <ThrowOnError extends boolean = false>(options: Options<DeleteHitokotoByIdData, ThrowOnError>) => import("./client/types.gen.js").RequestResult<DeleteHitokotoByIdResponses, DeleteHitokotoByIdErrors, ThrowOnError, "fields">;
40
+ /**
41
+ * 获取一言
42
+ *
43
+ * 传入一言的 ID,从数据库中查询对应的记录。若 ID 不存在则返回 404,数据库异常则返回 500。
44
+ */
45
+ export declare const getHitokotoById: <ThrowOnError extends boolean = false>(options: Options<GetHitokotoByIdData, ThrowOnError>) => import("./client/types.gen.js").RequestResult<GetHitokotoByIdResponses, GetHitokotoByIdErrors, ThrowOnError, "fields">;
package/dist/sdk.gen.js CHANGED
@@ -1,12 +1,18 @@
1
1
  // This file is auto-generated by @hey-api/openapi-ts
2
2
  import { client } from './client.gen.js';
3
+ /**
4
+ * 随机获取一言
5
+ *
6
+ * 从数据库中随机获取一条一言记录,数据库异常则返回 500。
7
+ */
8
+ export const getHitokoto = (options) => (options?.client ?? client).get({ url: '/hitokoto', ...options });
3
9
  /**
4
10
  * 添加一言
5
11
  *
6
12
  * 创建一条新的一言记录。如果内容已存在,则返回 409 冲突错误;其他数据库异常返回 500。
7
13
  */
8
14
  export const postHitokoto = (options) => (options.client ?? client).post({
9
- security: [{ scheme: 'basic', type: 'http' }],
15
+ security: [{ name: 'Authorization', type: 'apiKey' }],
10
16
  url: '/hitokoto',
11
17
  ...options,
12
18
  headers: {
@@ -14,13 +20,33 @@ export const postHitokoto = (options) => (options.client ?? client).post({
14
20
  ...options.headers
15
21
  }
16
22
  });
23
+ /**
24
+ * 获取一言列表
25
+ *
26
+ * 从数据库中查询所有的一言记录,数据库异常则返回 500。
27
+ */
28
+ export const getHitokotoList = (options) => (options?.client ?? client).get({
29
+ security: [{ name: 'Authorization', type: 'apiKey' }],
30
+ url: '/hitokoto/list',
31
+ ...options
32
+ });
17
33
  /**
18
34
  * 删除一言
19
35
  *
20
36
  * 传入一言的 ID,从数据库中删除对应的记录。若 ID 不存在则返回 404,数据库异常则返回 500。
21
37
  */
22
38
  export const deleteHitokotoById = (options) => (options.client ?? client).delete({
23
- security: [{ scheme: 'basic', type: 'http' }],
39
+ security: [{ name: 'Authorization', type: 'apiKey' }],
40
+ url: '/hitokoto/{id}',
41
+ ...options
42
+ });
43
+ /**
44
+ * 获取一言
45
+ *
46
+ * 传入一言的 ID,从数据库中查询对应的记录。若 ID 不存在则返回 404,数据库异常则返回 500。
47
+ */
48
+ export const getHitokotoById = (options) => (options.client ?? client).get({
49
+ security: [{ name: 'Authorization', type: 'apiKey' }],
24
50
  url: '/hitokoto/{id}',
25
51
  ...options
26
52
  });
@@ -4,14 +4,42 @@ export type ClientOptions = {
4
4
  export type AtelinoInternalDtoCreateHitokotoRequest = {
5
5
  content: string;
6
6
  };
7
- export type AtelinoInternalDtoHitokotoIdRequest = {
8
- id: number;
7
+ export type AtelinoInternalDtoHitokotoResponse = {
8
+ content?: string;
9
+ created_at?: string;
10
+ id?: number;
9
11
  };
10
12
  export type AtelinoInternalDtoResponse = {
11
13
  code?: number;
12
14
  data?: unknown;
13
15
  message?: string;
14
16
  };
17
+ export type GetHitokotoData = {
18
+ body?: never;
19
+ path?: never;
20
+ query?: never;
21
+ url: '/hitokoto';
22
+ };
23
+ export type GetHitokotoErrors = {
24
+ /**
25
+ * 没有找到对应的一言
26
+ */
27
+ 404: AtelinoInternalDtoResponse;
28
+ /**
29
+ * 数据库错误
30
+ */
31
+ 500: AtelinoInternalDtoResponse;
32
+ };
33
+ export type GetHitokotoError = GetHitokotoErrors[keyof GetHitokotoErrors];
34
+ export type GetHitokotoResponses = {
35
+ /**
36
+ * 请求成功
37
+ */
38
+ 200: AtelinoInternalDtoResponse & {
39
+ data?: AtelinoInternalDtoHitokotoResponse;
40
+ };
41
+ };
42
+ export type GetHitokotoResponse = GetHitokotoResponses[keyof GetHitokotoResponses];
15
43
  export type PostHitokotoData = {
16
44
  /**
17
45
  * 一言内容
@@ -25,24 +53,15 @@ export type PostHitokotoErrors = {
25
53
  /**
26
54
  * 请求参数错误
27
55
  */
28
- 400: AtelinoInternalDtoResponse & {
29
- code?: number;
30
- message?: string;
31
- };
56
+ 400: AtelinoInternalDtoResponse;
32
57
  /**
33
58
  * 该一言已存在
34
59
  */
35
- 409: AtelinoInternalDtoResponse & {
36
- code?: number;
37
- message?: string;
38
- };
60
+ 409: AtelinoInternalDtoResponse;
39
61
  /**
40
62
  * 数据库错误
41
63
  */
42
- 500: AtelinoInternalDtoResponse & {
43
- code?: number;
44
- message?: string;
45
- };
64
+ 500: AtelinoInternalDtoResponse;
46
65
  };
47
66
  export type PostHitokotoError = PostHitokotoErrors[keyof PostHitokotoErrors];
48
67
  export type PostHitokotoResponses = {
@@ -50,12 +69,41 @@ export type PostHitokotoResponses = {
50
69
  * 添加成功
51
70
  */
52
71
  200: AtelinoInternalDtoResponse & {
53
- code?: number;
54
- data?: AtelinoInternalDtoHitokotoIdRequest;
55
- message?: string;
72
+ data?: AtelinoInternalDtoHitokotoResponse;
56
73
  };
57
74
  };
58
75
  export type PostHitokotoResponse = PostHitokotoResponses[keyof PostHitokotoResponses];
76
+ export type GetHitokotoListData = {
77
+ body?: never;
78
+ path?: never;
79
+ query?: {
80
+ /**
81
+ * 页数
82
+ */
83
+ page?: number;
84
+ };
85
+ url: '/hitokoto/list';
86
+ };
87
+ export type GetHitokotoListErrors = {
88
+ /**
89
+ * 未授权
90
+ */
91
+ 401: AtelinoInternalDtoResponse;
92
+ /**
93
+ * 数据库错误
94
+ */
95
+ 500: AtelinoInternalDtoResponse;
96
+ };
97
+ export type GetHitokotoListError = GetHitokotoListErrors[keyof GetHitokotoListErrors];
98
+ export type GetHitokotoListResponses = {
99
+ /**
100
+ * 请求成功
101
+ */
102
+ 200: AtelinoInternalDtoResponse & {
103
+ data?: Array<AtelinoInternalDtoHitokotoResponse>;
104
+ };
105
+ };
106
+ export type GetHitokotoListResponse = GetHitokotoListResponses[keyof GetHitokotoListResponses];
59
107
  export type DeleteHitokotoByIdData = {
60
108
  body?: never;
61
109
  path: {
@@ -71,40 +119,64 @@ export type DeleteHitokotoByIdErrors = {
71
119
  /**
72
120
  * 请求参数错误
73
121
  */
74
- 400: AtelinoInternalDtoResponse & {
75
- code?: number;
76
- message?: string;
77
- };
122
+ 400: AtelinoInternalDtoResponse;
78
123
  /**
79
124
  * 未授权
80
125
  */
81
- 401: AtelinoInternalDtoResponse & {
82
- code?: number;
83
- message?: string;
84
- };
126
+ 401: AtelinoInternalDtoResponse;
85
127
  /**
86
128
  * 没有找到对应的一言
87
129
  */
88
- 404: AtelinoInternalDtoResponse & {
89
- code?: number;
90
- message?: string;
91
- };
130
+ 404: AtelinoInternalDtoResponse;
92
131
  /**
93
132
  * 数据库错误
94
133
  */
95
- 500: AtelinoInternalDtoResponse & {
96
- code?: number;
97
- message?: string;
98
- };
134
+ 500: AtelinoInternalDtoResponse;
99
135
  };
100
136
  export type DeleteHitokotoByIdError = DeleteHitokotoByIdErrors[keyof DeleteHitokotoByIdErrors];
101
137
  export type DeleteHitokotoByIdResponses = {
102
138
  /**
103
139
  * 删除成功
104
140
  */
141
+ 200: AtelinoInternalDtoResponse;
142
+ };
143
+ export type DeleteHitokotoByIdResponse = DeleteHitokotoByIdResponses[keyof DeleteHitokotoByIdResponses];
144
+ export type GetHitokotoByIdData = {
145
+ body?: never;
146
+ path: {
147
+ /**
148
+ * 一言 ID
149
+ */
150
+ id: number;
151
+ };
152
+ query?: never;
153
+ url: '/hitokoto/{id}';
154
+ };
155
+ export type GetHitokotoByIdErrors = {
156
+ /**
157
+ * 请求参数错误
158
+ */
159
+ 400: AtelinoInternalDtoResponse;
160
+ /**
161
+ * 未授权
162
+ */
163
+ 401: AtelinoInternalDtoResponse;
164
+ /**
165
+ * 没有找到对应的一言
166
+ */
167
+ 404: AtelinoInternalDtoResponse;
168
+ /**
169
+ * 数据库错误
170
+ */
171
+ 500: AtelinoInternalDtoResponse;
172
+ };
173
+ export type GetHitokotoByIdError = GetHitokotoByIdErrors[keyof GetHitokotoByIdErrors];
174
+ export type GetHitokotoByIdResponses = {
175
+ /**
176
+ * 请求成功
177
+ */
105
178
  200: AtelinoInternalDtoResponse & {
106
- code?: number;
107
- message?: string;
179
+ data?: AtelinoInternalDtoHitokotoResponse;
108
180
  };
109
181
  };
110
- export type DeleteHitokotoByIdResponse = DeleteHitokotoByIdResponses[keyof DeleteHitokotoByIdResponses];
182
+ export type GetHitokotoByIdResponse = GetHitokotoByIdResponses[keyof GetHitokotoByIdResponses];
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
- {
2
- "name": "atelino-sdk",
3
- "version": "1.0.1",
4
- "author": "BAIYI",
5
- "type": "module",
6
- "main": "./dist/index.js",
7
- "types": "./dist/index.d.ts",
8
- "exports": {
9
- ".": {
10
- "import": "./dist/index.js",
11
- "types": "./dist/index.d.ts"
12
- }
13
- },
14
- "files": [
15
- "dist/"
16
- ],
17
- "scripts": {
18
- "build": "tsc",
19
- "dev": "tsc --watch",
20
- "prepublishOnly": "npm run build",
21
- "generate": "openapi-ts"
22
- },
23
- "devDependencies": {
24
- "@hey-api/client-fetch": "^0.13.1",
25
- "@hey-api/openapi-ts": "^0.97.1",
26
- "@types/node": "^25.6.2",
27
- "typescript": "^6.0.3"
28
- },
29
- "publishConfig": {
30
- "registry": "https://registry.npmjs.org/"
31
- },
32
- "license": "MIT",
33
- "repository": {
34
- "type": "git",
35
- "url": "https://github.com/baiyibs/atelino-sdk.git"
36
- }
37
- }
1
+ {
2
+ "name": "atelino-sdk",
3
+ "version": "1.0.2",
4
+ "author": "BAIYI",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist/"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "dev": "tsc --watch",
20
+ "prepublishOnly": "npm run build",
21
+ "generate": "openapi-ts"
22
+ },
23
+ "devDependencies": {
24
+ "@hey-api/client-fetch": "^0.13.1",
25
+ "@hey-api/openapi-ts": "^0.97.1",
26
+ "@types/node": "^25.6.2",
27
+ "typescript": "^6.0.3"
28
+ },
29
+ "publishConfig": {
30
+ "registry": "https://registry.npmjs.org/"
31
+ },
32
+ "license": "MIT",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "https://github.com/baiyibs/atelino-sdk.git"
36
+ }
37
+ }