Member Junction
    Preparing search index...

    Client for file storage operations through GraphQL. This class provides an easy way to interact with file storage accounts from a client application.

    All operations use accountId (FileStorageAccount ID) as the primary identifier, supporting the enterprise model where storage accounts are organizational resources.

    // Create the client
    const storageClient = new GraphQLFileStorageClient(graphQLProvider);

    // List objects in a directory
    const objects = await storageClient.ListObjects(accountId, 'documents/');

    // Create a pre-authenticated upload URL
    const uploadResult = await storageClient.CreatePreAuthUploadUrl(
    accountId,
    'documents/report.pdf',
    'application/pdf'
    );
    Index

    Constructors

    Methods

    • Copy an object within the storage account.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • sourceName: string

        The source name/path of the object

      • destinationName: string

        The destination name/path for the copy

      Returns Promise<boolean>

      A Promise that resolves to true if the object was copied successfully

    • Copy an object between two different storage accounts.

      Parameters

      • sourceAccountId: string

        The ID of the source FileStorageAccount

      • destinationAccountId: string

        The ID of the destination FileStorageAccount

      • sourcePath: string

        The source path of the object

      • destinationPath: string

        The destination path for the copy

      Returns Promise<CopyBetweenAccountsResult>

      A Promise that resolves to the copy result

    • Create a directory in the storage account.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • path: string

        The directory path to create

      Returns Promise<boolean>

      A Promise that resolves to true if the directory was created successfully

    • Create a pre-authenticated URL for downloading a file.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • objectName: string

        The name/path of the object to download

      Returns Promise<string>

      A Promise that resolves to the download URL

      const downloadUrl = await storageClient.CreatePreAuthDownloadUrl(
      accountId,
      'documents/report.pdf'
      );

      // Use the download URL
      window.open(downloadUrl, '_blank');
    • Create a pre-authenticated URL for uploading a file.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • objectName: string

        The name/path of the object to upload

      • OptionalcontentType: string

        Optional content type for the file

      Returns Promise<CreatePreAuthUploadUrlResult>

      A Promise that resolves to the upload URL and provider key

      const result = await storageClient.CreatePreAuthUploadUrl(
      accountId,
      'documents/report.pdf',
      'application/pdf'
      );

      // Use the upload URL to upload the file
      await fetch(result.uploadUrl, {
      method: 'PUT',
      body: fileContent,
      headers: { 'Content-Type': 'application/pdf' }
      });
    • Delete an object from the storage account.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • objectName: string

        The name/path of the object to delete

      Returns Promise<boolean>

      A Promise that resolves to true if the object was deleted successfully

    • Check if a directory exists in the storage account.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • path: string

        The directory path to check

      Returns Promise<boolean>

      A Promise that resolves to true if the directory exists

    • List objects in a storage account at the specified path.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • prefix: string = ''

        The path prefix to list objects from (e.g., 'documents/')

      • Optionaldelimiter: string

        Optional delimiter for grouping results (default: '/')

      Returns Promise<StorageListResult>

      A Promise that resolves to a StorageListResult

      const result = await storageClient.ListObjects(accountId, 'documents/', '/');
      console.log('Files:', result.objects.filter(o => !o.isDirectory));
      console.log('Folders:', result.prefixes);
    • Move/rename an object within the storage account.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • oldName: string

        The current name/path of the object

      • newName: string

        The new name/path for the object

      Returns Promise<boolean>

      A Promise that resolves to true if the object was moved successfully

    • Check if an object exists in the storage account.

      Parameters

      • accountId: string

        The ID of the FileStorageAccount

      • objectName: string

        The name/path of the object to check

      Returns Promise<boolean>

      A Promise that resolves to true if the object exists

    • Search for files across one or more storage accounts.

      Parameters

      • accountIds: string[]

        Array of FileStorageAccount IDs to search

      • searchQuery: string
      • Optionaloptions: FileSearchOptions

        Optional search options

      Returns Promise<SearchAcrossAccountsResult>

      A Promise that resolves to the search results

      const results = await storageClient.SearchFiles(
      [accountId1, accountId2],
      'quarterly report',
      {
      maxResultsPerAccount: 10,
      fileTypes: ['pdf', 'docx'],
      searchContent: true
      }
      );

      for (const accountResult of results.accountResults) {
      console.log(`Results from ${accountResult.accountName}:`);
      for (const file of accountResult.results) {
      console.log(` - ${file.name} (${file.relevance})`);
      }
      }