Table of Contents

Class OpenBiApiClientServerFileExtensions

Namespace
BiExcellence.OpenBi.Api.Files
Assembly
BiExcellence.OpenBi.Api.Client.dll

Extension methods for the /files REST API (raw server filesystem operations against named content-root areas).

public static class OpenBiApiClientServerFileExtensions
Inheritance
object
OpenBiApiClientServerFileExtensions

Methods

CopyServerFolderContentAsync(IOpenBiApiClient, CopyServerFolderRequest, CancellationToken)

Recursively copies a server folder's content within one area (POST files/copy). The source is left alone - MoveServerFileAsync(IOpenBiApiClient, MoveServerFileRequest, CancellationToken) moves instead.

public static Task CopyServerFolderContentAsync(this IOpenBiApiClient client, CopyServerFolderRequest request, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
request CopyServerFolderRequest
cancellationToken CancellationToken

Returns

Task

CreateServerFolderAsync(IOpenBiApiClient, CreateServerFolderRequest, CancellationToken)

Creates a folder under a content-root area.

public static Task CreateServerFolderAsync(this IOpenBiApiClient client, CreateServerFolderRequest request, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
request CreateServerFolderRequest
cancellationToken CancellationToken

Returns

Task

DeleteServerFileAsync(IOpenBiApiClient, string, string, string?, CancellationToken)

Deletes a server file or, recursively, a server folder (DELETE files). Not recoverable - the file areas keep no history. A path that does not exist is not an error.

public static Task DeleteServerFileAsync(this IOpenBiApiClient client, string area, string filename, string? parent = null, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
area string
filename string
parent string
cancellationToken CancellationToken

Returns

Task

GetMimeObjectsAsync(IOpenBiApiClient, CancellationToken)

Lists every file under the MIMES area - where the CMS content item stores its uploads - recursively, with paths relative to that area's root. Content is not included.

public static Task<OpenBiListResult<MimeObject>> GetMimeObjectsAsync(this IOpenBiApiClient client, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
cancellationToken CancellationToken

Returns

Task<OpenBiListResult<MimeObject>>

GetServerFilesAsync(IOpenBiApiClient, string?, CancellationToken)

Lists the files (not the folders) directly under the FLATFILES and STATIC areas, or under the folder parent in each of them, with their content - so it transfers every file in full. A flat-file dataprovider reads what is stored in FLATFILES.

public static Task<OpenBiListResult<ServerFile>> GetServerFilesAsync(this IOpenBiApiClient client, string? parent = null, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
parent string
cancellationToken CancellationToken

Returns

Task<OpenBiListResult<ServerFile>>

MoveServerFileAsync(IOpenBiApiClient, MoveServerFileRequest, CancellationToken)

Moves (renames) a server file or folder within one area (POST files/move). Fails with 404 when the source does not exist.

public static Task MoveServerFileAsync(this IOpenBiApiClient client, MoveServerFileRequest request, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
request MoveServerFileRequest
cancellationToken CancellationToken

Returns

Task

SaveServerFileAsync(IOpenBiApiClient, SaveServerFileRequest, CancellationToken)

Saves (creates or overwrites) a server file from a base64 body (POST files), creating the folder when it does not exist. Returns the saved file, whose FileName is the path the server stored it under. Fails with 400 when the content is not valid base64 or the file cannot be written. For anything large use UploadServerFileAsync(IOpenBiApiClient, Stream, string, string?, string?, CancellationToken).

public static Task<ServerFile?> SaveServerFileAsync(this IOpenBiApiClient client, SaveServerFileRequest request, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient
request SaveServerFileRequest
cancellationToken CancellationToken

Returns

Task<ServerFile>

UploadServerFileAsync(IOpenBiApiClient, Stream, string, string?, string?, CancellationToken)

Uploads a server file as multipart/form-data, streaming it rather than buffering it as base64 - the REST equivalent of the legacy /uploadrolecontentelement endpoint, and the one to use for anything large. Returns the saved file, whose FileName is the path the server stored it under. Fails with 400 when the file's extension (or media type) is not in the server's CONTENT_FILE_TYPES setting, where one is configured.

public static Task<ServerFile?> UploadServerFileAsync(this IOpenBiApiClient client, Stream stream, string fileName, string? area = null, string? parent = null, CancellationToken cancellationToken = default)

Parameters

client IOpenBiApiClient

The client.

stream Stream

The file contents. The caller keeps ownership.

fileName string

The file name to store it under.

area string

The top level folder name; defaults to FLATFILES server-side.

parent string

The second level folder name.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<ServerFile>