316 lines
8.5 KiB
Plaintext
316 lines
8.5 KiB
Plaintext
syntax = "v1"
|
|
|
|
// growth-loop: outcomes / checkups / account health / workspaces / invite rewards
|
|
|
|
type (
|
|
OutcomeEventPublic {
|
|
Id string `json:"id"`
|
|
SourceType string `json:"source_type"`
|
|
SourceId string `json:"source_id"`
|
|
ThreadsAccountId string `json:"threads_account_id,optional"`
|
|
Kind string `json:"kind"`
|
|
Confidence string `json:"confidence"`
|
|
Status string `json:"status"`
|
|
ReplyCountDelta int `json:"reply_count_delta,optional"`
|
|
LikeCountDelta int `json:"like_count_delta,optional"`
|
|
FollowersDelta int `json:"followers_delta,optional"`
|
|
ConversionAmount float64 `json:"conversion_amount,optional"`
|
|
ConversionNote string `json:"conversion_note,optional"`
|
|
ConversionCurrency string `json:"conversion_currency,optional"`
|
|
WindowEndsAt int64 `json:"window_ends_at"`
|
|
SentAt int64 `json:"sent_at"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
OutcomeSummaryData {
|
|
From int64 `json:"from"`
|
|
To int64 `json:"to"`
|
|
Reach int `json:"reach"`
|
|
Conversations int `json:"conversations"`
|
|
FollowsPossible int `json:"follows_possible"`
|
|
FollowsConfirmed int `json:"follows_confirmed"`
|
|
Conversions int `json:"conversions"`
|
|
ConversionAmount float64 `json:"conversion_amount"`
|
|
}
|
|
|
|
ListOutcomesReq {
|
|
Page int `form:"page,default=1"`
|
|
PageSize int `form:"pageSize,default=20"`
|
|
Kind string `form:"kind,optional"`
|
|
Confidence string `form:"confidence,optional"`
|
|
SourceType string `form:"source_type,optional"`
|
|
From int64 `form:"from,optional"`
|
|
To int64 `form:"to,optional"`
|
|
}
|
|
|
|
OutcomeListData {
|
|
List []OutcomeEventPublic `json:"list"`
|
|
Pagination Pagination `json:"pagination"`
|
|
}
|
|
|
|
OutcomeSummaryReq {
|
|
Range string `form:"range,default=week"` // week | month
|
|
From int64 `form:"from,optional"`
|
|
To int64 `form:"to,optional"`
|
|
}
|
|
|
|
GetOutcomeReq {
|
|
Id string `path:"id"`
|
|
}
|
|
|
|
ReportConversionReq {
|
|
Id string `path:"id"`
|
|
Amount float64 `json:"amount,optional"`
|
|
Note string `json:"note,optional"`
|
|
Currency string `json:"currency,optional"`
|
|
}
|
|
|
|
UpdateConversionReq {
|
|
Id string `path:"id"`
|
|
Amount float64 `json:"amount,optional"`
|
|
Note string `json:"note,optional"`
|
|
Currency string `json:"currency,optional"`
|
|
}
|
|
|
|
DeleteConversionReq {
|
|
Id string `path:"id"`
|
|
}
|
|
|
|
CheckupFindingPublic {
|
|
Claim string `json:"claim"`
|
|
Evidence []string `json:"evidence"`
|
|
}
|
|
|
|
CheckupActionPublic {
|
|
Title string `json:"title"`
|
|
Reason string `json:"reason"`
|
|
Deeplink string `json:"deeplink"`
|
|
}
|
|
|
|
WeeklyCheckupPublic {
|
|
Id string `json:"id"`
|
|
WeekKey string `json:"week_key"`
|
|
Status string `json:"status"`
|
|
Summary string `json:"summary"`
|
|
Findings []CheckupFindingPublic `json:"findings"`
|
|
Actions []CheckupActionPublic `json:"actions"`
|
|
Error string `json:"error,optional"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
ListCheckupsReq {
|
|
Page int `form:"page,default=1"`
|
|
PageSize int `form:"pageSize,default=20"`
|
|
}
|
|
|
|
CheckupListData {
|
|
List []WeeklyCheckupPublic `json:"list"`
|
|
Pagination Pagination `json:"pagination"`
|
|
}
|
|
|
|
GetCheckupReq {
|
|
Id string `path:"id"`
|
|
}
|
|
|
|
AccountHealthPublic {
|
|
ThreadsAccountId string `json:"threads_account_id"`
|
|
Score int `json:"score"`
|
|
Level string `json:"level"`
|
|
Factors []string `json:"factors"`
|
|
Advice string `json:"advice"`
|
|
ComputedAt int64 `json:"computed_at"`
|
|
}
|
|
|
|
AccountHealthListData {
|
|
List []AccountHealthPublic `json:"list"`
|
|
}
|
|
|
|
GetAccountHealthReq {
|
|
AccountId string `path:"accountId"`
|
|
}
|
|
|
|
WorkspacePublic {
|
|
Id string `json:"id"`
|
|
Name string `json:"name"`
|
|
ReviewRequired bool `json:"review_required"`
|
|
IsDefault bool `json:"is_default"`
|
|
Archived bool `json:"archived"`
|
|
FooterText string `json:"footer_text,optional"`
|
|
HidePoweredBy bool `json:"hide_powered_by,optional"`
|
|
BrandName string `json:"brand_name,optional"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
WorkspaceListData {
|
|
List []WorkspacePublic `json:"list"`
|
|
CurrentWorkspaceId string `json:"current_workspace_id"`
|
|
}
|
|
|
|
CreateWorkspaceReq {
|
|
Name string `json:"name"`
|
|
}
|
|
|
|
UpdateWorkspaceReq {
|
|
Id string `path:"id"`
|
|
Name string `json:"name,optional"`
|
|
ReviewRequired *bool `json:"review_required,optional"`
|
|
}
|
|
|
|
WorkspaceIdReq {
|
|
Id string `path:"id"`
|
|
}
|
|
|
|
SwitchWorkspaceReq {
|
|
Id string `path:"id"`
|
|
}
|
|
|
|
DraftReviewPublic {
|
|
Id string `json:"id"`
|
|
RefType string `json:"ref_type"`
|
|
RefId string `json:"ref_id"`
|
|
WorkspaceId string `json:"workspace_id"`
|
|
Status string `json:"status"`
|
|
Reason string `json:"reason,optional"`
|
|
CreatedAt int64 `json:"created_at"`
|
|
UpdatedAt int64 `json:"updated_at"`
|
|
}
|
|
|
|
SubmitDraftReviewReq {
|
|
RefType string `json:"ref_type"`
|
|
RefId string `json:"ref_id"`
|
|
WorkspaceId string `json:"workspace_id,optional"`
|
|
}
|
|
|
|
ReviewDecisionReq {
|
|
Id string `path:"id"`
|
|
Reason string `json:"reason,optional"`
|
|
}
|
|
|
|
ListDraftReviewsReq {
|
|
Page int `form:"page,default=1"`
|
|
PageSize int `form:"pageSize,default=20"`
|
|
Status string `form:"status,optional"`
|
|
}
|
|
|
|
DraftReviewListData {
|
|
List []DraftReviewPublic `json:"list"`
|
|
Pagination Pagination `json:"pagination"`
|
|
}
|
|
|
|
ExportReportReq {
|
|
WorkspaceId string `form:"workspace_id"`
|
|
YearMonth string `form:"year_month"` // YYYY-MM
|
|
Format string `form:"format,optional"` // md | pdf
|
|
}
|
|
|
|
ExportReportData {
|
|
Url string `json:"url"`
|
|
ExpiresAt int64 `json:"expires_at,optional"`
|
|
Filename string `json:"filename"`
|
|
// ContentType: text/markdown or application/pdf
|
|
ContentType string `json:"content_type,optional"`
|
|
// Format: md | pdf
|
|
Format string `json:"format,optional"`
|
|
}
|
|
|
|
// branding fields on workspace (P2 white-label report)
|
|
// extended via UpdateWorkspaceBranding in growth_p2.api
|
|
)
|
|
|
|
@server (
|
|
group: outcomes
|
|
prefix: /api/v1/outcomes
|
|
middleware: AuthJWT
|
|
)
|
|
service gateway {
|
|
@handler GetOutcomeSummary
|
|
get /summary (OutcomeSummaryReq) returns (OutcomeSummaryData)
|
|
|
|
@handler ListOutcomes
|
|
get / (ListOutcomesReq) returns (OutcomeListData)
|
|
|
|
@handler GetOutcome
|
|
get /:id (GetOutcomeReq) returns (OutcomeEventPublic)
|
|
|
|
@handler ReportConversion
|
|
post /:id/conversion (ReportConversionReq) returns (OutcomeEventPublic)
|
|
|
|
@handler UpdateConversion
|
|
put /:id/conversion (UpdateConversionReq) returns (OutcomeEventPublic)
|
|
|
|
@handler DeleteConversion
|
|
delete /:id/conversion (DeleteConversionReq) returns (OkData)
|
|
}
|
|
|
|
@server (
|
|
group: checkups
|
|
prefix: /api/v1/checkups
|
|
middleware: AuthJWT
|
|
)
|
|
service gateway {
|
|
@handler GetLatestCheckup
|
|
get /latest returns (WeeklyCheckupPublic)
|
|
|
|
@handler ListCheckups
|
|
get / (ListCheckupsReq) returns (CheckupListData)
|
|
|
|
@handler GetCheckup
|
|
get /:id (GetCheckupReq) returns (WeeklyCheckupPublic)
|
|
|
|
@handler GenerateCheckupNow
|
|
post /generate returns (WeeklyCheckupPublic)
|
|
}
|
|
|
|
@server (
|
|
group: health
|
|
prefix: /api/v1/account-health
|
|
middleware: AuthJWT
|
|
)
|
|
service gateway {
|
|
@handler ListAccountHealth
|
|
get / returns (AccountHealthListData)
|
|
|
|
@handler GetAccountHealth
|
|
get /:accountId (GetAccountHealthReq) returns (AccountHealthPublic)
|
|
}
|
|
|
|
@server (
|
|
group: workspaces
|
|
prefix: /api/v1/workspaces
|
|
middleware: AuthJWT
|
|
)
|
|
service gateway {
|
|
@handler ListWorkspaces
|
|
get / returns (WorkspaceListData)
|
|
|
|
@handler CreateWorkspace
|
|
post / (CreateWorkspaceReq) returns (WorkspacePublic)
|
|
|
|
@handler UpdateWorkspace
|
|
put /:id (UpdateWorkspaceReq) returns (WorkspacePublic)
|
|
|
|
@handler ArchiveWorkspace
|
|
post /:id/archive (WorkspaceIdReq) returns (OkData)
|
|
|
|
@handler SwitchWorkspace
|
|
post /:id/switch (SwitchWorkspaceReq) returns (WorkspaceListData)
|
|
|
|
@handler SubmitDraftReview
|
|
post /reviews (SubmitDraftReviewReq) returns (DraftReviewPublic)
|
|
|
|
@handler ApproveDraftReview
|
|
post /reviews/:id/approve (ReviewDecisionReq) returns (DraftReviewPublic)
|
|
|
|
@handler RejectDraftReview
|
|
post /reviews/:id/reject (ReviewDecisionReq) returns (DraftReviewPublic)
|
|
|
|
@handler ListDraftReviews
|
|
get /reviews (ListDraftReviewsReq) returns (DraftReviewListData)
|
|
|
|
@handler ExportWorkspaceReport
|
|
get /report/export (ExportReportReq) returns (ExportReportData)
|
|
}
|