|
1 | 1 | import FormData from 'form-data'; |
2 | 2 | import { type ArcAPIOptions, ArcAbstractAPI } from '../abstract-api.js'; |
3 | 3 | import type { |
| 4 | + CreateEnterpriseGroupParams, |
4 | 5 | CreateEnterpriseGroupPayload, |
5 | 6 | CreateEnterpriseGroupResponse, |
| 7 | + CreateNonceResponse, |
6 | 8 | MigrateBatchSubscriptionsParams, |
7 | 9 | MigrateBatchSubscriptionsPayload, |
8 | 10 | MigrateBatchSubscriptionsResponse, |
@@ -33,8 +35,31 @@ export class ArcSalesV2 extends ArcAbstractAPI { |
33 | 35 | super({ ...options, apiPath: 'sales/api/v2' }); |
34 | 36 | } |
35 | 37 |
|
36 | | - async createEnterpriseGroup(payload: CreateEnterpriseGroupPayload): Promise<CreateEnterpriseGroupResponse> { |
37 | | - const { data } = await this.client.post<CreateEnterpriseGroupResponse>('/subscriptions/enterprise', payload); |
| 38 | + async getEnterpriseGroups(params: CreateEnterpriseGroupParams): Promise<CreateEnterpriseGroupResponse> { |
| 39 | + const { data } = await this.client.get<any>('/subscriptions/enterprise', { |
| 40 | + params: { |
| 41 | + 'arc-site': params.site, |
| 42 | + }, |
| 43 | + }); |
| 44 | + return data; |
| 45 | + } |
| 46 | + |
| 47 | + async createEnterpriseGroup( |
| 48 | + params: CreateEnterpriseGroupParams, |
| 49 | + payload: CreateEnterpriseGroupPayload |
| 50 | + ): Promise<CreateEnterpriseGroupResponse> { |
| 51 | + const { data } = await this.client.post<CreateEnterpriseGroupResponse>('/subscriptions/enterprise', payload, { |
| 52 | + params: { |
| 53 | + 'arc-site': params.site, |
| 54 | + }, |
| 55 | + }); |
| 56 | + return data; |
| 57 | + } |
| 58 | + |
| 59 | + async createNonce(website: string, enterpriseGroupId: number) { |
| 60 | + const { data } = await this.client.get<CreateNonceResponse>(`/subscriptions/enterprise/${enterpriseGroupId}`, { |
| 61 | + params: { 'arc-site': website }, |
| 62 | + }); |
38 | 63 | return data; |
39 | 64 | } |
40 | 65 | } |
0 commit comments