update clojure petstore cient

This commit is contained in:
wing328 2017-05-27 00:33:49 +08:00
parent b1ccaf69ac
commit 999f901d2b
4 changed files with 149 additions and 130 deletions

View File

@ -1,5 +1,5 @@
(defproject swagger-petstore "1.0.0"
:description "This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters."
:description "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters"
:license {:name "Apache 2.0"
:url "http://www.apache.org/licenses/LICENSE-2.0.html"}
:dependencies [[org.clojure/clojure "1.7.0"]

View File

@ -5,22 +5,24 @@
(defn add-pet-with-http-info
"Add a new pet to the store
"
[body ]
(call-api "/pet" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types ["application/json" "application/xml"]
:accepts ["application/xml" "application/json"]
:auth-names ["petstore_auth"]}))
([] (add-pet-with-http-info nil))
([{:keys [body ]}]
(call-api "/pet" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types ["application/json" "application/xml"]
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn add-pet
"Add a new pet to the store
"
[body ]
(:data (add-pet-with-http-info body)))
([] (add-pet nil))
([optional-params]
(:data (add-pet-with-http-info optional-params))))
(defn delete-pet-with-http-info
"Deletes a pet
@ -33,7 +35,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn delete-pet
@ -46,44 +48,48 @@
(defn find-pets-by-status-with-http-info
"Finds Pets by status
Multiple status values can be provided with comma separated strings"
[status ]
(call-api "/pet/findByStatus" :get
{:path-params {}
:header-params {}
:query-params {"status" (with-collection-format status :csv) }
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names ["petstore_auth"]}))
([] (find-pets-by-status-with-http-info nil))
([{:keys [status ]}]
(call-api "/pet/findByStatus" :get
{:path-params {}
:header-params {}
:query-params {"status" (with-collection-format status :multi) }
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn find-pets-by-status
"Finds Pets by status
Multiple status values can be provided with comma separated strings"
[status ]
(:data (find-pets-by-status-with-http-info status)))
([] (find-pets-by-status nil))
([optional-params]
(:data (find-pets-by-status-with-http-info optional-params))))
(defn find-pets-by-tags-with-http-info
"Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."
[tags ]
(call-api "/pet/findByTags" :get
{:path-params {}
:header-params {}
:query-params {"tags" (with-collection-format tags :csv) }
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names ["petstore_auth"]}))
([] (find-pets-by-tags-with-http-info nil))
([{:keys [tags ]}]
(call-api "/pet/findByTags" :get
{:path-params {}
:header-params {}
:query-params {"tags" (with-collection-format tags :multi) }
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn find-pets-by-tags
"Finds Pets by tags
Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing."
[tags ]
(:data (find-pets-by-tags-with-http-info tags)))
([] (find-pets-by-tags nil))
([optional-params]
(:data (find-pets-by-tags-with-http-info optional-params))))
(defn get-pet-by-id-with-http-info
"Find pet by ID
Returns a single pet"
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(call-api "/pet/{petId}" :get
{:path-params {"petId" pet-id }
@ -91,35 +97,36 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["api_key" "petstore_auth"]}))
(defn get-pet-by-id
"Find pet by ID
Returns a single pet"
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(:data (get-pet-by-id-with-http-info pet-id)))
(defn update-pet-with-http-info
"Update an existing pet
"
[body ]
(call-api "/pet" :put
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types ["application/json" "application/xml"]
:accepts ["application/xml" "application/json"]
:auth-names ["petstore_auth"]}))
([] (update-pet-with-http-info nil))
([{:keys [body ]}]
(call-api "/pet" :put
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types ["application/json" "application/xml"]
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn update-pet
"Update an existing pet
"
[body ]
(:data (update-pet-with-http-info body)))
([] (update-pet nil))
([optional-params]
(:data (update-pet-with-http-info optional-params))))
(defn update-pet-with-form-with-http-info
"Updates a pet in the store with form data
@ -132,7 +139,7 @@
:query-params {}
:form-params {"name" name "status" status }
:content-types ["application/x-www-form-urlencoded"]
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn update-pet-with-form
@ -153,7 +160,7 @@
:query-params {}
:form-params {"additionalMetadata" additional-metadata "file" file }
:content-types ["multipart/form-data"]
:accepts ["application/json"]
:accepts ["application/json" "application/xml"]
:auth-names ["petstore_auth"]})))
(defn upload-file

View File

@ -12,7 +12,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names []}))
(defn delete-order
@ -31,7 +31,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/json"]
:accepts ["application/json" "application/xml"]
:auth-names ["api_key"]}))
(defn get-inventory
@ -50,7 +50,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names []}))
(defn get-order-by-id
@ -62,20 +62,22 @@
(defn place-order-with-http-info
"Place an order for a pet
"
[body ]
(call-api "/store/order" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names []}))
([] (place-order-with-http-info nil))
([{:keys [body ]}]
(call-api "/store/order" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names []})))
(defn place-order
"Place an order for a pet
"
[body ]
(:data (place-order-with-http-info body)))
([] (place-order nil))
([optional-params]
(:data (place-order-with-http-info optional-params))))

