@strimz/sdk 0.7.0 → 0.8.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 +4 -2
- package/dist/browser-client.cjs.map +1 -1
- package/dist/browser-client.js.map +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/index.cjs +29 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -6
- package/dist/index.d.ts +3 -6
- package/dist/index.js +30 -18
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/client.ts +49 -6
- package/src/errors.ts +1 -0
- package/src/index.ts +0 -1
- package/src/resources/merchants.ts +2 -19
- package/src/resources/subscriptions.ts +0 -7
|
@@ -1,26 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
updateMerchantInputSchema,
|
|
4
|
-
changeTierInputSchema,
|
|
5
|
-
type Merchant,
|
|
6
|
-
type UpdateMerchantInput,
|
|
7
|
-
type ChangeTierInput,
|
|
8
|
-
} from '@strimz/shared-types'
|
|
9
|
-
import { BaseResource, type RequestOptions } from './base-resource.js'
|
|
1
|
+
import { merchantSchema, type Merchant } from '@strimz/shared-types'
|
|
2
|
+
import { BaseResource } from './base-resource.js'
|
|
10
3
|
|
|
11
4
|
export class MerchantsResource extends BaseResource {
|
|
12
5
|
/** The merchant the API key belongs to. */
|
|
13
6
|
me(): Promise<Merchant> {
|
|
14
7
|
return this.get('/v1/merchants/me', merchantSchema)
|
|
15
8
|
}
|
|
16
|
-
|
|
17
|
-
update(input: UpdateMerchantInput, options?: RequestOptions): Promise<Merchant> {
|
|
18
|
-
updateMerchantInputSchema.parse(input)
|
|
19
|
-
return this.patch('/v1/merchants/me', input, merchantSchema, options)
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
changeTier(input: ChangeTierInput, options?: RequestOptions): Promise<Merchant> {
|
|
23
|
-
changeTierInputSchema.parse(input)
|
|
24
|
-
return this.post('/v1/merchants/me/tier', input, merchantSchema, options)
|
|
25
|
-
}
|
|
26
9
|
}
|
|
@@ -1,20 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
subscriptionSchema,
|
|
3
|
-
createSubscriptionInputSchema,
|
|
4
3
|
cancelSubscriptionInputSchema,
|
|
5
4
|
type Subscription,
|
|
6
|
-
type CreateSubscriptionInput,
|
|
7
5
|
type CancelSubscriptionInput,
|
|
8
6
|
} from '@strimz/shared-types'
|
|
9
7
|
import type { PaginationParams, Page } from '../pagination.js'
|
|
10
8
|
import { BaseResource, type RequestOptions } from './base-resource.js'
|
|
11
9
|
|
|
12
10
|
export class SubscriptionsResource extends BaseResource {
|
|
13
|
-
create(input: CreateSubscriptionInput, options?: RequestOptions): Promise<Subscription> {
|
|
14
|
-
createSubscriptionInputSchema.parse(input)
|
|
15
|
-
return this.post('/v1/subscriptions', input, subscriptionSchema, options)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
11
|
retrieve(id: string): Promise<Subscription> {
|
|
19
12
|
return this.get(`/v1/subscriptions/${encodeURIComponent(id)}`, subscriptionSchema)
|
|
20
13
|
}
|