@commercelayer/sdk 4.3.0-beta.6 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Commerce Layer JS SDK
|
2
2
|
|
3
|
-
A JavaScript Library wrapper that makes it quick and easy to interact with the [Commerce Layer API](https://docs.commercelayer.io/
|
3
|
+
A JavaScript Library wrapper that makes it quick and easy to interact with the [Commerce Layer API](https://docs.commercelayer.io/developers/).
|
4
4
|
|
5
5
|
### What is Commerce Layer?
|
6
6
|
|
@@ -28,7 +28,7 @@ yarn add @commercelayer/sdk
|
|
28
28
|
|
29
29
|
## Authentication
|
30
30
|
|
31
|
-
All requests to Commerce Layer API must be authenticated with an [OAuth2](https://oauth.net/2/) bearer token. Hence, before starting to use this SDK you need to get a valid access token. Check [our documentation](https://docs.commercelayer.io/
|
31
|
+
All requests to Commerce Layer API must be authenticated with an [OAuth2](https://oauth.net/2/) bearer token. Hence, before starting to use this SDK you need to get a valid access token. Check [our documentation](https://docs.commercelayer.io/developers/authentication) for more information about the available authorization flows.
|
32
32
|
|
33
33
|
> Feel free to use [Commerce Layer JS Auth](https://github.com/commercelayer/commercelayer-js-auth), a JavaScript library that helps you wrap our authentication API.
|
34
34
|
|
@@ -45,7 +45,7 @@ const cl = CommerceLayer({
|
|
45
45
|
})
|
46
46
|
```
|
47
47
|
|
48
|
-
> In the following examples, we will use only the the specific resources we're going to access (SKUs and shipping categories). Check our [API reference](https://docs.commercelayer.io/api/) for the complete list of available resources and their attributes.
|
48
|
+
> In the following examples, we will use only the the specific resources we're going to access (SKUs and shipping categories). Check our [API reference](https://docs.commercelayer.io/developers/v/api-reference/) for the complete list of available resources and their attributes.
|
49
49
|
|
50
50
|
# Usage
|
51
51
|
|
@@ -81,7 +81,7 @@ The code snippets below show how to use the Commerce Layer JS SDK when performin
|
|
81
81
|
const newSku = await cl.skus.create(attributes)
|
82
82
|
```
|
83
83
|
|
84
|
-
Check our API reference for more information on how to [create an SKU](https://docs.commercelayer.io/api/
|
84
|
+
Check our API reference for more information on how to [create an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/create).
|
85
85
|
|
86
86
|
## Retrieve
|
87
87
|
|
@@ -101,7 +101,7 @@ Check our API reference for more information on how to [create an SKU](https://d
|
|
101
101
|
const sku = (await cl.skus.list()).last()
|
102
102
|
```
|
103
103
|
|
104
|
-
Check our API reference for more information on how to [retrieve an SKU](https://docs.commercelayer.io/api/
|
104
|
+
Check our API reference for more information on how to [retrieve an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/retrieve).
|
105
105
|
|
106
106
|
### How to fetch a collection of SKUs
|
107
107
|
|
@@ -160,7 +160,7 @@ When fetching a collection of resources you can leverage the `meta` attribute to
|
|
160
160
|
const meta = skus.meta
|
161
161
|
```
|
162
162
|
|
163
|
-
Check our API reference for more information on how to [list all SKUs](https://docs.commercelayer.io/api/
|
163
|
+
Check our API reference for more information on how to [list all SKUs](https://docs.commercelayer.io/developers/v/api-reference/skus/list), [sort the results](https://docs.commercelayer.io/developers/sorting-results), use [sparse fieldsets](https://docs.commercelayer.io/developers/sparse-fieldsets), [include associations](https://docs.commercelayer.io/developers/including-associations), and [filter data](https://docs.commercelayer.io/developers/filtering-data).
|
164
164
|
|
165
165
|
### How to paginate a collection of SKUs
|
166
166
|
|
@@ -179,7 +179,7 @@ When you fetch a collection of resources, you get paginated results:
|
|
179
179
|
|
180
180
|
> The default page number is **1**. The default page size is **10**. The maximum page size allowed is **25**.
|
181
181
|
|
182
|
-
Check our API reference for more information on how [pagination](https://docs.commercelayer.io/
|
182
|
+
Check our API reference for more information on how [pagination](https://docs.commercelayer.io/developers/pagination) works.
|
183
183
|
|
184
184
|
### How to iterate through a collection of SKUs
|
185
185
|
|
@@ -205,7 +205,7 @@ To execute a function for every item of a collection, use the `map()` method:
|
|
205
205
|
cl.skus.update(sku) // updates the SKU on the server
|
206
206
|
```
|
207
207
|
|
208
|
-
Check our API reference for more information on how to [update an SKU](https://docs.commercelayer.io/api/
|
208
|
+
Check our API reference for more information on how to [update an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/update).
|
209
209
|
|
210
210
|
## Delete
|
211
211
|
|
@@ -215,7 +215,7 @@ Check our API reference for more information on how to [update an SKU](https://d
|
|
215
215
|
cl.skus.delete('xYZkjABcde') // persisted deletion
|
216
216
|
```
|
217
217
|
|
218
|
-
Check our API reference for more information on how to [delete an SKU](https://docs.commercelayer.io/api/
|
218
|
+
Check our API reference for more information on how to [delete an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/delete).
|
219
219
|
|
220
220
|
# Overriding credentials
|
221
221
|
|
@@ -274,7 +274,7 @@ Commerce Layer API returns specific errors (with extra information) on each attr
|
|
274
274
|
|
275
275
|
```
|
276
276
|
|
277
|
-
Check our API reference for more information about the [errors](https://docs.commercelayer.io/
|
277
|
+
Check our API reference for more information about the [errors](https://docs.commercelayer.io/developers/handling-errors) returned by the API.
|
278
278
|
|
279
279
|
---
|
280
280
|
|