From d4be2b16fbf450fd27d824c548970f89ca51e018 Mon Sep 17 00:00:00 2001 From: Vincent Kok Date: Sun, 24 Mar 2024 20:53:21 +0100 Subject: [PATCH] 259 nullability warnings to go --- .../Models/Connect/AuthorizeRequest.cs | 12 ++++++------ .../Models/Connect/RevokeTokenRequest.cs | 4 ++-- src/Mollie.Api/Models/Connect/TokenRequest.cs | 16 ++++++++-------- src/Mollie.Api/Models/Connect/TokenResponse.cs | 10 +++++----- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/Mollie.Api/Models/Connect/AuthorizeRequest.cs b/src/Mollie.Api/Models/Connect/AuthorizeRequest.cs index 4e937f5c..02a4a98c 100644 --- a/src/Mollie.Api/Models/Connect/AuthorizeRequest.cs +++ b/src/Mollie.Api/Models/Connect/AuthorizeRequest.cs @@ -3,36 +3,36 @@ public class AuthorizeRequest { /// /// The client ID you receive when registering your app. /// - public string ClientId { get; set; } + public required string ClientId { get; init; } /// /// Optional – The URL the merchant is sent back to once the request has been authorized. If given, it must match the /// URL you set when registering your app. /// - public string RedirectUri { get; set; } + public string? RedirectUri { get; set; } /// /// A random string generated by your app to prevent CSRF attacks. /// - public string State { get; set; } + public required string State { get; init; } /// /// A space separated list of permissions your app requires. Refer to OAuth: Permissions for more information about the /// available scopes. /// - public string Scope { get; set; } + public required string Scope { get; init; } /// /// Mollie currently only replies with code responses. /// Possible values: code /// - public string ResponseType { get; set; } + public required string ResponseType { get; init; } /// /// This parameter can be set to force, to force showing the consent screen to the merchant, even when it is not /// necessary. /// Possible values: auto force /// - public string ApprovalPrompt { get; set; } + public string? ApprovalPrompt { get; set; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/Connect/RevokeTokenRequest.cs b/src/Mollie.Api/Models/Connect/RevokeTokenRequest.cs index 5372ebf8..84f9eafe 100644 --- a/src/Mollie.Api/Models/Connect/RevokeTokenRequest.cs +++ b/src/Mollie.Api/Models/Connect/RevokeTokenRequest.cs @@ -6,11 +6,11 @@ public class RevokeTokenRequest { /// Type of the token you want to revoke. /// [JsonProperty("token_type_hint")] - public string TokenTypeHint { get; set; } + public required string TokenTypeHint { get; init; } /// /// The token you want to revoke /// - public string Token { get; set; } + public required string Token { get; init; } } } diff --git a/src/Mollie.Api/Models/Connect/TokenRequest.cs b/src/Mollie.Api/Models/Connect/TokenRequest.cs index dea8a1c0..25f2afd9 100644 --- a/src/Mollie.Api/Models/Connect/TokenRequest.cs +++ b/src/Mollie.Api/Models/Connect/TokenRequest.cs @@ -7,14 +7,14 @@ public class TokenRequest { /// The URL the merchant is sent back to once the request has been authorized. It must match the URL you set when registering your app. public TokenRequest(string code, string redirectUri) { if (code.StartsWith("refresh_")) { - this.GrantType = "refresh_token"; - this.RefreshToken = code; + GrantType = "refresh_token"; + RefreshToken = code; } else { - this.GrantType = "authorization_code"; - this.Code = code; + GrantType = "authorization_code"; + Code = code; } - this.RedirectUri = redirectUri; + RedirectUri = redirectUri; } /// @@ -29,20 +29,20 @@ public TokenRequest(string code, string redirectUri) { /// Optional – The auth code you've received when creating the authorization. Only use this field when using grant type /// authorization_code. /// - public string Code { get; } + public string? Code { get; set; } /// /// Optional – The refresh token you've received when creating the authorization. Only use this field when using grant /// type refresh_token. /// [JsonProperty("refresh_token")] - public string RefreshToken { get; } + public string? RefreshToken { get; set; } /// /// The URL the merchant is sent back to once the request has been authorized. It must match the URL you set when /// registering your app. /// [JsonProperty("redirect_uri")] - public string RedirectUri { get; } + public string? RedirectUri { get; set; } } } \ No newline at end of file diff --git a/src/Mollie.Api/Models/Connect/TokenResponse.cs b/src/Mollie.Api/Models/Connect/TokenResponse.cs index 0196e626..03ef4059 100644 --- a/src/Mollie.Api/Models/Connect/TokenResponse.cs +++ b/src/Mollie.Api/Models/Connect/TokenResponse.cs @@ -6,32 +6,32 @@ public class TokenResponse : IResponseObject { /// The access token, with which you will be able to access the Mollie API on the merchant's behalf. /// [JsonProperty("access_token")] - public string AccessToken { get; set; } + public required string AccessToken { get; init; } /// /// The refresh token, with which you will be able to retrieve new access tokens on this endpoint. Please note that the /// refresh token does not expire. /// [JsonProperty("refresh_token")] - public string RefreshToken { get; set; } + public required string RefreshToken { get; init; } /// /// The number of seconds left before the access token expires. Be sure to renew your access token before this reaches /// zero. /// [JsonProperty("expires_in")] - public int ExpiresIn { get; set; } + public required int ExpiresIn { get; init; } /// /// As per OAuth standards, the provided access token can only be used with bearer authentication. /// Possible values: bearer /// [JsonProperty("token_type")] - public string TokenType { get; set; } + public required string TokenType { get; init; } /// /// A space separated list of permissions. Please refer to OAuth: Permissions for the full permission list. /// - public string Scope { get; set; } + public required string Scope { get; init; } } } \ No newline at end of file