* Fetch a single resource by its ID.
(
key: string,
params: Optional<Parameters<TResource["find"]>[0], "session">
)
| 84 | * Fetch a single resource by its ID. |
| 85 | */ |
| 86 | async find( |
| 87 | key: string, |
| 88 | params: Optional<Parameters<TResource["find"]>[0], "session"> |
| 89 | ): FindReturnType<TResource> { |
| 90 | return this.runTask( |
| 91 | key, |
| 92 | async (client, task, io) => { |
| 93 | const resource = (await client.rest[this.resourceType].find( |
| 94 | this.#withSession(params) |
| 95 | )) as Awaited<ReturnType<TResource["find"]>>; |
| 96 | |
| 97 | return JSON.parse(JSON.stringify(resource)); |
| 98 | }, |
| 99 | { |
| 100 | name: `Find ${this.resourceType}`, |
| 101 | params, |
| 102 | properties: basicProperties(params), |
| 103 | } |
| 104 | ); |
| 105 | } |
| 106 | |
| 107 | async #allSinglePage( |
| 108 | key: string, |