Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
feat: add Shop.current method to other versions
Browse files Browse the repository at this point in the history
  • Loading branch information
nullndr committed Apr 2, 2024
1 parent afbc960 commit 8e151f5
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2022-10/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-01/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-04/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-07/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down
16 changes: 16 additions & 0 deletions packages/shopify-api/rest/admin/2023-10/shop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@ export class Shop extends Base {
}
];

public static async current(
{
session,
fields = null,
...otherArgs
}: AllArgs
): Promise<Shop | null> {
const result = await this.baseFind<Shop>({
session: session,
urlIds: {},
params: {"fields": fields, ...otherArgs},
});

return result.data ? result.data[0] : null;
}

public static async all(
{
session,
Expand Down

0 comments on commit 8e151f5

Please sign in to comment.