tgstation-server 6.12.0
The /tg/station 13 server suite
Loading...
Searching...
No Matches
Mutation.cs
Go to the documentation of this file.
1using System;
2using System.Threading;
3using System.Threading.Tasks;
4
5using HotChocolate;
6using HotChocolate.Types;
7
10
12{
17 [GraphQLDescription(GraphQLDescription)]
18 public sealed class Mutation
19 {
23 public const string GraphQLDescription = "Root Mutation type";
24
31 [Error(typeof(ErrorMessageException))]
32 public ValueTask<LoginResult> Login(
33 [Service] IGraphQLAuthorityInvoker<ILoginAuthority> loginAuthority,
34 CancellationToken cancellationToken)
35 {
36 ArgumentNullException.ThrowIfNull(loginAuthority);
37
38 return loginAuthority.Invoke<LoginResult, LoginResult>(
39 authority => authority.AttemptLogin(cancellationToken));
40 }
41
48 [Error(typeof(ErrorMessageException))]
49 public ValueTask<OAuthGatewayLoginResult> OAuthGateway(
50 [Service] IGraphQLAuthorityInvoker<ILoginAuthority> loginAuthority,
51 CancellationToken cancellationToken)
52 {
53 ArgumentNullException.ThrowIfNull(loginAuthority);
54
55 return loginAuthority.Invoke<OAuthGatewayLoginResult, OAuthGatewayLoginResult>(
56 authority => authority.AttemptOAuthGatewayLogin(cancellationToken));
57 }
58 }
59}
Exception representing ErrorMessageResponses.
Root type for GraphQL mutations.
Definition Mutation.cs:19
const string GraphQLDescription
Description to show on the Mutation type.
Definition Mutation.cs:23
ValueTask< OAuthGatewayLoginResult > OAuthGateway([Service] IGraphQLAuthorityInvoker< ILoginAuthority > loginAuthority, CancellationToken cancellationToken)
Generate an OAuth user token for the requested service. This requires the OAuth authentication scheme...
Definition Mutation.cs:49
ValueTask< LoginResult > Login([Service] IGraphQLAuthorityInvoker< ILoginAuthority > loginAuthority, CancellationToken cancellationToken)
Generate a JWT for authenticating with server. This requires either the Basic authentication or OAuth...
Definition Mutation.cs:32