aint-sdk 0.1.0-alpha.2 → 0.1.0-alpha.4

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +31 -0
  3. package/client.d.mts +12 -0
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +12 -0
  6. package/client.d.ts.map +1 -1
  7. package/client.js +14 -0
  8. package/client.js.map +1 -1
  9. package/client.mjs +14 -0
  10. package/client.mjs.map +1 -1
  11. package/core/pagination.d.mts +56 -0
  12. package/core/pagination.d.mts.map +1 -0
  13. package/core/pagination.d.ts +56 -0
  14. package/core/pagination.d.ts.map +1 -0
  15. package/core/pagination.js +102 -0
  16. package/core/pagination.js.map +1 -0
  17. package/core/pagination.mjs +96 -0
  18. package/core/pagination.mjs.map +1 -0
  19. package/index.d.mts +1 -0
  20. package/index.d.mts.map +1 -1
  21. package/index.d.ts +1 -0
  22. package/index.d.ts.map +1 -1
  23. package/index.js +3 -1
  24. package/index.js.map +1 -1
  25. package/index.mjs +1 -0
  26. package/index.mjs.map +1 -1
  27. package/package.json +11 -1
  28. package/pagination.d.mts +2 -0
  29. package/pagination.d.mts.map +1 -0
  30. package/pagination.d.ts +2 -0
  31. package/pagination.d.ts.map +1 -0
  32. package/pagination.js +6 -0
  33. package/pagination.js.map +1 -0
  34. package/pagination.mjs +2 -0
  35. package/pagination.mjs.map +1 -0
  36. package/resources/chapters.d.mts +232 -0
  37. package/resources/chapters.d.mts.map +1 -0
  38. package/resources/chapters.d.ts +232 -0
  39. package/resources/chapters.d.ts.map +1 -0
  40. package/resources/chapters.js +78 -0
  41. package/resources/chapters.js.map +1 -0
  42. package/resources/chapters.mjs +74 -0
  43. package/resources/chapters.mjs.map +1 -0
  44. package/resources/index.d.mts +2 -0
  45. package/resources/index.d.mts.map +1 -1
  46. package/resources/index.d.ts +2 -0
  47. package/resources/index.d.ts.map +1 -1
  48. package/resources/index.js +5 -1
  49. package/resources/index.js.map +1 -1
  50. package/resources/index.mjs +2 -0
  51. package/resources/index.mjs.map +1 -1
  52. package/resources/projects.d.mts +220 -0
  53. package/resources/projects.d.mts.map +1 -0
  54. package/resources/projects.d.ts +220 -0
  55. package/resources/projects.d.ts.map +1 -0
  56. package/resources/projects.js +73 -0
  57. package/resources/projects.js.map +1 -0
  58. package/resources/projects.mjs +69 -0
  59. package/resources/projects.mjs.map +1 -0
  60. package/src/client.ts +75 -0
  61. package/src/core/pagination.ts +166 -0
  62. package/src/index.ts +1 -0
  63. package/src/pagination.ts +2 -0
  64. package/src/resources/chapters.ts +301 -0
  65. package/src/resources/index.ts +19 -0
  66. package/src/resources/projects.ts +289 -0
  67. package/src/version.ts +1 -1
  68. package/version.d.mts +1 -1
  69. package/version.d.ts +1 -1
  70. package/version.js +1 -1
  71. package/version.mjs +1 -1
