Skip to main content

cp_cli_platform_hackerrank/
lib.rs

1//! Public HackerRank Community API client
2
3mod client;
4mod error;
5
6pub use client::Client;
7pub use error::Error;
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq)]
10pub enum Difficulty {
11    Easy,
12    Medium,
13    Hard,
14    Other,
15}
16
17#[derive(Debug, PartialEq, Eq)]
18pub struct Track {
19    pub slug: Box<str>,
20    pub name: Box<str>,
21    pub domain_slug: Box<str>,
22    pub domain_name: Box<str>,
23}
24
25#[derive(Debug, PartialEq, Eq)]
26pub struct ProblemSummary {
27    pub id: u64,
28    pub slug: Box<str>,
29    pub title: Box<str>,
30    pub difficulty: Difficulty,
31    pub preview: Option<Box<str>>,
32    pub track: Option<Track>,
33}
34
35#[derive(Debug, PartialEq, Eq)]
36pub struct ProblemList {
37    pub total: u32,
38    pub problems: Vec<ProblemSummary>,
39}
40
41#[derive(Debug, PartialEq, Eq)]
42pub struct Problem {
43    pub summary: ProblemSummary,
44    /// Public HackerRank source text, which callers must render as untrusted Markdown-like content
45    pub statement: Box<str>,
46    /// Public HackerRank source text, which callers must render as untrusted Markdown-like content
47    pub input_format: Box<str>,
48    /// Public HackerRank source text, which callers must render as untrusted Markdown-like content
49    pub output_format: Box<str>,
50    /// Supported HackerRank language keys
51    pub languages: Vec<Box<str>>,
52    /// Public starter source supplied by HackerRank for a language
53    pub starters: Vec<Starter>,
54    /// Public sample input/output pairs when HackerRank includes them
55    pub samples: Vec<Sample>,
56    /// Whether HackerRank marks the challenge test cases as public
57    pub has_public_test_cases: bool,
58}
59
60#[derive(Debug, PartialEq, Eq)]
61pub struct Starter {
62    pub language: Box<str>,
63    pub template: Box<str>,
64}
65
66#[derive(Debug, PartialEq, Eq)]
67pub struct Sample {
68    pub input: Box<str>,
69    pub output: Box<str>,
70}
71
72/// Public profile fields HackerRank exposes without an authenticated session
73#[derive(Debug, PartialEq, Eq)]
74pub struct Profile {
75    pub id: u64,
76    pub username: Box<str>,
77    pub name: Option<Box<str>>,
78    pub country: Option<Box<str>>,
79    pub level: Option<u32>,
80    pub event_count: Option<u32>,
81    pub created_at: Option<Box<str>>,
82}
83
84#[cfg(test)]
85mod tests;