Skip to content

Commit

Permalink
working google sheets
Browse files Browse the repository at this point in the history
  • Loading branch information
igpetrov committed Feb 26, 2024
1 parent 5220c24 commit 73f9e95
Show file tree
Hide file tree
Showing 15 changed files with 329 additions and 240 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,36 @@
*/
package io.camunda.google.model;

import static io.camunda.connector.generator.java.annotation.TemplateProperty.PropertyType.Dropdown;

import io.camunda.connector.generator.dsl.Property.FeelMode;
import io.camunda.connector.generator.java.annotation.TemplateProperty;
import io.camunda.connector.generator.java.annotation.TemplateProperty.DropdownPropertyChoice;
import io.camunda.connector.generator.java.annotation.TemplateProperty.PropertyCondition;
import io.camunda.connector.generator.java.annotation.TemplateProperty.PropertyConstraints;
import jakarta.validation.constraints.AssertTrue;
import org.apache.commons.lang3.StringUtils;

public record Authentication(
@TemplateProperty(
id = "authType",
label = "Type",
group = "authentication",
feel = FeelMode.optional,
defaultValue = "BEARER")
type = Dropdown,
defaultValue = "BEARER",
constraints = @PropertyConstraints(notEmpty = true),
choices = {
@DropdownPropertyChoice(label = "Bearer token", value = "BEARER"),
@DropdownPropertyChoice(label = "Refresh token", value = "REFRESH")
})
AuthenticationType authType,
@TemplateProperty(
id = "bearerToken",
label = "Bearer token",
description = "Enter a valid Google API Bearer token",
group = "authentication",
feel = FeelMode.optional,
constraints = @PropertyConstraints(notEmpty = true),
condition = @PropertyCondition(property = "authentication.authType", equals = "BEARER"))
String bearerToken,
@TemplateProperty(
Expand All @@ -32,6 +44,7 @@ public record Authentication(
description = "Enter Google API Client ID",
group = "authentication",
feel = FeelMode.optional,
constraints = @PropertyConstraints(notEmpty = true),
condition =
@PropertyCondition(property = "authentication.authType", equals = "REFRESH"))
String oauthClientId,
Expand All @@ -41,6 +54,7 @@ public record Authentication(
description = "Enter Google API client Secret",
group = "authentication",
feel = FeelMode.optional,
constraints = @PropertyConstraints(notEmpty = true),
condition =
@PropertyCondition(property = "authentication.authType", equals = "REFRESH"))
String oauthClientSecret,
Expand All @@ -50,6 +64,16 @@ public record Authentication(
description = "Enter a valid Google API refresh token",
group = "authentication",
feel = FeelMode.optional,
constraints = @PropertyConstraints(notEmpty = true),
condition =
@PropertyCondition(property = "authentication.authType", equals = "REFRESH"))
String oauthRefreshToken) {}
String oauthRefreshToken) {

@AssertTrue(message = "Credentials were incorrect")
private boolean isCredentialsSupplied() {
return StringUtils.isNotBlank(bearerToken)
|| (StringUtils.isNotBlank(oauthClientId)
&& StringUtils.isNotBlank(oauthClientSecret)
&& StringUtils.isNotBlank(oauthRefreshToken));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,30 @@
"label" : "Type",
"optional" : false,
"value" : "BEARER",
"constraints" : {
"notEmpty" : true
},
"group" : "authentication",
"binding" : {
"name" : "authentication.authType",
"type" : "zeebe:input"
},
"type" : "Dropdown",
"choices" : [ {
"name" : "REFRESH",
"name" : "Refresh token",
"value" : "REFRESH"
}, {
"name" : "BEARER",
"name" : "Bearer token",
"value" : "BEARER"
} ]
}, {
"id" : "authentication.bearerToken",
"label" : "Bearer token",
"description" : "Enter a valid Google API Bearer token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -84,6 +90,9 @@
"label" : "Client ID",
"description" : "Enter Google API Client ID",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -101,6 +110,9 @@
"label" : "Client secret",
"description" : "Enter Google API client Secret",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -118,6 +130,9 @@
"label" : "Refresh token",
"description" : "Enter a valid Google API refresh token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,30 @@
"label" : "Type",
"optional" : false,
"value" : "BEARER",
"constraints" : {
"notEmpty" : true
},
"group" : "authentication",
"binding" : {
"name" : "authentication.authType",
"type" : "zeebe:input"
},
"type" : "Dropdown",
"choices" : [ {
"name" : "REFRESH",
"name" : "Refresh token",
"value" : "REFRESH"
}, {
"name" : "BEARER",
"name" : "Bearer token",
"value" : "BEARER"
} ]
}, {
"id" : "authentication.bearerToken",
"label" : "Bearer token",
"description" : "Enter a valid Google API Bearer token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -79,6 +85,9 @@
"label" : "Client ID",
"description" : "Enter Google API Client ID",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -96,6 +105,9 @@
"label" : "Client secret",
"description" : "Enter Google API client Secret",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand All @@ -113,6 +125,9 @@
"label" : "Refresh token",
"description" : "Enter a valid Google API refresh token",
"optional" : false,
"constraints" : {
"notEmpty" : true
},
"feel" : "optional",
"group" : "authentication",
"binding" : {
Expand Down
Loading

0 comments on commit 73f9e95

Please sign in to comment.