@dazl/api-client 1.0.1 → 1.0.3

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.
Files changed (95) hide show
  1. package/dist/db/generated-types.d.ts +10 -0
  2. package/dist/db/generated-types.d.ts.map +1 -1
  3. package/dist/internal/index.d.ts +1 -1
  4. package/dist/internal/index.d.ts.map +1 -1
  5. package/dist/internal/sdk.gen.d.ts +43 -1
  6. package/dist/internal/sdk.gen.d.ts.map +1 -1
  7. package/dist/internal/sdk.gen.js +101 -0
  8. package/dist/internal/sdk.gen.js.map +1 -1
  9. package/dist/internal/types.gen.d.ts +825 -0
  10. package/dist/internal/types.gen.d.ts.map +1 -1
  11. package/dist/public/client/client.gen.d.ts +3 -0
  12. package/dist/public/client/client.gen.d.ts.map +1 -0
  13. package/dist/public/client/client.gen.js +217 -0
  14. package/dist/public/client/client.gen.js.map +1 -0
  15. package/dist/public/client/index.d.ts +11 -0
  16. package/dist/public/client/index.d.ts.map +1 -0
  17. package/dist/public/client/index.js +7 -0
  18. package/dist/public/client/index.js.map +1 -0
  19. package/dist/public/client/types.gen.d.ts +121 -0
  20. package/dist/public/client/types.gen.d.ts.map +1 -0
  21. package/dist/public/client/types.gen.js +3 -0
  22. package/dist/public/client/types.gen.js.map +1 -0
  23. package/dist/public/client/utils.gen.d.ts +38 -0
  24. package/dist/public/client/utils.gen.d.ts.map +1 -0
  25. package/dist/public/client/utils.gen.js +229 -0
  26. package/dist/public/client/utils.gen.js.map +1 -0
  27. package/dist/public/client.gen.d.ts +13 -0
  28. package/dist/public/client.gen.d.ts.map +1 -0
  29. package/dist/public/client.gen.js +4 -0
  30. package/dist/public/client.gen.js.map +1 -0
  31. package/dist/public/core/auth.gen.d.ts +26 -0
  32. package/dist/public/core/auth.gen.d.ts.map +1 -0
  33. package/dist/public/core/auth.gen.js +15 -0
  34. package/dist/public/core/auth.gen.js.map +1 -0
  35. package/dist/public/core/bodySerializer.gen.d.ts +26 -0
  36. package/dist/public/core/bodySerializer.gen.d.ts.map +1 -0
  37. package/dist/public/core/bodySerializer.gen.js +58 -0
  38. package/dist/public/core/bodySerializer.gen.js.map +1 -0
  39. package/dist/public/core/params.gen.d.ts +44 -0
  40. package/dist/public/core/params.gen.d.ts.map +1 -0
  41. package/dist/public/core/params.gen.js +110 -0
  42. package/dist/public/core/params.gen.js.map +1 -0
  43. package/dist/public/core/pathSerializer.gen.d.ts +34 -0
  44. package/dist/public/core/pathSerializer.gen.d.ts.map +1 -0
  45. package/dist/public/core/pathSerializer.gen.js +107 -0
  46. package/dist/public/core/pathSerializer.gen.js.map +1 -0
  47. package/dist/public/core/queryKeySerializer.gen.d.ts +19 -0
  48. package/dist/public/core/queryKeySerializer.gen.d.ts.map +1 -0
  49. package/dist/public/core/queryKeySerializer.gen.js +93 -0
  50. package/dist/public/core/queryKeySerializer.gen.js.map +1 -0
  51. package/dist/public/core/serverSentEvents.gen.d.ts +72 -0
  52. package/dist/public/core/serverSentEvents.gen.d.ts.map +1 -0
  53. package/dist/public/core/serverSentEvents.gen.js +133 -0
  54. package/dist/public/core/serverSentEvents.gen.js.map +1 -0
  55. package/dist/public/core/types.gen.d.ts +84 -0
  56. package/dist/public/core/types.gen.d.ts.map +1 -0
  57. package/dist/public/core/types.gen.js +3 -0
  58. package/dist/public/core/types.gen.js.map +1 -0
  59. package/dist/public/core/utils.gen.d.ts +20 -0
  60. package/dist/public/core/utils.gen.d.ts.map +1 -0
  61. package/dist/public/core/utils.gen.js +88 -0
  62. package/dist/public/core/utils.gen.js.map +1 -0
  63. package/dist/public/index.d.ts +3 -0
  64. package/dist/public/index.d.ts.map +1 -0
  65. package/dist/public/index.js +3 -0
  66. package/dist/public/index.js.map +1 -0
  67. package/dist/public/sdk.gen.d.ts +22 -0
  68. package/dist/public/sdk.gen.d.ts.map +1 -0
  69. package/dist/public/sdk.gen.js +10 -0
  70. package/dist/public/sdk.gen.js.map +1 -0
  71. package/dist/public/types.gen.d.ts +56 -0
  72. package/dist/public/types.gen.d.ts.map +1 -0
  73. package/dist/public/types.gen.js +3 -0
  74. package/dist/public/types.gen.js.map +1 -0
  75. package/package.json +4 -1
  76. package/src/db/generated-types.ts +11 -0
  77. package/src/internal/index.ts +1 -1
  78. package/src/internal/sdk.gen.ts +114 -1
  79. package/src/internal/types.gen.ts +889 -0
  80. package/src/public/client/client.gen.ts +277 -0
  81. package/src/public/client/index.ts +27 -0
  82. package/src/public/client/types.gen.ts +218 -0
  83. package/src/public/client/utils.gen.ts +316 -0
  84. package/src/public/client.gen.ts +16 -0
  85. package/src/public/core/auth.gen.ts +48 -0
  86. package/src/public/core/bodySerializer.gen.ts +82 -0
  87. package/src/public/core/params.gen.ts +178 -0
  88. package/src/public/core/pathSerializer.gen.ts +171 -0
  89. package/src/public/core/queryKeySerializer.gen.ts +117 -0
  90. package/src/public/core/serverSentEvents.gen.ts +242 -0
  91. package/src/public/core/types.gen.ts +110 -0
  92. package/src/public/core/utils.gen.ts +140 -0
  93. package/src/public/index.ts +4 -0
  94. package/src/public/sdk.gen.ts +27 -0
  95. package/src/public/types.gen.ts +63 -0
