예제 #1
0
        /// <summary>
        /// Creates an issue for the specified repository. Any user with pull access to a repository can create an
        /// issue.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/#create-an-issue</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="newIssue">A <see cref="NewIssue"/> instance describing the new issue to create</param>
        public Task <Issue> Create(long repositoryId, NewIssue newIssue)
        {
            Ensure.ArgumentNotNull(newIssue, nameof(newIssue));

            return(ApiConnection.Post <Issue>(ApiUrls.Issues(repositoryId), newIssue));
        }
예제 #2
0
        public Task <Label> Create(long repositoryId, NewLabel newLabel)
        {
            Ensure.ArgumentNotNull(newLabel, nameof(newLabel));

            return(ApiConnection.Post <Label>(ApiUrls.Labels(repositoryId), newLabel));
        }
예제 #3
0
        /// <summary>
        /// Create a pull request for the specified repository.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/pulls/#create-a-pull-request</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="newPullRequest">A <see cref="NewPullRequest"/> instance describing the new PullRequest to create</param>
        public Task <PullRequest> Create(long repositoryId, NewPullRequest newPullRequest)
        {
            Ensure.ArgumentNotNull(newPullRequest, nameof(newPullRequest));

            return(ApiConnection.Post <PullRequest>(ApiUrls.PullRequests(repositoryId), newPullRequest, AcceptHeaders.DraftPullRequestApiPreview));
        }
예제 #4
0
        /// <summary>
        /// Create a commit for a given repository
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/git/commits/#create-a-commit
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="commit">The commit to create</param>
        public Task <Commit> Create(int repositoryId, NewCommit commit)
        {
            Ensure.ArgumentNotNull(commit, "commit");

            return(ApiConnection.Post <Commit>(ApiUrls.CreateCommit(repositoryId), commit));
        }
예제 #5
0
        public Task <GistComment> Create(string gistId, string comment)
        {
            Ensure.ArgumentNotNullOrEmptyString(comment, nameof(comment));

            return(ApiConnection.Post <GistComment>(ApiUrls.GistComments(gistId), new BodyWrapper(comment)));
        }
        public Task <Project> CreateForRepository(long repositoryId, NewProject newProject)
        {
            Ensure.ArgumentNotNull(newProject, nameof(newProject));

            return(ApiConnection.Post <Project>(ApiUrls.RepositoryProjects(repositoryId), newProject, AcceptHeaders.ProjectsApiPreview));
        }
예제 #7
0
 public Task <Gist> Fork(string id)
 {
     return(ApiConnection.Post <Gist>(ApiUrls.ForkGist(id), new object()));
 }
예제 #8
0
        /// <summary>
        /// Transfers the ownership of the specified repository.
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/#transfer-a-repository">API documentation</a> for more information.
        /// </remarks>
        /// <param name="repositoryId">The id of the repository</param>
        /// <param name="repositoryTransfer">Repository transfer information</param>
        /// <returns>A <see cref="Repository"/></returns>
        public Task <Repository> Transfer(long repositoryId, RepositoryTransfer repositoryTransfer)
        {
            Ensure.ArgumentNotNull(repositoryTransfer, nameof(repositoryTransfer));

            return(ApiConnection.Post <Repository>(ApiUrls.RepositoryTransfer(repositoryId), repositoryTransfer, AcceptHeaders.RepositoryTransferPreview));
        }
예제 #9
0
        public Task <Reference> Create(long repositoryId, NewReference reference)
        {
            Ensure.ArgumentNotNull(reference, nameof(reference));

            return(ApiConnection.Post <Reference>(ApiUrls.Reference(repositoryId), reference));
        }
예제 #10
0
        public Task <Merge> Create(long repositoryId, NewMerge merge)
        {
            Ensure.ArgumentNotNull(merge, nameof(merge));

            return(ApiConnection.Post <Merge>(ApiUrls.CreateMerge(repositoryId), merge));
        }
예제 #11
0
        /// <summary>
        /// Creates a reaction for a specified Issue Comment
        /// </summary>
        /// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-an-issue-comment</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The comment id</param>
        /// <param name="reaction">The reaction to create</param>
        public Task <Reaction> Create(long repositoryId, int number, NewReaction reaction)
        {
            Ensure.ArgumentNotNull(reaction, "reaction");

            return(ApiConnection.Post <Reaction>(ApiUrls.IssueCommentReactions(repositoryId, number), reaction, AcceptHeaders.ReactionsPreview));
        }
