Table of Contents

Class ApiTokenExpiration

Namespace
Mailtrap.ApiTokens.Models
Assembly
Mailtrap.Abstractions.dll

Represents an explicit API token expiration, serialized as an ISO 8601 date-time.
Leave the request property unset to omit the value and get 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.

[JsonConverter(typeof(ApiTokenExpirationJsonConverter))]
public sealed record ApiTokenExpiration : IEquatable<ApiTokenExpiration>
Inheritance
ApiTokenExpiration
Implements

Properties

Never

Gets the expiration for a token that never expires.

public static ApiTokenExpiration Never { get; }

Property Value

ApiTokenExpiration

Expiration for a token that never expires. Serialized as JSON null.

Methods

At(DateTimeOffset)

Creates an expiration at the provided date and time.

public static ApiTokenExpiration At(DateTimeOffset value)

Parameters

value DateTimeOffset

Date and time when the token expires.

Returns

ApiTokenExpiration

Expiration at the provided date and time. Serialized as an ISO 8601 date-time string.