service

package
v0.0.0-...-e64b967 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const AppSource = "sync-gmail"
View Source
const GCalSource = "gcal"
View Source
const GmailSource = "gmail"

Variables

This section is empty.

Functions

This section is empty.

Types

type CalendarEventAttendee

type CalendarEventAttendee struct {

	// Id: The creator's Profile ID, if available.
	Id string `json:"id,omitempty"`

	// Email: The creator's email address, if available.
	Email string `json:"email,omitempty"`

	// DisplayName: The creator's name, if available.
	DisplayName string `json:"displayName,omitempty"`

	// Optional: Whether this is an optional attendee. Optional. The default
	// is False.
	Optional bool `json:"optional,omitempty"`

	// Organizer: Whether the attendee is the organizer of the event.
	// Read-only. The default is False.
	Organizer bool `json:"organizer,omitempty"`

	// ResponseStatus: The attendee's response status. Possible values are:
	//
	// - "needsAction" - The attendee has not responded to the invitation
	// (recommended for new events).
	// - "declined" - The attendee has declined the invitation.
	// - "tentative" - The attendee has tentatively accepted the invitation.
	//
	// - "accepted" - The attendee has accepted the invitation.  Warning: If
	// you add an event using the values declined, tentative, or accepted,
	// attendees with the "Add invitations to my calendar" setting set to
	// "When I respond to invitation in email" won't see an event on their
	// calendar unless they choose to change their invitation response in
	// the event invitation email.
	ResponseStatus string `json:"responseStatus,omitempty"`
}

type CalendarEventDateTime

type CalendarEventDateTime struct {
	// Date: The date, in the format "yyyy-mm-dd", if this is an all-day
	// event.
	Date string `json:"date,omitempty"`

	// DateTime: The time, as a combined date-time value (formatted
	// according to RFC3339). A time zone offset is required unless a time
	// zone is explicitly specified in timeZone.
	DateTime string `json:"dateTime,omitempty"`

	// TimeZone: The time zone in which the time is specified. (Formatted as
	// an IANA Time Zone Database name, e.g. "Europe/Zurich".) For recurring
	// events this field is required and specifies the time zone in which
	// the recurrence is expanded. For single events this field is optional
	// and indicates a custom time zone for the event start/end.
	TimeZone string `json:"timeZone,omitempty"`
}

type CalendarEventRawData

