2019-12-01 13:47:25 +00:00
|
|
|
// Code generated by github.com/99designs/gqlgen, DO NOT EDIT.
|
|
|
|
|
|
|
|
package api
|
|
|
|
|
2020-02-23 21:07:46 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"strconv"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Request struct {
|
|
|
|
URL string `json:"url"`
|
|
|
|
Method HTTPMethod `json:"method"`
|
|
|
|
Timestamp time.Time `json:"timestamp"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type HTTPMethod string
|
|
|
|
|
|
|
|
const (
|
|
|
|
HTTPMethodGet HTTPMethod = "GET"
|
|
|
|
HTTPMethodPost HTTPMethod = "POST"
|
|
|
|
)
|
|
|
|
|
|
|
|
var AllHTTPMethod = []HTTPMethod{
|
|
|
|
HTTPMethodGet,
|
|
|
|
HTTPMethodPost,
|
2019-12-01 13:47:25 +00:00
|
|
|
}
|
|
|
|
|
2020-02-23 21:07:46 +00:00
|
|
|
func (e HTTPMethod) IsValid() bool {
|
|
|
|
switch e {
|
|
|
|
case HTTPMethodGet, HTTPMethodPost:
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e HTTPMethod) String() string {
|
|
|
|
return string(e)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (e *HTTPMethod) UnmarshalGQL(v interface{}) error {
|
|
|
|
str, ok := v.(string)
|
|
|
|
if !ok {
|
|
|
|
return fmt.Errorf("enums must be strings")
|
|
|
|
}
|
|
|
|
|
|
|
|
*e = HTTPMethod(str)
|
|
|
|
if !e.IsValid() {
|
|
|
|
return fmt.Errorf("%s is not a valid HttpMethod", str)
|
|
|
|
}
|
|
|
|
return nil
|
2019-12-01 13:47:25 +00:00
|
|
|
}
|
|
|
|
|
2020-02-23 21:07:46 +00:00
|
|
|
func (e HTTPMethod) MarshalGQL(w io.Writer) {
|
|
|
|
fmt.Fprint(w, strconv.Quote(e.String()))
|
2019-12-01 13:47:25 +00:00
|
|
|
}
|