Skip to content

Commit

Permalink
chore: implement queryDataApiVersion
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel J. Lauk committed Nov 16, 2021
1 parent 2453e70 commit d9cd35a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/api/v4/apiv4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
backendsResponseGuard,
binnedQueryResponseGuard,
channelSearchResponseGuard,
dataApiVersionResponseGuard,
eventsQueryResponseGuard,
} from './apiv4decoders'

Expand Down Expand Up @@ -50,6 +51,14 @@ export type DataApiV4ChannelSearchResult = {
channels: DataApiV4ChannelSearchResultItem[]
}

/** response for a data api version query operation */
export type DataApiV4DataApiVersionResult = {
data_api_version: {
major: number
minor?: number
}
}

/** options for an events query operation */
export type DataApiV4EventsQueryOptions = {
/** the backend where the channel is stored */
Expand Down Expand Up @@ -169,6 +178,15 @@ export class DataApiV4Client {
return backendsResponseGuard(result)
}

/** query data api version */
public async queryDataApiVersion(
timeoutMs: number = DEFAULT_TIMEOUT
): Promise<DataApiV4DataApiVersionResult> {
const url = `${this.baseUrl}/version`
const result = await get(url, timeoutMs)
return dataApiVersionResponseGuard(result)
}

/** query for data (raw) */
public async queryEvents(
queryOptions: DataApiV4EventsQueryOptions,
Expand Down

0 comments on commit d9cd35a

Please sign in to comment.