Skip to main content

GoogleClient

Struct GoogleClient 

Source
pub struct GoogleClient {
    pub docs: Docs<Connector>,
    pub drive: DriveHub<Connector>,
}
Expand description

Bundled Google Docs and Drive hubs backed by one authenticator.

Fields§

§docs: Docs<Connector>

Google Docs API hub (documents.create / get / batchUpdate).

§drive: DriveHub<Connector>

Google Drive API hub (comments.list / update).

Implementations§

Source§

impl GoogleClient

Source

pub fn new<A: GetToken + Clone + 'static>(auth: A) -> Result<Self>

Build both hubs from an authenticator, targeting the default Google roots.

Generic over the authenticator so production passes the crate::auth::GoogleAuthenticator while tests can pass any GetToken (e.g. a String static token).

§Errors

Returns crate::error::Error::Auth when the HTTPS connector cannot be constructed.

Source

pub fn set_base_url(&mut self, base_url: &str)

Point both hubs at base_url instead of the live Google endpoints.

The generated call builders construct request URLs from each hub’s _base_url, so the override must target that field (not root_url). A trailing / is ensured because the builders append the path directly. Used by mockito tests to assert request shapes without network access (OVR-3 CI tier).

Source§

impl GoogleClient

Source

pub async fn create_document(&self, title: &str) -> Result<DocumentRef>

Create a blank document titled title and return its DocumentRef.

§Errors

Returns Error::Google on API failure, or when the response omits a document id.

Source

pub async fn document_end_index(&self, document_id: &str) -> Result<u32>

Fetch the document’s end index (UTF-16 code units), operating on the first/legacy tab (DI-6).

§Errors

Returns Error::Google on API failure, or Error::MultipleTabs when the document exposes more than one tab.

Source

pub async fn batch_update( &self, document_id: &str, requests: Vec<Request>, ) -> Result<()>

Apply requests to the document in a single batchUpdate.

An empty request list is a no-op (the API rejects empty batches).

§Errors

Returns Error::Google on API failure.

Source§

impl GoogleClient

Source

pub async fn list_comments(&self, file_id: &str) -> Result<Vec<Comment>>

List every comment on the document, following pagination, mapped to the domain Comment model. Comments lacking an id are dropped (they cannot be merged or resolved).

§Errors

Returns crate::error::Error::Google on API failure.

Source

pub async fn resolve_comment( &self, file_id: &str, comment_id: &str, ) -> Result<()>

Resolve a single comment via comments.update {resolved:true} (DI-4).

§Errors

Returns crate::error::Error::Google on API failure.

Source

pub async fn resolve_comments( &self, file_id: &str, comment_ids: &[String], ) -> Vec<(String, Result<()>)>

Resolve many comments, isolating failures so one failed call never aborts the rest (DI-4). Returns each comment id paired with its own outcome.

Source

pub async fn create_reply( &self, file_id: &str, comment_id: &str, content: &str, ) -> Result<String>

Post a reply to an existing comment via replies.create, returning the new reply’s id.

Unlike anchored top-level comments (which the API cannot create with a usable anchor — D1, hence DI-4’s “never create comments”), a reply carries no anchor: it inherits its parent comment’s. Creating replies is therefore both supported by the API and outside DI-4’s prohibition.

§Errors

Returns crate::error::Error::Google on API failure, or when the response omits a reply id.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more