Skip to content

Commit 531c11c

Browse files
authored
Add a readme for the @gitbook/api (#283)
* Add readme for the api package * Always use production url for openapi spec * Add changeset
1 parent 713d4ca commit 531c11c

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

.changeset/perfect-clocks-look.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@gitbook/api': patch
3+
---
4+
5+
Document the @gitbook/api package and update the OpenAPI spec

packages/api/README.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# `@gitbook/api`
2+
3+
Javascript (Browser and Node) API client for the [GitBook API](https://developer.gitbook.com/).
4+
5+
## Installation
6+
7+
```
8+
npm install @gitbook/api
9+
```
10+
11+
## Usage
12+
13+
```ts
14+
import { GitBookAPI } from '@gitbook/api';
15+
16+
const gitbook = new GitBookAPI({
17+
authToken: 'gb_abc,
18+
});
19+
20+
const { data } = await gitbook..spaces.getSpaceById('abc');
21+
```

packages/api/build.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mkdir ./spec
77
LOCAL_OPENAPI_FILE=../../../gitbook-x/packages/api-client/static/openapi.yaml
88

99
if [[ -z "${GITBOOK_OPENAPI_URL}" ]]; then
10-
OPENAPI_URL="https://api.gitbook-staging.com/openapi.yaml"
10+
OPENAPI_URL="https://api.gitbook.com/openapi.yaml"
1111
else
1212
OPENAPI_URL="${GITBOOK_OPENAPI_URL}"
1313
fi

packages/api/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"version": "0.11.0",
88
"sideEffects": false,
99
"files": [
10+
"README.md",
1011
"spec/**",
1112
"dist/**"
1213
],

0 commit comments

Comments
 (0)