Benoît Courtine f4eb96933a [Rust] Client library choice between hyper and reqwest (#1258)
* Port of PR https://github.com/swagger-api/swagger-codegen/pull/8804.

* Correction of conflict with PR #528 (missing template file).

* Add rust-reqwest samples to Circle CI tests.

* Add integration test pom.xml file with launcher to trigger cargo execution.

* Deduplicate Maven project name.

* Fix "api_key" header for Petstore.

* Better API key management.

* Fix query param for lists of objects other than strings (numbers, etc.).

* Update to reqwest 0.9, and refactor of header management (using reqwest transition feature).

* Merge scripts generating rust-hyper and rust-reqwest samples.

* Consistent full stops.

* Use raw variables in all Rust mustache templates.

* Replace production build in CI with a quick simple check.

* Update samples.

* Finish Reqwest 0.9 migration (removing "hyper 0.11" transition feature).

* Configuration implements Default trait.

* API template reorganized: HashMap is not required anymore.

* Revert "Merge scripts generating rust-hyper and rust-reqwest samples."

This reverts commit 970f996566a740045f2a986fd70fc70f11952925.

* Remove deprecated "-XX:MaxPermSize" java arg.
2018-10-26 10:24:14 +01:00

146 lines
2.8 KiB
Rust

/*
* OpenAPI Petstore
*
* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.
*
* OpenAPI spec version: 1.0.0
*
* Generated by: https://openapi-generator.tech
*/
/// Pet : A pet for sale in the pet store
#[allow(unused_imports)]
use serde_json::Value;
#[derive(Debug, Serialize, Deserialize)]
pub struct Pet {
#[serde(rename = "id")]
id: Option<i64>,
#[serde(rename = "category")]
category: Option<::models::Category>,
#[serde(rename = "name")]
name: String,
#[serde(rename = "photoUrls")]
photo_urls: Vec<String>,
#[serde(rename = "tags")]
tags: Option<Vec<::models::Tag>>,
/// pet status in the store
#[serde(rename = "status")]
status: Option<String>
}
impl Pet {
/// A pet for sale in the pet store
pub fn new(name: String, photo_urls: Vec<String>) -> Pet {
Pet {
id: None,
category: None,
name: name,
photo_urls: photo_urls,
tags: None,
status: None
}
}
pub fn set_id(&mut self, id: i64) {
self.id = Some(id);
}
pub fn with_id(mut self, id: i64) -> Pet {
self.id = Some(id);
self
}
pub fn id(&self) -> Option<&i64> {
self.id.as_ref()
}
pub fn reset_id(&mut self) {
self.id = None;
}
pub fn set_category(&mut self, category: ::models::Category) {
self.category = Some(category);
}
pub fn with_category(mut self, category: ::models::Category) -> Pet {
self.category = Some(category);
self
}
pub fn category(&self) -> Option<&::models::Category> {
self.category.as_ref()
}
pub fn reset_category(&mut self) {
self.category = None;
}
pub fn set_name(&mut self, name: String) {
self.name = name;
}
pub fn with_name(mut self, name: String) -> Pet {
self.name = name;
self
}
pub fn name(&self) -> &String {
&self.name
}
pub fn set_photo_urls(&mut self, photo_urls: Vec<String>) {
self.photo_urls = photo_urls;
}
pub fn with_photo_urls(mut self, photo_urls: Vec<String>) -> Pet {
self.photo_urls = photo_urls;
self
}
pub fn photo_urls(&self) -> &Vec<String> {
&self.photo_urls
}
pub fn set_tags(&mut self, tags: Vec<::models::Tag>) {
self.tags = Some(tags);
}
pub fn with_tags(mut self, tags: Vec<::models::Tag>) -> Pet {
self.tags = Some(tags);
self
}
pub fn tags(&self) -> Option<&Vec<::models::Tag>> {
self.tags.as_ref()
}
pub fn reset_tags(&mut self) {
self.tags = None;
}
pub fn set_status(&mut self, status: String) {
self.status = Some(status);
}
pub fn with_status(mut self, status: String) -> Pet {
self.status = Some(status);
self
}
pub fn status(&self) -> Option<&String> {
self.status.as_ref()
}
pub fn reset_status(&mut self) {
self.status = None;
}
}