cloudfunctions

package module
v0.0.0-...-628cd94 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

README

Candidate Email Sync

candidate_email_sync is an HTTP triggered cloud function for syncing a user's inbox to a start and end date. It is used to do an initial one-time historic sync for new users and future syncs if a user's account is inactive for over a week.

candidate_email_sync blindly syncs emails to the inputted start date, which makes it convenient for manual DevOps tasks that require re-syncing a user's inbox.

SelfDoc

Auto-generated code documentation to make the repository easier to navigate and contribute to.

Last Updated: 2023-05-15

The recruiter_email_sync directory is for a cloud function that syncs a user's inbox to a start and end date. It includes files for linting configuration, a README, the CloudFunction struct definition, functions for syncing emails and handling errors, and functions for fetching and skipping threads. It also includes files for module dependencies and their versions.

Files
.golangci.yml

This file contains the configuration for GolangCI, a linter for Go code. It specifies a list of issue texts to exclude from linting, with an example exclusion provided.

cloudfunction.go

This file defines a CloudFunction struct and contains functions for syncing emails between Gmail and Pub/Sub, publishing email messages to a Pub/Sub topic, and handling errors. It also initializes Sentry for error tracking and sets up error handling for reading and unmarshalling the request body.

email.go

This file contains two functions: fetchThreadsSinceDate and skipThread. fetchThreadsSinceDate fetches all threads since a given start date, ignoring threads of only sent emails and threads already processed by SRC. skipThread checks if a thread has already been labeled with a given label.

email_test.go

This file contains a test function for the skipThread function in the email.go file. It tests three scenarios: when the thread should not be skipped, when the thread is sent from the user, and when the thread is already synced. The test uses the Google Gmail API and runs through a series of tests to ensure the skipThread function works as expected.

go.mod

This file lists the module dependencies and their version numbers for the recruiter_email_sync cloud function.

go.sum

This file (go.sum) contains a list of all the dependencies and their versions used in the cloudfunctions/recruiter_email_sync directory, along with their cryptographic checksums to ensure their integrity.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudFunction

type CloudFunction struct {
	// contains filtered or unexported fields
}

func NewCloudFunction

func NewCloudFunction(ctx context.Context, payload EmailSyncRequest) (*CloudFunction, error)

func (*CloudFunction) PublishMessages

func (cf *CloudFunction) PublishMessages(messages []*gmail.Message) (*pubsub.PublishResult, error)

func (*CloudFunction) Sync

func (cf *CloudFunction) Sync() error

type EmailSyncRequest

type EmailSyncRequest struct {
	Email string `json:"email"`
	// StartDate is the date to start syncing from (inclusive)
	StartDate time.Time `json:"start_date"`
	// EndDate is optional
	// if not provided, it will default to the current time
	EndDate  time.Time                    `json:"end_date"`
	Settings schema.EmailMessagesSettings `json:"settings"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL