docs: generate + configure js sdk reference (#9714)

Manually generate the JS SDK reference + add it to the sidebar
This commit is contained in:
Shahed Nasser
2024-10-22 17:31:32 +00:00
committed by GitHub
parent af3c6b0d93
commit a1190b7208
476 changed files with 76450 additions and 189 deletions
@@ -0,0 +1,25 @@
import { TypeList } from "docs-ui"
# create
This method creates a customer. It sends a request to the
[Create Customer](https://docs.medusajs.com/v2/api/admin#customers\_postcustomers) API route.
## Example
```ts
sdk.admin.customer.create({
email: "customer@gmail.com"
})
.then(({ customer }) => {
console.log(customer)
})
```
## Parameters
<TypeList types={[{"name":"body","type":"`AdminCreateCustomer`","description":"The customer's details.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"Configure the fields to retrieve in the customer.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="create"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;AdminCustomerResponse&#62;","optional":false,"defaultValue":"","description":"The customer's details.","expandable":false,"children":[{"name":"AdminCustomerResponse","type":"`AdminCustomerResponse`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="create"/>
@@ -0,0 +1,24 @@
import { TypeList } from "docs-ui"
# delete
This method deletes a customer by its ID. It sends a request to the
[Delete Customer](https://docs.medusajs.com/v2/api/admin#customers\_deletecustomersid)
API route.
## Example
```ts
sdk.admin.customer.delete("cus_123")
.then(({ deleted }) => {
console.log(deleted)
})
```
## Parameters
<TypeList types={[{"name":"id","type":"`string`","description":"The customer's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;AdminCustomerDeleteResponse&#62;","optional":false,"defaultValue":"","description":"The deletion's details.","expandable":false,"children":[{"name":"AdminCustomerDeleteResponse","type":"`AdminCustomerDeleteResponse`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="delete"/>
@@ -0,0 +1,54 @@
import { TypeList } from "docs-ui"
# list
This method retrieves a paginated list of customers. It sends a request to the
[List Customers](https://docs.medusajs.com/v2/api/admin#customers\_getcustomers)
API route.
## Example
To retrieve the list of customers:
```ts
sdk.admin.customer.list()
.then(({ customers, count, limit, offset }) => {
console.log(customers)
})
```
To configure the pagination, pass the `limit` and `offset` query parameters.
For example, to retrieve only 10 items and skip 10 items:
```ts
sdk.admin.customer.list({
limit: 10,
offset: 10
})
.then(({ customers, count, limit, offset }) => {
console.log(customers)
})
```
Using the `fields` query parameter, you can specify the fields and relations to retrieve
in each customer:
```ts
sdk.admin.customer.list({
fields: "id,*groups"
})
.then(({ customers, count, limit, offset }) => {
console.log(customers)
})
```
Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
## Parameters
<TypeList types={[{"name":"queryParams","type":"`AdminCustomerFilters`","description":"Filters and pagination configurations.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="list"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;AdminCustomerListResponse&#62;","optional":false,"defaultValue":"","description":"The paginated list of customers.","expandable":false,"children":[{"name":"AdminCustomerListResponse","type":"`AdminCustomerListResponse`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="list"/>
@@ -0,0 +1,39 @@
import { TypeList } from "docs-ui"
# retrieve
This method retrieves a customer by its ID. It sends a request to the
[Get Customer](https://docs.medusajs.com/v2/api/admin#customers\_getcustomersid)
API route.
## Example
To retrieve a customer by its ID:
```ts
sdk.admin.customer.retrieve("cus_123")
.then(({ customer }) => {
console.log(customer)
})
```
To specify the fields and relations to retrieve:
```ts
sdk.admin.customer.retrieve("cus_123", {
fields: "id,*groups"
})
.then(({ customer }) => {
console.log(customer)
})
```
Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
## Parameters
<TypeList types={[{"name":"id","type":"`string`","description":"The customer's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"Configure the fields to retrieve in the customer.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieve"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;AdminCustomerResponse&#62;","optional":false,"defaultValue":"","description":"The customer's details.","expandable":false,"children":[{"name":"AdminCustomerResponse","type":"`AdminCustomerResponse`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="retrieve"/>
@@ -0,0 +1,25 @@
import { TypeList } from "docs-ui"
# update
This method updates a customer's details. It sends a request to the
[Update Customer](https://docs.medusajs.com/v2/api/admin#customers\_postcustomersid) API route.
## Example
```ts
sdk.admin.customer.update("cus_123", {
first_name: "John"
})
.then(({ customer }) => {
console.log(customer)
})
```
## Parameters
<TypeList types={[{"name":"id","type":"`string`","description":"The customer's ID.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"body","type":"`AdminUpdateCustomer`","description":"The details to update of the customer.","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"query","type":"[SelectParams](../../../../../types/HttpTypes/interfaces/types.HttpTypes.SelectParams/page.mdx)","description":"Configure the fields to retrieve in the customer.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"fields","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"Headers to pass in the request.","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="update"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;AdminCustomerResponse&#62;","optional":false,"defaultValue":"","description":"The customer's details.","expandable":false,"children":[{"name":"AdminCustomerResponse","type":"`AdminCustomerResponse`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="update"/>
@@ -0,0 +1,223 @@
import { TypeList } from "docs-ui"
# client
## baseUrl
___
## globalHeaders
### tags
Tags to cache data under for Next.js applications.
Learn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).
___
## publishableKey
___
## apiKey
___
## auth
### type
### jwtTokenStorageKey
### jwtTokenStorageMethod
### type
### jwtTokenStorageKey
### jwtTokenStorageMethod
___
## logger
### error
#### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
#### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### warn
#### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
#### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### info
#### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
#### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### debug
#### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
#### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
___
## debug
## error
### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
___
## warn
### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
___
## info
### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
___
## debug
### Parameters
<TypeList types={[{"name":"messages","type":"`string`[]","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
### Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="__type"/>
## constructor
### Parameters
<TypeList types={[{"name":"config","type":"[Config](../../../types/js_sdk.admin.Config/page.mdx)","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"baseUrl","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"globalHeaders","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"publishableKey","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"apiKey","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"auth","type":"`object`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"type","type":"`\"jwt\"` \\| `\"session\"`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"jwtTokenStorageKey","type":"`string`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"jwtTokenStorageMethod","type":"`\"local\"` \\| `\"session\"` \\| `\"memory\"` \\| `\"nostore\"`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"logger","type":"[Logger](../../../types/js_sdk.admin.Logger/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"error","type":"(...`messages`: `string`[]) => `void`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"warn","type":"(...`messages`: `string`[]) => `void`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"info","type":"(...`messages`: `string`[]) => `void`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"debug","type":"(...`messages`: `string`[]) => `void`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"debug","type":"`boolean`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="new Client"/>
___
`fetch` closely follows (and uses under the hood) the native `fetch` API. There are, however, few key differences:
- Non 2xx statuses throw a `FetchError` with the status code as the `status` property, rather than resolving the promise
- You can pass `body` and `query` as objects, and they will be encoded and stringified.
- The response gets parsed as JSON if the `accept` header is set to `application/json`, otherwise the raw Response object is returned
Since the response is dynamically determined, we cannot know if it is JSON or not. Therefore, it is important to pass `Response` as the return type
## Type Parameters
<TypeList types={[{"name":"T","type":"`unknown`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="fetch"/>
## Parameters
<TypeList types={[{"name":"input","type":"`string` \\| `URL` \\| `Request`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"init","type":"[FetchArgs](../../../types/js_sdk.admin.FetchArgs/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"query","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"body","type":"`RequestInit`[`\"body\"`] \\| `Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="fetch"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;T&#62;","optional":false,"defaultValue":"","description":"Promise&#60;T&#62;","expandable":false,"children":[{"name":"T","type":"T","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="fetch"/>
`fetchStream` is a helper method to deal with server-sent events. It returns an object with a stream and an abort function.
It follows a very similar interface to `fetch`, with the return value being an async generator.
The stream is an async generator that yields `ServerSentEventMessage` objects, which contains the event name, stringified data, and few other properties.
The caller is responsible for handling `disconnect` events and aborting the stream. The caller is also responsible for parsing the data field.
## Parameters
<TypeList types={[{"name":"input","type":"`string` \\| `URL` \\| `Request`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"init","type":"[FetchArgs](../../../types/js_sdk.admin.FetchArgs/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"query","type":"`Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"headers","type":"[ClientHeaders](../../../types/js_sdk.admin.ClientHeaders/page.mdx)","description":"","optional":true,"defaultValue":"","expandable":false,"children":[{"name":"tags","type":"`string`[]","description":"Tags to cache data under for Next.js applications.\n\nLearn more in [Next.js's documentation](https://nextjs.org/docs/app/building-your-application/caching#fetch-optionsnexttags-and-revalidatetag).","optional":false,"defaultValue":"","expandable":false,"children":[]}]},{"name":"body","type":"`RequestInit`[`\"body\"`] \\| `Record<string, any>`","description":"","optional":true,"defaultValue":"","expandable":false,"children":[]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="fetchStream"/>
## Returns
<TypeList types={[{"name":"Promise","type":"Promise&#60;[FetchStreamResponse](../../../interfaces/js_sdk.admin.FetchStreamResponse/page.mdx)&#62;","optional":false,"defaultValue":"","description":"FetchStreamResponse","expandable":false,"children":[{"name":"FetchStreamResponse","type":"[FetchStreamResponse](../../../interfaces/js_sdk.admin.FetchStreamResponse/page.mdx)","optional":false,"defaultValue":"","description":"","expandable":false,"children":[{"name":"stream","type":"`null` \\| AsyncGenerator&#60;[ServerSentEventMessage](../../../interfaces/js_sdk.admin.ServerSentEventMessage/page.mdx), void, unknown&#62;","description":"","optional":false,"defaultValue":"","expandable":false,"children":[{"name":"comment","type":"`string`","description":"Ignored by the client.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"event","type":"`string`","description":"A string identifying the type of event described.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"data","type":"`string`","description":"The data field for the message. Split by new lines.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"id","type":"`string` \\| `number`","description":"The event ID to set the EventSource object's last event ID value.","optional":true,"defaultValue":"","expandable":false,"children":[]},{"name":"retry","type":"`number`","description":"The reconnection time.","optional":true,"defaultValue":"","expandable":false,"children":[]}]},{"name":"abort","type":"() => `void`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]}]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="fetchStream"/>
## Parameters
<TypeList types={[{"name":"token","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="setToken"/>
## Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="setToken"/>
## Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="clearToken"/>
## Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="clearToken_"/>
## Returns
<TypeList types={[{"name":"ClientFetch","type":"(`input`: [FetchInput](../../../types/js_sdk.admin.FetchInput/page.mdx), `init?`: [FetchArgs](../../../types/js_sdk.admin.FetchArgs/page.mdx)) => Promise&#60;Response&#62;","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="initClient"/>
## Returns
<TypeList types={[{"name":"object \\| object","type":"`object` \\| `object`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getApiKeyHeader_"/>
## Returns
<TypeList types={[{"name":"object \\| object","type":"`object` \\| `object`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getPublishableKeyHeader_"/>
## Returns
<TypeList types={[{"name":"object \\| object","type":"`object` \\| `object`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getJwtHeader_"/>
## Parameters
<TypeList types={[{"name":"token","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="setToken_"/>
## Returns
<TypeList types={[{"name":"void","type":"`void`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="setToken_"/>
## Returns
<TypeList types={[{"name":"undefined \\| null \\| string","type":"`undefined` \\| `null` \\| `string`","optional":false,"defaultValue":"","description":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getToken_"/>
## Returns
<TypeList types={[{"name":"storageMethod","type":"`\"session\"` \\| `\"local\"` \\| `\"memory\"` \\| `\"nostore\"`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"storageKey","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getTokenStorageInfo_"/>
<TypeList types={[{"name":"storageMethod","type":"`\"session\"` \\| `\"local\"` \\| `\"memory\"` \\| `\"nostore\"`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]},{"name":"storageKey","type":"`string`","description":"","optional":false,"defaultValue":"","expandable":false,"children":[]}]} expandUrl="https://docs.medusajs.com/v2/advanced-development/data-models/manage-relationships#retrieve-records-of-relation" sectionTitle="getTokenStorageInfo_"/>