Skip to content

Commit

Permalink
feat(yesod): add item collection & read count
Browse files Browse the repository at this point in the history
  • Loading branch information
MuZhou233 committed Dec 8, 2023
1 parent d8a356f commit f8f8558
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 9 deletions.
17 changes: 13 additions & 4 deletions proto/librarian/sephirah/v1/netzach.proto
Original file line number Diff line number Diff line change
Expand Up @@ -65,18 +65,27 @@ message NotifyFlow {
librarian.v1.InternalID id = 1;
string name = 2;
string description = 3;
NotifyFlowSource source = 4;
repeated NotifyFlowSource sources = 4;
repeated NotifyFlowTarget targets = 5;
NotifyFlowStatus status = 6;
}

message NotifyFlowSource {
repeated librarian.v1.InternalID feed_id_filter = 1;
NotifyFilter filter = 1;
// must be FeedConfigID or FeedItemCollectionID
librarian.v1.InternalID source_id = 2;
}

message NotifyFlowTarget {
librarian.v1.InternalID target_id = 1;
string channel_id = 2;
NotifyFilter filter = 1;
// must be NotifyTargetID
librarian.v1.InternalID target_id = 2;
string channel_id = 3;
}

message NotifyFilter {
repeated string exclude_keywords = 1;
repeated string include_keywords = 2;
}

