Documentation ¶
Index ¶
- Variables
- func NewContactSearchService(contactSearch ContactSearch, unifiedRepo repository.IUnified) *contactSearchService
- func NewContactService(userRepo repository.IUser, defaultSourceContactRepo repository.IContact, ...) *contactService
- func NewNoteService(noteRepo repository.INote) *noteService
- func NewTagService(tagRepo repository.ITag) *tagService
- func NewUserService(userRepo repository.IUser) *userService
- type ContactSearch
- type ContactSearchService
- type ContactService
- type ContactSourceDeletedPublisher
- type ContactSourceService
- func (s *ContactSourceService) DeleteContactSource(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID, ...) (err error)
- func (s *ContactSourceService) GetAllContactSources(ctx context.Context, userId domain.UserID) (sources []*models.ContactSource, err error)
- func (s *ContactSourceService) GetContactSources(ctx context.Context, userId domain.UserID, limit int, ...) (sources []*models.ContactSource, err error)
- func (s *ContactSourceService) GetGoogleRedirectUrl(ctx context.Context) (url string, err error)
- func (s *ContactSourceService) LinkGoogleContactSource(ctx context.Context, userId domain.UserID, role *domain.Role, code string) (err error)
- func (s *ContactSourceService) OnDeleteContactSource(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID, ...) (err error)
- func (s *ContactSourceService) PullContacts(ctx context.Context) (err error)
- func (s *ContactSourceService) SyncContacts(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID) (err error)
- type CsvImporter
- type GoogleOAuthService
- type IContactSource
- type IContactSourceProvider
- type IContactSourcePuller
- type IContactSourceReader
- type ICsvImporter
- type ILinkSuggestionService
- type IUnifiedContactService
- type IUnifiedSyncer
- type LinkSuggestionService
- func (s *LinkSuggestionService) AddToExistingSuggestion(ctx context.Context, userId domain.UserID, match domain.LinkMatch, ...) (addedToExisting bool, err error)
- func (a *LinkSuggestionService) ApplyLinkSuggestion(ctx context.Context, uID domain.UserID, suggestionId domain.LinkSuggestionID, ...) (err error)
- func (s *LinkSuggestionService) CheckAndAddToLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified) (added bool, err error)
- func (s *LinkSuggestionService) CheckAndCreateLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified) (added bool, err error)
- func (s *LinkSuggestionService) CreateLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified, ...) (created *domain.LinkSuggestion, err error)
- func (a *LinkSuggestionService) GetLinkSuggestions(ctx context.Context, uID domain.UserID, limit int, ...) ([]*models.LinkSuggestion, error)
- type NoteService
- type PeopleService
- type PeopleServiceFactory
- type PullContactPublisher
- type TagService
- type UnifiedContactService
- func (a *UnifiedContactService) GetContacts(ctx context.Context, uID domain.UserID, limit int, ...) ([]*models.Unified, error)
- func (a *UnifiedContactService) GetPendingContacts(ctx context.Context, uID domain.UserID, limit int, ...) (pending []*models.Unified, err error)
- func (a *UnifiedContactService) GetRecentContacts(ctx context.Context, uID domain.UserID, maxDays *int64, limit int, ...) (pending []*models.Unified, err error)
- func (s *UnifiedContactService) SyncContactToUnified(ctx context.Context, userId domain.UserID, source domain.Source, ...) (createdUnified *domain.Unified, err error)
- type UserService
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrPullCompleted = errors.New("pull completed")
View Source
var ErrSourceReadCompleted = errors.New("source read completed")
Functions ¶
func NewContactSearchService ¶
func NewContactSearchService(contactSearch ContactSearch, unifiedRepo repository.IUnified) *contactSearchService
func NewContactService ¶
func NewContactService( userRepo repository.IUser, defaultSourceContactRepo repository.IContact, unifiedRepo repository.IUnified, unifiedContactSyncer IUnifiedSyncer, contactSourceProvider IContactSourceProvider, ) *contactService
func NewNoteService ¶
func NewNoteService(noteRepo repository.INote) *noteService
func NewTagService ¶
func NewTagService(tagRepo repository.ITag) *tagService
func NewUserService ¶
func NewUserService(userRepo repository.IUser) *userService
Types ¶
type ContactSearch ¶
type ContactSearch interface {
Search(userId domain.UserID, searchParams domain.SearchParams) (docs []domain.UnifiedSearch, err error)
}
type ContactSearchService ¶
type ContactService ¶
type ContactService interface { SaveContact(context.Context, domain.UserID, *models.CreateContactDto) (updated *models.Unified, err error) UpdateContact(context.Context, domain.UserID, domain.UnifiedId, *models.UpdateUnifiedDto) (*models.Unified, error) UpdateCategory(ctx context.Context, userId domain.UserID, role *domain.Role, unifiedId domain.UnifiedId, category domain.ContactCatgeory) (*models.Unified, error) GetContacts(ctx context.Context, id domain.UserID, limit int, lastDocumentId *domain.ContactID) ([]*models.Contact, error) GetContactByID(context.Context, domain.UserID, domain.UnifiedId) (*models.Unified, error) DeleteContact(context.Context, domain.UserID, domain.UnifiedId) error }
type ContactSourceDeletedPublisher ¶
type ContactSourceDeletedPublisher interface {
Publish(ctx context.Context, job jobModels.ContactSourceDeleted) (err error)
}
type ContactSourceService ¶
type ContactSourceService struct {
// contains filtered or unexported fields
}
func NewContactSourceService ¶
func NewContactSourceService( googleOAuthService GoogleOAuthService, contactSourceRepo repository.IContactSource, pullContactSourcePublisher PullContactPublisher, unifiedContactSyncer IUnifiedSyncer, userRepo repository.IUser, contactSourceProvider IContactSourceProvider, unifiedRepo repository.IUnified, contactSourceDeletedPublisher ContactSourceDeletedPublisher, ) *ContactSourceService
func (*ContactSourceService) DeleteContactSource ¶
func (s *ContactSourceService) DeleteContactSource(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID, removeContactsFromUnified bool) (err error)
func (*ContactSourceService) GetAllContactSources ¶
func (s *ContactSourceService) GetAllContactSources(ctx context.Context, userId domain.UserID) (sources []*models.ContactSource, err error)
func (*ContactSourceService) GetContactSources ¶
func (s *ContactSourceService) GetContactSources(ctx context.Context, userId domain.UserID, limit int, lastDocumentId *domain.ContactSourceID) (sources []*models.ContactSource, err error)
func (*ContactSourceService) GetGoogleRedirectUrl ¶
func (s *ContactSourceService) GetGoogleRedirectUrl(ctx context.Context) (url string, err error)
func (*ContactSourceService) LinkGoogleContactSource ¶
func (*ContactSourceService) OnDeleteContactSource ¶
func (*ContactSourceService) PullContacts ¶
func (s *ContactSourceService) PullContacts(ctx context.Context) (err error)
func (*ContactSourceService) SyncContacts ¶
func (s *ContactSourceService) SyncContacts(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID) (err error)
type CsvImporter ¶
type CsvImporter struct {
// contains filtered or unexported fields
}
func NewCsvImporter ¶
func NewCsvImporter(defaultContactsRepo *firestore.DefaultContactsFirestore, unifiedContactSyncer IUnifiedSyncer) *CsvImporter
type GoogleOAuthService ¶
type GoogleOAuthService interface { GetRedirectUrl(ctx context.Context) (url string, err error) GetToken(ctx context.Context, code string) (token *oauth2.Token, err error) GetUserInfo(ctx context.Context, accessToken string) (info *googleOAuth2.Tokeninfo, err error) GetConfig() (config *oauth2.Config) }
type IContactSource ¶
type IContactSource interface { Update(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID, contactId domain.ContactID, unified domain.Unified) (err error) // puller return a new contacts puller. Puller(ctx context.Context, userId domain.UserID, source domain.ContactSource) (puller IContactSourcePuller) // reader returns a reader instance to read all documents stored in the database (and not from the remote. ie google, outlook etc) for a source. Reader(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID) IContactSourceReader // Remove() will remove contacts from database (and not from the remote, ie google, outlook etc). This is invoked when a contact source is removed. Remove(ctx context.Context, userId domain.UserID, sourceId domain.ContactSourceID, contactIds []domain.ContactID) (err error) }
type IContactSourceProvider ¶
type IContactSourceProvider interface {
Get(source domain.Source) IContactSource
}
type IContactSourcePuller ¶
type IContactSourcePuller interface {
Pull(ctx context.Context) (newContacts []domain.Contact, updatedContacts []domain.Contact, deletedContacts []domain.Contact, err error)
}
puller returns contacts from a source. Contacts are converted to domain.Contact. Pull should be called continuosly until it returns err == ErrPullCompleted (which is the normal termination) or some other error.
type IContactSourceReader ¶
type IContactSourceReader interface {
Read(ctx context.Context) (contacts []domain.Contact, err error)
}
reader returns contacts stored for a source from the database. Contacts are converted to domain.Contact. Read should be called continuosly until it returns err == ErrSourceReadCompleted (which is the normal termination) or some other error.
type ICsvImporter ¶
type ILinkSuggestionService ¶
type ILinkSuggestionService interface { // check for existing link suggestion and append to matches CheckAndAddToLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified) (added bool, err error) // create new link suggestions if any CheckAndCreateLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified) (added bool, err error) GetLinkSuggestions(ctx context.Context, uID domain.UserID, limit int, lastDocumentId *domain.LinkSuggestionID) ([]*models.LinkSuggestion, error) ApplyLinkSuggestion(ctx context.Context, uID domain.UserID, suggestionId domain.LinkSuggestionID, request []domain.UnifiedId) (err error) }
type IUnifiedContactService ¶
type IUnifiedContactService interface { GetContacts(ctx context.Context, id domain.UserID, limit int, lastDocumentId *domain.UnifiedId) ([]*models.Unified, error) GetPendingContacts(ctx context.Context, id domain.UserID, limit int, lastDocumentInstant *time.Time, lastDocumentId *domain.UnifiedId) ([]*models.Unified, error) GetRecentContacts(ctx context.Context, uid domain.UserID, maxDays *int64, limit int, lastDocumentInstant *time.Time, lastDocumentId *domain.UnifiedId) ([]*models.Unified, error) }
type IUnifiedSyncer ¶
type LinkSuggestionService ¶
type LinkSuggestionService struct {
// contains filtered or unexported fields
}
func NewLinkSuggestionService ¶
func NewLinkSuggestionService(unifiedRepo repository.IUnified, linkSuggestionRepo repository.ILinkSuggestion) *LinkSuggestionService
func (*LinkSuggestionService) AddToExistingSuggestion ¶
func (s *LinkSuggestionService) AddToExistingSuggestion(ctx context.Context, userId domain.UserID, match domain.LinkMatch, key domain.LinkSuggestionKey, value string) (addedToExisting bool, err error)
AddToExistingSuggestion checks if suggestion already exists for a key-value pair key could be email, phone or name
func (*LinkSuggestionService) ApplyLinkSuggestion ¶
func (a *LinkSuggestionService) ApplyLinkSuggestion(ctx context.Context, uID domain.UserID, suggestionId domain.LinkSuggestionID, ids []domain.UnifiedId) (err error)
func (*LinkSuggestionService) CheckAndAddToLinkSuggestion ¶
func (*LinkSuggestionService) CheckAndCreateLinkSuggestion ¶
func (s *LinkSuggestionService) CheckAndCreateLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified) (added bool, err error)
Check for possible duplicates in unified collection and create suggestions if any
func (*LinkSuggestionService) CreateLinkSuggestion ¶
func (s *LinkSuggestionService) CreateLinkSuggestion(ctx context.Context, userId domain.UserID, unified domain.Unified, matches []domain.Unified, key domain.LinkSuggestionKey, value string) (created *domain.LinkSuggestion, err error)
func (*LinkSuggestionService) GetLinkSuggestions ¶
func (a *LinkSuggestionService) GetLinkSuggestions(ctx context.Context, uID domain.UserID, limit int, lastDocumentId *domain.LinkSuggestionID) ([]*models.LinkSuggestion, error)
type NoteService ¶
type NoteService interface { SaveNote(context.Context, domain.UserID, domain.UnifiedId, *models.Note) (updated *models.Note, err error) UpdateNote(context.Context, domain.UserID, domain.UnifiedId, domain.NoteID, *models.Note) (*models.Note, error) GetAllNotes(context.Context, domain.UserID, domain.UnifiedId) ([]*models.Note, error) GetNotes(ctx context.Context, userID domain.UserID, contactId domain.UnifiedId, limit int, lastDocumentId *domain.NoteID) ([]*models.Note, error) DeleteNote(context.Context, domain.UserID, domain.UnifiedId, domain.NoteID) error }
type PeopleService ¶
type PeopleServiceFactory ¶
type PullContactPublisher ¶
type PullContactPublisher interface {
Publish(ctx context.Context, job jobModels.PullContactsRequest) (err error)
}
type TagService ¶
type TagService interface { SaveTag(context.Context, domain.UserID, domain.UnifiedId, *models.Tag) (updated *models.Tag, err error) UpdateTag(context.Context, domain.UserID, domain.UnifiedId, domain.TagID, *models.Tag) (*models.Tag, error) GetAllTags(context.Context, domain.UserID, domain.UnifiedId) ([]*models.Tag, error) GetTags(ctx context.Context, userId domain.UserID, contactId domain.UnifiedId, limit int, lastDocumentId *domain.TagID) ([]*models.Tag, error) DeleteTag(context.Context, domain.UserID, domain.UnifiedId, domain.TagID) error }
type UnifiedContactService ¶
type UnifiedContactService struct {
// contains filtered or unexported fields
}
func NewUnifiedContactService ¶
func NewUnifiedContactService(unifiedRepo repository.IUnified, linkSuggestionService ILinkSuggestionService, contactLogRepo repository.IContactLog) *UnifiedContactService
func (*UnifiedContactService) GetContacts ¶
func (*UnifiedContactService) GetPendingContacts ¶
func (*UnifiedContactService) GetRecentContacts ¶
type UserService ¶
Click to show internal directories.
Click to hide internal directories.