jinxapi_github/types.rs
1
2pub enum Sort<'sort> {
3 Default,
4 Ascending(&'sort str),
5 Descending(&'sort str),
6}
7
8impl<'sort> Default for Sort<'sort> {
9 fn default() -> Self {
10 Sort::Default
11 }
12}
13
14impl<'sort> Sort<'sort> {
15 pub fn extract(&self) -> (Option<&str>, Option<&str>) {
16 match self {
17 Sort::Default => (None, None),
18 Sort::Ascending(sort) => (Some(sort), Some("asc")),
19 Sort::Descending(sort) => (Some(sort), Some("desc"))
20 }
21 }
22}
23
24#[derive(Default)]
25pub struct IssueFilter<'filter> {
26 /// Indicates which sorts of issues to return. Can be one of:
27 /// * `assigned`: Issues assigned to you
28 /// * `created`: Issues created by you
29 /// * `mentioned`: Issues mentioning you
30 /// * `subscribed`: Issues you're subscribed to updates for
31 /// * `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation
32 pub filter: ::std::option::Option<&'filter str>,
33 /// Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`.
34 pub state: ::std::option::Option<&'filter str>,
35 /// A list of comma separated label names. Example: `bug,ui,@high`
36 pub labels: ::std::option::Option<&'filter str>,
37 /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`.
38 pub since: ::std::option::Option<&'filter str>,
39}