UNPKG

graphdb-workbench

Version:
62 lines (61 loc) 1.63 kB
/** * Represents the options that can be used for an HTTP request. */ export interface HttpOptions { /** * Optional headers for the HTTP request. * * A record of key-value pairs where the key is the header name and the value is the header value. * * Example: * ``` * { * 'Authorization': 'Bearer token', * 'Content-Type': 'application/json' * } * ``` */ headers?: Record<string, string>; /** * Optional body for the HTTP request. * * Can be any type of data, such as a JSON object or form data, depending on the request requirements. */ body?: unknown; /** * Optional query parameters for the HTTP request. * * A record of key-value pairs where the key is the parameter name, and the value can be a string or a number. * These parameters will be serialized and appended to the URL as a query string. * * Example: * ``` * { * page: 1, * search: 'keyword' * } * ``` */ params?: Record<string, string | number>; } /** * Extended to include a typed responseType property. * @inheritDoc */ export interface HttpOptionsTypedResponse extends HttpOptions { responseType?: 'body' | 'response'; } /** * Specify that the `responseType` is 'body'. * @inheritDoc */ export interface HttpOptionsBodyResponse extends HttpOptionsTypedResponse { responseType: 'body'; } /** * Specify that the `responseType` is 'response'. * @inheritDoc */ export interface HttpOptionsHttpResponse extends HttpOptionsTypedResponse { responseType: 'response'; }