pub struct GithubApiClient {
pub event_name: String,
pub debug_enabled: bool,
/* private fields */
}Available on crate feature
github only.Expand description
A structure to work with Github REST API.
Fields§
§event_name: StringThe name of the event that was triggered when running cpp_linter.
debug_enabled: boolThe value of the ACTIONS_STEP_DEBUG environment variable.
Implementations§
Source§impl GithubApiClient
impl GithubApiClient
Sourcepub fn new() -> Result<Self, RestClientError>
pub fn new() -> Result<Self, RestClientError>
Instantiate a GithubApiClient object.
Sourcepub async fn update_comment(
&self,
url: Url,
options: ThreadCommentOptions,
) -> Result<(), RestClientError>
pub async fn update_comment( &self, url: Url, options: ThreadCommentOptions, ) -> Result<(), RestClientError>
Update existing comment or remove old comment(s) and post a new comment
Trait Implementations§
Source§impl RestApiClient for GithubApiClient
impl RestApiClient for GithubApiClient
Source§fn start_log_group(name: &str)
fn start_log_group(name: &str)
This prints a line to indicate the beginning of a related group of log statements.
For apps’ log implementations, this function’s log::info output needs to have
no prefixed data.
Such behavior can be identified by the log target "CI_LOG_GROUPING".
impl log::Log for MyAppLogger {
fn log(&self, record: &log::Record) {
if record.target() == "CI_LOG_GROUPING" {
println!("{}", record.args());
} else {
println!(
"[{:>5}]{}: {}",
record.level().as_str(),
record.module_path().unwrap_or_default(),
record.args()
);
}
}
}Source§fn end_log_group()
fn end_log_group()
This prints a line to indicate the ending of a related group of log statements.
See also GithubApiClient::start_log_group about special handling of
the log target "CI_LOG_GROUPING".
Source§fn make_headers() -> Result<HeaderMap<HeaderValue>, RestClientError>
fn make_headers() -> Result<HeaderMap<HeaderValue>, RestClientError>
A convenience method to create the headers attached to all REST API calls. Read more
Source§async fn post_thread_comment(
&self,
options: ThreadCommentOptions,
) -> Result<(), RestClientError>
async fn post_thread_comment( &self, options: ThreadCommentOptions, ) -> Result<(), RestClientError>
A way to post feedback to the Git server’s GUI. Read more
Source§fn is_pr_event(&self) -> bool
fn is_pr_event(&self) -> bool
Is the current CI event trigger a Pull Request? Read more
Source§fn append_step_summary(comment: &str) -> Result<(), RestClientError>
fn append_step_summary(comment: &str) -> Result<(), RestClientError>
Appends a given comment to the CI workflow’s summary page. Read more
Source§fn write_output_variables(
vars: &[OutputVariable],
) -> Result<(), RestClientError>
fn write_output_variables( vars: &[OutputVariable], ) -> Result<(), RestClientError>
Sets the given
vars as output variables. Read moreSource§async fn get_list_of_changed_files(
&self,
file_filter: &FileFilter,
lines_changed_only: &LinesChangedOnly,
) -> Result<HashMap<String, FileDiffLines>, RestClientError>
async fn get_list_of_changed_files( &self, file_filter: &FileFilter, lines_changed_only: &LinesChangedOnly, ) -> Result<HashMap<String, FileDiffLines>, RestClientError>
Available on crate feature
file-changes only.A way to get the list of changed files in the context of the CI event. Read more
Source§fn make_api_request(
client: &Client,
url: impl IntoUrl,
method: Method,
data: Option<String>,
headers: Option<HeaderMap>,
) -> Result<Request, RestClientError>
fn make_api_request( client: &Client, url: impl IntoUrl, method: Method, data: Option<String>, headers: Option<HeaderMap>, ) -> Result<Request, RestClientError>
Construct a HTTP request to be sent. Read more
Source§fn try_next_page(headers: &HeaderMap) -> Option<Url>
fn try_next_page(headers: &HeaderMap) -> Option<Url>
Gets the URL for the next page from the headers in a paginated response. Read more
fn log_response( response: Response, context: &str, ) -> impl Future<Output = ()> + Send
Auto Trait Implementations§
impl Freeze for GithubApiClient
impl !RefUnwindSafe for GithubApiClient
impl Send for GithubApiClient
impl Sync for GithubApiClient
impl Unpin for GithubApiClient
impl !UnwindSafe for GithubApiClient
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