@@ -0,0 +1,301 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { PageNumberPagination, type PageNumberPaginationParams, PagePromise } from '../core/pagination';
6
+ import { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ export class Chapters extends APIResource {
11
+ /**
12
+ * Creates a new chapter in a project
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const chapter = await client.chapters.create({
17
+ * project_id: 'prj_xyz789',
18
+ * title: 'Chapter 1 - The Beginning',
19
+ * });
20
+ * ```
21
+ */
22
+ create(body: ChapterCreateParams, options?: RequestOptions): APIPromise<Chapter> {
23
+ return this._client.post('/chapters', { body, ...options });
24
+ }
25
+
26
+ /**
27
+ * Updates an existing chapter
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const chapter = await client.chapters.update('id');
32
+ * ```
33
+ */
34
+ update(id: string, body: ChapterUpdateParams, options?: RequestOptions): APIPromise<Chapter> {
35
+ return this._client.patch(path`/chapters/${id}`, { body, ...options });
36
+ }
37
+
38
+ /**
39
+ * Returns a paginated list of chapters for a project
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * // Automatically fetches more pages as needed.
44
+ * for await (const chapterListItem of client.chapters.list({
45
+ * project_id: 'project_id',
46
+ * })) {
47
+ * // ...
48
+ * }
49
+ * ```
50
+ */
51
+ list(
52
+ query: ChapterListParams,
53
+ options?: RequestOptions,
54
+ ): PagePromise<ChapterListItemsPageNumberPagination, ChapterListItem> {
55
+ return this._client.getAPIList('/chapters', PageNumberPagination<ChapterListItem>, { query, ...options });
56
+ }
57
+
58
+ /**
59
+ * Deletes a chapter (soft delete)
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * await client.chapters.delete('id');
64
+ * ```
65
+ */
66
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
67
+ return this._client.delete(path`/chapters/${id}`, {
68
+ ...options,
69
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
70
+ });
71
+ }
72
+
73
+ /**
74
+ * Returns a single chapter by ID, including full text content and cost breakdown
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * const chapter = await client.chapters.get('id');
79
+ * ```
80
+ */
81
+ get(id: string, options?: RequestOptions): APIPromise<Chapter> {
82
+ return this._client.get(path`/chapters/${id}`, options);
83
+ }
84
+ }
85
+
86
+ export type ChapterListItemsPageNumberPagination = PageNumberPagination<ChapterListItem>;
87
+
88
+ /**
89
+ * A chapter with full content and cost breakdown
90
+ */
91
+ export interface Chapter {
92
+ /**
93
+ * Unique chapter identifier
94
+ */
95
+ id: string;
96
+
97
+ /**
98
+ * Parent project identifier
99
+ */
100
+ project_id: string;
101
+
102
+ /**
103
+ * Chapter title
104
+ */
105
+ title: string;
106
+
107
+ /**
108
+ * Cost breakdown for the translation
109
+ */
110
+ cost?: Chapter.Cost | null;
111
+
112
+ /**
113
+ * Chapter creation timestamp
114
+ */
115
+ created_at?: string | null;
116
+
117
+ /**
118
+ * Timestamp of most recent translation edit
119
+ */
120
+ last_edited_at?: string | null;
121
+
122
+ /**
123
+ * Source language of the most recent translation
124
+ */
125
+ original_language?: string | null;
126
+
127
+ /**
128
+ * Original source text
129
+ */
130
+ original_text?: string | null;
131
+
132
+ /**
133
+ * AI-generated summary of the chapter content
134
+ */
135
+ summary_text?: string | null;
136
+
137
+ /**
138
+ * Target language of the most recent translation
139
+ */
140
+ translated_language?: string | null;
141
+
142
+ /**
143
+ * Translated text
144
+ */
145
+ translated_text?: string | null;
146
+ }
147
+
148
+ export namespace Chapter {
149
+ /**
150
+ * Cost breakdown for the translation
151
+ */
152
+ export interface Cost {
153
+ /**
154
+ * AI edit cost
155
+ */
156
+ edit?: number | null;
157
+
158
+ /**
159
+ * AI glossary generation cost
160
+ */
161
+ glossary?: number | null;
162
+
163
+ /**
164
+ * Summary generation cost
165
+ */
166
+ summary?: number | null;
167
+
168
+ /**
169
+ * Total cost (sum of all costs)
170
+ */
171
+ total?: number | null;
172
+
173
+ /**
174
+ * Translation cost
175
+ */
176
+ translation?: number | null;
177
+ }
178
+ }
179
+
180
+ /**
181
+ * A chapter summary for list responses
182
+ */
183
+ export interface ChapterListItem {
184
+ /**
185
+ * Unique chapter identifier
186
+ */
187
+ id: string;
188
+
189
+ /**
190
+ * Parent project identifier
191
+ */
192
+ project_id: string;
193
+
194
+ /**
195
+ * Chapter title
196
+ */
197
+ title: string;
198
+
199
+ /**
200
+ * Chapter creation timestamp
201
+ */
202
+ created_at?: string | null;
203
+
204
+ /**
205
+ * Timestamp of most recent translation edit
206
+ */
207
+ last_edited_at?: string | null;
208
+
209
+ /**
210
+ * Source language of the most recent translation
211
+ */
212
+ original_language?: string | null;
213
+
214
+ /**
215
+ * AI-generated summary of the chapter content
216
+ */
217
+ summary_text?: string | null;
218
+
219
+ /**
220
+ * Target language of the most recent translation
221
+ */
222
+ translated_language?: string | null;
223
+ }
224
+
225
+ /**
226
+ * Paginated list of chapters
227
+ */
228
+ export interface ChapterListResponse {
229
+ /**
230
+ * List of chapters
231
+ */
232
+ data: Array<ChapterListItem>;
233
+
234
+ /**
235
+ * Current page number
236
+ */
237
+ page: number;
238
+
239
+ /**
240
+ * Number of items per page
241
+ */
242
+ page_size: number;
243
+
244
+ /**
245
+ * Total number of chapters
246
+ */
247
+ total: number;
248
+
249
+ /**
250
+ * Total number of pages
251
+ */
252
+ total_pages: number;
253
+ }
254
+
255
+ export interface ChapterCreateParams {
256
+ /**
257
+ * Parent project ID
258
+ */
259
+ project_id: string;
260
+
261
+ /**
262
+ * Chapter title
263
+ */
264
+ title: string;
265
+ }
266
+
267
+ export interface ChapterUpdateParams {
268
+ /**
269
+ * Chapter title
270
+ */
271
+ title?: string;
272
+ }
273
+
274
+ export interface ChapterListParams extends PageNumberPaginationParams {
275
+ /**
276
+ * Project ID to filter chapters by
277
+ */
278
+ project_id: string;
279
+
280
+ /**
281
+ * Sort direction
282
+ */
283
+ sort_direction?: 'asc' | 'desc';
284
+
285
+ /**
286
+ * Field to sort by
287
+ */
288
+ sort_field?: 'title' | 'created_at' | 'last_edited_at';
289
+ }
290
+
291
+ export declare namespace Chapters {
292
+ export {
293
+ type Chapter as Chapter,
294
+ type ChapterListItem as ChapterListItem,
295
+ type ChapterListResponse as ChapterListResponse,
296
+ type ChapterListItemsPageNumberPagination as ChapterListItemsPageNumberPagination,
297
+ type ChapterCreateParams as ChapterCreateParams,
298
+ type ChapterUpdateParams as ChapterUpdateParams,
299
+ type ChapterListParams as ChapterListParams,
300
+ };
301
+ }
@@ -1,3 +1,22 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
+ export {
4
+ Chapters,
5
+ type Chapter,
6
+ type ChapterListItem,
7
+ type ChapterListResponse,
8
+ type ChapterCreateParams,
9
+ type ChapterUpdateParams,
10
+ type ChapterListParams,
11
+ type ChapterListItemsPageNumberPagination,
12
+ } from './chapters';
13
+ export {
14
+ Projects,
15
+ type Project,
16
+ type ProjectListResponse,
17
+ type ProjectCreateParams,
18
+ type ProjectUpdateParams,
19
+ type ProjectListParams,
20
+ type ProjectsPageNumberPagination,
21
+ } from './projects';
3
22
  export { Users, type User } from './users';
