Skip to main content

cp_cli_platform_codechef/
lib.rs

1//! Bounded public CodeChef access through public profile HTML and Discuss JSON
2
3mod client;
4mod error;
5
6pub use client::Client;
7pub use error::Error;
8
9#[derive(Debug, PartialEq, Eq)]
10pub struct DiscussionList {
11    pub discussions: Vec<DiscussionSummary>,
12}
13
14#[derive(Debug, PartialEq, Eq)]
15pub struct DiscussionSummary {
16    pub id: u32,
17    pub title: Box<str>,
18    pub slug: Box<str>,
19    pub author: Option<Box<str>>,
20    pub created_at: Box<str>,
21    pub activity_at: Box<str>,
22    pub views: Option<u32>,
23    pub posts: u32,
24    pub like_count: u32,
25    pub url: Box<str>,
26}
27
28#[derive(Debug, PartialEq, Eq)]
29pub struct Discussion {
30    pub summary: DiscussionSummary,
31    /// Public Discourse cooked HTML, which callers must sanitize before rendering
32    pub body_html: Box<str>,
33}
34
35/// Public fields rendered on a CodeChef user profile
36#[derive(Debug, PartialEq, Eq)]
37pub struct UserStats {
38    pub handle: Box<str>,
39    pub name: Box<str>,
40    pub solved: u32,
41    pub rating: Option<u32>,
42    pub highest_rating: Option<u32>,
43    pub contests: Option<u32>,
44    pub url: Box<str>,
45}
46
47#[cfg(test)]
48mod tests;