enum NotifyTargetType {
Expand Down
18 changes: 17 additions & 1 deletion proto/librarian/sephirah/v1/sephirah.proto
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ service LibrarianSephirahService {
// `Yesod` `Normal`
rpc ListFeedConfigs(ListFeedConfigsRequest) returns (ListFeedConfigsResponse);
// `Yesod` `Normal`
rpc ListFeedConfigCategories(ListFeedConfigCategoriesRequest) returns (ListFeedConfigCategoriesResponse);
rpc ListFeedCategories(ListFeedCategoriesRequest) returns (ListFeedCategoriesResponse);
// `Yesod` `Normal`
rpc ListFeedPlatforms(ListFeedPlatformsRequest) returns (ListFeedPlatformsResponse);
// `Yesod` `Normal`
rpc ListFeedItems(ListFeedItemsRequest) returns (ListFeedItemsResponse);
// `Yesod` `Normal`
Expand All @@ -190,6 +192,20 @@ service LibrarianSephirahService {
rpc GetFeedItem(GetFeedItemRequest) returns (GetFeedItemResponse);
// `Yesod` `Normal`
rpc GetBatchFeedItems(GetBatchFeedItemsRequest) returns (GetBatchFeedItemsResponse);
// `Yesod` `Normal`
rpc ReadFeedItem(ReadFeedItemRequest) returns (ReadFeedItemResponse);
// `Yesod` `Normal`
rpc CreateFeedItemCollection(CreateFeedItemCollectionRequest) returns (CreateFeedItemCollectionResponse);
// `Yesod` `Normal`
rpc UpdateFeedItemCollection(UpdateFeedItemCollectionRequest) returns (UpdateFeedItemCollectionResponse);
// `Yesod` `Normal`
rpc ListFeedItemCollections(ListFeedItemCollectionsRequest) returns (ListFeedItemCollectionsResponse);
// `Yesod` `Normal`
rpc AddFeedItemToCollection(AddFeedItemToCollectionRequest) returns (AddFeedItemToCollectionResponse);
// `Yesod` `Normal`
rpc RemoveFeedItemFromCollection(RemoveFeedItemFromCollectionRequest) returns (RemoveFeedItemFromCollectionResponse);
// `Yesod` `Normal`
rpc ListCollectionItems(ListCollectionItemsRequest) returns (ListCollectionItemsResponse);
}

message GetServerInformationRequest {}
Expand Down
72 changes: 69 additions & 3 deletions proto/librarian/sephirah/v1/yesod.proto
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,16 @@ message ListFeedConfigsResponse {
}
}

message ListFeedConfigCategoriesRequest {}
message ListFeedConfigCategoriesResponse {
message ListFeedCategoriesRequest {}
message ListFeedCategoriesResponse {
repeated string categories = 1;
}

message ListFeedPlatformsRequest {}
message ListFeedPlatformsResponse {
repeated string platforms = 1;
}

message ListFeedItemsRequest {
librarian.v1.PagingRequest paging = 1;
repeated librarian.v1.InternalID feed_id_filter = 2;
Expand Down Expand Up @@ -92,18 +97,69 @@ message GetBatchFeedItemsResponse {
repeated librarian.v1.FeedItem items = 1;
}

message ReadFeedItemRequest {
librarian.v1.InternalID id = 1;
}
message ReadFeedItemResponse {}

message CreateFeedItemCollectionRequest {
FeedItemCollection collection = 1;
}
message CreateFeedItemCollectionResponse {}

message UpdateFeedItemCollectionRequest {
FeedItemCollection collection = 1;
}
message UpdateFeedItemCollectionResponse {}

message ListFeedItemCollectionsRequest {}
message ListFeedItemCollectionsResponse {
repeated FeedItemCollection collections = 1;
}

message AddFeedItemToCollectionRequest {
librarian.v1.InternalID feed_item_id = 1;
// id 0 is regarded as the default collection id
librarian.v1.InternalID collection_id = 2;
}
message AddFeedItemToCollectionResponse {}

message RemoveFeedItemFromCollectionRequest {
librarian.v1.InternalID feed_item_id = 1;
// id 0 is regarded as the default collection id
librarian.v1.InternalID collection_id = 2;
}
message RemoveFeedItemFromCollectionResponse {}

message ListCollectionItemsRequest {
librarian.v1.PagingRequest paging = 1;
// id 0 is regarded as the default collection id
repeated librarian.v1.InternalID collection_id_filter = 2;
repeated librarian.v1.InternalID author_id_filter = 3;
repeated string publish_platform_filter = 4;
repeated string category_filter = 5;
librarian.v1.TimeRange publish_time_range = 6;
}

message ListCollectionItemsResponse {
librarian.v1.PagingResponse paging = 1;
repeated FeedItemDigest items = 2;
}

message FeedConfig {
librarian.v1.InternalID id = 1;
string name = 2;
string feed_url = 3;
// No meaning when source is FEED_CONFIG_SOURCE_COMMON
// Not used when source is FEED_CONFIG_SOURCE_COMMON
librarian.v1.InternalID author_account = 4;
FeedConfigSource source = 5;
FeedConfigStatus status = 6;
google.protobuf.Duration pull_interval = 7;
string category = 8;
// response only
optional google.protobuf.Timestamp latest_update_time = 9;
// If ture, exclude items from ListFeedItemsResponse
bool hide_items = 10;
}

enum FeedConfigStatus {
Expand Down Expand Up @@ -141,3 +197,13 @@ message FeedItemDigest {
// `Feed.image.url`
string feed_avatar_url = 11;
}

// Server must maintain a default collection, without requirement of create
// the default collection have its id, but sometimes client can use id 0 to specify the default collection.
// check ListCollectionItems api for the use case.
message FeedItemCollection {
librarian.v1.InternalID id = 1;
string name = 2;
string description = 3;
string category = 4;
}
4 changes: 3 additions & 1 deletion proto/librarian/v1/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ message FeedItem {
string content = 5;
// `standard field`
string guid = 6;
// standard field. e.g. https://github.com/TuiHub/Librarian/releases.atom
// `standard field`. e.g. https://github.com/TuiHub/Librarian/releases.atom
string link = 7;
// `standard field`
FeedImage image = 8;
Expand All @@ -196,6 +196,8 @@ message FeedItem {
repeated FeedEnclosure enclosures = 13;
// hostname of `link`. e.g. github.com
string publish_platform = 14;
// recorded read times
int64 read_count = 15;
}

// Person is an individual specified in a feed
Expand Down

0 comments on commit f8f8558

Please sign in to comment.