service

package
v0.0.0-...-a5768bf Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommonStoreService

func NewCommonStoreService() *commonStoreService

Types

type CommonStoreService

type CommonStoreService interface {
	ConvertMSTypeToEntityType(channel msProto.MessageType) entity.EventType
	ConvertEntityTypeToMSType(eventType entity.EventType) msProto.MessageType

	ConvertMSSubtypeToEntitySubtype(channel msProto.MessageSubtype) entity.EventSubtype
	ConvertEntitySubtypeToMSSubtype(eventType entity.EventSubtype) msProto.MessageSubtype

	ConvertMSSenderTypeToEntitySenderType(direction msProto.SenderType) entity.SenderType
	ConvertEntitySenderTypeToMSSenderType(direction entity.SenderType) msProto.SenderType

	ConvertEntityDirectionToMSDirection(direction entity.Direction) msProto.MessageDirection
	ConvertMSDirectionToEntityDirection(direction msProto.MessageDirection) entity.Direction

	EncodeConversationToMS(conversation Conversation) *msProto.FeedItem
	EncodeMessageIdToMS(conversation Conversation) *msProto.MessageId
	EncodeConversationEventToMS(conversationEvent entity.ConversationEvent) *msProto.Message
}

type Contact

type Contact struct {
	FirstName    string              `json:"firstName"`
	LastName     string              `json:"lastName"`
	Id           string              `json:"id"`
	Emails       []emailObject       `json:"emails"`
	PhoneNumbers []phoneNumberObject `json:"phoneNumbers"`
}

type Conversation

type Conversation struct {
	Id        string
	StartedAt time.Time
	UpdatedAt time.Time
	Channel   string
	Status    string

	InitiatorFirstName  string
	InitiatorLastName   string
	InitiatorUsername   string
	InitiatorType       string
	LastSenderId        string
	LastSenderType      string
	LastSenderFirstName string
	LastSenderLastName  string
	LastContentPreview  string
}

type CustomerOSService

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

func NewCustomerOSService

func NewCustomerOSService(driver *neo4j.DriverWithContext, graphqlClient *graphql.Client, postgresRepositories *repository.PostgresRepositories, commonStoreService *commonStoreService, config *config.Config) *CustomerOSService

func (*CustomerOSService) ConversationByIdExists

func (s *CustomerOSService) ConversationByIdExists(ctx context.Context, tenant string, conversationId string) (bool, error)

func (*CustomerOSService) CreateContactWithEmail

func (s *CustomerOSService) CreateContactWithEmail(ctx context.Context, tenant string, email string) (*Contact, error)

func (*CustomerOSService) CreateContactWithPhone

func (s *CustomerOSService) CreateContactWithPhone(ctx context.Context, tenant string, phoneNumber string) (*Contact, error)

func (*CustomerOSService) CreateConversation

func (s *CustomerOSService) CreateConversation(ctx context.Context, tenant string, initiator Participant, initiatorUsername string, channel entity.EventType, threadId string) (*Conversation, error)

func (*CustomerOSService) GetActiveConversationOrCreate

func (s *CustomerOSService) GetActiveConversationOrCreate(
	ctx context.Context,
	tenant string,
	initiator Participant,
	initiatorUsername *msProto.ParticipantId,
	eventType entity.EventType,
	threadId string,
) (*Conversation, error)

func (*CustomerOSService) GetContactByEmail

func (s *CustomerOSService) GetContactByEmail(ctx context.Context, email string, tenant string) (*Contact, error)

func (*CustomerOSService) GetContactById

func (s *CustomerOSService) GetContactById(ctx context.Context, id string, tenant string) (*Contact, error)

func (*CustomerOSService) GetContactByPhone

func (s *CustomerOSService) GetContactByPhone(ctx context.Context, phoneNumber string, tenant string) (*Contact, error)

func (*CustomerOSService) GetContactWithEmailOrCreate

func (s *CustomerOSService) GetContactWithEmailOrCreate(ctx context.Context, tenant string, email string) (Contact, error)

func (*CustomerOSService) GetContactWithPhoneOrCreate

func (s *CustomerOSService) GetContactWithPhoneOrCreate(ctx context.Context, tenant string, phoneNumber string) (Contact, error)

func (*CustomerOSService) GetConversationById

func (s *CustomerOSService) GetConversationById(ctx context.Context, tenant string, conversationId string) (*Conversation, error)

func (*CustomerOSService) GetConversationParticipants

func (s *CustomerOSService) GetConversationParticipants(ctx context.Context, tenant string, conversationId string) ([]string, error)

func (*CustomerOSService) GetConversationParticipantsIds