View File

@ -5,62 +5,68 @@
(defn create-user-with-http-info
"Create user
This can only be done by the logged in user."
[body ]
(call-api "/user" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names []}))
([] (create-user-with-http-info nil))
([{:keys [body ]}]
(call-api "/user" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names []})))
(defn create-user
"Create user
This can only be done by the logged in user."
[body ]
(:data (create-user-with-http-info body)))
([] (create-user nil))
([optional-params]
(:data (create-user-with-http-info optional-params))))
(defn create-users-with-array-input-with-http-info
"Creates list of users with given input array
"
[body ]
(call-api "/user/createWithArray" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names []}))
([] (create-users-with-array-input-with-http-info nil))
([{:keys [body ]}]
(call-api "/user/createWithArray" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names []})))
(defn create-users-with-array-input
"Creates list of users with given input array
"
[body ]
(:data (create-users-with-array-input-with-http-info body)))
([] (create-users-with-array-input nil))
([optional-params]
(:data (create-users-with-array-input-with-http-info optional-params))))
(defn create-users-with-list-input-with-http-info
"Creates list of users with given input array
"
[body ]
(call-api "/user/createWithList" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names []}))
([] (create-users-with-list-input-with-http-info nil))
([{:keys [body ]}]
(call-api "/user/createWithList" :post
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names []})))
(defn create-users-with-list-input
"Creates list of users with given input array
"
[body ]
(:data (create-users-with-list-input-with-http-info body)))
([] (create-users-with-list-input nil))
([optional-params]
(:data (create-users-with-list-input-with-http-info optional-params))))
(defn delete-user-with-http-info
"Delete user
@ -72,7 +78,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names []}))
(defn delete-user
@ -91,7 +97,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names []}))
(defn get-user-by-name
@ -103,21 +109,23 @@
(defn login-user-with-http-info
"Logs user into the system
"
[username password ]
(call-api "/user/login" :get
{:path-params {}
:header-params {}
:query-params {"username" username "password" password }
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names []}))
([] (login-user-with-http-info nil))
([{:keys [username password ]}]
(call-api "/user/login" :get
{:path-params {}
:header-params {}
:query-params {"username" username "password" password }
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names []})))
(defn login-user
"Logs user into the system
"
[username password ]
(:data (login-user-with-http-info username password)))
([] (login-user nil))
([optional-params]
(:data (login-user-with-http-info optional-params))))
(defn logout-user-with-http-info
"Logs out current logged in user session
@ -129,7 +137,7 @@
:query-params {}
:form-params {}
:content-types []
:accepts ["application/xml" "application/json"]
:accepts ["application/json" "application/xml"]
:auth-names []}))
(defn logout-user
@ -141,20 +149,22 @@
(defn update-user-with-http-info
"Updated user
This can only be done by the logged in user."
[username body ]
(call-api "/user/{username}" :put
{:path-params {"username" username }
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/xml" "application/json"]
:auth-names []}))
([username ] (update-user-with-http-info username nil))
([username {:keys [body ]}]
(call-api "/user/{username}" :put
{:path-params {"username" username }
:header-params {}
:query-params {}
:form-params {}
:body-param body
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names []})))
(defn update-user
"Updated user
This can only be done by the logged in user."
[username body ]
(:data (update-user-with-http-info username body)))
([username ] (update-user username nil))
([username optional-params]
(:data (update-user-with-http-info username optional-params))))