Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

Overview

Properties

There are two types of timers covered by these libraries: wall clock timers and set interval timersThe Tsplice Client properties include the following:

Expand
titleHttpClient
Code Block
public System.Net.Http.HttpClient HttpClient { get; set; }

Gets or sets the HTTP client object used for communications with the host system. By default this is initialized to a shared HttpClient instance, but can be set to an alternate instance of an HttpClient object if necessary (e.g. for automated tests).

Expand
titleBaseUri
Code Block
public System.Uri BaseUri { get; set; }

Gets or setsthe uniform resource identifier of the Tsplice host e.g. https://host.name.com/Path.

Expand
titleJsonOptions
Code Block
public System.Test.Json.JsonSerializerOptions JsonOptions { get; set; }

Gets or sets the Json serialization options used by the Tsplice client.

Expand
titleDownloadFolder
Code Block
public System.String DownloadFolder { get; set; }

Gets or sets the root download folder used by functions that retrieve files from the host i.e. when a local path is not specified in the function call. If a download folder is not explicitly set then a temporary folder will be created during the first function call that requires one, and this folder will be deleted when the application exits.

Methods

The Tsplice Client methods are grouped below by function.

...

The following functions can be used to authenticate and authorize a user via the Tsplice API

Expand
titleAuthenticate a user on the host
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Authenticate the current client-side Windows user on the host.
/// </summary>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>Authorization token data</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<AuthToken>>
               Authenticate(CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Authenticate user credentials on the host.
/// </summary>
/// <param name="username">User name</param>
/// <param name="password">User password</param>
/// <param name="domain">User domain</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>Authorization token data</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<AuthToken>>
               Authenticate(string username, string password,
                            string domain,
                            CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Authenticate user credentials on the host.
/// </summary>
/// <param name="credentials">User credentials</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>Authorization token data</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<AuthToken>>
               Authenticate(Credentials credentials,
                            CancellationToken cancelToken = default)
Expand
titleAuthorize a user in a Tsecurity app
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Authorize the current client-side Windows user for a specific
/// application.
/// </summary>
/// <param name="appName">Tsecurity application name</param>
/// <param name="cancelToken"></param>
/// <returns>Authorization token data</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<AuthToken>>
               Authorize(string appName, 
                         CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Authorize a user for a specific application.
/// </summary>
/// <param name="appName">Tsecurity application name</param>
/// <param name="username">User name</param>
/// <param name="password">User password</param>
/// <param name="domain">User domain</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>Authorization token data</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<AuthToken>>
               Authorize(string appName, string username,
                         string password, string domain,
                         CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Authorize a user for a specific application.
/// </summary>
/// <param name="appName">Tsecurity application name</param>
/// <param name="credentials">User credentials</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>Authorization token data</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<AuthToken>>
               Authorize(string appName, Credentials credentials,
                         CancellationToken cancelToken = default)
Expand
titleGet the available domains on the host
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Get the list of available domains on the host
/// </summary>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>
/// ApiResponse object containing the list of domains
/// </returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<List<Domain>>> GetDomains(
                           CancellationToken cancelToken = default)

System Status

The This following function can be used to get retrieves the current status of the Tsplice host system., including:

  • Host computer name

  • Host computer domain

  • Current date/time on the host computer

Expand
titleGet host system status
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Get the Tsentry system status information
/// </summary>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>Response object</returns>
///-----------------------------------------------------------------
public async Task<JsonResponse<SystemStatus>> GetSystemStatus(
            CancellationToken cancelToken = default)

...

The following functions can be used to interact with shared folders and files on the Tsplice host system. The list of folders and files exposed by the Tsplice host are defined in the sysTsplice.ini file.

Expand
titleRead a file from the host
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Download a list of files from a shared folder
/// </summary>
/// <param name="sharePath">Application name</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>
/// ApiResponse object containing the list of application files
/// </returns>
///-----------------------------------------------------------------
public async Task<ApiResponse<List<FileSystemEntry>>>
         GetSharedFileList(string sharePath,
                           CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Download a shared file into the specified location
/// </summary>
/// <param name="sharePath">Shared folder path</param>
/// <param name="localPath">
/// Target file path on local system, or null to use the default
/// download location
/// </param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>FileResponse object</returns>
///-----------------------------------------------------------------
public async Task<FileResponse> GetSharedFile(
                     string sharePath, string localPath = null,
                     CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Download files matching a filter from a shared folder into
/// the specified folder
/// </summary>
/// <param name="sharePath">Shared folder path</param>
/// <param name="search">
/// Search string, or null to match all files
/// </param>
/// <param name="localRoot">
/// Root folder for local files, or null to use the default
/// download folder
/// </param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>FileResponse object</returns>
///-----------------------------------------------------------------
public async Task<List<FileResponse>> GetSharedFiles(
                  string sharePath, string search = null,
                  string localRoot = null,
                  CancellationToken cancelToken = default)
Expand
titleWrite a file to the host
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Upload a shared file
/// </summary>
/// <param name="sharePath">Shared folder path</param>
/// <param name="localPath">Target file path on local system</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>ApiResponse object</returns>
///-----------------------------------------------------------------
public async Task<ApiResponse> PutSharedFile(
                     string sharePath, string localPath,
                     CancellationToken cancelToken = default)
Expand
titleCopy, move, or delete a file on the host
Code Block
///-----------------------------------------------------------------
/// <summary>
/// Copy a shared file from one location on the host to another
/// location on the host
/// </summary>
/// <param name="srcSharePath">Source shared file path</param>
/// <param name="dstSharePath">Destination shared file path</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>ApiResponse object</returns>
///-----------------------------------------------------------------
public async Task<ApiResponse> CopySharedFile(
                     string srcSharePath, string dstSharePath,
                     CancellationToken cancelToken = default)

///-----------------------------------------------------------------
/// <summary>
/// Rename or move a shared file on the host
/// </summary>
/// <param name="srcSharePath">Source shared file path</param>
/// <param name="dstSharePath">Destination shared file path</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>ApiResponse object</returns>
///-----------------------------------------------------------------
public async Task<ApiResponse> MoveSharedFile(
                     string srcSharePath, string dstSharePath,
                     CancellationToken cancelToken = default)

...