@@ -0,0 +1,289 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { PageNumberPagination, type PageNumberPaginationParams, PagePromise } from '../core/pagination';
6
+ import { buildHeaders } from '../internal/headers';
7
+ import { RequestOptions } from '../internal/request-options';
8
+ import { path } from '../internal/utils/path';
9
+
10
+ export class Projects extends APIResource {
11
+ /**
12
+ * Creates a new project
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const project = await client.projects.create();
17
+ * ```
18
+ */
19
+ create(body: ProjectCreateParams, options?: RequestOptions): APIPromise<Project> {
20
+ return this._client.post('/projects', { body, ...options });
21
+ }
22
+
23
+ /**
24
+ * Updates an existing project
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const project = await client.projects.update('id');
29
+ * ```
30
+ */
31
+ update(id: string, body: ProjectUpdateParams, options?: RequestOptions): APIPromise<Project> {
32
+ return this._client.patch(path`/projects/${id}`, { body, ...options });
33
+ }
34
+
35
+ /**
36
+ * Returns a paginated list of the user's projects
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * // Automatically fetches more pages as needed.
41
+ * for await (const project of client.projects.list()) {
42
+ * // ...
43
+ * }
44
+ * ```
45
+ */
46
+ list(
47
+ query: ProjectListParams | null | undefined = {},
48
+ options?: RequestOptions,
49
+ ): PagePromise<ProjectsPageNumberPagination, Project> {
50
+ return this._client.getAPIList('/projects', PageNumberPagination<Project>, { query, ...options });
51
+ }
52
+
53
+ /**
54
+ * Deletes a project (soft delete)
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * await client.projects.delete('id');
59
+ * ```
60
+ */
61
+ delete(id: string, options?: RequestOptions): APIPromise<void> {
62
+ return this._client.delete(path`/projects/${id}`, {
63
+ ...options,
64
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
65
+ });
66
+ }
67
+
68
+ /**
69
+ * Returns a single project by ID
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const project = await client.projects.get('id');
74
+ * ```
75
+ */
76
+ get(id: string, options?: RequestOptions): APIPromise<Project> {
77
+ return this._client.get(path`/projects/${id}`, options);
78
+ }
79
+ }
80
+
81
+ export type ProjectsPageNumberPagination = PageNumberPagination<Project>;
82
+
83
+ /**
84
+ * A translation project
85
+ */
86
+ export interface Project {
87
+ /**
88
+ * Unique project identifier
89
+ */
90
+ id: string;
91
+
92
+ /**
93
+ * Project name
94
+ */
95
+ name: string;
96
+
97
+ /**
98
+ * Number of translation batches
99
+ */
100
+ batch_count?: number | null;
101
+
102
+ /**
103
+ * Number of chapters in the project
104
+ */
105
+ chapter_count?: number | null;
106
+
107
+ /**
108
+ * Project creation timestamp
109
+ */
110
+ created_at?: string | null;
111
+
112
+ /**
113
+ * Custom translation instructions
114
+ */
115
+ custom_instructions?: string | null;
116
+
117
+ /**
118
+ * Project description
119
+ */
120
+ description?: string | null;
121
+
122
+ /**
123
+ * Last update timestamp
124
+ */
125
+ last_updated_at?: string | null;
126
+
127
+ /**
128
+ * Name of the last updated chapter
129
+ */
130
+ last_updated_chapter_name?: string | null;
131
+
132
+ /**
133
+ * Source language for translation
134
+ */
135
+ original_language?: string | null;
136
+
137
+ /**
138
+ * JSON string of section break positions for latest file uploaded for batch
139
+ * translation
140
+ */
141
+ section_breaks?: string | null;
142
+
143
+ /**
144
+ * Target language for translation
145
+ */
146
+ translated_language?: string | null;
147
+
148
+ /**
149
+ * Latest filename of uploaded content for batch translation
150
+ */
151
+ uploaded_filename?: string | null;
152
+
153
+ /**
154
+ * Length of latest file uploaded for batch translation in characters
155
+ */
156
+ uploaded_length?: number | null;
157
+
158
+ /**
159
+ * UUID of latest file uploaded for batch translation
160
+ */
161
+ uploaded_uuid?: string | null;
162
+ }
163
+
164
+ /**
165
+ * Paginated list of projects
166
+ */
167
+ export interface ProjectListResponse {
168
+ /**
169
+ * List of projects
170
+ */
171
+ data: Array<Project>;
172
+
173
+ /**
174
+ * Current page number
175
+ */
176
+ page: number;
177
+
178
+ /**
179
+ * Number of items per page
180
+ */
181
+ page_size: number;
182
+
183
+ /**
184
+ * Total number of projects
185
+ */
186
+ total: number;
187
+
188
+ /**
189
+ * Total number of pages
190
+ */
191
+ total_pages: number;
192
+ }
193
+
194
+ export interface ProjectCreateParams {
195
+ /**
196
+ * Custom translation instructions
197
+ */
198
+ custom_instructions?: string | null;
199
+
200
+ /**
201
+ * Project description
202
+ */
203
+ description?: string | null;
204
+
205
+ /**
206
+ * Project name (defaults to 'My Project')
207
+ */
208
+ name?: string;
209
+
210
+ /**
211
+ * Source language (defaults to 'Korean')
212
+ */
213
+ original_language?: string | null;
214
+
215
+ /**
216
+ * Target language (defaults to 'English')
217
+ */
218
+ translated_language?: string | null;
219
+ }
220
+
221
+ export interface ProjectUpdateParams {
222
+ /**
223
+ * Custom translation instructions
224
+ */
225
+ custom_instructions?: string | null;
226
+
227
+ /**
228
+ * Project description
229
+ */
230
+ description?: string | null;
231
+
232
+ /**
233
+ * Project name
234
+ */
235
+ name?: string;
236
+
237
+ /**
238
+ * Source language
239
+ */
240
+ original_language?: string | null;
241
+
242
+ /**
243
+ * JSON string of section break positions for batch translation
244
+ */
245
+ section_breaks?: string | null;
246
+
247
+ /**
248
+ * Target language
249
+ */
250
+ translated_language?: string | null;
251
+ }
252
+
253
+ export interface ProjectListParams extends PageNumberPaginationParams {
254
+ /**
255
+ * Filter by original language
256
+ */
257
+ original_language?: string;
258
+
259
+ /**
260
+ * Search query for project name
261
+ */
262
+ query?: string;
263
+
264
+ /**
265
+ * Sort direction
266
+ */
267
+ sort_direction?: 'asc' | 'desc';
268
+
269
+ /**
270
+ * Field to sort by
271
+ */
272
+ sort_field?: 'last_updated_at' | 'created_at' | 'name';
273
+
274
+ /**
275
+ * Filter by translated language
276
+ */
277
+ translated_language?: string;
278
+ }
279
+
280
+ export declare namespace Projects {
281
+ export {
282
+ type Project as Project,
283
+ type ProjectListResponse as ProjectListResponse,
284
+ type ProjectsPageNumberPagination as ProjectsPageNumberPagination,
285
+ type ProjectCreateParams as ProjectCreateParams,
286
+ type ProjectUpdateParams as ProjectUpdateParams,
287
+ type ProjectListParams as ProjectListParams,
288
+ };
289
+ }
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0-alpha.2'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.4'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.2";
1
+ export declare const VERSION = "0.1.0-alpha.4";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0-alpha.2";
1
+ export declare const VERSION = "0.1.0-alpha.4";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.0-alpha.2'; // x-release-please-version
4
+ exports.VERSION = '0.1.0-alpha.4'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0-alpha.2'; // x-release-please-version
1
+ export const VERSION = '0.1.0-alpha.4'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map