Documentation

FilesApi

Import

Import

  • const { FilesApi } = require("@unity-services/cloud-save-1.4");

Constructors

Constructor

  • Parameters

    • Optional configuration: Configuration
    • basePath: string = ...
    • axios: AxiosInstance = ...

    Returns FilesApi

Methods

Delete File

  • deleteFile(projectId: string, playerId: string, key: string, writeLock?: string, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<void, any>>
  • Deletes the specified player file. If a WriteLock is provided, the file will only be deleted if it matches the stored WriteLock.

    summary

    Delete Player File

    throws

    {RequiredError}

    memberof

    FilesApi

    Parameters

    • projectId: string

      ID of the project.

    • playerId: string

      The player ID supplied by the Authorization service.

    • key: string

      Item key.

    • Optional writeLock: string
    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<void, any>>

Get Download Url

  • getDownloadUrl(projectId: string, playerId: string, key: string, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<SignedUrlResponse, any>>
  • Generates a signed URL that will allow the client to download the requested player file for a limited period of time. If successful, an object will be returned containing all necessary information to perform the download.

    summary

    Get Player File Download URL

    throws

    {RequiredError}

    memberof

    FilesApi

    Parameters

    • projectId: string

      ID of the project.

    • playerId: string

      The player ID supplied by the Authorization service.

    • key: string

      Item key.

    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<SignedUrlResponse, any>>

Get File Metadata

  • getFileMetadata(projectId: string, playerId: string, key: string, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<FileItem, any>>
  • Retrieves the metadata (size, date last modified and created, key, content type, and current WriteLock) of a single player file.

    summary

    Get Player File Metadata

    throws

    {RequiredError}

    memberof

    FilesApi

    Parameters

    • projectId: string

      ID of the project.

    • playerId: string

      The player ID supplied by the Authorization service.

    • key: string

      Item key.

    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<FileItem, any>>

Get Upload Url

  • getUploadUrl(projectId: string, playerId: string, key: string, fileDetails?: FileDetails, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<SignedUrlResponse, any>>
  • Initiates the player file upload process and returns a URL to which the actual file contents can be uploaded. The type, length and MD5 hash of the file have to be provided up-front. If successful, an object will be returned containing all necessary information to perform the upload.

    summary

    Get Player File upload URL

    throws

    {RequiredError}

    memberof

    FilesApi

    Parameters

    • projectId: string

      ID of the project.

    • playerId: string

      The player ID supplied by the Authorization service.

    • key: string

      Item key.

    • Optional fileDetails: FileDetails
    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<SignedUrlResponse, any>>

List Player Files

  • listPlayerFiles(projectId: string, playerId: string, after?: string, options?: AxiosRequestConfig<any>): Promise<AxiosResponse<FileList, any>>
  • Retrieves a list of names of all the files currently saved in storage for a player along with size (in bytes), last date modified and current WriteLock. Ordered alphabetically in page sizes of 20.

    summary

    List Player Files

    throws

    {RequiredError}

    memberof

    FilesApi

    Parameters

    • projectId: string

      ID of the project.

    • playerId: string

      The player ID supplied by the Authorization service.

    • Optional after: string
    • Optional options: AxiosRequestConfig<any>

    Returns Promise<AxiosResponse<FileList, any>>