0.2.1 • Published 11 months ago

@risemaxi/api-client v0.2.1

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

Rise API client

This package contains an api client for Risevest. The contract is generated from an OpenAPI file, and then a client is built around this contract.

It uses typebox to generate the contract from an OpenAPI file, and also react-query

Installation

npm install @risemaxi/api-client --save

OR

yarn add @risemaxi/api-client
OR
bun install @risemaxi/api-client

Usage

This lib also ships with a cli rise-api, so you can use it to generate the contract at will, just run:

bunx rise-api generate <input-file>

The input file can be a local file or a url pointing to a file. For example

bunx rise-api generate ./swagger.yaml

Example

import { createRiseApiClient } from '@risemaxi/api-client'

const apiClient = createRiseApiClient(async (method, url, params) => {
  const data = await fetch(url)
  const res = await data.json()
  return data
} , 'api.com' false)

 apiClient.get('/plans', {
    query: {},
  })

Parameters

NameTypeDefault
fetcherFunction
baseUrlString Optional""
enableParsingBoolean Optionaltrue
0.1.0

1 year ago

0.2.1

11 months ago

0.1.2

1 year ago

0.2.0

12 months ago

0.1.1

1 year ago

0.1.7

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.12

2 years ago

0.0.11

2 years ago

0.0.10

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago