Class Files
public sealed class Files
- Inheritance
-
Files
- Inherited Members
- Extension Methods
Constructors
Files(ApiClient)
public Files(ApiClient apiClient)
Parameters
apiClientApiClient
Methods
DeleteAsync(string, DeleteFileConfig?, CancellationToken)
public Task<DeleteFileResponse> DeleteAsync(string name, DeleteFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
namestringconfigDeleteFileConfigcancellationTokenCancellationToken
Returns
DownloadAsync(File, DownloadFileConfig?, CancellationToken)
Downloads a File object and returns it as a Stream. Caller is responsible for disposing the returned stream.
public Task<Stream> DownloadAsync(File file, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
fileFileThe File object to download.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<Stream>
A Task<TResult> that represents the asynchronous operation. The task result contains a Stream with the file data.
DownloadAsync(GeneratedVideo, DownloadFileConfig?, CancellationToken)
Downloads a GeneratedVideo object and returns it as a Stream. Caller is responsible for disposing the returned stream.
public Task<Stream> DownloadAsync(GeneratedVideo generatedVideo, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
generatedVideoGeneratedVideoThe GeneratedVideo object to download.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<Stream>
A Task<TResult> that represents the asynchronous operation. The task result contains a Stream with the file data.
DownloadAsync(Video, DownloadFileConfig?, CancellationToken)
Downloads a Video object and returns it as a Stream. Caller is responsible for disposing the returned stream.
public Task<Stream> DownloadAsync(Video video, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
videoVideoThe Video object to download.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<Stream>
A Task<TResult> that represents the asynchronous operation. The task result contains a Stream with the file data.
DownloadAsync(string, DownloadFileConfig?, CancellationToken)
Downloads a file and returns it as a Stream. Caller is responsible for disposing the returned stream.
public Task<Stream> DownloadAsync(string fileName, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
fileNamestringThe name of the file to download (e.g., "files/abc123" or "abc123").
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<Stream>
A Task<TResult> that represents the asynchronous operation. The task result contains a Stream with the file data.
DownloadToFileAsync(File, string, DownloadFileConfig?, CancellationToken)
Downloads a File object directly to a file path.
public Task DownloadToFileAsync(File file, string outputPath, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
fileFileThe File object to download.
outputPathstringThe path where the file should be saved.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
DownloadToFileAsync(GeneratedVideo, string, DownloadFileConfig?, CancellationToken)
Downloads a GeneratedVideo object directly to a file path.
public Task DownloadToFileAsync(GeneratedVideo generatedVideo, string outputPath, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
generatedVideoGeneratedVideoThe GeneratedVideo object to download.
outputPathstringThe path where the Video should be saved.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
DownloadToFileAsync(Video, string, DownloadFileConfig?, CancellationToken)
Downloads a Video object directly to a file path.
public Task DownloadToFileAsync(Video video, string outputPath, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
videoVideoThe Video object to download.
outputPathstringThe path where the Video should be saved.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
DownloadToFileAsync(string, string, DownloadFileConfig?, CancellationToken)
Downloads a file directly to a file path.
public Task DownloadToFileAsync(string fileName, string outputPath, DownloadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
fileNamestringThe name of the file to download (e.g., "files/abc123" or "abc123").
outputPathstringThe path where the file should be saved.
configDownloadFileConfigA DownloadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
GetAsync(string, GetFileConfig?, CancellationToken)
public Task<File> GetAsync(string name, GetFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
namestringconfigGetFileConfigcancellationTokenCancellationToken
Returns
ListAsync(ListFilesConfig?, CancellationToken)
public Task<Pager<File, ListFilesConfig, ListFilesResponse>> ListAsync(ListFilesConfig? config = null, CancellationToken cancellationToken = default)
Parameters
configListFilesConfigcancellationTokenCancellationToken
Returns
RegisterFilesAsync(IEnumerable<string>, GoogleCredential, RegisterFilesConfig?, CancellationToken)
Registers Google Cloud Storage files for use with the API.
public Task<RegisterFilesResponse> RegisterFilesAsync(IEnumerable<string> uris, GoogleCredential credential, RegisterFilesConfig? config = null, CancellationToken cancellationToken = default)
Parameters
urisIEnumerable<string>The list of GCS URIs to register.
credentialGoogleCredentialThe GoogleCredential to use for authorization.
configRegisterFilesConfigA RegisterFilesConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<RegisterFilesResponse>
A Task<TResult> that represents the asynchronous operation. The task result contains the RegisterFilesResponse.
UploadAsync(byte[], string?, UploadFileConfig?, CancellationToken)
Uploads a file from a byte array.
public Task<File> UploadAsync(byte[] bytes, string? fileName = null, UploadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
bytesbyte[]The file content as a byte array.
fileNamestringOptional file name to use.
configUploadFileConfigA UploadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<File>
A Task<TResult> that represents the asynchronous operation. The task result contains the uploaded File metadata.
UploadAsync(Stream, long, string?, string?, UploadFileConfig?, CancellationToken)
Uploads a file from a stream.
public Task<File> UploadAsync(Stream stream, long size, string? fileName = null, string? mimeType = null, UploadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
streamStreamThe stream containing the file data.
sizelongThe size of the file in bytes.
fileNamestringOptional file name to use.
mimeTypestringOptional MIME type. If not provided, defaults to application/octet-stream.
configUploadFileConfigA UploadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<File>
A Task<TResult> that represents the asynchronous operation. The task result contains the uploaded File metadata.
UploadAsync(string, UploadFileConfig?, CancellationToken)
Uploads a file from a file path.
public Task<File> UploadAsync(string filePath, UploadFileConfig? config = null, CancellationToken cancellationToken = default)
Parameters
filePathstringThe path to the file to upload.
configUploadFileConfigA UploadFileConfig instance that specifies the optional configurations.
cancellationTokenCancellationTokenA CancellationToken to cancel the operation.
Returns
- Task<File>
A Task<TResult> that represents the asynchronous operation. The task result contains the uploaded File metadata.