/samples/client/petstore/dart2/petstore_client_lib/doc/PetApi.md

https://github.com/OpenAPITools/openapi-generator · Markdown · 379 lines · 259 code · 120 blank · 0 comment · 0 complexity · ac4b4ce41873625ffa049858e85557db MD5 · raw file

  1. # openapi.api.PetApi
  2. ## Load the API package
  3. ```dart
  4. import 'package:openapi/api.dart';
  5. ```
  6. All URIs are relative to *http://petstore.swagger.io/v2*
  7. Method | HTTP request | Description
  8. ------------- | ------------- | -------------
  9. [**addPet**](PetApi.md#addPet) | **POST** /pet | Add a new pet to the store
  10. [**deletePet**](PetApi.md#deletePet) | **DELETE** /pet/{petId} | Deletes a pet
  11. [**findPetsByStatus**](PetApi.md#findPetsByStatus) | **GET** /pet/findByStatus | Finds Pets by status
  12. [**findPetsByTags**](PetApi.md#findPetsByTags) | **GET** /pet/findByTags | Finds Pets by tags
  13. [**getPetById**](PetApi.md#getPetById) | **GET** /pet/{petId} | Find pet by ID
  14. [**updatePet**](PetApi.md#updatePet) | **PUT** /pet | Update an existing pet
  15. [**updatePetWithForm**](PetApi.md#updatePetWithForm) | **POST** /pet/{petId} | Updates a pet in the store with form data
  16. [**uploadFile**](PetApi.md#uploadFile) | **POST** /pet/{petId}/uploadImage | uploads an image
  17. # **addPet**
  18. > addPet(body)
  19. Add a new pet to the store
  20. ### Example
  21. ```dart
  22. import 'package:openapi/api.dart';
  23. // TODO Configure OAuth2 access token for authorization: petstore_auth
  24. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  25. var api_instance = PetApi();
  26. var body = Pet(); // Pet | Pet object that needs to be added to the store
  27. try {
  28. api_instance.addPet(body);
  29. } catch (e) {
  30. print("Exception when calling PetApi->addPet: $e\n");
  31. }
  32. ```
  33. ### Parameters
  34. Name | Type | Description | Notes
  35. ------------- | ------------- | ------------- | -------------
  36. **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
  37. ### Return type
  38. void (empty response body)
  39. ### Authorization
  40. [petstore_auth](../README.md#petstore_auth)
  41. ### HTTP request headers
  42. - **Content-Type**: application/json, application/xml
  43. - **Accept**: Not defined
  44. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  45. # **deletePet**
  46. > deletePet(petId, apiKey)
  47. Deletes a pet
  48. ### Example
  49. ```dart
  50. import 'package:openapi/api.dart';
  51. // TODO Configure OAuth2 access token for authorization: petstore_auth
  52. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  53. var api_instance = PetApi();
  54. var petId = 789; // int | Pet id to delete
  55. var apiKey = apiKey_example; // String |
  56. try {
  57. api_instance.deletePet(petId, apiKey);
  58. } catch (e) {
  59. print("Exception when calling PetApi->deletePet: $e\n");
  60. }
  61. ```
  62. ### Parameters
  63. Name | Type | Description | Notes
  64. ------------- | ------------- | ------------- | -------------
  65. **petId** | **int**| Pet id to delete |
  66. **apiKey** | **String**| | [optional]
  67. ### Return type
  68. void (empty response body)
  69. ### Authorization
  70. [petstore_auth](../README.md#petstore_auth)
  71. ### HTTP request headers
  72. - **Content-Type**: Not defined
  73. - **Accept**: Not defined
  74. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  75. # **findPetsByStatus**
  76. > List<Pet> findPetsByStatus(status)
  77. Finds Pets by status
  78. Multiple status values can be provided with comma separated strings
  79. ### Example
  80. ```dart
  81. import 'package:openapi/api.dart';
  82. // TODO Configure OAuth2 access token for authorization: petstore_auth
  83. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  84. var api_instance = PetApi();
  85. var status = []; // List<String> | Status values that need to be considered for filter
  86. try {
  87. var result = api_instance.findPetsByStatus(status);
  88. print(result);
  89. } catch (e) {
  90. print("Exception when calling PetApi->findPetsByStatus: $e\n");
  91. }
  92. ```
  93. ### Parameters
  94. Name | Type | Description | Notes
  95. ------------- | ------------- | ------------- | -------------
  96. **status** | [**List&lt;String&gt;**](String.md)| Status values that need to be considered for filter | [default to const []]
  97. ### Return type
  98. [**List<Pet>**](Pet.md)
  99. ### Authorization
  100. [petstore_auth](../README.md#petstore_auth)
  101. ### HTTP request headers
  102. - **Content-Type**: Not defined
  103. - **Accept**: application/xml, application/json
  104. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  105. # **findPetsByTags**
  106. > List<Pet> findPetsByTags(tags)
  107. Finds Pets by tags
  108. Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
  109. ### Example
  110. ```dart
  111. import 'package:openapi/api.dart';
  112. // TODO Configure OAuth2 access token for authorization: petstore_auth
  113. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  114. var api_instance = PetApi();
  115. var tags = []; // List<String> | Tags to filter by
  116. try {
  117. var result = api_instance.findPetsByTags(tags);
  118. print(result);
  119. } catch (e) {
  120. print("Exception when calling PetApi->findPetsByTags: $e\n");
  121. }
  122. ```
  123. ### Parameters
  124. Name | Type | Description | Notes
  125. ------------- | ------------- | ------------- | -------------
  126. **tags** | [**List&lt;String&gt;**](String.md)| Tags to filter by | [default to const []]
  127. ### Return type
  128. [**List<Pet>**](Pet.md)
  129. ### Authorization
  130. [petstore_auth](../README.md#petstore_auth)
  131. ### HTTP request headers
  132. - **Content-Type**: Not defined
  133. - **Accept**: application/xml, application/json
  134. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  135. # **getPetById**
  136. > Pet getPetById(petId)
  137. Find pet by ID
  138. Returns a single pet
  139. ### Example
  140. ```dart
  141. import 'package:openapi/api.dart';
  142. // TODO Configure API key authorization: api_key
  143. //defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
  144. // uncomment below to setup prefix (e.g. Bearer) for API key, if needed
  145. //defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
  146. var api_instance = PetApi();
  147. var petId = 789; // int | ID of pet to return
  148. try {
  149. var result = api_instance.getPetById(petId);
  150. print(result);
  151. } catch (e) {
  152. print("Exception when calling PetApi->getPetById: $e\n");
  153. }
  154. ```
  155. ### Parameters
  156. Name | Type | Description | Notes
  157. ------------- | ------------- | ------------- | -------------
  158. **petId** | **int**| ID of pet to return |
  159. ### Return type
  160. [**Pet**](Pet.md)
  161. ### Authorization
  162. [api_key](../README.md#api_key)
  163. ### HTTP request headers
  164. - **Content-Type**: Not defined
  165. - **Accept**: application/xml, application/json
  166. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  167. # **updatePet**
  168. > updatePet(body)
  169. Update an existing pet
  170. ### Example
  171. ```dart
  172. import 'package:openapi/api.dart';
  173. // TODO Configure OAuth2 access token for authorization: petstore_auth
  174. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  175. var api_instance = PetApi();
  176. var body = Pet(); // Pet | Pet object that needs to be added to the store
  177. try {
  178. api_instance.updatePet(body);
  179. } catch (e) {
  180. print("Exception when calling PetApi->updatePet: $e\n");
  181. }
  182. ```
  183. ### Parameters
  184. Name | Type | Description | Notes
  185. ------------- | ------------- | ------------- | -------------
  186. **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store |
  187. ### Return type
  188. void (empty response body)
  189. ### Authorization
  190. [petstore_auth](../README.md#petstore_auth)
  191. ### HTTP request headers
  192. - **Content-Type**: application/json, application/xml
  193. - **Accept**: Not defined
  194. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  195. # **updatePetWithForm**
  196. > updatePetWithForm(petId, name, status)
  197. Updates a pet in the store with form data
  198. ### Example
  199. ```dart
  200. import 'package:openapi/api.dart';
  201. // TODO Configure OAuth2 access token for authorization: petstore_auth
  202. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  203. var api_instance = PetApi();
  204. var petId = 789; // int | ID of pet that needs to be updated
  205. var name = name_example; // String | Updated name of the pet
  206. var status = status_example; // String | Updated status of the pet
  207. try {
  208. api_instance.updatePetWithForm(petId, name, status);
  209. } catch (e) {
  210. print("Exception when calling PetApi->updatePetWithForm: $e\n");
  211. }
  212. ```
  213. ### Parameters
  214. Name | Type | Description | Notes
  215. ------------- | ------------- | ------------- | -------------
  216. **petId** | **int**| ID of pet that needs to be updated |
  217. **name** | **String**| Updated name of the pet | [optional]
  218. **status** | **String**| Updated status of the pet | [optional]
  219. ### Return type
  220. void (empty response body)
  221. ### Authorization
  222. [petstore_auth](../README.md#petstore_auth)
  223. ### HTTP request headers
  224. - **Content-Type**: application/x-www-form-urlencoded
  225. - **Accept**: Not defined
  226. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
  227. # **uploadFile**
  228. > ApiResponse uploadFile(petId, additionalMetadata, file)
  229. uploads an image
  230. ### Example
  231. ```dart
  232. import 'package:openapi/api.dart';
  233. // TODO Configure OAuth2 access token for authorization: petstore_auth
  234. //defaultApiClient.getAuthentication<OAuth>('petstore_auth').accessToken = 'YOUR_ACCESS_TOKEN';
  235. var api_instance = PetApi();
  236. var petId = 789; // int | ID of pet to update
  237. var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server
  238. var file = BINARY_DATA_HERE; // MultipartFile | file to upload
  239. try {
  240. var result = api_instance.uploadFile(petId, additionalMetadata, file);
  241. print(result);
  242. } catch (e) {
  243. print("Exception when calling PetApi->uploadFile: $e\n");
  244. }
  245. ```
  246. ### Parameters
  247. Name | Type | Description | Notes
  248. ------------- | ------------- | ------------- | -------------
  249. **petId** | **int**| ID of pet to update |
  250. **additionalMetadata** | **String**| Additional data to pass to server | [optional]
  251. **file** | **MultipartFile**| file to upload | [optional]
  252. ### Return type
  253. [**ApiResponse**](ApiResponse.md)
  254. ### Authorization
  255. [petstore_auth](../README.md#petstore_auth)
  256. ### HTTP request headers
  257. - **Content-Type**: multipart/form-data
  258. - **Accept**: application/json
  259. [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)