UNPKG

1.9 kBTypeScriptView Raw
1import type { RequestRequestOptions } from "./RequestRequestOptions.js";
2import type { RequestHeaders } from "./RequestHeaders.js";
3import type { Url } from "./Url.js";
4/**
5 * Parameters that can be passed into `request(route, parameters)` or `endpoint(route, parameters)` methods
6 */
7export type RequestParameters = {
8 /**
9 * Base URL to be used when a relative URL is passed, such as `/orgs/{org}`.
10 * If `baseUrl` is `https://enterprise.acme-inc.com/api/v3`, then the request
11 * will be sent to `https://enterprise.acme-inc.com/api/v3/orgs/{org}`.
12 */
13 baseUrl?: Url;
14 /**
15 * HTTP headers. Use lowercase keys.
16 */
17 headers?: RequestHeaders;
18 /**
19 * Media type options, see {@link https://developer.github.com/v3/media/|GitHub Developer Guide}
20 */
21 mediaType?: {
22 /**
23 * `json` by default. Can be `raw`, `text`, `html`, `full`, `diff`, `patch`, `sha`, `base64`. Depending on endpoint
24 */
25 format?: string;
26 /**
27 * Custom media type names of {@link https://docs.github.com/en/graphql/overview/schema-previews|GraphQL API Previews} without the `-preview` suffix.
28 * Example for single preview: `['squirrel-girl']`.
29 * Example for multiple previews: `['squirrel-girl', 'mister-fantastic']`.
30 */
31 previews?: string[];
32 };
33 /**
34 * Pass custom meta information for the request. The `request` object will be returned as is.
35 */
36 request?: RequestRequestOptions;
37 /**
38 * Any additional parameter will be passed as follows
39 * 1. URL parameter if `':parameter'` or `{parameter}` is part of `url`
40 * 2. Query parameter if `method` is `'GET'` or `'HEAD'`
41 * 3. Request body if `parameter` is `'data'`
42 * 4. JSON in the request body in the form of `body[parameter]` unless `parameter` key is `'data'`
43 */
44 [parameter: string]: unknown;
45};