Skip to content

Commit

Permalink
chore: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
anrusina committed May 24, 2022
1 parent 4ea8a83 commit 53d1731
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion packages/plugins/flyte-api/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,39 @@
This is a flyte-API package for flyteconsole plugin system
## @flyteconsole/flyte-api

This package provides ability to do FlyteAdmin API calls from JS/TS code.

At this point it allows to get though authentication steps, request user profile and FlyteAdmin version.
In future releases we will add ability to do all types of FlyteAdmin API calls.

### Installation

To install the package please run:
```bash
yarn add @flyteconsole/flyte-api
```

### Usage

To use in your application

- Wrap parent component with <FlyteApiProvider flyteApiDomain={ADMIN_API_URL ?? ''}>

`ADMIN_API_URL` is a flyte admin domain URL to which `/api/v1/_endpoint` part would be added, to perform REST API call.
`
Then from any child component

```js
import useAxios from 'axios-hooks';
import { useFlyteApi, defaultAxiosConfig } from '@flyteconsole/flyte-api';

...
/** Get profile information */
const apiContext = useFlyteApi();

const profilePath = apiContext.getProfileUrl();
const [{ data: profile, loading }] = useAxios({
url: profilePath,
method: 'GET',
...defaultAxiosConfig,
});
```

0 comments on commit 53d1731

Please sign in to comment.