v0.0.47
commercetools deno sdk
Attributes
Includes Deno configuration
Repository
Current version released
2 years ago
Dependencies
Versions
- v0.0.53Latest
- v0.0.52
- v0.0.51
- v0.0.50
- v0.0.49
- v0.0.48
- v0.0.47
- v0.0.46
- v0.0.45
- v0.0.44
- v0.0.43
- v0.0.42
- v0.0.41
- v0.0.40
- v0.0.39
- v0.0.38
- v0.0.37
- v0.0.36
- v0.0.35
- v0.0.34
- v0.0.33
- v0.0.32
- v0.0.31
- v0.0.30
- v0.0.29
- v0.0.28
- v0.0.27
- v0.0.26
- v0.0.25
- v0.0.24
- v0.0.23
- v0.0.22
- v0.0.21
- v0.0.20
- v0.0.19
- v0.0.18
- v0.0.17
- v0.0.16
- v0.0.15
- v0.0.14
- v0.0.13
- v0.0.12
- v0.0.11
- v0.0.10
- v0.0.9
- v0.0.8
- v0.0.7
- v0.0.6
- v0.0.5
- v0.0.4
- v0.0.1
- v0.0.3
- v0.0.2
deno commercetools api 🦕
A small helper for using commercetools in combination with the deno runtime
How to get started
Install the Deno runtime on your machine, following this guidance: https://deno.land/
Prerequisites
A .env file in the root that contains the following:
CTP_PROJECT_KEY=**-********-****
CTP_CLIENT_SECRET=************
CTP_CLIENT_ID=****************
CTP_AUTH_URL=https://auth.europe-west1.gcp.commercetools.com
CTP_API_URL=https://api.europe-west1.gcp.commercetools.com
CTP_SCOPES=manage_project:**-********-****install the language server client for Deno in vscode, to make sure that vscode understands your code is for Deno and not for Node.
***using the api with Client Credentials Flow ***
import { sdk } from "https://deno.land/x/commercetools_demo_sdk/clientsdk.ts"
const handle = sdk.init()
const result = await handle
.root()
.get()
.execute()
console.log(result.body)Copy the text above in a file called projectsample.ts and run with:
deno run -A projectsample.ts
or, run it without copying anything:
deno run -A https://deno.land/x/commercetools_demo_sdk/projectsample.ts
or even nicer, install it
deno install -A https://deno.land/x/commercetools_demo_sdk/projectsample.tsprojectsampleusing the api with password flow
import { loglevel, sdk } from "https://deno.land/x/commercetools_demo_sdk/clientsdk.ts"
const handle = sdk.init(loglevel.quiet, {
passwordflow: {
email: "ocanne.ratnage@quinu.fr",
password: "password",
storeKey: "bbe4225c-b48f-4773-9a3c-ca7b685f171a",
},
})
const result = await handle
.root()
.get()
.execute()
console.log(result.body)using the api with anonymous flow
import { loglevel, sdk } from "https://deno.land/x/commercetools_demo_sdk/clientsdk.ts"
const handle = sdk.init(loglevel.quiet, {
anonymous: {
anonymous_id: "myotherid",
},
})
const result = await handle
.root()
.get()
.execute()
console.log(result.body)