Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gemini): implement Google Gemini connector #3549

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bundle/default-bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
<groupId>io.camunda.connector</groupId>
<artifactId>connector-aws-comprehend</artifactId>
</dependency>
<dependency>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-google-gemini</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
5 changes: 5 additions & 0 deletions bundle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,11 @@
<artifactId>connector-aws-comprehend</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.camunda.connector</groupId>
<artifactId>connector-google-gemini</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,27 @@ public final class GoogleServiceSupplierUtil {
private GoogleServiceSupplierUtil() {}

public static HttpCredentialsAdapter getHttpHttpCredentialsAdapter(final Authentication auth) {
Credentials creds = null;
Credentials creds = getCredentials(auth);
if (auth.authType() == AuthenticationType.BEARER) {
AccessToken accessToken = new AccessToken(auth.bearerToken(), null);
creds = new GoogleCredentials(accessToken).createScoped(DriveScopes.DRIVE);
}

if (auth.authType() == AuthenticationType.REFRESH) {
creds =
UserCredentials.newBuilder()
.setClientId(auth.oauthClientId())
.setClientSecret(auth.oauthClientSecret())
.setRefreshToken(auth.oauthRefreshToken())
.build();
creds = ((GoogleCredentials) creds).createScoped(DriveScopes.DRIVE);
}

return new HttpCredentialsAdapter(creds);
}

public static Credentials getCredentials(Authentication auth) {
if (auth.authType() == AuthenticationType.BEARER) {
AccessToken accessToken = new AccessToken(auth.bearerToken(), null);
GoogleCredentials googleCredentials = new GoogleCredentials(accessToken);
Fixed Show fixed Hide fixed
Dismissed Show dismissed Hide dismissed
return googleCredentials;
}
return UserCredentials.newBuilder()
.setClientId(auth.oauthClientId())
.setClientSecret(auth.oauthClientSecret())
.setRefreshToken(auth.oauthRefreshToken())
.build();
}

public static NetHttpTransport getNetHttpTransport() {
try {
return GoogleNetHttpTransport.newTrustedTransport();
Expand Down
Loading
Loading