import type { JsonValue } from '@bufbuild/protobuf'; import { Struct } from '@bufbuild/protobuf'; import { type Transport } from '@connectrpc/connect'; import { PackageType } from '../gen/app/packages/v1/packages_pb'; import { APIKeyWithAuthorizations, Authorization, AuthorizedPermissions, CreateKeyFromExistingKeyAuthorizationsResponse, CreateKeyResponse, CreateModuleResponse, CreateOAuthAppUserResponse, Fragment, FragmentImportList, FragmentVisibility, GetAppContentResponse, GetAppBrandingResponse, GetRobotPartLogsResponse, GetRobotPartResponse, GetRobotPartByNameAndLocationResponse, ListOrganizationMembersResponse, Location, LocationAuth, Model, Module, Organization, OrganizationIdentity, OrganizationInvite, OrgDetails, RegistryItem, RegistryItemStatus, Robot, RobotPart, RobotPartHistoryEntry, RotateKeyResponse, RoverRentalRobot, Visibility, LocationSummary } from '../gen/app/v1/app_pb'; import type { LogEntry } from '../gen/common/v1/common_pb'; /** * Creates an Authorization object from auth details. * * @param organizationId The ID of the organization to create the role under * @param entityId The ID of the entity the role belongs to (for example a user * ID) * @param role The role to add ("owner" or "operator") * @param resourceType The type of resource to create the role for ("robot", * "location", or "organization") * @param identityType The type of identity that the identity ID is (for example * an api-key) * @param resourceId The ID of the resource the role is being created for */ export declare const createAuth: (organizationId: string, entityId: string, role: string, resourceType: string, identityType: string, resourceId: string) => Authorization; /** * Creates an Authorization object specifically for a new API key. * * @param organizationId The ID of the organization to create the role under * @param role The role to add ("owner" or "operator") * @param resourceType The type of resource to create the role for ("robot", * "location", or "organization") * @param resourceId The ID of the resource the role is being created for */ export declare const createAuthForNewAPIKey: (organizationId: string, role: string, resourceType: string, resourceId: string) => Authorization; /** * Creates a new AuthorizedPermissions object * * @param resourceType The type of the resource to check permissions for * @param resourceId The ID of the resource to check permissions for * @param permissions A list of permissions to check * @returns The AuthorizedPermissions object */ export declare const createPermission: (resourceType: string, resourceId: string, permissions: string[]) => AuthorizedPermissions; export declare class AppClient { private client; constructor(transport: Transport); /** * Obtain a user's ID from their email address. Internal use only. * * @example * * ```ts * // This method is used internally only. To obtain a user's ID, use the listOrganizationsByUser method. * const members = await appClient.listOrganizationMembers( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getuseridbyemail). * * @param email The email address of the user * @returns The user's ID */ getUserIDByEmail(email: string): Promise; /** * Create a new organization. * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createorganization). * * @param name The name of the new organization * @returns The new organization */ createOrganization(name: string): Promise; /** * List all organizations. * * @example * * ```ts * const organizations = await appClient.listOrganizations(); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listorganizations). * * @returns The organization list */ listOrganizations(): Promise; /** * List all organizations with access to a particular location. * * @example * * ```ts * const organizations = * await appClient.getOrganizationsWithAccessToLocation( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getorganizationswithaccesstolocation). * * @param locationId The ID of the location to query * @returns The list of locations with access to the requested location */ getOrganizationsWithAccessToLocation(locationId: string): Promise; /** * List all organizations associated with a user. Internal use only. * * @param userId The ID of the user to query * @returns The list of locations the requested user has access to */ listOrganizationsByUser(userId: string): Promise; /** * Get details about an organization. * * @example * * ```ts * const organization = await appClient.getOrganization( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getorganization). * * @param organizationId The ID of the organization * @returns Details about the organization, if it exists */ getOrganization(organizationId: string): Promise; /** * Find out if an organization namespace is available. * * @example * * ```ts * const isAvailable = * await appClient.getOrganizationNamespaceAvailability('name'); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getorganizationnamespaceavailability). * * @param namespace The namespace to query for availability * @returns A boolean indicating whether or not the namespace is available */ getOrganizationNamespaceAvailability(namespace: string): Promise; /** * Updates organization details. * * @example * * ```ts * const organization = await appClient.updateOrganization( * '', * 'newName' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updateorganization). * * @param organizationId The id of the organization to update * @param name Optional name to update the organization with * @param publicNamespace Optional namespace to update the organization with * @param region Optional region to update the organization with * @param cid Optional CRM ID to update the organization with * @param defaultFragments Optional default fragments to set for the * organization * @returns The updated organization details */ updateOrganization(organizationId: string, name?: string, publicNamespace?: string, region?: string, cid?: string, defaultFragments?: FragmentImportList): Promise; /** * Deletes an organization. * * @example * * ```ts * await appClient.deleteOrganization(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleteorganization). * * @param organizationId The id of the organization to delete */ deleteOrganization(organizationId: string): Promise; /** * Lists organization memebers and outstanding invites. * * @example * * ```ts * const members = await appClient.listOrganizationMembers( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listorganizationmembers). * * @param organizationId The id of the organization to query * @returns An object containing organization members, pending invites, and * org ID */ listOrganizationMembers(organizationId: string): Promise; /** * Creates a new invitation to join an organization. * * @example * * ```ts * const auth = new VIAM.appApi.Authorization({ * authorizationType: 'role', * authorizationId: 'organization_operator', * organizationId: '', * resourceId: '', // The resource to grant access to * resourceType: 'organization', // The type of resource to grant access to * identityId: '', // The user id of the user to grant access to (optional) * roleId: 'owner', // The role to grant access to * identityType: 'user', * }); * * const invite = await appClient.createOrganizationInvite( * '', * 'youremail@email.com', * [auth] * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createorganizationinvite). * * @param organizationId The id of the organization to create the invite for * @param email The email address of the user to generate an invite for * @param authorizations The authorizations to associate with the new invite * @param sendEmailInvite Bool of whether to send an email invite (true) or * automatically add a user. Defaults to true * @returns The organization invite */ createOrganizationInvite(organizationId: string, email: string, authorizations: Authorization[], sendEmailInvite?: boolean): Promise; /** * Updates authorizations for an existing org invite. * * @example * * ```ts * const auth = new VIAM.appApi.Authorization({ * authorizationType: 'role', * authorizationId: 'organization_operator', * organizationId: '', * resourceId: '', // The resource to grant access to * resourceType: 'organization', // The type of resource to grant access to * identityId: '', // The user id of the user to grant access to (optional) * roleId: 'owner', // The role to grant access to * identityType: 'user', * }); * const invite = await appClient.updateOrganizationInviteAuthorizations( * '', * 'youremail@email.com', * [auth], * [] * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updateorganizationinviteauthorizations). * * @param organizationId The id of the organization * @param email The email address associated with the invite * @param addAuthsList List of authorizations to add to the invite * @param removeAuthsList List of authorizations to remove from the invite * @returns The organization invite */ updateOrganizationInviteAuthorizations(organizationId: string, email: string, addAuthsList: Authorization[], removeAuthsList: Authorization[]): Promise; /** * Removes a member from an organization. * * @example * * ```ts * await appClient.deleteOrganizationMember( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleteorganizationmember). * * @param organizationId The ID of the organization * @param userId The ID of the user */ deleteOrganizationMember(organizationId: string, userId: string): Promise; /** * Deletes a pending organization invite. * * @example * * ```ts * await appClient.deleteOrganizationInvite( * '', * 'youremail@email.com' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleteorganizationinvite). * * @param organizationId The ID of the organization * @param email The email associated with the invite to delete */ deleteOrganizationInvite(organizationId: string, email: string): Promise; /** * Resends a pending organization invite. * * @example * * ```ts * const invite = await appClient.resendOrganizationInvite( * '', * 'youremail@email.com' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#resendorganizationinvite). * * @param organizationId The ID of the organization * @param email The email associated with the invite to resend * @returns The invite */ resendOrganizationInvite(organizationId: string, email: string): Promise; /** * Creates a new location. * * @example * * ```ts * const location = await appClient.createLocation( * '', * 'name' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createlocation). * * @param organizationId The ID of the organization to create the location * under * @param name The name of the location to create * @param parentLocationId Optional name of a parent location to create the * new location under * @returns The location object */ createLocation(organizationId: string, name: string, parentLocationId?: string): Promise; /** * Looks up a location. * * @example * * ```ts * const location = await appClient.getLocation(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getlocation). * * @param locId The ID of the location to query. * @returns The location object */ getLocation(locId: string): Promise; /** * Updates location details. * * @example * * ```ts * const location = await appClient.updateLocation( * '', * 'newName' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updatelocation). * * @param locId The ID of the location to update * @param name Optional string to update the location's name to * @param parentLocId Optional string to update the location's parent location * to * @param region Optional string to update the location's region to * @returns The location object */ updateLocation(locId: string, name?: string, parentLocId?: string, region?: string): Promise; /** * Deletes a location * * @example * * ```ts * await appClient.deleteLocation(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deletelocation). * * @param locId The ID of the location to delete */ deleteLocation(locId: string): Promise; /** * Lists all locations under an organization. * * @example * * ```ts * const locations = await appClient.listLocations( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listlocations). * * @param organizationId The ID of the organization to query * @returns A list of locations under the organization */ listLocations(organizationId: string): Promise; /** * Shares a location with another organization * * @example * * ```ts * await appClient.shareLocation( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#sharelocation). * * @param organizationId The ID of the organization to share with * @param locId The ID of the location to share */ shareLocation(organizationId: string, locId: string): Promise; /** * Unshares a location with an organization * * @example * * ```ts * await appClient.unshareLocation( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#unsharelocation). * * @param organizationId The ID of the organization to unshare with * @param locId The ID of the location to unshare */ unshareLocation(organizationId: string, locId: string): Promise; /** * Get a location's `LocationAuth` (location secret(s)). * * @example * * ```ts * const locationAuth = await appClient.locationAuth( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#locationauth). * * @param locId The ID of the location to retrieve `LocationAuth` from. * @returns The `LocationAuth` for the requested location. */ locationAuth(locId: string): Promise; /** * Create a location secret (`LocationAuth`). * * @example * * ```ts * const locationAuth = await appClient.createLocationSecret( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createlocationsecret). * * @param locId The ID of the location to create a `LocationAuth` for * @returns The newly created `LocationAuth` */ createLocationSecret(locId: string): Promise; /** * Deletes a location secret (`LocationAuth`). * * @example * * ```ts * await appClient.deleteLocationSecret( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deletelocationsecret). * * @param locId The ID of the location to delete the `LocationAuth` from * @param secretId The ID of the location secret to delete */ deleteLocationSecret(locId: string, secretId: string): Promise; /** * Queries a robot by its ID. * * @example * * ```ts * const robot = await appClient.getRobot(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobot). * * @param id The ID of the robot * @returns The `Robot` object */ getRobot(id: string): Promise; /** * Returns a list of rover rental robots for an organization. * * @example * * ```ts * const roverRentalRobots = await appClient.getRoverRentalRobots( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getroverrentalrobots). * * @param orgId The ID of the organization to query * @returns The list of `RoverRentalRobot` objects */ getRoverRentalRobots(orgId: string): Promise; /** * Returns a list of parts for a given robot * * @example * * ```ts * const robotParts = await appClient.getRobotParts(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotparts). * * @param robotId The ID of the robot to query * @returns The list of `RobotPart` objects associated with the robot */ getRobotParts(robotId: string): Promise; /** * Queries a specific robot part by ID. * * @example * * ```ts * const robotPart = await appClient.getRobotPart(''); * // Get the part's address * const address = robotPart.part.fqdn; * // Check if machine is live (last access time less than 10 sec ago) * if ( * Date.now() - Number(robotPart.part.lastAccess.seconds) * 1000 <= * 10000 * ) { * console.log('Machine is live'); * } * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotpart). * * @param id The ID of the requested robot part * @returns The robot part and a its json config */ getRobotPart(id: string): Promise; /** * Queries a specific robot part by name and location id. * * @example * * ```ts * const robotPart = await appClient.getRobotPartByNameAndLocation( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotpartbynameandlocation). * * @param name The name of the requested robot part * @param locationId The ID of the location of the requested robot part * @returns The robot part */ getRobotPartByNameAndLocation(name: string, locationId: string): Promise; /** * Get a page of log entries for a specific robot part. Logs are sorted by * descending time (newest first). * * @example * * ```ts * const robotPartLogs = await appClient.getRobotPartLogs( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotpartlogs). * * @param id The ID of the requested robot part * @param filter Optional string to filter logs on * @param levels Optional array of log levels to return. Defaults to returning * all log levels * @param start Optional start time for log retrieval. Only logs created after * this time will be returned. * @param end Optional end time for log retrieval. Only logs created before * this time will be returned. * @param pageToken Optional string indicating which page of logs to query. * Defaults to the most recent * @returns The robot requested logs and the page token for the next page of * logs */ getRobotPartLogs(id: string, filter?: string, levels?: string[], start?: Date, end?: Date, pageToken?: string): Promise; /** * Get a stream of log entries for a specific robot part. Logs are sorted by * descending time (newest first). * * @example * * ```ts * const robotPartLogs = await appClient.tailRobotPartLogs( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#tailrobotpartlogs). * * @param id The ID of the requested robot part * @param queue A queue to put the log entries into * @param filter Optional string to filter logs on * @param errorsOnly Optional bool to indicate whether or not only error-level * logs should be returned. Defaults to true */ tailRobotPartLogs(id: string, queue: LogEntry[], filter?: string, errorsOnly?: boolean): Promise; /** * Get a list containing the history of a robot part. * * @example * * ```ts * const robotPartHistory = await appClient.getRobotPartHistory( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotparthistory). * * @param id The ID of the requested robot part * @returns The list of the robot part's history */ getRobotPartHistory(id: string): Promise; /** * Updates a robot part based on its ID. * * @example * * ```ts * const robotPart = await appClient.updateRobotPart( * '', * 'newName' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updaterobotpart). * * @param id The ID of the requested robot part * @param name The new name of the robot part * @param robotConfig The new config for the robot part * @returns The updated robot part */ updateRobotPart(id: string, name: string, robotConfig: Struct): Promise; /** * Creates a new robot part. * * @example * * ```ts * const robotPartId = await appClient.newRobotPart( * '', * 'newPart' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#newrobotpart). * * @param robotId The ID of the robot to create a part for * @param partName The name for the new robot part * @returns The ID of the newly-created robot part */ newRobotPart(robotId: string, partName: string): Promise; /** * Deletes a robot part. * * @example * * ```ts * await appClient.deleteRobotPart(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleterobotpart). * * @param partId The ID of the part to delete */ deleteRobotPart(partId: string): Promise; /** * Gets a list of a robot's API keys. * * @example * * ```ts * const robotAPIKeys = * await appClient.getRobotAPIKeys(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotapikeys). * * @param robotId The ID of the robot to get API keys for * @returns A list of the robot's API keys */ getRobotAPIKeys(robotId: string): Promise; /** * Marks a robot part as the main part. * * @example * * ```ts * await appClient.markPartAsMain(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#markpartasmain). * * @param partId The ID of the part to mark as main */ markPartAsMain(partId: string): Promise; /** * Marks a robot part for restart. * * @example * * ```ts * await appClient.markPartForRestart(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#markpartforrestart). * * @param partId The ID of the part to mark for restart */ markPartForRestart(partId: string): Promise; /** * Creates a new secret for a robot part. * * @example * * ```ts * const robotPart = await appClient.createRobotPartSecret( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createrobotpartsecret). * * @param partId The ID of the part to create a secret for * @returns The robot part object */ createRobotPartSecret(partId: string): Promise; /** * Deletes a robot secret from a robot part. * * @example * * ```ts * await appClient.deleteRobotPartSecret( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleterobotpartsecret). * * @param partId The ID of the part to delete a secret from * @param secretId The ID of the secret to delete */ deleteRobotPartSecret(partId: string, secretId: string): Promise; /** * Lists all robots in a location. * * @example * * ```ts * const robots = await appClient.listRobots(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listrobots). * * @param locId The ID of the location to list robots for * @returns The list of robot objects */ listRobots(locId: string): Promise; /** * Creates a new robot. * * @example * * ```ts * const robotId = await appClient.newRobot( * '', * 'newRobot' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#newrobot). * * @param locId The ID of the location to create the robot in * @param name The name of the new robot * @returns The new robot's ID */ newRobot(locId: string, name: string): Promise; /** * Change the name of an existing machine. You can only change the name of the * machine, not the location. * * @example * * ```ts * const robot = await appClient.updateRobot( * '', * '', * 'newName' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updaterobot). * * @param robotId The ID of the robot to update * @param locId The ID of the location where the robot is * @param name The name to update the robot to * @returns The newly-modified robot object */ updateRobot(robotId: string, locId: string, name: string): Promise; /** * Deletes a robot. * * @example * * ```ts * await appClient.deleteRobot(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleterobot). * * @param id The ID of the robot to delete */ deleteRobot(id: string): Promise; /** * Lists all fragments within an organization. * * @example * * ```ts * const fragments = await appClient.listFragments( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listfragments). * * @param organizationId The ID of the organization to list fragments for * @param publicOnly Optional, deprecated boolean. Use fragmentVisibilities * instead. If true then only public fragments will be listed. Defaults to * true * @param fragmentVisibilities Optional list of fragment visibilities to * include in returned list. An empty fragmentVisibilities list defaults to * normal publicOnly behavior (discludes unlisted public fragments) * Otherwise, fragment visibilities should contain one of the three * visibilities and takes precendence over the publicOnly field * @returns The list of fragment objects */ listFragments(organizationId: string, publicOnly?: boolean, fragmentVisibility?: FragmentVisibility[]): Promise; /** * Looks up a fragment by ID. * * @example * * ```ts * const fragment = await appClient.getFragment( * '12a12ab1-1234-5678-abcd-abcd01234567' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getfragment). * * @param id The ID of the fragment to look up * @returns The requested fragment */ getFragment(id: string): Promise; /** * Creates a new fragment. * * @example * * ```ts * const fragment = await appClient.createFragment( * '', * 'newFragment' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createfragment). * * @param organizationId The ID of the organization to create the fragment * under * @param name The name of the new fragment * @param config The new fragment's config * @returns The newly created fragment */ createFragment(organizationId: string, name: string, config: Struct): Promise; /** * Updates an existing fragment. * * @example * * ```ts * const fragment = await appClient.updateFragment( * '12a12ab1-1234-5678-abcd-abcd01234567', * 'better_name' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updatefragment). * * @param id The ID of the fragment to update * @param name The name to update the fragment to * @param config The config to update the fragment to * @param makePublic Optional, deprecated boolean specifying whether the * fragment should be public or not. If not passed, the visibility will be * unchanged. Fragments are private by default when created * @param visibility Optional FragmentVisibility specifying the updated * fragment visibility. If not passed, the visibility will be unchanged. If * visibility is not set and makePublic is set, makePublic takes effect. If * makePublic and visibility are set, they must not be conflicting. If * neither is set, the fragment visibility will remain unchanged. * @returns The updated fragment */ updateFragment(id: string, name: string, config: Struct, makePublic?: boolean, visibility?: FragmentVisibility): Promise; /** * Deletes a fragment. * * @example * * ```ts * await appClient.deleteFragment('12a12ab1-1234-5678-abcd-abcd01234567'); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deletefragment). * * @param id The ID of the fragment to delete */ deleteFragment(id: string): Promise; /** * @example * * ```ts * const fragments = await appClient.listMachineFragments( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listmachinefragments). * * @param machineId The machine ID used to filter fragments defined in a * machine's parts. Also returns any fragments nested within the fragments * defined in parts. * @param additionalFragmentIds Additional fragment IDs to append to the * response. Useful when needing to view fragments that will be * provisionally added to the machine alongside existing fragments. * @returns The list of top level and nested fragments for a machine, as well * as additionally specified fragment IDs. */ listMachineFragments(machineId: string, additionalFragmentIds?: string[]): Promise; /** * Add a role under an organization. * * @example * * ```ts * await appClient.addRole( * '', * '', * 'owner', * 'robot', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#addrole). * * @param organizationId The ID of the organization to create the role under * @param entityId The ID of the entity the role belongs to (for example a * user ID) * @param role The role to add ("owner" or "operator") * @param resourceType The type of resource to create the role for ("robot", * "location", or "organization") * @param resourceId The ID of the resource the role is being created for */ addRole(organizationId: string, entityId: string, role: string, resourceType: string, resourceId: string): Promise; /** * Removes a role from an organization. * * @example * * ```ts * await appClient.removeRole( * '', * '', * 'owner', * 'robot', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#removerole). * * @param organizationId The ID of the organization to remove the role from * @param entityId The ID of the entity the role belongs to (for example a * user ID) * @param role The role to remove ("owner" or "operator") * @param resourceType The type of resource to remove the role from ("robot", * "location", or "organization") * @param resourceId The ID of the resource the role is being removes from */ removeRole(organizationId: string, entityId: string, role: string, resourceType: string, resourceId: string): Promise; /** * Changes an existing role. * * @example * * ```ts * const oldAuth = new VIAM.appApi.Authorization({ * authorizationType: 'role', * authorizationId: 'organization_owner', * organizationId: '', * resourceId: '', // The resource to grant access to * resourceType: 'organization', // The type of resource to grant access to * identityId: '', // The user id of the user to grant access to (optional) * roleId: 'owner', // The role to grant access to * identityType: 'user', * }); * const newAuth = new VIAM.appApi.Authorization({ * authorizationType: 'role', * authorizationId: 'organization_operator', * organizationId: '', * resourceId: '', // The resource to grant access to * resourceType: 'organization', // The type of resource to grant access To * identityId: '', // The user id of the user to grant access to (optional) * roleId: 'operator', // The role to grant access to * identityType: 'user', * }); * await appClient.changeRole(oldAuth, newAuth); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#changerole). * * @param oldAuthorization The existing authorization * @param newAuthorization The new authorization to change to */ changeRole(oldAuthorization: Authorization, newAuthorization: Authorization): Promise; /** * List all authorizations for an organization. * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listauthorizations). * * @param organizationId The ID of the organization to list authorizations for * @param resourceIds Optional list of IDs of resources to list authorizations * for. If not provided, all resources will be included * @returns The list of authorizations */ listAuthorizations(organizationId: string, resourceIds?: string[]): Promise; /** * Checks whether requested permissions exist. * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#checkpermissions). * * @param permissions A list of permissions to check * @returns A filtered list of the authorized permissions */ checkPermissions(permissions: AuthorizedPermissions[]): Promise; /** * Get an item from the registry. * * @example * * ```ts * const registryItem = await appClient.getRegistryItem( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getregistryitem). * * @param itemId The ID of the item to get * @returns The requested item */ getRegistryItem(itemId: string): Promise; /** * Create a new registry item. * * @example * * ```ts * await appClient.createRegistryItem( * '', * 'newRegistryItemName', * 5 * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createregistryitem). * * @param organizationId The ID of the organization to create the registry * item under * @param name The name of the registry item * @param type The type of the item in the registry. */ createRegistryItem(organizationId: string, name: string, type: PackageType): Promise; /** * Update an existing registry item. * * @example * * ```ts * await appClient.updateRegistryItem( * '', * 5, // Package: ML Model * 'new description', * 1 // Private * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updateregistryitem). * * @param itemId The ID of the registry item to update * @param type The PackageType to update the item to * @param description A description of the item * @param visibility A visibility value to update to */ updateRegistryItem(itemId: string, type: PackageType, description: string, visibility: Visibility): Promise; /** * List all registry items for an organization. * * @example * * ```ts * const registryItems = await appClient.listRegistryItems( * '', * [], // All package types * [1], // Private packages * [], * [1] // Active packages * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listregistryitems). * * @param organizationId The ID of the organization to query registry items * for * @param types A list of types to query. If empty, will not filter on type * @param visibilities A list of visibilities to query for. If empty, will not * filter on visibility * @param platforms A list of platforms to query for. If empty, will not * filter on platform * @param statuses A list of statuses to query for. If empty, will not filter * on status * @param searchTerm Optional search term to filter on * @param pageToken Optional page token for results. If not provided, will * return all results * @returns The list of registry items */ listRegistryItems(organizationId: string, types: PackageType[], visibilities: Visibility[], platforms: string[], statuses: RegistryItemStatus[], searchTerm?: string, pageToken?: string): Promise; /** * Deletes a registry item. * * @example * * ```ts * await appClient.deleteRegistryItem(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deleteregistryitem). * * @param itemId The ID of the item to delete */ deleteRegistryItem(itemId: string): Promise; /** * Creates a new module. * * @example * * ```ts * const module = await appClient.createModule( * '', * 'newModule' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createmodule). * * @param organizationId The ID of the organization to create the module under * @param name The name of the module * @returns The module ID and a URL to its detail page */ createModule(organizationId: string, name: string): Promise; /** * Updates an existing module. * * @example * * ```ts * const module = await appClient.updateModule( * '', * 1, * 'https://example.com', * 'new description', * [{ model: 'namespace:group:model1', api: 'rdk:component:generic' }], * 'entrypoint' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updatemodule). * * @param moduleId The ID of the module to update * @param visibility The visibility to set for the module * @param url The url to reference for documentation, code, etc. * @param description A short description of the module * @param models A list of models available in the module * @param entrypoint The executable to run to start the module program * @returns The module URL */ updateModule(moduleId: string, visibility: Visibility, url: string, description: string, models: Model[], entrypoint: string): Promise; /** * Looks up a particular module. * * @example * * ```ts * const module = await appClient.getModule(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getmodule). * * @param moduleId The ID of the module * @returns The requested module */ getModule(moduleId: string): Promise; /** * Lists all modules for an organization. * * @example * * ```ts * const modules = await appClient.listModules(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listmodules). * * @param organizationId The ID of the organization to query * @returns The organization's modules */ listModules(organizationId: string): Promise; /** * Creates a new API key. * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createkey). * * @param authorizations The list of authorizations to provide for the API key * @param name An optional name for the key. If none is passed, defaults to * present timestamp * @returns The new key and ID */ createKey(authorizations: Authorization[], name?: string): Promise; /** * Deletes an existing API key. * * @example * * ```ts * await appClient.deleteKey(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#deletekey). * * @param id The ID of the key to delete */ deleteKey(id: string): Promise; /** * List all API keys for an organization. * * @example * * ```ts * const keys = await appClient.listKeys(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#listkeys). * * @param orgId The ID of the organization to query * @returns The list of API keys */ listKeys(orgId: string): Promise; /** * Rotates an existing API key. * * @example * * ```ts * const key = await appClient.rotateKey(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#rotatekey). * * @param id The ID of the key to rotate * @returns The updated key and ID */ rotateKey(id: string): Promise; /** * Creates a new key with an existing key's authorizations * * @example * * ```ts * const key = * await appClient.createKeyFromExistingKeyAuthorizations( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#createkeyfromexistingkeyauthorizations). * * @param id The ID of the key to duplicate * @returns The new key and ID */ createKeyFromExistingKeyAuthorizations(id: string): Promise; /** * Retrieves the app content for an organization. * * @example * * ```ts * const appContent = await appClient.getAppContent( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getappcontent). * * @param publicNamespace The public namespace of the organization * @param name The name of the app * @returns The blob path and entrypoint of the app content */ getAppContent(publicNamespace: string, name: string): Promise; /** * Retrieves user-defined metadata for an organization. * * @example * * ```ts * const metadata = await appClient.getOrganizationMetadata( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getorganizationmetadata). * * @param id The ID of the organization * @returns The metadata associated with the organization */ getOrganizationMetadata(id: string): Promise>; /** * Updates user-defined metadata for an organization. * * @example * * ```ts * await appClient.updateOrganizationMetadata('', { * key: 'value', * }); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updateorganizationmetadata). * * @param id The ID of the organization * @param data The metadata to update */ updateOrganizationMetadata(id: string, data: Record): Promise; /** * Retrieves user-defined metadata for a location. * * @example * * ```ts * const metadata = await appClient.getLocationMetadata( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getlocationmetadata). * * @param id The ID of the location * @returns The metadata associated with the location */ getLocationMetadata(id: string): Promise>; /** * Updates user-defined metadata for a location. * * @example * * ```ts * await appClient.updateLocationMetadata('', { * key: 'value', * }); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updatelocationmetadata). * * @param id The ID of the location * @param data The metadata to update */ updateLocationMetadata(id: string, data: Record): Promise; /** * Retrieves user-defined metadata for a robot. * * @example * * ```ts * const metadata = await appClient.getRobotMetadata(''); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotmetadata). * * @param id The ID of the robot * @returns The metadata associated with the robot */ getRobotMetadata(id: string): Promise>; /** * Updates user-defined metadata for a robot. * * @example * * ```ts * await appClient.updateRobotMetadata('', { * key: 'value', * }); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updaterobotmetadata). * * @param id The ID of the robot * @param data The metadata to update */ updateRobotMetadata(id: string, data: Record): Promise; /** * Retrieves user-defined metadata for a robot part. * * @example * * ```ts * const metadata = await appClient.getRobotPartMetadata( * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getrobotpartmetadata). * * @param id The ID of the robot part * @returns The metadata associated with the robot part */ getRobotPartMetadata(id: string): Promise>; /** * Updates user-defined metadata for a robot part. * * @example * * ```ts * await appClient.updateRobotPartMetadata('', { * key: 'value', * }); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#updaterobotpartmetadata). * * @param id The ID of the robot part * @param data The metadata to update */ updateRobotPartMetadata(id: string, data: Record): Promise; /** * Retrieves the app branding for an organization/app. * * @example * * ```ts * const branding = await appClient.getAppBranding( * '', * '' * ); * ``` * * For more information, see [App * API](https://docs.viam.com/dev/reference/apis/fleet/#getappbranding). * * @param publicNamespace The public namespace of the organization * @param name The name of the app * @returns The branding information for the app */ getAppBranding(publicNamespace: string, name: string): Promise; /** * Lists machine summaries for an organization, optionally filtered by * fragment IDs, location IDs, and limit. * * @example * * ```ts * const summaries = await appClient.listMachineSummaries( * 'orgId', * ['frag1'], * ['loc1'], * 10 * ); * ``` * * @param organizationId The ID of the organization * @param fragmentIds Optional list of fragment IDs to filter machines * @param locationIds Optional list of location IDs to filter machines * @param limit Optional max number of machines to return * @returns The list of location summaries */ listMachineSummaries(organizationId: string, fragmentIds?: string[], locationIds?: string[], limit?: number): Promise; /** * Creates a new OAuth app user. * * @example * * ```ts * const result = await appClient.createOAuthAppUser( * '', * '', * 'user@example.com', * 'First', * 'Last', * 'password' * ); * ``` * * @param orgId The ID of the organization * @param applicationId The ID of the OAuth application * @param email The email address for the new user * @param firstName The first name of the new user * @param lastName The last name of the new user * @param password The password for the new user * @returns The auth token, registration ID, user ID, and refresh token */ createOAuthAppUser(orgId: string, applicationId: string, email: string, firstName: string, lastName: string, password: string): Promise; }