Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add backwards compatible type params for HTTPRequest and HTTPStreamRequest #289

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/http-client/http-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ import { SupportedFaunaAPIPaths } from "./paths";
/**
* An object representing an http request.
* The {@link Client} provides this to the {@link HTTPClient} implementation.
*
* @typeParam T - The expected type of the request sent to fauna.
*/
export type HTTPRequest = {
export type HTTPRequest<T = QueryRequest> = {
/**
* The timeout of each http request, in milliseconds.
*/
client_timeout_ms: number;

/** The encoded Fauna query to send */
data: QueryRequest;
/** The encoded request to send */
data: T;

/** Headers in object format */
headers: Record<string, string | undefined>;
Expand Down Expand Up @@ -73,11 +75,13 @@ export interface HTTPClient {
/**
* An object representing an http request.
* The {@link Client} provides this to the {@link HTTPStreamClient} implementation.
*
* @typeParam T - The expected type of the request sent to fauna.
*/
export type HTTPStreamRequest = {
/** The encoded Fauna query to send */
export type HTTPStreamRequest<T = StreamRequest> = {
/** The encoded Fauna request to send */
// TODO: Allow type to be a QueryRequest once implemented by the db
data: StreamRequest;
data: T;

/** Headers in object format */
headers: Record<string, string | undefined>;
Expand Down
Loading