2023-01-27 03:22:44 -08:00
|
|
|
import type {
|
2022-07-15 01:36:01 -07:00
|
|
|
IAuthenticateGeneric,
|
|
|
|
ICredentialTestRequest,
|
|
|
|
ICredentialType,
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
|
|
|
export class ShopifyAccessTokenApi implements ICredentialType {
|
|
|
|
name = 'shopifyAccessTokenApi';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-15 01:36:01 -07:00
|
|
|
displayName = 'Shopify Access Token API';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-15 01:36:01 -07:00
|
|
|
documentationUrl = 'shopify';
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-15 01:36:01 -07:00
|
|
|
properties: INodeProperties[] = [
|
|
|
|
{
|
|
|
|
displayName: 'Shop Subdomain',
|
|
|
|
name: 'shopSubdomain',
|
|
|
|
required: true,
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'Only the subdomain without .myshopify.com',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Access Token',
|
|
|
|
name: 'accessToken',
|
|
|
|
required: true,
|
|
|
|
type: 'string',
|
2022-11-01 09:41:45 -07:00
|
|
|
typeOptions: { password: true },
|
2022-07-15 01:36:01 -07:00
|
|
|
default: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'APP Secret Key',
|
|
|
|
name: 'appSecretKey',
|
|
|
|
required: true,
|
|
|
|
type: 'string',
|
2023-08-01 04:08:25 -07:00
|
|
|
typeOptions: { password: true },
|
2022-07-15 01:36:01 -07:00
|
|
|
default: '',
|
|
|
|
description: 'Secret key needed to verify the webhook when using Shopify Trigger node',
|
|
|
|
},
|
|
|
|
];
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-15 01:36:01 -07:00
|
|
|
authenticate: IAuthenticateGeneric = {
|
|
|
|
type: 'generic',
|
|
|
|
properties: {
|
|
|
|
headers: {
|
|
|
|
'X-Shopify-Access-Token': '={{$credentials?.accessToken}}',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
2022-12-02 12:54:28 -08:00
|
|
|
|
2022-07-15 01:36:01 -07:00
|
|
|
test: ICredentialTestRequest = {
|
2022-07-24 08:36:17 -07:00
|
|
|
request: {
|
2022-07-15 01:36:01 -07:00
|
|
|
baseURL: '=https://{{$credentials?.shopSubdomain}}.myshopify.com/admin/api/2019-10',
|
|
|
|
url: '/products.json',
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|