Exemplo n.º 1
0
        /// <summary>
        /// Lists Check Suites for a commit reference (SHA, branch name or tag name)
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref">Check Suites API documentation</a> for more information.
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="reference">The reference (SHA, branch name or tag name) to list check suites for</param>
        public Task <CheckSuitesResponse> GetAllForReference(long repositoryId, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference));

            return(GetAllForReference(repositoryId, reference, new CheckSuiteRequest(), ApiOptions.None));
        }
        /// <summary>
        /// Gets a single commit for a given repository
        /// </summary>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="reference">The reference for the commit (SHA)</param>
        public Task <GitHubCommit> Get(long repositoryId, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(reference, "reference");

            return(ApiConnection.Get <GitHubCommit>(ApiUrls.RepositoryCommit(repositoryId, reference)));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Updates the comment with the specified gist- and comment id.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/gists/comments/#edit-a-comment</remarks>
        /// <param name="gistId">The id of the gist</param>
        /// <param name="commentId">The id of the comment</param>
        /// <param name="comment">The updated body of the comment</param>
        /// <returns>Task{GistComment}.</returns>
        public Task <GistComment> Update(string gistId, int commentId, string comment)
        {
            Ensure.ArgumentNotNullOrEmptyString(comment, "comment");

            return(ApiConnection.Patch <GistComment>(ApiUrls.GistComment(gistId, commentId), new BodyWrapper(comment)));
        }
        public Task <IReadOnlyList <User> > GetAll(string org)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));

            return(GetAll(org, ApiOptions.None));
        }
        /// <summary>
        /// Get the branch protection settings for the specified branch />
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#get-branch-protection">API documentation</a> for more details
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="branch">The name of the branch</param>
        public Task <BranchProtectionSettings> GetBranchProtection(int repositoryId, string branch)
        {
            Ensure.ArgumentNotNullOrEmptyString(branch, "branch");

            return(ApiConnection.Get <BranchProtectionSettings>(ApiUrls.RepoBranchProtection(repositoryId, branch), null, AcceptHeaders.ProtectedBranchesApiPreview));
        }
Exemplo n.º 6
0
 public static string FromRubyCase(this string propertyName)
 {
     Ensure.ArgumentNotNullOrEmptyString(propertyName, "s");
     return(string.Join("", propertyName.Split('_')).ToCapitalizedInvariant());
 }
        public Task <IReadOnlyList <User> > GetAll(string org, OrganizationMembersFilter filter, OrganizationMembersRole role)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));

            return(GetAll(org, filter, role, ApiOptions.None));
        }
Exemplo n.º 8
0
        public Task Delete(string id)
        {
            Ensure.ArgumentNotNullOrEmptyString(id, nameof(id));

            return(ApiConnection.Delete(ApiUrls.Gist(id)));
        }
Exemplo n.º 9
0
        public Task <GistComment> Create(string gistId, string comment)
        {
            Ensure.ArgumentNotNullOrEmptyString(comment, nameof(comment));

            return(ApiConnection.Post <GistComment>(ApiUrls.GistComments(gistId), new BodyWrapper(comment)));
        }
Exemplo n.º 10
0
        public Task <IReadOnlyList <GistFork> > GetAllForks(string id)
        {
            Ensure.ArgumentNotNullOrEmptyString(id, nameof(id));

            return(GetAllForks(id, ApiOptions.None));
        }
Exemplo n.º 11
0
        public Task Star(string id)
        {
            Ensure.ArgumentNotNullOrEmptyString(id, nameof(id));

            return(ApiConnection.Put(ApiUrls.StarGist(id)));
        }
Exemplo n.º 12
0
        public Task <IReadOnlyList <Gist> > GetAllForUser(string user, DateTimeOffset since)
        {
            Ensure.ArgumentNotNullOrEmptyString(user, nameof(user));

            return(GetAllForUser(user, since, ApiOptions.None));
        }
Exemplo n.º 13
0
        public Task <Blob> Get(long repositoryId, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(reference, nameof(reference));

            return(ApiConnection.Get <Blob>(ApiUrls.Blob(repositoryId, reference)));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Creates a new repository transfer description with no team Ids.
        /// </summary>
        /// <param name="newOwner">The new owner of the repository after the transfer.</param>
        public RepositoryTransfer(string newOwner)
        {
            Ensure.ArgumentNotNullOrEmptyString(newOwner, nameof(newOwner));

            NewOwner = newOwner;
        }
Exemplo n.º 15
0
        public static Uri FormatUri(this string pattern, params object[] args)
        {
            Ensure.ArgumentNotNullOrEmptyString(pattern, "pattern");

            return(new Uri(string.Format(CultureInfo.InvariantCulture, pattern, args), UriKind.Relative));
        }
        /// <summary>
        /// Returns the specified <see cref="Organization"/>.
        /// </summary>
        /// <param name="org">login of the organization to get</param>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>The specified <see cref="Organization"/>.</returns>
        public Task <Organization> Get(string org)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, "org");

            return(ApiConnection.Get <Organization>(ApiUrls.Organization(org)));
        }
