1.0.0-alpha.1 • Published 3 years ago

@exobase/client-builder v1.0.0-alpha.1

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@exobase/api

A library for creating clients that communicate with Exobase APIs

Usage

import apiMaker from '@exobase/api'
import * as t from './types'

export { ApiError, ApiResponse, Auth } from '@exobase/api'
export * from './types'


const createApi = (url: string) => {
  const endpoint = apiMaker(url)
  return {
    health: {
      ping: endpoint<{}, {
        message: 'pong'
      }>({
        module: 'health',
        function: 'ping'
      })
    },
    auth: {
      login: endpoint<{}, {
        user: t.User
        platforms: t.PlatformPreview[]
        platformId: string
        idToken: string
        exp: number
      }>({
        module: 'auth',
        function: 'login'
      })
    }
  }
}

const api = createApi('http://localhost:800')

await api.health.ping({})
const { error, data } = await api.auth.login({}, {
  token: 'abc=='
})
1.0.0-alpha.1

3 years ago

1.0.0-alpha.0

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.2-alpha.2

3 years ago

0.0.2-alpha.1

3 years ago

0.0.2-alpha.0

3 years ago

0.0.1

3 years ago