Example #1
0
        /// <summary>
        /// Gets all events for the repository.
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/issues/events/#list-events-for-a-repository
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="options">Options for changing the API response</param>
        public IObservable <IssueEvent> GetAllForRepository(long repositoryId, ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, nameof(options));

            return(_connection.GetAndFlattenAllPages <IssueEvent>(ApiUrls.IssuesEvents(repositoryId), options));
        }
        /// <summary>
        /// List gist commits
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/gists/#list-gists-commits
        /// </remarks>
        /// <param name="id">The id of the gist</param>
        public IObservable <GistHistory> GetAllCommits(string id)
        {
            Ensure.ArgumentNotNullOrEmptyString(id, "id");

            return(_connection.GetAndFlattenAllPages <GistHistory>(ApiUrls.GistCommits(id)));
        }
 /// <summary>
 /// List the authenticated user’s gists or if called anonymously,
 /// this will return all public gists
 /// </summary>
 /// <remarks>
 /// http://developer.github.com/v3/gists/#list-gists
 /// </remarks>
 public IObservable <Gist> GetAll()
 {
     return(_connection.GetAndFlattenAllPages <Gist>(ApiUrls.Gist()));
 }
Example #4
0
        /// <summary>
        /// Retrieves all of the watchers for the passed repository
        /// </summary>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="options">Options for changing the API's response.</param>
        /// <exception cref="AuthorizationException">Thrown if the client is not authenticated</exception>
        public IObservable <User> GetAllWatchers(long repositoryId, ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, "options");

            return(_connection.GetAndFlattenAllPages <User>(ApiUrls.Watchers(repositoryId), options));
        }
 /// <summary>
 /// List the authenticated user’s starred gists
 /// </summary>
 /// <remarks>
 /// http://developer.github.com/v3/gists/#list-gists
 /// </remarks>
 public IObservable <Gist> GetAllStarred()
 {
     return(_connection.GetAndFlattenAllPages <Gist>(ApiUrls.StarredGists()));
 }
Example #6
0
 public CurrentUserGistsViewModel(string username, IMessageService messageService = null)
     : base(ApiUrls.UsersGists(username))
 {
     messageService = messageService ?? Locator.Current.GetService <IMessageService>();
     _addToken      = messageService.Listen <GistAddMessage>(msg => Gists.Insert(0, msg.Gist));
 }
Example #7
0
 public static GistsViewModel CreateStarredGistsViewModel()
 => new GistsViewModel(ApiUrls.StarredGists());
Example #8
0
        /// <summary>
        /// List all pending invitations for the organization.
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/orgs/members/#list-pending-organization-invitations">API Documentation</a>
        /// for more information.
        /// </remarks>
        /// <param name="org">The login for the organization</param>
        /// <param name="options">Options to change API behaviour</param>
        /// <returns></returns>
        public IObservable <OrganizationMembershipInvitation> GetAllPendingInvitations(string org, ApiOptions options)
        {
            Ensure.ArgumentNotNullOrEmptyString(org, nameof(org));
            Ensure.ArgumentNotNull(options, nameof(options));

            return(_connection.GetAndFlattenAllPages <OrganizationMembershipInvitation>(ApiUrls.OrganizationPendingInvititations(org), null, AcceptHeaders.OrganizationMembershipPreview, options));
        }
Example #9
0
 /// <summary>
 /// Completes a translate and analysis task.
 /// All the resources associated with the given job will be deleted.
 /// </summary>
 /// <param name="jobId">The job identifier.</param>
 public Task DeleteJob(string jobId)
 {
     return(ApiConnection.Delete(ApiUrls.DeleteJob(jobId)));
 }
