@praxium/sdk 0.2.4

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.
@@ -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 { getBookableServices, getBusinessName, getContactDetails, getFaq, getFeatures, getInsuranceInfo, getLocation, getOpeningHours, getPaymentMethods, getPolicyInfo, getServiceVariants, getSocialLinks, getTeamMembers, type Options, submitContactForm } from './sdk.gen';
4
+ export type { ApiError, BilingualText, BookableService, BookableServices, BookableVariantInfo, BusinessName, ClientOptions, ContactDetails, ContactFormResult, FaqCategory, FaqContent, FaqGroup, FaqItem, FeatureItem, FeatureList, GetBookableServicesData, GetBookableServicesError, GetBookableServicesErrors, GetBookableServicesResponse, GetBookableServicesResponses, GetBusinessNameData, GetBusinessNameError, GetBusinessNameErrors, GetBusinessNameResponse, GetBusinessNameResponses, GetContactDetailsData, GetContactDetailsError, GetContactDetailsErrors, GetContactDetailsResponse, GetContactDetailsResponses, GetFaqData, GetFaqError, GetFaqErrors, GetFaqResponse, GetFaqResponses, GetFeaturesData, GetFeaturesError, GetFeaturesErrors, GetFeaturesResponse, GetFeaturesResponses, GetInsuranceInfoData, GetInsuranceInfoError, GetInsuranceInfoErrors, GetInsuranceInfoResponse, GetInsuranceInfoResponses, GetLocationData, GetLocationError, GetLocationErrors, GetLocationResponse, GetLocationResponses, GetOpeningHoursData, GetOpeningHoursError, GetOpeningHoursErrors, GetOpeningHoursResponse, GetOpeningHoursResponses, GetPaymentMethodsData, GetPaymentMethodsError, GetPaymentMethodsErrors, GetPaymentMethodsResponse, GetPaymentMethodsResponses, GetPolicyInfoData, GetPolicyInfoError, GetPolicyInfoErrors, GetPolicyInfoResponse, GetPolicyInfoResponses, GetServiceVariantsData, GetServiceVariantsError, GetServiceVariantsErrors, GetServiceVariantsResponse, GetServiceVariantsResponses, GetSocialLinksData, GetSocialLinksError, GetSocialLinksErrors, GetSocialLinksResponse, GetSocialLinksResponses, GetTeamMembersData, GetTeamMembersError, GetTeamMembersErrors, GetTeamMembersResponse, GetTeamMembersResponses, InsuranceInfo, InsuranceList, LocalizedSpecialization, Location, OpeningHours, PaymentMethod, PaymentMethodList, PolicyInfo, PolicyList, PricingVariant, PricingVariants, PublicDaySchedule, PublicTeamMember, ServiceCategoryInfo, SocialLinks, SubmitContactFormData, SubmitContactFormError, SubmitContactFormErrors, SubmitContactFormResponse, SubmitContactFormResponses, TeamMembers, TenantSlug } from './types.gen';
@@ -0,0 +1,177 @@
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 { GetBookableServicesData, GetBookableServicesErrors, GetBookableServicesResponses, GetBusinessNameData, GetBusinessNameErrors, GetBusinessNameResponses, GetContactDetailsData, GetContactDetailsErrors, GetContactDetailsResponses, GetFaqData, GetFaqErrors, GetFaqResponses, GetFeaturesData, GetFeaturesErrors, GetFeaturesResponses, GetInsuranceInfoData, GetInsuranceInfoErrors, GetInsuranceInfoResponses, GetLocationData, GetLocationErrors, GetLocationResponses, GetOpeningHoursData, GetOpeningHoursErrors, GetOpeningHoursResponses, GetPaymentMethodsData, GetPaymentMethodsErrors, GetPaymentMethodsResponses, GetPolicyInfoData, GetPolicyInfoErrors, GetPolicyInfoResponses, GetServiceVariantsData, GetServiceVariantsErrors, GetServiceVariantsResponses, GetSocialLinksData, GetSocialLinksErrors, GetSocialLinksResponses, GetTeamMembersData, GetTeamMembersErrors, GetTeamMembersResponses, SubmitContactFormData, SubmitContactFormErrors, SubmitContactFormResponses } 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
+ * Get weekly opening hours
23
+ *
24
+ * Returns the practice opening schedule for the requested locale. Includes daily hours, closed days, and optional notes.
25
+ */
26
+ export const getOpeningHours = <ThrowOnError extends boolean = false>(options: Options<GetOpeningHoursData, ThrowOnError>) => (options.client ?? client).get<GetOpeningHoursResponses, GetOpeningHoursErrors, ThrowOnError>({
27
+ security: [{ scheme: 'bearer', type: 'http' }],
28
+ url: '/api/public/{tenantSlug}/opening-hours',
29
+ ...options
30
+ });
31
+
32
+ /**
33
+ * Get contact details
34
+ *
35
+ * Returns phone, WhatsApp, and email contact information for the practice.
36
+ */
37
+ export const getContactDetails = <ThrowOnError extends boolean = false>(options: Options<GetContactDetailsData, ThrowOnError>) => (options.client ?? client).get<GetContactDetailsResponses, GetContactDetailsErrors, ThrowOnError>({
38
+ security: [{ scheme: 'bearer', type: 'http' }],
39
+ url: '/api/public/{tenantSlug}/contact',
40
+ ...options
41
+ });
42
+
43
+ /**
44
+ * Submit a contact form
45
+ *
46
+ * Sends a contact form submission via email to the practice admin. The email is sent using the Accept-Language locale for template localization.
47
+ */
48
+ export const submitContactForm = <ThrowOnError extends boolean = false>(options: Options<SubmitContactFormData, ThrowOnError>) => (options.client ?? client).post<SubmitContactFormResponses, SubmitContactFormErrors, ThrowOnError>({
49
+ security: [{ scheme: 'bearer', type: 'http' }],
50
+ url: '/api/public/{tenantSlug}/contact',
51
+ ...options,
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ ...options.headers
55
+ }
56
+ });
57
+
58
+ /**
59
+ * Get practice location
60
+ *
61
+ * Returns the practice address, GPS coordinates, Google Maps URL, parking info, and accessibility information.
62
+ */
63
+ export const getLocation = <ThrowOnError extends boolean = false>(options: Options<GetLocationData, ThrowOnError>) => (options.client ?? client).get<GetLocationResponses, GetLocationErrors, ThrowOnError>({
64
+ security: [{ scheme: 'bearer', type: 'http' }],
65
+ url: '/api/public/{tenantSlug}/location',
66
+ ...options
67
+ });
68
+
69
+ /**
70
+ * Get business name
71
+ *
72
+ * Returns the practice business name for the requested locale.
73
+ */
74
+ export const getBusinessName = <ThrowOnError extends boolean = false>(options: Options<GetBusinessNameData, ThrowOnError>) => (options.client ?? client).get<GetBusinessNameResponses, GetBusinessNameErrors, ThrowOnError>({
75
+ security: [{ scheme: 'bearer', type: 'http' }],
76
+ url: '/api/public/{tenantSlug}/business',
77
+ ...options
78
+ });
79
+
80
+ /**
81
+ * Get social media links
82
+ *
83
+ * Returns social media profile URLs (Facebook, Instagram, LinkedIn, Twitter/X).
84
+ */
85
+ export const getSocialLinks = <ThrowOnError extends boolean = false>(options: Options<GetSocialLinksData, ThrowOnError>) => (options.client ?? client).get<GetSocialLinksResponses, GetSocialLinksErrors, ThrowOnError>({
86
+ security: [{ scheme: 'bearer', type: 'http' }],
87
+ url: '/api/public/{tenantSlug}/social-links',
88
+ ...options
89
+ });
90
+
91
+ /**
92
+ * Get public team members
93
+ *
94
+ * Returns team members visible on the public team page, including name, image, specializations, bio, and BIG registration number.
95
+ */
96
+ export const getTeamMembers = <ThrowOnError extends boolean = false>(options: Options<GetTeamMembersData, ThrowOnError>) => (options.client ?? client).get<GetTeamMembersResponses, GetTeamMembersErrors, ThrowOnError>({
97
+ security: [{ scheme: 'bearer', type: 'http' }],
98
+ url: '/api/public/{tenantSlug}/team',
99
+ ...options
100
+ });
101
+
102
+ /**
103
+ * Get FAQ items grouped by category
104
+ *
105
+ * Returns all visible FAQ items, grouped by category. Questions and answers are bilingual (nl/en) — the SDK consumer localizes using their locale.
106
+ */
107
+ export const getFaq = <ThrowOnError extends boolean = false>(options: Options<GetFaqData, ThrowOnError>) => (options.client ?? client).get<GetFaqResponses, GetFaqErrors, ThrowOnError>({
108
+ security: [{ scheme: 'bearer', type: 'http' }],
109
+ url: '/api/public/{tenantSlug}/faq',
110
+ ...options
111
+ });
112
+
113
+ /**
114
+ * Get service pricing variants
115
+ *
116
+ * Returns all service variants with pricing information, suitable for displaying a pricing page. Includes category and service grouping metadata.
117
+ */
118
+ export const getServiceVariants = <ThrowOnError extends boolean = false>(options: Options<GetServiceVariantsData, ThrowOnError>) => (options.client ?? client).get<GetServiceVariantsResponses, GetServiceVariantsErrors, ThrowOnError>({
119
+ security: [{ scheme: 'bearer', type: 'http' }],
120
+ url: '/api/public/{tenantSlug}/service-variants',
121
+ ...options
122
+ });
123
+
124
+ /**
125
+ * Get insurance information
126
+ *
127
+ * Returns insurance coverage information items with bilingual titles and descriptions.
128
+ */
129
+ export const getInsuranceInfo = <ThrowOnError extends boolean = false>(options: Options<GetInsuranceInfoData, ThrowOnError>) => (options.client ?? client).get<GetInsuranceInfoResponses, GetInsuranceInfoErrors, ThrowOnError>({
130
+ security: [{ scheme: 'bearer', type: 'http' }],
131
+ url: '/api/public/{tenantSlug}/insurance',
132
+ ...options
133
+ });
134
+
135
+ /**
136
+ * Get practice features
137
+ *
138
+ * Returns practice feature/highlight items for display on the website.
139
+ */
140
+ export const getFeatures = <ThrowOnError extends boolean = false>(options: Options<GetFeaturesData, ThrowOnError>) => (options.client ?? client).get<GetFeaturesResponses, GetFeaturesErrors, ThrowOnError>({
141
+ security: [{ scheme: 'bearer', type: 'http' }],
142
+ url: '/api/public/{tenantSlug}/features',
143
+ ...options
144
+ });
145
+
146
+ /**
147
+ * Get accepted payment methods
148
+ *
149
+ * Returns the list of accepted payment methods with bilingual names.
150
+ */
151
+ export const getPaymentMethods = <ThrowOnError extends boolean = false>(options: Options<GetPaymentMethodsData, ThrowOnError>) => (options.client ?? client).get<GetPaymentMethodsResponses, GetPaymentMethodsErrors, ThrowOnError>({
152
+ security: [{ scheme: 'bearer', type: 'http' }],
153
+ url: '/api/public/{tenantSlug}/payments',
154
+ ...options
155
+ });
156
+
157
+ /**
158
+ * Get cancellation/practice policies
159
+ *
160
+ * Returns practice policy information items (cancellation, payment terms, etc.) with bilingual titles and descriptions.
161
+ */
162
+ export const getPolicyInfo = <ThrowOnError extends boolean = false>(options: Options<GetPolicyInfoData, ThrowOnError>) => (options.client ?? client).get<GetPolicyInfoResponses, GetPolicyInfoErrors, ThrowOnError>({
163
+ security: [{ scheme: 'bearer', type: 'http' }],
164
+ url: '/api/public/{tenantSlug}/policy',
165
+ ...options
166
+ });
167
+
168
+ /**
169
+ * Get bookable services with variants
170
+ *
171
+ * Returns all services available for online booking, with their variants, categories, pricing, and Cal.com event type slugs for booking integration.
172
+ */
173
+ export const getBookableServices = <ThrowOnError extends boolean = false>(options: Options<GetBookableServicesData, ThrowOnError>) => (options.client ?? client).get<GetBookableServicesResponses, GetBookableServicesErrors, ThrowOnError>({
174
+ security: [{ scheme: 'bearer', type: 'http' }],
175
+ url: '/api/public/{tenantSlug}/services',
176
+ ...options
177
+ });