Skip to content

Commit 9ba01f9

Browse files
committed
renamed
1 parent 832bea6 commit 9ba01f9

File tree

11 files changed

+25
-36
lines changed

11 files changed

+25
-36
lines changed

README.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# @chriscdn/cs-rest
1+
# @kweli/cs-rest
22

3-
Simplified authentication and REST calls for OpenText Content Server.
3+
Simple authentication and REST calls for OpenText Content Server.
44

55
## Features
66

77
- Provides a simplified interface for managing authentication with the OpenText Content Server REST API
88
- Automatically adds the `OTCSTicket` header to each subsequent request
99
- Refreshes the `OTCSTicket` token automatically (minimising token expiration errors)
10+
- Simplifies POST, PUT, & PATCH requests (since Content Server doesn't support the `application/json` content type)
1011
- Based on the [axios](https://github.com/axios/axios) HTTP client
1112
- Works with Node.js and the browser
1213

@@ -15,29 +16,29 @@ Simplified authentication and REST calls for OpenText Content Server.
1516
Using npm:
1617

1718
```bash
18-
$ npm install @chriscdn/cs-rest
19+
$ npm install @kweli/cs-rest
1920
```
2021

2122
Using yarn:
2223

2324
```bash
24-
$ yarn add @chriscdn/cs-rest
25+
$ yarn add @kweli/cs-rest
2526
```
2627

2728
Using unpkg CDN:
2829

2930
```html
3031
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js"></script>
3132
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
32-
<script src="https://unpkg.com/@chriscdn/cs-rest/lib/index.min.js"></script>
33+
<script src="https://unpkg.com/@kweli/cs-rest"></script>
3334
```
3435

3536
## Example
3637

3738
Authenticate with a username and password and get the details of a node:
3839

3940
```js
40-
const CSREST = require('@chriscdn/cs-rest')
41+
const CSREST = require('@kweli/cs-rest')
4142

4243
// session wraps an axios instance
4344
const session = new CSREST.Session({
@@ -63,11 +64,11 @@ const session = new CSREST.Session({
6364

6465
Requests can be made with the `get`, `post`, `put`, `patch`, `delete`, and `options` methods on the `Session` instance. These have the same interface as the respective methods in [axios](https://github.com/axios/axios).
6566

66-
Content Server returns a fresh `OTCSTicket` with each successful API call. The `Session` instance will automatically retain it for the subsequent request.
67+
Content Server returns a fresh `OTCSTicket` with each successful API call. The `Session` instance automatically retains it for the subsequent request.
6768

6869
#### POST, PUT, & PATCH
6970

70-
The OpenText Content Server REST API doesn't accept requests that use the `application/json` content type. This means post, put, & patch requests need to use a content type of `multipart/form-data`, which makes writing the request a little more verbose. For example, to create a new folder:
71+
The OpenText Content Server REST API doesn't accept requests that use the `application/json` content type. This means POST, PUT, & PATCH requests need to use a content type of `multipart/form-data`, which makes writing a request a little more verbose. For example, to create a new folder:
7172

7273
```js
7374
const formData = new FormData()
@@ -78,7 +79,7 @@ formDAta.append('name', 'My New Folder')
7879
const response = await session.post('api/v2/nodes', formData)
7980
```
8081

81-
The `Session` class provides a `postForm` (also `putForm` and `patchForm`) method to simplify this to:
82+
The `Session` class provides a `postForm` (also `putForm` and `patchForm`) method to simplify this:
8283

8384
```js
8485
const response = await session.postForm('api/v2/nodes', {
@@ -109,7 +110,7 @@ const response = await session.nodes.addFolder(2000, 'My New Folder')
109110
A method also exists for uploading a document, where `file` is either:
110111

111112
- a browser [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object (e.g,. from drag and drop); or
112-
- a Node.js file (e.g., `const file = fs.readFileSync('<file path>')`
113+
- a Node.js file (e.g., `const file = fs.readFileSync('<file path>')`.
113114

114115
```js
115116
const response = await session.nodes.uploadDocument(2000, "My New File", file)
@@ -120,7 +121,7 @@ See the `src/` directory for more examples.
120121
## Credits
121122

122123
- [OpenText Content Server REST API](https://developer.opentext.com/webaccess/#url=%2Fawd%2Fresources%2Fapis%2Fcs-rest-api-for-cs-16-s&tab=501)
123-
- [kwe.li GmbH](https://kwe.li/)
124+
- [Kwe.li GmbH](https://kwe.li/)
124125

125126
## License
126127

lib/index.cjs.js

Lines changed: 2 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.cjs.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.es.js

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.es.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/index.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
2-
"name": "@chriscdn/cs-rest",
3-
"version": "1.0.4",
4-
"description": "Simplified authentication and REST calls for OpenText Content Server.",
2+
"name": "@kweli/cs-rest",
3+
"version": "1.0.5",
4+
"description": "Simple authentication and REST calls for OpenText Content Server.",
55
"main": "lib/index.cjs.js",
66
"module": "lib/index.es.js",
77
"unpkg": "lib/index.min.js",
88
"repository": "https://github.com/chriscdn/cs-rest",
9-
"author": "Christopher Meyer",
9+
"author": "Christopher Meyer <chris.meyer@kwe.li> (https://kwe.li/)",
1010
"license": "MIT",
1111
"scripts": {
1212
"build": "rollup -c"

src/Session.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,16 @@ module.exports = class Session {
7272

7373
putForm(url, params) {
7474
const formData = this._objectToForm(params)
75-
7675
return process.node ? this.put(url, formData.getBuffer(), { headers: formData.getHeaders() }) : this.put(url, formData)
7776
}
7877

7978
postForm(url, params) {
8079
const formData = this._objectToForm(params)
81-
8280
return process.node ? this.post(url, formData.getBuffer(), { headers: formData.getHeaders() }) : this.post(url, formData)
8381
}
8482

8583
patchForm(url, params) {
8684
const formData = this._objectToForm(params)
87-
8885
return process.node ? this.patch(url, formData.getBuffer(), { headers: formData.getHeaders() }) : this.patch(url, formData)
8986
}
9087

src/auth.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,7 @@ function axiosFactory(options) {
4848
formData.append('username', username)
4949
formData.append('password', password)
5050

51-
let response = process.node
52-
? await axios.post(`${options.baseURL}/api/v1/auth/`, formData.getBuffer(), {headers: formData.getHeaders()})
53-
: await axios.post(`${options.baseURL}/api/v1/auth/`, formData)
51+
let response = process.node ? await axios.post(`${options.baseURL}/api/v1/auth/`, formData.getBuffer(), { headers: formData.getHeaders() }) : await axios.post(`${options.baseURL}/api/v1/auth/`, formData)
5452

5553
request.headers.common['OTCSTicket'] = get(response, 'data.ticket')
5654

0 commit comments

Comments
 (0)