pub struct CommentsService<'a> { /* private fields */ }Expand description
Comment operations, obtained via LinearClient::comments.
let client = linear_api::LinearClient::from_env()?;
let comment = client
.comments()
.create_on(linear_api::IssueRef::identifier("ENG-123"), "On it.")
.await?;
println!("created {}", comment.url);Implementations§
Source§impl<'a> CommentsService<'a>
impl<'a> CommentsService<'a>
Sourcepub async fn list_for_issue(
&self,
issue: impl Into<IssueRef>,
req: CommentListRequest,
) -> Result<Page<Comment>>
pub async fn list_for_issue( &self, issue: impl Into<IssueRef>, req: CommentListRequest, ) -> Result<Page<Comment>>
Fetches one page of an issue’s comment thread
(issue(id:) { comments }).
For the “latest N comments” pattern pass first: N on the request;
ordering follows Linear’s default connection order (createdAt).
use linear_api::IssueRef;
use linear_api::comments::CommentListRequest;
let page = client
.comments()
.list_for_issue(
IssueRef::identifier("ENG-123"),
CommentListRequest::builder().first(5).build(),
)
.await?;Sourcepub fn list_for_issue_stream(
&self,
issue: impl Into<IssueRef>,
req: CommentListRequest,
) -> impl Stream<Item = Result<Comment>> + 'a
pub fn list_for_issue_stream( &self, issue: impl Into<IssueRef>, req: CommentListRequest, ) -> impl Stream<Item = Result<Comment>> + 'a
Lazily streams an issue’s whole comment thread across pages via
paginate.
req.first controls the page size; a pre-set req.after seeds the
first page’s cursor.
use futures::TryStreamExt;
use linear_api::IssueRef;
use linear_api::comments::CommentListRequest;
let comments: Vec<_> = client
.comments()
.list_for_issue_stream(
IssueRef::identifier("ENG-123"),
CommentListRequest::builder().build(),
)
.try_collect()
.await?;Sourcepub async fn create(&self, input: CommentCreateInput) -> Result<Comment>
pub async fn create(&self, input: CommentCreateInput) -> Result<Comment>
Creates a comment (commentCreate). Thread replies via
parent_id.
use linear_api::comments::CommentCreateInput;
let comment = client
.comments()
.create(
CommentCreateInput::builder()
.issue_id("ENG-123")
.body("Run finished: all green.".to_owned())
.build(),
)
.await?;Sourcepub async fn create_on(
&self,
issue: impl Into<IssueRef>,
body: impl Into<String>,
) -> Result<Comment>
pub async fn create_on( &self, issue: impl Into<IssueRef>, body: impl Into<String>, ) -> Result<Comment>
Convenience: creates a plain markdown comment on an issue.
use linear_api::IssueRef;
client
.comments()
.create_on(IssueRef::identifier("ENG-123"), "On it.")
.await?;Trait Implementations§
Source§impl<'a> Clone for CommentsService<'a>
impl<'a> Clone for CommentsService<'a>
Source§fn clone(&self) -> CommentsService<'a>
fn clone(&self) -> CommentsService<'a>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<'a> Copy for CommentsService<'a>
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for CommentsService<'a>
impl<'a> !UnwindSafe for CommentsService<'a>
impl<'a> Freeze for CommentsService<'a>
impl<'a> Send for CommentsService<'a>
impl<'a> Sync for CommentsService<'a>
impl<'a> Unpin for CommentsService<'a>
impl<'a> UnsafeUnpin for CommentsService<'a>
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