mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-25 05:07:43 +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
|
||||
}
|
||||
|
||||
type watcherCreatedResponse struct {
|
||||
ID int64 `json:"id"`
|
||||
}
|
||||
|
||||
func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := context.Background()
|
||||
|
||||
|
@ -144,6 +148,8 @@ func (a *api) createWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
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) {
|
||||
|
@ -208,15 +214,15 @@ func (a *api) deleteWatcherHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
|
||||
type watcherItem struct {
|
||||
ID int64
|
||||
CreatedAt float64
|
||||
Type string
|
||||
Label string
|
||||
Upvotes int64
|
||||
Keyword string
|
||||
Flair string
|
||||
Domain string
|
||||
Hits int64
|
||||
ID int64 `json:"id"`
|
||||
CreatedAt float64 `json:"created_at"`
|
||||
Type string `json:"type"`
|
||||
Label string `json:"label"`
|
||||
Upvotes int64 `json:"upvotes"`
|
||||
Keyword string `json:"keyword"`
|
||||
Flair string `json:"flair"`
|
||||
Domain string `json:"domain"`
|
||||
Hits int64 `json:"hits"`
|
||||
}
|
||||
|
||||
func (a *api) listWatchersHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
Loading…
Reference in a new issue