Skip to content

Commit 965c03e

Browse files
algolia-botsbelloneFluf22
committed
feat(specs): Ingestion API: new code property in oauth authentication (generated)
algolia/api-clients-automation#5897 Co-authored-by: algolia-bot <accounts+algolia-api-client-bot@algolia.com> Co-authored-by: Sylvain Bellone <sylvain.bellone@algolia.com> Co-authored-by: Thomas Raffray <Fluf22@users.noreply.github.com>
1 parent 8c54c88 commit 965c03e

File tree

3 files changed

+45
-5
lines changed

3 files changed

+45
-5
lines changed

algoliasearch/src/main/java/com/algolia/model/ingestion/AuthInput.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Deserializer extends JsonDeserializer<AuthInput> {
5252
public AuthInput deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException {
5353
JsonNode tree = jp.readValueAsTree();
5454
// deserialize AuthOAuth
55-
if (tree.isObject() && tree.has("url") && tree.has("client_id") && tree.has("client_secret")) {
55+
if (tree.isObject() && tree.has("url") && tree.has("client_id") && tree.has("client_secret") && tree.has("code")) {
5656
try (JsonParser parser = tree.traverse(jp.getCodec())) {
5757
return parser.readValueAs(AuthOAuth.class);
5858
} catch (Exception e) {

algoliasearch/src/main/java/com/algolia/model/ingestion/AuthOAuth.java

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public class AuthOAuth implements AuthInput {
2020
@JsonProperty("client_secret")
2121
private String clientSecret;
2222

23+
@JsonProperty("code")
24+
private String code;
25+
2326
@JsonProperty("scope")
2427
private String scope;
2528

@@ -40,7 +43,7 @@ public AuthOAuth setClientId(String clientId) {
4043
}
4144

4245
/** Client ID. */
43-
@javax.annotation.Nonnull
46+
@javax.annotation.Nullable
4447
public String getClientId() {
4548
return clientId;
4649
}
@@ -51,11 +54,26 @@ public AuthOAuth setClientSecret(String clientSecret) {
5154
}
5255

5356
/** Client secret. This field is `null` in the API response. */
54-
@javax.annotation.Nonnull
57+
@javax.annotation.Nullable
5558
public String getClientSecret() {
5659
return clientSecret;
5760
}
5861

62+
public AuthOAuth setCode(String code) {
63+
this.code = code;
64+
return this;
65+
}
66+
67+
/**
68+
* Authorization code. Used during an `authorization_code` grant type flow, to request an
69+
* access_token when creating/updating the authentication. This field is not returned in the API
70+
* response.
71+
*/
72+
@javax.annotation.Nullable
73+
public String getCode() {
74+
return code;
75+
}
76+
5977
public AuthOAuth setScope(String scope) {
6078
this.scope = scope;
6179
return this;
@@ -80,13 +98,14 @@ public boolean equals(Object o) {
8098
Objects.equals(this.url, authOAuth.url) &&
8199
Objects.equals(this.clientId, authOAuth.clientId) &&
82100
Objects.equals(this.clientSecret, authOAuth.clientSecret) &&
101+
Objects.equals(this.code, authOAuth.code) &&
83102
Objects.equals(this.scope, authOAuth.scope)
84103
);
85104
}
86105

87106
@Override
88107
public int hashCode() {
89-
return Objects.hash(url, clientId, clientSecret, scope);
108+
return Objects.hash(url, clientId, clientSecret, code, scope);
90109
}
91110

92111
@Override
@@ -96,6 +115,7 @@ public String toString() {
96115
sb.append(" url: ").append(toIndentedString(url)).append("\n");
97116
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
98117
sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n");
118+
sb.append(" code: ").append(toIndentedString(code)).append("\n");
99119
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
100120
sb.append("}");
101121
return sb.toString();

algoliasearch/src/main/java/com/algolia/model/ingestion/AuthOAuthPartial.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ public class AuthOAuthPartial implements AuthInputPartial {
2020
@JsonProperty("client_secret")
2121
private String clientSecret;
2222

23+
@JsonProperty("code")
24+
private String code;
25+
2326
@JsonProperty("scope")
2427
private String scope;
2528

@@ -56,6 +59,21 @@ public String getClientSecret() {
5659
return clientSecret;
5760
}
5861

62+
public AuthOAuthPartial setCode(String code) {
63+
this.code = code;
64+
return this;
65+
}
66+
67+
/**
68+
* Authorization code. Used during an `authorization_code` grant type flow, to request an
69+
* access_token when creating/updating the authentication. This field is not returned in the API
70+
* response.
71+
*/
72+
@javax.annotation.Nullable
73+
public String getCode() {
74+
return code;
75+
}
76+
5977
public AuthOAuthPartial setScope(String scope) {
6078
this.scope = scope;
6179
return this;
@@ -80,13 +98,14 @@ public boolean equals(Object o) {
8098
Objects.equals(this.url, authOAuthPartial.url) &&
8199
Objects.equals(this.clientId, authOAuthPartial.clientId) &&
82100
Objects.equals(this.clientSecret, authOAuthPartial.clientSecret) &&
101+
Objects.equals(this.code, authOAuthPartial.code) &&
83102
Objects.equals(this.scope, authOAuthPartial.scope)
84103
);
85104
}
86105

87106
@Override
88107
public int hashCode() {
89-
return Objects.hash(url, clientId, clientSecret, scope);
108+
return Objects.hash(url, clientId, clientSecret, code, scope);
90109
}
91110

92111
@Override
@@ -96,6 +115,7 @@ public String toString() {
96115
sb.append(" url: ").append(toIndentedString(url)).append("\n");
97116
sb.append(" clientId: ").append(toIndentedString(clientId)).append("\n");
98117
sb.append(" clientSecret: ").append(toIndentedString(clientSecret)).append("\n");
118+
sb.append(" code: ").append(toIndentedString(code)).append("\n");
99119
sb.append(" scope: ").append(toIndentedString(scope)).append("\n");
100120
sb.append("}");
101121
return sb.toString();

0 commit comments

Comments
 (0)