public Task <PullRequestReviewComment> Edit(string owner, string name, int number, PullRequestReviewCommentEdit comment) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(comment, nameof(comment)); return(ApiConnection.Patch <PullRequestReviewComment>(ApiUrls.PullRequestReviewComment(owner, name, number), comment)); }
public Task <CheckSuitePreferencesResponse> UpdatePreferences(string owner, string name, CheckSuitePreferences preferences) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(preferences, nameof(preferences)); return(ApiConnection.Patch <CheckSuitePreferencesResponse>(ApiUrls.CheckSuitePreferences(owner, name), preferences, AcceptHeaders.ChecksApiPreview)); }
/// <summary> /// Updates a specified Commit Comment. /// </summary> /// <remarks>http://developer.github.com/v3/repos/comments/#update-a-commit-comment</remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="number">The comment number</param> /// <param name="commentUpdate">The modified comment</param> /// <returns></returns> public Task <CommitComment> Update(string owner, string name, int number, string commentUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(commentUpdate, "commentUpdate"); return(ApiConnection.Patch <CommitComment>(ApiUrls.CommitComment(owner, name, number), new BodyWrapper(commentUpdate))); }
/// <summary> /// Edits a hook for a repository /// </summary> /// <param name="owner">The repository's owner</param> /// <param name="name">The repository's name</param> /// <param name="hookId">The repository's hook id</param> /// <param name="hook">The requested changes to an edit repository hook</param> /// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#edit-a-hook">API documentation</a> for more information.</remarks> public Task <RepositoryHook> Edit(string owner, string name, int hookId, EditRepositoryHook hook) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(hook, nameof(hook)); return(ApiConnection.Patch <RepositoryHook>(ApiUrls.RepositoryHookById(owner, name, hookId), hook)); }
/// <summary> /// Edits a hook for a repository /// </summary> /// <remarks>See <a href="http://developer.github.com/v3/repos/hooks/#edit-a-hook">API documentation</a> for more information.</remarks> /// <returns></returns> public Task <RepositoryHook> Edit(string owner, string repositoryName, int hookId, EditRepositoryHook hook) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(repositoryName, "repositoryName"); Ensure.ArgumentNotNull(hook, "hook"); return(ApiConnection.Patch <RepositoryHook>(ApiUrls.RepositoryHookById(owner, repositoryName, hookId), hook)); }
public Task <ReleaseAsset> EditAsset(long repositoryId, int assetId, ReleaseAssetUpdate data) { Ensure.ArgumentNotNull(data, nameof(data)); var endpoint = ApiUrls.Asset(repositoryId, assetId); return(ApiConnection.Patch <ReleaseAsset>(endpoint, data)); }
public Task <Release> Edit(long repositoryId, int id, ReleaseUpdate data) { Ensure.ArgumentNotNull(data, nameof(data)); var endpoint = ApiUrls.Releases(repositoryId, id); return(ApiConnection.Patch <Release>(endpoint, data)); }
/// <summary> /// Update the specified <see cref="UserUpdate"/>. /// </summary> /// <param name="id">The ID of the SSH key</param> /// <param name="key">The SSH Key contents</param> /// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception> /// <returns>A <see cref="User"/></returns> public Task <SshKey> Update(int id, SshKeyUpdate key) { Ensure.ArgumentNotNull(key, "key"); var endpoint = "user/keys/{0}".FormatUri(id); return(ApiConnection.Patch <SshKey>(endpoint, key)); }
/// <summary> /// Updates an issue for the specified repository. Issue owners and users with push access can edit an issue. /// </summary> /// <remarks>https://developer.github.com/v3/issues/#edit-an-issue</remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="number">The issue number</param> /// <param name="issueUpdate">An <see cref="IssueUpdate"/> instance describing the changes to make to the issue /// </param> /// <returns></returns> public Task <Issue> Update(string owner, string name, int number, IssueUpdate issueUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(issueUpdate, "issueUpdate"); return(ApiConnection.Patch <Issue>(ApiUrls.Issue(owner, name, number), issueUpdate)); }
/// <summary> /// Returns updated <see cref="Team" /> for the current org. /// </summary> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>Updated <see cref="Team"/></returns> public Task <Team> Update(int id, UpdateTeam team) { Ensure.ArgumentNotNull(team, nameof(team)); var endpoint = ApiUrls.Teams(id); return(ApiConnection.Patch <Team>(endpoint, team, AcceptHeaders.NestedTeamsPreview)); }
/// <summary> /// Creates an Milestone for the specified repository. Any user with pull access to a repository can create an /// Milestone. /// </summary> /// <remarks>http://developer.github.com/v3/Milestones/#create-an-Milestone</remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="number">The Milestone number</param> /// <param name="milestoneUpdate">An <see cref="MilestoneUpdate"/> instance describing the changes to make to the Milestone /// </param> /// <returns></returns> public Task <Milestone> Update(string owner, string name, int number, MilestoneUpdate milestoneUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(milestoneUpdate, "milestoneUpdate"); return(ApiConnection.Patch <Milestone>(ApiUrls.Milestone(owner, name, number), milestoneUpdate)); }
/// <summary> /// Updates the specified repository with the values given in <paramref name="update"/> /// </summary> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="update">New values to update the repository with</param> /// <returns>The updated <see cref="T:Octokit.Repository"/></returns> public Task <Repository> Edit(string owner, string name, RepositoryUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(update, "update"); return(ApiConnection.Patch <Repository>(ApiUrls.Repository(owner, name), update)); }
/// <summary> /// Updates the specified <see cref="Authorization"/>. /// </summary> /// <remarks> /// This method requires authentication. /// See the <a href="http://developer.github.com/v3/oauth/#update-an-existing-authorization">API /// documentation</a> for more details. /// </remarks> /// <param name="id">ID of the <see cref="Authorization"/> to update</param> /// <param name="authorizationUpdate">Describes the changes to make to the authorization</param> /// <exception cref="AuthorizationException"> /// Thrown when the current user does not have permission to make the request. /// </exception> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>The updated <see cref="Authorization"/>.</returns> public Task <Authorization> Update(int id, AuthorizationUpdate authorizationUpdate) { Ensure.ArgumentNotNull(authorizationUpdate, "authorizationUpdate"); var endpoint = "authorizations/{0}".FormatUri(id); return(ApiConnection.Patch <Authorization>(endpoint, authorizationUpdate)); }
/// <summary> /// Returns updated <see cref="Team" /> for the current org. /// </summary> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>Updated <see cref="Team"/></returns> public Task <Team> Update(int id, UpdateTeam team) { Ensure.ArgumentNotNull(team, "team"); var endpoint = ApiUrls.Teams(id); return(ApiConnection.Patch <Team>(endpoint, team)); }
public Task <IssueComment> Update(string owner, string name, int id, string commentUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(commentUpdate, nameof(commentUpdate)); return(ApiConnection.Patch <IssueComment>(ApiUrls.IssueComment(owner, name, id), new BodyWrapper(commentUpdate))); }
/// <summary> /// Updates the specified <see cref="Authorization"/>. /// </summary> /// <remarks> /// This method requires authentication. /// See the <a href="http://developer.github.com/v3/oauth/#update-an-existing-authorization">API /// documentation</a> for more details. /// </remarks> /// <param name="id">Id of the <see cref="Authorization"/> to update</param> /// <param name="authorizationUpdate">Describes the changes to make to the authorization</param> /// <exception cref="AuthorizationException"> /// Thrown when the current user does not have permission to make the request. /// </exception> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>The updated <see cref="Authorization"/>.</returns> public Task <Authorization> Update(int id, AuthorizationUpdate authorizationUpdate) { Ensure.ArgumentNotNull(authorizationUpdate, "authorizationUpdate"); return(ApiConnection.Patch <Authorization>( ApiUrls.Authorizations(id), authorizationUpdate)); }
/// <summary> /// Create a pull request for the specified repository. /// </summary> /// <remarks>http://developer.github.com/v3/pulls/#update-a-pull-request</remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="number">The PullRequest number</param> /// <param name="pullRequestUpdate">An <see cref="PullRequestUpdate"/> instance describing the changes to make to the PullRequest /// </param> /// <returns>An updated <see cref="PullRequest"/> result</returns> public Task <PullRequest> Update(string owner, string name, int number, PullRequestUpdate pullRequestUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(pullRequestUpdate, "pullRequestUpdate"); return(ApiConnection.Patch <PullRequest>(ApiUrls.PullRequest(owner, name, number), pullRequestUpdate)); }
/// <summary> /// Rename an existing user (must be Site Admin user). /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/enterprise/2.5/v3/users/administration/#rename-an-existing-user">API documentation</a> /// for more information. /// Note that this queues a request to rename a user, rather than execute it straight away /// </remarks> /// <param name="login">The username to rename</param> /// <param name="userRename">The <see cref="UserRename"/> request, specifying the new login</param> /// <returns>A <see cref="UserRenameResponse"/> object indicating the queued task message and Url to the user</returns> public Task <UserRenameResponse> Rename(string login, UserRename userRename) { Ensure.ArgumentNotNullOrEmptyString(login, "login"); Ensure.ArgumentNotNull(userRename, "userRename"); var endpoint = ApiUrls.UserAdministration(login); return(ApiConnection.Patch <UserRenameResponse>(endpoint, userRename)); }
/// <summary> /// Replace required status checks for the specified branch /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/repos/branches/#update-required-status-checks-of-protected-branch">API documentation</a> for more details /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="branch">The name of the branch</param> /// <param name="update">Required status checks</param> public Task <BranchProtectionRequiredStatusChecks> UpdateRequiredStatusChecks(string owner, string name, string branch, BranchProtectionRequiredStatusChecksUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(branch, "branch"); Ensure.ArgumentNotNull(update, "update"); return(ApiConnection.Patch <BranchProtectionRequiredStatusChecks>(ApiUrls.RepoRequiredStatusChecks(owner, name, branch), update, AcceptHeaders.ProtectedBranchesApiPreview)); }
/// <summary> /// Edits the <see cref="ReleaseAsset"/> for the specified release of the specified repository. /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/releases/#edit-a-release-asset">API documentation</a> for more information. /// </remarks> /// <param name="owner">The repository's owner</param> /// <param name="name">The repository's name</param> /// <param name="assetId">The id of the <see cref="ReleaseAsset"/></param> /// <param name="data">Description of the asset with its amended data</param> public Task<ReleaseAsset> EditAsset(string owner, string name, int assetId, ReleaseAssetUpdate data) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(data, "data"); var endpoint = ApiUrls.Asset(owner, name, assetId); return ApiConnection.Patch<ReleaseAsset>(endpoint, data); }
/// <summary> /// Update the specified organization with data from <see cref="OrganizationUpdate"/>. /// </summary> /// <param name="organizationName">The name of the organization to update.</param> /// <param name="updateRequest"></param> /// <exception cref="AuthorizationException">Thrown if the client is not authenticated.</exception> /// <returns>A <see cref="Organization"/></returns> public Task <Organization> Update(string organizationName, OrganizationUpdate updateRequest) { Ensure.ArgumentNotNullOrEmptyString(organizationName, "organizationName"); Ensure.ArgumentNotNull(updateRequest, "updateRequest"); var updateUri = new Uri("orgs/" + organizationName, UriKind.Relative); return(ApiConnection.Patch <Organization>(updateUri, updateRequest)); }
/// <summary> /// Edit the specified branch with the values given in <paramref name="update"/> /// </summary> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="branch">The name of the branch</param> /// <param name="update">New values to update the branch with</param> /// <returns>The updated <see cref="T:Octokit.Branch"/></returns> public Task <Branch> EditBranch(string owner, string name, string branch, BranchUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "repositoryName"); Ensure.ArgumentNotNullOrEmptyString(branch, "branchName"); Ensure.ArgumentNotNull(update, "update"); return(ApiConnection.Patch <Branch>(ApiUrls.RepoBranch(owner, name, branch), update, AcceptHeaders.ProtectedBranchesApiPreview)); }
public Task <Repository> Edit(string owner, string name, RepositoryUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner)); Ensure.ArgumentNotNullOrEmptyString(name, nameof(name)); Ensure.ArgumentNotNull(update, nameof(update)); Ensure.ArgumentNotNull(update.Name, nameof(update.Name)); return(ApiConnection.Patch <Repository>(ApiUrls.Repository(owner, name), update, AcceptHeaders.VisibilityPreview)); }
/// <summary> /// Update the LDAP mapping for a team on a GitHub Enterprise appliance (must be Site Admin user). /// </summary> /// <remarks> /// https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-team /// </remarks> /// <param name="teamId">The teamId to update LDAP mapping</param> /// <param name="newLdapMapping">The <see cref="NewLdapMapping"/></param> /// <returns>The <see cref="Team"/> object.</returns> public Task <Team> UpdateTeamMapping(int teamId, NewLdapMapping newLdapMapping) { Ensure.ArgumentNotNull(teamId, "teamId"); Ensure.ArgumentNotNull(newLdapMapping, "newLdapMapping"); var endpoint = ApiUrls.EnterpriseLdapTeamMapping(teamId); return(ApiConnection.Patch <Team>(endpoint, newLdapMapping)); }
/// <summary> /// Updates a reference for a given repository by reference name /// </summary> /// <remarks> /// http://developer.github.com/v3/git/refs/#update-a-reference /// </remarks> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="reference">The name of the reference</param> /// <param name="referenceUpdate">The updated reference data</param> /// <returns></returns> public Task <Reference> Update(string owner, string name, string reference, ReferenceUpdate referenceUpdate) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); Ensure.ArgumentNotNull(referenceUpdate, "update"); return(ApiConnection.Patch <Reference>(ApiUrls.Reference(owner, name, reference), referenceUpdate)); }
/// <summary> /// Update the LDAP mapping for a user on a GitHub Enterprise appliance (must be Site Admin user). /// </summary> /// <remarks> /// https://developer.github.com/v3/enterprise/ldap/#update-ldap-mapping-for-a-user /// </remarks> /// <param name="userName">The username to update LDAP mapping</param> /// <param name="newLdapMapping">The <see cref="NewLdapMapping"/></param> /// <returns>The <see cref="User"/> object.</returns> public Task <User> UpdateUserMapping(string userName, NewLdapMapping newLdapMapping) { Ensure.ArgumentNotNull(userName, "userName"); Ensure.ArgumentNotNull(newLdapMapping, "newLdapMapping"); var endpoint = ApiUrls.EnterpriseLdapUserMapping(userName); return(ApiConnection.Patch <User>(endpoint, newLdapMapping)); }
/// <summary> /// Updates the specified repository with the values given in <paramref name="update"/> /// </summary> /// <param name="owner">The owner of the repository</param> /// <param name="name">The name of the repository</param> /// <param name="update">New values to update the repository with</param> /// <returns>The updated <see cref="T:Octokit.Repository"/></returns> public Task <Repository> Edit(string owner, string name, RepositoryUpdate update) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(update, "update"); Ensure.ArgumentNotNull(update.Name, "update.Name"); return(ApiConnection.Patch <Repository>(ApiUrls.Repository(owner, name), update, AcceptHeaders.Concat(AcceptHeaders.SquashCommitPreview, AcceptHeaders.LicensesApiPreview))); }
/// <summary> /// Edits an existing <see cref="Release"/> for the specified repository. /// </summary> /// <remarks> /// See the <a href="http://developer.github.com/v3/repos/releases/#edit-a-release">API documentation</a> for more information. /// </remarks> /// <param name="owner">The repository's owner</param> /// <param name="name">The repository's name</param> /// <param name="id">The id of the release</param> /// <param name="data">A description of the release to edit</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> /// <returns>The updated <see cref="Release"/>.</returns> public Task <Release> EditRelease(string owner, string name, int id, ReleaseUpdate data) { Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); Ensure.ArgumentNotNullOrEmptyString(name, "name"); Ensure.ArgumentNotNull(data, "data"); var endpoint = ApiUrls.Releases(owner, name, id); return(ApiConnection.Patch <Release>(endpoint, data)); }
public Task <Reference> Update(long repositoryId, string reference, ReferenceUpdate referenceUpdate) { Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference)); Ensure.ArgumentNotNull(referenceUpdate, nameof(referenceUpdate)); if (reference.StartsWith("refs/")) { reference = reference.Replace("refs/", string.Empty); } return(ApiConnection.Patch <Reference>(ApiUrls.Reference(repositoryId, reference), referenceUpdate)); }
/// <summary> /// Resets a valid OAuth token for an OAuth application without end user involvement. /// </summary> /// <remarks> /// This method requires authentication. /// See the <a href="https://developer.github.com/v3/oauth_authorizations/#reset-an-authorization">API documentation</a> for more information. /// </remarks> /// <param name="clientId">ClientID of the OAuth application for the token</param> /// <param name="accessToken">The OAuth token to reset</param> /// <returns>The valid <see cref="ApplicationAuthorization"/> with a new OAuth token</returns> public Task <ApplicationAuthorization> ResetApplicationAuthentication(string clientId, string accessToken) { Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId)); Ensure.ArgumentNotNullOrEmptyString(accessToken, nameof(accessToken)); var requestData = new { access_token = accessToken }; var endpoint = ApiUrls.ApplicationAuthorization(clientId); return(ApiConnection.Patch <ApplicationAuthorization>(endpoint, requestData)); }