You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
« Previous
Version 2
Next »
Timer
Overview
The Tsplice .NET API can be used in a client application to interact with a Tsplice host. This API consists of the following:
TPRI.Tsplice.Client - This class can be used to send a request to the Tsplice host and parse its response
TPRI.Tsplice.Models - The classes in this namespace represent the different types of data sent to or received from the Tsplice host
ApiResponse and derived classes - These classes represent the responses returned from the Tsplice host, and typically wrap a model object containing the specific response data
TPRI.Tsplice.Client
Overview
Properties
There are two types of timers covered by these libraries: wall clock timers and set interval timers.
Methods
The Tsplice Client methods are grouped below by function.
Authentication & Authorization
The following functions can be used to authenticate and authorize a user via the Tsplice API
Authenticate user
///-----------------------------------------------------------------
/// <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)
Authorize user
///-----------------------------------------------------------------
/// <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)
Domains
///-----------------------------------------------------------------
/// <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 following function can be used to get the current status of the Tsplice host system.
Get System Status
///-----------------------------------------------------------------
/// <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)
Shared Files and Folders
The following functions can be used to interact with shared folders and files on the Tsplice host system.
Get File from Host
///-----------------------------------------------------------------
/// <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)
Put File
///-----------------------------------------------------------------
/// <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)
Copy, Move, or Delete File
///-----------------------------------------------------------------
/// <summary>
/// Copy a shared file from one location 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)
Delete File
///-----------------------------------------------------------------
/// <summary>
/// Delete a shared file from the host
/// </summary>
/// <param name="sharePath">Shared folder path</param>
/// <param name="cancelToken">Cancellation token</param>
/// <returns>FileResponse object</returns>
///-----------------------------------------------------------------
public async Task<ApiResponse> DeleteSharedFile(
string sharePath,
CancellationToken cancelToken = default)