|
| 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; |
0 commit comments