mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 13:17:42 +00:00
responses
This commit is contained in:
parent
08fd2ef9a5
commit
7714046de2
1 changed files with 15 additions and 9 deletions
|
@ -28,6 +28,10 @@ type createWatcherRequest struct {
|
||||||
Criteria watcherCriteria
|
Criteria watcherCriteria
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type watcherCreatedResponse struct {
|
||||||
|
ID int64 `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
|
@ -144,6 +148,8 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
_ = json.NewEncoder(w).Encode(watcherCreatedResponse{ID: watcher.ID})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *api) editWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
func (a *api) editWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -208,15 +214,15 @@ func (a *api) deleteWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type watcherItem struct {
|
type watcherItem struct {
|
||||||
ID int64
|
ID int64 `json:"id"`
|
||||||
CreatedAt float64
|
CreatedAt float64 `json:"created_at"`
|
||||||
Type string
|
Type string `json:"type"`
|
||||||
Label string
|
Label string `json:"label"`
|
||||||
Upvotes int64
|
Upvotes int64 `json:"upvotes"`
|
||||||
Keyword string
|
Keyword string `json:"keyword"`
|
||||||
Flair string
|
Flair string `json:"flair"`
|
||||||
Domain string
|
Domain string `json:"domain"`
|
||||||
Hits int64
|
Hits int64 `json:"hits"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *api) listWatchersHandler(w http.ResponseWriter, r *http.Request) {
|
func (a *api) listWatchersHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
|
|
Loading…
Reference in a new issue