Skip to main content

OS API

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

MethodHTTP requestDescription
linkProviderPOST /os/link_provider/os/link_provider [POST]
osDeviceInformationGET /os/device/information/os/device/information [GET]
osPermissionsGET /os/permissions/os/permissions [GET]
osPermissionsRequestPOST /os/permissions/request/os/permissions/request [POST]
osRestartGET /os/restartYour GET endpoint
osUpdateCheckPOST /os/update/check/os/update/check [POST]
pickFilesPOST /os/files/pick/os/files/pick [POST]
pickFoldersPOST /os/folders/pick/os/folders/pick [POST]
signIntoOSPOST /os/sign_in
signOutOfOSPOST /os/sign_out/os/sign_out [POST]

linkProvider

ReturnedUserProfile linkProvider()

This will link an external provider to your current auth0 account. Will throw errors if your user is not signed in.

Example

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

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

const body: Pieces.LinkProviderRequest = {
// SeededExternalProvider (optional)
seededExternalProvider: ,
};

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

Parameters

NameTypeDescriptionNotes
seededExternalProviderSeededExternalProvider

Return type

ReturnedUserProfile

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
401Unauthorized, this means your user is not authenticated-
500Internal Server Error-

osDeviceInformation

OSDeviceInformationReturnable osDeviceInformation()

This will get information related to your specific device.

Example

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

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

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

Parameters

This endpoint does not need any parameters.

Return type

OSDeviceInformationReturnable

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

osPermissions

OSPermissions osPermissions()

This will only work on Macos and Windows. And will get the permissions of the user's local machine w/ regard to anything needed to effectively run PiecesOS. Note: this will let us know if we need to tell them to take action to enable any given permissions

Example

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

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

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

Parameters

This endpoint does not need any parameters.

Return type

OSPermissions

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

osPermissionsRequest

OSPermissions osPermissionsRequest()

This will only work on Macos and Windows. This will request permissions for the given inputs

Example

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

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

const body: Pieces.OsPermissionsRequestRequest = {
// OSPermissions (optional)
oSPermissions: ,
};

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

Parameters

NameTypeDescriptionNotes
oSPermissionsOSPermissions

Return type

OSPermissions

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

osRestart

osRestart()

This will restart PiecesOS, if successfull with return a 204. This is a LOCALOS Only Endpoint.

Example

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

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

apiInstance.osRestart().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: text/plain

HTTP response details

Status codeDescriptionResponse headers
204No Content-
500Internal Server Error-

osUpdateCheck

CheckedOSUpdate osUpdateCheck()

This is a helper endpoint that will check the status of an update for PiecesOS. IE if there is an update downloading, if there is one available, but the downloading has not started... etc

Example

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

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

const body: Pieces.OsUpdateCheckRequest = {
// UncheckedOSUpdate (optional)
uncheckedOSUpdate: ,
};

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

Parameters

NameTypeDescriptionNotes
uncheckedOSUpdateUncheckedOSUpdate

Return type

CheckedOSUpdate

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

pickFiles

Array<string> pickFiles()

This will trigger a filer picker and return the string paths of the files that were selected.

Example

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

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

const body: Pieces.PickFilesRequest = {
// FilePickerInput (optional)
filePickerInput: ,
};

apiInstance.pickFiles(body).then((data: Array\<string\>) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

NameTypeDescriptionNotes
filePickerInputFilePickerInput

Return type

Array<string>

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

pickFolders

Array<string> pickFolders()

This will trigger a folder picker and return the string paths of the folders that were selected.

Example

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

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

apiInstance.pickFolders().then((data: Array\<string\>) => {
console.log('API called successfully. Returned data: ' + data)
}).catch((error: unknown) => console.error(error))

Parameters

This endpoint does not need any parameters.

Return type

Array<string>

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-
500Internal Server Error-

signIntoOS

UserProfile signIntoOS()

A trigger that launches a Sign into OS Server

Example

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

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

apiInstance.signIntoOS().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-

signOutOfOS

Users signOutOfOS()

A trigger that signs out a user from the OS

Example

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

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

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

Parameters

This endpoint does not need any parameters.

Return type

Users

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200OK-