Skip to content

Commit

Permalink
259 nullability warnings to go
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Mar 24, 2024
1 parent 4664b20 commit d4be2b1
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
12 changes: 6 additions & 6 deletions src/Mollie.Api/Models/Connect/AuthorizeRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,36 +3,36 @@ public class AuthorizeRequest {
/// <summary>
/// The client ID you receive when registering your app.
/// </summary>
public string ClientId { get; set; }
public required string ClientId { get; init; }

/// <summary>
/// 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.
/// </summary>
public string RedirectUri { get; set; }
public string? RedirectUri { get; set; }

/// <summary>
/// A random string generated by your app to prevent CSRF attacks.
/// </summary>
public string State { get; set; }
public required string State { get; init; }

/// <summary>
/// A space separated list of permissions your app requires. Refer to OAuth: Permissions for more information about the
/// available scopes.
/// </summary>
public string Scope { get; set; }
public required string Scope { get; init; }

/// <summary>
/// Mollie currently only replies with code responses.
/// Possible values: code
/// </summary>
public string ResponseType { get; set; }
public required string ResponseType { get; init; }

/// <summary>
/// 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
/// </summary>
public string ApprovalPrompt { get; set; }
public string? ApprovalPrompt { get; set; }
}
}
4 changes: 2 additions & 2 deletions src/Mollie.Api/Models/Connect/RevokeTokenRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ public class RevokeTokenRequest {
/// Type of the token you want to revoke.
/// </summary>
[JsonProperty("token_type_hint")]
public string TokenTypeHint { get; set; }
public required string TokenTypeHint { get; init; }

/// <summary>
/// The token you want to revoke
/// </summary>
public string Token { get; set; }
public required string Token { get; init; }
}
}
16 changes: 8 additions & 8 deletions src/Mollie.Api/Models/Connect/TokenRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ public class TokenRequest {
/// <param name="redirectUri">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. </param>
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;
}

/// <summary>
Expand All @@ -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.
/// </summary>
public string Code { get; }
public string? Code { get; set; }

/// <summary>
/// Optional – The refresh token you've received when creating the authorization. Only use this field when using grant
/// type refresh_token.
/// </summary>
[JsonProperty("refresh_token")]
public string RefreshToken { get; }
public string? RefreshToken { get; set; }

/// <summary>
/// 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.
/// </summary>
[JsonProperty("redirect_uri")]
public string RedirectUri { get; }
public string? RedirectUri { get; set; }
}
}
10 changes: 5 additions & 5 deletions src/Mollie.Api/Models/Connect/TokenResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
/// </summary>
[JsonProperty("access_token")]
public string AccessToken { get; set; }
public required string AccessToken { get; init; }

/// <summary>
/// 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.
/// </summary>
[JsonProperty("refresh_token")]
public string RefreshToken { get; set; }
public required string RefreshToken { get; init; }

/// <summary>
/// The number of seconds left before the access token expires. Be sure to renew your access token before this reaches
/// zero.
/// </summary>
[JsonProperty("expires_in")]
public int ExpiresIn { get; set; }
public required int ExpiresIn { get; init; }

/// <summary>
/// As per OAuth standards, the provided access token can only be used with bearer authentication.
/// Possible values: bearer
/// </summary>
[JsonProperty("token_type")]
public string TokenType { get; set; }
public required string TokenType { get; init; }

/// <summary>
/// A space separated list of permissions. Please refer to OAuth: Permissions for the full permission list.
/// </summary>
public string Scope { get; set; }
public required string Scope { get; init; }
}
}

0 comments on commit d4be2b1

Please sign in to comment.