This repository has been archived by the owner on Dec 2, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Locations, InventoryLevels, InventoryItems and Fulfillment Support (#25)
* Adding fulfillment support * Removing options references * Adding casting * Revert "Adding casting" This reverts commit d04956c. * Found serious errors in my previous PR * add product variants service and export * Adding proper variant support * Fixing update * Adding inventory levels * Adding locations * - Updating list options for inventory levels - Fixing exports - Updating descriptions for inventory levels * - Updating location api description - Adding inventory items service - Adding proper inventory levels list options * Remove empty price rules options * Clean up product options * Fixing few bugs with inventory items * Exporting the object property correctly * Fixing root property for inventory levels * Making mandatory arguments live outside of the options param * Fixing fulfillments * Removed wrong filter options on product variant's count function
- Loading branch information
1 parent
5adf483
commit ed5ec08
Showing
22 changed files
with
325 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ShopifyObject } from "./base"; | ||
|
||
export interface InventoryItem extends ShopifyObject { | ||
/* | ||
* The date and time (ISO 8601 format) when the inventory item was created. | ||
*/ | ||
created_at?: string; | ||
|
||
/* | ||
* The unique SKU (stock keeping unit) of the inventory item. | ||
*/ | ||
sku?: string; | ||
|
||
/* | ||
* Whether the inventory item is tracked. If true, then inventory quantity changes are tracked by Shopify | ||
*/ | ||
tracked?: boolean; | ||
|
||
/* | ||
* The date and time (ISO 8601 format) when the inventory item was last modified. | ||
*/ | ||
updated_at?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { ShopifyObject } from "./base"; | ||
|
||
export interface InventoryLevel extends ShopifyObject { | ||
/* | ||
* The unique identifier of the inventory item that the inventory level belongs to | ||
*/ | ||
inventory_item_id?: number; | ||
|
||
/* | ||
* The unique identifier of the location that the inventory level belongs to. In order to find the ID of the location, use the Location API. | ||
*/ | ||
location_id?: number; | ||
|
||
/* | ||
* The quantity of inventory items available for sale. Returns null if the inventory item is not tracked. | ||
*/ | ||
available?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import { ShopifyObject } from './base'; | ||
|
||
export interface Location extends ShopifyObject { | ||
/** | ||
* The first line of the address. | ||
*/ | ||
address1?: string; | ||
|
||
/** | ||
* The second line of the address. | ||
*/ | ||
address2?: string; | ||
|
||
/** | ||
* The city the location is in. | ||
*/ | ||
city?: string; | ||
|
||
/** | ||
* The country the location is in. | ||
*/ | ||
country?: string; | ||
|
||
/** | ||
* The two-letter code (ISO 3166-1 alpha-2 format) corresponding to country the location is in. | ||
*/ | ||
country_code?: string; | ||
|
||
/** | ||
* The date and time (ISO 8601 format) when the location was created. | ||
*/ | ||
created_at?: string; | ||
|
||
/** | ||
* Whether this is a fulfillment service location. If true, then the location is a fulfillment service location. | ||
* If false, then the location was created by the merchant and isn't tied to a fulfillment service. | ||
*/ | ||
legacy?: string; | ||
|
||
/** | ||
* The name of the location. | ||
*/ | ||
name?: string; | ||
|
||
/** | ||
* The phone number of the location. This value can contain special characters like - and +. | ||
*/ | ||
phone?: string; | ||
|
||
/** | ||
* The province the location is in. | ||
*/ | ||
province?: string; | ||
|
||
/** | ||
* The two-letter code corresponding to province or state the location is in. | ||
*/ | ||
province_code?: string; | ||
|
||
/** | ||
* The date and time (ISO 8601 format) when the location was last updated. | ||
*/ | ||
updated_at?: string | ||
|
||
/** | ||
* The zip or postal code. | ||
*/ | ||
zip?: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { BasicListOptions } from "./base"; | ||
|
||
export interface InventoryItemListOptions extends BasicListOptions { | ||
/** | ||
* Show only certain inventory items, specified by a comma-seperated list of IDs.. | ||
*/ | ||
ids: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { BasicListOptions } from "./base"; | ||
|
||
export interface InventoryLevelListOptions extends BasicListOptions { | ||
/** | ||
* A comma-separated list of inventory item IDs. | ||
*/ | ||
inventory_item_ids?: string; | ||
|
||
/** | ||
* A comma-separated list of location IDs. | ||
*/ | ||
location_ids?: string; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import * as Options from '../options'; | ||
import { BaseService } from '../infrastructure'; | ||
import { InventoryItem } from '../models'; | ||
|
||
/** | ||
* A service for manipulating Shopify's InventoryItems API. | ||
*/ | ||
export class InventoryItems extends BaseService { | ||
constructor(shopDomain: string, accessToken: string) { | ||
super(shopDomain, accessToken, "inventory_items"); | ||
} | ||
|
||
/** | ||
* Gets a inventory item with the given id. | ||
* @param id Id of the inventory item being retrieved. | ||
* @param options Options for filtering the result. | ||
*/ | ||
public get(id: number, options?: Options.FieldOptions) { | ||
return this.createRequest<Location>("GET", `${id}.json`, "inventory_item", options); | ||
} | ||
|
||
/** | ||
* Gets a list of up to 250 of the shop's inventory items. | ||
* @param options Options for filtering the result. | ||
*/ | ||
public list(options: Options.InventoryItemListOptions) { | ||
return this.createRequest<InventoryItem[]>("GET", ".json", "inventory_items", options); | ||
} | ||
|
||
/** | ||
* Updates an inventory item with the given id. | ||
* @param id The inventory items's id. | ||
* @param inventoryItem The updated inventory item. | ||
*/ | ||
public update(id: number, inventoryItem: InventoryItem) { | ||
return this.createRequest<InventoryItem>("PUT", `${id}.json`, "inventory_item", { inventory_item: inventoryItem }); | ||
} | ||
} | ||
|
||
export default InventoryItems; |
Oops, something went wrong.