Forge
csharp3407750f
1using System.Text.Json.Serialization;
2
3namespace AgentForge.Contracts;
4
5public sealed record BeginDeviceLoginRequest(string? ClientName = null, string? Scopes = null);
6
7public sealed record DeviceAuthorizationResponse(
8 string DeviceCode,
9 string UserCode,
10 int ExpiresIn,
11 int Interval);
12
13public sealed record PollDeviceTokenRequest(string DeviceCode);
14
15public sealed record DeviceTokenPollResponse(
16 string? AccessToken,
17 string? TokenType,
18 string? Error,
19 string? TokenName)
20{
21 public static DeviceTokenPollResponse Pending() =>
22 new(null, null, "authorization_pending", null);
23
24 public static DeviceTokenPollResponse Success(string token, string tokenName) =>
25 new(token, "Bearer", null, tokenName);
26
27 public static DeviceTokenPollResponse Expired() =>
28 new(null, null, "expired_token", null);
29
30 public static DeviceTokenPollResponse Denied() =>
31 new(null, null, "access_denied", null);
32
33 public static DeviceTokenPollResponse NotFound() =>
34 new(null, null, "invalid_grant", null);
35}
36
37public sealed record ApproveDeviceLoginRequest(string UserCode);
38
39public sealed record DeviceApprovalResponse(string TokenName, string Scopes);
40
41public sealed record ForgeAuthProviderItem(string Id, string DisplayName);
42
43public sealed record OAuthTokenExchangeRequest(
44 [property: JsonPropertyName("grant_type")] string GrantType,
45 [property: JsonPropertyName("code")] string? Code,
46 [property: JsonPropertyName("state")] string? State,
47 [property: JsonPropertyName("code_verifier")] string? CodeVerifier,
48 [property: JsonPropertyName("redirect_uri")] string? RedirectUri);
49
50public sealed record OAuthTokenIssueResponse(
51 string AccessToken,
52 string TokenName,
53 string Scopes);
54
View only · write via MCP/CIDE