Skip to content

Commit

Permalink
adding missing google connector updates
Browse files Browse the repository at this point in the history
  • Loading branch information
pellicceama committed Oct 31, 2024
1 parent 0a8899f commit a21b425
Showing 1 changed file with 64 additions and 0 deletions.
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

0 comments on commit a21b425

Please sign in to comment.