func (s *CustomerOSService) GetConversationParticipantsIds(ctx context.Context, tenant string, conversationId string) ([]Participant, error)

func (*CustomerOSService) GetConversationWithContactInitiator

func (s *CustomerOSService) GetConversationWithContactInitiator(ctx context.Context, tenant string, contactId string, eventType entity.EventType) (*Conversation, error)

func (*CustomerOSService) GetConversationWithThreadId

func (s *CustomerOSService) GetConversationWithThreadId(ctx context.Context, tenant string, eventType entity.EventType, threadId string) (*Conversation, error)

func (*CustomerOSService) GetConversationWithUserInitiator

func (s *CustomerOSService) GetConversationWithUserInitiator(ctx context.Context, tenant string, userId string, eventType entity.EventType) (*Conversation, error)

func (*CustomerOSService) GetConversations

func (s *CustomerOSService) GetConversations(ctx context.Context, tenant string, onlyContacts bool) ([]Conversation, error)

func (*CustomerOSService) GetUserByEmail

func (s *CustomerOSService) GetUserByEmail(ctx context.Context, email string, tenant string) (*User, error)

func (*CustomerOSService) UpdateConversation

func (s *CustomerOSService) UpdateConversation(ctx context.Context, tenant string, conversationId string, lastSenderId string, lastSenderType string, contactIds []string, userIds []string, lastContentPreview string) (string, error)

type CustomerOSServiceInterface

type CustomerOSServiceInterface interface {
	ContactByPhoneExists(e164 string) (bool, error)

	GetUserByEmail(email string) (*User, error)
	GetContactById(id string) (*Contact, error)
	GetContactByEmail(email string) (*Contact, error)
	GetContactByPhone(phoneNumber string) (*Contact, error)

	CreateContactWithEmail(tenant string, email string) (*Contact, error)
	CreateContactWithPhone(tenant string, phoneNumber string) (*Contact, error)

	ConversationByIdExists(tenant string, conversationId string) (bool, error)

	GetConversations(tenant string) ([]Conversation, error)
	GetConversationById(tenant string, conversationId string) (Conversation, error)

	CreateConversation(tenant string, initiatorId string, initiatorFirstName string, initiatorLastName string, initiatorUsername string, initiatorType entity.SenderType, channel entity.EventType) (*Conversation, error)
	UpdateConversation(tenant string, conversationId string, participantId string, participantType entity.SenderType, lastSenderFirstName string, lastSenderLastName string, lastContentPreview string) (string, error)
}

type EmailContent

type EmailContent struct {
	MessageId string   `json:"messageId"`
	Html      string   `json:"html"`
	Subject   string   `json:"subject"`
	From      string   `json:"from"`
	To        []string `json:"to"`
	Cc        []string `json:"cc"`
	Bcc       []string `json:"bcc"`
	InReplyTo []string `json:"InReplyTo"`
	Reference []string `json:"Reference"`
}

type MessageService

type MessageService struct {
	msProto.UnimplementedMessageStoreServiceServer
	// contains filtered or unexported fields
}

func NewMessageService

func NewMessageService(driver *neo4j.DriverWithContext, postgresRepositories *repository.PostgresRepositories, customerOSService *CustomerOSService, commonStoreService *commonStoreService) *MessageService

func (*MessageService) GetFeed

func (s *MessageService) GetFeed(ctx context.Context, feedIdRequest *msProto.FeedId) (*msProto.FeedItem, error)

func (*MessageService) GetFeeds

func (*MessageService) GetMessage

func (s *MessageService) GetMessage(ctx context.Context, msgId *msProto.MessageId) (*msProto.Message, error)

func (*MessageService) GetMessagesForFeed

func (s *MessageService) GetMessagesForFeed(ctx context.Context, feedRequest *msProto.PagedMessages) (*msProto.MessageListResponse, error)

func (*MessageService) GetParticipantIds

func (s *MessageService) GetParticipantIds(ctx context.Context, feedId *msProto.FeedId) (*msProto.ParticipantObjectListResponse, error)

func (*MessageService) GetParticipants

func (s *MessageService) GetParticipants(ctx context.Context, feedId *msProto.FeedId) (*msProto.ParticipantsListResponse, error)

func (*MessageService) SaveMessage

func (s *MessageService) SaveMessage(ctx context.Context, input *msProto.InputMessage) (*msProto.MessageId, error)

type Participant

type Participant struct {
	Id   string
	Type entity.SenderType
}

type User

type User struct {
	FirstName string        `json:"firstName"`
	LastName  string        `json:"lastName"`
	Id        string        `json:"id"`
	Emails    []emailObject `json:"emails"`
}

Jump to

Keyboard shortcuts

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