Class CreateApiTokenRequest
Request to create a new API token.
public sealed record CreateApiTokenRequest : IValidatable, IEquatable<CreateApiTokenRequest>
- Inheritance
-
CreateApiTokenRequest
- Implements
Properties
ExpiresAt
Gets or sets the optional token expiration.
[JsonPropertyName("expires_at")]
[JsonPropertyOrder(2)]
public ApiTokenExpiration? ExpiresAt { get; set; }
Property Value
- ApiTokenExpiration
Optional token expiration as an ISO 8601 date-time.
Omit for the server default (a 1-year default is being rolled out).
Use Never for a token that never expires.
Past or more-than-5-years-ahead values are rejected with 422.
Name
Gets or sets the API token display name.
[JsonPropertyName("name")]
[JsonPropertyOrder(1)]
[JsonRequired]
public string Name { get; set; }
Property Value
- string
API token display name.
Resources
Gets the resource accesses to grant to the API token.
[JsonPropertyName("resources")]
[JsonPropertyOrder(3)]
[JsonObjectCreationHandling(JsonObjectCreationHandling.Populate)]
public IList<ApiTokenAccessRequest> Resources { get; }
Property Value
- IList<ApiTokenAccessRequest>
Collection of resource accesses.
Methods
Validate()
Validates the current instance.
public ValidationResult Validate()
Returns
- ValidationResult
Object containing validation errors, if any.