Skip to content

Commit

Permalink
feat: add methods to builder for changing timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrichardrinehart committed Dec 1, 2023
1 parent 551871a commit 10479e0
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,27 @@ impl OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
self
}

/// Set the connect timeout.
#[cfg(feature = "timeout")]
pub fn set_connect_timeout(mut self, timeout: Option<Duration>) -> &mut Self {
self.config.connect_timeout = timeout;
self
}

/// Set the read timeout.
#[cfg(feature = "timeout")]
pub fn set_read_timeout(mut self, timeout: Option<Duration>) -> &mut Self {
self.config.read_timeout = timeout;
self
}

/// Set the write timeout.
#[cfg(feature = "timeout")]
pub fn set_write_timeout(mut self, timeout: Option<Duration>) -> &mut Self {
self.config.write_timeout = timeout;
self
}

/// Enable a GitHub preview.
pub fn add_preview(mut self, preview: &'static str) -> Self {
self.config.previews.push(preview);
Expand Down

0 comments on commit 10479e0

Please sign in to comment.