using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reactive;
using System.Reactive.Linq;
using System.Reactive.Threading.Tasks;
using Octokit.Reactive.Clients;
using Octokit.Reactive.Internal;
namespace Octokit.Reactive
{
public class ObservableRepositoriesClient : IObservableRepositoriesClient
{
readonly IRepositoriesClient _client;
readonly IConnection _connection;
public ObservableRepositoriesClient(IGitHubClient client)
{
Ensure.ArgumentNotNull(client, nameof(client));
_client = client.Repository;
_connection = client.Connection;
Status = new ObservableCommitStatusClient(client);
Hooks = new ObservableRepositoryHooksClient(client);
Forks = new ObservableRepositoryForksClient(client);
Collaborator = new ObservableRepoCollaboratorsClient(client);
Deployment = new ObservableDeploymentsClient(client);
Environment = new ObservableEnvironmentsClient(client);
Statistics = new ObservableStatisticsClient(client);
PullRequest = new ObservablePullRequestsClient(client);
Branch = new ObservableRepositoryBranchesClient(client);
Comment = new ObservableRepositoryCommentsClient(client);
Commit = new ObservableRepositoryCommitsClient(client);
CustomProperty = new ObservableRepositoryCustomPropertiesClient(client);
Release = new ObservableReleasesClient(client);
DeployKeys = new ObservableRepositoryDeployKeysClient(client);
Content = new ObservableRepositoryContentsClient(client);
Merging = new ObservableMergingClient(client);
Page = new ObservableRepositoryPagesClient(client);
Invitation = new ObservableRepositoryInvitationsClient(client);
Traffic = new ObservableRepositoryTrafficClient(client);
Project = new ObservableProjectsClient(client);
Actions = new ObservableRepositoryActionsClient(client);
Autolinks = new ObservableAutolinksClient(client);
}
///
/// Creates a new repository for the current user.
///
/// A instance describing the new repository to create
/// An instance for the created repository
public IObservable Create(NewRepository newRepository)
{
Ensure.ArgumentNotNull(newRepository, nameof(newRepository));
if (string.IsNullOrEmpty(newRepository.Name))
throw new ArgumentException("The new repository's name must not be null.");
return _client.Create(newRepository).ToObservable();
}
///
/// Creates a new repository in the specified organization.
///
/// The login of the organization in which to create the repository
/// A instance describing the new repository to create
/// An instance for the created repository
public IObservable Create(string organizationLogin, NewRepository newRepository)
{
Ensure.ArgumentNotNull(organizationLogin, nameof(organizationLogin));
Ensure.ArgumentNotNull(newRepository, nameof(newRepository));
if (string.IsNullOrEmpty(newRepository.Name))
throw new ArgumentException("The new repository's name must not be null.");
return _client.Create(organizationLogin, newRepository).ToObservable();
}
///
/// Creates a new repository from a template
///
/// The organization or person who will owns the template
/// The name of template repository to work from
/// A instance describing the new repository to create from a template
///
public IObservable Generate(string templateOwner, string templateRepo, NewRepositoryFromTemplate newRepository)
{
Ensure.ArgumentNotNull(templateOwner, nameof(templateOwner));
Ensure.ArgumentNotNull(templateRepo, nameof(templateRepo));
Ensure.ArgumentNotNull(newRepository, nameof(newRepository));
if (string.IsNullOrEmpty(newRepository.Name))
throw new ArgumentException("The new repository's name must not be null.");
return _client.Generate(templateOwner, templateRepo, newRepository).ToObservable();
}
///
/// Deletes a repository for the specified owner and name.
///
/// The owner of the repository
/// The name of the repository
/// Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required.
/// An for the operation
public IObservable Delete(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return _client.Delete(owner, name).ToObservable();
}
///
/// Deletes a repository for the specified owner and name.
///
/// The Id of the repository
/// Deleting a repository requires admin access. If OAuth is used, the `delete_repo` scope is required.
/// An for the operation
public IObservable Delete(long repositoryId)
{
return _client.Delete(repositoryId).ToObservable();
}
///
/// Transfers the ownership of the specified repository.
///
///
/// See the API documentation for more information.
///
/// The current owner of the repository
/// The name of the repository
/// Repository transfer information
/// A
public IObservable Transfer(string owner, string name, RepositoryTransfer repositoryTransfer)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(repositoryTransfer, nameof(repositoryTransfer));
return _client.Transfer(owner, name, repositoryTransfer).ToObservable();
}
///
/// Transfers the ownership of the specified repository.
///
///
/// See the API documentation for more information.
///
/// The id of the repository
/// Repository transfer information
/// A
public IObservable Transfer(long repositoryId, RepositoryTransfer repositoryTransfer)
{
Ensure.ArgumentNotNull(repositoryTransfer, nameof(repositoryTransfer));
return _client.Transfer(repositoryId, repositoryTransfer).ToObservable();
}
///
/// Checks if vulnerability alerts are enabled for the specified repository.
///
///
/// See the API documentation for more information.
///
/// The current owner of the repository
/// The name of the repository
/// A bool indicating if alerts are turned on or not.
public IObservable AreVulnerabilityAlertsEnabled(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return _client.AreVulnerabilityAlertsEnabled(owner, name).ToObservable();
}
///
/// Retrieves the for the specified owner and name.
///
/// The owner of the repository
/// The name of the repository
/// A
public IObservable Get(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return _client.Get(owner, name).ToObservable();
}
///
/// Retrieves the for the specified owner and name.
///
/// The Id of the repository
/// A
public IObservable Get(long repositoryId)
{
return _client.Get(repositoryId).ToObservable();
}
///
/// Retrieves every public .
///
///
/// The default page size on GitHub.com is 30.
///
/// A of .
public IObservable GetAllPublic()
{
return _connection.GetAndFlattenAllPages(ApiUrls.AllPublicRepositories());
}
///
/// Retrieves every public since the last repository seen.
///
///
/// The default page size on GitHub.com is 30.
///
/// Search parameters of the last repository seen
/// A of .
public IObservable GetAllPublic(PublicRepositoryRequest request)
{
Ensure.ArgumentNotNull(request, nameof(request));
var url = ApiUrls.AllPublicRepositories(request.Since);
return _connection.GetAndFlattenAllPages(url);
}
///
/// Retrieves every that belongs to the current user.
///
///
/// The default page size on GitHub.com is 30.
///
/// Thrown if the client is not authenticated.
/// A of .
public IObservable GetAllForCurrent()
{
return GetAllForCurrent(ApiOptions.None);
}
///
/// Retrieves every that belongs to the current user.
///
/// Options for changing the API response
/// Thrown if the client is not authenticated.
/// A of .
public IObservable GetAllForCurrent(ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.Repositories(), options);
}
///
/// Retrieves every that belongs to the current user.
///
///
/// The default page size on GitHub.com is 30.
///
/// Search parameters to filter results on
/// Thrown if the client is not authenticated.
/// A of .
public IObservable GetAllForCurrent(RepositoryRequest request)
{
Ensure.ArgumentNotNull(request, nameof(request));
return GetAllForCurrent(request, ApiOptions.None);
}
///
/// Retrieves every that belongs to the current user.
///
/// Search parameters to filter results on
/// Options for changing the API response
/// Thrown if the client is not authenticated.
/// A of .
public IObservable GetAllForCurrent(RepositoryRequest request, ApiOptions options)
{
Ensure.ArgumentNotNull(request, nameof(request));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.Repositories(), request.ToParametersDictionary());
}
///
/// Retrieves every that belongs to the specified user.
///
/// The account name to search for
/// A of .
public IObservable GetAllForUser(string login)
{
Ensure.ArgumentNotNullOrEmptyString(login, nameof(login));
return GetAllForUser(login, ApiOptions.None);
}
///
/// Retrieves every that belongs to the specified user.
///
/// The account name to search for
/// Options for changing the API response
/// A of .
public IObservable GetAllForUser(string login, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(login, nameof(login));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.Repositories(login), null, options);
}
///
/// Retrieves every that belongs to the specified organization.
///
///
/// The default page size on GitHub.com is 30.
///
/// A of .
public IObservable GetAllForOrg(string organization)
{
Ensure.ArgumentNotNullOrEmptyString(organization, nameof(organization));
return GetAllForOrg(organization, ApiOptions.None);
}
///
/// Retrieves every that belongs to the specified organization.
///
/// The organization name to search for
/// Options for changing the API response
/// A of .
public IObservable GetAllForOrg(string organization, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(organization, nameof(organization));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.OrganizationRepositories(organization), options);
}
///
/// A client for GitHub's Commit Status API.
///
///
/// See the Commit Status API documentation for more
/// details. Also check out the blog post
/// that announced this feature.
///
public IObservableCommitStatusClient Status { get; private set; }
///
/// Client for GitHub's Repository Deployments API
///
///
/// See the Deployments API documentation for more details
///
public IObservableDeploymentsClient Deployment { get; private set; }
///
/// Client for GitHub's Repository Environments API
///
///
/// See the Environments API documentation for more details
///
public IObservableRepositoryDeployEnvironmentsClient Environment { get; private set; }
///
/// Client for GitHub's Repository Statistics API
/// Note that the GitHub API uses caching on these endpoints,
/// see a word about caching for more details.
///
///
/// See the Statistics API documentation for more details
///
public IObservableStatisticsClient Statistics { get; private set; }
///
/// Client for GitHub's Repository Comments API.
///
///
/// See the Repository Comments API documentation for more information.
///
public IObservableRepositoryCommentsClient Comment { get; private set; }
///
/// Client for GitHub's Repository Custom Property Values API.
///
///
/// See the Repository Custom Property API documentation for more information.
///
public IObservableRepositoryCustomPropertiesClient CustomProperty { get; private set; }
///
/// A client for GitHub's Repository Hooks API.
///
/// See Hooks API documentation for more information.
public IObservableRepositoryHooksClient Hooks { get; private set; }
///
/// A client for GitHub's Repository Forks API.
///
/// See Forks API documentation for more information.
public IObservableRepositoryForksClient Forks { get; private set; }
///
/// Client for GitHub's Repository Contents API.
///
///
/// See the Repository Contents API documentation for more information.
///
public IObservableRepositoryContentsClient Content { get; private set; }
///
/// Client for GitHub's Repository Merging API
///
///
/// See the Merging API documentation for more details
///
public IObservableMergingClient Merging { get; private set; }
///
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// All contributors of the repository.
public IObservable GetAllContributors(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return GetAllContributors(owner, name, ApiOptions.None);
}
///
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// All contributors of the repository.
public IObservable GetAllContributors(long repositoryId)
{
return GetAllContributors(repositoryId, ApiOptions.None);
}
///
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
/// All contributors of the repository.
public IObservable GetAllContributors(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return GetAllContributors(owner, name, false, options);
}
///
/// Gets all contributors for the specified repository. Does not include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// Options for changing the API response
/// All contributors of the repository.
public IObservable GetAllContributors(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return GetAllContributors(repositoryId, false, options);
}
///
/// Gets all contributors for the specified repository. With the option to include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// True if anonymous contributors should be included in result; Otherwise false
/// All contributors of the repository.
public IObservable GetAllContributors(string owner, string name, bool includeAnonymous)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return GetAllContributors(owner, name, includeAnonymous, ApiOptions.None);
}
///
/// Gets all contributors for the specified repository. With the option to include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// True if anonymous contributors should be included in result; Otherwise false
/// All contributors of the repository.
public IObservable GetAllContributors(long repositoryId, bool includeAnonymous)
{
return GetAllContributors(repositoryId, includeAnonymous, ApiOptions.None);
}
///
/// Gets all contributors for the specified repository. With the option to include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// True if anonymous contributors should be included in result; Otherwise false
/// Options for changing the API response
/// All contributors of the repository.
public IObservable GetAllContributors(string owner, string name, bool includeAnonymous, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
var endpoint = ApiUrls.RepositoryContributors(owner, name);
var parameters = new Dictionary();
if (includeAnonymous)
parameters.Add("anon", "1");
return _connection.GetAndFlattenAllPages(endpoint, parameters, options);
}
///
/// Gets all contributors for the specified repository. With the option to include anonymous contributors.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// True if anonymous contributors should be included in result; Otherwise false
/// Options for changing the API response
/// All contributors of the repository.
public IObservable GetAllContributors(long repositoryId, bool includeAnonymous, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
var endpoint = ApiUrls.RepositoryContributors(repositoryId);
var parameters = new Dictionary();
if (includeAnonymous)
parameters.Add("anon", "1");
return _connection.GetAndFlattenAllPages(endpoint, parameters, options);
}
///
/// Gets all languages for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// All languages used in the repository and the number of bytes of each language.
public IObservable GetAllLanguages(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
var endpoint = ApiUrls.RepositoryLanguages(owner, name);
return _connection
.GetAndFlattenAllPages>(endpoint)
.Select(t => new RepositoryLanguage(t.Item1, t.Item2));
}
///
/// Gets all languages for the specified repository.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// All languages used in the repository and the number of bytes of each language.
public IObservable GetAllLanguages(long repositoryId)
{
var endpoint = ApiUrls.RepositoryLanguages(repositoryId);
return _connection
.GetAndFlattenAllPages>(endpoint)
.Select(t => new RepositoryLanguage(t.Item1, t.Item2));
}
///
/// Gets all teams for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// All s associated with the repository
public IObservable GetAllTeams(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return GetAllTeams(owner, name, ApiOptions.None);
}
///
/// Gets all teams for the specified repository.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// All s associated with the repository
public IObservable GetAllTeams(long repositoryId)
{
return GetAllTeams(repositoryId, ApiOptions.None);
}
///
/// Gets all teams for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
/// All s associated with the repository
public IObservable GetAllTeams(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryTeams(owner, name), options);
}
///
/// Gets all teams for the specified repository.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// Options for changing the API response
/// All s associated with the repository
public IObservable GetAllTeams(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryTeams(repositoryId), options);
}
///
/// Gets all tags for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// All of the repositories tags.
public IObservable GetAllTags(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return GetAllTags(owner, name, ApiOptions.None);
}
///
/// Gets all tags for the specified repository.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// All of the repositories tags.
public IObservable GetAllTags(long repositoryId)
{
return GetAllTags(repositoryId, ApiOptions.None);
}
///
/// Gets all tags for the specified repository.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
/// All of the repositories tags.
public IObservable GetAllTags(string owner, string name, ApiOptions options)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryTags(owner, name), options);
}
///
/// Gets all tags for the specified repository.
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// Options for changing the API response
/// All of the repositories tags.
public IObservable GetAllTags(long repositoryId, ApiOptions options)
{
Ensure.ArgumentNotNull(options, nameof(options));
return _connection.GetAndFlattenAllPages(ApiUrls.RepositoryTags(repositoryId), options);
}
///
/// Updates the specified repository with the values given in
///
/// The owner of the repository
/// The name of the repository
/// New values to update the repository with
/// The updated
public IObservable Edit(string owner, string name, RepositoryUpdate update)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
Ensure.ArgumentNotNull(update, nameof(update));
return _client.Edit(owner, name, update).ToObservable();
}
///
/// Get the contents of a repository's license
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// Returns the contents of the repository's license file, if one is detected.
public IObservable GetLicenseContents(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return _client.GetLicenseContents(owner, name).ToObservable();
}
///
/// Get the contents of a repository's license
///
///
/// See the API documentation for more details
///
/// The Id of the repository
/// Returns the contents of the repository's license file, if one is detected.
public IObservable GetLicenseContents(long repositoryId)
{
return _client.GetLicenseContents(repositoryId).ToObservable();
}
///
/// Gets the list of errors in the codeowners file
///
/// The owner of the repository
/// The name of the repository
/// Returns the list of errors in the codeowners files
[ManualRoute("GET", "/repos/{owner}/{repo}/codeowners/errors")]
public IObservable GetAllCodeOwnersErrors(string owner, string name)
{
Ensure.ArgumentNotNullOrEmptyString(owner, nameof(owner));
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
return _client.GetAllCodeOwnersErrors(owner, name).ToObservable();
}
///
/// Gets the list of errors in the codeowners file
///
/// The Id of the repository
/// Returns the list of errors in the codeowners files
[ManualRoute("GET", "/repositories/{id}/codeowners/errors")]
public IObservable GetAllCodeOwnersErrors(long repositoryId)
{
return _client.GetAllCodeOwnersErrors(repositoryId).ToObservable();
}
///
/// Updates the specified repository with the values given in
///
/// The Id of the repository
/// New values to update the repository with
/// The updated
public IObservable Edit(long repositoryId, RepositoryUpdate update)
{
Ensure.ArgumentNotNull(update, nameof(update));
return _client.Edit(repositoryId, update).ToObservable();
}
///
/// Compare two references in a repository
///
/// The owner of the repository
/// The name of the repository
/// The reference to use as the base commit
/// The reference to use as the head commit
///
public IObservable Compare(string owner, string name, string @base, string head)
{
return _client.Commit.Compare(owner, name, @base, head).ToObservable();
}
///
/// A client for GitHub's Repository Actions API.
///
///
/// See the Actions API documentation for more details
///
public IObservableRepositoryActionsClient Actions { get; private set; }
///
/// A client for GitHub's Repository Autolinks API
///
///
/// See the API documentation for more information.
///
public IObservableAutolinksClient Autolinks { get; private set; }
///
/// A client for GitHub's Repository Branches API.
///
///
/// See the Branches API documentation for more details
///
[SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")]
public IObservableRepositoryBranchesClient Branch { get; private set; }
///
/// A client for GitHub's Repo Collaborators.
///
///
/// See the Collaborators API documentation for more details
///
public IObservableRepoCollaboratorsClient Collaborator { get; private set; }
///
/// Client for GitHub's Repository Commits API
///
///
/// See the Commits API documentation for more details
///
public IObservableRepositoryCommitsClient Commit { get; private set; }
///
/// Access GitHub's Releases API.
///
///
/// Refer to the API documentation for more information: https://developer.github.com/v3/repos/releases/
///
public IObservableReleasesClient Release { get; private set; }
///
/// Client for managing pull requests.
///
///
/// See the Pull Requests API documentation for more details
///
public IObservablePullRequestsClient PullRequest { get; private set; }
///
/// Client for managing deploy keys
///
///
/// See the Repository Deploy Keys API documentation for more information.
///
public IObservableRepositoryDeployKeysClient DeployKeys { get; private set; }
///
/// A client for GitHub's Repository Pages API.
///
///
/// See the Repository Pages API documentation for more information.
///
public IObservableRepositoryPagesClient Page { get; private set; }
///
/// A client for GitHub's Repository Invitations API.
///
///
/// See the Repository Invitations API documentation for more information.
///
public IObservableRepositoryInvitationsClient Invitation { get; private set; }
///
/// Access GitHub's Repository Traffic API
///
///
/// Refer to the API documentation for more information: https://developer.github.com/v3/repos/traffic/
///
public IObservableRepositoryTrafficClient Traffic { get; private set; }
///
/// Access GitHub's Repository Projects API
///
///
/// Refer to the API documentation for more information: https://developer.github.com/v3/repos/projects/
///
public IObservableProjectsClient Project { get; private set; }
///
/// Gets all topics for the specified owner and repository name.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// Options for changing the API response
/// All topics associated with the repository.
public IObservable GetAllTopics(string owner, string name, ApiOptions options)
{
return _client.GetAllTopics(owner, name, options).ToObservable();
}
///
/// Gets all topics for the specified owner and repository name.
///
///
/// See the API documentation for more details
///
/// The owner of the repository
/// The name of the repository
/// All topics associated with the repository.
public IObservable GetAllTopics(string owner, string name)
{
return GetAllTopics(owner, name, ApiOptions.None);
}
///
/// Gets all topics for the specified repository ID.
///
///
/// See the API documentation for more details
///
/// The ID of the repository
/// Options for changing the API response
/// All topics associated with the repository.
public IObservable GetAllTopics(long repositoryId, ApiOptions options)
{
return _client.GetAllTopics(repositoryId, options).ToObservable();
}
///
/// Gets all topics for the specified repository ID.
///
///
/// See the API documentation for more details
///
/// The ID of the repository
/// All topics associated with the repository.
public IObservable GetAllTopics(long repositoryId)
{
return GetAllTopics(repositoryId, ApiOptions.None);
}
///
/// Replaces all topics for the specified repository.
///
///
/// See the API documentation for more details
///
/// This is a replacement operation; it is not additive. To clear repository topics, for example, you could specify an empty list of topics here.
///
/// The ID of the repository
/// The list of topics to associate with the repository
/// All topics now associated with the repository.
public IObservable ReplaceAllTopics(long repositoryId, RepositoryTopics topics)
{
return _client.ReplaceAllTopics(repositoryId, topics).ToObservable();
}
///
/// Replaces all topics for the specified repository.
///
///
/// See the API documentation for more details
///
/// This is a replacement operation; it is not additive. To clear repository topics, for example, you could specify an empty list of topics here.
///
/// The owner of the repository
/// The name of the repository
/// The list of topics to associate with the repository
/// All topics now associated with the repository.
public IObservable ReplaceAllTopics(string owner, string name, RepositoryTopics topics)
{
return _client.ReplaceAllTopics(owner, name, topics).ToObservable();
}
}
}