Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
199 changes: 101 additions & 98 deletions clerk-typedoc/shared/clerk.mdx

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions clerk-typedoc/shared/payment-attempt-query-result.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Properties

| Property | Type | Description |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| <a id="data"></a> `data` | <code>undefined \| null \| [BillingPaymentResource](/docs/reference/javascript/types/billing-payment-resource)</code> | The payment attempt object, `undefined` before the first fetch, or `null` if no payment attempt exists. |
| <a id="error"></a> `error` | <code>null \| ClerkAPIResponseError</code> | Any error that occurred during the data fetch, or `undefined` if no error occurred. |
| <a id="isfetching"></a> `isFetching` | `boolean` | A boolean that indicates whether any request is still in flight, including background updates. |
| <a id="isloading"></a> `isLoading` | `boolean` | A boolean that indicates whether the initial data is still being fetched. |
8 changes: 8 additions & 0 deletions clerk-typedoc/shared/plan-details-query-result.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Properties

| Property | Type | Description |
| ------------------------------------ | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| <a id="data"></a> `data` | <code>undefined \| null \| [BillingPlanResource](/docs/reference/javascript/types/billing-plan-resource)</code> | The plan object, `undefined` before the first fetch, or `null` if no plan exists. |
| <a id="error"></a> `error` | <code>null \| ClerkAPIResponseError</code> | Any error that occurred during the data fetch, or `undefined` if no error occurred. |
| <a id="isfetching"></a> `isFetching` | `boolean` | A boolean that indicates whether any request is still in flight, including background updates. |
| <a id="isloading"></a> `isLoading` | `boolean` | A boolean that indicates whether the initial data is still being fetched. |
8 changes: 8 additions & 0 deletions clerk-typedoc/shared/statement-query-result.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Properties

| Property | Type | Description |
| ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
| <a id="data"></a> `data` | <code>undefined \| null \| [BillingStatementResource](/docs/reference/javascript/types/billing-statement-resource)</code> | The statement object, `undefined` before the first fetch, or `null` if no statement exists. |
| <a id="error"></a> `error` | <code>null \| [ClerkAPIResponseError](/docs/reference/javascript/types/clerk-api-response-error)</code> | Any error that occurred during the data fetch, or `undefined` if no error occurred. |
| <a id="isfetching"></a> `isFetching` | `boolean` | A boolean that indicates whether any request is still in flight, including background updates. |
| <a id="isloading"></a> `isLoading` | `boolean` | A boolean that indicates whether the initial data is still being fetched. |
46 changes: 46 additions & 0 deletions clerk-typedoc/shared/use-api-keys-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
The `useAPIKeys()` hook provides access to paginated API keys for the current user or organization.

## Parameters

| Parameter | Type |
| --------- | ---- |
| `params?` | `T` |

## Returns

[`UseAPIKeysReturn`](use-api-keys-return-1.mdx)\<`T`\>

## Examples

### Basic usage with default pagination

```tsx
const { data, isLoading, page, pageCount, fetchNext, fetchPrevious } =
useAPIKeys({
subject: "user_123",
pageSize: 10,
initialPage: 1,
});
```

### With search query

```tsx
const [searchValue, setSearchValue] = useState("");
const debouncedSearch = useDebounce(searchValue, 500);

const { data, isLoading } = useAPIKeys({
subject: "user_123",
query: debouncedSearch.trim(),
pageSize: 10,
});
```

### Infinite scroll

```tsx
const { data, isLoading, fetchNext, hasNextPage } = useAPIKeys({
subject: "user_123",
infinite: true,
});
```
9 changes: 9 additions & 0 deletions clerk-typedoc/shared/use-api-keys-params-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Properties