type CalendarEventRawData struct {
	// Attendees: The attendees of the event. See the Events with attendees
	// guide for more information on scheduling events with other calendar
	// users. Service accounts need to use domain-wide delegation of
	// authority to populate the attendee list.
	Attendees []*CalendarEventAttendee `json:"attendees,omitempty"`

	// Created: Creation time of the event (as a RFC3339 timestamp).
	// Read-only.
	Created string `json:"created,omitempty"`

	// Creator: The creator of the event. Read-only.
	Creator *CalendarEventAttendee `json:"creator,omitempty"`

	// Organizer: The organizer of the event. If the organizer is also an
	// attendee, this is indicated with a separate entry in attendees with
	// the organizer field set to True. To change the organizer, use the
	// move operation. Read-only, except when importing an event.
	Organizer *CalendarEventAttendee `json:"organizer,omitempty"`

	// EventType: Specific type of the event. Read-only. Possible values
	// are:
	// - "default" - A regular event or not further specified.
	// - "outOfOffice" - An out-of-office event.
	// - "focusTime" - A focus-time event.
	// - "workingLocation" - A working location event. Developer Preview.
	EventType string `json:"eventType,omitempty"`

	// Description: Description of the event. Can contain HTML. Optional.
	Description string `json:"description,omitempty"`

	// OriginalStartTime: For an instance of a recurring event, this is the
	// time at which this event would start according to the recurrence data
	// in the recurring event identified by recurringEventId. It uniquely
	// identifies the instance within the recurring event series even if the
	// instance was moved to a different time. Immutable.
	OriginalStartTime *CalendarEventDateTime `json:"originalStartTime,omitempty"`

	// Start: The (inclusive) start time of the event. For a recurring
	// event, this is the start time of the first instance.
	Start *CalendarEventDateTime `json:"start,omitempty"`

	// End: The (exclusive) end time of the event. For a recurring event,
	// this is the end time of the first instance.
	End *CalendarEventDateTime `json:"end,omitempty"`

	// HangoutLink: An absolute link to the Google Hangout associated with
	// this event. Read-only.
	HangoutLink string `json:"hangoutLink,omitempty"`

	// HtmlLink: An absolute link to this event in the Google Calendar Web
	// UI. Read-only.
	HtmlLink string `json:"htmlLink,omitempty"`

	// ICalUID: Event unique identifier as defined in RFC5545. It is used to
	// uniquely identify events accross calendaring systems and must be
	// supplied when importing events via the import method.
	// Note that the iCalUID and the id are not identical and only one of
	// them should be supplied at event creation time. One difference in
	// their semantics is that in recurring events, all occurrences of one
	// event have different ids while they all share the same iCalUIDs. To
	// retrieve an event using its iCalUID, call the events.list method
	// using the iCalUID parameter. To retrieve an event using its id, call
	// the events.get method.
	ICalUID string `json:"iCalUID,omitempty"`

	// Id: Opaque identifier of the event. When creating new single or
	// recurring events, you can specify their IDs. Provided IDs must follow
	// these rules:
	// - characters allowed in the ID are those used in base32hex encoding,
	// i.e. lowercase letters a-v and digits 0-9, see section 3.1.2 in
	// RFC2938
	// - the length of the ID must be between 5 and 1024 characters
	// - the ID must be unique per calendar  Due to the globally distributed
	// nature of the system, we cannot guarantee that ID collisions will be
	// detected at event creation time. To minimize the risk of collisions
	// we recommend using an established UUID algorithm such as one
	// described in RFC4122.
	// If you do not specify an ID, it will be automatically generated by
	// the server.
	// Note that the icalUID and the id are not identical and only one of
	// them should be supplied at event creation time. One difference in
	// their semantics is that in recurring events, all occurrences of one
	// event have different ids while they all share the same icalUIDs.
	Id string `json:"id,omitempty"`

	// Location: Geographic location of the event as free-form text.
	// Optional.
	Location string `json:"location,omitempty"`

	// Recurrence: List of RRULE, EXRULE, RDATE and EXDATE lines for a
	// recurring event, as specified in RFC5545. Note that DTSTART and DTEND
	// lines are not allowed in this field; event start and end times are
	// specified in the start and end fields. This field is omitted for
	// single events or instances of recurring events.
	Recurrence []string `json:"recurrence,omitempty"`

	// RecurringEventId: For an instance of a recurring event, this is the
	// id of the recurring event to which this instance belongs. Immutable.
	RecurringEventId string `json:"recurringEventId,omitempty"`

	// Status: Status of the event. Optional. Possible values are:
	// - "confirmed" - The event is confirmed. This is the default status.
	//
	// - "tentative" - The event is tentatively confirmed.
	// - "cancelled" - The event is cancelled (deleted). The list method
	// returns cancelled events only on incremental sync (when syncToken or
	// updatedMin are specified) or if the showDeleted flag is set to true.
	// The get method always returns them.
	// A cancelled status represents two different states depending on the
	// event type:
	// - Cancelled exceptions of an uncancelled recurring event indicate
	// that this instance should no longer be presented to the user. Clients
	// should store these events for the lifetime of the parent recurring
	// event.
	// Cancelled exceptions are only guaranteed to have values for the id,
	// recurringEventId and originalStartTime fields populated. The other
	// fields might be empty.
	// - All other cancelled events represent deleted events. Clients should
	// remove their locally synced copies. Such cancelled events will
	// eventually disappear, so do not rely on them being available
	// indefinitely.
	// Deleted events are only guaranteed to have the id field populated.
	// On the organizer's calendar, cancelled events continue to expose
	// event details (summary, location, etc.) so that they can be restored
	// (undeleted). Similarly, the events to which the user was invited and
	// that they manually removed continue to provide details. However,
	// incremental sync requests with showDeleted set to false will not
	// return these details.
	// If an event changes its organizer (for example via the move
	// operation) and the original organizer is not on the attendee list, it
	// will leave behind a cancelled event where only the id field is
	// guaranteed to be populated.
	Status string `json:"status,omitempty"`

	// Summary: Title of the event.
	Summary string `json:"summary,omitempty"`

	// Transparency: Whether the event blocks time on the calendar.
	// Optional. Possible values are:
	// - "opaque" - Default value. The event does block time on the
	// calendar. This is equivalent to setting Show me as to Busy in the
	// Calendar UI.
	// - "transparent" - The event does not block time on the calendar. This
	// is equivalent to setting Show me as to Available in the Calendar UI.
	Transparency string `json:"transparency,omitempty"`

	// Updated: Last modification time of the event (as a RFC3339
	// timestamp). Read-only.
	Updated string `json:"updated,omitempty"`

	// Visibility: Visibility of the event. Optional. Possible values are:
	//
	// - "default" - Uses the default visibility for events on the calendar.
	// This is the default value.
	// - "public" - The event is public and event details are visible to all
	// readers of the calendar.
	// - "private" - The event is private and only event attendees may view
	// event details.
	// - "confidential" - The event is private. This value is provided for
	// compatibility reasons.
	Visibility string `json:"visibility,omitempty"`
}

