Skip to content

Commit

Permalink
initial support for starred and bookmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed May 17, 2023
1 parent 150e305 commit 4e6ce0a
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions internal/chunk/chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const (
CChannels
CChannelInfo
CWorkspaceInfo
CStarredItems
CBookmarks
)

var ErrUnsupChunkType = fmt.Errorf("unsupported chunk type")
Expand Down Expand Up @@ -68,6 +70,10 @@ type Chunk struct {
// WorkspaceInfo contains the workspace information as returned by the
// API. Populated by WorkspaceInfo.
WorkspaceInfo *slack.AuthTestResponse `json:"w,omitempty"`
//
StarredItems []slack.StarredItem `json:"st,omitempty"` // Populated by StarredItems
//
Bookmarks []slack.Bookmark `json:"b,omitempty"` // Populated by Bookmarks
}

// GroupID is a unique ID for a chunk group. It is used to group chunks of
Expand All @@ -78,11 +84,13 @@ type GroupID string
const (
userChunkID GroupID = "lusr"
channelChunkID GroupID = "lch"
starredChunkID GroupID = "ls"
wspInfoChunkID GroupID = "iw"

threadPrefix = "t"
filePrefix = "f"
chanInfoPrefix = "ic"
bookmarkPrefix = "lb"
)

// Chunk ID categories
Expand All @@ -106,9 +114,13 @@ func (c *Chunk) ID() GroupID {
case CUsers:
return userChunkID // static, one team per chunk file
case CChannels:
return channelChunkID // static, one team per chunk file.
return channelChunkID // static
case CWorkspaceInfo:
return wspInfoChunkID // static, one team per chunk file.
return wspInfoChunkID // static
case CStarredItems:
return starredChunkID // static
case CBookmarks:
return id(bookmarkPrefix, c.ChannelID)
}
return GroupID(fmt.Sprintf("<unknown:%s>", c.Type))
}
Expand Down

0 comments on commit 4e6ce0a

Please sign in to comment.