Class: ActuallyColabRESTClient#
Constructors#
constructor#
+ new ActuallyColabRESTClient(baseURL: string): ActuallyColabRESTClient
Initializes a new client wrapper for the Actually Colab API.
Parameters:#
| Name | Type | Description |
|---|---|---|
baseURL | string | Actually Colab API basename |
Returns: ActuallyColabRESTClient
Defined in: src/REST/client.ts:15
Properties#
axiosInstance#
• Private axiosInstance: AxiosInstance
Defined in: src/REST/client.ts:15
Methods#
createNotebook#
â–¸ createNotebook(name: string, language?: python, cells?: Pick<DCell, language | contents>[]): Promise<Notebook>
Creates the metadata for a new notebook.
Parameters:#
| Name | Type | Default value | Description |
|---|---|---|---|
name | string | - | human-readable name of the notebook |
language | python | 'python' | runtime language for the notebook |
cells? | Pick<DCell, language | contents>[] | - | - |
Returns: Promise<Notebook>
Defined in: src/REST/client.ts:116
createWorkshop#
â–¸ createWorkshop(name: string, description: string, cells?: Pick<DCell, language | contents>[]): Promise<Workshop>
Creates the metadata for a new workshop.
Parameters:#
| Name | Type | Description |
|---|---|---|
name | string | human-readable name of the workshop |
description | string | human-readable description of the workshop |
cells? | Pick<DCell, language | contents>[] | cell contents to pre-insert |
Returns: Promise<Workshop>
Defined in: src/REST/client.ts:155
devLogin#
â–¸ devLogin(email: string, name?: string): Promise<{ sessionToken: string ; user: DUser }>
Attempts to login. On success, stores the token.
Parameters:#
| Name | Type | Description |
|---|---|---|
email | string | the user's email address |
name? | string | optional, sets the name of the user |
Returns: Promise<{ sessionToken: string ; user: DUser }>
Defined in: src/REST/client.ts:63
getNotebookContents#
â–¸ getNotebookContents(nb_id: string): Promise<NotebookContents>
Fetches cells and outputs for a specific notebook.
Parameters:#
| Name | Type | Description |
|---|---|---|
nb_id | string | id of the notebook to fetch |
Returns: Promise<NotebookContents>
Defined in: src/REST/client.ts:102
getNotebooksForUser#
â–¸ getNotebooksForUser(): Promise<Notebook[]>
Fetches all notebooks that this user has access to.
Returns: Promise<Notebook[]>
Defined in: src/REST/client.ts:93
getWorkshopsForUser#
â–¸ getWorkshopsForUser(): Promise<Workshop[]>
Fetches all workshops that this user has access to.
Returns: Promise<Workshop[]>
Defined in: src/REST/client.ts:170
login#
â–¸ Privatelogin(loginData: LoginData): Promise<{ sessionToken: string ; user: DUser }>
Parameters:#
| Name | Type |
|---|---|
loginData | LoginData |
Returns: Promise<{ sessionToken: string ; user: DUser }>
Defined in: src/REST/client.ts:40
loginWithGoogleIdToken#
â–¸ loginWithGoogleIdToken(idToken: string): Promise<{ sessionToken: string ; user: DUser }>
Attempts to login with Google ID Token. On success, stores the token.
Parameters:#
| Name | Type | Description |
|---|---|---|
idToken | string | from Google Auth |
Returns: Promise<{ sessionToken: string ; user: DUser }>
Defined in: src/REST/client.ts:75
refreshSessionToken#
â–¸ refreshSessionToken(sessionToken: string): Promise<{ sessionToken: string ; user: DUser }>
Attempts to refresh session token. On success, stores the token.
Parameters:#
| Name | Type | Description |
|---|---|---|
sessionToken | string | JWT from Actually Colab service |
Returns: Promise<{ sessionToken: string ; user: DUser }>
Defined in: src/REST/client.ts:86
setSessionToken#
â–¸ setSessionToken(sessionToken: string): void
Sets the authorization header for all requests.
Parameters:#
| Name | Type | Description |
|---|---|---|
sessionToken | string | the actually colab token for the user |
Returns: void
Defined in: src/REST/client.ts:36
shareNotebook#
â–¸ shareNotebook(email: string, nb_id: string, access_level: NotebookAccessLevelType): Promise<Notebook>
Shares a notebook with another user. The requesting user must have Full Access to share the notebook.
Parameters:#
| Name | Type | Description |
|---|---|---|
email | string | user to share with |
nb_id | string | id of the notebook to share |
access_level | NotebookAccessLevelType | permissions level for the user that the notebook is being shared with |
Returns: Promise<Notebook>
Defined in: src/REST/client.ts:138