Class: ActuallyColabRESTClient#

Constructors#

constructor#

+ new ActuallyColabRESTClient(baseURL: string): ActuallyColabRESTClient

Initializes a new client wrapper for the Actually Colab API.

Parameters:#

NameTypeDescription
baseURLstringActually 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:#

NameTypeDefault valueDescription
namestring-human-readable name of the notebook
languagepython'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:#

NameTypeDescription
namestringhuman-readable name of the workshop
descriptionstringhuman-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:#

NameTypeDescription
emailstringthe user's email address
name?stringoptional, 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:#

NameTypeDescription
nb_idstringid 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:#

NameType
loginDataLoginData

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:#

NameTypeDescription
idTokenstringfrom 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:#

NameTypeDescription
sessionTokenstringJWT 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:#

NameTypeDescription
sessionTokenstringthe 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:#

NameTypeDescription
emailstringuser to share with
nb_idstringid of the notebook to share
access_levelNotebookAccessLevelTypepermissions level for the user that the notebook is being shared with

Returns: Promise<Notebook>

Defined in: src/REST/client.ts:138