From 404ea805bed145303a2772a39d65c639a0b3aea9 Mon Sep 17 00:00:00 2001 From: Niel Drummond Date: Tue, 3 Aug 2021 06:59:10 +0100 Subject: [PATCH] Update from upstream --- README.md | 2 +- src/endpoints/actions.rs | 114 ++- src/endpoints/activity.rs | 68 +- src/endpoints/apps.rs | 398 ++++++++++- src/endpoints/checks.rs | 16 +- src/endpoints/code_scanning.rs | 12 +- src/endpoints/codes_of_conduct.rs | 28 +- src/endpoints/enterprise_admin.rs | 24 +- src/endpoints/gists.rs | 28 +- src/endpoints/git.rs | 4 +- src/endpoints/issues.rs | 68 +- src/endpoints/licenses.rs | 4 +- src/endpoints/migrations.rs | 16 +- src/endpoints/oauth_authorizations.rs | 8 +- src/endpoints/orgs.rs | 398 ++++++++++- src/endpoints/packages.rs | 8 +- src/endpoints/projects.rs | 24 +- src/endpoints/pulls.rs | 32 +- src/endpoints/reactions.rs | 32 +- src/endpoints/repos.rs | 969 +++++++++++++++++++++++--- src/endpoints/search.rs | 28 +- src/endpoints/secret_scanning.rs | 4 +- src/endpoints/teams.rs | 68 +- src/endpoints/users.rs | 44 +- src/lib.rs | 2 +- src/models.rs | 397 +++++++---- templates/lib.mustache | 2 +- 27 files changed, 2210 insertions(+), 588 deletions(-) diff --git a/README.md b/README.md index 2756522..c1066d6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Add the following to your `Cargo.toml` file ```nocompile [dependencies] -roctogen = "0.8" +roctogen = "0.9" ``` ## API diff --git a/src/endpoints/actions.rs b/src/endpoints/actions.rs index d572eee..f958e4b 100644 --- a/src/endpoints/actions.rs +++ b/src/endpoints/actions.rs @@ -1466,7 +1466,7 @@ pub enum ActionsUpdateSelfHostedRunnerGroupForOrgError { /// Query parameters for the [List artifacts for a repository](Actions::list_artifacts_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListArtifactsForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1477,7 +1477,7 @@ impl ActionsListArtifactsForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1506,7 +1506,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListArtifactsForRepoParams { /// Query parameters for the [List environment secrets](Actions::list_environment_secrets_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListEnvironmentSecretsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1517,7 +1517,7 @@ impl ActionsListEnvironmentSecretsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1548,7 +1548,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListEnvironmentSecretsParams { pub struct ActionsListJobsForWorkflowRunParams<'req> { /// Filters jobs by their `completed_at` timestamp. Can be one of: \\* `latest`: Returns jobs from the most recent execution of the workflow run. \\* `all`: Returns all jobs for a workflow run, including from old executions of the workflow run. filter: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1568,7 +1568,7 @@ impl<'req> ActionsListJobsForWorkflowRunParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { filter: self.filter, @@ -1599,7 +1599,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListJobsForWorkflowRunParams<'enc> { /// Query parameters for the [List organization secrets](Actions::list_org_secrets_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListOrgSecretsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1610,7 +1610,7 @@ impl ActionsListOrgSecretsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1641,7 +1641,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListOrgSecretsParams { pub struct ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -1658,7 +1658,7 @@ impl ActionsListRepoAccessToSelfHostedRunnerGroupInOrgParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, @@ -1679,7 +1679,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListRepoAccessToSelfHostedRunnerGroupI /// Query parameters for the [List repository secrets](Actions::list_repo_secrets_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListRepoSecretsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1690,7 +1690,7 @@ impl ActionsListRepoSecretsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1719,7 +1719,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListRepoSecretsParams { /// Query parameters for the [List repository workflows](Actions::list_repo_workflows_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListRepoWorkflowsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1730,7 +1730,7 @@ impl ActionsListRepoWorkflowsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1761,7 +1761,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListRepoWorkflowsParams { pub struct ActionsListSelectedReposForOrgSecretParams { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -1778,7 +1778,7 @@ impl ActionsListSelectedReposForOrgSecretParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, @@ -1799,7 +1799,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListSelectedReposForOrgSecretParams { /// Query parameters for the [List selected repositories enabled for GitHub Actions in an organization](Actions::list_selected_repositories_enabled_github_actions_organization_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1810,7 +1810,7 @@ impl ActionsListSelectedRepositoriesEnabledGithubActionsOrganizationParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1839,7 +1839,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListSelectedRepositoriesEnabledGithubA /// Query parameters for the [List self-hosted runner groups for an organization](Actions::list_self_hosted_runner_groups_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListSelfHostedRunnerGroupsForOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1850,7 +1850,7 @@ impl ActionsListSelfHostedRunnerGroupsForOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1879,7 +1879,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnerGroupsForOrgParams /// Query parameters for the [List self-hosted runners for an organization](Actions::list_self_hosted_runners_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListSelfHostedRunnersForOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1890,7 +1890,7 @@ impl ActionsListSelfHostedRunnersForOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1919,7 +1919,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnersForOrgParams { /// Query parameters for the [List self-hosted runners for a repository](Actions::list_self_hosted_runners_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListSelfHostedRunnersForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1930,7 +1930,7 @@ impl ActionsListSelfHostedRunnersForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1959,7 +1959,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnersForRepoParams { /// Query parameters for the [List self-hosted runners in a group for an organization](Actions::list_self_hosted_runners_in_group_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListSelfHostedRunnersInGroupForOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1970,7 +1970,7 @@ impl ActionsListSelfHostedRunnersInGroupForOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1999,7 +1999,7 @@ impl<'enc> From<&'enc PerPage> for ActionsListSelfHostedRunnersInGroupForOrgPara /// Query parameters for the [List workflow run artifacts](Actions::list_workflow_run_artifacts_async()) endpoint. #[derive(Default, Serialize)] pub struct ActionsListWorkflowRunArtifactsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -2010,7 +2010,7 @@ impl ActionsListWorkflowRunArtifactsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -2047,10 +2047,12 @@ pub struct ActionsListWorkflowRunsParams<'req> { event: Option<&'req str>, /// Returns workflow runs with the check run `status` or `conclusion` that you specify. For example, a conclusion can be `success` or a status can be `in_progress`. Only GitHub can set a status of `waiting` or `requested`. For a list of the possible `status` and `conclusion` options, see \"[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run).\" status: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. - page: Option + page: Option, + + created: Option> } impl<'req> ActionsListWorkflowRunsParams<'req> { @@ -2067,6 +2069,7 @@ impl<'req> ActionsListWorkflowRunsParams<'req> { status: self.status, per_page: self.per_page, page: self.page, + created: self.created, } } @@ -2079,6 +2082,7 @@ impl<'req> ActionsListWorkflowRunsParams<'req> { status: self.status, per_page: self.per_page, page: self.page, + created: self.created, } } @@ -2091,6 +2095,7 @@ impl<'req> ActionsListWorkflowRunsParams<'req> { status: self.status, per_page: self.per_page, page: self.page, + created: self.created, } } @@ -2103,10 +2108,11 @@ impl<'req> ActionsListWorkflowRunsParams<'req> { status: Some(status), per_page: self.per_page, page: self.page, + created: self.created, } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { actor: self.actor, @@ -2115,6 +2121,7 @@ impl<'req> ActionsListWorkflowRunsParams<'req> { status: self.status, per_page: Some(per_page), page: self.page, + created: self.created, } } @@ -2127,6 +2134,20 @@ impl<'req> ActionsListWorkflowRunsParams<'req> { status: self.status, per_page: self.per_page, page: Some(page), + created: self.created, + } + } + + + pub fn created(self, created: chrono::DateTime) -> Self { + Self { + actor: self.actor, + branch: self.branch, + event: self.event, + status: self.status, + per_page: self.per_page, + page: self.page, + created: Some(created), } } } @@ -2151,10 +2172,12 @@ pub struct ActionsListWorkflowRunsForRepoParams<'req> { event: Option<&'req str>, /// Returns workflow runs with the check run `status` or `conclusion` that you specify. For example, a conclusion can be `success` or a status can be `in_progress`. Only GitHub can set a status of `waiting` or `requested`. For a list of the possible `status` and `conclusion` options, see \"[Create a check run](https://docs.github.com/rest/reference/checks#create-a-check-run).\" status: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. - page: Option + page: Option, + + created: Option> } impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { @@ -2171,6 +2194,7 @@ impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { status: self.status, per_page: self.per_page, page: self.page, + created: self.created, } } @@ -2183,6 +2207,7 @@ impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { status: self.status, per_page: self.per_page, page: self.page, + created: self.created, } } @@ -2195,6 +2220,7 @@ impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { status: self.status, per_page: self.per_page, page: self.page, + created: self.created, } } @@ -2207,10 +2233,11 @@ impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { status: Some(status), per_page: self.per_page, page: self.page, + created: self.created, } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { actor: self.actor, @@ -2219,6 +2246,7 @@ impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { status: self.status, per_page: Some(per_page), page: self.page, + created: self.created, } } @@ -2231,6 +2259,20 @@ impl<'req> ActionsListWorkflowRunsForRepoParams<'req> { status: self.status, per_page: self.per_page, page: Some(page), + created: self.created, + } + } + + + pub fn created(self, created: chrono::DateTime) -> Self { + Self { + actor: self.actor, + branch: self.branch, + event: self.event, + status: self.status, + per_page: self.per_page, + page: self.page, + created: Some(created), } } } @@ -2507,8 +2549,6 @@ impl<'api> Actions<'api> { /// /// # Approve a workflow run for a fork pull request /// - /// **Note:** This endpoint is currently in beta and is subject to change. - /// /// Approves a workflow run for a pull request from a public fork of a first time contributor. For more information, see ["Approving workflow runs from public forks](https://docs.github.com/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)." /// /// You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. @@ -2551,8 +2591,6 @@ impl<'api> Actions<'api> { /// /// # Approve a workflow run for a fork pull request /// - /// **Note:** This endpoint is currently in beta and is subject to change. - /// /// Approves a workflow run for a pull request from a public fork of a first time contributor. For more information, see ["Approving workflow runs from public forks](https://docs.github.com/actions/managing-workflow-runs/approving-workflow-runs-from-public-forks)." /// /// You must authenticate using an access token with the `repo` scope to use this endpoint. GitHub Apps must have the `actions:write` permission to use this endpoint. diff --git a/src/endpoints/activity.rs b/src/endpoints/activity.rs index ba552af..8f4628d 100644 --- a/src/endpoints/activity.rs +++ b/src/endpoints/activity.rs @@ -664,7 +664,7 @@ pub enum ActivityUnstarRepoForAuthenticatedUserError { /// Query parameters for the [List events for the authenticated user](Activity::list_events_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListEventsForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -675,7 +675,7 @@ impl ActivityListEventsForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -712,7 +712,7 @@ pub struct ActivityListNotificationsForAuthenticatedUserParams { since: Option>, /// Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. before: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -771,7 +771,7 @@ impl ActivityListNotificationsForAuthenticatedUserParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { all: self.all, @@ -808,7 +808,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListNotificationsForAuthenticatedUser /// Query parameters for the [List organization events for the authenticated user](Activity::list_org_events_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListOrgEventsForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -819,7 +819,7 @@ impl ActivityListOrgEventsForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -848,7 +848,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListOrgEventsForAuthenticatedUserPara /// Query parameters for the [List public events](Activity::list_public_events_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListPublicEventsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -859,7 +859,7 @@ impl ActivityListPublicEventsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -888,7 +888,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListPublicEventsParams { /// Query parameters for the [List public events for a network of repositories](Activity::list_public_events_for_repo_network_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListPublicEventsForRepoNetworkParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -899,7 +899,7 @@ impl ActivityListPublicEventsForRepoNetworkParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -928,7 +928,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListPublicEventsForRepoNetworkParams /// Query parameters for the [List public events for a user](Activity::list_public_events_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListPublicEventsForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -939,7 +939,7 @@ impl ActivityListPublicEventsForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -968,7 +968,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListPublicEventsForUserParams { /// Query parameters for the [List public organization events](Activity::list_public_org_events_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListPublicOrgEventsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -979,7 +979,7 @@ impl ActivityListPublicOrgEventsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1008,7 +1008,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListPublicOrgEventsParams { /// Query parameters for the [List events received by the authenticated user](Activity::list_received_events_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListReceivedEventsForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1019,7 +1019,7 @@ impl ActivityListReceivedEventsForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1048,7 +1048,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListReceivedEventsForUserParams { /// Query parameters for the [List public events received by a user](Activity::list_received_public_events_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListReceivedPublicEventsForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1059,7 +1059,7 @@ impl ActivityListReceivedPublicEventsForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1088,7 +1088,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListReceivedPublicEventsForUserParams /// Query parameters for the [List repository events](Activity::list_repo_events_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListRepoEventsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1099,7 +1099,7 @@ impl ActivityListRepoEventsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1136,7 +1136,7 @@ pub struct ActivityListRepoNotificationsForAuthenticatedUserParams { since: Option>, /// Only show notifications updated before the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. before: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1195,7 +1195,7 @@ impl ActivityListRepoNotificationsForAuthenticatedUserParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { all: self.all, @@ -1236,7 +1236,7 @@ pub struct ActivityListReposStarredByAuthenticatedUserParams<'req> { sort: Option<&'req str>, /// One of `asc` (ascending) or `desc` (descending). direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1267,7 +1267,7 @@ impl<'req> ActivityListReposStarredByAuthenticatedUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -1304,7 +1304,7 @@ pub struct ActivityListReposStarredByUserParams<'req> { sort: Option<&'req str>, /// One of `asc` (ascending) or `desc` (descending). direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1335,7 +1335,7 @@ impl<'req> ActivityListReposStarredByUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -1368,7 +1368,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListReposStarredByUserParams<'enc> { /// Query parameters for the [List repositories watched by a user](Activity::list_repos_watched_by_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListReposWatchedByUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1379,7 +1379,7 @@ impl ActivityListReposWatchedByUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1408,7 +1408,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListReposWatchedByUserParams { /// Query parameters for the [List stargazers](Activity::list_stargazers_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListStargazersForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1419,7 +1419,7 @@ impl ActivityListStargazersForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1448,7 +1448,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListStargazersForRepoParams { /// Query parameters for the [List repositories watched by the authenticated user](Activity::list_watched_repos_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListWatchedReposForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1459,7 +1459,7 @@ impl ActivityListWatchedReposForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1488,7 +1488,7 @@ impl<'enc> From<&'enc PerPage> for ActivityListWatchedReposForAuthenticatedUserP /// Query parameters for the [List watchers](Activity::list_watchers_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct ActivityListWatchersForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1499,7 +1499,7 @@ impl ActivityListWatchersForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/apps.rs b/src/endpoints/apps.rs index 16f828a..14ba122 100644 --- a/src/endpoints/apps.rs +++ b/src/endpoints/apps.rs @@ -403,6 +403,27 @@ pub enum AppsGetWebhookConfigForAppError { Generic { code: u16 }, } +/// Errors for the [Get a delivery for an app webhook](Apps::get_webhook_delivery_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum AppsGetWebhookDeliveryError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [List accounts for a plan](Apps::list_accounts_for_plan_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum AppsListAccountsForPlanError { @@ -617,6 +638,48 @@ pub enum AppsListSubscriptionsForAuthenticatedUserStubbedError { Generic { code: u16 }, } +/// Errors for the [List deliveries for an app webhook](Apps::list_webhook_deliveries_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum AppsListWebhookDeliveriesError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + +/// Errors for the [Redeliver a delivery for an app webhook](Apps::redeliver_webhook_delivery_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum AppsRedeliverWebhookDeliveryError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [Remove a repository from an app installation](Apps::remove_repo_from_installation_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum AppsRemoveRepoFromInstallationError { @@ -815,7 +878,7 @@ pub struct AppsListAccountsForPlanParams<'req> { sort: Option<&'req str>, /// To return the oldest accounts first, set to `asc`. Can be one of `asc` or `desc`. Ignored without the `sort` parameter. direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -846,7 +909,7 @@ impl<'req> AppsListAccountsForPlanParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -883,7 +946,7 @@ pub struct AppsListAccountsForPlanStubbedParams<'req> { sort: Option<&'req str>, /// To return the oldest accounts first, set to `asc`. Can be one of `asc` or `desc`. Ignored without the `sort` parameter. direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -914,7 +977,7 @@ impl<'req> AppsListAccountsForPlanStubbedParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -947,7 +1010,7 @@ impl<'enc> From<&'enc PerPage> for AppsListAccountsForPlanStubbedParams<'enc> { /// Query parameters for the [List repositories accessible to the user access token](Apps::list_installation_repos_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListInstallationReposForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -958,7 +1021,7 @@ impl AppsListInstallationReposForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -987,7 +1050,7 @@ impl<'enc> From<&'enc PerPage> for AppsListInstallationReposForAuthenticatedUser /// Query parameters for the [List installations for the authenticated app](Apps::list_installations_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListInstallationsParams<'req> { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -1002,7 +1065,7 @@ impl<'req> AppsListInstallationsParams<'req> { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1055,7 +1118,7 @@ impl<'enc> From<&'enc PerPage> for AppsListInstallationsParams<'enc> { /// Query parameters for the [List app installations accessible to the user access token](Apps::list_installations_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListInstallationsForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1066,7 +1129,7 @@ impl AppsListInstallationsForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1095,7 +1158,7 @@ impl<'enc> From<&'enc PerPage> for AppsListInstallationsForAuthenticatedUserPara /// Query parameters for the [List plans](Apps::list_plans_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListPlansParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1106,7 +1169,7 @@ impl AppsListPlansParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1135,7 +1198,7 @@ impl<'enc> From<&'enc PerPage> for AppsListPlansParams { /// Query parameters for the [List plans (stubbed)](Apps::list_plans_stubbed_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListPlansStubbedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1146,7 +1209,7 @@ impl AppsListPlansStubbedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1175,7 +1238,7 @@ impl<'enc> From<&'enc PerPage> for AppsListPlansStubbedParams { /// Query parameters for the [List repositories accessible to the app installation](Apps::list_repos_accessible_to_installation_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListReposAccessibleToInstallationParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1186,7 +1249,7 @@ impl AppsListReposAccessibleToInstallationParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1215,7 +1278,7 @@ impl<'enc> From<&'enc PerPage> for AppsListReposAccessibleToInstallationParams { /// Query parameters for the [List subscriptions for the authenticated user](Apps::list_subscriptions_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListSubscriptionsForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1226,7 +1289,7 @@ impl AppsListSubscriptionsForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1255,7 +1318,7 @@ impl<'enc> From<&'enc PerPage> for AppsListSubscriptionsForAuthenticatedUserPara /// Query parameters for the [List subscriptions for the authenticated user (stubbed)](Apps::list_subscriptions_for_authenticated_user_stubbed_async()) endpoint. #[derive(Default, Serialize)] pub struct AppsListSubscriptionsForAuthenticatedUserStubbedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1266,7 +1329,7 @@ impl AppsListSubscriptionsForAuthenticatedUserStubbedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1292,6 +1355,37 @@ impl<'enc> From<&'enc PerPage> for AppsListSubscriptionsForAuthenticatedUserStub } } } +/// Query parameters for the [List deliveries for an app webhook](Apps::list_webhook_deliveries_async()) endpoint. +#[derive(Default, Serialize)] +pub struct AppsListWebhookDeliveriesParams<'req> { + /// Results per page (max 100) + per_page: Option, + /// Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. + cursor: Option<&'req str> +} + +impl<'req> AppsListWebhookDeliveriesParams<'req> { + pub fn new() -> Self { + Self::default() + } + + /// Results per page (max 100) + pub fn per_page(self, per_page: u16) -> Self { + Self { + per_page: Some(per_page), + cursor: self.cursor, + } + } + + /// Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. + pub fn cursor(self, cursor: &'req str) -> Self { + Self { + per_page: self.per_page, + cursor: Some(cursor), + } + } +} + impl<'api> Apps<'api> { /// --- @@ -2814,6 +2908,91 @@ impl<'api> Apps<'api> { } } + /// --- + /// + /// # Get a delivery for an app webhook + /// + /// Returns a delivery for the webhook configured for a GitHub App. + /// + /// You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + /// + /// [GitHub API docs for get_webhook_delivery](https://docs.github.com/rest/reference/apps#get-a-delivery-for-an-app-webhook) + /// + /// --- + pub async fn get_webhook_delivery_async(&self, delivery_id: i32) -> Result { + + let request_uri = format!("{}/app/hook/deliveries/{}", super::GITHUB_BASE_API_URL, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(AppsGetWebhookDeliveryError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(AppsGetWebhookDeliveryError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(AppsGetWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # Get a delivery for an app webhook + /// + /// Returns a delivery for the webhook configured for a GitHub App. + /// + /// You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + /// + /// [GitHub API docs for get_webhook_delivery](https://docs.github.com/rest/reference/apps#get-a-delivery-for-an-app-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn get_webhook_delivery(&self, delivery_id: i32) -> Result { + + let request_uri = format!("{}/app/hook/deliveries/{}", super::GITHUB_BASE_API_URL, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(AppsGetWebhookDeliveryError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(AppsGetWebhookDeliveryError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(AppsGetWebhookDeliveryError::Generic { code }), + } + } + } + /// --- /// /// # List accounts for a plan @@ -3778,6 +3957,185 @@ impl<'api> Apps<'api> { } } + /// --- + /// + /// # List deliveries for an app webhook + /// + /// Returns a list of webhook deliveries for the webhook configured for a GitHub App. + /// + /// You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + /// + /// [GitHub API docs for list_webhook_deliveries](https://docs.github.com/rest/reference/apps#list-deliveries-for-an-app-webhook) + /// + /// --- + pub async fn list_webhook_deliveries_async(&self, query_params: Option>>) -> Result, AppsListWebhookDeliveriesError> { + + let mut request_uri = format!("{}/app/hook/deliveries", super::GITHUB_BASE_API_URL); + + if let Some(params) = query_params { + request_uri.push_str("?"); + request_uri.push_str(&serde_urlencoded::to_string(params.into())?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(AppsListWebhookDeliveriesError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(AppsListWebhookDeliveriesError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(AppsListWebhookDeliveriesError::Generic { code }), + } + } + } + + /// --- + /// + /// # List deliveries for an app webhook + /// + /// Returns a list of webhook deliveries for the webhook configured for a GitHub App. + /// + /// You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + /// + /// [GitHub API docs for list_webhook_deliveries](https://docs.github.com/rest/reference/apps#list-deliveries-for-an-app-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn list_webhook_deliveries(&self, query_params: Option>>) -> Result, AppsListWebhookDeliveriesError> { + + let mut request_uri = format!("{}/app/hook/deliveries", super::GITHUB_BASE_API_URL); + + if let Some(params) = query_params { + request_uri.push_str("?"); + let qp: AppsListWebhookDeliveriesParams = params.into(); + request_uri.push_str(&serde_urlencoded::to_string(qp)?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(AppsListWebhookDeliveriesError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(AppsListWebhookDeliveriesError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(AppsListWebhookDeliveriesError::Generic { code }), + } + } + } + + /// --- + /// + /// # Redeliver a delivery for an app webhook + /// + /// Redeliver a delivery for the webhook configured for a GitHub App. + /// + /// You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + /// + /// [GitHub API docs for redeliver_webhook_delivery](https://docs.github.com/rest/reference/apps#redeliver-a-delivery-for-an-app-webhook) + /// + /// --- + pub async fn redeliver_webhook_delivery_async(&self, delivery_id: i32) -> Result, AppsRedeliverWebhookDeliveryError> { + + let request_uri = format!("{}/app/hook/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(AppsRedeliverWebhookDeliveryError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(AppsRedeliverWebhookDeliveryError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(AppsRedeliverWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # Redeliver a delivery for an app webhook + /// + /// Redeliver a delivery for the webhook configured for a GitHub App. + /// + /// You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. + /// + /// [GitHub API docs for redeliver_webhook_delivery](https://docs.github.com/rest/reference/apps#redeliver-a-delivery-for-an-app-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn redeliver_webhook_delivery(&self, delivery_id: i32) -> Result, AppsRedeliverWebhookDeliveryError> { + + let request_uri = format!("{}/app/hook/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(AppsRedeliverWebhookDeliveryError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(AppsRedeliverWebhookDeliveryError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(AppsRedeliverWebhookDeliveryError::Generic { code }), + } + } + } + /// --- /// /// # Remove a repository from an app installation diff --git a/src/endpoints/checks.rs b/src/endpoints/checks.rs index b23996f..ace4877 100644 --- a/src/endpoints/checks.rs +++ b/src/endpoints/checks.rs @@ -224,7 +224,7 @@ pub enum ChecksUpdateError { /// Query parameters for the [List check run annotations](Checks::list_annotations_async()) endpoint. #[derive(Default, Serialize)] pub struct ChecksListAnnotationsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -235,7 +235,7 @@ impl ChecksListAnnotationsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -270,7 +270,7 @@ pub struct ChecksListForRefParams<'req> { status: Option<&'req str>, /// Filters check runs by their `completed_at` timestamp. Can be one of `latest` (returning the most recent check runs) or `all`. filter: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -319,7 +319,7 @@ impl<'req> ChecksListForRefParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { check_name: self.check_name, @@ -374,7 +374,7 @@ pub struct ChecksListForSuiteParams<'req> { status: Option<&'req str>, /// Filters check runs by their `completed_at` timestamp. Can be one of `latest` (returning the most recent check runs) or `all`. filter: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -418,7 +418,7 @@ impl<'req> ChecksListForSuiteParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { check_name: self.check_name, @@ -457,7 +457,7 @@ pub struct ChecksListSuitesForRefParams<'req> { app_id: Option, /// Returns check runs with the specified `name`. check_name: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -488,7 +488,7 @@ impl<'req> ChecksListSuitesForRefParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { app_id: self.app_id, diff --git a/src/endpoints/code_scanning.rs b/src/endpoints/code_scanning.rs index a543c86..f823a6c 100644 --- a/src/endpoints/code_scanning.rs +++ b/src/endpoints/code_scanning.rs @@ -270,7 +270,7 @@ impl<'req> CodeScanningDeleteAnalysisParams<'req> { pub struct CodeScanningListAlertInstancesParams { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// The Git reference for the results you want to list. The `ref` for a branch can be formatted either as `refs/heads/` or simply ``. To reference a pull request use `refs/pull//merge`. git_ref: Option @@ -290,7 +290,7 @@ impl CodeScanningListAlertInstancesParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, @@ -327,7 +327,7 @@ pub struct CodeScanningListAlertsForRepoParams { tool_guid: Option, /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// The Git reference for the results you want to list. The `ref` for a branch can be formatted either as `refs/heads/` or simply ``. To reference a pull request use `refs/pull//merge`. git_ref: Option, @@ -376,7 +376,7 @@ impl CodeScanningListAlertsForRepoParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { tool_name: self.tool_name, @@ -431,7 +431,7 @@ pub struct CodeScanningListRecentAnalysesParams { tool_guid: Option, /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// The Git reference for the analyses you want to list. The `ref` for a branch can be formatted either as `refs/heads/` or simply ``. To reference a pull request use `refs/pull//merge`. git_ref: Option, @@ -480,7 +480,7 @@ impl CodeScanningListRecentAnalysesParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { tool_name: self.tool_name, diff --git a/src/endpoints/codes_of_conduct.rs b/src/endpoints/codes_of_conduct.rs index d0b66e1..dd00c76 100644 --- a/src/endpoints/codes_of_conduct.rs +++ b/src/endpoints/codes_of_conduct.rs @@ -46,8 +46,6 @@ pub enum CodesOfConductGetAllCodesOfConductError { #[error("Not modified")] Status304, - #[error("Preview header missing")] - Status415(GetProjectsListForUserResponse415), #[error("Status code: {}", code)] Generic { code: u16 }, } @@ -69,8 +67,6 @@ pub enum CodesOfConductGetConductCodeError { Status404(BasicError), #[error("Not modified")] Status304, - #[error("Preview header missing")] - Status415(GetProjectsListForUserResponse415), #[error("Status code: {}", code)] Generic { code: u16 }, } @@ -101,10 +97,7 @@ impl<'api> CodesOfConduct<'api> { /// /// [GitHub API docs for get_all_codes_of_conduct](https://docs.github.com/rest/reference/codes-of-conduct#get-all-codes-of-conduct) /// - /// The `get_all_codes_of_conduct_async` endpoint is enabled with the `scarlet-witch` cargo feature. - /// /// --- - #[cfg(feature = "scarlet-witch")] pub async fn get_all_codes_of_conduct_async(&self) -> Result, CodesOfConductGetAllCodesOfConductError> { let request_uri = format!("{}/codes_of_conduct", super::GITHUB_BASE_API_URL); @@ -114,7 +107,7 @@ impl<'api> CodesOfConduct<'api> { uri: request_uri, body: None, method: "GET", - headers: vec![("Accept", "application/vnd.github.scarlet-witch-preview+json"), ] + headers: vec![] }; let request = GitHubRequestBuilder::build(req, self.auth)?; @@ -130,7 +123,6 @@ impl<'api> CodesOfConduct<'api> { } else { match github_response.status_code() { 304 => Err(CodesOfConductGetAllCodesOfConductError::Status304), - 415 => Err(CodesOfConductGetAllCodesOfConductError::Status415(crate::adapters::to_json_async(github_response).await?)), code => Err(CodesOfConductGetAllCodesOfConductError::Generic { code }), } } @@ -142,11 +134,8 @@ impl<'api> CodesOfConduct<'api> { /// /// [GitHub API docs for get_all_codes_of_conduct](https://docs.github.com/rest/reference/codes-of-conduct#get-all-codes-of-conduct) /// - /// The `get_all_codes_of_conduct` endpoint is enabled with the `scarlet-witch` cargo feature. - /// /// --- #[cfg(not(target_arch = "wasm32"))] - #[cfg(feature = "scarlet-witch")] pub fn get_all_codes_of_conduct(&self) -> Result, CodesOfConductGetAllCodesOfConductError> { let request_uri = format!("{}/codes_of_conduct", super::GITHUB_BASE_API_URL); @@ -156,7 +145,7 @@ impl<'api> CodesOfConduct<'api> { uri: request_uri, body: None, method: "GET", - headers: vec![("Accept", "application/vnd.github.scarlet-witch-preview+json"), ] + headers: vec![] }; let request = GitHubRequestBuilder::build(req, self.auth)?; @@ -172,7 +161,6 @@ impl<'api> CodesOfConduct<'api> { } else { match github_response.status_code() { 304 => Err(CodesOfConductGetAllCodesOfConductError::Status304), - 415 => Err(CodesOfConductGetAllCodesOfConductError::Status415(crate::adapters::to_json(github_response)?)), code => Err(CodesOfConductGetAllCodesOfConductError::Generic { code }), } } @@ -184,10 +172,7 @@ impl<'api> CodesOfConduct<'api> { /// /// [GitHub API docs for get_conduct_code](https://docs.github.com/rest/reference/codes-of-conduct#get-a-code-of-conduct) /// - /// The `get_conduct_code_async` endpoint is enabled with the `scarlet-witch` cargo feature. - /// /// --- - #[cfg(feature = "scarlet-witch")] pub async fn get_conduct_code_async(&self, key: &str) -> Result { let request_uri = format!("{}/codes_of_conduct/{}", super::GITHUB_BASE_API_URL, key); @@ -197,7 +182,7 @@ impl<'api> CodesOfConduct<'api> { uri: request_uri, body: None, method: "GET", - headers: vec![("Accept", "application/vnd.github.scarlet-witch-preview+json"), ] + headers: vec![] }; let request = GitHubRequestBuilder::build(req, self.auth)?; @@ -214,7 +199,6 @@ impl<'api> CodesOfConduct<'api> { match github_response.status_code() { 404 => Err(CodesOfConductGetConductCodeError::Status404(crate::adapters::to_json_async(github_response).await?)), 304 => Err(CodesOfConductGetConductCodeError::Status304), - 415 => Err(CodesOfConductGetConductCodeError::Status415(crate::adapters::to_json_async(github_response).await?)), code => Err(CodesOfConductGetConductCodeError::Generic { code }), } } @@ -226,11 +210,8 @@ impl<'api> CodesOfConduct<'api> { /// /// [GitHub API docs for get_conduct_code](https://docs.github.com/rest/reference/codes-of-conduct#get-a-code-of-conduct) /// - /// The `get_conduct_code` endpoint is enabled with the `scarlet-witch` cargo feature. - /// /// --- #[cfg(not(target_arch = "wasm32"))] - #[cfg(feature = "scarlet-witch")] pub fn get_conduct_code(&self, key: &str) -> Result { let request_uri = format!("{}/codes_of_conduct/{}", super::GITHUB_BASE_API_URL, key); @@ -240,7 +221,7 @@ impl<'api> CodesOfConduct<'api> { uri: request_uri, body: None, method: "GET", - headers: vec![("Accept", "application/vnd.github.scarlet-witch-preview+json"), ] + headers: vec![] }; let request = GitHubRequestBuilder::build(req, self.auth)?; @@ -257,7 +238,6 @@ impl<'api> CodesOfConduct<'api> { match github_response.status_code() { 404 => Err(CodesOfConductGetConductCodeError::Status404(crate::adapters::to_json(github_response)?)), 304 => Err(CodesOfConductGetConductCodeError::Status304), - 415 => Err(CodesOfConductGetConductCodeError::Status415(crate::adapters::to_json(github_response)?)), code => Err(CodesOfConductGetConductCodeError::Generic { code }), } } diff --git a/src/endpoints/enterprise_admin.rs b/src/endpoints/enterprise_admin.rs index 12c96d8..d6a30e3 100644 --- a/src/endpoints/enterprise_admin.rs +++ b/src/endpoints/enterprise_admin.rs @@ -727,7 +727,7 @@ pub struct EnterpriseAdminGetAuditLogParams<'req> { order: Option<&'req str>, /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -814,7 +814,7 @@ impl<'req> EnterpriseAdminGetAuditLogParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { phrase: self.phrase, @@ -860,7 +860,7 @@ impl<'req> EnterpriseAdminGetProvisioningInformationForEnterpriseGroupParams<'re /// Query parameters for the [List organization access to a self-hosted runner group in an enterprise](EnterpriseAdmin::list_org_access_to_self_hosted_runner_group_in_enterprise_async()) endpoint. #[derive(Default, Serialize)] pub struct EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -871,7 +871,7 @@ impl EnterpriseAdminListOrgAccessToSelfHostedRunnerGroupInEnterpriseParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1003,7 +1003,7 @@ impl<'req> EnterpriseAdminListProvisionedIdentitiesEnterpriseParams<'req> { /// Query parameters for the [List selected organizations enabled for GitHub Actions in an enterprise](EnterpriseAdmin::list_selected_organizations_enabled_github_actions_enterprise_async()) endpoint. #[derive(Default, Serialize)] pub struct EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1014,7 +1014,7 @@ impl EnterpriseAdminListSelectedOrganizationsEnabledGithubActionsEnterpriseParam Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1043,7 +1043,7 @@ impl<'enc> From<&'enc PerPage> for EnterpriseAdminListSelectedOrganizationsEnabl /// Query parameters for the [List self-hosted runner groups for an enterprise](EnterpriseAdmin::list_self_hosted_runner_groups_for_enterprise_async()) endpoint. #[derive(Default, Serialize)] pub struct EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1054,7 +1054,7 @@ impl EnterpriseAdminListSelfHostedRunnerGroupsForEnterpriseParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1083,7 +1083,7 @@ impl<'enc> From<&'enc PerPage> for EnterpriseAdminListSelfHostedRunnerGroupsForE /// Query parameters for the [List self-hosted runners for an enterprise](EnterpriseAdmin::list_self_hosted_runners_for_enterprise_async()) endpoint. #[derive(Default, Serialize)] pub struct EnterpriseAdminListSelfHostedRunnersForEnterpriseParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1094,7 +1094,7 @@ impl EnterpriseAdminListSelfHostedRunnersForEnterpriseParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1123,7 +1123,7 @@ impl<'enc> From<&'enc PerPage> for EnterpriseAdminListSelfHostedRunnersForEnterp /// Query parameters for the [List self-hosted runners in a group for an enterprise](EnterpriseAdmin::list_self_hosted_runners_in_group_for_enterprise_async()) endpoint. #[derive(Default, Serialize)] pub struct EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1134,7 +1134,7 @@ impl EnterpriseAdminListSelfHostedRunnersInGroupForEnterpriseParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/gists.rs b/src/endpoints/gists.rs index 7e90d6f..f2af442 100644 --- a/src/endpoints/gists.rs +++ b/src/endpoints/gists.rs @@ -489,7 +489,7 @@ pub enum GistsUpdateCommentError { pub struct GistsListParams { /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -509,7 +509,7 @@ impl GistsListParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, @@ -540,7 +540,7 @@ impl<'enc> From<&'enc PerPage> for GistsListParams { /// Query parameters for the [List gist comments](Gists::list_comments_async()) endpoint. #[derive(Default, Serialize)] pub struct GistsListCommentsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -551,7 +551,7 @@ impl GistsListCommentsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -580,7 +580,7 @@ impl<'enc> From<&'enc PerPage> for GistsListCommentsParams { /// Query parameters for the [List gist commits](Gists::list_commits_async()) endpoint. #[derive(Default, Serialize)] pub struct GistsListCommitsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -591,7 +591,7 @@ impl GistsListCommitsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -622,7 +622,7 @@ impl<'enc> From<&'enc PerPage> for GistsListCommitsParams { pub struct GistsListForUserParams { /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -642,7 +642,7 @@ impl GistsListForUserParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, @@ -673,7 +673,7 @@ impl<'enc> From<&'enc PerPage> for GistsListForUserParams { /// Query parameters for the [List gist forks](Gists::list_forks_async()) endpoint. #[derive(Default, Serialize)] pub struct GistsListForksParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -684,7 +684,7 @@ impl GistsListForksParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -715,7 +715,7 @@ impl<'enc> From<&'enc PerPage> for GistsListForksParams { pub struct GistsListPublicParams { /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -735,7 +735,7 @@ impl GistsListPublicParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, @@ -768,7 +768,7 @@ impl<'enc> From<&'enc PerPage> for GistsListPublicParams { pub struct GistsListStarredParams { /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -788,7 +788,7 @@ impl GistsListStarredParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, diff --git a/src/endpoints/git.rs b/src/endpoints/git.rs index bc4993d..b7d9870 100644 --- a/src/endpoints/git.rs +++ b/src/endpoints/git.rs @@ -318,7 +318,7 @@ impl<'req> GitGetTreeParams<'req> { /// Query parameters for the [List matching references](Git::list_matching_refs_async()) endpoint. #[derive(Default, Serialize)] pub struct GitListMatchingRefsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -329,7 +329,7 @@ impl GitListMatchingRefsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/issues.rs b/src/endpoints/issues.rs index b3690bf..b744f2b 100644 --- a/src/endpoints/issues.rs +++ b/src/endpoints/issues.rs @@ -832,7 +832,7 @@ pub enum IssuesUpdateMilestoneError { /// Query parameters for the [List issues assigned to the authenticated user](Issues::list_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListParams<'req> { - /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all`: All issues the authenticated user can see, regardless of participation or creation + /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation filter: Option<&'req str>, /// Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. state: Option<&'req str>, @@ -852,7 +852,7 @@ pub struct IssuesListParams<'req> { owned: Option, pulls: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -863,7 +863,7 @@ impl<'req> IssuesListParams<'req> { Self::default() } - /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all`: All issues the authenticated user can see, regardless of participation or creation + /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation pub fn filter(self, filter: &'req str) -> Self { Self { filter: Some(filter), @@ -1043,7 +1043,7 @@ impl<'req> IssuesListParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { filter: self.filter, @@ -1092,7 +1092,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListParams<'enc> { /// Query parameters for the [List assignees](Issues::list_assignees_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListAssigneesParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1103,7 +1103,7 @@ impl IssuesListAssigneesParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1134,7 +1134,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListAssigneesParams { pub struct IssuesListCommentsParams { /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1154,7 +1154,7 @@ impl IssuesListCommentsParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, @@ -1191,7 +1191,7 @@ pub struct IssuesListCommentsForRepoParams<'req> { direction: Option<&'req str>, /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1235,7 +1235,7 @@ impl<'req> IssuesListCommentsForRepoParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -1270,7 +1270,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListCommentsForRepoParams<'enc> { /// Query parameters for the [List issue events](Issues::list_events_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListEventsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1281,7 +1281,7 @@ impl IssuesListEventsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1310,7 +1310,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListEventsParams { /// Query parameters for the [List issue events for a repository](Issues::list_events_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListEventsForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1321,7 +1321,7 @@ impl IssuesListEventsForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1350,7 +1350,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListEventsForRepoParams { /// Query parameters for the [List timeline events for an issue](Issues::list_events_for_timeline_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListEventsForTimelineParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1361,7 +1361,7 @@ impl IssuesListEventsForTimelineParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1390,7 +1390,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListEventsForTimelineParams { /// Query parameters for the [List user account issues assigned to the authenticated user](Issues::list_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListForAuthenticatedUserParams<'req> { - /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all`: All issues the authenticated user can see, regardless of participation or creation + /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation filter: Option<&'req str>, /// Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. state: Option<&'req str>, @@ -1402,7 +1402,7 @@ pub struct IssuesListForAuthenticatedUserParams<'req> { direction: Option<&'req str>, /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1413,7 +1413,7 @@ impl<'req> IssuesListForAuthenticatedUserParams<'req> { Self::default() } - /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all`: All issues the authenticated user can see, regardless of participation or creation + /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation pub fn filter(self, filter: &'req str) -> Self { Self { filter: Some(filter), @@ -1497,7 +1497,7 @@ impl<'req> IssuesListForAuthenticatedUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { filter: self.filter, @@ -1538,7 +1538,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListForAuthenticatedUserParams<'enc> { /// Query parameters for the [List organization issues assigned to the authenticated user](Issues::list_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListForOrgParams<'req> { - /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all`: All issues the authenticated user can see, regardless of participation or creation + /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation filter: Option<&'req str>, /// Indicates the state of the issues to return. Can be either `open`, `closed`, or `all`. state: Option<&'req str>, @@ -1550,7 +1550,7 @@ pub struct IssuesListForOrgParams<'req> { direction: Option<&'req str>, /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1561,7 +1561,7 @@ impl<'req> IssuesListForOrgParams<'req> { Self::default() } - /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all`: All issues the authenticated user can see, regardless of participation or creation + /// Indicates which sorts of issues to return. Can be one of: \\* `assigned`: Issues assigned to you \\* `created`: Issues created by you \\* `mentioned`: Issues mentioning you \\* `subscribed`: Issues you're subscribed to updates for \\* `all` or `repos`: All issues the authenticated user can see, regardless of participation or creation pub fn filter(self, filter: &'req str) -> Self { Self { filter: Some(filter), @@ -1645,7 +1645,7 @@ impl<'req> IssuesListForOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { filter: self.filter, @@ -1704,7 +1704,7 @@ pub struct IssuesListForRepoParams<'req> { direction: Option<&'req str>, /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1868,7 +1868,7 @@ impl<'req> IssuesListForRepoParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { milestone: self.milestone, @@ -1915,7 +1915,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListForRepoParams<'enc> { /// Query parameters for the [List labels for issues in a milestone](Issues::list_labels_for_milestone_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListLabelsForMilestoneParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1926,7 +1926,7 @@ impl IssuesListLabelsForMilestoneParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1955,7 +1955,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListLabelsForMilestoneParams { /// Query parameters for the [List labels for a repository](Issues::list_labels_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListLabelsForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1966,7 +1966,7 @@ impl IssuesListLabelsForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1995,7 +1995,7 @@ impl<'enc> From<&'enc PerPage> for IssuesListLabelsForRepoParams { /// Query parameters for the [List labels for an issue](Issues::list_labels_on_issue_async()) endpoint. #[derive(Default, Serialize)] pub struct IssuesListLabelsOnIssueParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -2006,7 +2006,7 @@ impl IssuesListLabelsOnIssueParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -2041,7 +2041,7 @@ pub struct IssuesListMilestonesParams<'req> { sort: Option<&'req str>, /// The direction of the sort. Either `asc` or `desc`. direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -2085,7 +2085,7 @@ impl<'req> IssuesListMilestonesParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, diff --git a/src/endpoints/licenses.rs b/src/endpoints/licenses.rs index 2a69f50..8ed155f 100644 --- a/src/endpoints/licenses.rs +++ b/src/endpoints/licenses.rs @@ -96,7 +96,7 @@ pub enum LicensesGetForRepoError { pub struct LicensesGetAllCommonlyUsedParams { featured: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -116,7 +116,7 @@ impl LicensesGetAllCommonlyUsedParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { featured: self.featured, diff --git a/src/endpoints/migrations.rs b/src/endpoints/migrations.rs index f594c3d..273e604 100644 --- a/src/endpoints/migrations.rs +++ b/src/endpoints/migrations.rs @@ -547,7 +547,7 @@ impl MigrationsGetStatusForOrgParams { /// Query parameters for the [List user migrations](Migrations::list_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct MigrationsListForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -558,7 +558,7 @@ impl MigrationsListForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -587,7 +587,7 @@ impl<'enc> From<&'enc PerPage> for MigrationsListForAuthenticatedUserParams { /// Query parameters for the [List organization migrations](Migrations::list_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct MigrationsListForOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -600,7 +600,7 @@ impl MigrationsListForOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -640,7 +640,7 @@ impl<'enc> From<&'enc PerPage> for MigrationsListForOrgParams { /// Query parameters for the [List repositories in an organization migration](Migrations::list_repos_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct MigrationsListReposForOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -651,7 +651,7 @@ impl MigrationsListReposForOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -680,7 +680,7 @@ impl<'enc> From<&'enc PerPage> for MigrationsListReposForOrgParams { /// Query parameters for the [List repositories for a user migration](Migrations::list_repos_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct MigrationsListReposForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -691,7 +691,7 @@ impl MigrationsListReposForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/oauth_authorizations.rs b/src/endpoints/oauth_authorizations.rs index 4dd3cf7..d292bba 100644 --- a/src/endpoints/oauth_authorizations.rs +++ b/src/endpoints/oauth_authorizations.rs @@ -271,7 +271,7 @@ pub enum OauthAuthorizationsUpdateAuthorizationError { /// Query parameters for the [List your authorizations](OauthAuthorizations::list_authorizations_async()) endpoint. #[derive(Default, Serialize)] pub struct OauthAuthorizationsListAuthorizationsParams<'req> { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -284,7 +284,7 @@ impl<'req> OauthAuthorizationsListAuthorizationsParams<'req> { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -324,7 +324,7 @@ impl<'enc> From<&'enc PerPage> for OauthAuthorizationsListAuthorizationsParams<' /// Query parameters for the [List your grants](OauthAuthorizations::list_grants_async()) endpoint. #[derive(Default, Serialize)] pub struct OauthAuthorizationsListGrantsParams<'req> { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -337,7 +337,7 @@ impl<'req> OauthAuthorizationsListGrantsParams<'req> { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/orgs.rs b/src/endpoints/orgs.rs index 8474a8a..6f09ad0 100644 --- a/src/endpoints/orgs.rs +++ b/src/endpoints/orgs.rs @@ -328,6 +328,27 @@ pub enum OrgsGetWebhookConfigForOrgError { Generic { code: u16 }, } +/// Errors for the [Get a webhook delivery for an organization webhook](Orgs::get_webhook_delivery_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum OrgsGetWebhookDeliveryError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [List organizations](Orgs::list_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum OrgsListError { @@ -577,6 +598,27 @@ pub enum OrgsListSamlSsoAuthorizationsError { Generic { code: u16 }, } +/// Errors for the [List deliveries for an organization webhook](Orgs::list_webhook_deliveries_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum OrgsListWebhookDeliveriesError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [List organization webhooks](Orgs::list_webhooks_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum OrgsListWebhooksError { @@ -615,6 +657,27 @@ pub enum OrgsPingWebhookError { Generic { code: u16 }, } +/// Errors for the [Redeliver a delivery for an organization webhook](Orgs::redeliver_webhook_delivery_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum OrgsRedeliverWebhookDeliveryError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [Remove an organization member](Orgs::remove_member_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum OrgsRemoveMemberError { @@ -865,7 +928,7 @@ pub struct OrgsGetAuditLogParams<'req> { before: Option<&'req str>, /// The order of audit log events. To list newest events first, specify `desc`. To list oldest events first, specify `asc`. The default is `desc`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -941,7 +1004,7 @@ impl<'req> OrgsGetAuditLogParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { phrase: self.phrase, @@ -982,7 +1045,7 @@ impl<'enc> From<&'enc PerPage> for OrgsGetAuditLogParams<'enc> { pub struct OrgsListParams { /// An organization ID. Only return organizations with an ID greater than this ID. since: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -999,7 +1062,7 @@ impl OrgsListParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, @@ -1011,7 +1074,7 @@ impl OrgsListParams { /// Query parameters for the [List app installations for an organization](Orgs::list_app_installations_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListAppInstallationsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1022,7 +1085,7 @@ impl OrgsListAppInstallationsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1051,7 +1114,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListAppInstallationsParams { /// Query parameters for the [List failed organization invitations](Orgs::list_failed_invitations_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListFailedInvitationsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1062,7 +1125,7 @@ impl OrgsListFailedInvitationsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1091,7 +1154,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListFailedInvitationsParams { /// Query parameters for the [List organizations for the authenticated user](Orgs::list_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1102,7 +1165,7 @@ impl OrgsListForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1131,7 +1194,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListForAuthenticatedUserParams { /// Query parameters for the [List organizations for a user](Orgs::list_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1142,7 +1205,7 @@ impl OrgsListForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1171,7 +1234,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListForUserParams { /// Query parameters for the [List organization invitation teams](Orgs::list_invitation_teams_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListInvitationTeamsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1182,7 +1245,7 @@ impl OrgsListInvitationTeamsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1215,7 +1278,7 @@ pub struct OrgsListMembersParams<'req> { filter: Option<&'req str>, /// Filter members returned by their role. Can be one of: \\* `all` - All members of the organization, regardless of role. \\* `admin` - Organization owners. \\* `member` - Non-owner organization members. role: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1246,7 +1309,7 @@ impl<'req> OrgsListMembersParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { filter: self.filter, @@ -1281,7 +1344,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListMembersParams<'enc> { pub struct OrgsListMembershipsForAuthenticatedUserParams<'req> { /// Indicates the state of the memberships to return. Can be either `active` or `pending`. If not specified, the API returns both active and pending memberships. state: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1301,7 +1364,7 @@ impl<'req> OrgsListMembershipsForAuthenticatedUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, @@ -1334,7 +1397,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListMembershipsForAuthenticatedUserParams pub struct OrgsListOutsideCollaboratorsParams<'req> { /// Filter the list of outside collaborators. Can be one of: \\* `2fa_disabled`: Outside collaborators without [two-factor authentication](https://github.com/blog/1614-two-factor-authentication) enabled. \\* `all`: All outside collaborators. filter: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1354,7 +1417,7 @@ impl<'req> OrgsListOutsideCollaboratorsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { filter: self.filter, @@ -1385,7 +1448,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListOutsideCollaboratorsParams<'enc> { /// Query parameters for the [List pending organization invitations](Orgs::list_pending_invitations_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListPendingInvitationsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1396,7 +1459,7 @@ impl OrgsListPendingInvitationsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1425,7 +1488,7 @@ impl<'enc> From<&'enc PerPage> for OrgsListPendingInvitationsParams { /// Query parameters for the [List public organization members](Orgs::list_public_members_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListPublicMembersParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1436,7 +1499,7 @@ impl OrgsListPublicMembersParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1462,10 +1525,41 @@ impl<'enc> From<&'enc PerPage> for OrgsListPublicMembersParams { } } } +/// Query parameters for the [List deliveries for an organization webhook](Orgs::list_webhook_deliveries_async()) endpoint. +#[derive(Default, Serialize)] +pub struct OrgsListWebhookDeliveriesParams<'req> { + /// Results per page (max 100) + per_page: Option, + /// Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. + cursor: Option<&'req str> +} + +impl<'req> OrgsListWebhookDeliveriesParams<'req> { + pub fn new() -> Self { + Self::default() + } + + /// Results per page (max 100) + pub fn per_page(self, per_page: u16) -> Self { + Self { + per_page: Some(per_page), + cursor: self.cursor, + } + } + + /// Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. + pub fn cursor(self, cursor: &'req str) -> Self { + Self { + per_page: self.per_page, + cursor: Some(cursor), + } + } +} + /// Query parameters for the [List organization webhooks](Orgs::list_webhooks_async()) endpoint. #[derive(Default, Serialize)] pub struct OrgsListWebhooksParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1476,7 +1570,7 @@ impl OrgsListWebhooksParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -2716,6 +2810,87 @@ impl<'api> Orgs<'api> { } } + /// --- + /// + /// # Get a webhook delivery for an organization webhook + /// + /// Returns a delivery for a webhook configured in an organization. + /// + /// [GitHub API docs for get_webhook_delivery](https://docs.github.com/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook) + /// + /// --- + pub async fn get_webhook_delivery_async(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result { + + let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(OrgsGetWebhookDeliveryError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(OrgsGetWebhookDeliveryError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(OrgsGetWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # Get a webhook delivery for an organization webhook + /// + /// Returns a delivery for a webhook configured in an organization. + /// + /// [GitHub API docs for get_webhook_delivery](https://docs.github.com/rest/reference/orgs#get-a-webhook-delivery-for-an-organization-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn get_webhook_delivery(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result { + + let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(OrgsGetWebhookDeliveryError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(OrgsGetWebhookDeliveryError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(OrgsGetWebhookDeliveryError::Generic { code }), + } + } + } + /// --- /// /// # List organizations @@ -3860,6 +4035,96 @@ impl<'api> Orgs<'api> { } } + /// --- + /// + /// # List deliveries for an organization webhook + /// + /// Returns a list of webhook deliveries for a webhook configured in an organization. + /// + /// [GitHub API docs for list_webhook_deliveries](https://docs.github.com/rest/reference/orgs#list-deliveries-for-an-organization-webhook) + /// + /// --- + pub async fn list_webhook_deliveries_async(&self, org: &str, hook_id: i32, query_params: Option>>) -> Result, OrgsListWebhookDeliveriesError> { + + let mut request_uri = format!("{}/orgs/{}/hooks/{}/deliveries", super::GITHUB_BASE_API_URL, org, hook_id); + + if let Some(params) = query_params { + request_uri.push_str("?"); + request_uri.push_str(&serde_urlencoded::to_string(params.into())?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(OrgsListWebhookDeliveriesError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(OrgsListWebhookDeliveriesError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(OrgsListWebhookDeliveriesError::Generic { code }), + } + } + } + + /// --- + /// + /// # List deliveries for an organization webhook + /// + /// Returns a list of webhook deliveries for a webhook configured in an organization. + /// + /// [GitHub API docs for list_webhook_deliveries](https://docs.github.com/rest/reference/orgs#list-deliveries-for-an-organization-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn list_webhook_deliveries(&self, org: &str, hook_id: i32, query_params: Option>>) -> Result, OrgsListWebhookDeliveriesError> { + + let mut request_uri = format!("{}/orgs/{}/hooks/{}/deliveries", super::GITHUB_BASE_API_URL, org, hook_id); + + if let Some(params) = query_params { + request_uri.push_str("?"); + let qp: OrgsListWebhookDeliveriesParams = params.into(); + request_uri.push_str(&serde_urlencoded::to_string(qp)?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(OrgsListWebhookDeliveriesError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(OrgsListWebhookDeliveriesError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(OrgsListWebhookDeliveriesError::Generic { code }), + } + } + } + /// --- /// /// # List organization webhooks @@ -4023,6 +4288,87 @@ impl<'api> Orgs<'api> { } } + /// --- + /// + /// # Redeliver a delivery for an organization webhook + /// + /// Redeliver a delivery for a webhook configured in an organization. + /// + /// [GitHub API docs for redeliver_webhook_delivery](https://docs.github.com/rest/reference/orgs#redeliver-a-delivery-for-an-organization-webhook) + /// + /// --- + pub async fn redeliver_webhook_delivery_async(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result, OrgsRedeliverWebhookDeliveryError> { + + let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(OrgsRedeliverWebhookDeliveryError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(OrgsRedeliverWebhookDeliveryError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(OrgsRedeliverWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # Redeliver a delivery for an organization webhook + /// + /// Redeliver a delivery for a webhook configured in an organization. + /// + /// [GitHub API docs for redeliver_webhook_delivery](https://docs.github.com/rest/reference/orgs#redeliver-a-delivery-for-an-organization-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn redeliver_webhook_delivery(&self, org: &str, hook_id: i32, delivery_id: i32) -> Result, OrgsRedeliverWebhookDeliveryError> { + + let request_uri = format!("{}/orgs/{}/hooks/{}/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, org, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(OrgsRedeliverWebhookDeliveryError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(OrgsRedeliverWebhookDeliveryError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(OrgsRedeliverWebhookDeliveryError::Generic { code }), + } + } + } + /// --- /// /// # Remove an organization member diff --git a/src/endpoints/packages.rs b/src/endpoints/packages.rs index 5902938..79157a6 100644 --- a/src/endpoints/packages.rs +++ b/src/endpoints/packages.rs @@ -392,7 +392,7 @@ pub enum PackagesRestorePackageVersionForOrgError { pub struct PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParams<'req> { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// The state of the package, either active or deleted. state: Option<&'req str> @@ -412,7 +412,7 @@ impl<'req> PackagesGetAllPackageVersionsForPackageOwnedByAuthenticatedUserParams } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, @@ -445,7 +445,7 @@ impl<'enc> From<&'enc PerPage> for PackagesGetAllPackageVersionsForPackageOwnedB pub struct PackagesGetAllPackageVersionsForPackageOwnedByOrgParams<'req> { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// The state of the package, either active or deleted. state: Option<&'req str> @@ -465,7 +465,7 @@ impl<'req> PackagesGetAllPackageVersionsForPackageOwnedByOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, diff --git a/src/endpoints/projects.rs b/src/endpoints/projects.rs index b762504..ab59ad9 100644 --- a/src/endpoints/projects.rs +++ b/src/endpoints/projects.rs @@ -678,7 +678,7 @@ pub enum ProjectsUpdateColumnError { pub struct ProjectsListCardsParams<'req> { /// Filters the project cards that are returned by the card's state. Can be one of `all`,`archived`, or `not_archived`. archived_state: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -698,7 +698,7 @@ impl<'req> ProjectsListCardsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { archived_state: self.archived_state, @@ -731,7 +731,7 @@ impl<'enc> From<&'enc PerPage> for ProjectsListCardsParams<'enc> { pub struct ProjectsListCollaboratorsParams<'req> { /// Filters the collaborators by their affiliation. Can be one of: \\* `outside`: Outside collaborators of a project that are not a member of the project's organization. \\* `direct`: Collaborators with permissions to a project, regardless of organization membership status. \\* `all`: All collaborators the authenticated user can see. affiliation: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -751,7 +751,7 @@ impl<'req> ProjectsListCollaboratorsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { affiliation: self.affiliation, @@ -782,7 +782,7 @@ impl<'enc> From<&'enc PerPage> for ProjectsListCollaboratorsParams<'enc> { /// Query parameters for the [List project columns](Projects::list_columns_async()) endpoint. #[derive(Default, Serialize)] pub struct ProjectsListColumnsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -793,7 +793,7 @@ impl ProjectsListColumnsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -824,7 +824,7 @@ impl<'enc> From<&'enc PerPage> for ProjectsListColumnsParams { pub struct ProjectsListForOrgParams<'req> { /// Indicates the state of the projects to return. Can be either `open`, `closed`, or `all`. state: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -844,7 +844,7 @@ impl<'req> ProjectsListForOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, @@ -877,7 +877,7 @@ impl<'enc> From<&'enc PerPage> for ProjectsListForOrgParams<'enc> { pub struct ProjectsListForRepoParams<'req> { /// Indicates the state of the projects to return. Can be either `open`, `closed`, or `all`. state: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -897,7 +897,7 @@ impl<'req> ProjectsListForRepoParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, @@ -930,7 +930,7 @@ impl<'enc> From<&'enc PerPage> for ProjectsListForRepoParams<'enc> { pub struct ProjectsListForUserParams<'req> { /// Indicates the state of the projects to return. Can be either `open`, `closed`, or `all`. state: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -950,7 +950,7 @@ impl<'req> ProjectsListForUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, diff --git a/src/endpoints/pulls.rs b/src/endpoints/pulls.rs index 197ff3f..ad5e3db 100644 --- a/src/endpoints/pulls.rs +++ b/src/endpoints/pulls.rs @@ -584,7 +584,7 @@ pub struct PullsListParams<'req> { sort: Option<&'req str>, /// The direction of the sort. Can be either `asc` or `desc`. Default: `desc` when sort is `created` or sort is not specified, otherwise `asc`. direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -660,7 +660,7 @@ impl<'req> PullsListParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, @@ -699,7 +699,7 @@ impl<'enc> From<&'enc PerPage> for PullsListParams<'enc> { /// Query parameters for the [List comments for a pull request review](Pulls::list_comments_for_review_async()) endpoint. #[derive(Default, Serialize)] pub struct PullsListCommentsForReviewParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -710,7 +710,7 @@ impl PullsListCommentsForReviewParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -739,7 +739,7 @@ impl<'enc> From<&'enc PerPage> for PullsListCommentsForReviewParams { /// Query parameters for the [List commits on a pull request](Pulls::list_commits_async()) endpoint. #[derive(Default, Serialize)] pub struct PullsListCommitsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -750,7 +750,7 @@ impl PullsListCommitsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -779,7 +779,7 @@ impl<'enc> From<&'enc PerPage> for PullsListCommitsParams { /// Query parameters for the [List pull requests files](Pulls::list_files_async()) endpoint. #[derive(Default, Serialize)] pub struct PullsListFilesParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -790,7 +790,7 @@ impl PullsListFilesParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -819,7 +819,7 @@ impl<'enc> From<&'enc PerPage> for PullsListFilesParams { /// Query parameters for the [List requested reviewers for a pull request](Pulls::list_requested_reviewers_async()) endpoint. #[derive(Default, Serialize)] pub struct PullsListRequestedReviewersParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -830,7 +830,7 @@ impl PullsListRequestedReviewersParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -865,7 +865,7 @@ pub struct PullsListReviewCommentsParams<'req> { direction: Option<&'req str>, /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -909,7 +909,7 @@ impl<'req> PullsListReviewCommentsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -950,7 +950,7 @@ pub struct PullsListReviewCommentsForRepoParams<'req> { direction: Option<&'req str>, /// Only show notifications updated after the given time. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. since: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -994,7 +994,7 @@ impl<'req> PullsListReviewCommentsForRepoParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -1029,7 +1029,7 @@ impl<'enc> From<&'enc PerPage> for PullsListReviewCommentsForRepoParams<'enc> { /// Query parameters for the [List reviews for a pull request](Pulls::list_reviews_async()) endpoint. #[derive(Default, Serialize)] pub struct PullsListReviewsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1040,7 +1040,7 @@ impl PullsListReviewsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/reactions.rs b/src/endpoints/reactions.rs index fb0c1c9..1ab1914 100644 --- a/src/endpoints/reactions.rs +++ b/src/endpoints/reactions.rs @@ -507,7 +507,7 @@ pub enum ReactionsListForTeamDiscussionLegacyError { pub struct ReactionsListForCommitCommentParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a commit comment. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -527,7 +527,7 @@ impl<'req> ReactionsListForCommitCommentParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -560,7 +560,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForCommitCommentParams<'enc> { pub struct ReactionsListForIssueParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -580,7 +580,7 @@ impl<'req> ReactionsListForIssueParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -613,7 +613,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForIssueParams<'enc> { pub struct ReactionsListForIssueCommentParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to an issue comment. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -633,7 +633,7 @@ impl<'req> ReactionsListForIssueCommentParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -666,7 +666,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForIssueCommentParams<'enc> { pub struct ReactionsListForPullRequestReviewCommentParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a pull request review comment. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -686,7 +686,7 @@ impl<'req> ReactionsListForPullRequestReviewCommentParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -719,7 +719,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForPullRequestReviewCommentParam pub struct ReactionsListForTeamDiscussionCommentInOrgParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -739,7 +739,7 @@ impl<'req> ReactionsListForTeamDiscussionCommentInOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -772,7 +772,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionCommentInOrgPar pub struct ReactionsListForTeamDiscussionCommentLegacyParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion comment. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -792,7 +792,7 @@ impl<'req> ReactionsListForTeamDiscussionCommentLegacyParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -825,7 +825,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionCommentLegacyPa pub struct ReactionsListForTeamDiscussionInOrgParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -845,7 +845,7 @@ impl<'req> ReactionsListForTeamDiscussionInOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, @@ -878,7 +878,7 @@ impl<'enc> From<&'enc PerPage> for ReactionsListForTeamDiscussionInOrgParams<'en pub struct ReactionsListForTeamDiscussionLegacyParams<'req> { /// Returns a single [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types). Omit this parameter to list all reactions to a team discussion. content: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -898,7 +898,7 @@ impl<'req> ReactionsListForTeamDiscussionLegacyParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { content: self.content, diff --git a/src/endpoints/repos.rs b/src/endpoints/repos.rs index b999fad..0b0dfb8 100644 --- a/src/endpoints/repos.rs +++ b/src/endpoints/repos.rs @@ -218,6 +218,25 @@ pub enum ReposCompareCommitsError { Generic { code: u16 }, } +/// Errors for the [Create an autolink reference for a repository](Repos::create_autolink_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposCreateAutolinkError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [Create a commit comment](Repos::create_commit_comment_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum ReposCreateCommitCommentError { @@ -659,6 +678,25 @@ pub enum ReposDeleteAnEnvironmentError { Generic { code: u16 }, } +/// Errors for the [Delete an autolink reference from a repository](Repos::delete_autolink_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposDeleteAutolinkError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Resource not found")] + Status404(BasicError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [Delete branch protection](Repos::delete_branch_protection_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum ReposDeleteBranchProtectionError { @@ -1132,6 +1170,25 @@ pub enum ReposGetAppsWithAccessToProtectedBranchError { Generic { code: u16 }, } +/// Errors for the [Get an autolink reference of a repository](Repos::get_autolink_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposGetAutolinkError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Resource not found")] + Status404(BasicError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [Get a branch](Repos::get_branch_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum ReposGetBranchError { @@ -1874,6 +1931,44 @@ pub enum ReposGetWebhookConfigForRepoError { Generic { code: u16 }, } +/// Errors for the [Get a delivery for a repository webhook](Repos::get_webhook_delivery_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposGetWebhookDeliveryError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + +/// Errors for the [List all autolinks of a repository](Repos::list_autolinks_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposListAutolinksError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [List branches](Repos::list_branches_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum ReposListBranchesError { @@ -2351,6 +2446,27 @@ pub enum ReposListTeamsError { Generic { code: u16 }, } +/// Errors for the [List deliveries for a repository webhook](Repos::list_webhook_deliveries_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposListWebhookDeliveriesError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [List repository webhooks](Repos::list_webhooks_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum ReposListWebhooksError { @@ -2416,6 +2532,27 @@ pub enum ReposPingWebhookError { Generic { code: u16 }, } +/// Errors for the [Redeliver a delivery for a repository webhook](Repos::redeliver_webhook_delivery_async()) endpoint. +#[derive(Debug, thiserror::Error)] +pub enum ReposRedeliverWebhookDeliveryError { + #[error(transparent)] + AdapterError(#[from] AdapterError), + #[error(transparent)] + SerdeJson(#[from] serde_json::Error), + #[error(transparent)] + SerdeUrl(#[from] serde_urlencoded::ser::Error), + + + // -- endpoint errors + + #[error("Bad Request")] + Status400(BasicError), + #[error("Validation failed")] + Status422(ValidationError), + #[error("Status code: {}", code)] + Generic { code: u16 }, +} + /// Errors for the [Remove app access restrictions](Repos::remove_app_access_restrictions_async()) endpoint. #[derive(Debug, thiserror::Error)] pub enum ReposRemoveAppAccessRestrictionsError { @@ -3006,7 +3143,7 @@ impl<'enc> From<&'enc PerPage> for ReposCompareCommitsParams { pub struct ReposGetAllTopicsParams { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -3023,7 +3160,7 @@ impl ReposGetAllTopicsParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, @@ -3064,7 +3201,7 @@ impl<'req> ReposGetClonesParams<'req> { /// Query parameters for the [Get the combined status for a specific reference](Repos::get_combined_status_for_ref_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposGetCombinedStatusForRefParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3075,7 +3212,7 @@ impl ReposGetCombinedStatusForRefParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -3106,7 +3243,7 @@ impl<'enc> From<&'enc PerPage> for ReposGetCombinedStatusForRefParams { pub struct ReposGetCommitParams { /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -3123,7 +3260,7 @@ impl ReposGetCommitParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { page: self.page, @@ -3221,12 +3358,32 @@ impl<'req> ReposGetViewsParams<'req> { } } +/// Query parameters for the [List all autolinks of a repository](Repos::list_autolinks_async()) endpoint. +#[derive(Default, Serialize)] +pub struct ReposListAutolinksParams { + /// Page number of the results to fetch. + page: Option +} + +impl ReposListAutolinksParams { + pub fn new() -> Self { + Self::default() + } + + /// Page number of the results to fetch. + pub fn page(self, page: u16) -> Self { + Self { + page: Some(page), + } + } +} + /// Query parameters for the [List branches](Repos::list_branches_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListBranchesParams { /// Setting to `true` returns only protected branches. When set to `false`, only unprotected branches are returned. Omitting this parameter returns all branches. protected: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3246,7 +3403,7 @@ impl ReposListBranchesParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { protected: self.protected, @@ -3279,7 +3436,7 @@ impl<'enc> From<&'enc PerPage> for ReposListBranchesParams { pub struct ReposListCollaboratorsParams<'req> { /// Filter collaborators returned by their affiliation. Can be one of: \\* `outside`: All outside collaborators of an organization-owned repository. \\* `direct`: All collaborators with permissions to an organization-owned repository, regardless of organization membership status. \\* `all`: All collaborators the authenticated user can see. affiliation: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3299,7 +3456,7 @@ impl<'req> ReposListCollaboratorsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { affiliation: self.affiliation, @@ -3330,7 +3487,7 @@ impl<'enc> From<&'enc PerPage> for ReposListCollaboratorsParams<'enc> { /// Query parameters for the [List commit comments](Repos::list_comments_for_commit_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListCommentsForCommitParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3341,7 +3498,7 @@ impl ReposListCommentsForCommitParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -3370,7 +3527,7 @@ impl<'enc> From<&'enc PerPage> for ReposListCommentsForCommitParams { /// Query parameters for the [List commit comments for a repository](Repos::list_commit_comments_for_repo_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListCommitCommentsForRepoParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3381,7 +3538,7 @@ impl ReposListCommitCommentsForRepoParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -3410,7 +3567,7 @@ impl<'enc> From<&'enc PerPage> for ReposListCommitCommentsForRepoParams { /// Query parameters for the [List commit statuses for a reference](Repos::list_commit_statuses_for_ref_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListCommitStatusesForRefParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3421,7 +3578,7 @@ impl ReposListCommitStatusesForRefParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -3460,7 +3617,7 @@ pub struct ReposListCommitsParams<'req> { since: Option>, /// Only commits before this date will be returned. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. until: Option>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3536,7 +3693,7 @@ impl<'req> ReposListCommitsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sha: self.sha, @@ -3577,7 +3734,7 @@ impl<'enc> From<&'enc PerPage> for ReposListCommitsParams<'enc> { pub struct ReposListContributorsParams<'req> { /// Set to `1` or `true` to include anonymous contributors in results. anon: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3597,7 +3754,7 @@ impl<'req> ReposListContributorsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { anon: self.anon, @@ -3628,7 +3785,7 @@ impl<'enc> From<&'enc PerPage> for ReposListContributorsParams<'enc> { /// Query parameters for the [List deploy keys](Repos::list_deploy_keys_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListDeployKeysParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3639,7 +3796,7 @@ impl ReposListDeployKeysParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -3668,7 +3825,7 @@ impl<'enc> From<&'enc PerPage> for ReposListDeployKeysParams { /// Query parameters for the [List deployment statuses](Repos::list_deployment_statuses_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListDeploymentStatusesParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3679,7 +3836,7 @@ impl ReposListDeploymentStatusesParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -3716,7 +3873,7 @@ pub struct ReposListDeploymentsParams<'req> { task: Option<&'req str>, /// The name of the environment that was deployed to (e.g., `staging` or `production`). environment: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -3775,7 +3932,7 @@ impl<'req> ReposListDeploymentsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sha: self.sha, @@ -3822,7 +3979,7 @@ pub struct ReposListForAuthenticatedUserParams<'req> { sort: Option<&'req str>, /// Can be one of `asc` or `desc`. Default: `asc` when using `full_name`, otherwise `desc` direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -3912,7 +4069,7 @@ impl<'req> ReposListForAuthenticatedUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { visibility: self.visibility, @@ -3991,7 +4148,7 @@ pub struct ReposListForOrgParams<'req> { sort: Option<&'req str>, /// Can be one of `asc` or `desc`. Default: when using `full_name`: `asc`, otherwise `desc` direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4035,7 +4192,7 @@ impl<'req> ReposListForOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { _type: self._type, @@ -4076,7 +4233,7 @@ pub struct ReposListForUserParams<'req> { sort: Option<&'req str>, /// Can be one of `asc` or `desc`. Default: `asc` when using `full_name`, otherwise `desc` direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4120,7 +4277,7 @@ impl<'req> ReposListForUserParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { _type: self._type, @@ -4157,7 +4314,7 @@ impl<'enc> From<&'enc PerPage> for ReposListForUserParams<'enc> { pub struct ReposListForksParams<'req> { /// The sort order. Can be either `newest`, `oldest`, or `stargazers`. sort: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4177,7 +4334,7 @@ impl<'req> ReposListForksParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { sort: self.sort, @@ -4208,7 +4365,7 @@ impl<'enc> From<&'enc PerPage> for ReposListForksParams<'enc> { /// Query parameters for the [List repository invitations](Repos::list_invitations_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListInvitationsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4219,7 +4376,7 @@ impl ReposListInvitationsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4248,7 +4405,7 @@ impl<'enc> From<&'enc PerPage> for ReposListInvitationsParams { /// Query parameters for the [List repository invitations for the authenticated user](Repos::list_invitations_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListInvitationsForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4259,7 +4416,7 @@ impl ReposListInvitationsForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4288,7 +4445,7 @@ impl<'enc> From<&'enc PerPage> for ReposListInvitationsForAuthenticatedUserParam /// Query parameters for the [List GitHub Pages builds](Repos::list_pages_builds_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListPagesBuildsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4299,7 +4456,7 @@ impl ReposListPagesBuildsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4348,7 +4505,7 @@ impl ReposListPublicParams { /// Query parameters for the [List pull requests associated with a commit](Repos::list_pull_requests_associated_with_commit_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListPullRequestsAssociatedWithCommitParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4359,7 +4516,7 @@ impl ReposListPullRequestsAssociatedWithCommitParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4388,7 +4545,7 @@ impl<'enc> From<&'enc PerPage> for ReposListPullRequestsAssociatedWithCommitPara /// Query parameters for the [List release assets](Repos::list_release_assets_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListReleaseAssetsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4399,7 +4556,7 @@ impl ReposListReleaseAssetsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4428,7 +4585,7 @@ impl<'enc> From<&'enc PerPage> for ReposListReleaseAssetsParams { /// Query parameters for the [List releases](Repos::list_releases_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListReleasesParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4439,7 +4596,7 @@ impl ReposListReleasesParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4468,7 +4625,7 @@ impl<'enc> From<&'enc PerPage> for ReposListReleasesParams { /// Query parameters for the [List repository tags](Repos::list_tags_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListTagsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4479,7 +4636,7 @@ impl ReposListTagsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4508,7 +4665,7 @@ impl<'enc> From<&'enc PerPage> for ReposListTagsParams { /// Query parameters for the [List repository teams](Repos::list_teams_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListTeamsParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4519,7 +4676,7 @@ impl ReposListTeamsParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4545,10 +4702,41 @@ impl<'enc> From<&'enc PerPage> for ReposListTeamsParams { } } } +/// Query parameters for the [List deliveries for a repository webhook](Repos::list_webhook_deliveries_async()) endpoint. +#[derive(Default, Serialize)] +pub struct ReposListWebhookDeliveriesParams<'req> { + /// Results per page (max 100) + per_page: Option, + /// Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. + cursor: Option<&'req str> +} + +impl<'req> ReposListWebhookDeliveriesParams<'req> { + pub fn new() -> Self { + Self::default() + } + + /// Results per page (max 100) + pub fn per_page(self, per_page: u16) -> Self { + Self { + per_page: Some(per_page), + cursor: self.cursor, + } + } + + /// Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. + pub fn cursor(self, cursor: &'req str) -> Self { + Self { + per_page: self.per_page, + cursor: Some(cursor), + } + } +} + /// Query parameters for the [List repository webhooks](Repos::list_webhooks_async()) endpoint. #[derive(Default, Serialize)] pub struct ReposListWebhooksParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -4559,7 +4747,7 @@ impl ReposListWebhooksParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -4589,7 +4777,7 @@ impl<'enc> From<&'enc PerPage> for ReposListWebhooksParams { #[derive(Default, Serialize)] pub struct ReposUploadReleaseAssetParams<'req> { - name: Option<&'req str>, + name: &'req str, label: Option<&'req str> } @@ -4602,7 +4790,7 @@ impl<'req> ReposUploadReleaseAssetParams<'req> { pub fn name(self, name: &'req str) -> Self { Self { - name: Some(name), + name: name, label: self.label, } } @@ -5496,23 +5684,21 @@ impl<'api> Repos<'api> { /// --- /// - /// # Create a commit comment + /// # Create an autolink reference for a repository /// - /// Create a comment for a commit using its `:commit_sha`. + /// Users with admin access to the repository can create an autolink. /// - /// This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. - /// - /// [GitHub API docs for create_commit_comment](https://docs.github.com/rest/reference/repos#create-a-commit-comment) + /// [GitHub API docs for create_autolink](https://docs.github.com/v3/repos#create-an-autolink) /// /// --- - pub async fn create_commit_comment_async(&self, owner: &str, repo: &str, commit_sha: &str, body: PostReposCreateCommitComment) -> Result { + pub async fn create_autolink_async(&self, owner: &str, repo: &str, body: PostReposCreateAutolink) -> Result { - let request_uri = format!("{}/repos/{}/{}/commits/{}/comments", super::GITHUB_BASE_API_URL, owner, repo, commit_sha); + let request_uri = format!("{}/repos/{}/{}/autolinks", super::GITHUB_BASE_API_URL, owner, repo); let req = GitHubRequest { uri: request_uri, - body: Some(PostReposCreateCommitComment::from_json(body)?), + body: Some(PostReposCreateAutolink::from_json(body)?), method: "POST", headers: vec![] }; @@ -5529,33 +5715,30 @@ impl<'api> Repos<'api> { Ok(crate::adapters::to_json_async(github_response).await?) } else { match github_response.status_code() { - 403 => Err(ReposCreateCommitCommentError::Status403(crate::adapters::to_json_async(github_response).await?)), - 422 => Err(ReposCreateCommitCommentError::Status422(crate::adapters::to_json_async(github_response).await?)), - code => Err(ReposCreateCommitCommentError::Generic { code }), + 422 => Err(ReposCreateAutolinkError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposCreateAutolinkError::Generic { code }), } } } /// --- /// - /// # Create a commit comment + /// # Create an autolink reference for a repository /// - /// Create a comment for a commit using its `:commit_sha`. - /// - /// This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + /// Users with admin access to the repository can create an autolink. /// - /// [GitHub API docs for create_commit_comment](https://docs.github.com/rest/reference/repos#create-a-commit-comment) + /// [GitHub API docs for create_autolink](https://docs.github.com/v3/repos#create-an-autolink) /// /// --- #[cfg(not(target_arch = "wasm32"))] - pub fn create_commit_comment(&self, owner: &str, repo: &str, commit_sha: &str, body: PostReposCreateCommitComment) -> Result { + pub fn create_autolink(&self, owner: &str, repo: &str, body: PostReposCreateAutolink) -> Result { - let request_uri = format!("{}/repos/{}/{}/commits/{}/comments", super::GITHUB_BASE_API_URL, owner, repo, commit_sha); + let request_uri = format!("{}/repos/{}/{}/autolinks", super::GITHUB_BASE_API_URL, owner, repo); let req = GitHubRequest { uri: request_uri, - body: Some(PostReposCreateCommitComment::from_json(body)?), + body: Some(PostReposCreateAutolink::from_json(body)?), method: "POST", headers: vec![] }; @@ -5572,37 +5755,33 @@ impl<'api> Repos<'api> { Ok(crate::adapters::to_json(github_response)?) } else { match github_response.status_code() { - 403 => Err(ReposCreateCommitCommentError::Status403(crate::adapters::to_json(github_response)?)), - 422 => Err(ReposCreateCommitCommentError::Status422(crate::adapters::to_json(github_response)?)), - code => Err(ReposCreateCommitCommentError::Generic { code }), + 422 => Err(ReposCreateAutolinkError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(ReposCreateAutolinkError::Generic { code }), } } } /// --- /// - /// # Create commit signature protection + /// # Create a commit comment /// - /// Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + /// Create a comment for a commit using its `:commit_sha`. /// - /// When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits. + /// This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. /// - /// [GitHub API docs for create_commit_signature_protection](https://docs.github.com/rest/reference/repos#create-commit-signature-protection) - /// - /// The `create_commit_signature_protection_async` endpoint is enabled with the `zzzax` cargo feature. + /// [GitHub API docs for create_commit_comment](https://docs.github.com/rest/reference/repos#create-a-commit-comment) /// /// --- - #[cfg(feature = "zzzax")] - pub async fn create_commit_signature_protection_async(&self, owner: &str, repo: &str, branch: &str) -> Result { + pub async fn create_commit_comment_async(&self, owner: &str, repo: &str, commit_sha: &str, body: PostReposCreateCommitComment) -> Result { - let request_uri = format!("{}/repos/{}/{}/branches/{}/protection/required_signatures", super::GITHUB_BASE_API_URL, owner, repo, branch); + let request_uri = format!("{}/repos/{}/{}/commits/{}/comments", super::GITHUB_BASE_API_URL, owner, repo, commit_sha); let req = GitHubRequest { uri: request_uri, - body: None, + body: Some(PostReposCreateCommitComment::from_json(body)?), method: "POST", - headers: vec![("Accept", "application/vnd.github.zzzax-preview+json"), ] + headers: vec![] }; let request = GitHubRequestBuilder::build(req, self.auth)?; @@ -5617,7 +5796,95 @@ impl<'api> Repos<'api> { Ok(crate::adapters::to_json_async(github_response).await?) } else { match github_response.status_code() { - 404 => Err(ReposCreateCommitSignatureProtectionError::Status404(crate::adapters::to_json_async(github_response).await?)), + 403 => Err(ReposCreateCommitCommentError::Status403(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(ReposCreateCommitCommentError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposCreateCommitCommentError::Generic { code }), + } + } + } + + /// --- + /// + /// # Create a commit comment + /// + /// Create a comment for a commit using its `:commit_sha`. + /// + /// This endpoint triggers [notifications](https://docs.github.com/en/github/managing-subscriptions-and-notifications-on-github/about-notifications). Creating content too quickly using this endpoint may result in abuse rate limiting. See "[Abuse rate limits](https://docs.github.com/rest/overview/resources-in-the-rest-api#abuse-rate-limits)" and "[Dealing with abuse rate limits](https://docs.github.com/rest/guides/best-practices-for-integrators#dealing-with-rate-limits)" for details. + /// + /// [GitHub API docs for create_commit_comment](https://docs.github.com/rest/reference/repos#create-a-commit-comment) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn create_commit_comment(&self, owner: &str, repo: &str, commit_sha: &str, body: PostReposCreateCommitComment) -> Result { + + let request_uri = format!("{}/repos/{}/{}/commits/{}/comments", super::GITHUB_BASE_API_URL, owner, repo, commit_sha); + + + let req = GitHubRequest { + uri: request_uri, + body: Some(PostReposCreateCommitComment::from_json(body)?), + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 403 => Err(ReposCreateCommitCommentError::Status403(crate::adapters::to_json(github_response)?)), + 422 => Err(ReposCreateCommitCommentError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(ReposCreateCommitCommentError::Generic { code }), + } + } + } + + /// --- + /// + /// # Create commit signature protection + /// + /// Protected branches are available in public repositories with GitHub Free and GitHub Free for organizations, and in public and private repositories with GitHub Pro, GitHub Team, GitHub Enterprise Cloud, and GitHub Enterprise Server. For more information, see [GitHub's products](https://help.github.com/github/getting-started-with-github/githubs-products) in the GitHub Help documentation. + /// + /// When authenticated with admin or owner permissions to the repository, you can use this endpoint to require signed commits on a branch. You must enable branch protection to require signed commits. + /// + /// [GitHub API docs for create_commit_signature_protection](https://docs.github.com/rest/reference/repos#create-commit-signature-protection) + /// + /// The `create_commit_signature_protection_async` endpoint is enabled with the `zzzax` cargo feature. + /// + /// --- + #[cfg(feature = "zzzax")] + pub async fn create_commit_signature_protection_async(&self, owner: &str, repo: &str, branch: &str) -> Result { + + let request_uri = format!("{}/repos/{}/{}/branches/{}/protection/required_signatures", super::GITHUB_BASE_API_URL, owner, repo, branch); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![("Accept", "application/vnd.github.zzzax-preview+json"), ] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 404 => Err(ReposCreateCommitSignatureProtectionError::Status404(crate::adapters::to_json_async(github_response).await?)), code => Err(ReposCreateCommitSignatureProtectionError::Generic { code }), } } @@ -7445,6 +7712,89 @@ impl<'api> Repos<'api> { } } + /// --- + /// + /// # Delete an autolink reference from a repository + /// + /// This deletes a single autolink reference by ID that was configured for the given repository. + /// + /// Information about autolinks are only available to repository administrators. + /// + /// [GitHub API docs for delete_autolink](https://docs.github.com/v3/repos#delete-autolink) + /// + /// --- + pub async fn delete_autolink_async(&self, owner: &str, repo: &str, autolink_id: i32) -> Result<(), ReposDeleteAutolinkError> { + + let request_uri = format!("{}/repos/{}/{}/autolinks/{}", super::GITHUB_BASE_API_URL, owner, repo, autolink_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "DELETE", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 404 => Err(ReposDeleteAutolinkError::Status404(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposDeleteAutolinkError::Generic { code }), + } + } + } + + /// --- + /// + /// # Delete an autolink reference from a repository + /// + /// This deletes a single autolink reference by ID that was configured for the given repository. + /// + /// Information about autolinks are only available to repository administrators. + /// + /// [GitHub API docs for delete_autolink](https://docs.github.com/v3/repos#delete-autolink) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn delete_autolink(&self, owner: &str, repo: &str, autolink_id: i32) -> Result<(), ReposDeleteAutolinkError> { + + let request_uri = format!("{}/repos/{}/{}/autolinks/{}", super::GITHUB_BASE_API_URL, owner, repo, autolink_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "DELETE", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 404 => Err(ReposDeleteAutolinkError::Status404(crate::adapters::to_json(github_response)?)), + code => Err(ReposDeleteAutolinkError::Generic { code }), + } + } + } + /// --- /// /// # Delete branch protection @@ -9517,6 +9867,89 @@ impl<'api> Repos<'api> { } } + /// --- + /// + /// # Get an autolink reference of a repository + /// + /// This returns a single autolink reference by ID that was configured for the given repository. + /// + /// Information about autolinks are only available to repository administrators. + /// + /// [GitHub API docs for get_autolink](https://docs.github.com/v3/repos#get-autolink) + /// + /// --- + pub async fn get_autolink_async(&self, owner: &str, repo: &str, autolink_id: i32) -> Result { + + let request_uri = format!("{}/repos/{}/{}/autolinks/{}", super::GITHUB_BASE_API_URL, owner, repo, autolink_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 404 => Err(ReposGetAutolinkError::Status404(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposGetAutolinkError::Generic { code }), + } + } + } + + /// --- + /// + /// # Get an autolink reference of a repository + /// + /// This returns a single autolink reference by ID that was configured for the given repository. + /// + /// Information about autolinks are only available to repository administrators. + /// + /// [GitHub API docs for get_autolink](https://docs.github.com/v3/repos#get-autolink) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn get_autolink(&self, owner: &str, repo: &str, autolink_id: i32) -> Result { + + let request_uri = format!("{}/repos/{}/{}/autolinks/{}", super::GITHUB_BASE_API_URL, owner, repo, autolink_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 404 => Err(ReposGetAutolinkError::Status404(crate::adapters::to_json(github_response)?)), + code => Err(ReposGetAutolinkError::Generic { code }), + } + } + } + /// --- /// /// # Get a branch @@ -12852,6 +13285,177 @@ impl<'api> Repos<'api> { } } + /// --- + /// + /// # Get a delivery for a repository webhook + /// + /// Returns a delivery for a webhook configured in a repository. + /// + /// [GitHub API docs for get_webhook_delivery](https://docs.github.com/rest/reference/repos#get-a-delivery-for-a-repository-webhook) + /// + /// --- + pub async fn get_webhook_delivery_async(&self, owner: &str, repo: &str, hook_id: i32, delivery_id: i32) -> Result { + + let request_uri = format!("{}/repos/{}/{}/hooks/{}/deliveries/{}", super::GITHUB_BASE_API_URL, owner, repo, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(ReposGetWebhookDeliveryError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(ReposGetWebhookDeliveryError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposGetWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # Get a delivery for a repository webhook + /// + /// Returns a delivery for a webhook configured in a repository. + /// + /// [GitHub API docs for get_webhook_delivery](https://docs.github.com/rest/reference/repos#get-a-delivery-for-a-repository-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn get_webhook_delivery(&self, owner: &str, repo: &str, hook_id: i32, delivery_id: i32) -> Result { + + let request_uri = format!("{}/repos/{}/{}/hooks/{}/deliveries/{}", super::GITHUB_BASE_API_URL, owner, repo, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(ReposGetWebhookDeliveryError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(ReposGetWebhookDeliveryError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(ReposGetWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # List all autolinks of a repository + /// + /// This returns a list of autolinks configured for the given repository. + /// + /// Information about autolinks are only available to repository administrators. + /// + /// [GitHub API docs for list_autolinks](https://docs.github.com/v3/repos#list-autolinks) + /// + /// --- + pub async fn list_autolinks_async(&self, owner: &str, repo: &str, query_params: Option>) -> Result, ReposListAutolinksError> { + + let mut request_uri = format!("{}/repos/{}/{}/autolinks", super::GITHUB_BASE_API_URL, owner, repo); + + if let Some(params) = query_params { + request_uri.push_str("?"); + request_uri.push_str(&serde_urlencoded::to_string(params.into())?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + code => Err(ReposListAutolinksError::Generic { code }), + } + } + } + + /// --- + /// + /// # List all autolinks of a repository + /// + /// This returns a list of autolinks configured for the given repository. + /// + /// Information about autolinks are only available to repository administrators. + /// + /// [GitHub API docs for list_autolinks](https://docs.github.com/v3/repos#list-autolinks) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn list_autolinks(&self, owner: &str, repo: &str, query_params: Option>) -> Result, ReposListAutolinksError> { + + let mut request_uri = format!("{}/repos/{}/{}/autolinks", super::GITHUB_BASE_API_URL, owner, repo); + + if let Some(params) = query_params { + request_uri.push_str("?"); + let qp: ReposListAutolinksParams = params.into(); + request_uri.push_str(&serde_urlencoded::to_string(qp)?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + code => Err(ReposListAutolinksError::Generic { code }), + } + } + } + /// --- /// /// # List branches @@ -15154,6 +15758,96 @@ impl<'api> Repos<'api> { } } + /// --- + /// + /// # List deliveries for a repository webhook + /// + /// Returns a list of webhook deliveries for a webhook configured in a repository. + /// + /// [GitHub API docs for list_webhook_deliveries](https://docs.github.com/rest/reference/repos#list-deliveries-for-a-repository-webhook) + /// + /// --- + pub async fn list_webhook_deliveries_async(&self, owner: &str, repo: &str, hook_id: i32, query_params: Option>>) -> Result, ReposListWebhookDeliveriesError> { + + let mut request_uri = format!("{}/repos/{}/{}/hooks/{}/deliveries", super::GITHUB_BASE_API_URL, owner, repo, hook_id); + + if let Some(params) = query_params { + request_uri.push_str("?"); + request_uri.push_str(&serde_urlencoded::to_string(params.into())?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(ReposListWebhookDeliveriesError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(ReposListWebhookDeliveriesError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposListWebhookDeliveriesError::Generic { code }), + } + } + } + + /// --- + /// + /// # List deliveries for a repository webhook + /// + /// Returns a list of webhook deliveries for a webhook configured in a repository. + /// + /// [GitHub API docs for list_webhook_deliveries](https://docs.github.com/rest/reference/repos#list-deliveries-for-a-repository-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn list_webhook_deliveries(&self, owner: &str, repo: &str, hook_id: i32, query_params: Option>>) -> Result, ReposListWebhookDeliveriesError> { + + let mut request_uri = format!("{}/repos/{}/{}/hooks/{}/deliveries", super::GITHUB_BASE_API_URL, owner, repo, hook_id); + + if let Some(params) = query_params { + request_uri.push_str("?"); + let qp: ReposListWebhookDeliveriesParams = params.into(); + request_uri.push_str(&serde_urlencoded::to_string(qp)?); + } + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "GET", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(ReposListWebhookDeliveriesError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(ReposListWebhookDeliveriesError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(ReposListWebhookDeliveriesError::Generic { code }), + } + } + } + /// --- /// /// # List repository webhooks @@ -15400,6 +16094,87 @@ impl<'api> Repos<'api> { } } + /// --- + /// + /// # Redeliver a delivery for a repository webhook + /// + /// Redeliver a webhook delivery for a webhook configured in a repository. + /// + /// [GitHub API docs for redeliver_webhook_delivery](https://docs.github.com/rest/reference/repos#redeliver-a-delivery-for-a-repository-webhook) + /// + /// --- + pub async fn redeliver_webhook_delivery_async(&self, owner: &str, repo: &str, hook_id: i32, delivery_id: i32) -> Result, ReposRedeliverWebhookDeliveryError> { + + let request_uri = format!("{}/repos/{}/{}/hooks/{}/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, owner, repo, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch_async(request).await?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json_async(github_response).await?) + } else { + match github_response.status_code() { + 400 => Err(ReposRedeliverWebhookDeliveryError::Status400(crate::adapters::to_json_async(github_response).await?)), + 422 => Err(ReposRedeliverWebhookDeliveryError::Status422(crate::adapters::to_json_async(github_response).await?)), + code => Err(ReposRedeliverWebhookDeliveryError::Generic { code }), + } + } + } + + /// --- + /// + /// # Redeliver a delivery for a repository webhook + /// + /// Redeliver a webhook delivery for a webhook configured in a repository. + /// + /// [GitHub API docs for redeliver_webhook_delivery](https://docs.github.com/rest/reference/repos#redeliver-a-delivery-for-a-repository-webhook) + /// + /// --- + #[cfg(not(target_arch = "wasm32"))] + pub fn redeliver_webhook_delivery(&self, owner: &str, repo: &str, hook_id: i32, delivery_id: i32) -> Result, ReposRedeliverWebhookDeliveryError> { + + let request_uri = format!("{}/repos/{}/{}/hooks/{}/deliveries/{}/attempts", super::GITHUB_BASE_API_URL, owner, repo, hook_id, delivery_id); + + + let req = GitHubRequest { + uri: request_uri, + body: None, + method: "POST", + headers: vec![] + }; + + let request = GitHubRequestBuilder::build(req, self.auth)?; + + // -- + + let github_response = crate::adapters::fetch(request)?; + + // -- + + if github_response.is_success() { + Ok(crate::adapters::to_json(github_response)?) + } else { + match github_response.status_code() { + 400 => Err(ReposRedeliverWebhookDeliveryError::Status400(crate::adapters::to_json(github_response)?)), + 422 => Err(ReposRedeliverWebhookDeliveryError::Status422(crate::adapters::to_json(github_response)?)), + code => Err(ReposRedeliverWebhookDeliveryError::Generic { code }), + } + } + } + /// --- /// /// # Remove app access restrictions @@ -17725,14 +18500,12 @@ impl<'api> Repos<'api> { /// [GitHub API docs for upload_release_asset](https://docs.github.com/rest/reference/repos#upload-a-release-asset) /// /// --- - pub async fn upload_release_asset_async(&self, owner: &str, repo: &str, release_id: i32, query_params: Option>>, body: String) -> Result { + pub async fn upload_release_asset_async(&self, owner: &str, repo: &str, release_id: i32, query_params: impl Into>, body: String) -> Result { let mut request_uri = format!("{}/repos/{}/{}/releases/{}/assets", super::GITHUB_BASE_API_URL, owner, repo, release_id); - if let Some(params) = query_params { - request_uri.push_str("?"); - request_uri.push_str(&serde_urlencoded::to_string(params.into())?); - } + request_uri.push_str("?"); + request_uri.push_str(&serde_urlencoded::to_string(query_params.into())?); let req = GitHubRequest { uri: request_uri, @@ -17785,15 +18558,13 @@ impl<'api> Repos<'api> { /// /// --- #[cfg(not(target_arch = "wasm32"))] - pub fn upload_release_asset(&self, owner: &str, repo: &str, release_id: i32, query_params: Option>>, body: String) -> Result { + pub fn upload_release_asset(&self, owner: &str, repo: &str, release_id: i32, query_params: impl Into>, body: String) -> Result { let mut request_uri = format!("{}/repos/{}/{}/releases/{}/assets", super::GITHUB_BASE_API_URL, owner, repo, release_id); - if let Some(params) = query_params { - request_uri.push_str("?"); - let qp: ReposUploadReleaseAssetParams = params.into(); - request_uri.push_str(&serde_urlencoded::to_string(qp)?); - } + request_uri.push_str("?"); + let qp: ReposUploadReleaseAssetParams = query_params.into(); + request_uri.push_str(&serde_urlencoded::to_string(qp)?); let req = GitHubRequest { uri: request_uri, diff --git a/src/endpoints/search.rs b/src/endpoints/search.rs index 38a8dac..42ed869 100644 --- a/src/endpoints/search.rs +++ b/src/endpoints/search.rs @@ -204,7 +204,7 @@ pub struct SearchCodeParams<'req> { sort: Option<&'req str>, /// Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -248,7 +248,7 @@ impl<'req> SearchCodeParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { q: self.q, @@ -289,7 +289,7 @@ pub struct SearchCommitsParams<'req> { sort: Option<&'req str>, /// Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -333,7 +333,7 @@ impl<'req> SearchCommitsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { q: self.q, @@ -374,7 +374,7 @@ pub struct SearchIssuesAndPullRequestsParams<'req> { sort: Option<&'req str>, /// Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -418,7 +418,7 @@ impl<'req> SearchIssuesAndPullRequestsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { q: self.q, @@ -461,7 +461,7 @@ pub struct SearchLabelsParams<'req> { sort: Option<&'req str>, /// Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -520,7 +520,7 @@ impl<'req> SearchLabelsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { repository_id: self.repository_id, @@ -563,7 +563,7 @@ pub struct SearchReposParams<'req> { sort: Option<&'req str>, /// Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -607,7 +607,7 @@ impl<'req> SearchReposParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { q: self.q, @@ -644,7 +644,7 @@ impl<'enc> From<&'enc PerPage> for SearchReposParams<'enc> { pub struct SearchTopicsParams<'req> { /// The query contains one or more search keywords and qualifiers. Qualifiers allow you to limit your search to specific areas of GitHub. The REST API supports the same qualifiers as GitHub.com. To learn more about the format of the query, see [Constructing a search query](https://docs.github.com/rest/reference/search#constructing-a-search-query). q: &'req str, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -664,7 +664,7 @@ impl<'req> SearchTopicsParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { q: self.q, @@ -701,7 +701,7 @@ pub struct SearchUsersParams<'req> { sort: Option<&'req str>, /// Determines whether the first search result returned is the highest number of matches (`desc`) or lowest number of matches (`asc`). This parameter is ignored unless you provide `sort`. order: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -745,7 +745,7 @@ impl<'req> SearchUsersParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { q: self.q, diff --git a/src/endpoints/secret_scanning.rs b/src/endpoints/secret_scanning.rs index 45fcc2e..11724ae 100644 --- a/src/endpoints/secret_scanning.rs +++ b/src/endpoints/secret_scanning.rs @@ -106,7 +106,7 @@ pub struct SecretScanningListAlertsForRepoParams<'req> { secret_type: Option<&'req str>, /// Page number of the results to fetch. page: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -145,7 +145,7 @@ impl<'req> SecretScanningListAlertsForRepoParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { state: self.state, diff --git a/src/endpoints/teams.rs b/src/endpoints/teams.rs index abf9245..23f0253 100644 --- a/src/endpoints/teams.rs +++ b/src/endpoints/teams.rs @@ -1252,7 +1252,7 @@ pub enum TeamsUpdateLegacyError { /// Query parameters for the [List teams](Teams::list_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1263,7 +1263,7 @@ impl TeamsListParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1292,7 +1292,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListParams { /// Query parameters for the [List child teams](Teams::list_child_in_org_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListChildInOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1303,7 +1303,7 @@ impl TeamsListChildInOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1332,7 +1332,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListChildInOrgParams { /// Query parameters for the [List child teams (Legacy)](Teams::list_child_legacy_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListChildLegacyParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1343,7 +1343,7 @@ impl TeamsListChildLegacyParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1374,7 +1374,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListChildLegacyParams { pub struct TeamsListDiscussionCommentsInOrgParams<'req> { /// One of `asc` (ascending) or `desc` (descending). direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1394,7 +1394,7 @@ impl<'req> TeamsListDiscussionCommentsInOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { direction: self.direction, @@ -1427,7 +1427,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListDiscussionCommentsInOrgParams<'enc> pub struct TeamsListDiscussionCommentsLegacyParams<'req> { /// One of `asc` (ascending) or `desc` (descending). direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1447,7 +1447,7 @@ impl<'req> TeamsListDiscussionCommentsLegacyParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { direction: self.direction, @@ -1480,7 +1480,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListDiscussionCommentsLegacyParams<'enc> pub struct TeamsListDiscussionsInOrgParams<'req> { /// One of `asc` (ascending) or `desc` (descending). direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option, @@ -1503,7 +1503,7 @@ impl<'req> TeamsListDiscussionsInOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { direction: self.direction, @@ -1548,7 +1548,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListDiscussionsInOrgParams<'enc> { pub struct TeamsListDiscussionsLegacyParams<'req> { /// One of `asc` (ascending) or `desc` (descending). direction: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1568,7 +1568,7 @@ impl<'req> TeamsListDiscussionsLegacyParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { direction: self.direction, @@ -1599,7 +1599,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListDiscussionsLegacyParams<'enc> { /// Query parameters for the [List teams for the authenticated user](Teams::list_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1610,7 +1610,7 @@ impl TeamsListForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1639,7 +1639,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListForAuthenticatedUserParams { /// Query parameters for the [List IdP groups for an organization](Teams::list_idp_groups_for_org_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListIdpGroupsForOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page token page: Option @@ -1650,7 +1650,7 @@ impl TeamsListIdpGroupsForOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1681,7 +1681,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListIdpGroupsForOrgParams { pub struct TeamsListMembersInOrgParams<'req> { /// Filters members returned by their role in the team. Can be one of: \\* `member` - normal members of the team. \\* `maintainer` - team maintainers. \\* `all` - all members of the team. role: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1701,7 +1701,7 @@ impl<'req> TeamsListMembersInOrgParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { role: self.role, @@ -1734,7 +1734,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListMembersInOrgParams<'enc> { pub struct TeamsListMembersLegacyParams<'req> { /// Filters members returned by their role in the team. Can be one of: \\* `member` - normal members of the team. \\* `maintainer` - team maintainers. \\* `all` - all members of the team. role: Option<&'req str>, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1754,7 +1754,7 @@ impl<'req> TeamsListMembersLegacyParams<'req> { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { role: self.role, @@ -1785,7 +1785,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListMembersLegacyParams<'enc> { /// Query parameters for the [List pending team invitations](Teams::list_pending_invitations_in_org_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListPendingInvitationsInOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1796,7 +1796,7 @@ impl TeamsListPendingInvitationsInOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1825,7 +1825,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListPendingInvitationsInOrgParams { /// Query parameters for the [List pending team invitations (Legacy)](Teams::list_pending_invitations_legacy_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListPendingInvitationsLegacyParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1836,7 +1836,7 @@ impl TeamsListPendingInvitationsLegacyParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1865,7 +1865,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListPendingInvitationsLegacyParams { /// Query parameters for the [List team projects](Teams::list_projects_in_org_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListProjectsInOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1876,7 +1876,7 @@ impl TeamsListProjectsInOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1905,7 +1905,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListProjectsInOrgParams { /// Query parameters for the [List team projects (Legacy)](Teams::list_projects_legacy_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListProjectsLegacyParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1916,7 +1916,7 @@ impl TeamsListProjectsLegacyParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1945,7 +1945,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListProjectsLegacyParams { /// Query parameters for the [List team repositories](Teams::list_repos_in_org_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListReposInOrgParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1956,7 +1956,7 @@ impl TeamsListReposInOrgParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1985,7 +1985,7 @@ impl<'enc> From<&'enc PerPage> for TeamsListReposInOrgParams { /// Query parameters for the [List team repositories (Legacy)](Teams::list_repos_legacy_async()) endpoint. #[derive(Default, Serialize)] pub struct TeamsListReposLegacyParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1996,7 +1996,7 @@ impl TeamsListReposLegacyParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/endpoints/users.rs b/src/endpoints/users.rs index 220fdb0..c030215 100644 --- a/src/endpoints/users.rs +++ b/src/endpoints/users.rs @@ -828,7 +828,7 @@ impl<'req> UsersGetContextForUserParams<'req> { pub struct UsersListParams { /// A user ID. Only return users with an ID greater than this ID. since: Option, - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option } @@ -845,7 +845,7 @@ impl UsersListParams { } } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { since: self.since, @@ -857,7 +857,7 @@ impl UsersListParams { /// Query parameters for the [List email addresses for the authenticated user](Users::list_emails_for_authenticated_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListEmailsForAuthenticatedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -868,7 +868,7 @@ impl UsersListEmailsForAuthenticatedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -897,7 +897,7 @@ impl<'enc> From<&'enc PerPage> for UsersListEmailsForAuthenticatedParams { /// Query parameters for the [List the people the authenticated user follows](Users::list_followed_by_authenticated_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListFollowedByAuthenticatedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -908,7 +908,7 @@ impl UsersListFollowedByAuthenticatedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -937,7 +937,7 @@ impl<'enc> From<&'enc PerPage> for UsersListFollowedByAuthenticatedParams { /// Query parameters for the [List followers of the authenticated user](Users::list_followers_for_authenticated_user_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListFollowersForAuthenticatedUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -948,7 +948,7 @@ impl UsersListFollowersForAuthenticatedUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -977,7 +977,7 @@ impl<'enc> From<&'enc PerPage> for UsersListFollowersForAuthenticatedUserParams /// Query parameters for the [List followers of a user](Users::list_followers_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListFollowersForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -988,7 +988,7 @@ impl UsersListFollowersForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1017,7 +1017,7 @@ impl<'enc> From<&'enc PerPage> for UsersListFollowersForUserParams { /// Query parameters for the [List the people a user follows](Users::list_following_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListFollowingForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1028,7 +1028,7 @@ impl UsersListFollowingForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1057,7 +1057,7 @@ impl<'enc> From<&'enc PerPage> for UsersListFollowingForUserParams { /// Query parameters for the [List GPG keys for the authenticated user](Users::list_gpg_keys_for_authenticated_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListGpgKeysForAuthenticatedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1068,7 +1068,7 @@ impl UsersListGpgKeysForAuthenticatedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1097,7 +1097,7 @@ impl<'enc> From<&'enc PerPage> for UsersListGpgKeysForAuthenticatedParams { /// Query parameters for the [List GPG keys for a user](Users::list_gpg_keys_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListGpgKeysForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1108,7 +1108,7 @@ impl UsersListGpgKeysForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1137,7 +1137,7 @@ impl<'enc> From<&'enc PerPage> for UsersListGpgKeysForUserParams { /// Query parameters for the [List public email addresses for the authenticated user](Users::list_public_emails_for_authenticated_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListPublicEmailsForAuthenticatedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1148,7 +1148,7 @@ impl UsersListPublicEmailsForAuthenticatedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1177,7 +1177,7 @@ impl<'enc> From<&'enc PerPage> for UsersListPublicEmailsForAuthenticatedParams { /// Query parameters for the [List public keys for a user](Users::list_public_keys_for_user_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListPublicKeysForUserParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1188,7 +1188,7 @@ impl UsersListPublicKeysForUserParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), @@ -1217,7 +1217,7 @@ impl<'enc> From<&'enc PerPage> for UsersListPublicKeysForUserParams { /// Query parameters for the [List public SSH keys for the authenticated user](Users::list_public_ssh_keys_for_authenticated_async()) endpoint. #[derive(Default, Serialize)] pub struct UsersListPublicSshKeysForAuthenticatedParams { - /// Results per page (max 100). + /// Results per page (max 100) per_page: Option, /// Page number of the results to fetch. page: Option @@ -1228,7 +1228,7 @@ impl UsersListPublicSshKeysForAuthenticatedParams { Self::default() } - /// Results per page (max 100). + /// Results per page (max 100) pub fn per_page(self, per_page: u16) -> Self { Self { per_page: Some(per_page), diff --git a/src/lib.rs b/src/lib.rs index f4cf7af..a538617 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,7 +19,7 @@ //! //! ```nocompile //! [dependencies] -//! roctogen = "0.8" +//! roctogen = "0.9" //! ``` //! //! # API diff --git a/src/models.rs b/src/models.rs index e513db7..ad14c18 100644 --- a/src/models.rs +++ b/src/models.rs @@ -5227,6 +5227,19 @@ pub struct AutoMerge { pub commit_message: Option, } +/// An autolink reference. +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct Autolink { + #[serde(skip_serializing_if="Option::is_none")] + pub id: Option, + /// The prefix of a key that is linkified. + #[serde(skip_serializing_if="Option::is_none")] + pub key_prefix: Option, + /// A template for the target URL that is generated if a key was found. + #[serde(skip_serializing_if="Option::is_none")] + pub url_template: Option, +} + /// Base Gist #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct BaseGist { @@ -5365,6 +5378,13 @@ pub struct PatchOauthAuthorizationsUpdateAuthorization { pub fingerprint: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PostReposCreateFork { + /// Optional parameter to specify the organization name if forking into an organization. + #[serde(skip_serializing_if="Option::is_none")] + pub organization: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostGitCreateBlob { /// The new blob's content. @@ -5492,6 +5512,14 @@ pub struct PatchReposUpdateWebhookConfigForRepo { pub insecure_ssl: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PutEnterpriseAdminSetGithubActionsPermissionsEnterprise { + #[serde(skip_serializing_if="Option::is_none")] + pub enabled_organizations: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub allowed_actions: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PutMigrationsStartImport { /// The URL of the originating repository. @@ -5511,14 +5539,6 @@ pub struct PutMigrationsStartImport { pub tfvc_project: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PutEnterpriseAdminSetGithubActionsPermissionsEnterprise { - #[serde(skip_serializing_if="Option::is_none")] - pub enabled_organizations: Option, - #[serde(skip_serializing_if="Option::is_none")] - pub allowed_actions: Option, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PatchMigrationsUpdateImport { /// The username to provide to the originating repository. @@ -5624,17 +5644,17 @@ pub struct PostIssuesAddAssignees { } #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct DeleteIssuesRemoveAssignees { - /// Usernames of assignees to remove from an issue. _NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise._ +pub struct PutEnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise { + /// List of organization IDs to enable for GitHub Actions. #[serde(skip_serializing_if="Option::is_none")] - pub assignees: Option>, + pub selected_organization_ids: Option>, } #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PutEnterpriseAdminSetSelectedOrganizationsEnabledGithubActionsEnterprise { - /// List of organization IDs to enable for GitHub Actions. +pub struct DeleteIssuesRemoveAssignees { + /// Usernames of assignees to remove from an issue. _NOTE: Only users with push access can remove assignees from an issue. Assignees are silently ignored otherwise._ #[serde(skip_serializing_if="Option::is_none")] - pub selected_organization_ids: Option>, + pub assignees: Option>, } #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] @@ -5776,22 +5796,6 @@ pub struct PostReposMerge { pub commit_message: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PostIssuesCreateMilestone { - /// The title of the milestone. - #[serde(skip_serializing_if="Option::is_none")] - pub title: Option, - /// The state of the milestone. Either `open` or `closed`. - #[serde(skip_serializing_if="Option::is_none")] - pub state: Option, - /// A description of the milestone. - #[serde(skip_serializing_if="Option::is_none")] - pub description: Option, - /// The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. - #[serde(skip_serializing_if="Option::is_none")] - pub due_on: Option>, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostEnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise { /// Name of the runner group. @@ -5808,6 +5812,22 @@ pub struct PostEnterpriseAdminCreateSelfHostedRunnerGroupForEnterprise { pub runners: Option>, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PostIssuesCreateMilestone { + /// The title of the milestone. + #[serde(skip_serializing_if="Option::is_none")] + pub title: Option, + /// The state of the milestone. Either `open` or `closed`. + #[serde(skip_serializing_if="Option::is_none")] + pub state: Option, + /// A description of the milestone. + #[serde(skip_serializing_if="Option::is_none")] + pub description: Option, + /// The milestone due date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format: `YYYY-MM-DDTHH:MM:SSZ`. + #[serde(skip_serializing_if="Option::is_none")] + pub due_on: Option>, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PatchIssuesUpdateMilestone { /// The title of the milestone. @@ -5925,6 +5945,16 @@ pub struct PatchPullsUpdate { pub maintainer_can_modify: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PatchEnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise { + /// Name of the runner group. + #[serde(skip_serializing_if="Option::is_none")] + pub name: Option, + /// Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: `all` or `selected` + #[serde(skip_serializing_if="Option::is_none")] + pub visibility: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostPullsCreateReviewComment { /// The text of the review comment. @@ -5955,16 +5985,6 @@ pub struct PostPullsCreateReviewComment { pub in_reply_to: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PatchEnterpriseAdminUpdateSelfHostedRunnerGroupForEnterprise { - /// Name of the runner group. - #[serde(skip_serializing_if="Option::is_none")] - pub name: Option, - /// Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: `all` or `selected` - #[serde(skip_serializing_if="Option::is_none")] - pub visibility: Option, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostPullsCreateReplyForReviewComment { /// The text of the review comment. @@ -6067,6 +6087,13 @@ pub struct PutPullsUpdateBranch { pub expected_head_sha: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PutEnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise { + /// List of organization IDs that can access the runner group. + #[serde(skip_serializing_if="Option::is_none")] + pub selected_organization_ids: Option>, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostReposCreateRelease { /// The name of the tag. @@ -6092,13 +6119,6 @@ pub struct PostReposCreateRelease { pub discussion_category_name: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PutEnterpriseAdminSetOrgAccessToSelfHostedRunnerGroupInEnterprise { - /// List of organization IDs that can access the runner group. - #[serde(skip_serializing_if="Option::is_none")] - pub selected_organization_ids: Option>, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PatchReposUpdateReleaseAsset { /// The file name of the asset. @@ -6213,6 +6233,13 @@ pub struct PostReposCreateUsingTemplate { pub private: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PutEnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise { + /// List of runner IDs to add to the runner group. + #[serde(skip_serializing_if="Option::is_none")] + pub runners: Option>, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PutActionsCreateOrUpdateEnvironmentSecret { /// Value for your secret, encrypted with [LibSodium](https://libsodium.gitbook.io/doc/bindings_for_other_languages) using the public key retrieved from the [Get an environment public key](https://docs.github.com/rest/reference/actions#get-an-environment-public-key) endpoint. @@ -6223,13 +6250,6 @@ pub struct PutActionsCreateOrUpdateEnvironmentSecret { pub key_id: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PutEnterpriseAdminSetSelfHostedRunnersInGroupForEnterprise { - /// List of runner IDs to add to the runner group. - #[serde(skip_serializing_if="Option::is_none")] - pub runners: Option>, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostEnterpriseAdminProvisionAndInviteEnterpriseGroup { /// The SCIM schema URIs. @@ -6378,6 +6398,18 @@ pub struct PatchScimUpdateAttributeForUser { pub operations: Option>, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PostGistsCreate { + /// Description of the gist + #[serde(skip_serializing_if="Option::is_none")] + pub description: Option, + /// Names and content for the files that make up the gist + #[serde(skip_serializing_if="Option::is_none")] + pub files: Option>, + #[serde(skip_serializing_if="Option::is_none")] + pub public: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PatchTeamsUpdateLegacy { /// The name of the team. @@ -6397,18 +6429,6 @@ pub struct PatchTeamsUpdateLegacy { pub parent_team_id: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PostGistsCreate { - /// Description of the gist - #[serde(skip_serializing_if="Option::is_none")] - pub description: Option, - /// Names and content for the files that make up the gist - #[serde(skip_serializing_if="Option::is_none")] - pub files: Option>, - #[serde(skip_serializing_if="Option::is_none")] - pub public: Option, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostTeamsCreateDiscussionLegacy { /// The discussion post's title. @@ -6481,15 +6501,6 @@ pub struct PutTeamsAddOrUpdateRepoPermissionsLegacy { pub permission: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PatchTeamsCreateOrUpdateIdpGroupConnectionsLegacy { - /// The IdP groups you want to connect to a GitHub team. When updating, the new `groups` object will replace the original one. You must include any existing groups that you don't want to remove. - #[serde(skip_serializing_if="Option::is_none")] - pub groups: Option>, - #[serde(skip_serializing_if="Option::is_none")] - pub synced_at: Option, -} - #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum PatchGistsUpdate { @@ -6510,6 +6521,15 @@ impl Display for PatchGistsUpdate { } } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PatchTeamsCreateOrUpdateIdpGroupConnectionsLegacy { + /// The IdP groups you want to connect to a GitHub team. When updating, the new `groups` object will replace the original one. You must include any existing groups that you don't want to remove. + #[serde(skip_serializing_if="Option::is_none")] + pub groups: Option>, + #[serde(skip_serializing_if="Option::is_none")] + pub synced_at: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PatchUsersUpdateAuthenticated { /// The new name of the user. @@ -6646,6 +6666,13 @@ pub struct PostProjectsCreateForAuthenticatedUser { pub body: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PostGistsCreateComment { + /// The comment text. + #[serde(skip_serializing_if="Option::is_none")] + pub body: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostReposCreateForAuthenticatedUser { /// The name of the repository. @@ -6701,13 +6728,6 @@ pub struct PostReposCreateForAuthenticatedUser { pub is_template: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PostGistsCreateComment { - /// The comment text. - #[serde(skip_serializing_if="Option::is_none")] - pub body: Option, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct DeleteAppsDeleteAuthorization { /// The OAuth access token used to authenticate to the GitHub API. @@ -7371,6 +7391,16 @@ pub struct PostActionsCreateWorkflowDispatch { pub inputs: Option>, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PostReposCreateAutolink { + /// The prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit. + #[serde(skip_serializing_if="Option::is_none")] + pub key_prefix: Option, + /// The URL must contain for the reference number. + #[serde(skip_serializing_if="Option::is_none")] + pub url_template: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PutReposUpdateBranchProtection { #[serde(skip_serializing_if="Option::is_none")] @@ -7421,25 +7451,6 @@ pub struct PatchReposUpdateStatusCheckProtection { pub contexts: Option>, } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PutReposSetStatusCheckContexts { - PutReposSetStatusCheckContextsVariant0(HashMap>), - PutReposSetStatusCheckContextsVariant1(Vec), -} - -impl From>> for PutReposSetStatusCheckContexts { - fn from(value: HashMap>) -> Self { - PutReposSetStatusCheckContexts::PutReposSetStatusCheckContextsVariant0(value) - } -} - -impl From> for PutReposSetStatusCheckContexts { - fn from(value: Vec) -> Self { - PutReposSetStatusCheckContexts::PutReposSetStatusCheckContextsVariant1(value) - } -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostOauthAuthorizationsCreateAuthorization { /// A list of scopes that this authorization is in. @@ -7462,6 +7473,25 @@ pub struct PostOauthAuthorizationsCreateAuthorization { pub fingerprint: Option, } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PutReposSetStatusCheckContexts { + PutReposSetStatusCheckContextsVariant0(HashMap>), + PutReposSetStatusCheckContextsVariant1(Vec), +} + +impl From>> for PutReposSetStatusCheckContexts { + fn from(value: HashMap>) -> Self { + PutReposSetStatusCheckContexts::PutReposSetStatusCheckContextsVariant0(value) + } +} + +impl From> for PutReposSetStatusCheckContexts { + fn from(value: Vec) -> Self { + PutReposSetStatusCheckContexts::PutReposSetStatusCheckContextsVariant1(value) + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum PostReposAddStatusCheckContexts { @@ -7633,25 +7663,6 @@ impl From> for PutReposSetUserAccessRestrictions { } } -#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] -#[serde(untagged)] -pub enum PostReposAddUserAccessRestrictions { - PostReposAddUserAccessRestrictionsVariant0(HashMap>), - PostReposAddUserAccessRestrictionsVariant1(Vec), -} - -impl From>> for PostReposAddUserAccessRestrictions { - fn from(value: HashMap>) -> Self { - PostReposAddUserAccessRestrictions::PostReposAddUserAccessRestrictionsVariant0(value) - } -} - -impl From> for PostReposAddUserAccessRestrictions { - fn from(value: Vec) -> Self { - PostReposAddUserAccessRestrictions::PostReposAddUserAccessRestrictionsVariant1(value) - } -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PutOauthAuthorizationsGetOrCreateAuthorizationForApp { /// The OAuth app client secret for which to create the token. @@ -7671,6 +7682,25 @@ pub struct PutOauthAuthorizationsGetOrCreateAuthorizationForApp { pub fingerprint: Option, } +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +#[serde(untagged)] +pub enum PostReposAddUserAccessRestrictions { + PostReposAddUserAccessRestrictionsVariant0(HashMap>), + PostReposAddUserAccessRestrictionsVariant1(Vec), +} + +impl From>> for PostReposAddUserAccessRestrictions { + fn from(value: HashMap>) -> Self { + PostReposAddUserAccessRestrictions::PostReposAddUserAccessRestrictionsVariant0(value) + } +} + +impl From> for PostReposAddUserAccessRestrictions { + fn from(value: Vec) -> Self { + PostReposAddUserAccessRestrictions::PostReposAddUserAccessRestrictionsVariant1(value) + } +} + #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(untagged)] pub enum DeleteReposRemoveUserAccessRestrictions { @@ -7772,13 +7802,6 @@ pub struct PutReposAddCollaborator { pub permissions: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PatchReposUpdateCommitComment { - /// The contents of the comment - #[serde(skip_serializing_if="Option::is_none")] - pub body: Option, -} - #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PutOauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint { /// The OAuth app client secret for which to create the token. @@ -7795,6 +7818,13 @@ pub struct PutOauthAuthorizationsGetOrCreateAuthorizationForAppAndFingerprint { pub note_url: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct PatchReposUpdateCommitComment { + /// The contents of the comment + #[serde(skip_serializing_if="Option::is_none")] + pub body: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct PostReactionsCreateForCommitComment { /// The [reaction type](https://docs.github.com/rest/reference/reactions#reaction-types) to add to the commit comment. @@ -7942,13 +7972,6 @@ pub struct PutReposCreateOrUpdateEnvironment { pub deployment_branch_policy: Option, } -#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] -pub struct PostReposCreateFork { - /// Optional parameter to specify the organization name if forking into an organization. - #[serde(skip_serializing_if="Option::is_none")] - pub organization: Option, -} - /// Branch Protection #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct BranchProtection { @@ -10984,6 +11007,8 @@ pub struct Hook { #[serde(skip_serializing_if="Option::is_none")] pub ping_url: Option, #[serde(skip_serializing_if="Option::is_none")] + pub deliveries_url: Option, + #[serde(skip_serializing_if="Option::is_none")] pub last_response: Option, } @@ -11011,6 +11036,86 @@ pub struct HookConfig { pub token: Option, } +/// Delivery made by a webhook. +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct HookDelivery { + /// Unique identifier of the delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub id: Option, + /// Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event). + #[serde(skip_serializing_if="Option::is_none")] + pub guid: Option, + /// Time when the delivery was delivered. + #[serde(skip_serializing_if="Option::is_none")] + pub delivered_at: Option>, + /// Whether the delivery is a redelivery. + #[serde(skip_serializing_if="Option::is_none")] + pub redelivery: Option, + /// Time spent delivering. + #[serde(skip_serializing_if="Option::is_none")] + pub duration: Option, + /// Description of the status of the attempted delivery + #[serde(skip_serializing_if="Option::is_none")] + pub status: Option, + /// Status code received when delivery was made. + #[serde(skip_serializing_if="Option::is_none")] + pub status_code: Option, + /// The event that triggered the delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub event: Option, + /// The type of activity for the event that triggered the delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub action: Option, + /// The id of the GitHub App installation associated with this event. + #[serde(skip_serializing_if="Option::is_none")] + pub installation_id: Option, + /// The id of the repository associated with this event. + #[serde(skip_serializing_if="Option::is_none")] + pub repository_id: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub request: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub response: Option, +} + +/// Delivery made by a webhook, without request and response information. +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct HookDeliveryItem { + /// Unique identifier of the webhook delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub id: Option, + /// Unique identifier for the event (shared with all deliveries for all webhooks that subscribe to this event). + #[serde(skip_serializing_if="Option::is_none")] + pub guid: Option, + /// Time when the webhook delivery occurred. + #[serde(skip_serializing_if="Option::is_none")] + pub delivered_at: Option>, + /// Whether the webhook delivery is a redelivery. + #[serde(skip_serializing_if="Option::is_none")] + pub redelivery: Option, + /// Time spent delivering. + #[serde(skip_serializing_if="Option::is_none")] + pub duration: Option, + /// Describes the response returned after attempting the delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub status: Option, + /// Status code received when delivery was made. + #[serde(skip_serializing_if="Option::is_none")] + pub status_code: Option, + /// The event that triggered the delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub event: Option, + /// The type of activity for the event that triggered the delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub action: Option, + /// The id of the GitHub App installation associated with this event. + #[serde(skip_serializing_if="Option::is_none")] + pub installation_id: Option, + /// The id of the repository associated with this event. + #[serde(skip_serializing_if="Option::is_none")] + pub repository_id: Option, +} + #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct HookResponse { #[serde(skip_serializing_if="Option::is_none")] @@ -11021,6 +11126,26 @@ pub struct HookResponse { pub message: Option, } +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct HookdeliveryRequest { + /// The request headers sent with the webhook delivery. + #[serde(skip_serializing_if="Option::is_none")] + pub headers: Option>>, + /// The webhook payload. + #[serde(skip_serializing_if="Option::is_none")] + pub payload: Option>>, +} + +#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] +pub struct HookdeliveryResponse { + /// The response headers received when the delivery was made. + #[serde(skip_serializing_if="Option::is_none")] + pub headers: Option>>, + /// The response payload received. + #[serde(skip_serializing_if="Option::is_none")] + pub payload: Option>>, +} + /// Hovercard #[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)] pub struct Hovercard { @@ -13484,6 +13609,8 @@ pub struct OrgHook { #[serde(skip_serializing_if="Option::is_none")] pub ping_url: Option, #[serde(skip_serializing_if="Option::is_none")] + pub deliveries_url: Option, + #[serde(skip_serializing_if="Option::is_none")] pub name: Option, #[serde(skip_serializing_if="Option::is_none")] pub events: Option>, @@ -15483,6 +15610,8 @@ pub struct Release { pub body_html: Option, #[serde(skip_serializing_if="Option::is_none")] pub body_text: Option, + #[serde(skip_serializing_if="Option::is_none")] + pub mentions_count: Option, /// The URL of the release discussion. #[serde(skip_serializing_if="Option::is_none")] pub discussion_url: Option, diff --git a/templates/lib.mustache b/templates/lib.mustache index ed8c893..6f4161e 100644 --- a/templates/lib.mustache +++ b/templates/lib.mustache @@ -19,7 +19,7 @@ //! //! ```nocompile //! [dependencies] -//! roctogen = "0.6" +//! roctogen = "0.9" //! ``` //! //! # API