Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions samples/client/petstore/clojure/.swagger-codegen-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
63 changes: 2 additions & 61 deletions samples/client/petstore/clojure/src/swagger_petstore/api/pet.clj
Original file line number Diff line number Diff line change
Expand Up @@ -24,28 +24,6 @@
([optional-params]
(:data (add-pet-with-http-info optional-params))))

(defn add-pet-using-byte-array-with-http-info
"Fake endpoint to test byte array in body parameter for adding a new pet to the store
"
([] (add-pet-using-byte-array-with-http-info nil))
([{:keys [body ]}]
(call-api "/pet?testing_byte_array=true" :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-using-byte-array
"Fake endpoint to test byte array in body parameter for adding a new pet to the store
"
([] (add-pet-using-byte-array nil))
([optional-params]
(:data (add-pet-using-byte-array-with-http-info optional-params))))

(defn delete-pet-with-http-info
"Deletes a pet
"
Expand Down Expand Up @@ -120,52 +98,14 @@
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["api_key" "petstore_auth"]}))
:auth-names ["petstore_auth" "api_key"]}))

(defn get-pet-by-id
"Find pet by ID
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 get-pet-by-id-in-object-with-http-info
"Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(call-api "/pet/{petId}?response=inline_arbitrary_object" :get
{:path-params {"petId" pet-id }
:header-params {}
:query-params {}
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["api_key" "petstore_auth"]}))

(defn get-pet-by-id-in-object
"Fake endpoint to test inline arbitrary object return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(:data (get-pet-by-id-in-object-with-http-info pet-id)))

(defn pet-pet-idtesting-byte-arraytrue-get-with-http-info
"Fake endpoint to test byte array return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(call-api "/pet/{petId}?testing_byte_array=true" :get
{:path-params {"petId" pet-id }
:header-params {}
:query-params {}
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["api_key" "petstore_auth"]}))

(defn pet-pet-idtesting-byte-arraytrue-get
"Fake endpoint to test byte array return by 'Find pet by ID'
Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions"
[pet-id ]
(:data (pet-pet-idtesting-byte-arraytrue-get-with-http-info pet-id)))

(defn update-pet-with-http-info
"Update an existing pet
"
Expand Down Expand Up @@ -229,3 +169,4 @@
([pet-id ] (upload-file pet-id nil))
([pet-id optional-params]
(:data (upload-file-with-http-info pet-id optional-params))))

45 changes: 3 additions & 42 deletions samples/client/petstore/clojure/src/swagger_petstore/api/store.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,6 @@
[order-id ]
(:data (delete-order-with-http-info order-id)))

(defn find-orders-by-status-with-http-info
"Finds orders by status
A single status value can be provided as a string"
([] (find-orders-by-status-with-http-info nil))
([{:keys [status ]}]
(call-api "/store/findByStatus" :get
{:path-params {}
:header-params {}
:query-params {"status" status }
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["test_api_client_id" "test_api_client_secret"]})))

(defn find-orders-by-status
"Finds orders by status
A single status value can be provided as a string"
([] (find-orders-by-status nil))
([optional-params]
(:data (find-orders-by-status-with-http-info optional-params))))

(defn get-inventory-with-http-info
"Returns pet inventories by status
Returns a map of status codes to quantities"
Expand All @@ -61,25 +40,6 @@
[]
(:data (get-inventory-with-http-info)))

(defn get-inventory-in-object-with-http-info
"Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually a map of status codes to quantities"
[]
(call-api "/store/inventory?response=arbitrary_object" :get
{:path-params {}
:header-params {}
:query-params {}
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["api_key"]}))

(defn get-inventory-in-object
"Fake endpoint to test arbitrary object return by 'Get inventory'
Returns an arbitrary object which is actually a map of status codes to quantities"
[]
(:data (get-inventory-in-object-with-http-info)))

(defn get-order-by-id-with-http-info
"Find purchase order by ID
For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions"
Expand All @@ -91,7 +51,7 @@
:form-params {}
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["test_api_key_header" "test_api_key_query"]}))
:auth-names []}))

(defn get-order-by-id
"Find purchase order by ID
Expand All @@ -112,11 +72,12 @@
:body-param body
:content-types []
:accepts ["application/json" "application/xml"]
:auth-names ["test_api_client_id" "test_api_client_secret"]})))
:auth-names []})))

(defn place-order
"Place an order for a pet
"
([] (place-order nil))
([optional-params]
(:data (place-order-with-http-info optional-params))))

Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,4 @@
([username ] (update-user username nil))
([username optional-params]
(:data (update-user-with-http-info username optional-params))))

16 changes: 4 additions & 12 deletions samples/client/petstore/clojure/src/swagger_petstore/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,17 @@
(java.text SimpleDateFormat)))

(def auth-definitions
{"test_api_key_header" {:type :api-key :in :header :param-name "test_api_key_header"}
"api_key" {:type :api-key :in :header :param-name "api_key"}
"test_api_client_secret" {:type :api-key :in :header :param-name "x-test_api_client_secret"}
"test_api_client_id" {:type :api-key :in :header :param-name "x-test_api_client_id"}
"test_api_key_query" {:type :api-key :in :query :param-name "test_api_key_query"}
"petstore_auth" {:type :oauth2}})
{"api_key" {:type :api-key :in :header :param-name "api_key"}"petstore_auth" {:type :oauth2}
})

(def default-api-context
"Default API context."
{:base-url "http://petstore.swagger.io/v2"
:date-format "yyyy-MM-dd"
:datetime-format "yyyy-MM-dd'T'HH:mm:ss.SSSXXX"
:debug false
:auths {"test_api_key_header" nil
"api_key" nil
"test_api_client_secret" nil
"test_api_client_id" nil
"test_api_key_query" nil
"petstore_auth" nil}})
:auths {"api_key" nil"petstore_auth" nil
}})

(def ^:dynamic *api-context*
"Dynamic API context to be applied in API calls."
Expand Down