1 | import type { RawAxiosRequestHeaders } from 'axios';
|
2 | import type { GetSpaceEnvironmentParams, QueryParams, CollectionProp } from '../../common-types';
|
3 | import type { OptionalDefaults } from '../wrappers/wrap';
|
4 | import type { CreateLocaleProps, LocaleProps } from '../../entities/locale';
|
5 | export type LocalePlainClientAPI = {
|
6 | /**
|
7 | * Fetch a single locale by ID
|
8 | * @param params the locale ID and the IDs of the space and environment
|
9 | * @returns the locale
|
10 | * @throws if the space, environment, or locale are not found
|
11 | * @example
|
12 | * ```javascript
|
13 | * const locale = await client.locale.get({
|
14 | * spaceId: '<space_id>',
|
15 | * environmentId: '<environment_id>',
|
16 | * localeId: 'en-US',
|
17 | * });
|
18 | * ```
|
19 | */
|
20 | get(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
21 | localeId: string;
|
22 | }>): Promise<LocaleProps>;
|
23 | /**
|
24 | * Fetch all locales in a space and environment
|
25 | * @param params the space and environment IDs
|
26 | * @returns a collection of locales
|
27 | * @throws if the space or environment are not found
|
28 | * @example
|
29 | * ```javascript
|
30 | * const locales = await client.locale.getMany(
|
31 | * {
|
32 | * spaceId: '<space_id>',
|
33 | * environmentId: '<environment_id>',
|
34 | * query: {
|
35 | * limit: 10,
|
36 | * },
|
37 | * }
|
38 | * );
|
39 | * ```
|
40 | */
|
41 | getMany(params: OptionalDefaults<GetSpaceEnvironmentParams & QueryParams>): Promise<CollectionProp<LocaleProps>>;
|
42 | /**
|
43 | * Delete a locale
|
44 | * @param params the space, environment, and locale IDs
|
45 | * @returns void
|
46 | * @throws if the space, environment, or locale are not found
|
47 | * @example
|
48 | * ```javascript
|
49 | * await client.locale.delete({
|
50 | * spaceId: '<space_id>',
|
51 | * environmentId: '<environment_id>',
|
52 | * localeId: 'en-US',
|
53 | * });
|
54 | * ```
|
55 | */
|
56 | delete(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
57 | localeId: string;
|
58 | }>): Promise<any>;
|
59 | /**
|
60 | * Update a locale
|
61 | * @param params the space, environment, and locale IDs
|
62 | * @param rawData the updated locale data
|
63 | * @returns the updated locale
|
64 | * @throws if the space, environment, or locale are not found
|
65 | * @example
|
66 | * ```javascript
|
67 | * let locale = await client.locale.get({
|
68 | * spaceId: '<space_id>',
|
69 | * environmentId: '<environment_id>',
|
70 | * localeId: 'en-US',
|
71 | * });
|
72 | *
|
73 | * locale = await client.locale.update(
|
74 | * {
|
75 | * spaceId: '<space_id>',
|
76 | * environmentId: '<environment_id>',
|
77 | * localeId: 'en-US',
|
78 | * },
|
79 | * {
|
80 | * ...locale,
|
81 | * name: 'English (US)',
|
82 | * }
|
83 | * );
|
84 | * ```
|
85 | */
|
86 | update(params: OptionalDefaults<GetSpaceEnvironmentParams & {
|
87 | localeId: string;
|
88 | }>, rawData: LocaleProps, headers?: RawAxiosRequestHeaders): Promise<LocaleProps>;
|
89 | /**
|
90 | * Create a locale
|
91 | * @param params the space and environment ID to create the locale in
|
92 | * @param data the locale data
|
93 | * @returns the created locale
|
94 | * @throws if the space or environment are not found or the payload is malformed
|
95 | * @example
|
96 | * ```javascript
|
97 | * const locale = await client.locale.create(
|
98 | * {
|
99 | * spaceId: '<space_id>',
|
100 | * environmentId: '<environment_id>',
|
101 | * },
|
102 | * {
|
103 | * name: 'German (Austria)',
|
104 | * code: 'de-AT',
|
105 | * fallbackCode: 'de-DE',
|
106 | * optional: true,
|
107 | * }
|
108 | * );
|
109 | * ```
|
110 | */
|
111 | create(params: OptionalDefaults<GetSpaceEnvironmentParams>, data: CreateLocaleProps, headers?: RawAxiosRequestHeaders): Promise<LocaleProps>;
|
112 | };
|