2
0

request.go 802 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. package types
  2. type APIVerb string
  3. const (
  4. APIVerbGet APIVerb = "get"
  5. APIVerbCreate APIVerb = "create"
  6. APIVerbList APIVerb = "list"
  7. APIVerbUpdate APIVerb = "update"
  8. APIVerbDelete APIVerb = "delete"
  9. )
  10. type APIVerbGroup []APIVerb
  11. func ReadVerbGroup() APIVerbGroup {
  12. return []APIVerb{APIVerbGet, APIVerbList}
  13. }
  14. func ReadWriteVerbGroup() APIVerbGroup {
  15. return []APIVerb{APIVerbGet, APIVerbList, APIVerbCreate, APIVerbUpdate, APIVerbDelete}
  16. }
  17. type HTTPVerb string
  18. const (
  19. HTTPVerbGet HTTPVerb = "GET"
  20. HTTPVerbPost HTTPVerb = "POST"
  21. HTTPVerbPut HTTPVerb = "PUT"
  22. HTTPVerbPatch HTTPVerb = "PUT"
  23. HTTPVerbDelete HTTPVerb = "DELETE"
  24. )
  25. type Path struct {
  26. Parent *Path
  27. RelativePath string
  28. }
  29. type APIRequestMetadata struct {
  30. Verb APIVerb
  31. Method HTTPVerb
  32. Path *Path
  33. }