flexadminportal
    Preparing search index...

    A class that contains methods for interacting with the Amplify API

    Hierarchy (View Summary)

    Index

    ctx

    _error: (message?: any) => void = alert
    • Protected Methods **

    Type Declaration

      • (message?: any): void
      • window.alert() instructs the browser to display a dialog with an optional message, and to wait until the user dismisses the dialog.

        MDN Reference

        Parameters

        • Optionalmessage: any

        Returns void

    _errorFunction: (errors: string[] | number[] | object[]) => void = console.error
    • get amplify(): Client

      Returns Client

    • set amplify(amplify: Client): void

      Parameters

      • amplify: Client

      Returns void

    • set errorFunction(error: (errors: string[] | number[] | object[]) => void): void

      Parameters

      • error: (errors: string[] | number[] | object[]) => void

      Returns void

    • Averages an array of numbers

      Parameters

      • arr: number[]

        an array of numbers to average

      Returns number

      the average of the elements in the array

    • Delete many S3 files at once

      Parameters

      • fileNames: string[]

        the list of file names to delete

      Returns Promise<any>

      the list of the files which had errors, if any

    • Generate a random string of characters to be used as a unique id

      Returns string | number[]

      the result of the call to the uuid function

    • Delete a device from the database

      Parameters

      • deviceID: number

        the ID of the device to delete

      Returns Promise<
          {
              __typename: "Device";
              ID: number;
              ImageURL?: string;
              Name?: string;
              Password?: string;
              RadiusRA?: number;
              RadiusRB?: number;
              RadiusRC?: number;
              RadiusRD?: number;
              SerialNumber?: string;
              SpringConstant?: number;
          },
      >

    • Delete the device authentication entity

      Parameters

      • deviceID: number

        the ID of the device to delete the authentication entity for

      Returns Promise<boolean>

      true if the entity was deleted, false otherwise

    • Delete the device key from the S3 bucket

      Parameters

      • deviceID: number

        the ID of the device to delete the key for

      Returns Promise<boolean>

      true if the key was deleted, false otherwise

    • Parameters

      • path: string
      • handleError: (errors: string[] | number[] | object[]) => void = ...

      Returns Promise<boolean>

    • Executes a lambda function

      Parameters

      • functionName: string

        The name of the lambda function to execute

      • functionArgs: any

        The arguments to pass to the lambda function

      Returns Promise<{ logs: string; result: string }>

      • The API response or error
    • Get the Cognito user for a device

      Parameters

      • deviceID: number

      Returns Promise<AdminGetUserCommandOutput>

      the Cognito user

    • Get all the parameters for a lambda function

      Parameters

      • functionName: string

        The name of the lambda function to execute

      Returns Promise<{ logs: string; result: string }>

      this.executeLambda

    • Parameters

      • path: string
      • handleError: (errors: string[] | number[] | object[]) => void = ...

      Returns Promise<string>

    • Initialize the Cognito service to manage device auth

      Parameters

      • deviceID: number

      Returns Promise<
          {
              cognito: CognitoIdentityProviderClient;
              params: { Username: string; UserPoolId: string };
          },
      >

    • Parameters

      • callback: (err: object, data: object) => void

      Returns Promise<void>

    • Loads a text file from S3

      Parameters

      • path: string

        The S3 path to the file

      • handleError: (error: string | number | object) => void = ...

        The error handler

      Returns Promise<string>

      • The file contents
    • Move a file in the S3 bucket from one location to another

      Parameters

      • source: string

        the source path of the file to move

      • destination: string

        the destination path of the file to move

      Returns Promise<boolean>

      true if the file was moved, false otherwise

    • Reauthorize the device

      Parameters

      • deviceID: number

        the ID of the device to reauthorize

      Returns Promise<boolean>

      true if the device was reauthorized, false otherwise

    • Reauthorize the device key by moving it back to the device keys folder

      Parameters

      • deviceID: number

        the ID of the device to reauthorize the key for

      Returns Promise<boolean>

      true if the key was reauthorized, false otherwise

    • Revoke the device authorization

      Parameters

      • deviceID: number

        the ID of the device to revoke authorization for

      Returns Promise<boolean>

      true if the device was revoked, false otherwise

    • Revoke the device key by moving it to the revoked keys folder

      Parameters

      • deviceID: number

        the ID of the device to revoke the key for

      Returns Promise<boolean>

      true if the key was revoked, false otherwise

    • Update the details for a device in the database

      Parameters

      Returns Promise<
          {
              __typename: "Device";
              ID: number;
              ImageURL?: string;
              Name?: string;
              Password?: string;
              RadiusRA?: number;
              RadiusRB?: number;
              RadiusRC?: number;
              RadiusRD?: number;
              SerialNumber?: string;
              SpringConstant?: number;
          },
      >