MyApp

<back to all web services

QueryChinookEmployees

Media Store
The following routes are available for this service:
GET/employees
GET/employees/{EmployeeId}
#![allow(
    dead_code,
    non_camel_case_types,
    non_snake_case,
    clippy::upper_case_acronyms
)]

use serde::{Deserialize, Serialize};
use serde_json::Value;
use servicestack::*;
use std::collections::HashMap;

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct Employees {
    #[serde(rename = "employeeId")]
    pub employee_id: i64,
    // Required
    #[serde(rename = "lastName")]
    pub last_name: String,
    // Required
    #[serde(rename = "firstName")]
    pub first_name: String,
    pub title: String,
    #[serde(rename = "reportsTo")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub reports_to: Option<i64>,
    #[serde(rename = "birthDate")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub birth_date: Option<String>,
    #[serde(rename = "hireDate")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub hire_date: Option<String>,
    pub address: String,
    pub city: String,
    pub state: String,
    pub country: String,
    #[serde(rename = "postalCode")]
    pub postal_code: String,
    pub phone: String,
    pub fax: String,
    pub email: String,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct QueryChinookEmployees {
    #[serde(flatten)]
    pub query_db: QueryDb,
    #[serde(rename = "employeeId")]
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub employee_id: Option<i64>,
}

#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct Todo {
    pub id: i64,
    pub text: String,
    #[serde(rename = "isFinished")]
    pub is_finished: bool,
}

Rust QueryChinookEmployees DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /employees HTTP/1.1 
Host: blazor-gallery.servicestack.net 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	offset: 0,
	total: 0,
	results: 
	[
		{
			employeeId: 0,
			lastName: String,
			firstName: String,
			title: String,
			reportsTo: 0,
			birthDate: 0001-01-01,
			hireDate: 0001-01-01,
			address: String,
			city: String,
			state: String,
			country: String,
			postalCode: String,
			phone: String,
			fax: String,
			email: String
		}
	],
	meta: 
	{
		String: String
	},
	responseStatus: 
	{
		errorCode: String,
		message: String,
		stackTrace: String,
		errors: 
		[
			{
				errorCode: String,
				fieldName: String,
				message: String,
				meta: 
				{
					String: String
				}
			}
		],
		meta: 
		{
			String: String
		}
	}
}