Skip to content

Latest commit

 

History

History
286 lines (179 loc) · 7.08 KB

README.md

File metadata and controls

286 lines (179 loc) · 7.08 KB

@lookingglass/blocks.js

@lookingglass/blocks.js

Table of contents

Enumerations

Classes

Type Aliases

Variables

Functions

Type Aliases

AuthClientOptions

Ƭ AuthClientOptions: Omit<Auth0ClientOptions, "domain"> & { domain?: string }


BlocksClientArgs

Ƭ BlocksClientArgs: Object

Type declaration

Name Type Description
apiUrl? string Change the API url if you're using a self-hosted version of Blocks Default https://blocks.glass
token string | null The JWT token that's used to authenticate with the Blocks API

CreateHologramFromImageInput

Ƭ CreateHologramFromImageInput: Object

The input arguments for the createHologram mutation.

Type declaration

Name Type Description
description? InputMaybe<Scalars["String"]["input"]> -
imageUrl Scalars["String"]["input"] The public URL of the image to be converted to RGBD.
privacy? InputMaybe<PrivacyType> -
title? InputMaybe<Scalars["String"]["input"]> -

CreateQuiltHologramInputType

Ƭ CreateQuiltHologramInputType: Object

The input arguments for the createQuiltHologram mutation.

Type declaration

Name Type Description
aspectRatio? InputMaybe<Scalars["Float"]["input"]> -
description? InputMaybe<Scalars["String"]["input"]> -
imageUrl Scalars["String"]["input"] The URL of the image
isPublished? InputMaybe<Scalars["Boolean"]["input"]> -
privacy? InputMaybe<PrivacyType> Restricted
quiltCols? InputMaybe<Scalars["Int"]["input"]> -
quiltRows? InputMaybe<Scalars["Int"]["input"]> -
quiltTileCount? InputMaybe<Scalars["Int"]["input"]> -
title? InputMaybe<Scalars["String"]["input"]> -

GraphqlDocument

Ƭ GraphqlDocument: RequestDocument | TypedQueryDocumentNode<any, Variables> | string


UpdateHologramInput

Ƭ UpdateHologramInput: Object

The input arguments for the updateHologram mutation.

Type declaration

Name Type
aspectRatio? InputMaybe<Scalars["Float"]["input"]>
description? InputMaybe<Scalars["String"]["input"]>
id Scalars["Int"]["input"]
isPublished? InputMaybe<Scalars["Boolean"]["input"]>
privacy? InputMaybe<PrivacyType>
quiltCols? InputMaybe<Scalars["Int"]["input"]>
quiltRows? InputMaybe<Scalars["Int"]["input"]>
quiltTileCount? InputMaybe<Scalars["Int"]["input"]>
rgbdDepthiness? InputMaybe<Scalars["Float"]["input"]>
rgbdFocus? InputMaybe<Scalars["Float"]["input"]>
rgbdStretch? InputMaybe<Scalars["Float"]["input"]>
rgbdZoom? InputMaybe<Scalars["Float"]["input"]>
title? InputMaybe<Scalars["String"]["input"]>

VerifySessionQuery

Ƭ VerifySessionQuery: Object

Type declaration

Name Type
__typename? "Query"
me? { __typename?: "User" ; displayName: string ; email?: string | null ; id: number ; username: string } | null

Variables

HOLOGRAM_QUILT_IMAGE_FORMATS

Const HOLOGRAM_QUILT_IMAGE_FORMATS: string[]

Default Value

["png", "jpg", "jpeg", "webp", "bmp"]


HOLOGRAM_QUILT_IMAGE_MIMETYPES

Const HOLOGRAM_QUILT_IMAGE_MIMETYPES: string[]

Default Value

["image/png", "image/jpg", "image/jpeg", "image/webp", "image/bmp"]

Functions

createAuthClient

createAuthClient(options): Auth0Client

Create a new Auth0Client with default Blocks API configuration

const authClient = createAuthClient({
	clientId: "BLOCKS_CLIENT_ID_HERE",
})

Parameters

Name Type
options AuthClientOptions

Returns

Auth0Client


getToken

getToken(): string

Returns the token from the session. This is just fetching it from cache. If you are wanting to validate a new sign in see validateSession

Returns

string


isAuthenticated

isAuthenticated(): boolean

Returns if the user is logged in or not

Returns

boolean


loginWithRedirect

loginWithRedirect(authClient, redirectUri): Promise<void>

Redirects the user to the Auth0 login page. Use this to sign in users. When the user is redirected back to your app, you can use validateSession to validate the session.

Parameters

Name Type
authClient Auth0Client
redirectUri string

Returns

Promise<void>


logout

logout(authClient, enableRedirect?): Promise<void>

Signs the user out

Parameters

Name Type Default value
authClient Auth0Client undefined
enableRedirect boolean true

Returns

Promise<void>


logoutWithRedirect

logoutWithRedirect(authClient, redirectURL): Promise<void>

Parameters

Name Type
authClient Auth0Client
redirectURL string

Returns

Promise<void>


validateSession

validateSession(authClient): Promise<string | null>

Validates the session with Auth0 and returns the token if it exists.

Parameters

Name Type
authClient Auth0Client

Returns

Promise<string | null>