Example #10
0
 /// <summary>
 /// Get top coins by volume for the to currency. It returns volume24hto and total supply (where available).
 /// The number of coins you get is the minimum of the limit you set (default 50) and the total number of coins available.
 /// </summary>
 /// <param name="toSymbol">to symbol.</param>
 /// <param name="limit">(Optional) The limit.</param>
 /// <returns>
 /// An asynchronous result that yields a TopVolumesResponse.
 /// </returns>
 /// <seealso cref="M:CryptoCompare.ITopsClient.Volumes(string,int?)"/>
 public async Task <TopVolumesResponse> ByPairVolumeAsync([NotNull] string toSymbol, int?limit = null)
 {
     Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol));
     return(await this.GetAsync <TopVolumesResponse>(ApiUrls.TopByPairVolume(toSymbol, limit)).ConfigureAwait(false));
 }
Example #11
0
 /// <summary>
 /// Get top exchanges by volume for a currency pair plus the full CCCAGG data. The number of
 /// exchanges you get is the minimum of the limit you set (default 5) and the total number of
 /// exchanges available.
 /// </summary>
 /// <param name="fromSymbol">The cryptocurrency symbol of interest.</param>
 /// <param name="toSymbol">The currency symbol to convert into.</param>
 /// <param name="limit">(Optional)The number of data points to return.</param>
 /// <returns>
 /// The asynchronous result that yields a TopResponse.
 /// </returns>
 /// <seealso cref="M:CryptoCompare.ITopListClient.ExchangesFullDataByPairAsync(string,string,int?)"/>
 public async Task <TopExchangeFullResponse> ExchangesFullDataByPairAsync(string fromSymbol, string toSymbol, int?limit = null)
 {
     Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol));
     return(await this.GetAsync <TopExchangeFullResponse>(ApiUrls.ExchangesFullDataByPair(fromSymbol, toSymbol, limit)).ConfigureAwait(false));
 }
Example #12
0
 /// <summary>
 /// Get top pairs by volume for a currency (always uses our aggregated data).
 /// The number of pairs you get is the minimum of the limit you set (default 5) and the total number of pairs available.
 /// </summary>
 /// <param name="fromSymbol">from symbol.</param>
 /// <param name="limit">(Optional) The limit.</param>
 /// <returns>
 /// An asynchronous result that yields a TopResponse.
 /// </returns>
 /// <seealso cref="M:CryptoCompare.ITopsClient.Pairs(string,int?)"/>
 public async Task <TopResponse> TradingPairsAsync([NotNull] string fromSymbol, int?limit = null)
 {
     Check.NotNullOrWhiteSpace(fromSymbol, nameof(fromSymbol));
     return(await this.GetAsync <TopResponse>(ApiUrls.TopOfTradingPairs(fromSymbol, limit)).ConfigureAwait(false));
 }
Example #13
0
 /// <summary>
 /// Get full data for the top coins ordered by their total volume across all markets in the last 24 hours as expressed in a given currency.
 /// </summary>
 /// <param name="toSymbol">The symbol of the currency into which the market cap are expressed.</param>
 /// <param name="limit">(Optional)The number currencies to return, default is 10.</param>
 /// <param name="page">(Optional)The pagination for the request.</param>
 /// <param name="sign">(Optional)If set to true, the server will sign the requests, this is useful for usage in smart contracts.</param>
 /// <returns>
 /// The asynchronous result that yields a TopVolume24HResponse.
 /// </returns>
 /// <seealso cref="M:CryptoCompare.ITopListClient.CoinFullDataBy24HVolume(string,int?,int?,bool?)"/>
 public async Task <TopVolume24HResponse> CoinFullDataBy24HVolume(string toSymbol, int?limit = null, int?page = null, bool?sign = null)
 {
     Check.NotNullOrWhiteSpace(toSymbol, nameof(toSymbol));
     return(await this.GetAsync <TopVolume24HResponse>(ApiUrls.TopByVolume24HFull(toSymbol, limit, page, sign)).ConfigureAwait(false));
 }