예제 #12
0
        public Task <Repository> Create(long repositoryId, NewRepositoryFork fork)
        {
            Ensure.ArgumentNotNull(fork, nameof(fork));

            return(ApiConnection.Post <Repository>(ApiUrls.RepositoryForks(repositoryId), fork));
        }
예제 #13
0
 /// <summary>
 /// Create a time bound access token for a GitHubApp Installation that can be used to access other API endpoints (requires GitHubApp JWT token auth).
 /// </summary>
 /// <remarks>
 /// https://developer.github.com/v3/apps/#create-a-new-installation-token
 /// https://developer.github.com/apps/building-github-apps/authentication-options-for-github-apps/#authenticating-as-an-installation
 /// https://developer.github.com/v3/apps/available-endpoints/
 /// </remarks>
 /// <param name="installationId">The Id of the GitHub App Installation</param>
 public Task <AccessToken> CreateInstallationToken(long installationId)
 {
     return(ApiConnection.Post <AccessToken>(ApiUrls.AccessTokens(installationId), string.Empty, AcceptHeaders.GitHubAppsPreview));
 }
예제 #14
0
 public Task <PagesBuild> RequestPageBuild(long repositoryId)
 {
     return(ApiConnection.Post <PagesBuild>(ApiUrls.RepositoryPageBuilds(repositoryId), AcceptHeaders.PagesApiPreview));
 }
        /// <summary>
        /// Triggers a new download of the <see cref="PreReceiveEnvironment"/>'s tarball from the environment's <see cref="PreReceiveEnvironment.ImageUrl"/>.
        /// When the download is finished, the newly downloaded tarball will overwrite the existing environment.
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/enterprise-admin/pre_receive_environments/#trigger-a-pre-receive-environment-download">API documentation</a> for more information.
        /// </remarks>
        /// <param name="environmentId">The id of the pre-receive environment</param>
        /// <exception cref="NotFoundException">Thrown when the specified <paramref name="environmentId"/> does not exist.</exception>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        public Task <PreReceiveEnvironmentDownload> TriggerDownload(long environmentId)
        {
            var endpoint = ApiUrls.AdminPreReceiveEnvironmentDownload(environmentId);

            return(ApiConnection.Post <PreReceiveEnvironmentDownload>(endpoint, new object(), AcceptHeaders.PreReceiveEnvironmentsPreview));
        }
예제 #16
0
        /// <summary>
        /// Creates a new <see cref="GpgKey"/> for the authenticated user.
        /// </summary>
        /// <param name="newGpgKey">The new GPG key to add.</param>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/users/gpg_keys/#create-a-gpg-key">API documentation</a> for more information.
        /// </remarks>
        /// <returns>The newly created <see cref="GpgKey"/>.</returns>
        public Task <GpgKey> Create(NewGpgKey newGpgKey)
        {
            Ensure.ArgumentNotNull(newGpgKey, nameof(newGpgKey));

            return(ApiConnection.Post <GpgKey>(ApiUrls.GpgKeys(), newGpgKey, AcceptHeaders.GpgKeysPreview));
        }
예제 #17
0
        /// <summary>
        /// Creates a card.
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/projects/#create-a-project-card">API documentation</a> for more information.
        /// </remarks>
        /// <param name="columnId">The id of the column</param>
        /// <param name="newProjectCard">The card to create</param>
        public Task <ProjectCard> Create(int columnId, NewProjectCard newProjectCard)
        {
            Ensure.ArgumentNotNull(newProjectCard, nameof(newProjectCard));

            return(ApiConnection.Post <ProjectCard>(ApiUrls.ProjectCards(columnId), newProjectCard, AcceptHeaders.ProjectsApiPreview));
        }
예제 #18
0
        /// <summary>
        /// Create a pull request for the specified repository.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/pulls/#create-a-pull-request</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="newPullRequest">A <see cref="NewPullRequest"/> instance describing the new PullRequest to create</param>
        public Task <PullRequest> Create(long repositoryId, NewPullRequest newPullRequest)
        {
            Ensure.ArgumentNotNull(newPullRequest, "newPullRequest");

            return(ApiConnection.Post <PullRequest>(ApiUrls.PullRequests(repositoryId), newPullRequest));
        }
예제 #19
0
        public Task <BlobReference> Create(long repositoryId, NewBlob newBlob)
        {
            Ensure.ArgumentNotNull(newBlob, nameof(newBlob));

            return(ApiConnection.Post <BlobReference>(ApiUrls.Blobs(repositoryId), newBlob));
        }
예제 #20
0
        public Task <RepositoryHook> Create(long repositoryId, NewRepositoryHook hook)
        {
            Ensure.ArgumentNotNull(hook, nameof(hook));

            return(ApiConnection.Post <RepositoryHook>(ApiUrls.RepositoryHooks(repositoryId), hook.ToRequest()));
        }
