Skip to content

Commit 3bfa221

Browse files
committed
docs: update typedoc
1 parent fb9965d commit 3bfa221

File tree

4 files changed

+362
-202
lines changed

4 files changed

+362
-202
lines changed

src/PostgrestClient.ts

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ import PostgrestBuilder from './PostgrestBuilder'
44
import { DEFAULT_HEADERS } from './constants'
55
import { Fetch, GenericSchema } from './types'
66

7+
/**
8+
* PostgREST client.
9+
*
10+
* @typeParam Database - Types for the schema from the [type
11+
* generator](https://supabase.com/docs/reference/javascript/next/typescript-support)
12+
*
13+
* @typeParam SchemaName - Postgres schema to switch to. Must be a string
14+
* literal, the same one passed to the constructor. If the schema is not
15+
* `"public"`, this must be supplied manually.
16+
*/
717
export default class PostgrestClient<
818
Database = any,
919
SchemaName extends string & keyof Database = 'public' extends keyof Database
@@ -22,9 +32,11 @@ export default class PostgrestClient<
2232
/**
2333
* Creates a PostgREST client.
2434
*
25-
* @param url URL of the PostgREST endpoint.
26-
* @param headers Custom headers.
27-
* @param schema Postgres schema to switch to.
35+
* @param url - URL of the PostgREST endpoint
36+
* @param options - Named parameters
37+
* @param options.headers - Custom headers
38+
* @param options.schema - Postgres schema to switch to
39+
* @param options.fetch - Custom fetch
2840
*/
2941
constructor(
3042
url: string,
@@ -47,7 +59,7 @@ export default class PostgrestClient<
4759
/**
4860
* Perform a query on a table or a view.
4961
*
50-
* @param relation The table or view name to query.
62+
* @param relation - The table or view name to query
5163
*/
5264
from<
5365
TableName extends string & keyof Schema['Tables'],
@@ -69,9 +81,23 @@ export default class PostgrestClient<
6981
/**
7082
* Perform a function call.
7183
*
72-
* @param fn The function name to call.
73-
* @param args The parameters to pass to the function call.
74-
* @param options Named parameters.
84+
* @param fn - The function name to call
85+
* @param args - The arguments to pass to the function call
86+
* @param options - Named parameters
87+
* @param options.head - When set to `true`, `data` will not be returned.
88+
* Useful if you only need the count.
89+
* @param options.count - Count algorithm to use to count rows returned by the
90+
* function. Only applicable for [set-returning
91+
* functions](https://www.postgresql.org/docs/current/functions-srf.html).
92+
*
93+
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
94+
* hood.
95+
*
96+
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
97+
* statistics under the hood.
98+
*
99+
* `"estimated"`: Uses exact count for low numbers and planned count for high
100+
* numbers.
75101
*/
76102
rpc<
77103
FunctionName extends string & keyof Schema['Functions'],
@@ -83,9 +109,7 @@ export default class PostgrestClient<
83109
head = false,
84110
count,
85111
}: {
86-
/** When set to true, no data will be returned. */
87112
head?: boolean
88-
/** Count algorithm to use to count rows in a table. */
89113
count?: 'exact' | 'planned' | 'estimated'
90114
} = {}
91115
): PostgrestFilterBuilder<

0 commit comments

Comments
 (0)