Skip to content

Commit

Permalink
(add) docs project to the monorepo apps
Browse files Browse the repository at this point in the history
  • Loading branch information
danh91 committed Nov 27, 2023
1 parent 8698392 commit 552df35
Show file tree
Hide file tree
Showing 175 changed files with 37,504 additions and 9,347 deletions.
20 changes: 20 additions & 0 deletions apps/www/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
41 changes: 41 additions & 0 deletions apps/www/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Website

This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.

### Installation

```
$ yarn
```

### Local Development

```
$ yarn start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

### Build

```
$ yarn build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

### Deployment

Using SSH:

```
$ USE_SSH=true yarn deploy
```

Not using SSH:

```
$ GIT_USER=<Your GitHub username> yarn deploy
```

If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
3 changes: 3 additions & 0 deletions apps/www/babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')],
};
9 changes: 9 additions & 0 deletions apps/www/docs/api/addresses.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
id: addresses
title: Addresses
description: Create update and delete addresses using via API.
tags:
- GraphQL
---

# Manage addresses
73 changes: 73 additions & 0 deletions apps/www/docs/api/authentication.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
id: authentication
title: Authentication
description: Manage you API keys to authenticate requests to Karrio.
tags:
- Authentication
---

import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";

**Manage your API keys to authenticate requests with Karrio.**

Karrio authenticates your API requests using your account’s API keys.
If you don’t include your key when making an API request, or use an
incorrect or outdated one, Karrio returns an error.

There are two types of keys: a private key and a JSON Web Token.

- Private You must keep your private API keys confidential and only
store them on your own servers. You must not share your private API
key with any third parties. Your account’s private API key can perform
any API request to Karrio without restriction. If Karrio believes that
your secret API key has been compromised, you may cancel and reissue it.
- JSON Web Token aka JWT are meant solely to identify your account with
Karrio, they aren’t secret. In other words, you can safely publish them
in places like your karrio.js JavaScript code, or in an Android or iPhone app.

## Obtaining your API keys

- Your Private API key is always available in the [Dashboard](https://app.karrio.io/developers/api):

<img style={{ borderRadius: 5 }} src="/img/assets/api-key.png" width="90%" />

- The JSON Web Token on the other hand are obtained by API request

<div id="tabs">
<Tabs>
<TabItem value="curl" label="cURL">

```shell
curl --request POST \\
--url https://api.karrio.io/api/token \\
--header 'Content-Type: application/json' \\
--data '{
"email": "admin@example.com",
"password": "demo"
}'
```

</TabItem>
<TabItem value="js" label="Javascript">

```javascript
const karrio = Karrio();
const token = await karrio.api.authenticate({
email: "admin@example.com",
password: "demo",
});
```

</TabItem>
</Tabs>
</div>

Karrio returns an key pair object in response to your API request.

```json
{
"refresh": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoicmVmcmVzaCIsImV4cCI6MTYzNjYxMzY4NSwiaWF0IjoxNjM2MTgxNjg1LCJqdGkiOiIwNjM1ZGQ4NWExMWU0NTNjYTk2ZTk3NDM4ZDBjOTRkMiIsInVzZXJfaWQiOjF9.1MO8ODXIPvEQtTJdiyyFT1UA54hZnLjrVj8a3DEDbbw",
"access": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNjM2MTgyNTg1LCJpYXQiOjE2MzYxODE2ODUsImp0aSI6ImMyYWI5YTAzNTRkYTRlZTQ5ZjQ1ZDdlMmI4NWQ5ZGZkIiwidXNlcl9pZCI6MX0.X-MA-9Vi_zWJfvMWSaL8dNj7XOy8kPNz16gvbciLCIM"
}
```
7 changes: 7 additions & 0 deletions apps/www/docs/api/batches.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
id: batches
title: Batches
description: Use the batch API to create multiple objects at once.
tags:
- REST API
---
Loading

0 comments on commit 552df35

Please sign in to comment.