| Property | Type | Description |
| ------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="enabled"></a> `enabled?` | `boolean` | If `true`, a request will be triggered when the hook is mounted. Defaults to `true`. |
| <a id="infinite"></a> `infinite?` | `boolean` | If `true`, newly fetched data will be appended to the existing list rather than replacing it. Useful for implementing infinite scroll functionality. Defaults to `false`. |
| <a id="initialpage"></a> `initialPage?` | `number` | A number that specifies which page to fetch. For example, if `initialPage` is set to `10`, it will skip the first 9 pages and fetch the 10th page. Defaults to `1`. |
| <a id="keeppreviousdata"></a> `keepPreviousData?` | `boolean` | If `true`, the previous data will be kept in the cache until new data is fetched. Defaults to `false`. |
| <a id="pagesize"></a> `pageSize?` | `number` | A number that specifies the maximum number of results to return per page. Defaults to `10`. |
19 changes: 19 additions & 0 deletions clerk-typedoc/shared/use-api-keys-return-1.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Properties

| Property | Type | Description |
| ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="count"></a> `count` | `number` | The total count of data that exist remotely. |
| <a id="data"></a> `data` | <code>APIKeyResource[]</code> | An array that contains the fetched data. For example, for the `memberships` attribute, data will be an array of [`OrganizationMembership`](/docs/reference/javascript/types/organization-membership) objects. |
| <a id="error"></a> `error` | <code>null \| ClerkAPIResponseError</code> | Clerk's API response error object. |
| <a id="fetchnext"></a> `fetchNext` | <code>() => void</code> | A function that triggers the next page to be loaded. This is the same as `fetchPage(page => Math.min(pageCount, page + 1))`. |
| <a id="fetchpage"></a> `fetchPage` | `ValueOrSetter`\<`number`\> | A function that triggers a specific page to be loaded. |
| <a id="fetchprevious"></a> `fetchPrevious` | <code>() => void</code> | A function that triggers the previous page to be loaded. This is the same as `fetchPage(page => Math.max(0, page - 1))`. |
| <a id="hasnextpage"></a> `hasNextPage` | `boolean` | A boolean that indicates if there are available pages to be fetched. |
| <a id="haspreviouspage"></a> `hasPreviousPage` | `boolean` | A boolean that indicates if there are available pages to be fetched. |
| <a id="iserror"></a> `isError` | `boolean` | A boolean that indicates the request failed. |
| <a id="isfetching"></a> `isFetching` | `boolean` | A boolean that is `true` if there is an ongoing request or a revalidation. |
| <a id="isloading"></a> `isLoading` | `boolean` | A boolean that is `true` if there is an ongoing request and there is no fetched data. |
| <a id="page"></a> `page` | `number` | The current page. |
| <a id="pagecount"></a> `pageCount` | `number` | The total amount of pages. It is calculated based on `count`, `initialPage`, and `pageSize`. |
| <a id="revalidate"></a> `revalidate` | <code>() => Promise\<void\></code> | A function that triggers a revalidation of the current page. |
| <a id="setdata"></a> `setData` | `T` _extends_ <code>\{ infinite: true; \}</code> ? `true` : `false` _extends_ `true` ? `CacheSetter`\<<code>(undefined \| [ClerkPaginatedResponse](/docs/reference/javascript/types/clerk-paginated-response)\<APIKeyResource\>)[]</code>\> : `CacheSetter`\<<code>undefined \| [ClerkPaginatedResponse](/docs/reference/javascript/types/clerk-paginated-response)\<APIKeyResource\></code>\> | A function that allows you to set the data manually. |
8 changes: 8 additions & 0 deletions clerk-typedoc/shared/use-payment-attempt-query-params.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## Properties

| Property | Type | Description |
| ------------------------------------------------- | ------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| <a id="enabled"></a> `enabled?` | `boolean` | If `true`, a request will be triggered when the hook is mounted. Defaults to `true`. |
| <a id="for"></a> `for?` | <code>"user" \| "organization"</code> | Specifies whether to fetch the payment attempt for an organization or a user. Defaults to `'user'`. |
| <a id="keeppreviousdata"></a> `keepPreviousData?` | `boolean` | If true, the previous data will be kept in the cache until new data is fetched. Defaults to `false`. |
| <a id="paymentattemptid"></a> `paymentAttemptId` | `string` | The payment attempt ID to fetch. |
Loading