0.3.2 • Published 2 years ago

@1of1studio/shopify-sanity-sync v0.3.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

@1of1studio/shopify-sanity-sync

API

Initialise as you would @sanity/client for read + write use.

import { SanitySyncClient } from '@1of1studio/shopify-sanity-sync'

const client = new SanitySyncClient({
  projectId: 'your-project-id',
  dataset: 'bikeshop',
  apiVersion: '2021-03-25',
  token: 'sanity-auth-token',
})

Create or Update

import { formatShopifyDocument } from '@1of1studio/shopify-sanity-sync'

const documentToCreateOrUpdate = formatShopifyDocumnet('collection', {
  id: 'Z2lkOi8vc2hvcGlmeS9Db2xsZWN0aW9uLzM1ODUwMzM1MDQ5Ng==',
  handle: 'lighting',
  title: 'Lighting',
})

await client.createDraftOrUpdate(documentToCreateOrUpdate)

Delete

import { convertShopifyDocumentId } from '@1of1studio/shopify-sanity-sync'

const documentIDToDelete = convertShopifyDocumentId(
  'Z2lkOi8vc2hvcGlmeS9Db2xsZWN0aW9uLzM1ODUwMzM1MDQ5Ng=='
)

await client.delete(documentIDToDelete)

To Do

  • Setup Sanity and Shopify environments for setup/teardown in tests.
0.3.2

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago