| GET | /todos |
|---|
#![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 Todo {
pub id: i64,
pub text: String,
#[serde(rename = "isFinished")]
pub is_finished: bool,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Default)]
#[serde(default)]
pub struct QueryTodos {
#[serde(flatten)]
pub query_data: QueryData,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub id: Option<i32>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub ids: Option<Vec<i64>>,
#[serde(rename = "textContains")]
#[serde(default, skip_serializing_if = "Option::is_none")]
pub text_contains: Option<String>,
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /todos HTTP/1.1 Host: blazor-gallery.servicestack.net Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"offset":0,"total":0,"results":[{"id":0,"text":"String","isFinished":false}],"meta":{"String":"String"},"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}