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

adding missing google connector updates #33

Merged
merged 1 commit into from
Oct 31, 2024
Merged
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
64 changes: 64 additions & 0 deletions connectors/connector-google/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,70 @@ export const googleServer = {
// params: {query: input.query},
// body: JSON.stringify(input.body),
// }),
// eslint-disable-next-line @typescript-eslint/require-await
async preConnect(_, context) {
// This returns auth options for Nango connect because it is an oauth integration
// this behavior is not type checked though and could use some improvement
// May be fixed if we turn nango into a connector
if (context.integrationExternalId === 'drive') {
return {
authorization_params: {
scope: 'https://www.googleapis.com/auth/drive',
},
}
}
if (context.integrationExternalId === 'calendar') {
return {
authorization_params: {
scope: 'https://www.googleapis.com/auth/calendar',
},
}
}
if (context.integrationExternalId === 'gmail') {
return {
authorization_params: {
scope: 'https://www.googleapis.com/auth/gmail.readonly',
// • https://www.googleapis.com/auth/gmail.send (Send only)
// TODO: How do we determine more specific scopes here?
},
}
}
return {}
},
// eslint-disable-next-line @typescript-eslint/require-await
async listIntegrations() {
return {
has_next_page: false,
items: [
{
id: 'drive',
name: 'Google Drive',
// TODO: Differ oauth scope use in Connect based on which integration
raw_data: {} as any,
verticals: ['file-storage'],
updated_at: new Date().toISOString(),
logo_url: '/_assets/logo-google-drive.svg',
},
{
id: 'gmail',
name: 'Gmail',
raw_data: {} as any,
verticals: ['email'],
updated_at: new Date().toISOString(),
logo_url: '/_assets/logo-google-gmail.svg',
},
{
id: 'calendar',
name: 'Google Calendar',
raw_data: {} as any,
verticals: ['calendar'],
updated_at: new Date().toISOString(),
logo_url: '/_assets/logo-google-calendar.svg',
},
],
next_cursor: null,
}
},
} satisfies ConnectorServer<typeof googleSchemas>

export default googleServer
Loading