Exemplo n.º 17
0
 public static string ToRubyCase(this string propertyName)
 {
     Ensure.ArgumentNotNullOrEmptyString(propertyName, "s");
     return(string.Join("_", propertyName.SplitUpperCase()).ToLowerInvariant());
 }
        public Task <IReadOnlyList <Organization> > GetAll(string user)
        {
            Ensure.ArgumentNotNullOrEmptyString(user, "user");

            return(GetAll(user, ApiOptions.None));
        }
Exemplo n.º 19
0
 public static string ToCapitalizedInvariant(this string value)
 {
     Ensure.ArgumentNotNullOrEmptyString(value, "s");
     return(string.Concat(value[0].ToString().ToUpperInvariant(), value.Substring(1)));
 }
Exemplo n.º 20
0
        /// <summary>
        /// Retrieves the <see cref="SshKey"/> for the specified id.
        /// </summary>
        /// <param name="user">The login of the user</param>
        /// <returns>A <see cref="IReadOnlyPagedCollection{SshKey}"/> of <see cref="SshKey"/>.</returns>
        public Task <IReadOnlyList <SshKey> > GetAll(string user)
        {
            Ensure.ArgumentNotNullOrEmptyString(user, "user");

            return(ApiConnection.GetAll <SshKey>(ApiUrls.SshKeys(user)));
        }
        public Task <IReadOnlyList <OrganizationMembershipInvitation> > GetAllPendingInvitations(string org)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));

            return(GetAllPendingInvitations(org, ApiOptions.None));
        }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NewRelease"/> class.
 /// </summary>
 /// <param name="tagName">Name of the tag to create in the repository for this release.</param>
 public NewRelease(string tagName)
 {
     Ensure.ArgumentNotNullOrEmptyString(tagName, nameof(tagName));
     TagName = tagName;
 }
Exemplo n.º 23
0
        public Task <IReadOnlyList <PublicKey> > GetAll(string userName)
        {
            Ensure.ArgumentNotNullOrEmptyString(userName, nameof(userName));

            return(GetAll(userName, ApiOptions.None));
        }
Exemplo n.º 24
0
        public ReleaseAssetUpdate(string name)
        {
            Ensure.ArgumentNotNullOrEmptyString(name, "name");

            Name = name;
        }
Exemplo n.º 25
0
        /// <summary>
        /// Get the SHA-1 of a commit reference
        /// </summary>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="reference">The repository reference</param>
        public Task <string> GetSha1(long repositoryId, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(reference, "reference");

            return(ApiConnection.Get <string>(ApiUrls.RepositoryCommit(repositoryId, reference), null, AcceptHeaders.CommitReferenceSha1Preview));
        }
Exemplo n.º 26
0
        /// <summary>
        /// Gets all repositories owned by the specified user.
        /// </summary>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/repos/#list-user-repositories">API documentation</a> for more information.
        /// The default page size on GitHub.com is 30.
        /// </remarks>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
        public Task <IReadOnlyList <Repository> > GetAllForUser(string login)
        {
            Ensure.ArgumentNotNullOrEmptyString(login, "login");

            return(ApiConnection.GetAll <Repository>(ApiUrls.Repositories(login)));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Gets all comments for the gist with the specified id.
        /// </summary>
        /// <remarks>http://developer.github.com/v3/gists/comments/#list-comments-on-a-gist</remarks>
        /// <param name="gistId">The id of the gist</param>
        /// <returns>Task{IReadOnlyList{GistComment}}.</returns>
        public Task <IReadOnlyList <GistComment> > GetAllForGist(string gistId)
        {
            Ensure.ArgumentNotNullOrEmptyString(gistId, "gistId");

            return(GetAllForGist(gistId, ApiOptions.None));
        }
Exemplo n.º 28
0
        /// <summary>
        /// Gets all repositories owned by the specified organization.
        /// </summary>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/repos/#list-organization-repositories">API documentation</a> for more information.
        /// The default page size on GitHub.com is 30.
        /// </remarks>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
        public Task <IReadOnlyList <Repository> > GetAllForOrg(string organization)
        {
            Ensure.ArgumentNotNullOrEmptyString(organization, "organization");

            return(ApiConnection.GetAll <Repository>(ApiUrls.OrganizationRepositories(organization)));
        }
Exemplo n.º 29
0
        /// <summary>
        /// Gets a tag for a given repository by sha reference
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/git/tags/#get-a-tag
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="reference">Tha sha reference of the tag</param>
        public Task <GitTag> Get(long repositoryId, string reference)
        {
            Ensure.ArgumentNotNullOrEmptyString(reference, "reference");

            return(ApiConnection.Get <GitTag>(ApiUrls.Tag(repositoryId, reference), null, AcceptHeaders.SignatureVerificationPreview));
        }
Exemplo n.º 30
0
        /// <summary>
        /// Gets all repositories owned by the specified organization.
        /// </summary>
        /// <remarks>
        /// See the <a href="http://developer.github.com/v3/repos/#list-organization-repositories">API documentation</a> for more information.
        /// The default page size on GitHub.com is 30.
        /// </remarks>
        /// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
        /// <returns>A <see cref="IReadOnlyPagedCollection{Repository}"/> of <see cref="Repository"/>.</returns>
        public Task <IReadOnlyList <Repository> > GetAllForOrg(string organization)
        {
            Ensure.ArgumentNotNullOrEmptyString(organization, "organization");

            return(GetAllForOrg(organization, ApiOptions.None));
        }