Commit 5f629af1 authored by Corentin Barreau's avatar Corentin Barreau
Browse files

Fix: payload structure

parent 5ba59586
......@@ -12,10 +12,15 @@ func (c *Client) Discovered(URLs []string, URLType string) (discoveredResponse *
discoveredResponse = new(DiscoveredResponse)
// build payload
var URLsPayload []URL
for _, URLString := range URLs {
URLsPayload = append(URLsPayload, URL{Value: URLString})
}
payload := DiscoveredPayload{
Project: c.Project,
Type: URLType,
URLs: URLs,
URLs: URLsPayload,
}
jsonPayload, err := json.Marshal(payload)
......
......@@ -11,8 +11,10 @@ type Client struct {
}
type URL struct {
ID int `json:"id"`
ID int `json:"id,omitempty"`
Value string `json:"value"`
Path string `json:"path,omitempty"`
Via string `json:"via,omitempty"`
}
type FeedResponse struct {
......@@ -29,9 +31,9 @@ type FinishedResponse struct {
}
type DiscoveredPayload struct {
Project string `json:"project"`
Type string `json:"type"`
URLs []string `json:"urls"`
Project string `json:"project"`
Type string `json:"type"`
URLs []URL `json:"urls"`
}
type FinishedPayload struct {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment