infra

package
v0.0.0-...-23b2a61 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CloudStorageBucket

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

func NewCloudStoreBucketClient

func NewCloudStoreBucketClient(ctx context.Context, projectId string, videoFilesBucketUrl string) *CloudStorageBucket

func (*CloudStorageBucket) Read

func (b *CloudStorageBucket) Read(ctx context.Context, addr string, writer io.Writer) error

type FirestorePostsRepository

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

func NewFirestorePostsRepository

func NewFirestorePostsRepository(client *firestore.Client) *FirestorePostsRepository

func (*FirestorePostsRepository) GetByExternalSourceUrl

func (s *FirestorePostsRepository) GetByExternalSourceUrl(ctx context.Context, url string) (domain.Post, bool, error)

AK TODO this won't work if different chats posted the same link This will also fail if message was posted twice

func (FirestorePostsRepository) GetChatPosts

func (s FirestorePostsRepository) GetChatPosts(ctx context.Context, chatid domain.ChatId) ([]domain.Post, error)

func (*FirestorePostsRepository) GetLastWeekPosts

func (s *FirestorePostsRepository) GetLastWeekPosts(ctx context.Context, chatid int64) ([]domain.Post, error)

func (*FirestorePostsRepository) GetPostById

func (s *FirestorePostsRepository) GetPostById(ctx context.Context, mediaId string) (domain.Post, bool, error)

func (*FirestorePostsRepository) UpsertPost

func (s *FirestorePostsRepository) UpsertPost(ctx context.Context, p domain.Post) error

type PostModel

type PostModel struct {
	Id                string          `firestore:"-"`
	Type              string          `firestore:"type"`
	OriginalMessageId int             `firestore:"original_message_id,omitempty"`
	ExternalSourceUrl string          `firestore:"external_source_url,omitempty"`
	Reactions         []ReactionModel `firestore:"reactions"`
	PostedOn          time.Time       `firestore:"posted_on"`
	ChatId            int64           `firestore:"chat_id"`
	Poster            UserRefModel    `firestore:"poster"`
}

func MapPostToModel

func MapPostToModel(p domain.Post) PostModel

func (*PostModel) SetId

func (pm *PostModel) SetId(id string)

type PubSubTopic

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

func NewPubSubTopicClient

func NewPubSubTopicClient(ctx context.Context, projectId string, servicename string, videoUrlPublishedTopicId string) *PubSubTopic

func (*PubSubTopic) PublishUrl

func (t *PubSubTopic) PublishUrl(ctx context.Context, url *url.URL) error

type ReactionModel

type ReactionModel struct {
	ReactToMessageId int          `firestore:"react_to_message_id"`
	Text             string       `firestore:"text"`
	PostedOn         time.Time    `firestore:"posted_on"`
	Reactor          UserRefModel `firestore:"reactor"`
}

func MapReactionToModel

func MapReactionToModel(r domain.Reaction) ReactionModel

type TelegramMessenger

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

func NewMessenger

func NewMessenger(token string) *TelegramMessenger

func (TelegramMessenger) Delete

func (b TelegramMessenger) Delete(chatId domain.ChatId, messageId domain.MessageId) error

func (TelegramMessenger) ReplyWithText

func (m TelegramMessenger) ReplyWithText(chatId domain.ChatId, replyToMessageId domain.MessageId, text string) (int, error)

func (TelegramMessenger) SendText

func (m TelegramMessenger) SendText(chatID domain.ChatId, text string) (int, error)

func (TelegramMessenger) SendVideo

func (b TelegramMessenger) SendVideo(chatId domain.ChatId, videoId string, caption string, payload io.Reader) (int, error)

type UserRefModel

type UserRefModel struct {
	DisplayName string `firestore:"user_name"`
	Id          int64  `firestore:"user_id"`
}

func MapUserRefToModel

func MapUserRefToModel(ur domain.UserRef) UserRefModel

Jump to

Keyboard shortcuts

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