node-shopify
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -8,5 +8,10 @@ import { Result } from 'node-result'; | ||
import { CheckoutCreate, CheckoutUpdate, CheckoutToken, Checkout, CheckoutShippingRates } from './types/checkout'; | ||
import { ProductId } from './types/product'; | ||
export declare class Shopify { | ||
private readonly instance; | ||
constructor(baseUrl: string, timeout?: number); | ||
getApiToken(appApiKey: string, appSecret: string, code: string): Promise<Result<Error, { | ||
accessToken: string; | ||
scope: string[]; | ||
}>>; | ||
getShop(): Promise<Result<Error, Shop>>; | ||
@@ -42,5 +47,5 @@ getCarrierServices(): Promise<Result<Error, CarrierService[]>>; | ||
getProductListingIds(): Promise<import("node-result").ResultOK<number[]>>; | ||
createProductListing(productId: number): Promise<import("node-result").ResultOK<object>>; | ||
getProductListing(productId: number): Promise<import("node-result").ResultOK<object>>; | ||
deleteProductListing(productId: number): Promise<Result<Error, null>>; | ||
createProductListing(productId: ProductId): Promise<import("node-result").ResultOK<object>>; | ||
getProductListing(productId: ProductId): Promise<import("node-result").ResultOK<object>>; | ||
deleteProductListing(productId: ProductId): Promise<Result<Error, null>>; | ||
} |
@@ -19,2 +19,15 @@ "use strict"; | ||
} | ||
async getApiToken(appApiKey, appSecret, code) { | ||
const url = '/admin/oauth/access_token'; | ||
const payload = { | ||
client_id: appApiKey, | ||
client_secret: appSecret, | ||
code | ||
}; | ||
const { data: { access_token, scope } } = (await this.instance.post(url, payload)).unwrap(); | ||
return node_result_1.ResultOk({ | ||
accessToken: access_token, | ||
scope: scope.split(',') | ||
}); | ||
} | ||
async getShop() { | ||
@@ -215,2 +228,5 @@ const url = '/admin/api/2020-10/shop.json'; | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "getApiToken", null); | ||
__decorate([ | ||
node_result_1.tryCatchWrapperAsync | ||
], Shopify.prototype, "getShop", null); | ||
@@ -217,0 +233,0 @@ __decorate([ |
{ | ||
"name": "node-shopify", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "shopify", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
25963
19
526