@labeleer/api 1.0.2 → 1.0.3

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.
@@ -1,34 +1,174 @@
1
1
  export type ClientOptions = {
2
2
  baseUrl: `${string}://${string}` | (string & {});
3
3
  };
4
+ export type Booleanish = boolean;
5
+ export type Collaborator = {
6
+ id: string;
7
+ name: string;
8
+ email: string;
9
+ /**
10
+ * Thumbnail URL of the user
11
+ */
12
+ thumbnail_url?: string;
13
+ role: Role;
14
+ };
15
+ export type Comment = {
16
+ id: string;
17
+ key_id: string;
18
+ project_id: string;
19
+ created_on: Timestamp;
20
+ edited_on?: Timestamp;
21
+ user: {
22
+ id: string;
23
+ name: string;
24
+ email: string;
25
+ thumbnail_url?: string;
26
+ };
27
+ content: string;
28
+ };
29
+ export type CreateAccessTokenRequestBody = {
30
+ permissions: ProjectPermissions;
31
+ };
32
+ export type CreateAccessTokenResponse = {
33
+ key: string;
34
+ details: ProjectApiKeyDetails;
35
+ };
36
+ export type CreateCommentRequestBody = {
37
+ projectId: string;
38
+ keyId: string;
39
+ comment: string;
40
+ commentId: string;
41
+ };
42
+ export type CreateLocaleRequestBody = {
43
+ projectId: string;
44
+ locale: Locale;
45
+ };
46
+ export type CreateLocaleResponse = {
47
+ data: Array<LanguageItem>;
48
+ };
49
+ export type CreateProjectRequestBody = {
50
+ name: string;
51
+ description?: string;
52
+ locales?: Array<Locale>;
53
+ };
54
+ export type CreateProjectResponse = {
55
+ data: Project;
56
+ };
57
+ export type DeleteCommentRequestQuery = {
58
+ commentId: string;
59
+ projectId: string;
60
+ };
61
+ export type DeleteLocaleRequestBody = {
62
+ projectId: string;
63
+ locale: Locale;
64
+ };
65
+ export type DeleteTranslationRequestQuery = {
66
+ projectId: string;
67
+ keyId: string;
68
+ };
69
+ export type DeleteTranslationsRequestBody = {
70
+ projectId: string;
71
+ keys: Array<string>;
72
+ };
4
73
  export type ErrorResponse = {
5
74
  error: string;
6
75
  details?: string;
7
76
  };
