pub struct LinearClient { /* private fields */ }Expand description
Async client for the Linear GraphQL API.
Cheap to clone (an Arc around the connection pool); build one per
process and clone it across tasks.
Implementations§
Source§impl LinearClient
impl LinearClient
Sourcepub fn builder() -> LinearClientBuilder
pub fn builder() -> LinearClientBuilder
Starts building a client.
Sourcepub fn new(api_key: impl Into<SecretString>) -> Result<Self>
pub fn new(api_key: impl Into<SecretString>) -> Result<Self>
Builds a client with all defaults and the given API key.
Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Builds a client from the LINEAR_API_KEY environment variable.
Fails with Error::Config when unset.
Sourcepub fn last_rate_limit(&self) -> Option<RateLimitInfo>
pub fn last_rate_limit(&self) -> Option<RateLimitInfo>
The most recent rate-limit budget snapshot observed on any response.
Sourcepub async fn execute_raw(
&self,
document: &str,
variables: Value,
) -> Result<Value>
pub async fn execute_raw( &self, document: &str, variables: Value, ) -> Result<Value>
Escape hatch: executes an arbitrary GraphQL document and returns the
raw data value. Uses the same error classification as typed calls
and is treated as a query for retry purposes — do not send
non-idempotent mutations through it unless you can dedupe.
Source§impl LinearClient
impl LinearClient
Sourcepub async fn organization(&self) -> Result<Organization>
pub async fn organization(&self) -> Result<Organization>
Fetches the workspace the API key belongs to.
Source§impl LinearClient
impl LinearClient
Sourcepub fn comments(&self) -> CommentsService<'_>
pub fn comments(&self) -> CommentsService<'_>
Comment operations: read an issue’s thread, create, update, delete.
let comments = client.comments();Source§impl LinearClient
impl LinearClient
Sourcepub fn issues(&self) -> IssuesService<'_>
pub fn issues(&self) -> IssuesService<'_>
Issue operations: CRUD, list/search, batch create, and label convenience mutations.
let client = linear_api::LinearClient::from_env()?;
let issue = client
.issues()
.get(linear_api::IssueRef::identifier("ENG-123"))
.await?;
println!("{}: {}", issue.identifier, issue.title);Source§impl LinearClient
impl LinearClient
Sourcepub fn labels(&self) -> LabelsService<'_>
pub fn labels(&self) -> LabelsService<'_>
Issue label operations: listing, CRUD, and find-or-create.
§Example
let client = linear_api::LinearClient::from_env()?;
let labels = client.labels().list(Default::default()).await?;Source§impl LinearClient
impl LinearClient
Sourcepub fn projects(&self) -> ProjectsService<'_>
pub fn projects(&self) -> ProjectsService<'_>
Projects, project statuses, and project milestones.
let client = linear_api::LinearClient::from_env()?;
let statuses = client.projects().statuses().await?;Source§impl LinearClient
impl LinearClient
Sourcepub fn relations(&self) -> RelationsService<'_>
pub fn relations(&self) -> RelationsService<'_>
Issue-relation operations (blocks/blocked-by DAG edges).
§Examples
let client = linear_api::LinearClient::from_env()?;
let relations = client
.relations()
.of_issue(linear_api::IssueRef::identifier("ENG-3"))
.await?;Source§impl LinearClient
impl LinearClient
Sourcepub fn teams(&self) -> TeamsService<'_>
pub fn teams(&self) -> TeamsService<'_>
Teams: list, get, and per-team workflow states.
§Example
let client = linear_api::LinearClient::from_env()?;
let page = client.teams().list(Default::default()).await?;
for team in &page.nodes {
println!("{}: {}", team.key, team.name);
}Sourcepub fn users(&self) -> UsersService<'_>
pub fn users(&self) -> UsersService<'_>
Users: list and get workspace members.
§Example
let client = linear_api::LinearClient::from_env()?;
let page = client.users().list(Default::default()).await?;
println!("{} users on the first page", page.nodes.len());Sourcepub fn workflow_states(&self) -> WorkflowStatesService<'_>
pub fn workflow_states(&self) -> WorkflowStatesService<'_>
Workflow states (issue statuses) across the workspace.
For the states of one team, prefer TeamsService::states.
§Example
let client = linear_api::LinearClient::from_env()?;
let page = client.workflow_states().list(Default::default()).await?;
println!("{} states on the first page", page.nodes.len());Trait Implementations§
Source§impl Clone for LinearClient
impl Clone for LinearClient
Source§fn clone(&self) -> LinearClient
fn clone(&self) -> LinearClient
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more