Example #14
0
        /// <summary>
        /// Gets all events for the issue.
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/issues/events/#list-events-for-an-issue
        /// </remarks>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="number">The issue number</param>
        /// <param name="options">Options for changing the API response</param>
        public IObservable <EventInfo> GetAllForIssue(long repositoryId, int number, ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, nameof(options));

            return(_connection.GetAndFlattenAllPages <EventInfo>(ApiUrls.IssuesEvents(repositoryId, number), options));
        }
        /// <summary>
        /// Gets all issues across all the authenticated user’s visible repositories including owned repositories,
        /// member repositories, and organization repositories.
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/issues/#list-issues
        /// </remarks>
        /// <param name="request">Used to filter and sort the list of issues returned</param>
        /// <returns></returns>
        public IObservable <Issue> GetAllForCurrent(IssueRequest request)
        {
            Ensure.ArgumentNotNull(request, "request");

            return(_connection.GetAndFlattenAllPages <Issue>(ApiUrls.Issues(), request.ToParametersDictionary()));
        }
Example #16
0
 /// <summary>
 /// Initiates a new translate and analysis job
 /// </summary>
 /// <param name="request">The analysis options.</param>
 /// <returns>The job identifier</returns>
 /// <response code="200">The job was registered.</response>
 /// <response code="401">The authorization provided was denied. Populate the Authorization header with a valid token.</response>
 public Task <int> GetTranslateAndAnalysisJob(TranslationAndAnalysisJobRequest request)
 {
     return(ApiConnection.Post <int>(ApiUrls.InitiateTranslateAndAnalysisJob(), request, "application/json"));
 }
        /// <summary>
        /// Gets all the branches for the specified repository.
        /// </summary>
        /// <remarks>
        /// See the <a href="https://developer.github.com/v3/repos/branches/#list-branches">API documentation</a> for more details
        /// </remarks>
        /// <param name="repositoryId">The ID of the repository</param>
        /// <param name="options">Options for changing the API response</param>
        public IObservable <Branch> GetAll(long repositoryId, ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, "options");

            return(_connection.GetAndFlattenAllPages <Branch>(ApiUrls.RepoBranches(repositoryId), options));
        }
Example #18
0
 /// <summary>
 /// Gets a new translation job for the specified translate and analysis job.
 /// </summary>
 /// <param name="jobId">The job identifier.</param>
 /// <param name="request">The document and the tm's options</param>
 /// <returns>The translatable document identifier</returns>
 /// <response code="200">Translation triggered successfully.</response>
 /// <response code="400">When the given document or translation information not correct</response>
 /// <response code="404">If there is no document with the given identifier</response>
 public Task <int> GetTranslationJob(string jobId, MultipartFormDataContent request)
 {
     return(ApiConnection.Post <int>(ApiUrls.TranslationJob(jobId), request, "multipart/form-data"));
 }
Example #19
0
 public static GistsViewModel CreatePublicGistsViewModel()
 => new GistsViewModel(ApiUrls.PublicGists());
Example #20
0
 /// <summary>
 /// Exposes the translation status
 /// </summary>
 /// <param name="translateJobNo">The document identifier.</param>
 /// <returns>The translation status and errors</returns>
 /// <response code="200">The status was returned.</response>
 /// <response code="404">If there is no document with the given identifier</response>
 public Task <Translation> GetTranslationStatus(string translateJobNo)
 {
     return(ApiConnection.Get <Translation>(ApiUrls.TranslationJobStatus(translateJobNo), null));
 }
Example #21
0
 public static GistsViewModel CreateUserGistsViewModel(string username)
 => new GistsViewModel(ApiUrls.UsersGists(username));
Example #22
0
 /// <summary>
 /// Downloads the translated document.
 /// </summary>
 /// <param name="translateJobNo">The document identifier.</param>
 /// <returns>The document content</returns>
 /// <response code="200">The download was successful</response>
 /// <response code="400">When the translation was not completed successfully. Use the status call to know the status of the translation.</response>
 /// <response code="404">If there is no document with the given identifier</response>
 public Task <byte[]> DownloadTranslationDocument(string translateJobNo)
 {
     return(ApiConnection.Get <byte[]>(ApiUrls.DownloadTranslationDocument(translateJobNo), null));
 }
