Skip to content

Commit

Permalink
feat: add duplicate shop endpoint (#161)
Browse files Browse the repository at this point in the history
Adds a separate POST shops/duplicate endpoint for shop creation
purposes.
  • Loading branch information
remcohendriks authored Apr 16, 2024
1 parent fcc8584 commit 5c80d3f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/__snapshots__/index.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ exports[`module exports > exposes the correct data from index.ts 1`] = `
"PostCarrierOptions": [Function],
"PostShipments": [Function],
"PostShop": [Function],
"PostShopDuplicate": [Function],
"PostSubscriptions": [Function],
"PostWebhookSubscriptions": [Function],
"PutAccount": [Function],
Expand Down
20 changes: 20 additions & 0 deletions src/endpoints/private/shops/PostShopDuplicate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {AbstractPrivateEndpoint} from '@/model/endpoint/AbstractPrivateEndpoint';
import {type CreateDefinition} from '@/model/endpoint/AbstractEndpoint.types';
import {type HttpMethod} from '@/types/request.types';
import {type DuplicateShop} from './Shop.types';

type PostShopDuplicateDefinition = CreateDefinition<{
name: typeof PostShopDuplicate.name;
body: DuplicateShop[];
response: {ids: [{id: number}]};
}>;

/**
* The PostShopDuplicate endpoint is used to add a new shop.
*/
export class PostShopDuplicate extends AbstractPrivateEndpoint<PostShopDuplicateDefinition> {
public readonly method: HttpMethod = 'POST';
public readonly name = 'postShopDuplicate';
public readonly path = 'shops/duplicate';
public readonly property = 'ids';
}
5 changes: 5 additions & 0 deletions src/endpoints/private/shops/Shop.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ export interface MyParcelShop {
return: ShopReturn;
tracktrace: ShopTrackTrace;
}

export interface DuplicateShop {
name: string;
account_id: number;
}
1 change: 1 addition & 0 deletions src/endpoints/private/shops/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ export * from './GetShop';
export * from './PostShop';
export * from './PutShop';
export * from './Shop.types';
export * from './PostShopDuplicate';

0 comments on commit 5c80d3f

Please sign in to comment.