github.com/djarvur/go-swagger@v0.18.0/examples/todo-list/client/todos/todos_client.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package todos 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "github.com/go-openapi/runtime" 10 11 strfmt "github.com/go-openapi/strfmt" 12 ) 13 14 // New creates a new todos API client. 15 func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 return &Client{transport: transport, formats: formats} 17 } 18 19 /* 20 Client for todos API 21 */ 22 type Client struct { 23 transport runtime.ClientTransport 24 formats strfmt.Registry 25 } 26 27 /* 28 AddOne add one API 29 */ 30 func (a *Client) AddOne(params *AddOneParams, authInfo runtime.ClientAuthInfoWriter) (*AddOneCreated, error) { 31 // TODO: Validate the params before sending 32 if params == nil { 33 params = NewAddOneParams() 34 } 35 36 result, err := a.transport.Submit(&runtime.ClientOperation{ 37 ID: "addOne", 38 Method: "POST", 39 PathPattern: "/", 40 ProducesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 41 ConsumesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 42 Schemes: []string{"http", "https"}, 43 Params: params, 44 Reader: &AddOneReader{formats: a.formats}, 45 AuthInfo: authInfo, 46 Context: params.Context, 47 Client: params.HTTPClient, 48 }) 49 if err != nil { 50 return nil, err 51 } 52 return result.(*AddOneCreated), nil 53 54 } 55 56 /* 57 DestroyOne destroy one API 58 */ 59 func (a *Client) DestroyOne(params *DestroyOneParams, authInfo runtime.ClientAuthInfoWriter) (*DestroyOneNoContent, error) { 60 // TODO: Validate the params before sending 61 if params == nil { 62 params = NewDestroyOneParams() 63 } 64 65 result, err := a.transport.Submit(&runtime.ClientOperation{ 66 ID: "destroyOne", 67 Method: "DELETE", 68 PathPattern: "/{id}", 69 ProducesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 70 ConsumesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 71 Schemes: []string{"http", "https"}, 72 Params: params, 73 Reader: &DestroyOneReader{formats: a.formats}, 74 AuthInfo: authInfo, 75 Context: params.Context, 76 Client: params.HTTPClient, 77 }) 78 if err != nil { 79 return nil, err 80 } 81 return result.(*DestroyOneNoContent), nil 82 83 } 84 85 /* 86 Find find API 87 */ 88 func (a *Client) Find(params *FindParams, authInfo runtime.ClientAuthInfoWriter) (*FindOK, error) { 89 // TODO: Validate the params before sending 90 if params == nil { 91 params = NewFindParams() 92 } 93 94 result, err := a.transport.Submit(&runtime.ClientOperation{ 95 ID: "find", 96 Method: "GET", 97 PathPattern: "/", 98 ProducesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 99 ConsumesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 100 Schemes: []string{"http", "https"}, 101 Params: params, 102 Reader: &FindReader{formats: a.formats}, 103 AuthInfo: authInfo, 104 Context: params.Context, 105 Client: params.HTTPClient, 106 }) 107 if err != nil { 108 return nil, err 109 } 110 return result.(*FindOK), nil 111 112 } 113 114 /* 115 UpdateOne update one API 116 */ 117 func (a *Client) UpdateOne(params *UpdateOneParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateOneOK, error) { 118 // TODO: Validate the params before sending 119 if params == nil { 120 params = NewUpdateOneParams() 121 } 122 123 result, err := a.transport.Submit(&runtime.ClientOperation{ 124 ID: "updateOne", 125 Method: "PUT", 126 PathPattern: "/{id}", 127 ProducesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 128 ConsumesMediaTypes: []string{"application/io.swagger.examples.todo-list.v1+json"}, 129 Schemes: []string{"http", "https"}, 130 Params: params, 131 Reader: &UpdateOneReader{formats: a.formats}, 132 AuthInfo: authInfo, 133 Context: params.Context, 134 Client: params.HTTPClient, 135 }) 136 if err != nil { 137 return nil, err 138 } 139 return result.(*UpdateOneOK), nil 140 141 } 142 143 // SetTransport changes the transport on the client 144 func (a *Client) SetTransport(transport runtime.ClientTransport) { 145 a.transport = transport 146 }