Example #23
0
        /// <summary>
        /// Retrieves all of the watched <see cref="Repository"/>(ies) for the current user
        /// </summary>
        /// <param name="options">Options for changing the API's response.</param>
        /// <exception cref="AuthorizationException">Thrown if the client is not authenticated</exception>
        public IObservable <Repository> GetAllForCurrent(ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, "options");

            return(_connection.GetAndFlattenAllPages <Repository>(ApiUrls.Watched(), options));
        }
Example #24
0
 /// <summary>
 /// Triggers the analysis.
 /// This should be called after all the translations are complete.
 /// </summary>
 /// <param name="jobId">The job identifier.</param>
 /// <returns>The analysis identifier</returns>
 /// <response code="200">The translated document identifier</response>
 /// <response code="400">When the given document or translation information is incorrect</response>
 public Task <int> GetAnalysisJob(string jobId)
 {
     return(ApiConnection.Post <int>(ApiUrls.AnalysisJob(jobId), string.Empty, "application/json"));
 }
        /// <summary>
        /// List a user's gists
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/gists/#list-gists
        /// </remarks>
        /// <param name="user">The user</param>
        public IObservable <Gist> GetAllForUser(string user)
        {
            Ensure.ArgumentNotNull(user, "user");

            return(_connection.GetAndFlattenAllPages <Gist>(ApiUrls.UsersGists(user)));
        }
Example #26
0
 /// <summary>
 /// Gets the specified analysis statistics.
 /// </summary>
 /// <param name="analysisJobNo">The analysis identifier.</param>
 /// <returns>The analysis statistics</returns>
 public Task <AnalysisStatistics> GetAnalysisStatistics(string analysisJobNo)
 {
     return(ApiConnection.Get <AnalysisStatistics>(ApiUrls.AnalysisStatistics(analysisJobNo), null));
 }
        /// <summary>
        /// List gist forks
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/gists/#list-gists-forks
        /// </remarks>
        /// <param name="id">The id of the gist</param>
        public IObservable <GistFork> GetAllForks(string id)
        {
            Ensure.ArgumentNotNullOrEmptyString(id, "id");

            return(_connection.GetAndFlattenAllPages <GistFork>(ApiUrls.ForkGist(id)));
        }
        /// <summary>
        /// Gets Commit Comments for a repository.
        /// </summary>
        /// <param name="repositoryId">The Id of the repository</param>
        /// <param name="options">Options to change the API response</param>
        /// <remarks>http://developer.github.com/v3/repos/comments/#list-commit-comments-for-a-repository</remarks>
        public IObservable <CommitComment> GetAllForRepository(long repositoryId, ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, nameof(options));

            return(_connection.GetAndFlattenAllPages <CommitComment>(ApiUrls.CommitComments(repositoryId), null, AcceptHeaders.ReactionsPreview, options));
        }
        /// <summary>
        /// List the authenticated user’s gists or if called anonymously,
        /// this will return all public gists
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/gists/#list-gists
        /// </remarks>
        /// <param name="since">Only gists updated at or after this time are returned</param>
        public IObservable <Gist> GetAll(DateTimeOffset since)
        {
            var request = new GistRequest(since);

            return(_connection.GetAndFlattenAllPages <Gist>(ApiUrls.Gist(), request.ToParametersDictionary()));
        }
Example #30
0
        /// <summary>
        /// Gets all the public events
        /// </summary>
        /// <remarks>
        /// http://developer.github.com/v3/activity/events/#list-public-events
        /// </remarks>
        /// <param name="options">Options for changing the API response</param>
        public IObservable <Activity> GetAll(ApiOptions options)
        {
            Ensure.ArgumentNotNull(options, "options");

            return(_connection.GetAndFlattenAllPages <Activity>(ApiUrls.Events(), options));
        }