From 8d4277b1c7035722f708d98cd462a3c5136ebabd Mon Sep 17 00:00:00 2001 From: neha-Gupta1 Date: Thu, 17 Aug 2023 16:24:38 +0530 Subject: [PATCH 1/5] add handers for channels --- .../m365/collection/groups/handler.go | 23 +++++++++++ src/pkg/services/m365/api/channels.go | 1 + src/pkg/services/m365/api/channels_pager.go | 39 +++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 src/internal/m365/collection/groups/handler.go create mode 100644 src/pkg/services/m365/api/channels.go create mode 100644 src/pkg/services/m365/api/channels_pager.go diff --git a/src/internal/m365/collection/groups/handler.go b/src/internal/m365/collection/groups/handler.go new file mode 100644 index 000000000..0dea1ebb3 --- /dev/null +++ b/src/internal/m365/collection/groups/handler.go @@ -0,0 +1,23 @@ +package groups + +import ( + "context" + + "github.com/alcionai/corso/src/pkg/services/m365/api" + "github.com/microsoft/kiota-abstractions-go/serialization" + "github.com/microsoftgraph/msgraph-sdk-go/models" +) + +type BackupChannelHandler interface { + GetChannel(ctx context.Context, teamID, channelID string) (models.Channelable, error) + NewChannelPager(teamID, channelID string) api.ChannelItemDeltaEnumerator +} + +type BackupMessagesHandler interface { + GetItem(ctx context.Context, teamID, channelID, itemID string) (models.ChatMessageable, error) + NewItemPager(teamID, channelID string) api.MessageItemDeltaEnumerator +} + +type BackupReplyHandler interface { + GetItem(ctx context.Context, teamID, channelID, messageID string) (serialization.Parsable, error) +} diff --git a/src/pkg/services/m365/api/channels.go b/src/pkg/services/m365/api/channels.go new file mode 100644 index 000000000..778f64ec1 --- /dev/null +++ b/src/pkg/services/m365/api/channels.go @@ -0,0 +1 @@ +package api diff --git a/src/pkg/services/m365/api/channels_pager.go b/src/pkg/services/m365/api/channels_pager.go new file mode 100644 index 000000000..599c09649 --- /dev/null +++ b/src/pkg/services/m365/api/channels_pager.go @@ -0,0 +1,39 @@ +package api + +import ( + "context" +) + +// --------------------------------------------------------------------------- +// item pager +// --------------------------------------------------------------------------- + +type MessageItemDeltaEnumerator interface { + GetPage(context.Context) (DeltaPageLinker, error) +} + +// TODO: implement +// var _ MessageItemDeltaEnumerator = &messagePageCtrl{} + +// type messagePageCtrl struct { +// gs graph.Servicer +// builder *teams.ItemChannelsItemMessagesRequestBuilder +// options *teams.ItemChannelsItemMessagesRequestBuilderGetRequestConfiguration +// } + +// --------------------------------------------------------------------------- +// channel pager +// --------------------------------------------------------------------------- + +type ChannelItemDeltaEnumerator interface { + GetPage(context.Context) (DeltaPageLinker, error) +} + +// TODO: implement +// var _ ChannelsItemDeltaEnumerator = &channelsPageCtrl{} + +// type channelsPageCtrl struct { +// gs graph.Servicer +// builder *teams.ItemChannelsChannelItemRequestBuilder +// options *teams.ItemChannelsChannelItemRequestBuilderGetRequestConfiguration +// } From fa1a432a8706243aa57fe6757ef4290a1624dbf2 Mon Sep 17 00:00:00 2001 From: neha-Gupta1 Date: Thu, 17 Aug 2023 16:42:14 +0530 Subject: [PATCH 2/5] lint changes --- src/internal/m365/collection/groups/handler.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/internal/m365/collection/groups/handler.go b/src/internal/m365/collection/groups/handler.go index 0dea1ebb3..9134f1056 100644 --- a/src/internal/m365/collection/groups/handler.go +++ b/src/internal/m365/collection/groups/handler.go @@ -3,9 +3,10 @@ package groups import ( "context" + "github.com/microsoftgraph/msgraph-sdk-go/models" + "github.com/alcionai/corso/src/pkg/services/m365/api" "github.com/microsoft/kiota-abstractions-go/serialization" - "github.com/microsoftgraph/msgraph-sdk-go/models" ) type BackupChannelHandler interface { From d1f0d683af2263044307fbea0c433aa3db375662 Mon Sep 17 00:00:00 2001 From: neha-Gupta1 Date: Fri, 18 Aug 2023 13:40:42 +0530 Subject: [PATCH 3/5] message handler --- src/internal/m365/collection/groups/handler.go | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/internal/m365/collection/groups/handler.go b/src/internal/m365/collection/groups/handler.go index 9134f1056..950f6c828 100644 --- a/src/internal/m365/collection/groups/handler.go +++ b/src/internal/m365/collection/groups/handler.go @@ -9,16 +9,10 @@ import ( "github.com/microsoft/kiota-abstractions-go/serialization" ) -type BackupChannelHandler interface { +type BackupMessagesHandler interface { + GetMessage(ctx context.Context, teamID, channelID, itemID string) (models.ChatMessageable, error) + NewMessagePager(teamID, channelID string) api.MessageItemDeltaEnumerator GetChannel(ctx context.Context, teamID, channelID string) (models.Channelable, error) NewChannelPager(teamID, channelID string) api.ChannelItemDeltaEnumerator -} - -type BackupMessagesHandler interface { - GetItem(ctx context.Context, teamID, channelID, itemID string) (models.ChatMessageable, error) - NewItemPager(teamID, channelID string) api.MessageItemDeltaEnumerator -} - -type BackupReplyHandler interface { - GetItem(ctx context.Context, teamID, channelID, messageID string) (serialization.Parsable, error) + GetReply(ctx context.Context, teamID, channelID, messageID string) (serialization.Parsable, error) } From 4c5a33db690c406ebc516ef9eaebdee559a0b027 Mon Sep 17 00:00:00 2001 From: neha-Gupta1 Date: Fri, 18 Aug 2023 23:33:21 +0530 Subject: [PATCH 4/5] lint file --- src/internal/m365/collection/groups/handler.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/m365/collection/groups/handler.go b/src/internal/m365/collection/groups/handler.go index 950f6c828..c1a544e67 100644 --- a/src/internal/m365/collection/groups/handler.go +++ b/src/internal/m365/collection/groups/handler.go @@ -3,10 +3,10 @@ package groups import ( "context" + "github.com/microsoft/kiota-abstractions-go/serialization" "github.com/microsoftgraph/msgraph-sdk-go/models" "github.com/alcionai/corso/src/pkg/services/m365/api" - "github.com/microsoft/kiota-abstractions-go/serialization" ) type BackupMessagesHandler interface { From a4b65f1ab5917b83187f74577fc20887724e0f1d Mon Sep 17 00:00:00 2001 From: neha-Gupta1 Date: Tue, 22 Aug 2023 10:23:13 +0530 Subject: [PATCH 5/5] improve function names --- src/internal/m365/collection/groups/handler.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/internal/m365/collection/groups/handler.go b/src/internal/m365/collection/groups/handler.go index c1a544e67..d4a382149 100644 --- a/src/internal/m365/collection/groups/handler.go +++ b/src/internal/m365/collection/groups/handler.go @@ -10,9 +10,9 @@ import ( ) type BackupMessagesHandler interface { - GetMessage(ctx context.Context, teamID, channelID, itemID string) (models.ChatMessageable, error) + GetMessageByID(ctx context.Context, teamID, channelID, itemID string) (models.ChatMessageable, error) NewMessagePager(teamID, channelID string) api.MessageItemDeltaEnumerator - GetChannel(ctx context.Context, teamID, channelID string) (models.Channelable, error) + GetChannelByID(ctx context.Context, teamID, channelID string) (models.Channelable, error) NewChannelPager(teamID, channelID string) api.ChannelItemDeltaEnumerator - GetReply(ctx context.Context, teamID, channelID, messageID string) (serialization.Parsable, error) + GetReplyByID(ctx context.Context, teamID, channelID, messageID string) (serialization.Parsable, error) }