@dazl/internal-api-client 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/README.md +77 -0
- package/dist/client/client.gen.d.ts +3 -0
- package/dist/client/client.gen.d.ts.map +1 -0
- package/dist/client/client.gen.js +229 -0
- package/dist/client/client.gen.js.map +1 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +7 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.gen.d.ts +118 -0
- package/dist/client/types.gen.d.ts.map +1 -0
- package/dist/client/types.gen.js +3 -0
- package/dist/client/types.gen.js.map +1 -0
- package/dist/client/utils.gen.d.ts +34 -0
- package/dist/client/utils.gen.d.ts.map +1 -0
- package/dist/client/utils.gen.js +232 -0
- package/dist/client/utils.gen.js.map +1 -0
- package/dist/client.gen.d.ts +13 -0
- package/dist/client.gen.d.ts.map +1 -0
- package/dist/client.gen.js +4 -0
- package/dist/client.gen.js.map +1 -0
- package/dist/core/auth.gen.d.ts +19 -0
- package/dist/core/auth.gen.d.ts.map +1 -0
- package/dist/core/auth.gen.js +15 -0
- package/dist/core/auth.gen.js.map +1 -0
- package/dist/core/bodySerializer.gen.d.ts +26 -0
- package/dist/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/core/bodySerializer.gen.js +58 -0
- package/dist/core/bodySerializer.gen.js.map +1 -0
- package/dist/core/params.gen.d.ts +44 -0
- package/dist/core/params.gen.d.ts.map +1 -0
- package/dist/core/params.gen.js +101 -0
- package/dist/core/params.gen.js.map +1 -0
- package/dist/core/pathSerializer.gen.d.ts +34 -0
- package/dist/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/core/pathSerializer.gen.js +115 -0
- package/dist/core/pathSerializer.gen.js.map +1 -0
- package/dist/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/core/queryKeySerializer.gen.js +100 -0
- package/dist/core/queryKeySerializer.gen.js.map +1 -0
- package/dist/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/core/serverSentEvents.gen.js +136 -0
- package/dist/core/serverSentEvents.gen.js.map +1 -0
- package/dist/core/types.gen.d.ts +79 -0
- package/dist/core/types.gen.d.ts.map +1 -0
- package/dist/core/types.gen.js +3 -0
- package/dist/core/types.gen.js.map +1 -0
- package/dist/core/utils.gen.d.ts +20 -0
- package/dist/core/utils.gen.d.ts.map +1 -0
- package/dist/core/utils.gen.js +88 -0
- package/dist/core/utils.gen.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk.gen.d.ts +28 -0
- package/dist/sdk.gen.d.ts.map +1 -0
- package/dist/sdk.gen.js +77 -0
- package/dist/sdk.gen.js.map +1 -0
- package/dist/types.gen.d.ts +458 -0
- package/dist/types.gen.d.ts.map +1 -0
- package/dist/types.gen.js +3 -0
- package/dist/types.gen.js.map +1 -0
- package/package.json +36 -0
- package/src/client/client.gen.ts +301 -0
- package/src/client/index.ts +25 -0
- package/src/client/types.gen.ts +241 -0
- package/src/client/utils.gen.ts +332 -0
- package/src/client.gen.ts +16 -0
- package/src/core/auth.gen.ts +42 -0
- package/src/core/bodySerializer.gen.ts +100 -0
- package/src/core/params.gen.ts +176 -0
- package/src/core/pathSerializer.gen.ts +181 -0
- package/src/core/queryKeySerializer.gen.ts +136 -0
- package/src/core/serverSentEvents.gen.ts +264 -0
- package/src/core/types.gen.ts +118 -0
- package/src/core/utils.gen.ts +143 -0
- package/src/index.ts +5 -0
- package/src/sdk.gen.ts +103 -0
- package/src/types.gen.ts +510 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import type { BodySerializer, QuerySerializer } from './bodySerializer.gen.ts';
|
|
4
|
+
import {
|
|
5
|
+
type ArraySeparatorStyle,
|
|
6
|
+
serializeArrayParam,
|
|
7
|
+
serializeObjectParam,
|
|
8
|
+
serializePrimitiveParam,
|
|
9
|
+
} from './pathSerializer.gen.ts';
|
|
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(
|
|
48
|
+
match,
|
|
49
|
+
serializeArrayParam({ explode, name, style, value }),
|
|
50
|
+
);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (typeof value === 'object') {
|
|
55
|
+
url = url.replace(
|
|
56
|
+
match,
|
|
57
|
+
serializeObjectParam({
|
|
58
|
+
explode,
|
|
59
|
+
name,
|
|
60
|
+
style,
|
|
61
|
+
value: value as Record<string, unknown>,
|
|
62
|
+
valueOnly: true,
|
|
63
|
+
}),
|
|
64
|
+
);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (style === 'matrix') {
|
|
69
|
+
url = url.replace(
|
|
70
|
+
match,
|
|
71
|
+
`;${serializePrimitiveParam({
|
|
72
|
+
name,
|
|
73
|
+
value: value as string,
|
|
74
|
+
})}`,
|
|
75
|
+
);
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const replaceValue = encodeURIComponent(
|
|
80
|
+
style === 'label' ? `.${value as string}` : (value as string),
|
|
81
|
+
);
|
|
82
|
+
url = url.replace(match, replaceValue);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return url;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const getUrl = ({
|
|
89
|
+
baseUrl,
|
|
90
|
+
path,
|
|
91
|
+
query,
|
|
92
|
+
querySerializer,
|
|
93
|
+
url: _url,
|
|
94
|
+
}: {
|
|
95
|
+
baseUrl?: string;
|
|
96
|
+
path?: Record<string, unknown>;
|
|
97
|
+
query?: Record<string, unknown>;
|
|
98
|
+
querySerializer: QuerySerializer;
|
|
99
|
+
url: string;
|
|
100
|
+
}) => {
|
|
101
|
+
const pathUrl = _url.startsWith('/') ? _url : `/${_url}`;
|
|
102
|
+
let url = (baseUrl ?? '') + pathUrl;
|
|
103
|
+
if (path) {
|
|
104
|
+
url = defaultPathSerializer({ path, url });
|
|
105
|
+
}
|
|
106
|
+
let search = query ? querySerializer(query) : '';
|
|
107
|
+
if (search.startsWith('?')) {
|
|
108
|
+
search = search.substring(1);
|
|
109
|
+
}
|
|
110
|
+
if (search) {
|
|
111
|
+
url += `?${search}`;
|
|
112
|
+
}
|
|
113
|
+
return url;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export function getValidRequestBody(options: {
|
|
117
|
+
body?: unknown;
|
|
118
|
+
bodySerializer?: BodySerializer | null;
|
|
119
|
+
serializedBody?: unknown;
|
|
120
|
+
}) {
|
|
121
|
+
const hasBody = options.body !== undefined;
|
|
122
|
+
const isSerializedBody = hasBody && options.bodySerializer;
|
|
123
|
+
|
|
124
|
+
if (isSerializedBody) {
|
|
125
|
+
if ('serializedBody' in options) {
|
|
126
|
+
const hasSerializedBody =
|
|
127
|
+
options.serializedBody !== undefined && options.serializedBody !== '';
|
|
128
|
+
|
|
129
|
+
return hasSerializedBody ? options.serializedBody : null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// not all clients implement a serializedBody property (i.e. client-axios)
|
|
133
|
+
return options.body !== '' ? options.body : null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// plain/text body
|
|
137
|
+
if (hasBody) {
|
|
138
|
+
return options.body;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// no body was provided
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
package/src/index.ts
ADDED
package/src/sdk.gen.ts
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// This file is auto-generated by @hey-api/openapi-ts
|
|
2
|
+
|
|
3
|
+
import { client } from './client.gen.ts';
|
|
4
|
+
import type { Client, Options as Options2, TDataShape } from './client/index.ts';
|
|
5
|
+
import type { CancelScheduledUpdateByDazlIdData, CancelScheduledUpdateByDazlIdErrors, CancelScheduledUpdateByDazlIdResponses, CreateCustomerPortalSessionData, CreateCustomerPortalSessionErrors, CreateCustomerPortalSessionResponses, CreateCustomerWithDefaultSubscriptionData, CreateCustomerWithDefaultSubscriptionErrors, CreateCustomerWithDefaultSubscriptionResponses, GetAllProductsData, GetAllProductsErrors, GetAllProductsResponses, GetBalanceByDazlIdData, GetBalanceByDazlIdErrors, GetBalanceByDazlIdResponses, GetCustomerInfoByDazlIdData, GetCustomerInfoByDazlIdErrors, GetCustomerInfoByDazlIdResponses, GetHasSufficientCreditsByDazlIdData, GetHasSufficientCreditsByDazlIdErrors, GetHasSufficientCreditsByDazlIdResponses, GetMaxCreditsForDefaultFreeData, GetMaxCreditsForDefaultFreeResponses, GetPriceByPriceIdData, GetPriceByPriceIdErrors, GetPriceByPriceIdResponses, UpdateUserSubscriptionData, UpdateUserSubscriptionErrors, UpdateUserSubscriptionResponses } from './types.gen.ts';
|
|
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
|
+
export class Billing {
|
|
22
|
+
public static getBalanceByDazlId<ThrowOnError extends boolean = false>(options: Options<GetBalanceByDazlIdData, ThrowOnError>) {
|
|
23
|
+
return (options.client ?? client).get<GetBalanceByDazlIdResponses, GetBalanceByDazlIdErrors, ThrowOnError>({
|
|
24
|
+
url: '/billing/balance/{dazlId}',
|
|
25
|
+
...options
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
public static getHasSufficientCreditsByDazlId<ThrowOnError extends boolean = false>(options: Options<GetHasSufficientCreditsByDazlIdData, ThrowOnError>) {
|
|
30
|
+
return (options.client ?? client).get<GetHasSufficientCreditsByDazlIdResponses, GetHasSufficientCreditsByDazlIdErrors, ThrowOnError>({
|
|
31
|
+
url: '/billing/has-sufficient-credits/{dazlId}',
|
|
32
|
+
...options
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public static getAllProducts<ThrowOnError extends boolean = false>(options?: Options<GetAllProductsData, ThrowOnError>) {
|
|
37
|
+
return (options?.client ?? client).get<GetAllProductsResponses, GetAllProductsErrors, ThrowOnError>({
|
|
38
|
+
url: '/billing/prices',
|
|
39
|
+
...options
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
public static getPriceByPriceId<ThrowOnError extends boolean = false>(options: Options<GetPriceByPriceIdData, ThrowOnError>) {
|
|
44
|
+
return (options.client ?? client).get<GetPriceByPriceIdResponses, GetPriceByPriceIdErrors, ThrowOnError>({
|
|
45
|
+
url: '/billing/price/{priceId}',
|
|
46
|
+
...options
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static getMaxCreditsForDefaultFree<ThrowOnError extends boolean = false>(options?: Options<GetMaxCreditsForDefaultFreeData, ThrowOnError>) {
|
|
51
|
+
return (options?.client ?? client).get<GetMaxCreditsForDefaultFreeResponses, unknown, ThrowOnError>({
|
|
52
|
+
url: '/billing/max-credits-for-default-free',
|
|
53
|
+
...options
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
public static getCustomerInfoByDazlId<ThrowOnError extends boolean = false>(options: Options<GetCustomerInfoByDazlIdData, ThrowOnError>) {
|
|
58
|
+
return (options.client ?? client).get<GetCustomerInfoByDazlIdResponses, GetCustomerInfoByDazlIdErrors, ThrowOnError>({
|
|
59
|
+
url: '/billing/customer-info/{dazlId}',
|
|
60
|
+
...options
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public static updateUserSubscription<ThrowOnError extends boolean = false>(options: Options<UpdateUserSubscriptionData, ThrowOnError>) {
|
|
65
|
+
return (options.client ?? client).post<UpdateUserSubscriptionResponses, UpdateUserSubscriptionErrors, ThrowOnError>({
|
|
66
|
+
url: '/billing/update-subscription',
|
|
67
|
+
...options,
|
|
68
|
+
headers: {
|
|
69
|
+
'Content-Type': 'application/json',
|
|
70
|
+
...options.headers
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public static cancelScheduledUpdateByDazlId<ThrowOnError extends boolean = false>(options: Options<CancelScheduledUpdateByDazlIdData, ThrowOnError>) {
|
|
76
|
+
return (options.client ?? client).post<CancelScheduledUpdateByDazlIdResponses, CancelScheduledUpdateByDazlIdErrors, ThrowOnError>({
|
|
77
|
+
url: '/billing/cancel-scheduled-update/{dazlId}',
|
|
78
|
+
...options
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
public static createCustomerPortalSession<ThrowOnError extends boolean = false>(options: Options<CreateCustomerPortalSessionData, ThrowOnError>) {
|
|
83
|
+
return (options.client ?? client).post<CreateCustomerPortalSessionResponses, CreateCustomerPortalSessionErrors, ThrowOnError>({
|
|
84
|
+
url: '/billing/create-portal-session',
|
|
85
|
+
...options,
|
|
86
|
+
headers: {
|
|
87
|
+
'Content-Type': 'application/json',
|
|
88
|
+
...options.headers
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
public static createCustomerWithDefaultSubscription<ThrowOnError extends boolean = false>(options: Options<CreateCustomerWithDefaultSubscriptionData, ThrowOnError>) {
|
|
94
|
+
return (options.client ?? client).put<CreateCustomerWithDefaultSubscriptionResponses, CreateCustomerWithDefaultSubscriptionErrors, ThrowOnError>({
|
|
95
|
+
url: '/billing/create-customer-with-default-subscription',
|
|
96
|
+
...options,
|
|
97
|
+
headers: {
|
|
98
|
+
'Content-Type': 'application/json',
|
|
99
|
+
...options.headers
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|