mirror of
https://github.com/jlengrand/openapi-generator.git
synced 2026-05-17 08:31:23 +00:00
* Use the right package name for the Rust crate. * Change getters on models to return Option for non-required fields. * Cleanup Rust generation and get example compiling again. * Use underscore names for functions.
189 lines
3.9 KiB
Rust
189 lines
3.9 KiB
Rust
/*
|
|
* Swagger Petstore
|
|
*
|
|
* 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.
|
|
*
|
|
* OpenAPI spec version: 1.0.0
|
|
* Contact: apiteam@swagger.io
|
|
* Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
*/
|
|
|
|
/// User : A User who is purchasing from the pet store
|
|
|
|
#[derive(Debug, Serialize, Deserialize)]
|
|
pub struct User {
|
|
#[serde(rename = "id")]
|
|
id: Option<i64>,
|
|
#[serde(rename = "username")]
|
|
username: Option<String>,
|
|
#[serde(rename = "firstName")]
|
|
first_name: Option<String>,
|
|
#[serde(rename = "lastName")]
|
|
last_name: Option<String>,
|
|
#[serde(rename = "email")]
|
|
email: Option<String>,
|
|
#[serde(rename = "password")]
|
|
password: Option<String>,
|
|
#[serde(rename = "phone")]
|
|
phone: Option<String>,
|
|
/// User Status
|
|
#[serde(rename = "userStatus")]
|
|
user_status: Option<i32>
|
|
}
|
|
|
|
impl User {
|
|
/// A User who is purchasing from the pet store
|
|
pub fn new() -> User {
|
|
User {
|
|
id: None,
|
|
username: None,
|
|
first_name: None,
|
|
last_name: None,
|
|
email: None,
|
|
password: None,
|
|
phone: None,
|
|
user_status: None
|
|
}
|
|
}
|
|
|
|
pub fn set_id(&mut self, id: i64) {
|
|
self.id = Some(id);
|
|
}
|
|
|
|
pub fn with_id(mut self, id: i64) -> User {
|
|
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_username(&mut self, username: String) {
|
|
self.username = Some(username);
|
|
}
|
|
|
|
pub fn with_username(mut self, username: String) -> User {
|
|
self.username = Some(username);
|
|
self
|
|
}
|
|
|
|
pub fn username(&self) -> Option<&String> {
|
|
self.username.as_ref()
|
|
}
|
|
|
|
pub fn reset_username(&mut self) {
|
|
self.username = None;
|
|
}
|
|
|
|
pub fn set_first_name(&mut self, first_name: String) {
|
|
self.first_name = Some(first_name);
|
|
}
|
|
|
|
pub fn with_first_name(mut self, first_name: String) -> User {
|
|
self.first_name = Some(first_name);
|
|
self
|
|
}
|
|
|
|
pub fn first_name(&self) -> Option<&String> {
|
|
self.first_name.as_ref()
|
|
}
|
|
|
|
pub fn reset_first_name(&mut self) {
|
|
self.first_name = None;
|
|
}
|
|
|
|
pub fn set_last_name(&mut self, last_name: String) {
|
|
self.last_name = Some(last_name);
|
|
}
|
|
|
|
pub fn with_last_name(mut self, last_name: String) -> User {
|
|
self.last_name = Some(last_name);
|
|
self
|
|
}
|
|
|
|
pub fn last_name(&self) -> Option<&String> {
|
|
self.last_name.as_ref()
|
|
}
|
|
|
|
pub fn reset_last_name(&mut self) {
|
|
self.last_name = None;
|
|
}
|
|
|
|
pub fn set_email(&mut self, email: String) {
|
|
self.email = Some(email);
|
|
}
|
|
|
|
pub fn with_email(mut self, email: String) -> User {
|
|
self.email = Some(email);
|
|
self
|
|
}
|
|
|
|
pub fn email(&self) -> Option<&String> {
|
|
self.email.as_ref()
|
|
}
|
|
|
|
pub fn reset_email(&mut self) {
|
|
self.email = None;
|
|
}
|
|
|
|
pub fn set_password(&mut self, password: String) {
|
|
self.password = Some(password);
|
|
}
|
|
|
|
pub fn with_password(mut self, password: String) -> User {
|
|
self.password = Some(password);
|
|
self
|
|
}
|
|
|
|
pub fn password(&self) -> Option<&String> {
|
|
self.password.as_ref()
|
|
}
|
|
|
|
pub fn reset_password(&mut self) {
|
|
self.password = None;
|
|
}
|
|
|
|
pub fn set_phone(&mut self, phone: String) {
|
|
self.phone = Some(phone);
|
|
}
|
|
|
|
pub fn with_phone(mut self, phone: String) -> User {
|
|
self.phone = Some(phone);
|
|
self
|
|
}
|
|
|
|
pub fn phone(&self) -> Option<&String> {
|
|
self.phone.as_ref()
|
|
}
|
|
|
|
pub fn reset_phone(&mut self) {
|
|
self.phone = None;
|
|
}
|
|
|
|
pub fn set_user_status(&mut self, user_status: i32) {
|
|
self.user_status = Some(user_status);
|
|
}
|
|
|
|
pub fn with_user_status(mut self, user_status: i32) -> User {
|
|
self.user_status = Some(user_status);
|
|
self
|
|
}
|
|
|
|
pub fn user_status(&self) -> Option<&i32> {
|
|
self.user_status.as_ref()
|
|
}
|
|
|
|
pub fn reset_user_status(&mut self) {
|
|
self.user_status = None;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|