@transifex/api 4.2.1 → 4.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@transifex/api",
3
- "version": "4.2.1",
3
+ "version": "4.2.2",
4
4
  "description": "Transifex API SDK",
5
5
  "keywords": [
6
6
  "transifex",
@@ -31,7 +31,7 @@
31
31
  "@babel/cli": "^7.17.10",
32
32
  "@babel/core": "^7.17.10",
33
33
  "@babel/preset-env": "^7.17.10",
34
- "@transifex/jsonapi": "^4.2.1",
34
+ "@transifex/jsonapi": "^4.2.2",
35
35
  "babel-eslint": "^10.1.0",
36
36
  "babel-loader": "^8.2.5",
37
37
  "eslint": "^7.32.0",
@@ -45,5 +45,6 @@
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
- }
48
+ },
49
+ "types": "src/transifexApi.d.ts"
49
50
  }
@@ -0,0 +1,120 @@
1
+ interface AnyDict {
2
+ [key: string]: any;
3
+ }
4
+
5
+ interface StringDict {
6
+ [key: string]: string;
7
+ }
8
+
9
+ declare class JsonApiResource {
10
+ constructor({
11
+ id: string,
12
+ attributes: AnyDict,
13
+ relationships: AnyDict,
14
+ links: StringDict,
15
+ });
16
+ get(key: string): any;
17
+ set(key: string, value: any): void;
18
+ async reload(include: string[]): null;
19
+ static async get(arg:string | AnyDict): JsonApiResource;
20
+ async fetch(relationshipName: string, force: boolean): JsonApiResource | Collection;
21
+ async save(arg: AnyDict | string[]): null;
22
+ static async create({
23
+ id: string,
24
+ attributes: AnyDict,
25
+ relationships: AnyDict,
26
+ links: StringDict,
27
+ }): JsonApiResource;
28
+ async delete(): void;
29
+ async change(field: string, value:JsonApiResource | null): void;
30
+ async add(field: string, values: JsonApiResource[]): null;
31
+ async reset(field: string, values: JsonApiResource[]): null;
32
+ async remove(field: string, values: JsonApiResource[]): null;
33
+ static list(): Collection;
34
+ static extra(AnyDict): Collection;
35
+ static filter(filters: AnyDict): Collection;
36
+ static page(arg: AnyDict | string): Collection;
37
+ static include(...args: string[]): Collection;
38
+ static sort(...args: string[]): Collection;
39
+ static fields(...args: string[]): Collection;
40
+ static all(): Iterable<JsonApiResource>;
41
+ static allPages(): Iterable<Collection>;
42
+ }
43
+
44
+ declare class Collection {
45
+ async fetch(): void;
46
+ async getNext(): Collection
47
+ async getPrevious(): Collection
48
+ extra(AnyDict): Collection;
49
+ filter(filters: AnyDict): Collection;
50
+ page(arg: AnyDict | string): Collection;
51
+ include(...args: string[]): Collection;
52
+ sort(...args: string[]): Collection;
53
+ fields(...args: string[]): Collection;
54
+ all(): Iterable<JsonApiResource>;
55
+ allPages(): Iterable<Collection>;
56
+ }
57
+
58
+ type AuthFunction = () => string;
59
+ type AuthArgument = string | AuthFunction;
60
+
61
+ declare export class TransifexApi {
62
+ constructor({ host: string, auth: AuthArgument });
63
+ setup({ host: string, auth: AuthArgument }): void;
64
+
65
+ Organization: typeof JsonApiResource;
66
+ User: typeof JsonApiResource;
67
+ Language: typeof JsonApiResource;
68
+ Project: typeof JsonApiResource;
69
+ ProjectWebhook: typeof JsonApiResource;
70
+ Resource: typeof JsonApiResource;
71
+ ResourceString: typeof JsonApiResource;
72
+ ResourceStringsAsyncDownload: typeof JsonApiResource;
73
+ ResourceStringsAsyncUpload: typeof JsonApiResource;
74
+ ResourceStringComment: typeof JsonApiResource;
75
+ I18nFormat: typeof JsonApiResource;
76
+ ContextScreenshotMap: typeof JsonApiResource;
77
+ ContextScreenshot: typeof JsonApiResource;
78
+ OrganizationActivityReportsAsyncDownload: typeof JsonApiResource;
79
+ ProjectActivityReportsAsyncDownload: typeof JsonApiResource;
80
+ ResourceActivityReportsAsyncDownload: typeof JsonApiResource;
81
+ TeamActivityReportsAsyncDownload: typeof JsonApiResource;
82
+ ResourceLanguageStats: typeof JsonApiResource;
83
+ ResourceTranslation: typeof JsonApiResource;
84
+ ResourceTranslationsAsyncDownload: typeof JsonApiResource;
85
+ ResourceTranslationsAsyncUpload: typeof JsonApiResource;
86
+ TeamMembership: typeof JsonApiResource;
87
+ Team: typeof JsonApiResource;
88
+ TmxAsyncDownload: typeof JsonApiResource;
89
+ TmxAsyncUpload: typeof JsonApiResource;
90
+ ResourceStringsRevision: typeof JsonApiResource;
91
+
92
+ organizations: typeof JsonApiResource;
93
+ users: typeof JsonApiResource;
94
+ languages: typeof JsonApiResource;
95
+ projects: typeof JsonApiResource;
96
+ project_webhooks: typeof JsonApiResource;
97
+ resources: typeof JsonApiResource;
98
+ resource_strings: typeof JsonApiResource;
99
+ resource_strings_async_downloads: typeof JsonApiResource;
100
+ resource_strings_async_uploads: typeof JsonApiResource;
101
+ resource_string_comments: typeof JsonApiResource;
102
+ i18n_formats: typeof JsonApiResource;
103
+ context_screenshot_maps: typeof JsonApiResource;
104
+ context_screenshots: typeof JsonApiResource;
105
+ organization_activity_reports_async_downloads: typeof JsonApiResource;
106
+ project_activity_reports_async_downloads: typeof JsonApiResource;
107
+ resource_activity_reports_async_downloads: typeof JsonApiResource;
108
+ team_activity_reports_async_downloads: typeof JsonApiResource;
109
+ resource_language_stats: typeof JsonApiResource;
110
+ resource_translations: typeof JsonApiResource;
111
+ resource_translations_async_downloads: typeof JsonApiResource;
112
+ resource_translations_async_uploads: typeof JsonApiResource;
113
+ team_memberships: typeof JsonApiResource;
114
+ teams: typeof JsonApiResource;
115
+ tmx_async_downloads: typeof JsonApiResource;
116
+ tmx_async_uploads: typeof JsonApiResource;
117
+ resource_strings_revisions: typeof JsonApiResource;
118
+ }
119
+
120
+ declare export var transifexApi: TransifexApi;