@@ -0,0 +1,140 @@
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: RegExp = /\{[^{}]+\}/g;
17
+
18
+ export const defaultPathSerializer = ({ path, url: _url }: PathSerializer): string => {
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
+ }): string => {
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
+ }): unknown {
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 { type Options, Ping } from './sdk.gen.ts';
4
+ export type { ClientOptions, ErrorResponse, GetPingData, GetPingError, GetPingErrors, GetPingResponse, GetPingResponses } from './types.gen.ts';
@@ -0,0 +1,27 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ import type { Client, ClientMeta, Options as Options2, RequestResult, TDataShape } from './client/index.ts';
4
+ import type { GetPingData, GetPingErrors, GetPingResponses } from './types.gen.ts';
5
+
6
+ export type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean = boolean, TResponse = unknown> = Options2<TData, ThrowOnError, TResponse> & {
7
+ /**
8
+ * You can provide a client instance returned by `createClient()` instead of
9
+ * individual options. This might be also useful if you want to implement a
10
+ * custom client.
11
+ */
12
+ client: Client;
13
+ /**
14
+ * You can pass arbitrary values through the `meta` object. This can be
15
+ * used to access values that aren't defined as part of the SDK function.
16
+ */
17
+ meta?: keyof ClientMeta extends never ? Record<string, unknown> : ClientMeta;
18
+ };
19
+
20
+ export class Ping {
21
+ /**
22
+ * Ping endpoint for test
23
+ */
24
+ public static getPing<ThrowOnError extends boolean = false>(options: Options<GetPingData, ThrowOnError>): RequestResult<GetPingResponses, GetPingErrors, ThrowOnError> {
25
+ return options.client.get<GetPingResponses, GetPingErrors, ThrowOnError>({ url: '/ping', ...options });
26
+ }
27
+ }
@@ -0,0 +1,63 @@
1
+ // This file is auto-generated by @hey-api/openapi-ts
2
+
3
+ export type ClientOptions = {
4
+ baseUrl: `${string}://${string}` | (string & {});
5
+ };
6
+
7
+ export type ErrorResponse = {
8
+ message: string;
9
+ };
10
+
11
+ export type GetPingData = {
12
+ body?: never;
13
+ path?: never;
14
+ query?: never;
15
+ url: '/ping';
16
+ };
17
+
18
+ export type GetPingErrors = {
19
+ /**
20
+ * Bad request - Invalid parameters or malformed JSON
21
+ */
22
+ 400: {
23
+ message: string;
24
+ issues?: string;
25
+ };
26
+ /**
27
+ * Unauthorized
28
+ */
29
+ 401: ErrorResponse;
30
+ /**
31
+ * Forbidden
32
+ */
33
+ 403: ErrorResponse;
34
+ /**
35
+ * Not Found
36
+ */
37
+ 404: ErrorResponse;
38
+ /**
39
+ * Conflict
40
+ */
41
+ 409: ErrorResponse;
42
+ /**
43
+ * Internal server error
44
+ */
45
+ 500: ErrorResponse;
46
+ /**
47
+ * Service Unavailable
48
+ */
49
+ 503: ErrorResponse;
50
+ };
51
+
52
+ export type GetPingError = GetPingErrors[keyof GetPingErrors];
53
+
54
+ export type GetPingResponses = {
55
+ /**
56
+ * Returns a pong message
57
+ */
58
+ 200: {
59
+ message: string;
60
+ };
61
+ };
62
+
63
+ export type GetPingResponse = GetPingResponses[keyof GetPingResponses];