Skip to content

Commit

Permalink
Update SDK Documentation (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
caidobot authored Nov 28, 2024
1 parent d93a1c0 commit b617062
Show file tree
Hide file tree
Showing 3 changed files with 249 additions and 15 deletions.
117 changes: 108 additions & 9 deletions src/reference/sdks/backend/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ The console.

This is currently the same as the global `console`.

##### env

> **env**: [`EnvironmentSDK`](index.md#environmentsdk)
The SDK for the Environment service.

##### events

> **events**: [`EventsSDK`](index.md#eventssdkapi-events)\<`API`, `Events`\>
Expand Down Expand Up @@ -418,24 +424,60 @@ Get the host of the request.

##### getMethod()

###### getMethod()

> **getMethod**(): `string`
Get the HTTP method of the request.

Get the raw version by passing `{ raw: true }` in the options.

###### Returns

`string`

###### getMethod(options)

> **getMethod**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array`
###### Parameters

| Parameter | Type |
| ------ | ------ |
| `options` | [`RawOption`](index.md#rawoption) |

###### Returns

`Uint8Array`

##### getPath()

###### getPath()

> **getPath**(): `string`
Get the path of the request.

Get the raw version by passing `{ raw: true }` in the options.

###### Returns

`string`

###### getPath(options)

> **getPath**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array`
###### Parameters

| Parameter | Type |
| ------ | ------ |
| `options` | [`RawOption`](index.md#rawoption) |

###### Returns

`Uint8Array`

##### getPort()

> **getPort**(): `number`
Expand All @@ -448,16 +490,34 @@ Get the port of the request.

##### getQuery()

###### getQuery()

> **getQuery**(): `string`
Get the unparsed query of the request.

Get the raw version by passing `{ raw: true }` in the options.

Excludes the leading `?`.

###### Returns

`string`

###### getQuery(options)

> **getQuery**(`options`: [`RawOption`](index.md#rawoption)): `Uint8Array`
###### Parameters

| Parameter | Type |
| ------ | ------ |
| `options` | [`RawOption`](index.md#rawoption) |

###### Returns

`Uint8Array`

##### getRaw()

> **getRaw**(): [`RequestSpecRaw`](index.md#requestspecraw)
Expand Down Expand Up @@ -570,7 +630,7 @@ It will also update the `Host` header.

##### setMethod()

> **setMethod**(`method`: `string`): `void`
> **setMethod**(`method`: [`Bytes`](index.md#bytes)): `void`
Set the HTTP method of the request.

Expand All @@ -580,23 +640,23 @@ All strings are accepted.

| Parameter | Type |
| ------ | ------ |
| `method` | `string` |
| `method` | [`Bytes`](index.md#bytes) |

###### Returns

`void`

##### setPath()

> **setPath**(`path`: `string`): `void`
> **setPath**(`path`: [`Bytes`](index.md#bytes)): `void`
Set the path of the request.

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `path` | `string` |
| `path` | [`Bytes`](index.md#bytes) |

###### Returns

Expand All @@ -622,7 +682,7 @@ The port number must be between 1 and 65535.

##### setQuery()

> **setQuery**(`query`: `string`): `void`
> **setQuery**(`query`: [`Bytes`](index.md#bytes)): `void`
Set the unparsed query of the request.

Expand All @@ -632,7 +692,7 @@ The query string should not include the leading `?`.

| Parameter | Type |
| ------ | ------ |
| `query` | `string` |
| `query` | [`Bytes`](index.md#bytes) |

###### Returns

Expand Down Expand Up @@ -2034,12 +2094,52 @@ Promise or value.

***

### RawOption

> **RawOption**: `object`
Option to return raw value

#### Type declaration

##### raw

> **raw**: `true`
***

### RequestSource

> **RequestSource**: [`ID`](index.md#id) \| [`Request`](index.md#request-2) \| [`RequestSpec`](index.md#requestspec) \| [`RequestSpecRaw`](index.md#requestspecraw)
The source of a request.

## Environment

### EnvironmentSDK

> **EnvironmentSDK**: `object`
The SDK for the Environment service.

#### Type declaration

##### getVar()

Get the value of an environment variable.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `name` | `string` | The name of the environment variable. |

###### Returns

`undefined` \| `string`

The value of the environment variable.

## Other

### Database
Expand All @@ -2055,7 +2155,6 @@ Each connection will be spawned in a worker thread.
const db = await open({ filename: "path/to/database.sqlite" });
await db.exec("CREATE TABLE test (id INTEGER PRIMARY KEY, name TEXT);");
await db.exec("INSERT INTO test (name) VALUES ('foo');");
```

#### Constructors

Expand Down Expand Up @@ -2087,7 +2186,7 @@ This method allows one or more SQL statements to be executed without returning a

##### prepare()

> **prepare**(`sql`: `string`): `Promise`\<[`Statement`](index.md#statement)\>
> **prepare**(`sql`: `string`): [`Statement`](index.md#statement)

Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3ref/stmt.html).

Expand All @@ -2099,7 +2198,7 @@ Compiles a SQL statement into a [prepared statement](https://www.sqlite.org/c3re

###### Returns

`Promise`\<[`Statement`](index.md#statement)\>
[`Statement`](index.md#statement)

***

Expand Down
35 changes: 35 additions & 0 deletions src/reference/sdks/frontend/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Utilities to interact with the command palette.
Utilities to interact with commands

##### env

> **env**: [`EnvironmentSDK`](index.md#environmentsdk)
Utilities to interact with the environment.

##### files

> **files**: [`FilesSDK`](index.md#filessdk)
Expand Down Expand Up @@ -908,6 +914,7 @@ Add a page to the navigation.
| `path` | `string` | The path of the page. |
| `options` | `object` | Options for the page. |
| `options.body` | `HTMLElement` | The body of the page. |
| `options.onEnter`? | () => `void` | The callback to execute when the page is entered. |
| `options.topbar`? | `HTMLElement` | The topbar of the page. |

###### Returns
Expand Down Expand Up @@ -1527,6 +1534,34 @@ The size of the file in bytes.
The date the file was updated.

## Environment

### EnvironmentSDK

> **EnvironmentSDK**: `object`
Utilities to interact with the environment.

#### Type declaration

##### getVar()

> **getVar**: (`name`: `string`) => `string` \| `undefined`
Get the value of an environment variable.

###### Parameters

| Parameter | Type | Description |
| ------ | ------ | ------ |
| `name` | `string` | The name of the environment variable. |

###### Returns

`string` \| `undefined`

The value of the environment variable.

## Filters

### Filter
Expand Down
Loading

0 comments on commit b617062

Please sign in to comment.