@deliverart/sdk-js-customer 0.1.0 → 1.1.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/package.json +12 -26
- package/.changeset/config.json +0 -11
- package/.github/workflows/workflow.yml +0 -47
- package/.prettierrc +0 -7
- package/CHANGELOG.md +0 -67
- package/README.md +0 -3
- package/dist/index.cjs +0 -722
- package/dist/index.d.cts +0 -4587
- package/dist/index.d.ts +0 -4587
- package/dist/index.js +0 -641
- package/eslint.config.js +0 -41
- package/src/index.ts +0 -3
- package/src/models.ts +0 -131
- package/src/requests/customer-addresses/CreateCustomerAddress.ts +0 -32
- package/src/requests/customer-addresses/DeleteCustomerAddress.ts +0 -30
- package/src/requests/customer-addresses/GetCustomerAddressDetails.ts +0 -36
- package/src/requests/customer-addresses/GetCustomerAddresses.ts +0 -58
- package/src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts +0 -58
- package/src/requests/customer-addresses/UpdateCustomerAddress.ts +0 -35
- package/src/requests/customer-addresses/index.ts +0 -6
- package/src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts +0 -40
- package/src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts +0 -30
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts +0 -38
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts +0 -70
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts +0 -64
- package/src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts +0 -43
- package/src/requests/customer-business-profiles/index.ts +0 -6
- package/src/requests/customers/CreateCustomer.ts +0 -32
- package/src/requests/customers/DeleteCustomer.ts +0 -30
- package/src/requests/customers/GetCustomerDetails.ts +0 -34
- package/src/requests/customers/GetCustomers.ts +0 -47
- package/src/requests/customers/UpdateCustomer.ts +0 -35
- package/src/requests/customers/index.ts +0 -5
- package/src/requests/index.ts +0 -3
- package/src/types.ts +0 -24
- package/tsconfig.json +0 -15
package/src/models.ts
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
addressSchema,
|
|
3
|
-
billingDataSchema,
|
|
4
|
-
datetimeSchema,
|
|
5
|
-
locationSchema,
|
|
6
|
-
sortDirSchema,
|
|
7
|
-
timestampsFilterSchema,
|
|
8
|
-
} from '@deliverart/sdk-js-global-types'
|
|
9
|
-
import { pointOfSaleNullableIriSchema } from '@deliverart/sdk-js-point-of-sale'
|
|
10
|
-
import { userNullableIriSchema } from '@deliverart/sdk-js-user'
|
|
11
|
-
import { z } from 'zod'
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
customerAddressIriSchema,
|
|
15
|
-
customerBusinessProfileIriSchema,
|
|
16
|
-
customerIriSchema,
|
|
17
|
-
} from './types'
|
|
18
|
-
|
|
19
|
-
export const customerSchema = z.object({
|
|
20
|
-
id: z.string(),
|
|
21
|
-
firstName: z.string().nullable(),
|
|
22
|
-
lastName: z.string().nullable(),
|
|
23
|
-
email: z.string().email().nullable(),
|
|
24
|
-
phoneNumber: z.string().nullable(),
|
|
25
|
-
hasBusinessProfiles: z.boolean(),
|
|
26
|
-
hasAddresses: z.boolean(),
|
|
27
|
-
ordersPlaced: z.number(),
|
|
28
|
-
totalSpent: z.string(),
|
|
29
|
-
createdAt: datetimeSchema,
|
|
30
|
-
updatedAt: datetimeSchema,
|
|
31
|
-
})
|
|
32
|
-
export type Customer = z.infer<typeof customerSchema>
|
|
33
|
-
|
|
34
|
-
export const customerDetailsSchema = customerSchema.extend({
|
|
35
|
-
pointOfSale: pointOfSaleNullableIriSchema,
|
|
36
|
-
owner: userNullableIriSchema,
|
|
37
|
-
addresses: z.array(customerAddressIriSchema),
|
|
38
|
-
businessProfiles: z.array(customerBusinessProfileIriSchema),
|
|
39
|
-
})
|
|
40
|
-
export type CustomerDetails = z.infer<typeof customerDetailsSchema>
|
|
41
|
-
|
|
42
|
-
export const writableCreateCustomerSchema = customerDetailsSchema.pick({
|
|
43
|
-
pointOfSale: true,
|
|
44
|
-
firstName: true,
|
|
45
|
-
lastName: true,
|
|
46
|
-
email: true,
|
|
47
|
-
phoneNumber: true,
|
|
48
|
-
})
|
|
49
|
-
export const writableCustomerSchema = writableCreateCustomerSchema.omit({
|
|
50
|
-
pointOfSale: true,
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
export const customerAddressSchema = z.object({
|
|
54
|
-
id: z.string(),
|
|
55
|
-
address: addressSchema,
|
|
56
|
-
location: locationSchema,
|
|
57
|
-
createdAt: datetimeSchema,
|
|
58
|
-
updatedAt: datetimeSchema,
|
|
59
|
-
})
|
|
60
|
-
export type CustomerAddress = z.infer<typeof customerAddressSchema>
|
|
61
|
-
|
|
62
|
-
export const customerAddressDetailsSchema = customerAddressSchema.extend({
|
|
63
|
-
customer: customerIriSchema,
|
|
64
|
-
})
|
|
65
|
-
export type CustomerAddressDetails = z.infer<typeof customerAddressDetailsSchema>
|
|
66
|
-
|
|
67
|
-
export const writableCreateCustomerAddressSchema = customerAddressDetailsSchema.pick({
|
|
68
|
-
customer: true,
|
|
69
|
-
address: true,
|
|
70
|
-
})
|
|
71
|
-
export const writableCustomerAddressSchema = writableCreateCustomerAddressSchema.omit({
|
|
72
|
-
customer: true,
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
export const customerBusinessProfileSchema = z.object({
|
|
76
|
-
id: z.string(),
|
|
77
|
-
businessName: z.string(),
|
|
78
|
-
vat: z.string(),
|
|
79
|
-
taxCode: z.string(),
|
|
80
|
-
billingAddress: addressSchema,
|
|
81
|
-
billingData: billingDataSchema,
|
|
82
|
-
createdAt: datetimeSchema,
|
|
83
|
-
updatedAt: datetimeSchema,
|
|
84
|
-
})
|
|
85
|
-
export type CustomerBusinessProfile = z.infer<typeof customerBusinessProfileSchema>
|
|
86
|
-
|
|
87
|
-
export const customerBusinessProfileDetailsSchema = customerBusinessProfileSchema.extend({
|
|
88
|
-
customer: customerIriSchema,
|
|
89
|
-
})
|
|
90
|
-
export type CustomerBusinessProfileDetails = z.infer<typeof customerBusinessProfileDetailsSchema>
|
|
91
|
-
|
|
92
|
-
export const writableCreateCustomerBusinessProfileSchema =
|
|
93
|
-
customerBusinessProfileDetailsSchema.pick({
|
|
94
|
-
customer: true,
|
|
95
|
-
businessName: true,
|
|
96
|
-
vat: true,
|
|
97
|
-
taxCode: true,
|
|
98
|
-
billingAddress: true,
|
|
99
|
-
billingData: true,
|
|
100
|
-
})
|
|
101
|
-
export const writableCustomerBusinessProfileSchema =
|
|
102
|
-
writableCreateCustomerBusinessProfileSchema.omit({
|
|
103
|
-
customer: true,
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
export const customersQuerySchema = z
|
|
107
|
-
.object({
|
|
108
|
-
firstName: z.string().optional(),
|
|
109
|
-
lastName: z.string().optional(),
|
|
110
|
-
email: z.string().optional(),
|
|
111
|
-
phoneNumber: z.string().optional(),
|
|
112
|
-
hasBusinessProfiles: z.coerce.boolean().optional(),
|
|
113
|
-
hasAddresses: z.coerce.boolean().optional(),
|
|
114
|
-
'ordersPlaced[between]': z.coerce.number().optional(),
|
|
115
|
-
'ordersPlaced[gt]': z.coerce.number().optional(),
|
|
116
|
-
'ordersPlaced[gte]': z.coerce.number().optional(),
|
|
117
|
-
'ordersPlaced[lt]': z.coerce.number().optional(),
|
|
118
|
-
'ordersPlaced[lte]': z.coerce.number().optional(),
|
|
119
|
-
'totalSpent[between]': z.coerce.number().optional(),
|
|
120
|
-
'totalSpent[gt]': z.coerce.string().optional(),
|
|
121
|
-
'totalSpent[gte]': z.coerce.string().optional(),
|
|
122
|
-
'totalSpent[lt]': z.coerce.string().optional(),
|
|
123
|
-
'totalSpent[lte]': z.coerce.string().optional(),
|
|
124
|
-
'order[firstName]': sortDirSchema.optional(),
|
|
125
|
-
'order[lastName]': sortDirSchema.optional(),
|
|
126
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
127
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
128
|
-
page: z.coerce.number().optional(),
|
|
129
|
-
})
|
|
130
|
-
.merge(timestampsFilterSchema)
|
|
131
|
-
export type CustomersQueryParams = z.infer<typeof customersQuerySchema>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { customerAddressDetailsSchema, writableCreateCustomerAddressSchema } from '../../models'
|
|
5
|
-
|
|
6
|
-
export const createCustomerAddressInputSchema = writableCreateCustomerAddressSchema.required()
|
|
7
|
-
export type CreateCustomerAddressInput = z.input<typeof createCustomerAddressInputSchema>
|
|
8
|
-
|
|
9
|
-
export const createCustomerAddressResponseSchema = customerAddressDetailsSchema
|
|
10
|
-
export type CreateCustomerAddressResponse = z.infer<typeof createCustomerAddressResponseSchema>
|
|
11
|
-
|
|
12
|
-
export class CreateCustomerAddress extends AbstractApiRequest<
|
|
13
|
-
typeof createCustomerAddressInputSchema,
|
|
14
|
-
typeof createCustomerAddressResponseSchema
|
|
15
|
-
> {
|
|
16
|
-
readonly method = 'POST'
|
|
17
|
-
readonly contentType = 'application/json'
|
|
18
|
-
readonly accept = 'application/json'
|
|
19
|
-
|
|
20
|
-
readonly inputSchema = createCustomerAddressInputSchema
|
|
21
|
-
readonly outputSchema = createCustomerAddressResponseSchema
|
|
22
|
-
readonly querySchema = undefined
|
|
23
|
-
readonly headersSchema = undefined
|
|
24
|
-
|
|
25
|
-
constructor(input: z.input<typeof createCustomerAddressInputSchema>) {
|
|
26
|
-
super(input)
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getPath(): string {
|
|
30
|
-
return '/customers/addresses'
|
|
31
|
-
}
|
|
32
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
export const deleteCustomerAddressInputSchema = z.undefined()
|
|
5
|
-
export const deleteCustomerAddressResponseSchema = z.undefined()
|
|
6
|
-
|
|
7
|
-
export class DeleteCustomerAddress extends AbstractApiRequest<
|
|
8
|
-
typeof deleteCustomerAddressInputSchema,
|
|
9
|
-
typeof deleteCustomerAddressResponseSchema
|
|
10
|
-
> {
|
|
11
|
-
readonly method = 'DELETE'
|
|
12
|
-
readonly contentType = 'application/json'
|
|
13
|
-
readonly accept = 'application/json'
|
|
14
|
-
|
|
15
|
-
readonly inputSchema = deleteCustomerAddressInputSchema
|
|
16
|
-
readonly outputSchema = deleteCustomerAddressResponseSchema
|
|
17
|
-
readonly querySchema = undefined
|
|
18
|
-
readonly headersSchema = undefined
|
|
19
|
-
|
|
20
|
-
private readonly customerAddressId: string
|
|
21
|
-
|
|
22
|
-
constructor(customerAddressId: string) {
|
|
23
|
-
super(undefined)
|
|
24
|
-
this.customerAddressId = customerAddressId
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getPath(): string {
|
|
28
|
-
return `/customers/addresses/${this.customerAddressId}`
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { CustomerAddressDetails, customerAddressDetailsSchema } from '../../models'
|
|
5
|
-
|
|
6
|
-
export const getCustomerAddressDetailsInputSchema = z.undefined()
|
|
7
|
-
export type GetCustomerAddressDetailsInput = z.input<typeof getCustomerAddressDetailsInputSchema>
|
|
8
|
-
|
|
9
|
-
export const getCustomerAddressDetailsResponseSchema = customerAddressDetailsSchema
|
|
10
|
-
export type GetCustomerAddressDetailsResponse = z.infer<
|
|
11
|
-
typeof getCustomerAddressDetailsResponseSchema
|
|
12
|
-
>
|
|
13
|
-
|
|
14
|
-
export class GetCustomerAddressDetails extends AbstractApiRequest<
|
|
15
|
-
typeof getCustomerAddressDetailsInputSchema,
|
|
16
|
-
typeof getCustomerAddressDetailsResponseSchema
|
|
17
|
-
> {
|
|
18
|
-
readonly method = 'GET'
|
|
19
|
-
readonly contentType = 'application/json'
|
|
20
|
-
readonly accept = 'application/json'
|
|
21
|
-
readonly inputSchema = getCustomerAddressDetailsInputSchema
|
|
22
|
-
readonly outputSchema = getCustomerAddressDetailsResponseSchema
|
|
23
|
-
readonly querySchema = undefined
|
|
24
|
-
readonly headersSchema = undefined
|
|
25
|
-
|
|
26
|
-
private readonly customerAddressId: string
|
|
27
|
-
|
|
28
|
-
constructor(customerAddressId: string) {
|
|
29
|
-
super(undefined)
|
|
30
|
-
this.customerAddressId = customerAddressId
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
getPath(): string {
|
|
34
|
-
return `/customers/addresses/${this.customerAddressId}`
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import {
|
|
3
|
-
createPaginatedSchema,
|
|
4
|
-
Paginated,
|
|
5
|
-
responseToPagination,
|
|
6
|
-
sortDirSchema,
|
|
7
|
-
timestampsFilterSchema,
|
|
8
|
-
} from '@deliverart/sdk-js-global-types'
|
|
9
|
-
import { AxiosResponse } from 'axios'
|
|
10
|
-
import { z } from 'zod'
|
|
11
|
-
|
|
12
|
-
import { CustomerAddress, customerAddressSchema } from '../../models'
|
|
13
|
-
|
|
14
|
-
export const getCustomerAddressesQuerySchema = z
|
|
15
|
-
.object({
|
|
16
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
17
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
18
|
-
page: z.coerce.number().optional(),
|
|
19
|
-
})
|
|
20
|
-
.merge(timestampsFilterSchema)
|
|
21
|
-
export type GetCustomerAddressesQueryParams = z.infer<typeof getCustomerAddressesQuerySchema>
|
|
22
|
-
|
|
23
|
-
export const getCustomerAddressesInputSchema = z.undefined()
|
|
24
|
-
export type GetCustomerAddressesInput = z.input<typeof getCustomerAddressesInputSchema>
|
|
25
|
-
|
|
26
|
-
export const getCustomerAddressesResponseSchema = createPaginatedSchema(customerAddressSchema)
|
|
27
|
-
export type GetCustomerAddressesResponse = z.infer<typeof getCustomerAddressesResponseSchema>
|
|
28
|
-
|
|
29
|
-
export class GetCustomerAddresses extends AbstractApiRequest<
|
|
30
|
-
typeof getCustomerAddressesInputSchema,
|
|
31
|
-
typeof getCustomerAddressesResponseSchema,
|
|
32
|
-
GetCustomerAddressesQueryParams
|
|
33
|
-
> {
|
|
34
|
-
readonly method = 'GET'
|
|
35
|
-
readonly contentType = 'application/json'
|
|
36
|
-
readonly accept = 'application/json'
|
|
37
|
-
|
|
38
|
-
readonly inputSchema = getCustomerAddressesInputSchema
|
|
39
|
-
readonly outputSchema = getCustomerAddressesResponseSchema
|
|
40
|
-
readonly querySchema = getCustomerAddressesQuerySchema
|
|
41
|
-
readonly headersSchema = undefined
|
|
42
|
-
|
|
43
|
-
constructor(options?: { query?: GetCustomerAddressesQueryParams }) {
|
|
44
|
-
super(undefined, options)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getPath(): string {
|
|
48
|
-
return '/customers/addresses'
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
parseResponse(data: unknown, rawResponse: AxiosResponse): Paginated<CustomerAddress> {
|
|
52
|
-
const customerAddresses = z.array(customerAddressSchema).parse(data)
|
|
53
|
-
return this.validateOutput({
|
|
54
|
-
data: customerAddresses,
|
|
55
|
-
pagination: responseToPagination(rawResponse),
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { sortDirSchema, timestampsFilterSchema } from '@deliverart/sdk-js-global-types'
|
|
3
|
-
import { z } from 'zod'
|
|
4
|
-
|
|
5
|
-
import { CustomerAddress, customerAddressSchema } from '../../models'
|
|
6
|
-
|
|
7
|
-
export const getCustomerAddressesForCustomerQuerySchema = z
|
|
8
|
-
.object({
|
|
9
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
10
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
11
|
-
})
|
|
12
|
-
.merge(timestampsFilterSchema)
|
|
13
|
-
export type GetCustomerAddressesForCustomerQueryParams = z.infer<
|
|
14
|
-
typeof getCustomerAddressesForCustomerQuerySchema
|
|
15
|
-
>
|
|
16
|
-
|
|
17
|
-
export const getCustomerAddressesForCustomerInputSchema = z.undefined()
|
|
18
|
-
export type GetCustomerAddressesForCustomerInput = z.input<
|
|
19
|
-
typeof getCustomerAddressesForCustomerInputSchema
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
export const getCustomerAddressesForCustomerResponseSchema = z.array(customerAddressSchema)
|
|
23
|
-
export type GetCustomerAddressesForCustomerResponse = z.infer<
|
|
24
|
-
typeof getCustomerAddressesForCustomerResponseSchema
|
|
25
|
-
>
|
|
26
|
-
|
|
27
|
-
export class GetCustomerAddressesForCustomer extends AbstractApiRequest<
|
|
28
|
-
typeof getCustomerAddressesForCustomerInputSchema,
|
|
29
|
-
typeof getCustomerAddressesForCustomerResponseSchema,
|
|
30
|
-
GetCustomerAddressesForCustomerQueryParams
|
|
31
|
-
> {
|
|
32
|
-
readonly method = 'GET'
|
|
33
|
-
readonly contentType = 'application/json'
|
|
34
|
-
readonly accept = 'application/json'
|
|
35
|
-
|
|
36
|
-
readonly inputSchema = getCustomerAddressesForCustomerInputSchema
|
|
37
|
-
readonly outputSchema = getCustomerAddressesForCustomerResponseSchema
|
|
38
|
-
readonly querySchema = getCustomerAddressesForCustomerQuerySchema
|
|
39
|
-
readonly headersSchema = undefined
|
|
40
|
-
|
|
41
|
-
private readonly customerId: string
|
|
42
|
-
|
|
43
|
-
constructor(
|
|
44
|
-
customerId: string,
|
|
45
|
-
options?: { query?: GetCustomerAddressesForCustomerQueryParams },
|
|
46
|
-
) {
|
|
47
|
-
super(undefined, options)
|
|
48
|
-
this.customerId = customerId
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
getPath(): string {
|
|
52
|
-
return `/customers/${this.customerId}/addresses`
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
parseResponse(data: unknown): CustomerAddress[] {
|
|
56
|
-
return z.array(customerAddressSchema).parse(data)
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { customerAddressDetailsSchema, writableCustomerAddressSchema } from '../../models'
|
|
5
|
-
|
|
6
|
-
export const updateCustomerAddressInputSchema = writableCustomerAddressSchema.partial()
|
|
7
|
-
export type UpdateCustomerAddressInput = z.input<typeof updateCustomerAddressInputSchema>
|
|
8
|
-
|
|
9
|
-
export const updateCustomerAddressResponseSchema = customerAddressDetailsSchema
|
|
10
|
-
export type UpdateCustomerAddressResponse = z.infer<typeof updateCustomerAddressResponseSchema>
|
|
11
|
-
|
|
12
|
-
export class UpdateCustomerAddress extends AbstractApiRequest<
|
|
13
|
-
typeof updateCustomerAddressInputSchema,
|
|
14
|
-
typeof updateCustomerAddressResponseSchema
|
|
15
|
-
> {
|
|
16
|
-
readonly method = 'PATCH'
|
|
17
|
-
readonly contentType = 'application/merge-patch+json'
|
|
18
|
-
readonly accept = 'application/json'
|
|
19
|
-
|
|
20
|
-
readonly inputSchema = updateCustomerAddressInputSchema
|
|
21
|
-
readonly outputSchema = updateCustomerAddressResponseSchema
|
|
22
|
-
readonly querySchema = undefined
|
|
23
|
-
readonly headersSchema = undefined
|
|
24
|
-
|
|
25
|
-
private readonly customerId: string
|
|
26
|
-
|
|
27
|
-
constructor(customerId: string, input: UpdateCustomerAddressInput) {
|
|
28
|
-
super(input)
|
|
29
|
-
this.customerId = customerId
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getPath(): string {
|
|
33
|
-
return `/customers/addresses/${this.customerId}`
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
customerBusinessProfileDetailsSchema,
|
|
6
|
-
writableCreateCustomerBusinessProfileSchema,
|
|
7
|
-
} from '../../models'
|
|
8
|
-
|
|
9
|
-
export const createCustomerBusinessProfileInputSchema =
|
|
10
|
-
writableCreateCustomerBusinessProfileSchema.required()
|
|
11
|
-
export type CreateCustomerBusinessProfileInput = z.input<
|
|
12
|
-
typeof createCustomerBusinessProfileInputSchema
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
export const createCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema
|
|
16
|
-
export type CreateCustomerBusinessProfileResponse = z.infer<
|
|
17
|
-
typeof createCustomerBusinessProfileResponseSchema
|
|
18
|
-
>
|
|
19
|
-
|
|
20
|
-
export class CreateCustomerBusinessProfile extends AbstractApiRequest<
|
|
21
|
-
typeof createCustomerBusinessProfileInputSchema,
|
|
22
|
-
typeof createCustomerBusinessProfileResponseSchema
|
|
23
|
-
> {
|
|
24
|
-
readonly method = 'POST'
|
|
25
|
-
readonly contentType = 'application/json'
|
|
26
|
-
readonly accept = 'application/json'
|
|
27
|
-
|
|
28
|
-
readonly inputSchema = createCustomerBusinessProfileInputSchema
|
|
29
|
-
readonly outputSchema = createCustomerBusinessProfileResponseSchema
|
|
30
|
-
readonly querySchema = undefined
|
|
31
|
-
readonly headersSchema = undefined
|
|
32
|
-
|
|
33
|
-
constructor(input: CreateCustomerBusinessProfileInput) {
|
|
34
|
-
super(input)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getPath(): string {
|
|
38
|
-
return '/customers/business_profiles'
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
export const deleteCustomerBusinessProfileInputSchema = z.undefined()
|
|
5
|
-
export const deleteCustomerBusinessProfileResponseSchema = z.undefined()
|
|
6
|
-
|
|
7
|
-
export class DeleteCustomerBusinessProfile extends AbstractApiRequest<
|
|
8
|
-
typeof deleteCustomerBusinessProfileInputSchema,
|
|
9
|
-
typeof deleteCustomerBusinessProfileResponseSchema
|
|
10
|
-
> {
|
|
11
|
-
readonly method = 'DELETE'
|
|
12
|
-
readonly contentType = 'application/json'
|
|
13
|
-
readonly accept = 'application/json'
|
|
14
|
-
|
|
15
|
-
readonly inputSchema = deleteCustomerBusinessProfileInputSchema
|
|
16
|
-
readonly outputSchema = deleteCustomerBusinessProfileResponseSchema
|
|
17
|
-
readonly querySchema = undefined
|
|
18
|
-
readonly headersSchema = undefined
|
|
19
|
-
|
|
20
|
-
private readonly customerBusinessProfileId: string
|
|
21
|
-
|
|
22
|
-
constructor(customerBusinessProfileId: string) {
|
|
23
|
-
super(undefined)
|
|
24
|
-
this.customerBusinessProfileId = customerBusinessProfileId
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getPath(): string {
|
|
28
|
-
return `/customers/business_profiles/${this.customerBusinessProfileId}`
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import { customerBusinessProfileDetailsSchema } from '../../models'
|
|
5
|
-
|
|
6
|
-
export const getCustomerBusinessProfileDetailsInputSchema = z.undefined()
|
|
7
|
-
export type GetCustomerBusinessProfileDetailsInput = z.infer<
|
|
8
|
-
typeof getCustomerBusinessProfileDetailsInputSchema
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
export const getCustomerBusinessProfileDetailsResponseSchema = customerBusinessProfileDetailsSchema
|
|
12
|
-
export type GetCustomerBusinessProfileDetailsResponse = z.infer<
|
|
13
|
-
typeof getCustomerBusinessProfileDetailsResponseSchema
|
|
14
|
-
>
|
|
15
|
-
|
|
16
|
-
export class GetCustomerBusinessProfileDetails extends AbstractApiRequest<
|
|
17
|
-
typeof getCustomerBusinessProfileDetailsInputSchema,
|
|
18
|
-
typeof getCustomerBusinessProfileDetailsResponseSchema
|
|
19
|
-
> {
|
|
20
|
-
readonly method = 'GET'
|
|
21
|
-
readonly contentType = 'application/json'
|
|
22
|
-
readonly accept = 'application/json'
|
|
23
|
-
readonly inputSchema = getCustomerBusinessProfileDetailsInputSchema
|
|
24
|
-
readonly outputSchema = getCustomerBusinessProfileDetailsResponseSchema
|
|
25
|
-
readonly querySchema = undefined
|
|
26
|
-
readonly headersSchema = undefined
|
|
27
|
-
|
|
28
|
-
private readonly customerBusinessProfileId: string
|
|
29
|
-
|
|
30
|
-
constructor(customerBusinessProfileId: string) {
|
|
31
|
-
super(undefined)
|
|
32
|
-
this.customerBusinessProfileId = customerBusinessProfileId
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
getPath(): string {
|
|
36
|
-
return `/customers/business_profiles/${this.customerBusinessProfileId}`
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import {
|
|
3
|
-
createPaginatedSchema,
|
|
4
|
-
Paginated,
|
|
5
|
-
responseToPagination,
|
|
6
|
-
sortDirSchema,
|
|
7
|
-
timestampsFilterSchema,
|
|
8
|
-
} from '@deliverart/sdk-js-global-types'
|
|
9
|
-
import { AxiosResponse } from 'axios'
|
|
10
|
-
import { z } from 'zod'
|
|
11
|
-
|
|
12
|
-
import { CustomerBusinessProfile, customerBusinessProfileSchema } from '../../models'
|
|
13
|
-
|
|
14
|
-
export const getCustomerBusinessProfilesQuerySchema = z
|
|
15
|
-
.object({
|
|
16
|
-
'order[businessName]': sortDirSchema.optional(),
|
|
17
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
18
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
19
|
-
businessName: z.string().optional(),
|
|
20
|
-
vat: z.string().optional(),
|
|
21
|
-
taxCode: z.string().optional(),
|
|
22
|
-
page: z.coerce.number().optional(),
|
|
23
|
-
})
|
|
24
|
-
.merge(timestampsFilterSchema)
|
|
25
|
-
export type GetCustomerBusinessProfilesQueryParams = z.infer<
|
|
26
|
-
typeof getCustomerBusinessProfilesQuerySchema
|
|
27
|
-
>
|
|
28
|
-
|
|
29
|
-
export const getCustomerBusinessProfilesInputSchema = z.undefined()
|
|
30
|
-
export type GetCustomerBusinessProfilesInput = z.infer<
|
|
31
|
-
typeof getCustomerBusinessProfilesInputSchema
|
|
32
|
-
>
|
|
33
|
-
|
|
34
|
-
export const getCustomerBusinessProfilesResponseSchema = createPaginatedSchema(
|
|
35
|
-
customerBusinessProfileSchema,
|
|
36
|
-
)
|
|
37
|
-
export type GetCustomerBusinessProfilesResponse = z.infer<
|
|
38
|
-
typeof getCustomerBusinessProfilesResponseSchema
|
|
39
|
-
>
|
|
40
|
-
|
|
41
|
-
export class GetCustomerBusinessProfiles extends AbstractApiRequest<
|
|
42
|
-
typeof getCustomerBusinessProfilesInputSchema,
|
|
43
|
-
typeof getCustomerBusinessProfilesResponseSchema,
|
|
44
|
-
GetCustomerBusinessProfilesQueryParams
|
|
45
|
-
> {
|
|
46
|
-
readonly method = 'GET'
|
|
47
|
-
readonly contentType = 'application/json'
|
|
48
|
-
readonly accept = 'application/json'
|
|
49
|
-
|
|
50
|
-
readonly inputSchema = getCustomerBusinessProfilesInputSchema
|
|
51
|
-
readonly outputSchema = getCustomerBusinessProfilesResponseSchema
|
|
52
|
-
readonly querySchema = getCustomerBusinessProfilesQuerySchema
|
|
53
|
-
readonly headersSchema = undefined
|
|
54
|
-
|
|
55
|
-
constructor(options?: { query?: GetCustomerBusinessProfilesQueryParams }) {
|
|
56
|
-
super(undefined, options)
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getPath(): string {
|
|
60
|
-
return '/customers/business_profiles'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
parseResponse(data: unknown, rawResponse: AxiosResponse): Paginated<CustomerBusinessProfile> {
|
|
64
|
-
const customerBusinessProfiles = z.array(customerBusinessProfileSchema).parse(data)
|
|
65
|
-
return this.validateOutput({
|
|
66
|
-
data: customerBusinessProfiles,
|
|
67
|
-
pagination: responseToPagination(rawResponse),
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { sortDirSchema, timestampsFilterSchema } from '@deliverart/sdk-js-global-types'
|
|
3
|
-
import { z } from 'zod'
|
|
4
|
-
|
|
5
|
-
import { CustomerBusinessProfile, customerBusinessProfileSchema } from '../../models'
|
|
6
|
-
|
|
7
|
-
export const getCustomerBusinessProfilesForCustomerQuerySchema = z
|
|
8
|
-
.object({
|
|
9
|
-
'order[businessName]': sortDirSchema.optional(),
|
|
10
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
11
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
12
|
-
businessName: z.string().optional(),
|
|
13
|
-
vat: z.string().optional(),
|
|
14
|
-
taxCode: z.string().optional(),
|
|
15
|
-
})
|
|
16
|
-
.merge(timestampsFilterSchema)
|
|
17
|
-
export type GetCustomerBusinessProfilesForCustomerQueryParams = z.infer<
|
|
18
|
-
typeof getCustomerBusinessProfilesForCustomerQuerySchema
|
|
19
|
-
>
|
|
20
|
-
|
|
21
|
-
export const getCustomerBusinessProfilesForCustomerInputSchema = z.undefined()
|
|
22
|
-
export type GetCustomerBusinessProfilesForCustomerInput = z.input<
|
|
23
|
-
typeof getCustomerBusinessProfilesForCustomerInputSchema
|
|
24
|
-
>
|
|
25
|
-
|
|
26
|
-
export const getCustomerBusinessProfilesForCustomerResponseSchema = z.array(
|
|
27
|
-
customerBusinessProfileSchema,
|
|
28
|
-
)
|
|
29
|
-
export type GetCustomerBusinessProfilesForCustomerResponse = z.infer<
|
|
30
|
-
typeof getCustomerBusinessProfilesForCustomerResponseSchema
|
|
31
|
-
>
|
|
32
|
-
|
|
33
|
-
export class GetCustomerBusinessProfilesForCustomer extends AbstractApiRequest<
|
|
34
|
-
typeof getCustomerBusinessProfilesForCustomerInputSchema,
|
|
35
|
-
typeof getCustomerBusinessProfilesForCustomerResponseSchema,
|
|
36
|
-
GetCustomerBusinessProfilesForCustomerQueryParams
|
|
37
|
-
> {
|
|
38
|
-
readonly method = 'GET'
|
|
39
|
-
readonly contentType = 'application/json'
|
|
40
|
-
readonly accept = 'application/json'
|
|
41
|
-
|
|
42
|
-
readonly inputSchema = getCustomerBusinessProfilesForCustomerInputSchema
|
|
43
|
-
readonly outputSchema = getCustomerBusinessProfilesForCustomerResponseSchema
|
|
44
|
-
readonly querySchema = getCustomerBusinessProfilesForCustomerQuerySchema
|
|
45
|
-
readonly headersSchema = undefined
|
|
46
|
-
|
|
47
|
-
private readonly customerId: string
|
|
48
|
-
|
|
49
|
-
constructor(
|
|
50
|
-
customerId: string,
|
|
51
|
-
options?: { query?: GetCustomerBusinessProfilesForCustomerQueryParams },
|
|
52
|
-
) {
|
|
53
|
-
super(undefined, options)
|
|
54
|
-
this.customerId = customerId
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
getPath(): string {
|
|
58
|
-
return `/customers/${this.customerId}/business_profiles`
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
parseResponse(data: unknown): CustomerBusinessProfile[] {
|
|
62
|
-
return z.array(customerBusinessProfileSchema).parse(data)
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
|
-
import { z } from 'zod'
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
customerBusinessProfileDetailsSchema,
|
|
6
|
-
writableCustomerBusinessProfileSchema,
|
|
7
|
-
} from '../../models'
|
|
8
|
-
|
|
9
|
-
export const updateCustomerBusinessProfileInputSchema =
|
|
10
|
-
writableCustomerBusinessProfileSchema.partial()
|
|
11
|
-
export type UpdateCustomerBusinessProfileInput = z.input<
|
|
12
|
-
typeof updateCustomerBusinessProfileInputSchema
|
|
13
|
-
>
|
|
14
|
-
|
|
15
|
-
export const updateCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema
|
|
16
|
-
export type UpdateCustomerBusinessProfileResponse = z.output<
|
|
17
|
-
typeof updateCustomerBusinessProfileResponseSchema
|
|
18
|
-
>
|
|
19
|
-
|
|
20
|
-
export class UpdateCustomerBusinessProfile extends AbstractApiRequest<
|
|
21
|
-
typeof updateCustomerBusinessProfileInputSchema,
|
|
22
|
-
typeof updateCustomerBusinessProfileResponseSchema
|
|
23
|
-
> {
|
|
24
|
-
readonly method = 'PATCH'
|
|
25
|
-
readonly contentType = 'application/merge-patch+json'
|
|
26
|
-
readonly accept = 'application/json'
|
|
27
|
-
|
|
28
|
-
readonly inputSchema = updateCustomerBusinessProfileInputSchema
|
|
29
|
-
readonly outputSchema = updateCustomerBusinessProfileResponseSchema
|
|
30
|
-
readonly querySchema = undefined
|
|
31
|
-
readonly headersSchema = undefined
|
|
32
|
-
|
|
33
|
-
private readonly customerId: string
|
|
34
|
-
|
|
35
|
-
constructor(customerId: string, input: UpdateCustomerBusinessProfileInput) {
|
|
36
|
-
super(input)
|
|
37
|
-
this.customerId = customerId
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
getPath(): string {
|
|
41
|
-
return `/customers/business_profiles/${this.customerId}`
|
|
42
|
-
}
|
|
43
|
-
}
|