getta 1.0.0 → 1.0.1

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.
Files changed (2) hide show
  1. package/README.md +4 -8
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -109,14 +109,11 @@ The stream reader to use when parsing the response body. Default is `'json'`.
109
109
 
110
110
  ### Making reqeusts
111
111
 
112
- The rest client supports `GET`, `POST`, `PUT` and `DELETE` methods and has functions for each method.
112
+ The rest client supports `GET`, `POST`, `PUT` and `DELETE` methods and has functions for each method. The first argument is the path to make the request to. This can also be a path template with variable placeholders that will be replaced with data passed in on the `pathTemplateData` request option.
113
113
 
114
114
  ```typescript
115
- const pathTemplate = '/direct/rest/content/catalog/{type}/{id,+}?format={brief|standard}';
116
- const pathTemplateData = { 'brief|standard': 'standard', 'id,+': '136-7317', type: 'product' };
117
-
118
115
  // GET
119
- const getResponse = await restClient.get(pathTemplate, { pathTemplateData });
116
+ const getResponse = await restClient.get('/path/to/resource');
120
117
 
121
118
  // POST
122
119
  const postResponse = await restClient.post('/graphql/api', {
@@ -124,13 +121,12 @@ const postResponse = await restClient.post('/graphql/api', {
124
121
  });
125
122
 
126
123
  // PUT
127
- const putResponse = await restClient.put(pathTemplate, {
124
+ const putResponse = await restClient.put('/path/to/resource', {
128
125
  body: JSON.stringify({ /* payload */ }),
129
- pathTemplateData,
130
126
  });
131
127
 
132
128
  // DELETE
133
- const deleteResponse = await restClient.delete(pathTemplate, { pathTemplateData });
129
+ const deleteResponse = await restClient.delete('/path/to/resource');
134
130
  ```
135
131
 
136
132
  ### Request options
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "getta",
3
3
  "description": "An isomorphic rest client based on the Fetch API.",
4
- "version": "1.0.0",
4
+ "version": "1.0.1",
5
5
  "author": "Dylan Aubrey",
6
6
  "license": "MIT",
7
7
  "homepage": "https://github.com/badbatch/getta",