Struct octocrab::OctocrabBuilder
source · pub struct OctocrabBuilder<Svc, Config, Auth, LayerReady> { /* private fields */ }
Expand description
A builder struct for Octocrab
, allowing you to configure the client, such
as using GitHub previews, the github instance, authentication, etc.
let octocrab = octocrab::OctocrabBuilder::default()
.add_preview("machine-man")
.base_uri("https://github.example.com")?
.build()?;
A builder struct for Octocrab
.
OctocrabBuilder can be extended with a custom config, see DefaultOctocrabBuilderConfig for an example
Implementations§
source§impl<Config, Auth> OctocrabBuilder<NoSvc, Config, Auth, NotLayerReady>
impl<Config, Auth> OctocrabBuilder<NoSvc, Config, Auth, NotLayerReady>
pub fn with_service<Svc>( self, service: Svc ) -> OctocrabBuilder<Svc, Config, Auth, LayerReady>
source§impl<Svc, Config, Auth, B> OctocrabBuilder<Svc, Config, Auth, LayerReady>
impl<Svc, Config, Auth, B> OctocrabBuilder<Svc, Config, Auth, LayerReady>
sourcepub fn with_layer<L: Layer<Svc>>(
self,
layer: &L
) -> OctocrabBuilder<L::Service, Config, Auth, LayerReady>
pub fn with_layer<L: Layer<Svc>>( self, layer: &L ) -> OctocrabBuilder<L::Service, Config, Auth, LayerReady>
source§impl<Svc, B, LayerState> OctocrabBuilder<Svc, NoConfig, AuthState, LayerState>
impl<Svc, B, LayerState> OctocrabBuilder<Svc, NoConfig, AuthState, LayerState>
source§impl<Svc, Config, LayerState> OctocrabBuilder<Svc, Config, NoAuth, LayerState>
impl<Svc, Config, LayerState> OctocrabBuilder<Svc, Config, NoAuth, LayerState>
pub fn with_auth<Auth>( self, auth: Auth ) -> OctocrabBuilder<Svc, Config, Auth, LayerState>
source§impl OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
impl OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
pub fn add_retry_config(&mut self, retry_config: RetryConfig) -> &mut Self
sourcepub fn set_connect_timeout(self, timeout: Option<Duration>) -> Self
pub fn set_connect_timeout(self, timeout: Option<Duration>) -> Self
Set the connect timeout.
sourcepub fn set_read_timeout(self, timeout: Option<Duration>) -> Self
pub fn set_read_timeout(self, timeout: Option<Duration>) -> Self
Set the read timeout.
sourcepub fn set_write_timeout(self, timeout: Option<Duration>) -> Self
pub fn set_write_timeout(self, timeout: Option<Duration>) -> Self
Set the write timeout.
sourcepub fn add_preview(self, preview: &'static str) -> Self
pub fn add_preview(self, preview: &'static str) -> Self
Enable a GitHub preview.
sourcepub fn add_header(self, key: HeaderName, value: String) -> Self
pub fn add_header(self, key: HeaderName, value: String) -> Self
Add an additional header to include with every request.
sourcepub fn personal_token(self, token: String) -> Self
pub fn personal_token(self, token: String) -> Self
Add a personal token to use for authentication.
sourcepub fn app(self, app_id: AppId, key: EncodingKey) -> Self
pub fn app(self, app_id: AppId, key: EncodingKey) -> Self
Authenticate as a Github App.
key
: RSA private key in DER or PEM formats.
sourcepub fn basic_auth(self, username: String, password: String) -> Self
pub fn basic_auth(self, username: String, password: String) -> Self
Authenticate as a Basic Auth username and password
sourcepub fn user_access_token(self, token: String) -> Self
pub fn user_access_token(self, token: String) -> Self
Authenticate with a user access token.
sourcepub fn base_uri(self, base_uri: impl TryInto<Uri>) -> Result<Self>
pub fn base_uri(self, base_uri: impl TryInto<Uri>) -> Result<Self>
Set the base url for Octocrab
.
pub fn set_connector_retry_service<S>( &self, connector: Client<S, String> ) -> Retry<RetryConfig, Client<S, String>>
pub fn set_connect_timeout_service<T>( &self, connector: T ) -> TimeoutConnector<T>
Trait Implementations§
source§impl Default for OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
impl Default for OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
source§fn default(
) -> OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
fn default( ) -> OctocrabBuilder<NoSvc, DefaultOctocrabBuilderConfig, NoAuth, NotLayerReady>
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl<Svc, Config, Auth, LayerReady> RefUnwindSafe for OctocrabBuilder<Svc, Config, Auth, LayerReady>
impl<Svc, Config, Auth, LayerReady> Send for OctocrabBuilder<Svc, Config, Auth, LayerReady>
impl<Svc, Config, Auth, LayerReady> Sync for OctocrabBuilder<Svc, Config, Auth, LayerReady>
impl<Svc, Config, Auth, LayerReady> Unpin for OctocrabBuilder<Svc, Config, Auth, LayerReady>
impl<Svc, Config, Auth, LayerReady> UnwindSafe for OctocrabBuilder<Svc, Config, Auth, LayerReady>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more