Skip to main content

User API

All URIs are relative to http://localhost:1000

MethodHTTP requestDescription
clearUserPOST /user/clear/user/clear
refreshUserGET /user/refresh/user/refresh [GET]
selectUserPOST /user/select/user/select [POST]
streamUserGET /user/stream/user/stream [WS]
updateUserPOST /user/update/user/update [POST]
userBetaStatusPOST /user/beta/status/user/beta/status [POST]
userProvidersGET /user/providersYour GET endpoint
userSnapshotGET /user/user [GET]
userUpdateVanityPOST /user/update/vanity/user/update/vanity [POST]

clearUser

clearUser()

An endpoint to clear the current user.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

apiInstance.clearUser().then((data: void (empty response body)) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

void (empty response body)

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

HTTP response details

Status codeDescriptionResponse headers
204No Content-

refreshUser

UserProfile refreshUser()

This will refresh a user.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

apiInstance.refreshUser().then((data: UserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

UserProfile

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

selectUser

UserProfile selectUser()

This will select the current user.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

const body: Pieces.SelectUserRequest = {
// Auth0User | (optional)
auth0User: ,
};

apiInstance.selectUser(body).then((data: UserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
auth0UserAuth0User

Return type

UserProfile

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-

streamUser

UserProfile streamUser()

Provides a WebSocket connection that streams user data.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

apiInstance.streamUser().then((data: UserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

UserProfile

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-

updateUser

UserProfile updateUser()

This will update a specific user in the database.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

const body: Pieces.UpdateUserRequest = {
// UserProfile | (optional)
userProfile: ,
};

apiInstance.updateUser(body).then((data: UserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
userProfileUserProfile

Return type

UserProfile

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-

userBetaStatus

UserBetaStatus userBetaStatus()

This will be an endpoint to give access or remove access immediately from a given user.(isomorphic from the given provider)

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

const body: Pieces.UserBetaStatusRequest = {
// UserBetaStatus (optional)
userBetaStatus: ,
};

apiInstance.userBetaStatus(body).then((data: UserBetaStatus) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
userBetaStatusUserBetaStatus

Return type

UserBetaStatus

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-
511Authentication Required, This means that you user needs to be authenticated with OS in order to change the beta status-

userProviders

ReturnedUserProfile userProviders()

This will retrieve all the users Providers that are connected to this account. If called locally. we will 501 - because it is not implemented locally yet. If called in the cloud, we will refresh && get your access tokens to access these providers.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

apiInstance.userProviders().then((data: ReturnedUserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

ReturnedUserProfile

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-
501Not Implemented-

userSnapshot

ReturnedUserProfile userSnapshot()

This will return a snapshot of the current user. This will return our ReturnUserProfile and the user on that object is just a UserProfile and can potentially be null.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

apiInstance.userSnapshot().then((data: ReturnedUserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

ReturnedUserProfile

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status codeDescriptionResponse headers
200OK-

userUpdateVanity

UserProfile userUpdateVanity()

This is a local route to update your vanityname. ie mark.pieces.cloud, where "mark" is the vanityname.

Example

import * as Pieces from '@pieces.app/pieces-os-client'

const configuration = Pieces.Configuration()
const apiInstance = new Pieces.UserApi(configuration)

const body: Pieces.UserUpdateVanityRequest = {
// UserProfile | This will take an update userProfile, with the updated vanity name! (optional)
userProfile: ,
};

apiInstance.userUpdateVanity(body).then((data: UserProfile) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
userProfileUserProfileThis will take an update userProfile, with the updated vanity name!

Return type

UserProfile

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json, text/plain

HTTP response details

Status codeDescriptionResponse headers
200OK-
404The original dns record was not found, please wait for cloud connectivity to fully connect.-
409Conflict, This means that we were unable to update the username because it was already taken.-
500Unable to create a username. Internal Server Error.-
511Network Authentication Required, Cannot Update the Vanityname of the user because the user is either not signed in or in not connected to the cloud.-