Skip to main content

Service

Struct Service 

Source
pub struct Service { /* private fields */ }
Expand description

The machine’s GitHub, read through the mirror and written through GitHub.

Implementations§

Source§

impl Service

Source

pub fn new(mirror: Mirror) -> Self

Source

pub fn mirror(&self) -> &Mirror

Source

pub fn issues(&self, repos: &[String], wanted: IssueState) -> Outcome<IssueList>

Every mirrored issue of these repositories.

Source

pub fn list(&self, scope: &Scope) -> Outcome<Listed>

A list scope as it stands.

Source

pub fn single(&self, scope: &Scope) -> Outcome<Single>

A single-document scope as it stands.

Source

pub fn overview( &self, repositories: &[Repository], ) -> Outcome<BTreeMap<String, RepoFacts>>

What the mirror knows about each repository of a checkout, in one read.

Source

pub fn gists(&self) -> Outcome<Listed>

The person’s gists. Summaries until one is opened.

Source

pub async fn gist( &self, client: Option<&GitHubClient>, id: &str, ) -> Outcome<GistAnswer>

One gist with its file contents.

The mirror answers when it holds the whole gist. Often it does not — the list endpoint omits file contents — and opening one is the moment where reaching GitHub is right: a person is waiting for exactly this, and what comes back is stored, so the next open is instant.

Source

pub async fn comments( &self, client: Option<&GitHubClient>, repo: &str, number: i64, ) -> Outcome<Listed>

Comments on an issue or pull request.

Opening a thread is what puts it in the sweep: a thread nobody opened is not worth a request per sweep. The first open reads it now, when a token is there to read with; after that the mirror answers.

Source

pub async fn create_issue( &self, client: &GitHubClient, owner: &str, repo: &str, request: &CreateIssueRequest, ) -> Outcome<GitHubIssue>

Source

pub async fn update_issue( &self, client: &GitHubClient, owner: &str, repo: &str, number: i64, request: &UpdateIssueRequest, ) -> Outcome<GitHubIssue>

Source

pub async fn add_comment( &self, client: &GitHubClient, owner: &str, repo: &str, number: i64, body: &str, ) -> Outcome<GitHubComment>

Source

pub async fn create_gist( &self, client: &GitHubClient, request: &CreateGistRequest, ) -> Outcome<Value>

Source

pub async fn update_gist( &self, client: &GitHubClient, id: &str, request: &UpdateGistRequest, ) -> Outcome<Value>

Source

pub fn boards(&self, references: &[BoardRef]) -> Outcome<BoardList>

The boards a project references, as the mirror knows them.

Source

pub fn cards(&self, board: &str) -> Outcome<Cards>

One board’s cards, in TODAY’S shape.

Every card is parsed into the type this version defines: a row an older version wrote takes the defaults of the fields it did not have, and a payload that does not parse AT ALL is raised — half a board is the silent wrong answer.

Source

pub async fn refresh_board( &self, client: &GitHubClient, board: &GitHubProject, force: bool, ) -> SyncReport

Bring one board current before it is shown: its owner’s board list, then its cards, each if due — or whether due or not, with force.

Source

pub async fn set_field( &self, client: &GitHubClient, board: &str, item: &str, field: &str, value: Option<&ProjectFieldWrite>, ) -> Outcome<GitHubProjectItem>

Set one field of one card, or take its value off with None.

Clearing is its own act rather than an empty value: an empty text IS a value, and a board that could not tell “no due date” from “a due date of nothing” shows a column of blanks where it means to show none.

Source

pub async fn move_card( &self, client: &GitHubClient, board: &str, item: &str, after: Option<&str>, ) -> Outcome<GitHubProjectItem>

Order a card: behind after, or first with None.

Source

pub async fn set_archived( &self, client: &GitHubClient, board: &str, item: &str, archived: bool, ) -> Outcome<GitHubProjectItem>

Archive a card, or bring it back. Stated rather than toggled: a toggle acts on what the caller last saw.

Source

pub async fn edit_draft( &self, client: &GitHubClient, board: &str, item: &str, content: &str, title: &str, body: &str, ) -> Outcome<GitHubProjectItem>

Rewrite a draft card’s title and body, whole.

Source

pub async fn add_draft( &self, client: &GitHubClient, board: &str, title: &str, body: &str, ) -> Outcome<GitHubProjectItem>

A card that lives only on the board.

Source

pub async fn add_existing( &self, client: &GitHubClient, board: &str, url: &str, ) -> Outcome<GitHubProjectItem>

A card for an issue or pull request that already exists, by its URL.

Source

pub async fn remove_card( &self, client: &GitHubClient, board: &str, item: &str, ) -> Outcome<()>

Take a card off the board. The issue itself is untouched — a board owns cards, not issues — and a draft has nowhere else to be.

Source

pub async fn add_column( &self, client: &GitHubClient, board: &str, field: &str, name: &str, color: &str, description: &str, ) -> Outcome<(GitHubProject, Vec<GitHubProjectItem>)>

Add a column to a board’s single-select field.

Source

pub async fn remove_column( &self, client: &GitHubClient, board: &str, field: &str, option: &str, ) -> Outcome<(GitHubProject, Vec<GitHubProjectItem>)>

Remove a column. GitHub clears that value from affected cards; every card is read again before the mirror changes, so they land in no column.

Trait Implementations§

Source§

impl Clone for Service

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Service

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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