예제 #21
0
        /// <summary>
        /// Create a tag for a given repository
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/git/tags/#create-a-tag-object
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="tag">The tag to create</param>
        public Task <GitTag> Create(long repositoryId, NewTag tag)
        {
            Ensure.ArgumentNotNull(tag, nameof(tag));

            return(ApiConnection.Post <GitTag>(ApiUrls.CreateTag(repositoryId), tag));
        }
예제 #22
0
 public Task Ping(long repositoryId, int hookId)
 {
     return(ApiConnection.Post(ApiUrls.RepositoryHookPing(repositoryId, hookId)));
 }
예제 #23
0
        /// <summary>
        /// Creates a milestone for the specified repository. Any user with pull access to a repository can create an
        /// Milestone.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/milestones/#create-a-milestone</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="newMilestone">A <see cref="NewMilestone"/> instance describing the new Milestone to create</param>
        /// <returns></returns>
        public Task <Milestone> Create(long repositoryId, NewMilestone newMilestone)
        {
            Ensure.ArgumentNotNull(newMilestone, nameof(newMilestone));

            return(ApiConnection.Post <Milestone>(ApiUrls.Milestones(repositoryId), newMilestone));
        }
예제 #24
0
        /// <summary>
        /// Creates a new Issue Comment for a specified Issue.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/issues/comments/#create-a-comment</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The number of the issue</param>
        /// <param name="newComment">The new comment to add to the issue</param>
        public Task <IssueComment> Create(long repositoryId, int number, string newComment)
        {
            Ensure.ArgumentNotNull(newComment, nameof(newComment));

            return(ApiConnection.Post <IssueComment>(ApiUrls.IssueComments(repositoryId, number), new BodyWrapper(newComment)));
        }
예제 #25
0
        /// <summary>
        /// Creates a new <see cref="Authorization"/>.
        /// </summary>
        /// <remarks>
        /// This method requires authentication.
        /// See the <a href="http://developer.github.com/v3/oauth/#create-a-new-authorization">API documentation</a> for more information.
        /// </remarks>
        /// <param name="newAuthorization">Describes the new authorization to create</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 created <see cref="Authorization"/>.</returns>
        public Task <Authorization> Create(NewAuthorization newAuthorization)
        {
            Ensure.ArgumentNotNull(newAuthorization, "newAuthorization");

            return(ApiConnection.Post <Authorization>(ApiUrls.Authorizations(), newAuthorization));
        }
예제 #26
0
        /// <summary>
        /// Creates a reaction for a specified Pull Request Review Comment.
        /// </summary>
        /// <remarks>https://developer.github.com/v3/reactions/#create-reaction-for-a-pull-request-review-comment</remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The comment id</param>
        /// <param name="reaction">The reaction to create</param>
        public Task <Reaction> Create(long repositoryId, int number, NewReaction reaction)
        {
            Ensure.ArgumentNotNull(reaction, nameof(reaction));

            return(ApiConnection.Post <Reaction>(ApiUrls.PullRequestReviewCommentReaction(repositoryId, number), reaction, AcceptHeaders.ReactionsPreview));
        }
예제 #27
0
        public Task <IReadOnlyList <Label> > AddToIssue(long repositoryId, int number, string[] labels)
        {
            Ensure.ArgumentNotNull(labels, nameof(labels));

            return(ApiConnection.Post <IReadOnlyList <Label> >(ApiUrls.IssueLabels(repositoryId, number), labels));
        }
예제 #28
0
        public Task <PublicKey> Create(NewPublicKey newKey)
        {
            Ensure.ArgumentNotNull(newKey, nameof(newKey));

            return(ApiConnection.Post <PublicKey>(ApiUrls.Keys(), newKey));
        }
예제 #29
0
        public Task <CheckRun> Create(long repositoryId, NewCheckRun newCheckRun)
        {
            Ensure.ArgumentNotNull(newCheckRun, nameof(newCheckRun));

            return(ApiConnection.Post <CheckRun>(ApiUrls.CheckRuns(repositoryId), newCheckRun, AcceptHeaders.ChecksApiPreview));
        }
예제 #30
0
        /// <summary>
        /// Update the specified <see cref="UserUpdate"/>.
        /// </summary>
        /// <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> Create(SshKeyUpdate key)
        {
            Ensure.ArgumentNotNull(key, "key");

            return(ApiConnection.Post <SshKey>(ApiUrls.SshKeys(), key));
        }