npm i hypothesis-rest
import HypothesisRestClient from 'hypothesis-rest'
Get a client appropriate to your authorization requirements, it will provide you with only those API endpoints available with this authentication method:
const client = HypothesisRestClient()
expectType<UnauthenticatedClient>(client)
const client = HypothesisRestClient({ apiKey: '<YOUR_API_KEY>' })
expectType<ApiKeyClient>(client)
const client = HypothesisRestClient({ authClient: '<OAUTH2_TOKEN>' })
expectType<AuthClientClient>(client)
From ./examples/clients/authClientForwardedUser.test-d.ts#16~19
const client = HypothesisRestClient({ authClientForwardedUser: '<FORWARDED_USER_OAUTH2_TOKEN>' })
expectType<AuthClientForwardedUserClient>(client)
See which endpoints support or require which auth types in the endpoints table below, or go directly to the Hypothesis docs on Authorization
expectType<Annotation>(
await client.annotations.fetchAnnotation(ANNOTATION_ID)
)
expectType<Annotation>(
await client.annotations.createAnnotation(NEW_ANNOTATION)
)
expectType<Group>(
await client.groups.fetchGroup(GROUP_ID)
)
From ./examples/clients/authClientForwardedUser.test-d.ts#25~29
expectType<IndexResponse>(
await client.root()
)
Generated using TypeDoc