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

Move all Gmail API calls into gmail utils folder #272

Open
elie222 opened this issue Dec 19, 2024 · 0 comments
Open

Move all Gmail API calls into gmail utils folder #272

elie222 opened this issue Dec 19, 2024 · 0 comments
Labels
outlook Microsoft Outlook support

Comments

@elie222
Copy link
Owner

elie222 commented Dec 19, 2024

Move all Gmail API calls into gmail utils folder

Currently some Gmail API calls are scattered throughout the app. All Gmail API interactions should live in apps/web/utils/gmail/.

Search the project for .gmail. and you'll see all the places we're calling the Gmail API outside of the apps/web/utils/gmail/ folder.

Unifying this into the gmail folder, will make it easier to add Outlook integration.

Examples

Good (already in gmail folder):

// apps/web/utils/gmail/message.ts
export async function getMessage(
  messageId: string,
  gmail: gmail_v1.Gmail,
  format?: "full" | "metadata",
): Promise<MessageWithPayload>

Need to fix (currently outside gmail folder):

// Found in app code
const response = await gmail.users.messages.list({
  userId: "me",
  labelIds: type === "OTHER" ? undefined : [type],
  maxResults: 5,
  q: getQuery(type),
  pageToken,
});

Tasks

  1. Find all direct Gmail API calls outside the gmail folder
  2. Create corresponding functions in gmail folder
  3. Replace direct API calls with these functions
  4. Remove any unused direct Gmail imports

Done when

  • All Gmail API calls happen through functions in apps/web/utils/gmail/
  • No direct Gmail API usage outside this folder
@elie222 elie222 added the outlook Microsoft Outlook support label Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
outlook Microsoft Outlook support
Projects
None yet
Development

No branches or pull requests

1 participant