github.com/josephspurrier/go-swagger@v0.2.1-0.20221129144919-1f672a142a00/fixtures/goparsing/classification/operations/todo_operation.go (about)

     1  // Copyright 2015 go-swagger maintainers
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //    http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package operations
    16  
    17  // ListPetParams the params for the list pets query
    18  type ListPetParams struct {
    19  	// OutOfStock when set to true only the pets that are out of stock will be returned
    20  	OutOfStock bool
    21  }
    22  
    23  // ServeAPI serves the API for this record store
    24  func ServeAPI(host, basePath string, schemes []string) error {
    25  
    26  	// swagger:route GET /pets pets users listPets
    27  	//
    28  	// Lists pets filtered by some parameters.
    29  	//
    30  	// This will show all available pets by default.
    31  	// You can get the pets that are out of stock
    32  	//
    33  	// Consumes:
    34  	// application/json
    35  	// application/x-protobuf
    36  	//
    37  	// Produces:
    38  	// application/json
    39  	// application/x-protobuf
    40  	//
    41  	// Schemes: http, https, ws, wss
    42  	//
    43  	// Security:
    44  	// api_key:
    45  	// oauth: read, write
    46  	//
    47  	// Responses:
    48  	// default: genericError
    49  	// 200: someResponse
    50  	// 422: validationError
    51  	//
    52  	// Extensions:
    53  	// x-some-flag: true
    54  	mountItem("GET", basePath+"/pets", nil)
    55  
    56  	/* swagger:route POST /pets pets users createPet
    57  
    58  	Create a pet based on the parameters.
    59  
    60  	Consumes:
    61  	- application/json
    62  	- application/x-protobuf
    63  
    64  	Produces:
    65  	- application/json
    66  	- application/x-protobuf
    67  
    68  	Schemes: http, https, ws, wss
    69  
    70  	Responses:
    71  	default: genericError
    72  	200: someResponse
    73  	422: validationError
    74  
    75  	Security:
    76  	api_key:
    77  	oauth: read, write */
    78  	mountItem("POST", basePath+"/pets", nil)
    79  
    80  	// swagger:route GET /orders orders listOrders
    81  	//
    82  	// lists orders filtered by some parameters.
    83  	//
    84  	// Consumes:
    85  	// application/json
    86  	// application/x-protobuf
    87  	//
    88  	// Produces:
    89  	// application/json
    90  	// application/x-protobuf
    91  	//
    92  	// Schemes: http, https, ws, wss
    93  	//
    94  	// Security:
    95  	// api_key:
    96  	// oauth: orders:read, https://www.googleapis.com/auth/userinfo.email
    97  	//
    98  	// Responses:
    99  	// default: genericError
   100  	// 200: someResponse
   101  	// 422: validationError
   102  	//
   103  	// Extensions:
   104  	// x-some-flag: false
   105  	// x-some-list:
   106  	//	- item1
   107  	//	- item2
   108  	//	- item3
   109  	// x-some-object:
   110  	//	key1: value1
   111  	//	key2: value2
   112  	//	subobject:
   113  	//		subkey1: subvalue1
   114  	//		subkey2: subvalue2
   115  	//	key3: value3
   116  	mountItem("GET", basePath+"/orders", nil)
   117  
   118  	// swagger:route POST /orders orders createOrder
   119  	//
   120  	// create an order based on the parameters.
   121  	//
   122  	// Consumes:
   123  	// application/json
   124  	// application/x-protobuf
   125  	//
   126  	// Produces:
   127  	// application/json
   128  	// application/x-protobuf
   129  	//
   130  	// Schemes: http, https, ws, wss
   131  	//
   132  	// Security:
   133  	// api_key:
   134  	// oauth: read, write
   135  	//
   136  	// Responses:
   137  	// default: genericError
   138  	// 200: someResponse
   139  	// 422: validationError
   140  	mountItem("POST", basePath+"/orders", nil)
   141  
   142  	// swagger:route GET /orders/{id} orders orderDetails
   143  	//
   144  	// gets the details for an order.
   145  	//
   146  	// Consumes:
   147  	// application/json
   148  	// application/x-protobuf
   149  	//
   150  	// Produces:
   151  	// application/json
   152  	// application/x-protobuf
   153  	//
   154  	// Schemes: http, https, ws, wss
   155  	//
   156  	// Security:
   157  	// api_key:
   158  	// oauth: read, write
   159  	//
   160  	// Responses:
   161  	// default: genericError
   162  	// 200: someResponse
   163  	// 201: fileResponse
   164  	// 422: validationError
   165  	mountItem("GET", basePath+"/orders/:id", nil)
   166  
   167  	// swagger:route PUT /orders/{id} orders updateOrder
   168  	//
   169  	// Update the details for an order.
   170  	//
   171  	// When the order doesn't exist this will return an error.
   172  	//
   173  	// Consumes:
   174  	// application/json
   175  	// application/x-protobuf
   176  	//
   177  	// Produces:
   178  	// application/json
   179  	// application/x-protobuf
   180  	//
   181  	// Schemes: http, https, ws, wss
   182  	//
   183  	// Security:
   184  	// api_key:
   185  	// oauth: read, write
   186  	//
   187  	// Responses:
   188  	// default: genericError
   189  	// 200: someResponse
   190  	// 422: validationError
   191  	mountItem("PUT", basePath+"/orders/:id", nil)
   192  
   193  	// swagger:route DELETE /orders/{id} deleteOrder
   194  	//
   195  	// delete a particular order.
   196  	//
   197  	// Consumes:
   198  	// application/json
   199  	// application/x-protobuf
   200  	//
   201  	// Produces:
   202  	// application/json
   203  	// application/x-protobuf
   204  	//
   205  	// Schemes: http, https, ws, wss
   206  	//
   207  	// Security:
   208  	// api_key:
   209  	// oauth: read, write
   210  	//
   211  	// Responses:
   212  	// default: genericError
   213  	// 200: someResponse
   214  	// 202: description:Some description
   215  	// 422: validationError
   216  	mountItem("DELETE", basePath+"/orders/:id", nil)
   217  
   218  	return nil
   219  }
   220  
   221  // not really used but I need a method to decorate the calls to
   222  func mountItem(method, path string, handler interface{}) {}