@deliverart/sdk-js-customer 0.0.4 → 0.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +156 -181
- package/dist/index.d.cts +406 -304
- package/dist/index.d.ts +406 -304
- package/dist/index.js +139 -165
- package/package.json +5 -5
- package/src/models.ts +41 -12
- package/src/requests/customer-addresses/CreateCustomerAddress.ts +6 -10
- package/src/requests/customer-addresses/DeleteCustomerAddress.ts +5 -2
- package/src/requests/customer-addresses/GetCustomerAddressDetails.ts +7 -4
- package/src/requests/customer-addresses/GetCustomerAddresses.ts +5 -4
- package/src/requests/customer-addresses/GetCustomerAddressesForCustomer.ts +7 -4
- package/src/requests/customer-addresses/UpdateCustomerAddress.ts +5 -9
- package/src/requests/customer-business-profiles/CreateCustomerBusinessProfile.ts +6 -5
- package/src/requests/customer-business-profiles/DeleteCustomerBusinessProfile.ts +5 -2
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfileDetails.ts +10 -5
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfiles.ts +7 -4
- package/src/requests/customer-business-profiles/GetCustomerBusinessProfilesForCustomer.ts +7 -4
- package/src/requests/customer-business-profiles/UpdateCustomerBusinessProfile.ts +6 -5
- package/src/requests/customers/CreateCustomer.ts +5 -5
- package/src/requests/customers/DeleteCustomer.ts +5 -2
- package/src/requests/customers/GetCustomerDetails.ts +8 -4
- package/src/requests/customers/GetCustomers.ts +7 -32
- package/src/requests/customers/UpdateCustomer.ts +5 -5
- package/src/types.ts +16 -58
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
CustomerAddressDetails,
|
|
6
|
-
customerAddressDetailsSchema,
|
|
7
|
-
writableCreateCustomerAddressSchema,
|
|
8
|
-
} from '../../models'
|
|
4
|
+
import { customerAddressDetailsSchema, writableCreateCustomerAddressSchema } from '../../models'
|
|
9
5
|
|
|
10
6
|
export const createCustomerAddressInputSchema = writableCreateCustomerAddressSchema.required()
|
|
11
|
-
export type CreateCustomerAddressInput = z.
|
|
7
|
+
export type CreateCustomerAddressInput = z.input<typeof createCustomerAddressInputSchema>
|
|
12
8
|
|
|
13
9
|
export const createCustomerAddressResponseSchema = customerAddressDetailsSchema
|
|
14
|
-
export type CreateCustomerAddressResponse =
|
|
10
|
+
export type CreateCustomerAddressResponse = z.infer<typeof createCustomerAddressResponseSchema>
|
|
15
11
|
|
|
16
12
|
export class CreateCustomerAddress extends AbstractApiRequest<
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
typeof createCustomerAddressInputSchema,
|
|
14
|
+
typeof createCustomerAddressResponseSchema
|
|
19
15
|
> {
|
|
20
16
|
readonly method = 'POST'
|
|
21
17
|
readonly contentType = 'application/json'
|
|
@@ -26,7 +22,7 @@ export class CreateCustomerAddress extends AbstractApiRequest<
|
|
|
26
22
|
readonly querySchema = undefined
|
|
27
23
|
readonly headersSchema = undefined
|
|
28
24
|
|
|
29
|
-
constructor(input:
|
|
25
|
+
constructor(input: z.input<typeof createCustomerAddressInputSchema>) {
|
|
30
26
|
super(input)
|
|
31
27
|
}
|
|
32
28
|
|
|
@@ -4,7 +4,10 @@ import { z } from 'zod'
|
|
|
4
4
|
export const deleteCustomerAddressInputSchema = z.undefined()
|
|
5
5
|
export const deleteCustomerAddressResponseSchema = z.undefined()
|
|
6
6
|
|
|
7
|
-
export class DeleteCustomerAddress extends AbstractApiRequest<
|
|
7
|
+
export class DeleteCustomerAddress extends AbstractApiRequest<
|
|
8
|
+
typeof deleteCustomerAddressInputSchema,
|
|
9
|
+
typeof deleteCustomerAddressResponseSchema
|
|
10
|
+
> {
|
|
8
11
|
readonly method = 'DELETE'
|
|
9
12
|
readonly contentType = 'application/json'
|
|
10
13
|
readonly accept = 'application/json'
|
|
@@ -17,7 +20,7 @@ export class DeleteCustomerAddress extends AbstractApiRequest<void, void> {
|
|
|
17
20
|
private readonly customerAddressId: string
|
|
18
21
|
|
|
19
22
|
constructor(customerAddressId: string) {
|
|
20
|
-
super()
|
|
23
|
+
super(undefined)
|
|
21
24
|
this.customerAddressId = customerAddressId
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -4,13 +4,16 @@ import { z } from 'zod'
|
|
|
4
4
|
import { CustomerAddressDetails, customerAddressDetailsSchema } from '../../models'
|
|
5
5
|
|
|
6
6
|
export const getCustomerAddressDetailsInputSchema = z.undefined()
|
|
7
|
+
export type GetCustomerAddressDetailsInput = z.input<typeof getCustomerAddressDetailsInputSchema>
|
|
7
8
|
|
|
8
9
|
export const getCustomerAddressDetailsResponseSchema = customerAddressDetailsSchema
|
|
9
|
-
export type GetCustomerAddressDetailsResponse =
|
|
10
|
+
export type GetCustomerAddressDetailsResponse = z.infer<
|
|
11
|
+
typeof getCustomerAddressDetailsResponseSchema
|
|
12
|
+
>
|
|
10
13
|
|
|
11
14
|
export class GetCustomerAddressDetails extends AbstractApiRequest<
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
typeof getCustomerAddressDetailsInputSchema,
|
|
16
|
+
typeof getCustomerAddressDetailsResponseSchema
|
|
14
17
|
> {
|
|
15
18
|
readonly method = 'GET'
|
|
16
19
|
readonly contentType = 'application/json'
|
|
@@ -23,7 +26,7 @@ export class GetCustomerAddressDetails extends AbstractApiRequest<
|
|
|
23
26
|
private readonly customerAddressId: string
|
|
24
27
|
|
|
25
28
|
constructor(customerAddressId: string) {
|
|
26
|
-
super()
|
|
29
|
+
super(undefined)
|
|
27
30
|
this.customerAddressId = customerAddressId
|
|
28
31
|
}
|
|
29
32
|
|
|
@@ -20,14 +20,15 @@ export const getCustomerAddressesQuerySchema = z
|
|
|
20
20
|
.merge(timestampsFilterSchema)
|
|
21
21
|
export type GetCustomerAddressesQueryParams = z.infer<typeof getCustomerAddressesQuerySchema>
|
|
22
22
|
|
|
23
|
+
export const getCustomerAddressesInputSchema = z.undefined()
|
|
24
|
+
export type GetCustomerAddressesInput = z.input<typeof getCustomerAddressesInputSchema>
|
|
25
|
+
|
|
23
26
|
export const getCustomerAddressesResponseSchema = createPaginatedSchema(customerAddressSchema)
|
|
24
27
|
export type GetCustomerAddressesResponse = z.infer<typeof getCustomerAddressesResponseSchema>
|
|
25
28
|
|
|
26
|
-
export const getCustomerAddressesInputSchema = z.undefined()
|
|
27
|
-
|
|
28
29
|
export class GetCustomerAddresses extends AbstractApiRequest<
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
typeof getCustomerAddressesInputSchema,
|
|
31
|
+
typeof getCustomerAddressesResponseSchema,
|
|
31
32
|
GetCustomerAddressesQueryParams
|
|
32
33
|
> {
|
|
33
34
|
readonly method = 'GET'
|
|
@@ -14,16 +14,19 @@ export type GetCustomerAddressesForCustomerQueryParams = z.infer<
|
|
|
14
14
|
typeof getCustomerAddressesForCustomerQuerySchema
|
|
15
15
|
>
|
|
16
16
|
|
|
17
|
+
export const getCustomerAddressesForCustomerInputSchema = z.undefined()
|
|
18
|
+
export type GetCustomerAddressesForCustomerInput = z.input<
|
|
19
|
+
typeof getCustomerAddressesForCustomerInputSchema
|
|
20
|
+
>
|
|
21
|
+
|
|
17
22
|
export const getCustomerAddressesForCustomerResponseSchema = z.array(customerAddressSchema)
|
|
18
23
|
export type GetCustomerAddressesForCustomerResponse = z.infer<
|
|
19
24
|
typeof getCustomerAddressesForCustomerResponseSchema
|
|
20
25
|
>
|
|
21
26
|
|
|
22
|
-
export const getCustomerAddressesForCustomerInputSchema = z.undefined()
|
|
23
|
-
|
|
24
27
|
export class GetCustomerAddressesForCustomer extends AbstractApiRequest<
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
typeof getCustomerAddressesForCustomerInputSchema,
|
|
29
|
+
typeof getCustomerAddressesForCustomerResponseSchema,
|
|
27
30
|
GetCustomerAddressesForCustomerQueryParams
|
|
28
31
|
> {
|
|
29
32
|
readonly method = 'GET'
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
CustomerAddressDetails,
|
|
6
|
-
customerAddressDetailsSchema,
|
|
7
|
-
writableCustomerAddressSchema,
|
|
8
|
-
} from '../../models'
|
|
4
|
+
import { customerAddressDetailsSchema, writableCustomerAddressSchema } from '../../models'
|
|
9
5
|
|
|
10
6
|
export const updateCustomerAddressInputSchema = writableCustomerAddressSchema.partial()
|
|
11
|
-
export type UpdateCustomerAddressInput = z.
|
|
7
|
+
export type UpdateCustomerAddressInput = z.input<typeof updateCustomerAddressInputSchema>
|
|
12
8
|
|
|
13
9
|
export const updateCustomerAddressResponseSchema = customerAddressDetailsSchema
|
|
14
|
-
export type UpdateCustomerAddressResponse =
|
|
10
|
+
export type UpdateCustomerAddressResponse = z.infer<typeof updateCustomerAddressResponseSchema>
|
|
15
11
|
|
|
16
12
|
export class UpdateCustomerAddress extends AbstractApiRequest<
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
typeof updateCustomerAddressInputSchema,
|
|
14
|
+
typeof updateCustomerAddressResponseSchema
|
|
19
15
|
> {
|
|
20
16
|
readonly method = 'PATCH'
|
|
21
17
|
readonly contentType = 'application/merge-patch+json'
|
|
@@ -2,23 +2,24 @@ import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
CustomerBusinessProfileDetails,
|
|
6
5
|
customerBusinessProfileDetailsSchema,
|
|
7
6
|
writableCreateCustomerBusinessProfileSchema,
|
|
8
7
|
} from '../../models'
|
|
9
8
|
|
|
10
9
|
export const createCustomerBusinessProfileInputSchema =
|
|
11
10
|
writableCreateCustomerBusinessProfileSchema.required()
|
|
12
|
-
export type CreateCustomerBusinessProfileInput = z.
|
|
11
|
+
export type CreateCustomerBusinessProfileInput = z.input<
|
|
13
12
|
typeof createCustomerBusinessProfileInputSchema
|
|
14
13
|
>
|
|
15
14
|
|
|
16
15
|
export const createCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema
|
|
17
|
-
export type CreateCustomerBusinessProfileResponse =
|
|
16
|
+
export type CreateCustomerBusinessProfileResponse = z.infer<
|
|
17
|
+
typeof createCustomerBusinessProfileResponseSchema
|
|
18
|
+
>
|
|
18
19
|
|
|
19
20
|
export class CreateCustomerBusinessProfile extends AbstractApiRequest<
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
typeof createCustomerBusinessProfileInputSchema,
|
|
22
|
+
typeof createCustomerBusinessProfileResponseSchema
|
|
22
23
|
> {
|
|
23
24
|
readonly method = 'POST'
|
|
24
25
|
readonly contentType = 'application/json'
|
|
@@ -4,7 +4,10 @@ import { z } from 'zod'
|
|
|
4
4
|
export const deleteCustomerBusinessProfileInputSchema = z.undefined()
|
|
5
5
|
export const deleteCustomerBusinessProfileResponseSchema = z.undefined()
|
|
6
6
|
|
|
7
|
-
export class DeleteCustomerBusinessProfile extends AbstractApiRequest<
|
|
7
|
+
export class DeleteCustomerBusinessProfile extends AbstractApiRequest<
|
|
8
|
+
typeof deleteCustomerBusinessProfileInputSchema,
|
|
9
|
+
typeof deleteCustomerBusinessProfileResponseSchema
|
|
10
|
+
> {
|
|
8
11
|
readonly method = 'DELETE'
|
|
9
12
|
readonly contentType = 'application/json'
|
|
10
13
|
readonly accept = 'application/json'
|
|
@@ -17,7 +20,7 @@ export class DeleteCustomerBusinessProfile extends AbstractApiRequest<void, void
|
|
|
17
20
|
private readonly customerBusinessProfileId: string
|
|
18
21
|
|
|
19
22
|
constructor(customerBusinessProfileId: string) {
|
|
20
|
-
super()
|
|
23
|
+
super(undefined)
|
|
21
24
|
this.customerBusinessProfileId = customerBusinessProfileId
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { customerBusinessProfileDetailsSchema } from '../../models'
|
|
5
5
|
|
|
6
6
|
export const getCustomerBusinessProfileDetailsInputSchema = z.undefined()
|
|
7
|
+
export type GetCustomerBusinessProfileDetailsInput = z.infer<
|
|
8
|
+
typeof getCustomerBusinessProfileDetailsInputSchema
|
|
9
|
+
>
|
|
7
10
|
|
|
8
11
|
export const getCustomerBusinessProfileDetailsResponseSchema = customerBusinessProfileDetailsSchema
|
|
9
|
-
export type GetCustomerBusinessProfileDetailsResponse =
|
|
12
|
+
export type GetCustomerBusinessProfileDetailsResponse = z.infer<
|
|
13
|
+
typeof getCustomerBusinessProfileDetailsResponseSchema
|
|
14
|
+
>
|
|
10
15
|
|
|
11
16
|
export class GetCustomerBusinessProfileDetails extends AbstractApiRequest<
|
|
12
|
-
|
|
13
|
-
|
|
17
|
+
typeof getCustomerBusinessProfileDetailsInputSchema,
|
|
18
|
+
typeof getCustomerBusinessProfileDetailsResponseSchema
|
|
14
19
|
> {
|
|
15
20
|
readonly method = 'GET'
|
|
16
21
|
readonly contentType = 'application/json'
|
|
@@ -23,7 +28,7 @@ export class GetCustomerBusinessProfileDetails extends AbstractApiRequest<
|
|
|
23
28
|
private readonly customerBusinessProfileId: string
|
|
24
29
|
|
|
25
30
|
constructor(customerBusinessProfileId: string) {
|
|
26
|
-
super()
|
|
31
|
+
super(undefined)
|
|
27
32
|
this.customerBusinessProfileId = customerBusinessProfileId
|
|
28
33
|
}
|
|
29
34
|
|
|
@@ -26,6 +26,11 @@ export type GetCustomerBusinessProfilesQueryParams = z.infer<
|
|
|
26
26
|
typeof getCustomerBusinessProfilesQuerySchema
|
|
27
27
|
>
|
|
28
28
|
|
|
29
|
+
export const getCustomerBusinessProfilesInputSchema = z.undefined()
|
|
30
|
+
export type GetCustomerBusinessProfilesInput = z.infer<
|
|
31
|
+
typeof getCustomerBusinessProfilesInputSchema
|
|
32
|
+
>
|
|
33
|
+
|
|
29
34
|
export const getCustomerBusinessProfilesResponseSchema = createPaginatedSchema(
|
|
30
35
|
customerBusinessProfileSchema,
|
|
31
36
|
)
|
|
@@ -33,11 +38,9 @@ export type GetCustomerBusinessProfilesResponse = z.infer<
|
|
|
33
38
|
typeof getCustomerBusinessProfilesResponseSchema
|
|
34
39
|
>
|
|
35
40
|
|
|
36
|
-
export const getCustomerBusinessProfilesInputSchema = z.undefined()
|
|
37
|
-
|
|
38
41
|
export class GetCustomerBusinessProfiles extends AbstractApiRequest<
|
|
39
|
-
|
|
40
|
-
|
|
42
|
+
typeof getCustomerBusinessProfilesInputSchema,
|
|
43
|
+
typeof getCustomerBusinessProfilesResponseSchema,
|
|
41
44
|
GetCustomerBusinessProfilesQueryParams
|
|
42
45
|
> {
|
|
43
46
|
readonly method = 'GET'
|
|
@@ -18,6 +18,11 @@ export type GetCustomerBusinessProfilesForCustomerQueryParams = z.infer<
|
|
|
18
18
|
typeof getCustomerBusinessProfilesForCustomerQuerySchema
|
|
19
19
|
>
|
|
20
20
|
|
|
21
|
+
export const getCustomerBusinessProfilesForCustomerInputSchema = z.undefined()
|
|
22
|
+
export type GetCustomerBusinessProfilesForCustomerInput = z.input<
|
|
23
|
+
typeof getCustomerBusinessProfilesForCustomerInputSchema
|
|
24
|
+
>
|
|
25
|
+
|
|
21
26
|
export const getCustomerBusinessProfilesForCustomerResponseSchema = z.array(
|
|
22
27
|
customerBusinessProfileSchema,
|
|
23
28
|
)
|
|
@@ -25,11 +30,9 @@ export type GetCustomerBusinessProfilesForCustomerResponse = z.infer<
|
|
|
25
30
|
typeof getCustomerBusinessProfilesForCustomerResponseSchema
|
|
26
31
|
>
|
|
27
32
|
|
|
28
|
-
export const getCustomerBusinessProfilesForCustomerInputSchema = z.undefined()
|
|
29
|
-
|
|
30
33
|
export class GetCustomerBusinessProfilesForCustomer extends AbstractApiRequest<
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
typeof getCustomerBusinessProfilesForCustomerInputSchema,
|
|
35
|
+
typeof getCustomerBusinessProfilesForCustomerResponseSchema,
|
|
33
36
|
GetCustomerBusinessProfilesForCustomerQueryParams
|
|
34
37
|
> {
|
|
35
38
|
readonly method = 'GET'
|
|
@@ -2,23 +2,24 @@ import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
CustomerBusinessProfileDetails,
|
|
6
5
|
customerBusinessProfileDetailsSchema,
|
|
7
6
|
writableCustomerBusinessProfileSchema,
|
|
8
7
|
} from '../../models'
|
|
9
8
|
|
|
10
9
|
export const updateCustomerBusinessProfileInputSchema =
|
|
11
10
|
writableCustomerBusinessProfileSchema.partial()
|
|
12
|
-
export type UpdateCustomerBusinessProfileInput = z.
|
|
11
|
+
export type UpdateCustomerBusinessProfileInput = z.input<
|
|
13
12
|
typeof updateCustomerBusinessProfileInputSchema
|
|
14
13
|
>
|
|
15
14
|
|
|
16
15
|
export const updateCustomerBusinessProfileResponseSchema = customerBusinessProfileDetailsSchema
|
|
17
|
-
export type UpdateCustomerBusinessProfileResponse =
|
|
16
|
+
export type UpdateCustomerBusinessProfileResponse = z.output<
|
|
17
|
+
typeof updateCustomerBusinessProfileResponseSchema
|
|
18
|
+
>
|
|
18
19
|
|
|
19
20
|
export class UpdateCustomerBusinessProfile extends AbstractApiRequest<
|
|
20
|
-
|
|
21
|
-
|
|
21
|
+
typeof updateCustomerBusinessProfileInputSchema,
|
|
22
|
+
typeof updateCustomerBusinessProfileResponseSchema
|
|
22
23
|
> {
|
|
23
24
|
readonly method = 'PATCH'
|
|
24
25
|
readonly contentType = 'application/merge-patch+json'
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { customerDetailsSchema, writableCreateCustomerSchema } from '../../models'
|
|
5
5
|
|
|
6
6
|
export const createCustomerInputSchema = writableCreateCustomerSchema.required()
|
|
7
|
-
export type CreateCustomerInput = z.
|
|
7
|
+
export type CreateCustomerInput = z.input<typeof createCustomerInputSchema>
|
|
8
8
|
|
|
9
9
|
export const createCustomerResponseSchema = customerDetailsSchema
|
|
10
|
-
export type CreateCustomerResponse =
|
|
10
|
+
export type CreateCustomerResponse = z.output<typeof createCustomerResponseSchema>
|
|
11
11
|
|
|
12
12
|
export class CreateCustomer extends AbstractApiRequest<
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
typeof createCustomerInputSchema,
|
|
14
|
+
typeof createCustomerResponseSchema
|
|
15
15
|
> {
|
|
16
16
|
readonly method = 'POST'
|
|
17
17
|
readonly contentType = 'application/json'
|
|
@@ -4,7 +4,10 @@ import { z } from 'zod'
|
|
|
4
4
|
export const deleteCustomerInputSchema = z.undefined()
|
|
5
5
|
export const deleteCustomerResponseSchema = z.undefined()
|
|
6
6
|
|
|
7
|
-
export class DeleteCustomer extends AbstractApiRequest<
|
|
7
|
+
export class DeleteCustomer extends AbstractApiRequest<
|
|
8
|
+
typeof deleteCustomerInputSchema,
|
|
9
|
+
typeof deleteCustomerResponseSchema
|
|
10
|
+
> {
|
|
8
11
|
readonly method = 'DELETE'
|
|
9
12
|
readonly contentType = 'application/json'
|
|
10
13
|
readonly accept = 'application/json'
|
|
@@ -17,7 +20,7 @@ export class DeleteCustomer extends AbstractApiRequest<void, void> {
|
|
|
17
20
|
private readonly customerId: string
|
|
18
21
|
|
|
19
22
|
constructor(customerId: string) {
|
|
20
|
-
super()
|
|
23
|
+
super(undefined)
|
|
21
24
|
this.customerId = customerId
|
|
22
25
|
}
|
|
23
26
|
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { customerDetailsSchema } from '../../models'
|
|
5
5
|
|
|
6
6
|
export const getCustomerDetailsInputSchema = z.undefined()
|
|
7
|
+
export type GetCustomerDetailsInput = z.infer<typeof getCustomerDetailsInputSchema>
|
|
7
8
|
|
|
8
9
|
export const getCustomerDetailsResponseSchema = customerDetailsSchema
|
|
9
|
-
export type GetCustomerDetailsResponse =
|
|
10
|
+
export type GetCustomerDetailsResponse = z.infer<typeof getCustomerDetailsResponseSchema>
|
|
10
11
|
|
|
11
|
-
export class GetCustomerDetails extends AbstractApiRequest<
|
|
12
|
+
export class GetCustomerDetails extends AbstractApiRequest<
|
|
13
|
+
typeof getCustomerDetailsInputSchema,
|
|
14
|
+
typeof getCustomerDetailsResponseSchema
|
|
15
|
+
> {
|
|
12
16
|
readonly method = 'GET'
|
|
13
17
|
readonly contentType = 'application/json'
|
|
14
18
|
readonly accept = 'application/json'
|
|
@@ -20,7 +24,7 @@ export class GetCustomerDetails extends AbstractApiRequest<void, GetCustomerDeta
|
|
|
20
24
|
private readonly customerId: string
|
|
21
25
|
|
|
22
26
|
constructor(customerId: string) {
|
|
23
|
-
super()
|
|
27
|
+
super(undefined)
|
|
24
28
|
this.customerId = customerId
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -3,49 +3,24 @@ import {
|
|
|
3
3
|
createPaginatedSchema,
|
|
4
4
|
Paginated,
|
|
5
5
|
responseToPagination,
|
|
6
|
-
sortDirSchema,
|
|
7
|
-
timestampsFilterSchema,
|
|
8
6
|
} from '@deliverart/sdk-js-global-types'
|
|
9
7
|
import { AxiosResponse } from 'axios'
|
|
10
8
|
import { z } from 'zod'
|
|
11
9
|
|
|
12
|
-
import { Customer, customerSchema } from '../../models'
|
|
10
|
+
import { Customer, customerSchema, customersQuerySchema } from '../../models'
|
|
13
11
|
|
|
14
|
-
export const getCustomersQuerySchema =
|
|
15
|
-
.object({
|
|
16
|
-
firstName: z.string().optional(),
|
|
17
|
-
lastName: z.string().optional(),
|
|
18
|
-
email: z.string().optional(),
|
|
19
|
-
phoneNumber: z.string().optional(),
|
|
20
|
-
hasBusinessProfiles: z.coerce.boolean().optional(),
|
|
21
|
-
hasAddresses: z.coerce.boolean().optional(),
|
|
22
|
-
'ordersPlaced[between]': z.coerce.number().optional(),
|
|
23
|
-
'ordersPlaced[gt]': z.coerce.number().optional(),
|
|
24
|
-
'ordersPlaced[gte]': z.coerce.number().optional(),
|
|
25
|
-
'ordersPlaced[lt]': z.coerce.number().optional(),
|
|
26
|
-
'ordersPlaced[lte]': z.coerce.number().optional(),
|
|
27
|
-
'totalSpent[between]': z.coerce.number().optional(),
|
|
28
|
-
'totalSpent[gt]': z.coerce.number().optional(),
|
|
29
|
-
'totalSpent[gte]': z.coerce.number().optional(),
|
|
30
|
-
'totalSpent[lt]': z.coerce.number().optional(),
|
|
31
|
-
'totalSpent[lte]': z.coerce.number().optional(),
|
|
32
|
-
'order[firstName]': sortDirSchema.optional(),
|
|
33
|
-
'order[lastName]': sortDirSchema.optional(),
|
|
34
|
-
'order[createdAt]': sortDirSchema.optional(),
|
|
35
|
-
'order[updatedAt]': sortDirSchema.optional(),
|
|
36
|
-
page: z.coerce.number().optional(),
|
|
37
|
-
})
|
|
38
|
-
.merge(timestampsFilterSchema)
|
|
12
|
+
export const getCustomersQuerySchema = customersQuerySchema
|
|
39
13
|
export type GetCustomersQueryParams = z.infer<typeof getCustomersQuerySchema>
|
|
40
14
|
|
|
15
|
+
export const getCustomersInputSchema = z.undefined()
|
|
16
|
+
export type GetCustomersInput = z.input<typeof getCustomersInputSchema>
|
|
17
|
+
|
|
41
18
|
export const getCustomersResponseSchema = createPaginatedSchema(customerSchema)
|
|
42
19
|
export type GetCustomersResponse = z.infer<typeof getCustomersResponseSchema>
|
|
43
20
|
|
|
44
|
-
export const getCustomersInputSchema = z.undefined()
|
|
45
|
-
|
|
46
21
|
export class GetCustomers extends AbstractApiRequest<
|
|
47
|
-
|
|
48
|
-
|
|
22
|
+
typeof getCustomersInputSchema,
|
|
23
|
+
typeof getCustomersResponseSchema,
|
|
49
24
|
GetCustomersQueryParams
|
|
50
25
|
> {
|
|
51
26
|
readonly method = 'GET'
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { AbstractApiRequest } from '@deliverart/sdk-js-core'
|
|
2
2
|
import { z } from 'zod'
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { customerDetailsSchema, writableCustomerSchema } from '../../models'
|
|
5
5
|
|
|
6
6
|
export const updateCustomerInputSchema = writableCustomerSchema.partial()
|
|
7
|
-
export type UpdateCustomerInput = z.
|
|
7
|
+
export type UpdateCustomerInput = z.input<typeof updateCustomerInputSchema>
|
|
8
8
|
|
|
9
9
|
export const updateCustomerResponseSchema = customerDetailsSchema
|
|
10
|
-
export type UpdateCustomerResponse =
|
|
10
|
+
export type UpdateCustomerResponse = z.infer<typeof updateCustomerResponseSchema>
|
|
11
11
|
|
|
12
12
|
export class UpdateCustomer extends AbstractApiRequest<
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
typeof updateCustomerInputSchema,
|
|
14
|
+
typeof updateCustomerResponseSchema
|
|
15
15
|
> {
|
|
16
16
|
readonly method = 'PATCH'
|
|
17
17
|
readonly contentType = 'application/merge-patch+json'
|
package/src/types.ts
CHANGED
|
@@ -1,66 +1,24 @@
|
|
|
1
|
+
import { iriNullableSchema, iriSchema } from '@deliverart/sdk-js-global-types'
|
|
1
2
|
import { z } from 'zod'
|
|
2
3
|
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
.refine(val => /^\/customers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
6
|
-
message: 'Invalid customer path format',
|
|
7
|
-
})
|
|
8
|
-
export type CustomerPath = z.infer<typeof customerPathSchema>
|
|
4
|
+
export const customerIriSchema = iriSchema('/customers/:id')
|
|
5
|
+
export type CustomerIri = z.infer<typeof customerIriSchema>
|
|
9
6
|
|
|
10
|
-
export const
|
|
11
|
-
|
|
12
|
-
.nullable()
|
|
13
|
-
.refine(
|
|
14
|
-
val => {
|
|
15
|
-
if (!val) return true
|
|
16
|
-
return /^\/customers\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
message: 'Invalid customer path format',
|
|
20
|
-
},
|
|
21
|
-
)
|
|
22
|
-
export type CustomerNullablePath = z.infer<typeof customerNullablePathSchema>
|
|
7
|
+
export const customerNullableIriSchema = iriNullableSchema('/customers/:id')
|
|
8
|
+
export type CustomerNullableIri = z.infer<typeof customerNullableIriSchema>
|
|
23
9
|
|
|
24
|
-
export const
|
|
25
|
-
|
|
26
|
-
.refine(val => /^\/customers\/addresses\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
27
|
-
message: 'Invalid customerAddress path format',
|
|
28
|
-
})
|
|
29
|
-
export type CustomerAddressPath = z.infer<typeof customerAddressPathSchema>
|
|
10
|
+
export const customerAddressIriSchema = iriSchema('/customers/address/:id')
|
|
11
|
+
export type CustomerAddressIri = z.infer<typeof customerAddressIriSchema>
|
|
30
12
|
|
|
31
|
-
export const
|
|
32
|
-
|
|
33
|
-
.nullable()
|
|
34
|
-
.refine(
|
|
35
|
-
val => {
|
|
36
|
-
if (!val) return true
|
|
37
|
-
return /^\/customers\/addresses\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
38
|
-
},
|
|
39
|
-
{
|
|
40
|
-
message: 'Invalid customerAddress path format',
|
|
41
|
-
},
|
|
42
|
-
)
|
|
43
|
-
export type CustomerAddressNullablePath = z.infer<typeof customerAddressNullablePathSchema>
|
|
13
|
+
export const customerAddressNullableIriSchema = iriNullableSchema('/customers/address/:id')
|
|
14
|
+
export type CustomerAddressNullableIri = z.infer<typeof customerAddressNullableIriSchema>
|
|
44
15
|
|
|
45
|
-
export const
|
|
46
|
-
|
|
47
|
-
.refine(val => /^\/customers\/business_profiles\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val), {
|
|
48
|
-
message: 'Invalid customerBusinessProfile path format',
|
|
49
|
-
})
|
|
50
|
-
export type CustomerBusinessProfilePath = z.infer<typeof customerBusinessProfilePathSchema>
|
|
16
|
+
export const customerBusinessProfileIriSchema = iriSchema('/customers/business_profiles/:id')
|
|
17
|
+
export type CustomerBusinessProfileIri = z.infer<typeof customerBusinessProfileIriSchema>
|
|
51
18
|
|
|
52
|
-
export const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
if (!val) return true
|
|
58
|
-
return /^\/customers\/business_profiles\/[a-z_]+\/[0-9a-fA-F-]{36}$/.test(val)
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
message: 'Invalid customerBusinessProfile path format',
|
|
62
|
-
},
|
|
63
|
-
)
|
|
64
|
-
export type CustomerBusinessProfileNullablePath = z.infer<
|
|
65
|
-
typeof customerBusinessProfileNullablePathSchema
|
|
19
|
+
export const customerBusinessProfileNullableIriSchema = iriNullableSchema(
|
|
20
|
+
'/customers/business_profiles/:id',
|
|
21
|
+
)
|
|
22
|
+
export type CustomerBusinessProfileNullableIri = z.infer<
|
|
23
|
+
typeof customerBusinessProfileNullableIriSchema
|
|
66
24
|
>
|