integration/webhook: add category title to request body
This commit is contained in:
parent
a0b4665080
commit
756dd449cc
1 changed files with 15 additions and 8 deletions
|
@ -57,6 +57,7 @@ func (c *Client) SendSaveEntryWebhookEvent(entry *model.Entry) error {
|
||||||
ID: entry.Feed.ID,
|
ID: entry.Feed.ID,
|
||||||
UserID: entry.Feed.UserID,
|
UserID: entry.Feed.UserID,
|
||||||
CategoryID: entry.Feed.Category.ID,
|
CategoryID: entry.Feed.Category.ID,
|
||||||
|
Category: &WebhookCategory{ID: entry.Feed.Category.ID, Title: entry.Feed.Category.Title},
|
||||||
FeedURL: entry.Feed.FeedURL,
|
FeedURL: entry.Feed.FeedURL,
|
||||||
SiteURL: entry.Feed.SiteURL,
|
SiteURL: entry.Feed.SiteURL,
|
||||||
Title: entry.Feed.Title,
|
Title: entry.Feed.Title,
|
||||||
|
@ -94,13 +95,13 @@ func (c *Client) SendNewEntriesWebhookEvent(feed *model.Feed, entries model.Entr
|
||||||
Tags: entry.Tags,
|
Tags: entry.Tags,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
return c.makeRequest(NewEntriesEventType, &WebhookNewEntriesEvent{
|
return c.makeRequest(NewEntriesEventType, &WebhookNewEntriesEvent{
|
||||||
EventType: NewEntriesEventType,
|
EventType: NewEntriesEventType,
|
||||||
Feed: &WebhookFeed{
|
Feed: &WebhookFeed{
|
||||||
ID: feed.ID,
|
ID: feed.ID,
|
||||||
UserID: feed.UserID,
|
UserID: feed.UserID,
|
||||||
CategoryID: feed.Category.ID,
|
CategoryID: feed.Category.ID,
|
||||||
|
Category: &WebhookCategory{ID: feed.Category.ID, Title: feed.Category.Title},
|
||||||
FeedURL: feed.FeedURL,
|
FeedURL: feed.FeedURL,
|
||||||
SiteURL: feed.SiteURL,
|
SiteURL: feed.SiteURL,
|
||||||
Title: feed.Title,
|
Title: feed.Title,
|
||||||
|
@ -148,12 +149,18 @@ type WebhookFeed struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
UserID int64 `json:"user_id"`
|
UserID int64 `json:"user_id"`
|
||||||
CategoryID int64 `json:"category_id"`
|
CategoryID int64 `json:"category_id"`
|
||||||
|
Category *WebhookCategory `json:"category,omitempty"`
|
||||||
FeedURL string `json:"feed_url"`
|
FeedURL string `json:"feed_url"`
|
||||||
SiteURL string `json:"site_url"`
|
SiteURL string `json:"site_url"`
|
||||||
Title string `json:"title"`
|
Title string `json:"title"`
|
||||||
CheckedAt time.Time `json:"checked_at"`
|
CheckedAt time.Time `json:"checked_at"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type WebhookCategory struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
type WebhookEntry struct {
|
type WebhookEntry struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
UserID int64 `json:"user_id"`
|
UserID int64 `json:"user_id"`
|
||||||
|
|
Loading…
Reference in a new issue