2023-06-23 22:13:03 -06:00
|
|
|
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
|
|
|
2023-07-21 11:33:01 -06:00
|
|
|
[Home](./index.md) > [iceshrimp-js](./iceshrimp-js.md) > [api](./iceshrimp-js.api.md) > [APIClient](./iceshrimp-js.api.apiclient.md) > [request](./iceshrimp-js.api.apiclient.request.md)
|
2023-06-23 22:13:03 -06:00
|
|
|
|
|
|
|
## api.APIClient.request() method
|
|
|
|
|
|
|
|
**Signature:**
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
request<E extends keyof Endpoints, P extends Endpoints[E]["req"]>(
|
|
|
|
endpoint: E,
|
|
|
|
params?: P,
|
|
|
|
credential?: string | null | undefined,
|
|
|
|
): Promise<
|
|
|
|
Endpoints[E]["res"] extends {
|
|
|
|
$switch: {
|
|
|
|
$cases: [any, any][];
|
|
|
|
$default: any;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
? IsCaseMatched<E, P, 0> extends true
|
|
|
|
? GetCaseResult<E, P, 0>
|
|
|
|
: IsCaseMatched<E, P, 1> extends true
|
|
|
|
? GetCaseResult<E, P, 1>
|
|
|
|
: IsCaseMatched<E, P, 2> extends true
|
|
|
|
? GetCaseResult<E, P, 2>
|
|
|
|
: IsCaseMatched<E, P, 3> extends true
|
|
|
|
? GetCaseResult<E, P, 3>
|
|
|
|
: IsCaseMatched<E, P, 4> extends true
|
|
|
|
? GetCaseResult<E, P, 4>
|
|
|
|
: IsCaseMatched<E, P, 5> extends true
|
|
|
|
? GetCaseResult<E, P, 5>
|
|
|
|
: IsCaseMatched<E, P, 6> extends true
|
|
|
|
? GetCaseResult<E, P, 6>
|
|
|
|
: IsCaseMatched<E, P, 7> extends true
|
|
|
|
? GetCaseResult<E, P, 7>
|
|
|
|
: IsCaseMatched<E, P, 8> extends true
|
|
|
|
? GetCaseResult<E, P, 8>
|
|
|
|
: IsCaseMatched<E, P, 9> extends true
|
|
|
|
? GetCaseResult<E, P, 9>
|
|
|
|
: Endpoints[E]["res"]["$switch"]["$default"]
|
|
|
|
: Endpoints[E]["res"]
|
|
|
|
>;
|
|
|
|
```
|
|
|
|
|
|
|
|
## Parameters
|
|
|
|
|
|
|
|
| Parameter | Type | Description |
|
|
|
|
| --- | --- | --- |
|
|
|
|
| endpoint | E | |
|
|
|
|
| params | P | _(Optional)_ |
|
|
|
|
| credential | string \| null \| undefined | _(Optional)_ |
|
|
|
|
|
|
|
|
**Returns:**
|
|
|
|
|
2023-07-21 11:33:01 -06:00
|
|
|
Promise< [Endpoints](./iceshrimp-js.endpoints.md)<!-- -->\[E\]\["res"\] extends { $switch: { $cases: \[any, any\]\[\]; $default: any; }; } ? IsCaseMatched<E, P, 0> extends true ? GetCaseResult<E, P, 0> : IsCaseMatched<E, P, 1> extends true ? GetCaseResult<E, P, 1> : IsCaseMatched<E, P, 2> extends true ? GetCaseResult<E, P, 2> : IsCaseMatched<E, P, 3> extends true ? GetCaseResult<E, P, 3> : IsCaseMatched<E, P, 4> extends true ? GetCaseResult<E, P, 4> : IsCaseMatched<E, P, 5> extends true ? GetCaseResult<E, P, 5> : IsCaseMatched<E, P, 6> extends true ? GetCaseResult<E, P, 6> : IsCaseMatched<E, P, 7> extends true ? GetCaseResult<E, P, 7> : IsCaseMatched<E, P, 8> extends true ? GetCaseResult<E, P, 8> : IsCaseMatched<E, P, 9> extends true ? GetCaseResult<E, P, 9> : [Endpoints](./iceshrimp-js.endpoints.md)<!-- -->\[E\]\["res"\]\["$switch"\]\["$default"\] : [Endpoints](./iceshrimp-js.endpoints.md)<!-- -->\[E\]\["res"\] >
|
2023-06-23 22:13:03 -06:00
|
|
|
|