Skip to content

Commit

Permalink
Add some documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
blachniet committed Nov 17, 2022
1 parent 3e4be45 commit d8a4ae7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/api.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
//! Low-level client for interacting with the [Toggl API](https://developers.track.toggl.com/docs/).

use chrono::NaiveDate;
use reqwest::header;
use serde::{Deserialize, Serialize};
use serde_json::Number;

static BASE_API_URL: &str = "https://api.track.toggl.com/api/v9";

/// Low-level client for interacting with the [Toggl API](https://developers.track.toggl.com/docs/).
pub struct Client {
c: reqwest::blocking::Client,
token: String,
}

impl Client {
/// Creates a new client with the given API token.
pub fn new(token: String) -> Result<Self, reqwest::Error> {
let mut headers = header::HeaderMap::new();

Expand Down
4 changes: 4 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
//! Defines the error type for top-level CLI commands.

/// Error type for top-level CLI commands.
#[derive(Debug)]
pub struct Error {
pub message: String,
}

impl Error {
/// Creates a new entry with the given message.
pub fn new(message: String) -> Self {
Self { message }
}
Expand Down
2 changes: 2 additions & 0 deletions src/svc.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! High-level client for interacting with Toggl. Uses the [api].

use crate::api;
use chrono::{DateTime, Duration, TimeZone, Utc};

Expand Down

0 comments on commit d8a4ae7

Please sign in to comment.