Viam SDK
    Preparing search index...

    Interface AppClient

    interface AppClient {
        addRole(
            organizationId: string,
            entityId: string,
            role: string,
            resourceType: string,
            resourceId: string,
        ): Promise<void>;
        changeRole(
            oldAuthorization: Authorization,
            newAuthorization: Authorization,
        ): Promise<void>;
        checkPermissions(
            permissions: AuthorizedPermissions[],
        ): Promise<AuthorizedPermissions[]>;
        createFragment(
            organizationId: string,
            name: string,
            config: Struct,
        ): Promise<Fragment | undefined>;
        createKey(
            authorizations: Authorization[],
            name?: string,
        ): Promise<CreateKeyResponse>;
        createKeyFromExistingKeyAuthorizations(
            id: string,
        ): Promise<CreateKeyFromExistingKeyAuthorizationsResponse>;
        createLocation(
            organizationId: string,
            name: string,
            parentLocationId?: string,
        ): Promise<Location | undefined>;
        createLocationSecret(locId: string): Promise<LocationAuth | undefined>;
        createModule(
            organizationId: string,
            name: string,
        ): Promise<CreateModuleResponse>;
        createOAuthAppUser(
            orgId: string,
            applicationId: string,
            email: string,
            firstName: string,
            lastName: string,
            password: string,
        ): Promise<CreateOAuthAppUserResponse>;
        createOrganization(name: string): Promise<Organization | undefined>;
        createOrganizationInvite(
            organizationId: string,
            email: string,
            authorizations: Authorization[],
            sendEmailInvite?: boolean,
        ): Promise<OrganizationInvite | undefined>;
        createRegistryItem(
            organizationId: string,
            name: string,
            type: PackageType,
        ): Promise<void>;
        createRobotPartSecret(partId: string): Promise<RobotPart | undefined>;
        deleteFragment(id: string): Promise<void>;
        deleteKey(id: string): Promise<DeleteKeyResponse>;
        deleteLocation(locId: string): Promise<void>;
        deleteLocationSecret(locId: string, secretId: string): Promise<void>;
        deleteOrganization(organizationId: string): Promise<void>;
        deleteOrganizationInvite(
            organizationId: string,
            email: string,
        ): Promise<void>;
        deleteOrganizationMember(
            organizationId: string,
            userId: string,
        ): Promise<void>;
        deleteRegistryItem(itemId: string): Promise<void>;
        deleteRobot(id: string): Promise<void>;
        deleteRobotPart(partId: string): Promise<void>;
        deleteRobotPartSecret(partId: string, secretId: string): Promise<void>;
        deprecateRegistryItem(itemId: string, message: string): Promise<void>;
        deprecateRegistryItemVersion(
            itemId: string,
            version: string,
            message: string,
        ): Promise<void>;
        getAppBranding(
            publicNamespace: string,
            name: string,
        ): Promise<GetAppBrandingResponse>;
        getAppContent(
            publicNamespace: string,
            name: string,
        ): Promise<GetAppContentResponse>;
        getFragment(id: string): Promise<Fragment | undefined>;
        getLocation(locId: string): Promise<Location | undefined>;
        getLocationMetadata(id: string): Promise<Record<string, JsonValue>>;
        getModule(moduleId: string): Promise<Module | undefined>;
        getOrganization(organizationId: string): Promise<Organization | undefined>;
        getOrganizationMetadata(id: string): Promise<Record<string, JsonValue>>;
        getOrganizationNamespaceAvailability(namespace: string): Promise<boolean>;
        getOrganizationsWithAccessToLocation(
            locationId: string,
        ): Promise<OrganizationIdentity[]>;
        getRegistryItem(itemId: string): Promise<RegistryItem | undefined>;
        getRobot(id: string): Promise<appApi.Robot | undefined>;
        getRobotAPIKeys(robotId: string): Promise<APIKeyWithAuthorizations[]>;
        getRobotMetadata(id: string): Promise<Record<string, JsonValue>>;
        getRobotPart(id: string): Promise<GetRobotPartResponse>;
        getRobotPartByNameAndLocation(
            name: string,
            locationId: string,
        ): Promise<GetRobotPartByNameAndLocationResponse>;
        getRobotPartHistory(id: string): Promise<RobotPartHistoryEntry[]>;
        getRobotPartLogs(
            id: string,
            filter?: string,
            levels?: string[],
            start?: Date,
            end?: Date,
            pageToken?: string,
        ): Promise<GetRobotPartLogsResponse>;
        getRobotPartMetadata(id: string): Promise<Record<string, JsonValue>>;
        getRobotParts(robotId: string): Promise<RobotPart[]>;
        getRoverRentalRobots(orgId: string): Promise<RoverRentalRobot[]>;
        getUserIDByEmail(email: string): Promise<string>;
        listAuthorizations(
            organizationId: string,
            resourceIds?: string[],
        ): Promise<Authorization[]>;
        listFragments(
            organizationId: string,
            publicOnly?: boolean,
            fragmentVisibility?: FragmentVisibility[],
        ): Promise<Fragment[]>;
        listKeys(orgId: string): Promise<APIKeyWithAuthorizations[]>;
        listLocations(organizationId: string): Promise<Location[]>;
        listMachineFragments(
            machineId: string,
            additionalFragmentIds?: string[],
        ): Promise<Fragment[]>;
        listMachineSummaries(
            organizationId: string,
            fragmentIds?: string[],
            locationIds?: string[],
            limit?: number,
        ): Promise<LocationSummary[]>;
        listModules(organizationId: string): Promise<Module[]>;
        listOrganizationMembers(
            organizationId: string,
        ): Promise<ListOrganizationMembersResponse>;
        listOrganizations(): Promise<Organization[]>;
        listOrganizationsByUser(userId: string): Promise<OrgDetails[]>;
        listRegistryItems(
            organizationId: string,
            types: PackageType[],
            visibilities: Visibility[],
            platforms: string[],
            statuses: RegistryItemStatus[],
            searchTerm?: string,
            pageToken?: string,
        ): Promise<RegistryItem[]>;
        listRobots(locId: string): Promise<appApi.Robot[]>;
        locationAuth(locId: string): Promise<LocationAuth | undefined>;
        markPartAsMain(partId: string): Promise<void>;
        markPartForRestart(partId: string): Promise<void>;
        newRobot(locId: string, name: string): Promise<string>;
        newRobotPart(robotId: string, partName: string): Promise<string>;
        removeRole(
            organizationId: string,
            entityId: string,
            role: string,
            resourceType: string,
            resourceId: string,
        ): Promise<void>;
        resendOrganizationInvite(
            organizationId: string,
            email: string,
        ): Promise<OrganizationInvite | undefined>;
        rotateKey(id: string): Promise<RotateKeyResponse>;
        shareLocation(organizationId: string, locId: string): Promise<void>;
        tailRobotPartLogs(
            id: string,
            queue: LogEntry[],
            filter?: string,
            errorsOnly?: boolean,
        ): Promise<void>;
        undeprecateRegistryItem(itemId: string): Promise<void>;
        undeprecateRegistryItemVersion(
            itemId: string,
            version: string,
        ): Promise<void>;
        unshareLocation(organizationId: string, locId: string): Promise<void>;
        updateFragment(
            id: string,
            name: string,
            config: Struct,
            makePublic?: boolean,
            visibility?: FragmentVisibility,
        ): Promise<Fragment | undefined>;
        updateLocation(
            locId: string,
            name?: string,
            parentLocId?: string,
            region?: string,
        ): Promise<Location | undefined>;
        updateLocationMetadata(
            id: string,
            data: Record<string, JsonValue>,
        ): Promise<void>;
        updateModule(
            moduleId: string,
            visibility: Visibility,
            url: string,
            description: string,
            models: Model[],
            entrypoint: string,
        ): Promise<string>;
        updateOrganization(
            organizationId: string,
            name?: string,
            publicNamespace?: string,
            region?: string,
            cid?: string,
            defaultFragments?: FragmentImportList,
        ): Promise<Organization | undefined>;
        updateOrganizationInviteAuthorizations(
            organizationId: string,
            email: string,
            addAuthsList: Authorization[],
            removeAuthsList: Authorization[],
        ): Promise<OrganizationInvite | undefined>;
        updateOrganizationMetadata(
            id: string,
            data: Record<string, JsonValue>,
        ): Promise<void>;
        updateRegistryItem(
            itemId: string,
            type: PackageType,
            description: string,
            visibility: Visibility,
        ): Promise<void>;
        updateRobot(
            robotId: string,
            locId: string,
            name: string,
        ): Promise<appApi.Robot | undefined>;
        updateRobotMetadata(
            id: string,
            data: Record<string, JsonValue>,
        ): Promise<void>;
        updateRobotPart(
            id: string,
            name: string,
            robotConfig: Struct,
        ): Promise<RobotPart | undefined>;
        updateRobotPartMetadata(
            id: string,
            data: Record<string, JsonValue>,
        ): Promise<void>;
    }
    Index

    Methods

    addRole changeRole checkPermissions createFragment createKey createKeyFromExistingKeyAuthorizations createLocation createLocationSecret createModule createOAuthAppUser createOrganization createOrganizationInvite createRegistryItem createRobotPartSecret deleteFragment deleteKey deleteLocation deleteLocationSecret deleteOrganization deleteOrganizationInvite deleteOrganizationMember deleteRegistryItem deleteRobot deleteRobotPart deleteRobotPartSecret deprecateRegistryItem deprecateRegistryItemVersion getAppBranding getAppContent getFragment getLocation getLocationMetadata getModule getOrganization getOrganizationMetadata getOrganizationNamespaceAvailability getOrganizationsWithAccessToLocation getRegistryItem getRobot getRobotAPIKeys getRobotMetadata getRobotPart getRobotPartByNameAndLocation getRobotPartHistory getRobotPartLogs getRobotPartMetadata getRobotParts getRoverRentalRobots getUserIDByEmail listAuthorizations listFragments listKeys listLocations listMachineFragments listMachineSummaries listModules listOrganizationMembers listOrganizations listOrganizationsByUser listRegistryItems listRobots locationAuth markPartAsMain markPartForRestart newRobot newRobotPart removeRole resendOrganizationInvite rotateKey shareLocation tailRobotPartLogs undeprecateRegistryItem undeprecateRegistryItemVersion unshareLocation updateFragment updateLocation updateLocationMetadata updateModule updateOrganization updateOrganizationInviteAuthorizations updateOrganizationMetadata updateRegistryItem updateRobot updateRobotMetadata updateRobotPart updateRobotPartMetadata

    Methods

    • Add a role under an organization.

      Parameters

      • organizationId: string

        The ID of the organization to create the role under

      • entityId: string

        The ID of the entity the role belongs to (for example a user ID)

      • role: string

        The role to add ("owner" or "operator")

      • resourceType: string

        The type of resource to create the role for ("robot", "location", or "organization")

      • resourceId: string

        The ID of the resource the role is being created for

      Returns Promise<void>

      await appClient.addRole(
      '<YOUR-ORGANIZATION-ID>',
      '<YOUR-USER-ID>',
      'owner',
      'robot',
      '<YOUR-ROBOT-ID>',
      );

      For more information, see App API.

    • Changes an existing role.

      Parameters

      Returns Promise<void>

      const oldAuth = new VIAM.appApi.Authorization({
      authorizationType: 'role',
      authorizationId: 'organization_owner',
      organizationId: '<YOUR-ORGANIZATION-ID>',
      resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
      resourceType: 'organization', // The type of resource to grant access to
      identityId: '<USER-ID>', // 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: '<YOUR-ORGANIZATION-ID>',
      resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
      resourceType: 'organization', // The type of resource to grant access To
      identityId: '<USER-ID>', // 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.

    • Creates a new fragment.

      Parameters

      • organizationId: string

        The ID of the organization to create the fragment under

      • name: string

        The name of the new fragment

      • config: Struct

        The new fragment's config

      Returns Promise<Fragment | undefined>

      The newly created fragment

      const fragment = await appClient.createFragment('<YOUR-ORGANIZATION-ID>', 'newFragment');
      

      For more information, see App API.

    • Creates a new API key.

      For more information, see App API.

      Parameters

      • authorizations: Authorization[]

        The list of authorizations to provide for the API key

      • Optionalname: string

        An optional name for the key. If none is passed, defaults to present timestamp

      Returns Promise<CreateKeyResponse>

      The new key and ID

    • Creates a new location.

      Parameters

      • organizationId: string

        The ID of the organization to create the location under

      • name: string

        The name of the location to create

      • OptionalparentLocationId: string

        Optional name of a parent location to create the new location under

      Returns Promise<Location | undefined>

      The location object

      const location = await appClient.createLocation('<YOUR-ORGANIZATION-ID>', 'name');
      

      For more information, see App API.

    • Create a location secret (LocationAuth).

      Parameters

      • locId: string

        The ID of the location to create a LocationAuth for

      Returns Promise<LocationAuth | undefined>

      The newly created LocationAuth

      const locationAuth = await appClient.createLocationSecret('<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Creates a new module.

      Parameters

      • organizationId: string

        The ID of the organization to create the module under

      • name: string

        The name of the module

      Returns Promise<CreateModuleResponse>

      The module ID and a URL to its detail page

      const module = await appClient.createModule('<YOUR-ORGANIZATION-ID>', 'newModule');
      

      For more information, see App API.

    • Creates a new OAuth app user.

      Parameters

      • orgId: string

        The ID of the organization

      • applicationId: string

        The ID of the OAuth application

      • email: string

        The email address for the new user

      • firstName: string

        The first name of the new user

      • lastName: string

        The last name of the new user

      • password: string

        The password for the new user

      Returns Promise<CreateOAuthAppUserResponse>

      The auth token, registration ID, user ID, and refresh token

      const result = await appClient.createOAuthAppUser(
      '<YOUR-ORGANIZATION-ID>',
      '<YOUR-APPLICATION-ID>',
      'user@example.com',
      'First',
      'Last',
      'password',
      );
    • Create a new organization.

      For more information, see App API.

      Parameters

      • name: string

        The name of the new organization

      Returns Promise<Organization | undefined>

      The new organization

    • Creates a new invitation to join an organization.

      Parameters

      • organizationId: string

        The id of the organization to create the invite for

      • email: string

        The email address of the user to generate an invite for

      • authorizations: Authorization[]

        The authorizations to associate with the new invite

      • sendEmailInvite: boolean = true

        Bool of whether to send an email invite (true) or automatically add a user. Defaults to true

      Returns Promise<OrganizationInvite | undefined>

      The organization invite

      const auth = new VIAM.appApi.Authorization({
      authorizationType: 'role',
      authorizationId: 'organization_operator',
      organizationId: '<YOUR-ORGANIZATION-ID>',
      resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
      resourceType: 'organization', // The type of resource to grant access to
      identityId: '<YOUR-USER-ID>', // 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(
      '<YOUR-ORGANIZATION-ID>',
      'youremail@email.com',
      [auth],
      );

      For more information, see App API.

    • Create a new registry item.

      Parameters

      • organizationId: string

        The ID of the organization to create the registry item under

      • name: string

        The name of the registry item

      • type: PackageType

        The type of the item in the registry.

      Returns Promise<void>

      await appClient.createRegistryItem('<YOUR-ORGANIZATION-ID>', 'newRegistryItemName', 5);
      

      For more information, see App API.

    • Creates a new secret for a robot part.

      Parameters

      • partId: string

        The ID of the part to create a secret for

      Returns Promise<RobotPart | undefined>

      The robot part object

      const robotPart = await appClient.createRobotPartSecret('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Deletes a fragment.

      Parameters

      • id: string

        The ID of the fragment to delete

      Returns Promise<void>

      await appClient.deleteFragment('12a12ab1-1234-5678-abcd-abcd01234567');
      

      For more information, see App API.

    • Deletes an existing API key.

      Parameters

      • id: string

        The ID of the key to delete

      Returns Promise<DeleteKeyResponse>

      await appClient.deleteKey('<YOUR-KEY-ID>');
      

      For more information, see App API.

    • Deletes a location

      Parameters

      • locId: string

        The ID of the location to delete

      Returns Promise<void>

      await appClient.deleteLocation('<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Deletes a location secret (LocationAuth).

      Parameters

      • locId: string

        The ID of the location to delete the LocationAuth from

      • secretId: string

        The ID of the location secret to delete

      Returns Promise<void>

      await appClient.deleteLocationSecret('<YOUR-LOCATION-ID>', '<YOUR-SECRET-ID>');
      

      For more information, see App API.

    • Deletes an organization.

      Parameters

      • organizationId: string

        The id of the organization to delete

      Returns Promise<void>

      await appClient.deleteOrganization('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Deletes a pending organization invite.

      Parameters

      • organizationId: string

        The ID of the organization

      • email: string

        The email associated with the invite to delete

      Returns Promise<void>

      await appClient.deleteOrganizationInvite('<YOUR-ORGANIZATION-ID>', 'youremail@email.com');
      

      For more information, see App API.

    • Removes a member from an organization.

      Parameters

      • organizationId: string

        The ID of the organization

      • userId: string

        The ID of the user

      Returns Promise<void>

      await appClient.deleteOrganizationMember('<YOUR-ORGANIZATION-ID>', '<YOUR-USER-ID>');
      

      For more information, see App API.

    • Deletes a registry item.

      Parameters

      • itemId: string

        The ID of the item to delete

      Returns Promise<void>

      await appClient.deleteRegistryItem('<YOUR-REGISTRY-ITEM-ID>');
      

      For more information, see App API.

    • Deletes a robot.

      Parameters

      • id: string

        The ID of the robot to delete

      Returns Promise<void>

      await appClient.deleteRobot('<YOUR-ROBOT-ID>');
      

      For more information, see App API.

    • Deletes a robot part.

      Parameters

      • partId: string

        The ID of the part to delete

      Returns Promise<void>

      await appClient.deleteRobotPart('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Deletes a robot secret from a robot part.

      Parameters

      • partId: string

        The ID of the part to delete a secret from

      • secretId: string

        The ID of the secret to delete

      Returns Promise<void>

      await appClient.deleteRobotPartSecret('<YOUR-ROBOT-PART-ID>', '<YOUR-SECRET-ID>');
      

      For more information, see App API.

    • Deprecates a registry item.

      Parameters

      • itemId: string

        The ID of the item to deprecate

      • message: string

        The reason for deprecation

      Returns Promise<void>

      await appClient.deprecateRegistryItem('<YOUR-REGISTRY-ITEM-ID>', 'reason for deprecation');
      
    • Deprecates a specific version of a registry item.

      Parameters

      • itemId: string

        The ID of the registry item

      • version: string

        The semver string of the version to deprecate

      • message: string

        The reason for deprecation

      Returns Promise<void>

      await appClient.deprecateRegistryItemVersion(
      '<YOUR-REGISTRY-ITEM-ID>',
      '1.2.3',
      'reason for deprecation',
      );
    • Retrieves the app branding for an organization/app.

      Parameters

      • publicNamespace: string

        The public namespace of the organization

      • name: string

        The name of the app

      Returns Promise<GetAppBrandingResponse>

      The branding information for the app

      const branding = await appClient.getAppBranding(
      '<YOUR-PUBLIC-NAMESPACE>',
      '<YOUR-APP-NAME>',
      );

      For more information, see App API.

    • Retrieves the app content for an organization.

      Parameters

      • publicNamespace: string

        The public namespace of the organization

      • name: string

        The name of the app

      Returns Promise<GetAppContentResponse>

      The blob path and entrypoint of the app content

      const appContent = await appClient.getAppContent(
      '<YOUR-PUBLIC-NAMESPACE>',
      '<YOUR-APP-NAME>',
      );

      For more information, see App API.

    • Looks up a fragment by ID.

      Parameters

      • id: string

        The ID of the fragment to look up

      Returns Promise<Fragment | undefined>

      The requested fragment

      const fragment = await appClient.getFragment('12a12ab1-1234-5678-abcd-abcd01234567');
      

      For more information, see App API.

    • Looks up a location.

      Parameters

      • locId: string

        The ID of the location to query.

      Returns Promise<Location | undefined>

      The location object

      const location = await appClient.getLocation('<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Retrieves user-defined metadata for a location.

      Parameters

      • id: string

        The ID of the location

      Returns Promise<Record<string, JsonValue>>

      The metadata associated with the location

      const metadata = await appClient.getLocationMetadata('<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Looks up a particular module.

      Parameters

      • moduleId: string

        The ID of the module

      Returns Promise<Module | undefined>

      The requested module

      const module = await appClient.getModule('<YOUR-MODULE-ID>');
      

      For more information, see App API.

    • Get details about an organization.

      Parameters

      • organizationId: string

        The ID of the organization

      Returns Promise<Organization | undefined>

      Details about the organization, if it exists

      const organization = await appClient.getOrganization('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Retrieves user-defined metadata for an organization.

      Parameters

      • id: string

        The ID of the organization

      Returns Promise<Record<string, JsonValue>>

      The metadata associated with the organization

      const metadata = await appClient.getOrganizationMetadata('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Find out if an organization namespace is available.

      Parameters

      • namespace: string

        The namespace to query for availability

      Returns Promise<boolean>

      A boolean indicating whether or not the namespace is available

      const isAvailable = await appClient.getOrganizationNamespaceAvailability('name');
      

      For more information, see App API.

    • List all organizations with access to a particular location.

      Parameters

      • locationId: string

        The ID of the location to query

      Returns Promise<OrganizationIdentity[]>

      The list of locations with access to the requested location

      const organizations =
      await appClient.getOrganizationsWithAccessToLocation('<YOUR-LOCATION-ID>');

      For more information, see App API.

    • Get an item from the registry.

      Parameters

      • itemId: string

        The ID of the item to get

      Returns Promise<RegistryItem | undefined>

      The requested item

      const registryItem = await appClient.getRegistryItem('<YOUR-REGISTRY-ITEM-ID>');
      

      For more information, see App API.

    • Queries a robot by its ID.

      Parameters

      • id: string

        The ID of the robot

      Returns Promise<appApi.Robot | undefined>

      The Robot object

      const robot = await appClient.getRobot('<YOUR-ROBOT-ID>');
      

      For more information, see App API.

    • Gets a list of a robot's API keys.

      Parameters

      • robotId: string

        The ID of the robot to get API keys for

      Returns Promise<APIKeyWithAuthorizations[]>

      A list of the robot's API keys

      const robotAPIKeys = await appClient.getRobotAPIKeys('<YOUR-ROBOT-ID>');
      

      For more information, see App API.

    • Retrieves user-defined metadata for a robot.

      Parameters

      • id: string

        The ID of the robot

      Returns Promise<Record<string, JsonValue>>

      The metadata associated with the robot

      const metadata = await appClient.getRobotMetadata('<YOUR-ROBOT-ID>');
      

      For more information, see App API.

    • Queries a specific robot part by ID.

      Parameters

      • id: string

        The ID of the requested robot part

      Returns Promise<GetRobotPartResponse>

      The robot part and a its json config

      const robotPart = await appClient.getRobotPart('<YOUR-ROBOT-PART-ID>');
      // 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.

    • Queries a specific robot part by name and location id.

      Parameters

      • name: string

        The name of the requested robot part

      • locationId: string

        The ID of the location of the requested robot part

      Returns Promise<GetRobotPartByNameAndLocationResponse>

      The robot part

      const robotPart = await appClient.getRobotPartByNameAndLocation(
      '<YOUR-ROBOT-PART-NAME>',
      '<YOUR-LOCATION-ID>',
      );

      For more information, see App API.

    • Get a list containing the history of a robot part.

      Parameters

      • id: string

        The ID of the requested robot part

      Returns Promise<RobotPartHistoryEntry[]>

      The list of the robot part's history

      const robotPartHistory = await appClient.getRobotPartHistory('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Get a page of log entries for a specific robot part. Logs are sorted by descending time (newest first).

      Parameters

      • id: string

        The ID of the requested robot part

      • Optionalfilter: string

        Optional string to filter logs on

      • Optionallevels: string[]

        Optional array of log levels to return. Defaults to returning all log levels

      • Optionalstart: Date

        Optional start time for log retrieval. Only logs created after this time will be returned.

      • Optionalend: Date

        Optional end time for log retrieval. Only logs created before this time will be returned.

      • pageToken: string = ''

        Optional string indicating which page of logs to query. Defaults to the most recent

      Returns Promise<GetRobotPartLogsResponse>

      The robot requested logs and the page token for the next page of logs

      const robotPartLogs = await appClient.getRobotPartLogs('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Retrieves user-defined metadata for a robot part.

      Parameters

      • id: string

        The ID of the robot part

      Returns Promise<Record<string, JsonValue>>

      The metadata associated with the robot part

      const metadata = await appClient.getRobotPartMetadata('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Returns a list of parts for a given robot

      Parameters

      • robotId: string

        The ID of the robot to query

      Returns Promise<RobotPart[]>

      The list of RobotPart objects associated with the robot

      const robotParts = await appClient.getRobotParts('<YOUR-ROBOT-ID>');
      

      For more information, see App API.

    • Returns a list of rover rental robots for an organization.

      Parameters

      • orgId: string

        The ID of the organization to query

      Returns Promise<RoverRentalRobot[]>

      The list of RoverRentalRobot objects

      const roverRentalRobots = await appClient.getRoverRentalRobots('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Obtain a user's ID from their email address. Internal use only.

      Parameters

      • email: string

        The email address of the user

      Returns Promise<string>

      The user's ID

      // This method is used internally only. To obtain a user's ID, use the listOrganizationsByUser method.
      const members = await appClient.listOrganizationMembers('<YOUR-ORGANIZATION-ID>');

      For more information, see App API.

    • List all authorizations for an organization.

      For more information, see App API.

      Parameters

      • organizationId: string

        The ID of the organization to list authorizations for

      • OptionalresourceIds: string[]

        Optional list of IDs of resources to list authorizations for. If not provided, all resources will be included

      Returns Promise<Authorization[]>

      The list of authorizations

    • Lists all fragments within an organization.

      Parameters

      • organizationId: string

        The ID of the organization to list fragments for

      • publicOnly: boolean = true

        Optional, deprecated boolean. Use fragmentVisibilities instead. If true then only public fragments will be listed. Defaults to true

      • fragmentVisibility: FragmentVisibility[] = []

      Returns Promise<Fragment[]>

      The list of fragment objects

      const fragments = await appClient.listFragments('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • List all API keys for an organization.

      Parameters

      • orgId: string

        The ID of the organization to query

      Returns Promise<APIKeyWithAuthorizations[]>

      The list of API keys

      const keys = await appClient.listKeys('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Lists all locations under an organization.

      Parameters

      • organizationId: string

        The ID of the organization to query

      Returns Promise<Location[]>

      A list of locations under the organization

      const locations = await appClient.listLocations('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Parameters

      • machineId: string

        The machine ID used to filter fragments defined in a machine's parts. Also returns any fragments nested within the fragments defined in parts.

      • OptionaladditionalFragmentIds: string[]

        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 Promise<Fragment[]>

      The list of top level and nested fragments for a machine, as well as additionally specified fragment IDs.

      const fragments = await appClient.listMachineFragments('<YOUR-MACHINE-ID>');
      

      For more information, see App API.

    • Lists machine summaries for an organization, optionally filtered by fragment IDs, location IDs, and limit.

      Parameters

      • organizationId: string

        The ID of the organization

      • OptionalfragmentIds: string[]

        Optional list of fragment IDs to filter machines

      • OptionallocationIds: string[]

        Optional list of location IDs to filter machines

      • Optionallimit: number

        Optional max number of machines to return

      Returns Promise<LocationSummary[]>

      The list of location summaries

      const summaries = await appClient.listMachineSummaries('orgId', ['frag1'], ['loc1'], 10);
      
    • Lists all modules for an organization.

      Parameters

      • organizationId: string

        The ID of the organization to query

      Returns Promise<Module[]>

      The organization's modules

      const modules = await appClient.listModules('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • Lists organization memebers and outstanding invites.

      Parameters

      • organizationId: string

        The id of the organization to query

      Returns Promise<ListOrganizationMembersResponse>

      An object containing organization members, pending invites, and org ID

      const members = await appClient.listOrganizationMembers('<YOUR-ORGANIZATION-ID>');
      

      For more information, see App API.

    • List all organizations.

      Returns Promise<Organization[]>

      The organization list

      const organizations = await appClient.listOrganizations();
      

      For more information, see App API.

    • List all organizations associated with a user. Internal use only.

      Parameters

      • userId: string

        The ID of the user to query

      Returns Promise<OrgDetails[]>

      The list of locations the requested user has access to

    • List all registry items for an organization.

      Parameters

      • organizationId: string

        The ID of the organization to query registry items for

      • types: PackageType[]

        A list of types to query. If empty, will not filter on type

      • visibilities: Visibility[]

        A list of visibilities to query for. If empty, will not filter on visibility

      • platforms: string[]

        A list of platforms to query for. If empty, will not filter on platform

      • statuses: RegistryItemStatus[]

        A list of statuses to query for. If empty, will not filter on status

      • OptionalsearchTerm: string

        Optional search term to filter on

      • OptionalpageToken: string

        Optional page token for results. If not provided, will return all results

      Returns Promise<RegistryItem[]>

      The list of registry items

      const registryItems = await appClient.listRegistryItems(
      '<YOUR-ORGANIZATION-ID>',
      [], // All package types
      [1], // Private packages
      [],
      [1], // Active packages
      );

      For more information, see App API.

    • Lists all robots in a location.

      Parameters

      • locId: string

        The ID of the location to list robots for

      Returns Promise<appApi.Robot[]>

      The list of robot objects

      const robots = await appClient.listRobots('<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Get a location's LocationAuth (location secret(s)).

      Parameters

      • locId: string

        The ID of the location to retrieve LocationAuth from.

      Returns Promise<LocationAuth | undefined>

      The LocationAuth for the requested location.

      const locationAuth = await appClient.locationAuth('<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Marks a robot part as the main part.

      Parameters

      • partId: string

        The ID of the part to mark as main

      Returns Promise<void>

      await appClient.markPartAsMain('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Marks a robot part for restart.

      Parameters

      • partId: string

        The ID of the part to mark for restart

      Returns Promise<void>

      await appClient.markPartForRestart('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Creates a new robot.

      Parameters

      • locId: string

        The ID of the location to create the robot in

      • name: string

        The name of the new robot

      Returns Promise<string>

      The new robot's ID

      const robotId = await appClient.newRobot('<YOUR-LOCATION-ID>', 'newRobot');
      

      For more information, see App API.

    • Creates a new robot part.

      Parameters

      • robotId: string

        The ID of the robot to create a part for

      • partName: string

        The name for the new robot part

      Returns Promise<string>

      The ID of the newly-created robot part

      const robotPartId = await appClient.newRobotPart('<YOUR-ROBOT-ID>', 'newPart');
      

      For more information, see App API.

    • Removes a role from an organization.

      Parameters

      • organizationId: string

        The ID of the organization to remove the role from

      • entityId: string

        The ID of the entity the role belongs to (for example a user ID)

      • role: string

        The role to remove ("owner" or "operator")

      • resourceType: string

        The type of resource to remove the role from ("robot", "location", or "organization")

      • resourceId: string

        The ID of the resource the role is being removes from

      Returns Promise<void>

      await appClient.removeRole(
      '<YOUR-ORGANIZATION-ID>',
      '<YOUR-USER-ID>',
      'owner',
      'robot',
      '<YOUR-ROBOT-ID>',
      );

      For more information, see App API.

    • Resends a pending organization invite.

      Parameters

      • organizationId: string

        The ID of the organization

      • email: string

        The email associated with the invite to resend

      Returns Promise<OrganizationInvite | undefined>

      The invite

      const invite = await appClient.resendOrganizationInvite(
      '<YOUR-ORGANIZATION-ID>',
      'youremail@email.com',
      );

      For more information, see App API.

    • Rotates an existing API key.

      Parameters

      • id: string

        The ID of the key to rotate

      Returns Promise<RotateKeyResponse>

      The updated key and ID

      const key = await appClient.rotateKey('<YOUR-KEY-ID>');
      

      For more information, see App API.

    • Shares a location with another organization

      Parameters

      • organizationId: string

        The ID of the organization to share with

      • locId: string

        The ID of the location to share

      Returns Promise<void>

      await appClient.shareLocation('<OTHER-ORGANIZATION-ID>', '<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Get a stream of log entries for a specific robot part. Logs are sorted by descending time (newest first).

      Parameters

      • id: string

        The ID of the requested robot part

      • queue: LogEntry[]

        A queue to put the log entries into

      • Optionalfilter: string

        Optional string to filter logs on

      • errorsOnly: boolean = true

        Optional bool to indicate whether or not only error-level logs should be returned. Defaults to true

      Returns Promise<void>

      const robotPartLogs = await appClient.tailRobotPartLogs('<YOUR-ROBOT-PART-ID>');
      

      For more information, see App API.

    • Undeprecates a registry item.

      Parameters

      • itemId: string

        The ID of the item to undeprecate

      Returns Promise<void>

      await appClient.undeprecateRegistryItem('<YOUR-REGISTRY-ITEM-ID>');
      
    • Undeprecates a specific version of a registry item.

      Parameters

      • itemId: string

        The ID of the registry item

      • version: string

        The semver string of the version to undeprecate

      Returns Promise<void>

      await appClient.undeprecateRegistryItemVersion('<YOUR-REGISTRY-ITEM-ID>', '1.2.3');
      
    • Unshares a location with an organization

      Parameters

      • organizationId: string

        The ID of the organization to unshare with

      • locId: string

        The ID of the location to unshare

      Returns Promise<void>

      await appClient.unshareLocation('<OTHER-ORGANIZATION-ID>', '<YOUR-LOCATION-ID>');
      

      For more information, see App API.

    • Updates an existing fragment.

      Parameters

      • id: string

        The ID of the fragment to update

      • name: string

        The name to update the fragment to

      • config: Struct

        The config to update the fragment to

      • OptionalmakePublic: boolean

        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

      • Optionalvisibility: FragmentVisibility

        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 Promise<Fragment | undefined>

      The updated fragment

      const fragment = await appClient.updateFragment(
      '12a12ab1-1234-5678-abcd-abcd01234567',
      'better_name',
      );

      For more information, see App API.

    • Updates location details.

      Parameters

      • locId: string

        The ID of the location to update

      • Optionalname: string

        Optional string to update the location's name to

      • OptionalparentLocId: string

        Optional string to update the location's parent location to

      • Optionalregion: string

        Optional string to update the location's region to

      Returns Promise<Location | undefined>

      The location object

      const location = await appClient.updateLocation('<YOUR-LOCATION-ID>', 'newName');
      

      For more information, see App API.

    • Updates user-defined metadata for a location.

      Parameters

      • id: string

        The ID of the location

      • data: Record<string, JsonValue>

        The metadata to update

      Returns Promise<void>

      await appClient.updateLocationMetadata('<YOUR-LOCATION-ID>', {
      key: 'value',
      });

      For more information, see App API.

    • Updates an existing module.

      Parameters

      • moduleId: string

        The ID of the module to update

      • visibility: Visibility

        The visibility to set for the module

      • url: string

        The url to reference for documentation, code, etc.

      • description: string

        A short description of the module

      • models: Model[]

        A list of models available in the module

      • entrypoint: string

        The executable to run to start the module program

      Returns Promise<string>

      The module URL

      const module = await appClient.updateModule(
      '<YOUR-MODULE-ID>',
      1,
      'https://example.com',
      'new description',
      [{ model: 'namespace:group:model1', api: 'rdk:component:generic' }],
      'entrypoint',
      );

      For more information, see App API.

    • Updates organization details.

      Parameters

      • organizationId: string

        The id of the organization to update

      • Optionalname: string

        Optional name to update the organization with

      • OptionalpublicNamespace: string

        Optional namespace to update the organization with

      • Optionalregion: string

        Optional region to update the organization with

      • Optionalcid: string

        Optional CRM ID to update the organization with

      • OptionaldefaultFragments: FragmentImportList

        Optional default fragments to set for the organization

      Returns Promise<Organization | undefined>

      The updated organization details

      const organization = await appClient.updateOrganization(
      '<YOUR-ORGANIZATION-ID>',
      'newName',
      );

      For more information, see App API.

    • Updates authorizations for an existing org invite.

      Parameters

      • organizationId: string

        The id of the organization

      • email: string

        The email address associated with the invite

      • addAuthsList: Authorization[]

        List of authorizations to add to the invite

      • removeAuthsList: Authorization[]

        List of authorizations to remove from the invite

      Returns Promise<OrganizationInvite | undefined>

      The organization invite

      const auth = new VIAM.appApi.Authorization({
      authorizationType: 'role',
      authorizationId: 'organization_operator',
      organizationId: '<YOUR-ORGANIZATION-ID>',
      resourceId: '<YOUR-RESOURCE-ID>', // The resource to grant access to
      resourceType: 'organization', // The type of resource to grant access to
      identityId: '<YOUR-USER-ID>', // 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(
      '<YOUR-ORGANIZATION-ID>',
      'youremail@email.com',
      [auth],
      [],
      );

      For more information, see App API.

    • Updates user-defined metadata for an organization.

      Parameters

      • id: string

        The ID of the organization

      • data: Record<string, JsonValue>

        The metadata to update

      Returns Promise<void>

      await appClient.updateOrganizationMetadata('<YOUR-ORGANIZATION-ID>', {
      key: 'value',
      });

      For more information, see App API.

    • Update an existing registry item.

      Parameters

      • itemId: string

        The ID of the registry item to update

      • type: PackageType

        The PackageType to update the item to

      • description: string

        A description of the item

      • visibility: Visibility

        A visibility value to update to

      Returns Promise<void>

      await appClient.updateRegistryItem(
      '<YOUR-REGISTRY-ITEM-ID>',
      5, // Package: ML Model
      'new description',
      1, // Private
      );

      For more information, see App API.

    • Change the name of an existing machine. You can only change the name of the machine, not the location.

      Parameters

      • robotId: string

        The ID of the robot to update

      • locId: string

        The ID of the location where the robot is

      • name: string

        The name to update the robot to

      Returns Promise<appApi.Robot | undefined>

      The newly-modified robot object

      const robot = await appClient.updateRobot(
      '<YOUR-ROBOT-ID>',
      '<YOUR-LOCATION-ID>',
      'newName',
      );

      For more information, see App API.

    • Updates user-defined metadata for a robot.

      Parameters

      • id: string

        The ID of the robot

      • data: Record<string, JsonValue>

        The metadata to update

      Returns Promise<void>

      await appClient.updateRobotMetadata('<YOUR-ROBOT-ID>', {
      key: 'value',
      });

      For more information, see App API.

    • Updates a robot part based on its ID.

      Parameters

      • id: string

        The ID of the requested robot part

      • name: string

        The new name of the robot part

      • robotConfig: Struct

        The new config for the robot part

      Returns Promise<RobotPart | undefined>

      The updated robot part

      const robotPart = await appClient.updateRobotPart('<YOUR-ROBOT-PART-ID>', 'newName');
      

      For more information, see App API.

    • Updates user-defined metadata for a robot part.

      Parameters

      • id: string

        The ID of the robot part

      • data: Record<string, JsonValue>

        The metadata to update

      Returns Promise<void>

      await appClient.updateRobotPartMetadata('<YOUR-ROBOT-PART-ID>', {
      key: 'value',
      });

      For more information, see App API.