8
- export type SuccessResponse = {
9
- success: boolean;
77
+ export type ExtendedTranslationItem = {
78
+ key: string;
79
+ key_id: string;
80
+ translations: {
81
+ [key in Locale]?: string;
82
+ };
83
+ plurals: {
84
+ [key in Locale]?: {
85
+ [key in Plurality]?: string;
86
+ };
87
+ };
88
+ comment_count: number;
89
+ description?: string | null;
90
+ tags: TranslationTags;
91
+ created_at: Timestamp;
92
+ updated_at?: Timestamp;
93
+ created_by?: {
94
+ id: string;
95
+ name: string;
96
+ email: string;
97
+ thumbnail?: string;
98
+ };
10
99
  };
11
- export declare const enum PermissionCategory {
12
- TRANSLATIONS = "translations",
13
- LANGUAGES = "languages",
14
- COLLABORATORS = "collaborators",
15
- PROJECT = "project"
16
- }
17
- export declare const enum PermissionRole {
18
- VIEWER = "viewer",
19
- EDITOR = "editor"
20
- }
21
- export type ProjectPermissions = {
22
- [key in PermissionCategory]?: PermissionRole;
100
+ export type GenerateTranslationsRequestQuery = {
101
+ project_id: string;
102
+ key: string;
103
+ from_locale: Locale;
104
+ to_locale: Locale;
105
+ };
106
+ export type GetCommentsRequestQuery = {
107
+ projectId: string;
108
+ keyId: string;
109
+ };
110
+ export type GetCommentsResponse = {
111
+ data: Array<Comment>;
112
+ };
113
+ export type GetInvitationsResponse = {
114
+ data: Array<Invitation>;
115
+ };
116
+ export type GetLocaleResponse = {
117
+ data: Array<LanguageItem>;
118
+ };
119
+ export type GetLocalesRequestQuery = {
120
+ projectId: string;
121
+ };
122
+ export type GetProjectsResponse = {
123
+ data: Array<Project>;
124
+ };
125
+ export type GetTranslationDataResponse = {
126
+ data: ExtendedTranslationItem;
127
+ };
128
+ export type GetTranslationRequestQuery = {
129
+ projectId: string;
130
+ keyId: string;
131
+ };
132
+ export type GetTranslationsResponse = {
133
+ data: Array<TranslationItem>;
134
+ pagination: Pagination;
135
+ };
136
+ export type GetTranslationTagsRequestQuery = {
137
+ projectId: string;
138
+ keyId: string;
139
+ };
140
+ export type GetTranslationTagsResponse = {
141
+ data: TranslationTags;
142
+ };
143
+ export type GetUserPermissionsResponse = {
144
+ data: ProjectPermissions;
145
+ };
146
+ export type Invitation = {
147
+ id: string;
148
+ role: Role;
149
+ invited_on: Timestamp;
150
+ project: InvitationProject;
151
+ invited_by: InvitedBy;
152
+ };
153
+ export type InvitationProject = {
154
+ id: string;
155
+ name: string;
156
+ description?: string;
157
+ };
158
+ export type InvitedBy = {
159
+ user_id: string;
160
+ name: string;
161
+ thumbnail_url?: string;
162
+ email: string;
163
+ };
164
+ export type InviteUserRequestBody = {
165
+ email: string;
166
+ };
167
+ export type LanguageItem = {
168
+ id: string;
169
+ locale: Locale;
170
+ is_reference: boolean;
23
171
  };
24
- export declare const enum Role {
25
- OWNER = "owner",
26
- COLLABORATOR = "collaborator"
27
- }
28
- export declare const enum ProjectFeature {
29
- AUTO_TRANSLATE = "auto-translate",
30
- SUGGESTIONS = "suggestions"
31
- }
32
172
  export declare const enum Locale {
33
173
  AF_ZA = "af_ZA",
34
174
  AM_ET = "am_ET",
@@ -177,7 +317,34 @@ export declare const enum Locale {
177
317
  YI_DE = "yi_DE",
178
318
  TR_TR = "tr_TR"
179
319
  }
180
- export type Timestamp = string;
320
+ export type Pagination = {
321
+ /**
322
+ * Page offset
323
+ */
324
+ offset: number;
325
+ /**
326
+ * Amount of entries contained within this page
327
+ */
328
+ count: number;
329
+ /**
330
+ * Total amount of items in all pages
331
+ */
332
+ total_count: number;
333
+ /**
334
+ * Whether this is the last page in pagination
335
+ */
336
+ has_next: boolean;
337
+ };
338
+ export declare const enum PermissionCategory {
339
+ TRANSLATIONS = "translations",
340
+ LANGUAGES = "languages",
341
+ COLLABORATORS = "collaborators",
342
+ PROJECT = "project"
343
+ }
344
+ export declare const enum PermissionRole {
345
+ VIEWER = "viewer",
346
+ EDITOR = "editor"
347
+ }
181
348
  export declare const enum Plurality {
182
349
  ZERO = "zero",
183
350
  ONE = "one",
@@ -186,24 +353,6 @@ export declare const enum Plurality {
186
353
  MANY = "many",
187
354
  OTHER = "other"
188
355
  }
189
- export type Pagination = {
190
- offset: number;
191
- count: number;
192
- totalCount: number;
193
- };
194
- export type User = {
195
- id: string;
196
- name: string;
197
- email: string;
198
- thumbnail_url?: string;
199
- };
200
- export type Collaborator = {
201
- id: string;
202
- name: string;
203
- email: string;
204
- thumbnail_url?: string;
205
- role: Role;
206
- };
207
356
  export type Project = {
208
357
  id: string;
209
358
  description?: string;
@@ -215,28 +364,36 @@ export type Project = {
215
364
  created_by: Collaborator;
216
365
  users: Array<Collaborator>;
217
366
  };
218
- export type InvitationProject = {
367
+ export type ProjectApiKeyDetails = {
219
368
  id: string;
220
- name: string;
221
- description?: string;
369
+ name?: string;
370
+ start: string;
371
+ enabled: boolean;
372
+ permissions: ProjectPermissions;
373
+ created_on: Timestamp;
374
+ last_request?: Timestamp;
375
+ request_count: number;
376
+ expires_on?: Timestamp;
222
377
  };
223
- export type InvitedBy = {
224
- user_id: string;
225
- name: string;
226
- thumbnail_url?: string;
227
- email: string;
378
+ export declare const enum ProjectFeature {
379
+ AUTO_TRANSLATE = "auto-translate",
380
+ SUGGESTIONS = "suggestions"
381
+ }
382
+ export type ProjectPermissions = {
383
+ [key in PermissionCategory]?: PermissionRole;
228
384
  };
229
- export type Invitation = {
230
- id: string;
231
- role: Role;
232
- invited_on: Timestamp;
233
- project: InvitationProject;
234
- invited_by: InvitedBy;
385
+ export declare const enum Role {
386
+ OWNER = "owner",
387
+ COLLABORATOR = "collaborator"
388
+ }
389
+ export type SuccessResponse = {
390
+ success: boolean;
235
391
  };
236
- export type TranslationTags = Array<string>;
237
- export type TranslationItem = {
392
+ export type Timestamp = string;
393
+ export type TranslationExportItem = {
238
394
  key: string;
239
- key_id: string;
395
+ tags: TranslationTags;
396
+ description?: string;
240
397
  translations: {
241
398
  [key in Locale]?: string;
242
399
  };
@@ -245,11 +402,8 @@ export type TranslationItem = {
245
402
  [key in Plurality]?: string;
246
403
  };
247
404
  };
248
- comment_count: number;
249
- description?: string;
250
- tags: TranslationTags;
251
405
  };
252
- export type ExtendedTranslationItem = {
406
+ export type TranslationItem = {
253
407
  key: string;
254
408
  key_id: string;
255
409
  translations: {
@@ -261,114 +415,8 @@ export type ExtendedTranslationItem = {
261
415
  };
262
416
  };
263
417
  comment_count: number;
264
- description?: string;
418
+ description?: string | null;
265
419
  tags: TranslationTags;
266
- created_at: Timestamp;
267
- updated_at?: Timestamp;
268
- created_by?: {
269
- id: string;
270
- name: string;
271
- email: string;
272
- thumbnail?: string;
273
- };
274
- };
275
- export type TranslationExportItem = {
276
- key: string;
277
- tags: TranslationTags;
278
- description?: string;
279
- translations: {
280
- [key in Locale]?: string;
281
- };
282
- plurals: {
283
- [key in Locale]?: {
284
- [key in Plurality]?: string;
285
- };
286
- };
287
- };
288
- export type LanguageItem = {
289
- id: string;
290
- locale: Locale;
291
- is_reference: boolean;
292
- };
293
- export type Comment = {
294
- id: string;
295
- key_id: string;
296
- project_id: string;
297
- created_on: Timestamp;
298
- edited_on?: Timestamp;
299
- user: {
300
- id: string;
301
- name: string;
302
- email: string;
303
- thumbnail_url?: string;
304
- };
305
- content: string;
306
- };
307
- export type ProjectApiKeyDetails = {
308
- id: string;
309
- name?: string;
310
- start: string;
311
- enabled: boolean;
312
- permissions: ProjectPermissions;
313
- created_on: Timestamp;
314
- last_request?: Timestamp;
315
- request_count: number;
316
- expires_on?: Timestamp;
317
- };
318
- export type Booleanish = boolean;
319
- export type GetInvitationsResponse = {
320
- data: Array<Invitation>;
321
- };
322
- export type CreateAccessTokenResponse = {
323
- key: string;
324
- details: ProjectApiKeyDetails;
325
- };
326
- export type UpdateAccessTokenResponse = {
327
- details: ProjectApiKeyDetails;
328
- };
329
- export type UpdateProjectResponse = {
330
- name: string;
331
- description?: string;
332
- };
333
- export type GetUserPermissionsResponse = {
334
- data: ProjectPermissions;
335
- };
336
- export type UpdateUserPermissionsRequestBody = {
337
- permissions: {
338
- translations?: 'viewer' | 'editor';
339
- languages?: 'viewer' | 'editor';
340
- collaborators?: 'viewer' | 'editor';
341
- project?: 'viewer' | 'editor';
342
- };
343
- };
344
- export type CreateProjectRequest = {
345
- name: string;
346
- description?: string;
347
- locales?: Array<Locale>;
348
- };
349
- export type CreateProjectResponse = {
350
- data: Project;
351
- };
352
- export type GetProjectsResponse = {
353
- data: Array<Project>;
354
- };
355
- export type GetTranslationDataResponse = {
356
- data: ExtendedTranslationItem;
357
- };
358
- export type GetTranslationTagsRequest = {
359
- projectId: string;
360
- keyId: string;
361
- };
362
- export type GetTranslationTagsResponse = {
363
- data: TranslationTags;
364
- };
365
- export type UpdateTranslationTagsRequestBody = {
366
- projectId: string;
367
- keyId: string;
368
- tags: Array<string>;
369
- };
370
- export type UpdateTranslationTagsResponse = {
371
- data: TranslationTags;
372
420
  };
373
421
  export type TranslationsExportRequestQuery = {
374
422
  projectId: string;
@@ -378,23 +426,29 @@ export type TranslationsExportRequestQuery = {
378
426
  include_untranslated?: Booleanish;
379
427
  include_description?: Booleanish;
380
428
  };
381
- export type GetLocaleResponse = {
382
- data: Array<LanguageItem>;
429
+ export type TranslationTags = Array<string>;
430
+ export type UpdateAccessTokenPermissionsRequestBody = {
431
+ permissions: ProjectPermissions;
383
432
  };
384
- export type CreateLocaleRequestBody = {
385
- projectId: string;
386
- locale: Locale;
433
+ export type UpdateAccessTokenPermissionsResponse = {
434
+ details: ProjectApiKeyDetails;
387
435
  };
388
- export type CreateLocaleResponse = {
389
- data: Array<LanguageItem>;
436
+ export type UpdateInvitationStatusRequestBody = {
437
+ invitationId: string;
438
+ status: 'accepted' | 'declined';
439
+ };
440
+ export type UpdateProjectResponse = {
441
+ name: string;
442
+ description?: string;
390
443
  };
391
444
  export type UpdateReferenceLocaleRequestBody = {
392
445
  projectId: string;
393
446
  locale: Locale;
394
447
  };
395
- export type GetTranslationsResponse = {
396
- data: Array<TranslationItem>;
397
- pagination: Pagination;
448
+ export type UpdateTranslationRequestBody = {
449
+ projectId: string;
450
+ keyId: string;
451
+ newKeyName: string;
398
452
  };
399
453
  export type UpdateTranslationsRequestBody = {
400
454
  projectId: string;
@@ -413,9 +467,25 @@ export type UpdateTranslationsRequestBody = {
413
467
  };
414
468
  };
415
469
  };
416
- export type DeleteTranslationsRequestBody = {
470
+ export type UpdateTranslationTagsRequestBody = {
417
471
  projectId: string;
418
- keys: Array<string>;
472
+ keyId: string;
473
+ tags: Array<string>;
474
+ };
475
+ export type UpdateTranslationTagsResponse = {
476
+ data: TranslationTags;
477
+ };
478
+ export type UpdateUserPermissionsRequestBody = {
479
+ permissions: ProjectPermissions;
480
+ };
481
+ export type User = {
482
+ id: string;
483
+ name: string;
484
+ email: string;
485
+ /**
486
+ * Thumbnail URL of the user
487
+ */
488
+ thumbnail_url?: string;
419
489
  };
420
490
  export type GetInvitationsData = {
421
491
  body?: never;
@@ -442,10 +512,7 @@ export type GetInvitationsResponses = {
442
512
  };
443
513
  export type GetInvitationsResponse2 = GetInvitationsResponses[keyof GetInvitationsResponses];
444
514
  export type RespondToInvitationData = {
445
- body: {
446
- invitationId: string;
447
- status: 'accepted' | 'declined';
448
- };
515
+ body: UpdateInvitationStatusRequestBody;
449
516
  path?: never;
450
517
  query?: never;
451
518
  url: '/api/invitations';
@@ -511,14 +578,7 @@ export type RevokeAccessTokenResponses = {
511
578
  };
512
579
  export type RevokeAccessTokenResponse = RevokeAccessTokenResponses[keyof RevokeAccessTokenResponses];
513
580
  export type UpdateAccessTokenData = {
514
- body: {
515
- permissions: {
516
- translations?: 'viewer' | 'editor';
517
- languages?: 'viewer' | 'editor';
518
- collaborators?: 'viewer' | 'editor';
519
- project?: 'viewer' | 'editor';
520
- };
521
- };
581
+ body: UpdateAccessTokenPermissionsRequestBody;
522
582
  path: {
523
583
  projectId: string;
524
584
  };
@@ -552,18 +612,11 @@ export type UpdateAccessTokenResponses = {
552
612
  /**
553
613
  * Ok
554
614
  */
555
- 200: UpdateAccessTokenResponse;
615
+ 200: UpdateAccessTokenPermissionsResponse;
556
616
  };
557
- export type UpdateAccessTokenResponse2 = UpdateAccessTokenResponses[keyof UpdateAccessTokenResponses];
617
+ export type UpdateAccessTokenResponse = UpdateAccessTokenResponses[keyof UpdateAccessTokenResponses];
558
618
  export type CreateAccessTokenData = {
559
- body: {
560
- permissions: {
561
- translations?: 'viewer' | 'editor';
562
- languages?: 'viewer' | 'editor';
563
- collaborators?: 'viewer' | 'editor';
564
- project?: 'viewer' | 'editor';
565
- };
566
- };
619
+ body: CreateAccessTokenRequestBody;
567
620
  path: {
568
621
  projectId: string;
569
622
  };
@@ -597,9 +650,7 @@ export type CreateAccessTokenResponses = {
597
650
  };
598
651
  export type CreateAccessTokenResponse2 = CreateAccessTokenResponses[keyof CreateAccessTokenResponses];
599
652
  export type InviteUserToProjectData = {
600
- body: {
601
- email: string;
602
- };
653
+ body: InviteUserRequestBody;
603
654
  path: {
604
655
  projectId: string;
605
656
  };
@@ -627,9 +678,9 @@ export type InviteUserToProjectErrors = {
627
678
  export type InviteUserToProjectError = InviteUserToProjectErrors[keyof InviteUserToProjectErrors];
628
679
  export type InviteUserToProjectResponses = {
629
680
  /**
630
- * Resource Created
681
+ * Ok
631
682
  */
632
- 201: SuccessResponse;
683
+ 200: SuccessResponse;
633
684
  };
634
685
  export type InviteUserToProjectResponse = InviteUserToProjectResponses[keyof InviteUserToProjectResponses];
635
686
  export type DeleteProjectData = {
@@ -834,7 +885,7 @@ export type GetProjectsResponses = {
834
885
  };
835
886
  export type GetProjectsResponse2 = GetProjectsResponses[keyof GetProjectsResponses];
836
887
  export type CreateProjectData = {
837
- body: CreateProjectRequest;
888
+ body: CreateProjectRequestBody;
838
889
  path?: never;
839
890
  query?: never;
840
891
  url: '/api/project';
@@ -981,11 +1032,7 @@ export type GetTranslationResponses = {
981
1032
  };
982
1033
  export type GetTranslationResponse = GetTranslationResponses[keyof GetTranslationResponses];
983
1034
  export type RenameTranslationKeyData = {
984
- body: {
985
- projectId: string;
986
- keyId: string;
987
- newKeyName: string;
988
- };
1035
+ body: UpdateTranslationRequestBody;
989
1036
  path?: never;
990
1037
  query?: never;
991
1038
  url: '/api/translation';
@@ -1195,13 +1242,13 @@ export type GetLocalesResponses = {
1195
1242
  200: GetLocaleResponse;
1196
1243
  };
1197
1244
  export type GetLocalesResponse = GetLocalesResponses[keyof GetLocalesResponses];
1198
- export type AddLocaleData = {
1199
- body: CreateLocaleRequestBody;
1245
+ export type UpdateReferenceLocaleData = {
1246
+ body: UpdateReferenceLocaleRequestBody;
1200
1247
  path?: never;
1201
1248
  query?: never;
1202
1249
  url: '/api/translations/locales';
1203
1250
  };
1204
- export type AddLocaleErrors = {
1251
+ export type UpdateReferenceLocaleErrors = {
1205
1252
  /**
1206
1253
  * Bad Request
1207
1254
  */
@@ -1219,21 +1266,21 @@ export type AddLocaleErrors = {
1219
1266
  */
1220
1267
  500: ErrorResponse;
1221
1268
  };
1222
- export type AddLocaleError = AddLocaleErrors[keyof AddLocaleErrors];
1223
- export type AddLocaleResponses = {
1269
+ export type UpdateReferenceLocaleError = UpdateReferenceLocaleErrors[keyof UpdateReferenceLocaleErrors];
1270
+ export type UpdateReferenceLocaleResponses = {
1224
1271
  /**
1225
- * Resource Created
1272
+ * Ok
1226
1273
  */
1227
- 201: CreateLocaleResponse;
1274
+ 200: SuccessResponse;
1228
1275
  };
1229
- export type AddLocaleResponse = AddLocaleResponses[keyof AddLocaleResponses];
1230
- export type UpdateReferenceLocaleData = {
1231
- body: UpdateReferenceLocaleRequestBody;
1276
+ export type UpdateReferenceLocaleResponse = UpdateReferenceLocaleResponses[keyof UpdateReferenceLocaleResponses];
1277
+ export type AddLocaleData = {
1278
+ body: CreateLocaleRequestBody;
1232
1279
  path?: never;
1233
1280
  query?: never;
1234
1281
  url: '/api/translations/locales';
1235
1282
  };
1236
- export type UpdateReferenceLocaleErrors = {
1283
+ export type AddLocaleErrors = {
1237
1284
  /**
1238
1285
  * Bad Request
1239
1286
  */
@@ -1251,14 +1298,14 @@ export type UpdateReferenceLocaleErrors = {
1251
1298
  */
1252
1299
  500: ErrorResponse;
1253
1300
  };
1254
- export type UpdateReferenceLocaleError = UpdateReferenceLocaleErrors[keyof UpdateReferenceLocaleErrors];
1255
- export type UpdateReferenceLocaleResponses = {
1301
+ export type AddLocaleError = AddLocaleErrors[keyof AddLocaleErrors];
1302
+ export type AddLocaleResponses = {
1256
1303
  /**
1257
- * Ok
1304
+ * Resource Created
1258
1305
  */
1259
- 200: SuccessResponse;
1306
+ 201: CreateLocaleResponse;
1260
1307
  };
1261
- export type UpdateReferenceLocaleResponse = UpdateReferenceLocaleResponses[keyof UpdateReferenceLocaleResponses];
1308
+ export type AddLocaleResponse = AddLocaleResponses[keyof AddLocaleResponses];
1262
1309
  export type DeleteTranslationsData = {
1263
1310
  body: DeleteTranslationsRequestBody;
1264
1311
  path?: never;