wing328 4cb7f1d613 [Rust] add new Rust client generator (#6105)
* add rust generator (1st release)

* update based on feedback

* fix reserved keyword

* fix string parameter

* Convert String to &str in trait definition

* Only pass pathParams to uri builder

* Fixed the html escaping in return type

* Fixed the hashmap constructor

* Added models into API scope

* removed models subimport, reference from super

* update returntype in method signature

* Fixed the remaining templates inconsistencies

* Fixed issues that floated up in kubernetes swagger file

* add hash support, fix docstring

* fix map parameter, update api.mustache

* use baseName for parameter

* use fully-qualfiied model name

* add rust tests

* fix test cases

* Rust gen slightly more idiomatic (#6247)

* Go -> Rust in README

* Remove leftover go file in rust sample

* rust: Regenerate sample

* rust: Rename *Impl -> *Client

* rust: one-line use line

More in line with common style

* rust: Replace tabs (in java) with 4 spaces

* Added trivial getter implementation (#6249)

* update rust petstore samples
2017-08-06 16:59:08 +08:00

8.3 KiB

\PetApi

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
AddPet Post /pet Add a new pet to the store
DeletePet Delete /pet/{petId} Deletes a pet
FindPetsByStatus Get /pet/findByStatus Finds Pets by status
FindPetsByTags Get /pet/findByTags Finds Pets by tags
GetPetById Get /pet/{petId} Find pet by ID
UpdatePet Put /pet Update an existing pet
UpdatePetWithForm Post /pet/{petId} Updates a pet in the store with form data
UploadFile Post /pet/{petId}/uploadImage uploads an image

AddPet

AddPet(ctx, body) Add a new pet to the store

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
body Pet Pet object that needs to be added to the store

Return type

(empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeletePet

DeletePet(ctx, pet_id, optional) Deletes a pet

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
pet_id i64 Pet id to delete
optional map[string]interface{} optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a map[string]interface{}.

Name Type Description Notes
pet_id i64 Pet id to delete
api_key String

Return type

(empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

FindPetsByStatus

Vec<::models::Pet> FindPetsByStatus(ctx, status) Finds Pets by status

Multiple status values can be provided with comma separated strings

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
status Vec<String> Status values that need to be considered for filter

Return type

Vec<::models::Pet>

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

FindPetsByTags

Vec<::models::Pet> FindPetsByTags(ctx, tags) Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
tags Vec<String> Tags to filter by

Return type

Vec<::models::Pet>

Authorization

petstore_auth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPetById

::models::Pet GetPetById(ctx, pet_id) Find pet by ID

Returns a single pet

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
pet_id i64 ID of pet to return

Return type

::models::Pet

Authorization

api_key

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdatePet

UpdatePet(ctx, body) Update an existing pet

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
body Pet Pet object that needs to be added to the store

Return type

(empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/json, application/xml
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdatePetWithForm

UpdatePetWithForm(ctx, pet_id, optional) Updates a pet in the store with form data

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
pet_id i64 ID of pet that needs to be updated
optional map[string]interface{} optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a map[string]interface{}.

Name Type Description Notes
pet_id i64 ID of pet that needs to be updated
name String Updated name of the pet
status String Updated status of the pet

Return type

(empty response body)

Authorization

petstore_auth

HTTP request headers

  • Content-Type: application/x-www-form-urlencoded
  • Accept: application/xml, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UploadFile

::models::ApiResponse UploadFile(ctx, pet_id, optional) uploads an image

Required Parameters

Name Type Description Notes
ctx context.Context context containing the authentication nil if no authentication
pet_id i64 ID of pet to update
optional map[string]interface{} optional parameters nil if no parameters

Optional Parameters

Optional parameters are passed through a map[string]interface{}.

Name Type Description Notes
pet_id i64 ID of pet to update
additional_metadata String Additional data to pass to server
file File file to upload

Return type

::models::ApiResponse

Authorization

petstore_auth

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]