type EmailChannelData

type EmailChannelData struct {
	Subject   string   `json:"Subject"`
	InReplyTo []string `json:"InReplyTo"`
	Reference []string `json:"Reference"`
}

type EmailRawData

type EmailRawData struct {
	ProviderMessageId string            `json:"ProviderMessageId"`
	MessageId         string            `json:"MessageId"`
	Sent              string            `json:"Sent"`
	Subject           string            `json:"Subject"`
	From              string            `json:"From"`
	To                string            `json:"To"`
	Cc                string            `json:"Cc"`
	Bcc               string            `json:"Bcc"`
	Html              string            `json:"Html"`
	Text              string            `json:"Text"`
	ThreadId          string            `json:"ThreadId"`
	InReplyTo         string            `json:"InReplyTo"`
	Reference         string            `json:"Reference"`
	Headers           map[string]string `json:"Headers"`
}

type EmailService

type EmailService interface {
	FindEmailForUser(tenant, userId string) (*entity.EmailEntity, error)

	SyncEmailsForUser(externalSystemId, tenant string, userSource string, personalEmailProviderList []postgresEntity.PersonalEmailProvider, organizationAllowedForImport []postgresEntity.WhitelistDomain)

	SyncEmailByEmailRawId(externalSystemId, tenant string, emailId uuid.UUID) (entity.RawState, *string, error)
	SyncEmailByMessageId(externalSystemId, tenant, usernameSource, messageId string) (entity.RawState, *string, error)
}

func NewEmailService

func NewEmailService(cfg *config.Config, repositories *repository.Repositories, services *Services) EmailService

type MeetingService

type MeetingService interface {
	SyncCalendarEvents(externalSystemId, tenant string, personalEmailProviderList []postgresEntity.PersonalEmailProvider, organizationAllowedForImport []postgresEntity.WhitelistDomain)
}

func NewMeetingService

func NewMeetingService(cfg *config.Config, repositories *repository.Repositories, services *Services) MeetingService

type OpenAiService

type OpenAiService interface {
	AskForOrganizationNameByDomain(tenant, elementId, domain string) (string, error)
}

func NewOpenAiService

func NewOpenAiService(cfg *config.Config, repositories *repository.Repositories) OpenAiService

type Services

type Services struct {
	Repositories *repository.Repositories

	TenantService TenantService
	UserService   UserService
	OpenAiService OpenAiService

	SyncService    SyncService
	EmailService   EmailService
	MeetingService MeetingService
	// contains filtered or unexported fields
}

func InitServices

func InitServices(cfg *config.Config, driver *neo4j.DriverWithContext, gormDb *gorm.DB, grpcClients *grpc_client.Clients) *Services

type SyncService

type SyncService interface {
	GetWhitelistedDomain(domain string, whitelistedDomains []postgresEntity.WhitelistDomain) *postgresEntity.WhitelistDomain
	GetEmailIdForEmail(ctx context.Context, tx neo4j.ManagedTransaction, tenant string, interactionEventId, email string, whitelistDomain *postgresEntity.WhitelistDomain, personalEmailProviderList []postgresEntity.PersonalEmailProvider, now time.Time, source string) (string, error)

	BuildEmailsListExcludingPersonalEmails(personalEmailProviderList []postgresEntity.PersonalEmailProvider, usernameSource, from string, to []string, cc []string, bcc []string) ([]string, error)

	ConvertToUTC(datetimeStr string) (time.Time, error)
	IsValidEmailSyntax(email string) bool
}

func NewSyncService

func NewSyncService(cfg *config.Config, repositories *repository.Repositories, services *Services) SyncService

type TenantService

type TenantService interface {
	GetAllTenants(ctx context.Context) ([]*entity.TenantEntity, error)
}

func NewTenantService

func NewTenantService(repository *repository.Repositories) TenantService

type UserService

type UserService interface {
	GetAllUsersForTenant(ctx context.Context, tenant string) ([]*entity.UserEntity, error)
}

func NewUserService

func NewUserService(repository *repository.Repositories) UserService

Jump to

Keyboard shortcuts

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