tgstation-server 6.12.3
The /tg/station 13 server suite
Loading...
Searching...
No Matches
Public Member Functions | Properties | Private Attributes | List of all members
Tgstation.Server.Client.RestServerClient Class Referencesealed

More...

Inheritance diagram for Tgstation.Server.Client.RestServerClient:
Inheritance graph
[legend]
Collaboration diagram for Tgstation.Server.Client.RestServerClient:
Collaboration graph
[legend]

Public Member Functions

 RestServerClient (IApiClient apiClient)
 Initializes a new instance of the RestServerClient class.
 
ValueTask DisposeAsync ()
 
ValueTask< ServerInformationResponseServerInformation (CancellationToken cancellationToken)
 The ServerInformationResponse of the IRestServerClient.
Parameters
cancellationTokenThe CancellationToken for the operation.
Returns
A Task<TResult> resulting in the ServerInformationResponse of the target server.

 
void AddRequestLogger (IRequestLogger requestLogger)
 Adds a requestLogger to the request pipeline.
Parameters
requestLoggerThe IRequestLogger to add.

 
ValueTask< IAsyncDisposableSubscribeToJobUpdates (IJobsHub jobsReceiver, IRetryPolicy? retryPolicy, Action< ILoggingBuilder >? loggingConfigureAction, CancellationToken cancellationToken)
 Subscribe to all job updates available to the IRestServerClient.
Parameters
jobsReceiverThe IJobsHub to use to subscribe to updates.
retryPolicyThe optional IRetryPolicy to use for the backing connection. The default retry policy waits for 1, 2, 4, 8, and 16 seconds, then 30s repeatedly.
loggingConfigureActionThe optional Action<T1> used to configure a ILoggingBuilder.
cancellationTokenThe CancellationToken for the operation.
Returns
An IAsyncDisposable representing the lifetime of the subscription.

 

Properties

Uri Url [get]
 The connected server's root Uri.
 
TokenResponse Token [get, set]
 The Token used to access the server.
 
TimeSpan Timeout [get, set]
 The connection timeout.
 
IInstanceManagerClient Instances [get]
 Access the IInstanceManagerClient.
 
IAdministrationClient Administration [get]
 Access the IAdministrationClient.
 
IUsersClient Users [get]
 Access the IUsersClient.
 
IUserGroupsClient Groups [get]
 Access the IUserGroupsClient.
 
ITransferClient Transfer [get]
 Access the ITransferClient.Most client methods handle transfers in their invocations. There is rarely any reason to use the ITransferClient directly.
 
- Properties inherited from Tgstation.Server.Client.IRestServerClient

Private Attributes

readonly IApiClient apiClient
 The IApiClient for the RestServerClient.
 

Detailed Description

Definition at line 15 of file RestServerClient.cs.

Constructor & Destructor Documentation

◆ RestServerClient()

Tgstation.Server.Client.RestServerClient.RestServerClient ( IApiClient  apiClient)

Initializes a new instance of the RestServerClient class.

Parameters
apiClientThe value of apiClient.

Definition at line 58 of file RestServerClient.cs.

59 {
60 this.apiClient = apiClient ?? throw new ArgumentNullException(nameof(apiClient));
61
62 Instances = new InstanceManagerClient(apiClient);
63 Users = new UsersClient(apiClient);
64 Administration = new AdministrationClient(apiClient);
65 Groups = new UserGroupsClient(apiClient);
66 }
IUsersClient Users
Access the IUsersClient.
IAdministrationClient Administration
Access the IAdministrationClient.
IInstanceManagerClient Instances
Access the IInstanceManagerClient.
readonly IApiClient apiClient
The IApiClient for the RestServerClient.
IUserGroupsClient Groups
Access the IUserGroupsClient.

References Tgstation.Server.Client.RestServerClient.Administration, Tgstation.Server.Client.RestServerClient.apiClient, Tgstation.Server.Client.RestServerClient.Groups, Tgstation.Server.Client.RestServerClient.Instances, and Tgstation.Server.Client.RestServerClient.Users.

Member Function Documentation

◆ AddRequestLogger()

void Tgstation.Server.Client.RestServerClient.AddRequestLogger ( IRequestLogger  requestLogger)

