|
| 1 | +// |
| 2 | +// OAuthTokenResponse.swift |
| 3 | +// ATOAuthKit |
| 4 | +// |
| 5 | +// Created by Christopher Jr Riley on 2025-08-04. |
| 6 | +// |
| 7 | + |
| 8 | +import Foundation |
| 9 | + |
| 10 | +/// A structure representing a token response. |
| 11 | +public struct TokenResponse: Codable { |
| 12 | + |
| 13 | + /// The access token of the response. |
| 14 | + public let accessToken: String |
| 15 | + |
| 16 | + /// The response's token type. |
| 17 | + public let tokenType: OAuthTokenType |
| 18 | + |
| 19 | + /// The scope of the token response. Optional. |
| 20 | + public let scope: String? |
| 21 | + |
| 22 | + /// The refresh token of the response. Optional. |
| 23 | + public let refreshToken: String? |
| 24 | + |
| 25 | + /// The date and time the response expires. Optional. |
| 26 | + public let expiresIn: Date? |
| 27 | + |
| 28 | + /// The signed JSON Web Token (JWT). Optional. |
| 29 | + public let idToken: SignedJWT? |
| 30 | + |
| 31 | + /// Additional authorization details associated with the token response. Optional. |
| 32 | + public let authorizationDetails: AuthorizationDetail? |
| 33 | + |
| 34 | + enum CodingKeys: String, CodingKey { |
| 35 | + case accessToken = "access_token" |
| 36 | + case tokenType = "token_type" |
| 37 | + case scope |
| 38 | + case refreshToken = "refresh_token" |
| 39 | + case expiresIn = "expires_in" |
| 40 | + case idToken = "id_token" |
| 41 | + case authorizationDetails = "authorization_details" |
| 42 | + } |
| 43 | +} |
0 commit comments