pub struct Service { /* private fields */ }Expand description
The machine’s GitHub, read through the mirror and written through GitHub.
Implementations§
Source§impl Service
impl Service
pub fn new(mirror: Mirror) -> Self
pub fn mirror(&self) -> &Mirror
Sourcepub fn issues(&self, repos: &[String], wanted: IssueState) -> Outcome<IssueList>
pub fn issues(&self, repos: &[String], wanted: IssueState) -> Outcome<IssueList>
Every mirrored issue of these repositories.
Sourcepub fn overview(
&self,
repositories: &[Repository],
) -> Outcome<BTreeMap<String, RepoFacts>>
pub fn overview( &self, repositories: &[Repository], ) -> Outcome<BTreeMap<String, RepoFacts>>
What the mirror knows about each repository of a checkout, in one read.
Sourcepub async fn gist(
&self,
client: Option<&GitHubClient>,
id: &str,
) -> Outcome<GistAnswer>
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.
Sourcepub async fn comments(
&self,
client: Option<&GitHubClient>,
repo: &str,
number: i64,
) -> Outcome<Listed>
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.
pub async fn create_issue( &self, client: &GitHubClient, owner: &str, repo: &str, request: &CreateIssueRequest, ) -> Outcome<GitHubIssue>
pub async fn update_issue( &self, client: &GitHubClient, owner: &str, repo: &str, number: i64, request: &UpdateIssueRequest, ) -> Outcome<GitHubIssue>
pub async fn add_comment( &self, client: &GitHubClient, owner: &str, repo: &str, number: i64, body: &str, ) -> Outcome<GitHubComment>
pub async fn create_gist( &self, client: &GitHubClient, request: &CreateGistRequest, ) -> Outcome<Value>
pub async fn update_gist( &self, client: &GitHubClient, id: &str, request: &UpdateGistRequest, ) -> Outcome<Value>
Sourcepub fn boards(&self, references: &[BoardRef]) -> Outcome<BoardList>
pub fn boards(&self, references: &[BoardRef]) -> Outcome<BoardList>
The boards a project references, as the mirror knows them.
Sourcepub fn cards(&self, board: &str) -> Outcome<Cards>
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.
Sourcepub async fn refresh_board(
&self,
client: &GitHubClient,
board: &GitHubProject,
force: bool,
) -> SyncReport
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.
Sourcepub async fn set_field(
&self,
client: &GitHubClient,
board: &str,
item: &str,
field: &str,
value: Option<&ProjectFieldWrite>,
) -> Outcome<GitHubProjectItem>
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.
Sourcepub async fn move_card(
&self,
client: &GitHubClient,
board: &str,
item: &str,
after: Option<&str>,
) -> Outcome<GitHubProjectItem>
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.
Sourcepub async fn set_archived(
&self,
client: &GitHubClient,
board: &str,
item: &str,
archived: bool,
) -> Outcome<GitHubProjectItem>
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.
Sourcepub async fn edit_draft(
&self,
client: &GitHubClient,
board: &str,
item: &str,
content: &str,
title: &str,
body: &str,
) -> Outcome<GitHubProjectItem>
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.
Sourcepub async fn add_draft(
&self,
client: &GitHubClient,
board: &str,
title: &str,
body: &str,
) -> Outcome<GitHubProjectItem>
pub async fn add_draft( &self, client: &GitHubClient, board: &str, title: &str, body: &str, ) -> Outcome<GitHubProjectItem>
A card that lives only on the board.
Sourcepub async fn add_existing(
&self,
client: &GitHubClient,
board: &str,
url: &str,
) -> Outcome<GitHubProjectItem>
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.
Sourcepub async fn remove_card(
&self,
client: &GitHubClient,
board: &str,
item: &str,
) -> Outcome<()>
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.
Sourcepub async fn add_column(
&self,
client: &GitHubClient,
board: &str,
field: &str,
name: &str,
color: &str,
description: &str,
) -> Outcome<(GitHubProject, Vec<GitHubProjectItem>)>
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.
Sourcepub async fn remove_column(
&self,
client: &GitHubClient,
board: &str,
field: &str,
option: &str,
) -> Outcome<(GitHubProject, Vec<GitHubProjectItem>)>
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.