@commercelayer/sdk 4.5.0-beta.2 → 4.5.0-beta.3
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
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://github.com/semantic-release/semantic-release)
|
4
4
|
|
5
|
-
A JavaScript Library wrapper that makes it quick and easy to interact with the [Commerce Layer API](https://docs.commercelayer.io/
|
5
|
+
A JavaScript Library wrapper that makes it quick and easy to interact with the [Commerce Layer API](https://docs.commercelayer.io/developers/).
|
6
6
|
|
7
7
|
### What is Commerce Layer?
|
8
8
|
|
@@ -30,7 +30,7 @@ yarn add @commercelayer/sdk
|
|
30
30
|
|
31
31
|
## Authentication
|
32
32
|
|
33
|
-
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/
|
33
|
+
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.
|
34
34
|
|
35
35
|
> 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.
|
36
36
|
|
@@ -47,7 +47,7 @@ const cl = CommerceLayer({
|
|
47
47
|
})
|
48
48
|
```
|
49
49
|
|
50
|
-
> 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.
|
50
|
+
> 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.
|
51
51
|
|
52
52
|
# Usage
|
53
53
|
|
@@ -84,7 +84,7 @@ The code snippets below show how to use the Commerce Layer JS SDK when performin
|
|
84
84
|
const newSku = await cl.skus.create(attributes)
|
85
85
|
```
|
86
86
|
|
87
|
-
Check our API reference for more information on how to [create an SKU](https://docs.commercelayer.io/api/
|
87
|
+
Check our API reference for more information on how to [create an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/create).
|
88
88
|
|
89
89
|
## Retrieve / List
|
90
90
|
|
@@ -104,7 +104,7 @@ Check our API reference for more information on how to [create an SKU](https://d
|
|
104
104
|
const sku = (await cl.skus.list()).last()
|
105
105
|
```
|
106
106
|
|
107
|
-
Check our API reference for more information on how to [retrieve an SKU](https://docs.commercelayer.io/api/
|
107
|
+
Check our API reference for more information on how to [retrieve an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/retrieve).
|
108
108
|
|
109
109
|
### How to fetch a collection of SKUs
|
110
110
|
|
@@ -163,7 +163,7 @@ When fetching a collection of resources you can leverage the `meta` attribute to
|
|
163
163
|
const meta = skus.meta
|
164
164
|
```
|
165
165
|
|
166
|
-
Check our API reference for more information on how to [list all SKUs](https://docs.commercelayer.io/api/
|
166
|
+
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).
|
167
167
|
|
168
168
|
### How to paginate a collection of SKUs
|
169
169
|
|
@@ -182,7 +182,7 @@ When you fetch a collection of resources, you get paginated results:
|
|
182
182
|
|
183
183
|
> The default page number is **1**. The default page size is **10**. The maximum page size allowed is **25**.
|
184
184
|
|
185
|
-
Check our API reference for more information on how [pagination](https://docs.commercelayer.io/
|
185
|
+
Check our API reference for more information on how [pagination](https://docs.commercelayer.io/developers/pagination) works.
|
186
186
|
|
187
187
|
### How to iterate through a collection of SKUs
|
188
188
|
|
@@ -216,7 +216,7 @@ code
|
|
216
216
|
cl.skus.update(sku) // updates the SKU on the server
|
217
217
|
```
|
218
218
|
|
219
|
-
Check our API reference for more information on how to [update an SKU](https://docs.commercelayer.io/api/
|
219
|
+
Check our API reference for more information on how to [update an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/update).
|
220
220
|
|
221
221
|
## Delete
|
222
222
|
|
@@ -226,7 +226,7 @@ Check our API reference for more information on how to [update an SKU](https://d
|
|
226
226
|
cl.skus.delete('xYZkjABcde') // persisted deletion
|
227
227
|
```
|
228
228
|
|
229
|
-
Check our API reference for more information on how to [delete an SKU](https://docs.commercelayer.io/api/
|
229
|
+
Check our API reference for more information on how to [delete an SKU](https://docs.commercelayer.io/developers/v/api-reference/skus/delete).
|
230
230
|
|
231
231
|
# Overriding credentials
|
232
232
|
|
@@ -285,7 +285,7 @@ Commerce Layer API returns specific errors (with extra information) on each attr
|
|
285
285
|
|
286
286
|
```
|
287
287
|
|
288
|
-
Check our API reference for more information about the [errors](https://docs.commercelayer.io/
|
288
|
+
Check our API reference for more information about the [errors](https://docs.commercelayer.io/developers/handling-errors) returned by the API.
|
289
289
|
|
290
290
|
---
|
291
291
|
|