@safeurl/sdk 1.0.0
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/CHANGELOG.md +20 -0
- package/CLAUDE.md +111 -0
- package/README.md +15 -0
- package/bun.lock +140 -0
- package/index.ts +1 -0
- package/package.json +29 -0
- package/src/client/client/client.gen.ts +290 -0
- package/src/client/client/index.ts +25 -0
- package/src/client/client/types.gen.ts +214 -0
- package/src/client/client/utils.gen.ts +316 -0
- package/src/client/client.gen.ts +16 -0
- package/src/client/core/auth.gen.ts +41 -0
- package/src/client/core/bodySerializer.gen.ts +82 -0
- package/src/client/core/params.gen.ts +169 -0
- package/src/client/core/pathSerializer.gen.ts +171 -0
- package/src/client/core/queryKeySerializer.gen.ts +117 -0
- package/src/client/core/serverSentEvents.gen.ts +243 -0
- package/src/client/core/types.gen.ts +104 -0
- package/src/client/core/utils.gen.ts +140 -0
- package/src/client/index.ts +4 -0
- package/src/client/sdk.gen.ts +152 -0
- package/src/client/types.gen.ts +323 -0
- package/tests/client.unit.test.ts +118 -0
- package/tests/sdk-smoke.test.ts +239 -0
- package/tsconfig.json +29 -0
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import type { Auth, AuthToken } from './auth.gen';
|
|
4
|
+
import type { BodySerializer, QuerySerializer, QuerySerializerOptions } from './bodySerializer.gen';
|
|
5
|
+
|
|
6
|
+
export type HttpMethod =
|
|
7
|
+
| 'connect'
|
|
8
|
+
| 'delete'
|
|
9
|
+
| 'get'
|
|
10
|
+
| 'head'
|
|
11
|
+
| 'options'
|
|
12
|
+
| 'patch'
|
|
13
|
+
| 'post'
|
|
14
|
+
| 'put'
|
|
15
|
+
| 'trace';
|
|
16
|
+
|
|
17
|
+
export type Client<
|
|
18
|
+
RequestFn = never,
|
|
19
|
+
Config = unknown,
|
|
20
|
+
MethodFn = never,
|
|
21
|
+
BuildUrlFn = never,
|
|
22
|
+
SseFn = never,
|
|
23
|
+
> = {
|
|
24
|
+
/**
|
|
25
|
+
* Returns the final request URL.
|
|
26
|
+
*/
|
|
27
|
+
buildUrl: BuildUrlFn;
|
|
28
|
+
getConfig: () => Config;
|
|
29
|
+
request: RequestFn;
|
|
30
|
+
setConfig: (config: Config) => Config;
|
|
31
|
+
} & {
|
|
32
|
+
[K in HttpMethod]: MethodFn;
|
|
33
|
+
} & ([SseFn] extends [never] ? { sse?: never } : { sse: { [K in HttpMethod]: SseFn } });
|
|
34
|
+
|
|
35
|
+
export interface Config {
|
|
36
|
+
/**
|
|
37
|
+
* Auth token or a function returning auth token. The resolved value will be
|
|
38
|
+
* added to the request payload as defined by its `security` array.
|
|
39
|
+
*/
|
|
40
|
+
auth?: ((auth: Auth) => Promise<AuthToken> | AuthToken) | AuthToken;
|
|
41
|
+
/**
|
|
42
|
+
* A function for serializing request body parameter. By default,
|
|
43
|
+
* {@link JSON.stringify()} will be used.
|
|
44
|
+
*/
|
|
45
|
+
bodySerializer?: BodySerializer | null;
|
|
46
|
+
/**
|
|
47
|
+
* An object containing any HTTP headers that you want to pre-populate your
|
|
48
|
+
* `Headers` object with.
|
|
49
|
+
*
|
|
50
|
+
* {@link https://developer.mozilla.org/docs/Web/API/Headers/Headers#init See more}
|
|
51
|
+
*/
|
|
52
|
+
headers?:
|
|
53
|
+
| RequestInit['headers']
|
|
54
|
+
| Record<
|
|
55
|
+
string,
|
|
56
|
+
string | number | boolean | (string | number | boolean)[] | null | undefined | unknown
|
|
57
|
+
>;
|
|
58
|
+
/**
|
|
59
|
+
* The request method.
|
|
60
|
+
*
|
|
61
|
+
* {@link https://developer.mozilla.org/docs/Web/API/fetch#method See more}
|
|
62
|
+
*/
|
|
63
|
+
method?: Uppercase<HttpMethod>;
|
|
64
|
+
/**
|
|
65
|
+
* A function for serializing request query parameters. By default, arrays
|
|
66
|
+
* will be exploded in form style, objects will be exploded in deepObject
|
|
67
|
+
* style, and reserved characters are percent-encoded.
|
|
68
|
+
*
|
|
69
|
+
* This method will have no effect if the native `paramsSerializer()` Axios
|
|
70
|
+
* API function is used.
|
|
71
|
+
*
|
|
72
|
+
* {@link https://swagger.io/docs/specification/serialization/#query View examples}
|
|
73
|
+
*/
|
|
74
|
+
querySerializer?: QuerySerializer | QuerySerializerOptions;
|
|
75
|
+
/**
|
|
76
|
+
* A function validating request data. This is useful if you want to ensure
|
|
77
|
+
* the request conforms to the desired shape, so it can be safely sent to
|
|
78
|
+
* the server.
|
|
79
|
+
*/
|
|
80
|
+
requestValidator?: (data: unknown) => Promise<unknown>;
|
|
81
|
+
/**
|
|
82
|
+
* A function transforming response data before it's returned. This is useful
|
|
83
|
+
* for post-processing data, e.g. converting ISO strings into Date objects.
|
|
84
|
+
*/
|
|
85
|
+
responseTransformer?: (data: unknown) => Promise<unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* A function validating response data. This is useful if you want to ensure
|
|
88
|
+
* the response conforms to the desired shape, so it can be safely passed to
|
|
89
|
+
* the transformers and returned to the user.
|
|
90
|
+
*/
|
|
91
|
+
responseValidator?: (data: unknown) => Promise<unknown>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type IsExactlyNeverOrNeverUndefined<T> = [T] extends [never]
|
|
95
|
+
? true
|
|
96
|
+
: [T] extends [never | undefined]
|
|
97
|
+
? [undefined] extends [T]
|
|
98
|
+
? false
|
|
99
|
+
: true
|
|
100
|
+
: false;
|
|
101
|
+
|
|
102
|
+
export type OmitNever<T extends Record<string, unknown>> = {
|
|
103
|
+
[K in keyof T as IsExactlyNeverOrNeverUndefined<T[K]> extends true ? never : K]: T[K];
|
|
104
|
+
};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import type { BodySerializer, QuerySerializer } from './bodySerializer.gen';
|
|
4
|
+
import {
|
|
5
|
+
type ArraySeparatorStyle,
|
|
6
|
+
serializeArrayParam,
|
|
7
|
+
serializeObjectParam,
|
|
8
|
+
serializePrimitiveParam,
|
|
9
|
+
} from './pathSerializer.gen';
|
|
10
|
+
|
|
11
|
+
export interface PathSerializer {
|
|
12
|
+
path: Record<string, unknown>;
|
|
13
|
+
url: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
17
|
+
|
|
18
|
+
export const defaultPathSerializer = ({ path, url: _url }: PathSerializer) => {
|
|
19
|
+
let url = _url;
|
|
20
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
21
|
+
if (matches) {
|
|
22
|
+
for (const match of matches) {
|
|
23
|
+
let explode = false;
|
|
24
|
+
let name = match.substring(1, match.length - 1);
|
|
25
|
+
let style: ArraySeparatorStyle = 'simple';
|
|
26
|
+
|
|
27
|
+
if (name.endsWith('*')) {
|
|
28
|
+
explode = true;
|
|
29
|
+
name = name.substring(0, name.length - 1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (name.startsWith('.')) {
|
|
33
|
+
name = name.substring(1);
|
|
34
|
+
style = 'label';
|
|
35
|
+
} else if (name.startsWith(';')) {
|
|
36
|
+
name = name.substring(1);
|
|
37
|
+
style = 'matrix';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const value = path[name];
|
|
41
|
+
|
|
42
|
+
if (value === undefined || value === null) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (Array.isArray(value)) {
|
|
47
|
+
url = url.replace(match, serializeArrayParam({ explode, name, style, value }));
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof value === 'object') {
|
|
52
|
+
url = url.replace(
|
|
53
|
+
match,
|
|
54
|
+
serializeObjectParam({
|
|
55
|
+
explode,
|
|
56
|
+
name,
|
|
57
|
+
style,
|
|
58
|
+
value: value as Record<string, unknown>,
|
|
59
|
+
valueOnly: true,
|
|
60
|
+
}),
|
|
61
|
+
);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (style === 'matrix') {
|
|
66
|
+
url = url.replace(
|
|
67
|
+
match,
|
|
68
|
+
`;${serializePrimitiveParam({
|
|
69
|
+
name,
|
|
70
|
+
value: value as string,
|
|
71
|
+
})}`,
|
|
72
|
+
);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const replaceValue = encodeURIComponent(
|
|
77
|
+
style === 'label' ? `.${value as string}` : (value as string),
|
|
78
|
+
);
|
|
79
|
+
url = url.replace(match, replaceValue);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return url;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export const getUrl = ({
|
|
86
|
+
baseUrl,
|
|
87
|
+
path,
|
|
88
|
+
query,
|
|
89
|
+
querySerializer,
|
|
90
|
+
url: _url,
|
|
91
|
+
}: {
|
|
92
|
+
baseUrl?: string;
|
|
93
|
+
path?: Record<string, unknown>;
|
|
94
|
+
query?: Record<string, unknown>;
|
|
95
|
+
querySerializer: QuerySerializer;
|
|
96
|
+
url: string;
|
|
97
|
+
}) => {
|
|
98
|
+
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
99
|
+
let url = (baseUrl ?? '') + pathUrl;
|
|
100
|
+
if (path) {
|
|
101
|
+
url = defaultPathSerializer({ path, url });
|
|
102
|
+
}
|
|
103
|
+
let search = query ? querySerializer(query) : '';
|
|
104
|
+
if (search.startsWith('?')) {
|
|
105
|
+
search = search.substring(1);
|
|
106
|
+
}
|
|
107
|
+
if (search) {
|
|
108
|
+
url += `?${search}`;
|
|
109
|
+
}
|
|
110
|
+
return url;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
export function getValidRequestBody(options: {
|
|
114
|
+
body?: unknown;
|
|
115
|
+
bodySerializer?: BodySerializer | null;
|
|
116
|
+
serializedBody?: unknown;
|
|
117
|
+
}) {
|
|
118
|
+
const hasBody = options.body !== undefined;
|
|
119
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
120
|
+
|
|
121
|
+
if (isSerializedBody) {
|
|
122
|
+
if ('serializedBody' in options) {
|
|
123
|
+
const hasSerializedBody =
|
|
124
|
+
options.serializedBody !== undefined && options.serializedBody !== '';
|
|
125
|
+
|
|
126
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// not all clients implement a serializedBody property (i.e. client-axios)
|
|
130
|
+
return options.body !== '' ? options.body : null;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// plain/text body
|
|
134
|
+
if (hasBody) {
|
|
135
|
+
return options.body;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// no body was provided
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
export { deleteV1ApiKeysById, getHealth, getV1ApiKeys, getV1Credits, getV1Scans, getV1ScansById, getV1ScansByIdAnalytics, getV1ScansByIdEvents, getV1Settings, type Options, postV1ApiKeys, postV1CreditsPurchase, postV1Scans, postV1ScansBatch, putV1Settings } from './sdk.gen';
|
|
4
|
+
export type { ClientOptions, DeleteV1ApiKeysByIdData, DeleteV1ApiKeysByIdErrors, DeleteV1ApiKeysByIdResponses, GetHealthData, GetV1ApiKeysData, GetV1ApiKeysErrors, GetV1ApiKeysResponses, GetV1CreditsData, GetV1CreditsErrors, GetV1CreditsResponses, GetV1ScansByIdAnalyticsData, GetV1ScansByIdAnalyticsErrors, GetV1ScansByIdAnalyticsResponses, GetV1ScansByIdData, GetV1ScansByIdErrors, GetV1ScansByIdEventsData, GetV1ScansByIdEventsErrors, GetV1ScansByIdEventsResponses, GetV1ScansByIdResponses, GetV1ScansData, GetV1ScansErrors, GetV1ScansResponses, GetV1SettingsData, GetV1SettingsErrors, GetV1SettingsResponses, PostV1ApiKeysData, PostV1ApiKeysErrors, PostV1ApiKeysResponses, PostV1CreditsPurchaseData, PostV1CreditsPurchaseErrors, PostV1CreditsPurchaseResponses, PostV1ScansBatchData, PostV1ScansBatchResponses, PostV1ScansData, PostV1ScansResponses, PutV1SettingsData, PutV1SettingsErrors, PutV1SettingsResponses } from './types.gen';
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import type { Client, Options as Options2, TDataShape } from './client';
|
|
4
|
+
import { client } from './client.gen';
|
|
5
|
+
import type { DeleteV1ApiKeysByIdData, DeleteV1ApiKeysByIdErrors, DeleteV1ApiKeysByIdResponses, GetHealthData, GetV1ApiKeysData, GetV1ApiKeysErrors, GetV1ApiKeysResponses, GetV1CreditsData, GetV1CreditsErrors, GetV1CreditsResponses, GetV1ScansByIdAnalyticsData, GetV1ScansByIdAnalyticsErrors, GetV1ScansByIdAnalyticsResponses, GetV1ScansByIdData, GetV1ScansByIdErrors, GetV1ScansByIdEventsData, GetV1ScansByIdEventsErrors, GetV1ScansByIdEventsResponses, GetV1ScansByIdResponses, GetV1ScansData, GetV1ScansErrors, GetV1ScansResponses, GetV1SettingsData, GetV1SettingsErrors, GetV1SettingsResponses, PostV1ApiKeysData, PostV1ApiKeysErrors, PostV1ApiKeysResponses, PostV1CreditsPurchaseData, PostV1CreditsPurchaseErrors, PostV1CreditsPurchaseResponses, PostV1ScansBatchData, PostV1ScansBatchResponses, PostV1ScansData, PostV1ScansResponses, PutV1SettingsData, PutV1SettingsErrors, PutV1SettingsResponses } from './types.gen';
|
|
6
|
+
|
|
7
|
+
export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean> = Options2<TData, ThrowOnError> & {
|
|
8
|
+
/**
|
|
9
|
+
* You can provide a client instance returned by `createClient()` instead of
|
|
10
|
+
* individual options. This might be also useful if you want to implement a
|
|
11
|
+
* custom client.
|
|
12
|
+
*/
|
|
13
|
+
client?: Client;
|
|
14
|
+
/**
|
|
15
|
+
* You can pass arbitrary values through the `meta` object. This can be
|
|
16
|
+
* used to access values that aren't defined as part of the SDK function.
|
|
17
|
+
*/
|
|
18
|
+
meta?: Record<string, unknown>;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Health Check
|
|
23
|
+
*
|
|
24
|
+
* Returns service health status with dependency checks
|
|
25
|
+
*/
|
|
26
|
+
export const getHealth = <ThrowOnError extends boolean = false>(options?: Options<GetHealthData, ThrowOnError>) => (options?.client ?? client).get<unknown, unknown, ThrowOnError>({ url: '/health', ...options });
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* List API keys
|
|
30
|
+
*
|
|
31
|
+
* Retrieves all API keys for the authenticated user. Plaintext keys are never returned.
|
|
32
|
+
*/
|
|
33
|
+
export const getV1ApiKeys = <ThrowOnError extends boolean = false>(options?: Options<GetV1ApiKeysData, ThrowOnError>) => (options?.client ?? client).get<GetV1ApiKeysResponses, GetV1ApiKeysErrors, ThrowOnError>({ url: '/v1/api-keys/', ...options });
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Create a new API key
|
|
37
|
+
*
|
|
38
|
+
* Creates a new API key for the authenticated user. The plaintext key is only returned once in this response.
|
|
39
|
+
*/
|
|
40
|
+
export const postV1ApiKeys = <ThrowOnError extends boolean = false>(options: Options<PostV1ApiKeysData, ThrowOnError>) => (options.client ?? client).post<PostV1ApiKeysResponses, PostV1ApiKeysErrors, ThrowOnError>({
|
|
41
|
+
url: '/v1/api-keys/',
|
|
42
|
+
...options,
|
|
43
|
+
headers: {
|
|
44
|
+
'Content-Type': 'application/json',
|
|
45
|
+
...options.headers
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Revoke an API key
|
|
51
|
+
*
|
|
52
|
+
* Revokes an API key by setting its revokedAt timestamp. The key will no longer be valid for authentication.
|
|
53
|
+
*/
|
|
54
|
+
export const deleteV1ApiKeysById = <ThrowOnError extends boolean = false>(options: Options<DeleteV1ApiKeysByIdData, ThrowOnError>) => (options.client ?? client).delete<DeleteV1ApiKeysByIdResponses, DeleteV1ApiKeysByIdErrors, ThrowOnError>({ url: '/v1/api-keys/{id}', ...options });
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* List scan jobs
|
|
58
|
+
*
|
|
59
|
+
* Returns the user's scan jobs, most recent first. Optional query batchId to list only jobs from a batch (e.g. from POST /v1/scans/batch).
|
|
60
|
+
*/
|
|
61
|
+
export const getV1Scans = <ThrowOnError extends boolean = false>(options?: Options<GetV1ScansData, ThrowOnError>) => (options?.client ?? client).get<GetV1ScansResponses, GetV1ScansErrors, ThrowOnError>({ url: '/v1/scans/', ...options });
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Create a new URL scan job
|
|
65
|
+
*
|
|
66
|
+
* Creates a new URL scan job and deducts credits from the user's wallet
|
|
67
|
+
*/
|
|
68
|
+
export const postV1Scans = <ThrowOnError extends boolean = false>(options: Options<PostV1ScansData, ThrowOnError>) => (options.client ?? client).post<PostV1ScansResponses, unknown, ThrowOnError>({
|
|
69
|
+
url: '/v1/scans/',
|
|
70
|
+
...options,
|
|
71
|
+
headers: {
|
|
72
|
+
'Content-Type': 'application/json',
|
|
73
|
+
...options.headers
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Create a batch of URL scan jobs
|
|
79
|
+
*
|
|
80
|
+
* Creates multiple scan jobs in one request. Deducts credits for each URL. Max 50 URLs per batch. Returns batchId for listing via GET /v1/scans?batchId=.
|
|
81
|
+
*/
|
|
82
|
+
export const postV1ScansBatch = <ThrowOnError extends boolean = false>(options: Options<PostV1ScansBatchData, ThrowOnError>) => (options.client ?? client).post<PostV1ScansBatchResponses, unknown, ThrowOnError>({
|
|
83
|
+
url: '/v1/scans/batch',
|
|
84
|
+
...options,
|
|
85
|
+
headers: {
|
|
86
|
+
'Content-Type': 'application/json',
|
|
87
|
+
...options.headers
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Get scan analytics (LLM calls)
|
|
93
|
+
*
|
|
94
|
+
* Returns observability data for a scan job: LLM calls (triage, vision, synthesis) with tokens, cost, latency.
|
|
95
|
+
*/
|
|
96
|
+
export const getV1ScansByIdAnalytics = <ThrowOnError extends boolean = false>(options: Options<GetV1ScansByIdAnalyticsData, ThrowOnError>) => (options.client ?? client).get<GetV1ScansByIdAnalyticsResponses, GetV1ScansByIdAnalyticsErrors, ThrowOnError>({ url: '/v1/scans/{id}/analytics', ...options });
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Stream scan state changes via SSE
|
|
100
|
+
*
|
|
101
|
+
* Opens a Server-Sent Events stream that emits a state event immediately on connect, then on every state transition until a terminal state (COMPLETED, FAILED, TIMED_OUT) is reached.
|
|
102
|
+
*/
|
|
103
|
+
export const getV1ScansByIdEvents = <ThrowOnError extends boolean = false>(options: Options<GetV1ScansByIdEventsData, ThrowOnError>) => (options.client ?? client).get<GetV1ScansByIdEventsResponses, GetV1ScansByIdEventsErrors, ThrowOnError>({ url: '/v1/scans/{id}/events', ...options });
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Get scan result by job ID
|
|
107
|
+
*
|
|
108
|
+
* Retrieves the scan result for a specific job ID. Returns the full result if completed, or status if in progress.
|
|
109
|
+
*/
|
|
110
|
+
export const getV1ScansById = <ThrowOnError extends boolean = false>(options: Options<GetV1ScansByIdData, ThrowOnError>) => (options.client ?? client).get<GetV1ScansByIdResponses, GetV1ScansByIdErrors, ThrowOnError>({ url: '/v1/scans/{id}', ...options });
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Get credit balance
|
|
114
|
+
*
|
|
115
|
+
* Retrieves the current credit balance for the user
|
|
116
|
+
*/
|
|
117
|
+
export const getV1Credits = <ThrowOnError extends boolean = false>(options?: Options<GetV1CreditsData, ThrowOnError>) => (options?.client ?? client).get<GetV1CreditsResponses, GetV1CreditsErrors, ThrowOnError>({ url: '/v1/credits/', ...options });
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Purchase credits
|
|
121
|
+
*
|
|
122
|
+
* Purchase credits using crypto or other payment methods. This is a stub implementation.
|
|
123
|
+
*/
|
|
124
|
+
export const postV1CreditsPurchase = <ThrowOnError extends boolean = false>(options: Options<PostV1CreditsPurchaseData, ThrowOnError>) => (options.client ?? client).post<PostV1CreditsPurchaseResponses, PostV1CreditsPurchaseErrors, ThrowOnError>({
|
|
125
|
+
url: '/v1/credits/purchase',
|
|
126
|
+
...options,
|
|
127
|
+
headers: {
|
|
128
|
+
'Content-Type': 'application/json',
|
|
129
|
+
...options.headers
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Get user settings
|
|
135
|
+
*
|
|
136
|
+
* Retrieves user-defined settings including safe/unsafe domain patterns.
|
|
137
|
+
*/
|
|
138
|
+
export const getV1Settings = <ThrowOnError extends boolean = false>(options?: Options<GetV1SettingsData, ThrowOnError>) => (options?.client ?? client).get<GetV1SettingsResponses, GetV1SettingsErrors, ThrowOnError>({ url: '/v1/settings/', ...options });
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Update user settings
|
|
142
|
+
*
|
|
143
|
+
* Updates user-defined settings like domain glob patterns for short-circuiting.
|
|
144
|
+
*/
|
|
145
|
+
export const putV1Settings = <ThrowOnError extends boolean = false>(options: Options<PutV1SettingsData, ThrowOnError>) => (options.client ?? client).put<PutV1SettingsResponses, PutV1SettingsErrors, ThrowOnError>({
|
|
146
|
+
url: '/v1/settings/',
|
|
147
|
+
...options,
|
|
148
|
+
headers: {
|
|
149
|
+
'Content-Type': 'application/json',
|
|
150
|
+
...options.headers
|
|
151
|
+
}
|
|
152
|
+
});
|