@labeleer/api 1.0.0 → 1.0.1
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/bin/import-spec.ts +18 -0
- package/openapi-ts.config.ts +35 -0
- package/openapi.yaml +2181 -0
- package/package.json +5 -7
- package/pnpm-workspace.yaml +3 -0
- package/prettier.config.ts +13 -0
- package/src/generated/client/client.gen.ts +300 -0
- package/{dist/client/index.d.ts → src/generated/client/index.ts} +19 -2
- package/src/generated/client/types.gen.ts +238 -0
- package/src/generated/client/utils.gen.ts +337 -0
- package/{dist/client.gen.d.ts → src/generated/client.gen.ts} +17 -3
- package/src/generated/core/auth.gen.ts +49 -0
- package/src/generated/core/bodySerializer.gen.ts +96 -0
- package/src/generated/core/params.gen.ts +188 -0
- package/src/generated/core/pathSerializer.gen.ts +186 -0
- package/src/generated/core/queryKeySerializer.gen.ts +134 -0
- package/src/generated/core/serverSentEvents.gen.ts +265 -0
- package/src/generated/core/types.gen.ts +126 -0
- package/src/generated/core/utils.gen.ts +146 -0
- package/{dist/generated/index.js → src/generated/index.ts} +1 -0
- package/src/generated/sdk.gen.ts +890 -0
- package/src/generated/types/index.ts +1611 -0
- package/src/generated/zod.gen.ts +733 -0
- package/src/wrapper.ts +73 -0
- package/tsconfig.json +25 -0
- package/dist/client/client.gen.d.ts +0 -2
- package/dist/client/client.gen.js +0 -217
- package/dist/client/index.js +0 -6
- package/dist/client/types.gen.d.ts +0 -120
- package/dist/client/types.gen.js +0 -2
- package/dist/client/utils.gen.d.ts +0 -37
- package/dist/client/utils.gen.js +0 -231
- package/dist/client.gen.js +0 -3
- package/dist/core/auth.gen.d.ts +0 -25
- package/dist/core/auth.gen.js +0 -14
- package/dist/core/bodySerializer.gen.d.ts +0 -25
- package/dist/core/bodySerializer.gen.js +0 -57
- package/dist/core/params.gen.d.ts +0 -43
- package/dist/core/params.gen.js +0 -112
- package/dist/core/pathSerializer.gen.d.ts +0 -33
- package/dist/core/pathSerializer.gen.js +0 -114
- package/dist/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/core/queryKeySerializer.gen.js +0 -99
- package/dist/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/core/serverSentEvents.gen.js +0 -136
- package/dist/core/types.gen.d.ts +0 -83
- package/dist/core/types.gen.js +0 -2
- package/dist/core/utils.gen.d.ts +0 -19
- package/dist/core/utils.gen.js +0 -87
- package/dist/generated/client/client.gen.d.ts +0 -2
- package/dist/generated/client/client.gen.js +0 -217
- package/dist/generated/client/index.d.ts +0 -10
- package/dist/generated/client/index.js +0 -6
- package/dist/generated/client/types.gen.d.ts +0 -120
- package/dist/generated/client/types.gen.js +0 -2
- package/dist/generated/client/utils.gen.d.ts +0 -37
- package/dist/generated/client/utils.gen.js +0 -231
- package/dist/generated/client.gen.d.ts +0 -12
- package/dist/generated/client.gen.js +0 -3
- package/dist/generated/core/auth.gen.d.ts +0 -25
- package/dist/generated/core/auth.gen.js +0 -14
- package/dist/generated/core/bodySerializer.gen.d.ts +0 -25
- package/dist/generated/core/bodySerializer.gen.js +0 -57
- package/dist/generated/core/params.gen.d.ts +0 -43
- package/dist/generated/core/params.gen.js +0 -112
- package/dist/generated/core/pathSerializer.gen.d.ts +0 -33
- package/dist/generated/core/pathSerializer.gen.js +0 -114
- package/dist/generated/core/queryKeySerializer.gen.d.ts +0 -18
- package/dist/generated/core/queryKeySerializer.gen.js +0 -99
- package/dist/generated/core/serverSentEvents.gen.d.ts +0 -71
- package/dist/generated/core/serverSentEvents.gen.js +0 -136
- package/dist/generated/core/types.gen.d.ts +0 -83
- package/dist/generated/core/types.gen.js +0 -2
- package/dist/generated/core/utils.gen.d.ts +0 -19
- package/dist/generated/core/utils.gen.js +0 -87
- package/dist/generated/index.d.ts +0 -2
- package/dist/generated/sdk.gen.d.ts +0 -42
- package/dist/generated/sdk.gen.js +0 -190
- package/dist/generated/types/index.d.ts +0 -1366
- package/dist/generated/types/index.js +0 -181
- package/dist/generated/zod.gen.d.ts +0 -3149
- package/dist/generated/zod.gen.js +0 -621
- package/dist/index.js +0 -2
- package/dist/sdk.gen.d.ts +0 -42
- package/dist/sdk.gen.js +0 -190
- package/dist/types/index.d.ts +0 -1366
- package/dist/types/index.js +0 -181
- package/dist/wrapper.d.ts +0 -51
- package/dist/wrapper.js +0 -49
- package/dist/zod.gen.d.ts +0 -3149
- package/dist/zod.gen.js +0 -621
- /package/{dist/index.d.ts → src/index.ts} +0 -0
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
export function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
3
|
-
let lastEventId;
|
|
4
|
-
const sleep = sseSleepFn ??
|
|
5
|
-
((ms) => new Promise(resolve => setTimeout(resolve, ms)));
|
|
6
|
-
const createStream = async function* () {
|
|
7
|
-
let retryDelay = sseDefaultRetryDelay ?? 3000;
|
|
8
|
-
let attempt = 0;
|
|
9
|
-
const signal = options.signal ?? new AbortController().signal;
|
|
10
|
-
while (true) {
|
|
11
|
-
if (signal.aborted)
|
|
12
|
-
break;
|
|
13
|
-
attempt++;
|
|
14
|
-
const headers = options.headers instanceof Headers
|
|
15
|
-
? options.headers
|
|
16
|
-
: new Headers(options.headers);
|
|
17
|
-
if (lastEventId !== undefined) {
|
|
18
|
-
headers.set('Last-Event-ID', lastEventId);
|
|
19
|
-
}
|
|
20
|
-
try {
|
|
21
|
-
const requestInit = {
|
|
22
|
-
redirect: 'follow',
|
|
23
|
-
...options,
|
|
24
|
-
body: options.serializedBody,
|
|
25
|
-
headers,
|
|
26
|
-
signal,
|
|
27
|
-
};
|
|
28
|
-
let request = new Request(url, requestInit);
|
|
29
|
-
if (onRequest) {
|
|
30
|
-
request = await onRequest(url, requestInit);
|
|
31
|
-
}
|
|
32
|
-
// fetch must be assigned here, otherwise it would throw the error:
|
|
33
|
-
// TypeError: Failed to execute 'fetch' on 'Window': Illegal invocation
|
|
34
|
-
const _fetch = options.fetch ?? globalThis.fetch;
|
|
35
|
-
const response = await _fetch(request);
|
|
36
|
-
if (!response.ok)
|
|
37
|
-
throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
38
|
-
if (!response.body)
|
|
39
|
-
throw new Error('No body in SSE response');
|
|
40
|
-
const reader = response.body
|
|
41
|
-
.pipeThrough(new TextDecoderStream())
|
|
42
|
-
.getReader();
|
|
43
|
-
let buffer = '';
|
|
44
|
-
const abortHandler = () => {
|
|
45
|
-
try {
|
|
46
|
-
reader.cancel();
|
|
47
|
-
}
|
|
48
|
-
catch {
|
|
49
|
-
// noop
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
signal.addEventListener('abort', abortHandler);
|
|
53
|
-
try {
|
|
54
|
-
while (true) {
|
|
55
|
-
const { done, value } = await reader.read();
|
|
56
|
-
if (done)
|
|
57
|
-
break;
|
|
58
|
-
buffer += value;
|
|
59
|
-
buffer = buffer.replace(/\r\n?/g, '\n'); // normalize line endings
|
|
60
|
-
const chunks = buffer.split('\n\n');
|
|
61
|
-
buffer = chunks.pop() ?? '';
|
|
62
|
-
for (const chunk of chunks) {
|
|
63
|
-
const lines = chunk.split('\n');
|
|
64
|
-
const dataLines = [];
|
|
65
|
-
let eventName;
|
|
66
|
-
for (const line of lines) {
|
|
67
|
-
if (line.startsWith('data:')) {
|
|
68
|
-
dataLines.push(line.replace(/^data:\s*/, ''));
|
|
69
|
-
}
|
|
70
|
-
else if (line.startsWith('event:')) {
|
|
71
|
-
eventName = line.replace(/^event:\s*/, '');
|
|
72
|
-
}
|
|
73
|
-
else if (line.startsWith('id:')) {
|
|
74
|
-
lastEventId = line.replace(/^id:\s*/, '');
|
|
75
|
-
}
|
|
76
|
-
else if (line.startsWith('retry:')) {
|
|
77
|
-
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ''), 10);
|
|
78
|
-
if (!Number.isNaN(parsed)) {
|
|
79
|
-
retryDelay = parsed;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
let data;
|
|
84
|
-
let parsedJson = false;
|
|
85
|
-
if (dataLines.length) {
|
|
86
|
-
const rawData = dataLines.join('\n');
|
|
87
|
-
try {
|
|
88
|
-
data = JSON.parse(rawData);
|
|
89
|
-
parsedJson = true;
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
data = rawData;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
if (parsedJson) {
|
|
96
|
-
if (responseValidator) {
|
|
97
|
-
await responseValidator(data);
|
|
98
|
-
}
|
|
99
|
-
if (responseTransformer) {
|
|
100
|
-
data = await responseTransformer(data);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
onSseEvent?.({
|
|
104
|
-
data,
|
|
105
|
-
event: eventName,
|
|
106
|
-
id: lastEventId,
|
|
107
|
-
retry: retryDelay,
|
|
108
|
-
});
|
|
109
|
-
if (dataLines.length) {
|
|
110
|
-
yield data;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
finally {
|
|
116
|
-
signal.removeEventListener('abort', abortHandler);
|
|
117
|
-
reader.releaseLock();
|
|
118
|
-
}
|
|
119
|
-
break; // exit loop on normal completion
|
|
120
|
-
}
|
|
121
|
-
catch (error) {
|
|
122
|
-
// connection failed or aborted; retry after delay
|
|
123
|
-
onSseError?.(error);
|
|
124
|
-
if (sseMaxRetryAttempts !== undefined &&
|
|
125
|
-
attempt >= sseMaxRetryAttempts) {
|
|
126
|
-
break; // stop after firing error
|
|
127
|
-
}
|
|
128
|
-
// exponential backoff: double retry each attempt, cap at 30s
|
|
129
|
-
const backoff = Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 30000);
|
|
130
|
-
await sleep(backoff);
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
const stream = createStream();
|
|
135
|
-
return { stream };
|
|
136
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import type { Auth, AuthToken } from './auth.gen.js';
|
|
2
|
-
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen.js';
|
|
3
|
-
export type HttpMethod = 'connect' | 'delete' | 'get' | 'head' | 'options' | 'patch' | 'post' | 'put' | 'trace';
|
|
4
|
-
export type Client<RequestFn = never, Config = unknown, MethodFn = never, BuildUrlFn = never, SseFn = never> = {
|
|
5
|
-
/**
|
|
6
|
-
* Returns the final request URL.
|
|
7
|
-
*/
|
|
8
|
-
buildUrl: BuildUrlFn;
|
|
9
|
-
getConfig: () => Config;
|
|
10
|
-
request: RequestFn;
|
|
11
|
-
setConfig: (config: Config) => Config;
|
|
12
|
-
} & {
|
|
13
|
-
[K in HttpMethod]: MethodFn;
|
|
14
|
-
} & ([SseFn] extends [never] ? {
|
|
15
|
-
sse?: never;
|
|
16
|
-
} : {
|
|
17
|
-
sse: {
|
|
18
|
-
[K in HttpMethod]: SseFn;
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
export interface Config {
|
|
22
|
-
/**
|
|
23
|
-
* Auth token or a function returning auth token. The resolved value will be
|
|
24
|
-
* added to the request payload as defined by its `security` array.
|
|
25
|
-
*/
|
|
26
|
-
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
27
|
-
/**
|
|
28
|
-
* A function for serializing request body parameter. By default,
|
|
29
|
-
* {@link JSON.stringify()} will be used.
|
|
30
|
-
*/
|
|
31
|
-
bodySerializer?: BodySerializer | null;
|
|
32
|
-
/**
|
|
33
|
-
* An object containing any HTTP headers that you want to pre-populate your
|
|
34
|
-
* `Headers` object with.
|
|
35
|
-
*
|
|
36
|
-
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
37
|
-
*/
|
|
38
|
-
headers?: RequestInit['headers'] | Record<string, string | number | boolean | (string | number | boolean)[] | null | undefined | unknown>;
|
|
39
|
-
/**
|
|
40
|
-
* The request method.
|
|
41
|
-
*
|
|
42
|
-
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
43
|
-
*/
|
|
44
|
-
method?: Uppercase<HttpMethod>;
|
|
45
|
-
/**
|
|
46
|
-
* A function for serializing request query parameters. By default, arrays
|
|
47
|
-
* will be exploded in form style, objects will be exploded in deepObject
|
|
48
|
-
* style, and reserved characters are percent-encoded.
|
|
49
|
-
*
|
|
50
|
-
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
51
|
-
* API function is used.
|
|
52
|
-
*
|
|
53
|
-
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
54
|
-
*/
|
|
55
|
-
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
56
|
-
/**
|
|
57
|
-
* A function validating request data. This is useful if you want to ensure
|
|
58
|
-
* the request conforms to the desired shape, so it can be safely sent to
|
|
59
|
-
* the server.
|
|
60
|
-
*/
|
|
61
|
-
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
62
|
-
/**
|
|
63
|
-
* A function transforming response data before it's returned. This is useful
|
|
64
|
-
* for post-processing data, e.g., converting ISO strings into Date objects.
|
|
65
|
-
*/
|
|
66
|
-
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
67
|
-
/**
|
|
68
|
-
* A function validating response data. This is useful if you want to ensure
|
|
69
|
-
* the response conforms to the desired shape, so it can be safely passed to
|
|
70
|
-
* the transformers and returned to the user.
|
|
71
|
-
*/
|
|
72
|
-
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Arbitrary metadata passed through the `meta` request option.
|
|
76
|
-
*/
|
|
77
|
-
export interface ClientMeta {
|
|
78
|
-
}
|
|
79
|
-
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never] ? true : [T] extends [never | undefined] ? [undefined] extends [T] ? false : true : false;
|
|
80
|
-
export type OmitNever<T extends Record<string, unknown>> = {
|
|
81
|
-
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
|
|
82
|
-
};
|
|
83
|
-
export {};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.js';
|
|
2
|
-
export interface PathSerializer {
|
|
3
|
-
path: Record<string, unknown>;
|
|
4
|
-
url: string;
|
|
5
|
-
}
|
|
6
|
-
export declare const PATH_PARAM_RE: RegExp;
|
|
7
|
-
export declare const defaultPathSerializer: ({ path, url: _url, }: PathSerializer) => string;
|
|
8
|
-
export declare const getUrl: ({ baseUrl, path, query, querySerializer, url: _url, }: {
|
|
9
|
-
baseUrl?: string;
|
|
10
|
-
path?: Record<string, unknown>;
|
|
11
|
-
query?: Record<string, unknown>;
|
|
12
|
-
querySerializer: QuerySerializer;
|
|
13
|
-
url: string;
|
|
14
|
-
}) => string;
|
|
15
|
-
export declare function getValidRequestBody(options: {
|
|
16
|
-
body?: unknown;
|
|
17
|
-
bodySerializer?: BodySerializer | null;
|
|
18
|
-
serializedBody?: unknown;
|
|
19
|
-
}): unknown;
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
import { serializeArrayParam, serializeObjectParam, serializePrimitiveParam, } from './pathSerializer.gen.js';
|
|
3
|
-
export const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
4
|
-
export const defaultPathSerializer = ({ path, url: _url, }) => {
|
|
5
|
-
let url = _url;
|
|
6
|
-
const matches = _url.match(PATH_PARAM_RE);
|
|
7
|
-
if (matches) {
|
|
8
|
-
for (const match of matches) {
|
|
9
|
-
let explode = false;
|
|
10
|
-
let name = match.substring(1, match.length - 1);
|
|
11
|
-
let style = 'simple';
|
|
12
|
-
if (name.endsWith('*')) {
|
|
13
|
-
explode = true;
|
|
14
|
-
name = name.substring(0, name.length - 1);
|
|
15
|
-
}
|
|
16
|
-
if (name.startsWith('.')) {
|
|
17
|
-
name = name.substring(1);
|
|
18
|
-
style = 'label';
|
|
19
|
-
}
|
|
20
|
-
else if (name.startsWith(';')) {
|
|
21
|
-
name = name.substring(1);
|
|
22
|
-
style = 'matrix';
|
|
23
|
-
}
|
|
24
|
-
const value = path[name];
|
|
25
|
-
if (value === undefined || value === null) {
|
|
26
|
-
continue;
|
|
27
|
-
}
|
|
28
|
-
if (Array.isArray(value)) {
|
|
29
|
-
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (typeof value === 'object') {
|
|
33
|
-
url = url.replace(match, serializeObjectParam({
|
|
34
|
-
explode,
|
|
35
|
-
name,
|
|
36
|
-
style,
|
|
37
|
-
value: value,
|
|
38
|
-
valueOnly: true,
|
|
39
|
-
}));
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
if (style === 'matrix') {
|
|
43
|
-
url = url.replace(match, `;${serializePrimitiveParam({
|
|
44
|
-
name,
|
|
45
|
-
value: value,
|
|
46
|
-
})}`);
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const replaceValue = encodeURIComponent(style === 'label' ? `.${value}` : value);
|
|
50
|
-
url = url.replace(match, replaceValue);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
return url;
|
|
54
|
-
};
|
|
55
|
-
export const getUrl = ({ baseUrl, path, query, querySerializer, url: _url, }) => {
|
|
56
|
-
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
57
|
-
let url = (baseUrl ?? '') + pathUrl;
|
|
58
|
-
if (path) {
|
|
59
|
-
url = defaultPathSerializer({ path, url });
|
|
60
|
-
}
|
|
61
|
-
let search = query ? querySerializer(query) : '';
|
|
62
|
-
if (search.startsWith('?')) {
|
|
63
|
-
search = search.substring(1);
|
|
64
|
-
}
|
|
65
|
-
if (search) {
|
|
66
|
-
url += `?${search}`;
|
|
67
|
-
}
|
|
68
|
-
return url;
|
|
69
|
-
};
|
|
70
|
-
export function getValidRequestBody(options) {
|
|
71
|
-
const hasBody = options.body !== undefined;
|
|
72
|
-
const isSerializedBody = hasBody && options.bodySerializer;
|
|
73
|
-
if (isSerializedBody) {
|
|
74
|
-
if ('serializedBody' in options) {
|
|
75
|
-
const hasSerializedBody = options.serializedBody !== undefined && options.serializedBody !== '';
|
|
76
|
-
return hasSerializedBody ? options.serializedBody : null;
|
|
77
|
-
}
|
|
78
|
-
// not all clients implement a serializedBody property (i.e., client-axios)
|
|
79
|
-
return options.body !== '' ? options.body : null;
|
|
80
|
-
}
|
|
81
|
-
// plain/text body
|
|
82
|
-
if (hasBody) {
|
|
83
|
-
return options.body;
|
|
84
|
-
}
|
|
85
|
-
// no body was provided
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Client, ClientMeta, Options as Options2, RequestResult, ServerSentEventsResult, TDataShape } from './client/index.js';
|
|
2
|
-
import type { AddLocaleData, AddLocaleErrors, AddLocaleResponses, CreateAccessTokenData, CreateAccessTokenErrors, CreateAccessTokenResponses, CreateProjectData, CreateProjectErrors, CreateProjectResponses, DeleteLocaleData, DeleteLocaleErrors, DeleteLocaleResponses, DeleteProjectData, DeleteProjectErrors, DeleteProjectResponses, DeleteTranslationData, DeleteTranslationErrors, DeleteTranslationResponses, DeleteTranslationsData, DeleteTranslationsErrors, DeleteTranslationsResponses, ExportTranslationsData, ExportTranslationsErrors, ExportTranslationsResponses, GenerateTranslationsData, GenerateTranslationsResponse, GenerateTranslationsResponses, GetInvitationsData, GetInvitationsErrors, GetInvitationsResponses, GetLocalesData, GetLocalesErrors, GetLocalesResponses, GetProjectsData, GetProjectsErrors, GetProjectsResponses, GetTranslationData, GetTranslationErrors, GetTranslationResponses, GetTranslationsData, GetTranslationsErrors, GetTranslationsResponses, GetTranslationTagsData, GetTranslationTagsErrors, GetTranslationTagsResponses, GetUserProjectPermissionsData, GetUserProjectPermissionsErrors, GetUserProjectPermissionsResponses, InviteUserToProjectData, InviteUserToProjectErrors, InviteUserToProjectResponses, RemoveUserFromProjectData, RemoveUserFromProjectErrors, RemoveUserFromProjectResponses, RenameTranslationKeyData, RenameTranslationKeyErrors, RenameTranslationKeyResponses, RespondToInvitationData, RespondToInvitationErrors, RespondToInvitationResponses, RevokeAccessTokenData, RevokeAccessTokenErrors, RevokeAccessTokenResponses, UpdateAccessTokenData, UpdateAccessTokenErrors, UpdateAccessTokenResponses, UpdateProjectData, UpdateProjectErrors, UpdateProjectResponses, UpdateReferenceLocaleData, UpdateReferenceLocaleErrors, UpdateReferenceLocaleResponses, UpdateTranslationsData, UpdateTranslationsErrors, UpdateTranslationsResponses, UpdateTranslationTagsData, UpdateTranslationTagsErrors, UpdateTranslationTagsResponses, UpdateUserPermissionsData, UpdateUserPermissionsErrors, UpdateUserPermissionsResponses } from './types/index.js';
|
|
3
|
-
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
|
|
4
|
-
/**
|
|
5
|
-
* You can provide a client instance returned by `createClient()` instead of
|
|
6
|
-
* individual options. This might be also useful if you want to implement a
|
|
7
|
-
* custom client.
|
|
8
|
-
*/
|
|
9
|
-
client?: Client;
|
|
10
|
-
/**
|
|
11
|
-
* You can pass arbitrary values through the `meta` object. This can be
|
|
12
|
-
* used to access values that aren't defined as part of the SDK function.
|
|
13
|
-
*/
|
|
14
|
-
meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
|
|
15
|
-
};
|
|
16
|
-
export declare const getInvitations: <ThrowOnError extends boolean = false>(options?: Options<GetInvitationsData, ThrowOnError>) => RequestResult<GetInvitationsResponses, GetInvitationsErrors, ThrowOnError>;
|
|
17
|
-
export declare const respondToInvitation: <ThrowOnError extends boolean = false>(options: Options<RespondToInvitationData, ThrowOnError>) => RequestResult<RespondToInvitationResponses, RespondToInvitationErrors, ThrowOnError>;
|
|
18
|
-
export declare const revokeAccessToken: <ThrowOnError extends boolean = false>(options: Options<RevokeAccessTokenData, ThrowOnError>) => RequestResult<RevokeAccessTokenResponses, RevokeAccessTokenErrors, ThrowOnError>;
|
|
19
|
-
export declare const updateAccessToken: <ThrowOnError extends boolean = false>(options: Options<UpdateAccessTokenData, ThrowOnError>) => RequestResult<UpdateAccessTokenResponses, UpdateAccessTokenErrors, ThrowOnError>;
|
|
20
|
-
export declare const createAccessToken: <ThrowOnError extends boolean = false>(options: Options<CreateAccessTokenData, ThrowOnError>) => RequestResult<CreateAccessTokenResponses, CreateAccessTokenErrors, ThrowOnError>;
|
|
21
|
-
export declare const inviteUserToProject: <ThrowOnError extends boolean = false>(options: Options<InviteUserToProjectData, ThrowOnError>) => RequestResult<InviteUserToProjectResponses, InviteUserToProjectErrors, ThrowOnError>;
|
|
22
|
-
export declare const deleteProject: <ThrowOnError extends boolean = false>(options: Options<DeleteProjectData, ThrowOnError>) => RequestResult<DeleteProjectResponses, DeleteProjectErrors, ThrowOnError>;
|
|
23
|
-
export declare const updateProject: <ThrowOnError extends boolean = false>(options: Options<UpdateProjectData, ThrowOnError>) => RequestResult<UpdateProjectResponses, UpdateProjectErrors, ThrowOnError>;
|
|
24
|
-
export declare const removeUserFromProject: <ThrowOnError extends boolean = false>(options: Options<RemoveUserFromProjectData, ThrowOnError>) => RequestResult<RemoveUserFromProjectResponses, RemoveUserFromProjectErrors, ThrowOnError>;
|
|
25
|
-
export declare const getUserProjectPermissions: <ThrowOnError extends boolean = false>(options: Options<GetUserProjectPermissionsData, ThrowOnError>) => RequestResult<GetUserProjectPermissionsResponses, GetUserProjectPermissionsErrors, ThrowOnError>;
|
|
26
|
-
export declare const updateUserPermissions: <ThrowOnError extends boolean = false>(options: Options<UpdateUserPermissionsData, ThrowOnError>) => RequestResult<UpdateUserPermissionsResponses, UpdateUserPermissionsErrors, ThrowOnError>;
|
|
27
|
-
export declare const getProjects: <ThrowOnError extends boolean = false>(options?: Options<GetProjectsData, ThrowOnError>) => RequestResult<GetProjectsResponses, GetProjectsErrors, ThrowOnError>;
|
|
28
|
-
export declare const createProject: <ThrowOnError extends boolean = false>(options: Options<CreateProjectData, ThrowOnError>) => RequestResult<CreateProjectResponses, CreateProjectErrors, ThrowOnError>;
|
|
29
|
-
export declare const generateTranslations: <ThrowOnError extends boolean = false>(options: Options<GenerateTranslationsData, ThrowOnError, GenerateTranslationsResponse>) => Promise<ServerSentEventsResult<GenerateTranslationsResponses>>;
|
|
30
|
-
export declare const deleteTranslation: <ThrowOnError extends boolean = false>(options: Options<DeleteTranslationData, ThrowOnError>) => RequestResult<DeleteTranslationResponses, DeleteTranslationErrors, ThrowOnError>;
|
|
31
|
-
export declare const getTranslation: <ThrowOnError extends boolean = false>(options: Options<GetTranslationData, ThrowOnError>) => RequestResult<GetTranslationResponses, GetTranslationErrors, ThrowOnError>;
|
|
32
|
-
export declare const renameTranslationKey: <ThrowOnError extends boolean = false>(options: Options<RenameTranslationKeyData, ThrowOnError>) => RequestResult<RenameTranslationKeyResponses, RenameTranslationKeyErrors, ThrowOnError>;
|
|
33
|
-
export declare const getTranslationTags: <ThrowOnError extends boolean = false>(options: Options<GetTranslationTagsData, ThrowOnError>) => RequestResult<GetTranslationTagsResponses, GetTranslationTagsErrors, ThrowOnError>;
|
|
34
|
-
export declare const updateTranslationTags: <ThrowOnError extends boolean = false>(options: Options<UpdateTranslationTagsData, ThrowOnError>) => RequestResult<UpdateTranslationTagsResponses, UpdateTranslationTagsErrors, ThrowOnError>;
|
|
35
|
-
export declare const exportTranslations: <ThrowOnError extends boolean = false>(options: Options<ExportTranslationsData, ThrowOnError>) => RequestResult<ExportTranslationsResponses, ExportTranslationsErrors, ThrowOnError>;
|
|
36
|
-
export declare const deleteLocale: <ThrowOnError extends boolean = false>(options: Options<DeleteLocaleData, ThrowOnError>) => RequestResult<DeleteLocaleResponses, DeleteLocaleErrors, ThrowOnError>;
|
|
37
|
-
export declare const getLocales: <ThrowOnError extends boolean = false>(options: Options<GetLocalesData, ThrowOnError>) => RequestResult<GetLocalesResponses, GetLocalesErrors, ThrowOnError>;
|
|
38
|
-
export declare const addLocale: <ThrowOnError extends boolean = false>(options: Options<AddLocaleData, ThrowOnError>) => RequestResult<AddLocaleResponses, AddLocaleErrors, ThrowOnError>;
|
|
39
|
-
export declare const updateReferenceLocale: <ThrowOnError extends boolean = false>(options: Options<UpdateReferenceLocaleData, ThrowOnError>) => RequestResult<UpdateReferenceLocaleResponses, UpdateReferenceLocaleErrors, ThrowOnError>;
|
|
40
|
-
export declare const deleteTranslations: <ThrowOnError extends boolean = false>(options: Options<DeleteTranslationsData, ThrowOnError>) => RequestResult<DeleteTranslationsResponses, DeleteTranslationsErrors, ThrowOnError>;
|
|
41
|
-
export declare const getTranslations: <ThrowOnError extends boolean = false>(options: Options<GetTranslationsData, ThrowOnError>) => RequestResult<GetTranslationsResponses, GetTranslationsErrors, ThrowOnError>;
|
|
42
|
-
export declare const updateTranslations: <ThrowOnError extends boolean = false>(options: Options<UpdateTranslationsData, ThrowOnError>) => RequestResult<UpdateTranslationsResponses, UpdateTranslationsErrors, ThrowOnError>;
|
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
-
import { client } from './client.gen.js';
|
|
3
|
-
import { zAddLocaleResponse, zCreateAccessTokenResponse2, zCreateProjectResponse2, zDeleteLocaleResponse, zDeleteProjectResponse, zDeleteTranslationResponse, zDeleteTranslationsResponse, zExportTranslationsResponse, zGenerateTranslationsResponse, zGetInvitationsResponse2, zGetLocalesResponse, zGetProjectsResponse2, zGetTranslationResponse, zGetTranslationsResponse2, zGetTranslationTagsResponse2, zGetUserProjectPermissionsResponse, zInviteUserToProjectResponse, zRemoveUserFromProjectResponse, zRenameTranslationKeyResponse, zRespondToInvitationResponse, zRevokeAccessTokenResponse, zUpdateAccessTokenResponse2, zUpdateProjectResponse2, zUpdateReferenceLocaleResponse, zUpdateTranslationsResponse, zUpdateTranslationTagsResponse2, zUpdateUserPermissionsResponse, } from './zod.gen.js';
|
|
4
|
-
export const getInvitations = (options) => (options?.client ?? client).get({
|
|
5
|
-
responseValidator: async (data) => await zGetInvitationsResponse2.parseAsync(data),
|
|
6
|
-
url: '/api/invitations',
|
|
7
|
-
...options,
|
|
8
|
-
});
|
|
9
|
-
export const respondToInvitation = (options) => (options.client ?? client).post({
|
|
10
|
-
responseValidator: async (data) => await zRespondToInvitationResponse.parseAsync(data),
|
|
11
|
-
url: '/api/invitations',
|
|
12
|
-
...options,
|
|
13
|
-
headers: {
|
|
14
|
-
'Content-Type': 'application/json',
|
|
15
|
-
...options.headers,
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
export const revokeAccessToken = (options) => (options.client ?? client).delete({
|
|
19
|
-
responseValidator: async (data) => await zRevokeAccessTokenResponse.parseAsync(data),
|
|
20
|
-
url: '/api/project/{projectId}/access-token',
|
|
21
|
-
...options,
|
|
22
|
-
});
|
|
23
|
-
export const updateAccessToken = (options) => (options.client ?? client).patch({
|
|
24
|
-
responseValidator: async (data) => await zUpdateAccessTokenResponse2.parseAsync(data),
|
|
25
|
-
url: '/api/project/{projectId}/access-token',
|
|
26
|
-
...options,
|
|
27
|
-
headers: {
|
|
28
|
-
'Content-Type': 'application/json',
|
|
29
|
-
...options.headers,
|
|
30
|
-
},
|
|
31
|
-
});
|
|
32
|
-
export const createAccessToken = (options) => (options.client ?? client).post({
|
|
33
|
-
responseValidator: async (data) => await zCreateAccessTokenResponse2.parseAsync(data),
|
|
34
|
-
url: '/api/project/{projectId}/access-token',
|
|
35
|
-
...options,
|
|
36
|
-
headers: {
|
|
37
|
-
'Content-Type': 'application/json',
|
|
38
|
-
...options.headers,
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
export const inviteUserToProject = (options) => (options.client ?? client).post({
|
|
42
|
-
responseValidator: async (data) => await zInviteUserToProjectResponse.parseAsync(data),
|
|
43
|
-
url: '/api/project/{projectId}/invite',
|
|
44
|
-
...options,
|
|
45
|
-
headers: {
|
|
46
|
-
'Content-Type': 'application/json',
|
|
47
|
-
...options.headers,
|
|
48
|
-
},
|
|
49
|
-
});
|
|
50
|
-
export const deleteProject = (options) => (options.client ?? client).delete({
|
|
51
|
-
responseValidator: async (data) => await zDeleteProjectResponse.parseAsync(data),
|
|
52
|
-
url: '/api/project/{projectId}',
|
|
53
|
-
...options,
|
|
54
|
-
});
|
|
55
|
-
export const updateProject = (options) => (options.client ?? client).put({
|
|
56
|
-
responseValidator: async (data) => await zUpdateProjectResponse2.parseAsync(data),
|
|
57
|
-
url: '/api/project/{projectId}',
|
|
58
|
-
...options,
|
|
59
|
-
headers: {
|
|
60
|
-
'Content-Type': 'application/json',
|
|
61
|
-
...options.headers,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
export const removeUserFromProject = (options) => (options.client ?? client).delete({
|
|
65
|
-
responseValidator: async (data) => await zRemoveUserFromProjectResponse.parseAsync(data),
|
|
66
|
-
url: '/api/project/{projectId}/users/{userId}',
|
|
67
|
-
...options,
|
|
68
|
-
});
|
|
69
|
-
export const getUserProjectPermissions = (options) => (options.client ?? client).get({
|
|
70
|
-
responseValidator: async (data) => await zGetUserProjectPermissionsResponse.parseAsync(data),
|
|
71
|
-
url: '/api/project/{projectId}/users/{userId}',
|
|
72
|
-
...options,
|
|
73
|
-
});
|
|
74
|
-
export const updateUserPermissions = (options) => (options.client ?? client).put({
|
|
75
|
-
responseValidator: async (data) => await zUpdateUserPermissionsResponse.parseAsync(data),
|
|
76
|
-
url: '/api/project/{projectId}/users/{userId}',
|
|
77
|
-
...options,
|
|
78
|
-
headers: {
|
|
79
|
-
'Content-Type': 'application/json',
|
|
80
|
-
...options.headers,
|
|
81
|
-
},
|
|
82
|
-
});
|
|
83
|
-
export const getProjects = (options) => (options?.client ?? client).get({
|
|
84
|
-
responseValidator: async (data) => await zGetProjectsResponse2.parseAsync(data),
|
|
85
|
-
url: '/api/project',
|
|
86
|
-
...options,
|
|
87
|
-
});
|
|
88
|
-
export const createProject = (options) => (options.client ?? client).post({
|
|
89
|
-
responseValidator: async (data) => await zCreateProjectResponse2.parseAsync(data),
|
|
90
|
-
url: '/api/project',
|
|
91
|
-
...options,
|
|
92
|
-
headers: {
|
|
93
|
-
'Content-Type': 'application/json',
|
|
94
|
-
...options.headers,
|
|
95
|
-
},
|
|
96
|
-
});
|
|
97
|
-
export const generateTranslations = (options) => (options.client ?? client).sse.post({
|
|
98
|
-
responseValidator: async (data) => await zGenerateTranslationsResponse.parseAsync(data),
|
|
99
|
-
url: '/api/translation/generate',
|
|
100
|
-
...options,
|
|
101
|
-
});
|
|
102
|
-
export const deleteTranslation = (options) => (options.client ?? client).delete({
|
|
103
|
-
responseValidator: async (data) => await zDeleteTranslationResponse.parseAsync(data),
|
|
104
|
-
url: '/api/translation',
|
|
105
|
-
...options,
|
|
106
|
-
});
|
|
107
|
-
export const getTranslation = (options) => (options.client ?? client).get({
|
|
108
|
-
responseValidator: async (data) => await zGetTranslationResponse.parseAsync(data),
|
|
109
|
-
url: '/api/translation',
|
|
110
|
-
...options,
|
|
111
|
-
});
|
|
112
|
-
export const renameTranslationKey = (options) => (options.client ?? client).put({
|
|
113
|
-
responseValidator: async (data) => await zRenameTranslationKeyResponse.parseAsync(data),
|
|
114
|
-
url: '/api/translation',
|
|
115
|
-
...options,
|
|
116
|
-
headers: {
|
|
117
|
-
'Content-Type': 'application/json',
|
|
118
|
-
...options.headers,
|
|
119
|
-
},
|
|
120
|
-
});
|
|
121
|
-
export const getTranslationTags = (options) => (options.client ?? client).get({
|
|
122
|
-
responseValidator: async (data) => await zGetTranslationTagsResponse2.parseAsync(data),
|
|
123
|
-
url: '/api/translation/tags',
|
|
124
|
-
...options,
|
|
125
|
-
});
|
|
126
|
-
export const updateTranslationTags = (options) => (options.client ?? client).patch({
|
|
127
|
-
responseValidator: async (data) => await zUpdateTranslationTagsResponse2.parseAsync(data),
|
|
128
|
-
url: '/api/translation/tags',
|
|
129
|
-
...options,
|
|
130
|
-
headers: {
|
|
131
|
-
'Content-Type': 'application/json',
|
|
132
|
-
...options.headers,
|
|
133
|
-
},
|
|
134
|
-
});
|
|
135
|
-
export const exportTranslations = (options) => (options.client ?? client).get({
|
|
136
|
-
responseValidator: async (data) => await zExportTranslationsResponse.parseAsync(data),
|
|
137
|
-
url: '/api/translations/export',
|
|
138
|
-
...options,
|
|
139
|
-
});
|
|
140
|
-
export const deleteLocale = (options) => (options.client ?? client).delete({
|
|
141
|
-
responseValidator: async (data) => await zDeleteLocaleResponse.parseAsync(data),
|
|
142
|
-
url: '/api/translations/locales',
|
|
143
|
-
...options,
|
|
144
|
-
});
|
|
145
|
-
export const getLocales = (options) => (options.client ?? client).get({
|
|
146
|
-
responseValidator: async (data) => await zGetLocalesResponse.parseAsync(data),
|
|
147
|
-
url: '/api/translations/locales',
|
|
148
|
-
...options,
|
|
149
|
-
});
|
|
150
|
-
export const addLocale = (options) => (options.client ?? client).post({
|
|
151
|
-
responseValidator: async (data) => await zAddLocaleResponse.parseAsync(data),
|
|
152
|
-
url: '/api/translations/locales',
|
|
153
|
-
...options,
|
|
154
|
-
headers: {
|
|
155
|
-
'Content-Type': 'application/json',
|
|
156
|
-
...options.headers,
|
|
157
|
-
},
|
|
158
|
-
});
|
|
159
|
-
export const updateReferenceLocale = (options) => (options.client ?? client).put({
|
|
160
|
-
responseValidator: async (data) => await zUpdateReferenceLocaleResponse.parseAsync(data),
|
|
161
|
-
url: '/api/translations/locales',
|
|
162
|
-
...options,
|
|
163
|
-
headers: {
|
|
164
|
-
'Content-Type': 'application/json',
|
|
165
|
-
...options.headers,
|
|
166
|
-
},
|
|
167
|
-
});
|
|
168
|
-
export const deleteTranslations = (options) => (options.client ?? client).delete({
|
|
169
|
-
responseValidator: async (data) => await zDeleteTranslationsResponse.parseAsync(data),
|
|
170
|
-
url: '/api/translations',
|
|
171
|
-
...options,
|
|
172
|
-
headers: {
|
|
173
|
-
'Content-Type': 'application/json',
|
|
174
|
-
...options.headers,
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
export const getTranslations = (options) => (options.client ?? client).get({
|
|
178
|
-
responseValidator: async (data) => await zGetTranslationsResponse2.parseAsync(data),
|
|
179
|
-
url: '/api/translations',
|
|
180
|
-
...options,
|
|
181
|
-
});
|
|
182
|
-
export const updateTranslations = (options) => (options.client ?? client).post({
|
|
183
|
-
responseValidator: async (data) => await zUpdateTranslationsResponse.parseAsync(data),
|
|
184
|
-
url: '/api/translations',
|
|
185
|
-
...options,
|
|
186
|
-
headers: {
|
|
187
|
-
'Content-Type': 'application/json',
|
|
188
|
-
...options.headers,
|
|
189
|
-
},
|
|
190
|
-
});
|