Skip to content

Commit

Permalink
move array types to respective packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Maciej Winnicki committed Feb 12, 2018
1 parent 8945d40 commit 26ee506
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 101 deletions.
5 changes: 5 additions & 0 deletions function/function.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ type Function struct {
Provider *Provider `json:"provider" validate:"required"`
}

// Functions is an array of functions.
type Functions struct {
Functions []*Function `json:"functions"`
}

// ID uniquely identifies a function.
type ID string

Expand Down
63 changes: 0 additions & 63 deletions httpapi/configapi.go

This file was deleted.

28 changes: 0 additions & 28 deletions httpapi/eventsapi.go

This file was deleted.

12 changes: 2 additions & 10 deletions httpapi/httpapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ func (h HTTPAPI) getFunctions(w http.ResponseWriter, r *http.Request, params htt
w.WriteHeader(http.StatusInternalServerError)
encoder.Encode(&Error{Error: err.Error()})
} else {
encoder.Encode(&functions{fns})
encoder.Encode(&function.Functions{Functions: fns})
}
}

type functions struct {
Functions []*function.Function `json:"functions"`
}

func (h HTTPAPI) registerFunction(w http.ResponseWriter, r *http.Request, params httprouter.Params) {
w.Header().Set("Content-Type", "application/json")
encoder := json.NewEncoder(w)
Expand Down Expand Up @@ -211,10 +207,6 @@ func (h HTTPAPI) getSubscriptions(w http.ResponseWriter, r *http.Request, params
w.WriteHeader(http.StatusInternalServerError)
encoder.Encode(&Error{Error: err.Error()})
} else {
encoder.Encode(&subscriptions{subs})
encoder.Encode(&subscription.Subscriptions{Subscriptions: subs})
}
}

type subscriptions struct {
Subscriptions []*subscription.Subscription `json:"subscriptions"`
}
5 changes: 5 additions & 0 deletions subscription/subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ type Subscription struct {
CORS *CORS `json:"cors,omitempty"`
}

// Subscriptions is an array of subscriptions.
type Subscriptions struct {
Subscriptions []*Subscription `json:"subscriptions"`
}

// ID uniquely identifies a subscription.
type ID string

Expand Down

0 comments on commit 26ee506

Please sign in to comment.