Adds a requestLogger to the request pipeline.

Parameters
requestLoggerThe IRequestLogger to add.

Implements Tgstation.Server.Client.IRestServerClient.

◆ DisposeAsync()

ValueTask Tgstation.Server.Client.RestServerClient.DisposeAsync ( )

◆ ServerInformation()

ValueTask< ServerInformationResponse > Tgstation.Server.Client.RestServerClient.ServerInformation ( CancellationToken  cancellationToken)

The ServerInformationResponse of the IRestServerClient.

Parameters
cancellationTokenThe CancellationToken for the operation.
Returns
A Task<TResult> resulting in the ServerInformationResponse of the target server.

Implements Tgstation.Server.Client.IRestServerClient.

◆ SubscribeToJobUpdates()

ValueTask< IAsyncDisposable > Tgstation.Server.Client.RestServerClient.SubscribeToJobUpdates ( IJobsHub  jobsReceiver,
IRetryPolicy retryPolicy,
Action< ILoggingBuilder >?  loggingConfigureAction,
CancellationToken  cancellationToken 
)

Subscribe to all job updates available to the IRestServerClient.

Parameters
jobsReceiverThe IJobsHub to use to subscribe to updates.
retryPolicyThe optional IRetryPolicy to use for the backing connection. The default retry policy waits for 1, 2, 4, 8, and 16 seconds, then 30s repeatedly.
loggingConfigureActionThe optional Action<T1> used to configure a ILoggingBuilder.
cancellationTokenThe CancellationToken for the operation.
Returns
An IAsyncDisposable representing the lifetime of the subscription.

Implements Tgstation.Server.Client.IRestServerClient.

Member Data Documentation

◆ apiClient

readonly IApiClient Tgstation.Server.Client.RestServerClient.apiClient
private

The IApiClient for the RestServerClient.

Definition at line 52 of file RestServerClient.cs.

Referenced by Tgstation.Server.Client.RestServerClient.RestServerClient().

Property Documentation

◆ Administration

IAdministrationClient Tgstation.Server.Client.RestServerClient.Administration
get

◆ Groups

IUserGroupsClient Tgstation.Server.Client.RestServerClient.Groups
get

◆ Instances

IInstanceManagerClient Tgstation.Server.Client.RestServerClient.Instances
get

◆ Timeout

TimeSpan Tgstation.Server.Client.RestServerClient.Timeout
getset

The connection timeout.

Implements Tgstation.Server.Client.IRestServerClient.

Definition at line 28 of file RestServerClient.cs.

29 {
30 get => apiClient.Timeout;
31 set => apiClient.Timeout = value;
32 }
TimeSpan Timeout
The request timeout.
Definition IApiClient.cs:31

◆ Token

TokenResponse Tgstation.Server.Client.RestServerClient.Token
getset

The Token used to access the server.

Implements Tgstation.Server.Client.IRestServerClient.

Definition at line 21 of file RestServerClient.cs.

22 {
23 get => apiClient.Headers.Token ?? throw new InvalidOperationException("apiClient.Headers.Token was null!");
24 set => apiClient.Headers = new ApiHeaders(apiClient.Headers.UserAgent!, value);
25 }
Represents the header that must be present for every server request.
Definition ApiHeaders.cs:25
ProductHeaderValue? UserAgent
The client's user agent as a ProductHeaderValue if valid.
Definition ApiHeaders.cs:89
ApiHeaders Headers
The ApiHeaders the IApiClient uses.
Definition IApiClient.cs:21

◆ Transfer

ITransferClient Tgstation.Server.Client.RestServerClient.Transfer
get

Access the ITransferClient.Most client methods handle transfers in their invocations. There is rarely any reason to use the ITransferClient directly.

Implements Tgstation.Server.Client.IRestServerClient.

Definition at line 47 of file RestServerClient.cs.

◆ Url

Uri Tgstation.Server.Client.RestServerClient.Url
get

The connected server's root Uri.

Implements Tgstation.Server.Client.IRestServerClient.

Definition at line 18 of file RestServerClient.cs.

◆ Users

IUsersClient Tgstation.Server.Client.RestServerClient.Users
get

The documentation for this class was generated from the following file: