github.com/go-swagger/go-swagger@v0.31.0/fixtures/goparsing/spec/api.go (about) 1 // Package booking API. 2 // 3 // the purpose of this application is to provide an application 4 // that is using plain go code to define an API 5 // 6 // Schemes: https 7 // Host: localhost 8 // Version: 0.0.1 9 // 10 // Consumes: 11 // - application/json 12 // 13 // Produces: 14 // - application/json 15 // 16 // swagger:meta 17 package spec 18 19 import ( 20 "net/http" 21 22 "github.com/go-swagger/scan-repo-boundary/makeplans" 23 ) 24 25 // Customer of the site. 26 // 27 // swagger:model Customer 28 type Customer = User 29 30 type User struct { 31 Name string `json:"name"` 32 } 33 34 // IgnoreMe should not be added to definitions since it is not annotated. 35 type IgnoreMe struct { 36 Name string `json:"name"` 37 } 38 39 // DateRange represents a scheduled appointments time 40 // DateRange should be in definitions since it's being used in a response 41 type DateRange struct { 42 Start string `json:"start"` 43 End string `json:"end"` 44 } 45 46 // BookingResponse represents a scheduled appointment 47 // 48 // swagger:response BookingResponse 49 type BookingResponse struct { 50 // Booking struct 51 // 52 // in: body 53 // required: true 54 Body struct { 55 Booking makeplans.Booking `json:"booking"` 56 Customer Customer `json:"customer"` 57 Dates DateRange `json:"dates"` 58 // example: {"key": "value"} 59 Map map[string]string `json:"map"` 60 // example: [1, 2] 61 Slice []int `json:"slice"` 62 } 63 } 64 65 // Bookings swagger:route GET /admin/bookings/ booking Bookings 66 // 67 // Bookings lists all the appointments that have been made on the site. 68 // 69 // Consumes: 70 // application/json 71 // 72 // Deprecated: true 73 // 74 // Schemes: http, https 75 // 76 // Produces: 77 // application/json 78 // 79 // Responses: 80 // 200: BookingResponse 81 func bookings(w http.ResponseWriter, r *http.Request) { 82 83 }