115 lines
2.5 KiB
Go
115 lines
2.5 KiB
Go
package usecase
|
|
|
|
import "context"
|
|
|
|
type QueueItemSummary struct {
|
|
ID string
|
|
AccountID string
|
|
Text string
|
|
ScheduledAt int64
|
|
Status string
|
|
MediaID string
|
|
Permalink string
|
|
PublishedAt int64
|
|
ErrorMessage string
|
|
CreateAt int64
|
|
UpdateAt int64
|
|
}
|
|
|
|
type CreateRequest struct {
|
|
TenantID string
|
|
OwnerUID string
|
|
AccountID string
|
|
Text string
|
|
ScheduledAt int64
|
|
}
|
|
|
|
type UpdateRequest struct {
|
|
TenantID string
|
|
OwnerUID string
|
|
AccountID string
|
|
QueueID string
|
|
Text *string
|
|
ScheduledAt *int64
|
|
}
|
|
|
|
type ListRequest struct {
|
|
TenantID string
|
|
OwnerUID string
|
|
AccountID string
|
|
Status string
|
|
Page int
|
|
PageSize int
|
|
}
|
|
|
|
type ListResult struct {
|
|
Items []QueueItemSummary
|
|
Total int64
|
|
Page int
|
|
PageSize int
|
|
TotalPages int
|
|
}
|
|
|
|
type PublishHealthSummary struct {
|
|
PendingScheduled int64
|
|
FailedCount int64
|
|
Published7d int64
|
|
TotalLikes7d int
|
|
TotalReplies7d int
|
|
}
|
|
|
|
type PublishHealthCheckpoint struct {
|
|
Checkpoint string
|
|
LikeCount int
|
|
ReplyCount int
|
|
RepostCount int
|
|
QuoteCount int
|
|
Views int
|
|
CheckedAt int64
|
|
}
|
|
|
|
type PublishHealthItem struct {
|
|
MediaID string
|
|
Permalink string
|
|
Text string
|
|
PublishedAt int64
|
|
LikeCount int
|
|
ReplyCount int
|
|
RepostCount int
|
|
QuoteCount int
|
|
Views int
|
|
Shares int
|
|
Checkpoints []PublishHealthCheckpoint
|
|
}
|
|
|
|
type PublishHealthResult struct {
|
|
Summary PublishHealthSummary
|
|
Items []PublishHealthItem
|
|
Total int64
|
|
Page int
|
|
PageSize int
|
|
TotalPages int
|
|
}
|
|
|
|
type RecordPublishedRequest struct {
|
|
TenantID string
|
|
OwnerUID string
|
|
AccountID string
|
|
Text string
|
|
MediaID string
|
|
Permalink string
|
|
PublishedAt int64
|
|
}
|
|
|
|
type UseCase interface {
|
|
Create(ctx context.Context, req CreateRequest) (*QueueItemSummary, error)
|
|
RecordPublished(ctx context.Context, req RecordPublishedRequest) (*QueueItemSummary, error)
|
|
Get(ctx context.Context, tenantID, ownerUID, accountID, queueID string) (*QueueItemSummary, error)
|
|
List(ctx context.Context, req ListRequest) (*ListResult, error)
|
|
Update(ctx context.Context, req UpdateRequest) (*QueueItemSummary, error)
|
|
Cancel(ctx context.Context, tenantID, ownerUID, accountID, queueID string) (*QueueItemSummary, error)
|
|
Delete(ctx context.Context, tenantID, ownerUID, accountID, queueID string) error
|
|
DispatchDue(ctx context.Context, limit int) (int, error)
|
|
ListPublishHealth(ctx context.Context, tenantID, ownerUID, accountID string, page, pageSize int) (*PublishHealthResult, error)
|
|
}
|