From 19d00f60a06e9b323e7f4c50b2ab64ef8a1b24d2 Mon Sep 17 00:00:00 2001 From: Chris Heckathorne Date: Fri, 8 May 2015 15:16:09 -0400 Subject: [PATCH] added getcontents to observable client --- .../IObservableRepositoryContentsClient.cs | 17 +++++++++++++ .../ObservableRepositoryContentsClient.cs | 25 +++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs index 4b56ed1b..ed40d26e 100644 --- a/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs +++ b/Octokit.Reactive/Clients/IObservableRepositoryContentsClient.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Reactive; namespace Octokit.Reactive @@ -77,6 +78,22 @@ namespace Octokit.Reactive /// IObservable GetAllContents(string owner, string name, string path); + /// + /// Returns the contents of a file or directory in a repository. + /// + /// + /// If given a path to a single file, this method returns a collection containing only that file. + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// The content path + /// The name of the commit/branch/tag. Default: the repository’s default branch (usually master) + /// + /// A collection of representing the content at the specified path + /// + IObservable> GetContents(string owner, string name, string path, string reference); + /// /// Creates a commit that creates a new file in a repository. /// diff --git a/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs b/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs index ca2889e4..7001cd4a 100644 --- a/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs +++ b/Octokit.Reactive/Clients/ObservableRepositoryContentsClient.cs @@ -1,6 +1,7 @@ using System; using System.Reactive.Threading.Tasks; using Octokit.Reactive.Internal; +using System.Collections.Generic; namespace Octokit.Reactive { @@ -123,6 +124,30 @@ namespace Octokit.Reactive .GetAndFlattenAllPages(ApiUrls.RepositoryContent(owner, name, path)); } + /// + /// Returns the contents of a file or directory in a repository. + /// + /// + /// If given a path to a single file, this method returns a collection containing only that file. + /// See the API documentation for more information. + /// + /// The owner of the repository + /// The name of the repository + /// The content path + /// The name of the commit/branch/tag. Default: the repository’s default branch (usually master) + /// + /// A collection of representing the content at the specified path + /// + public IObservable> GetContents(string owner, string name, string path, string reference) + { + Ensure.ArgumentNotNullOrEmptyString(owner, "owner"); + Ensure.ArgumentNotNullOrEmptyString(name, "name"); + Ensure.ArgumentNotNullOrEmptyString(path, "path"); + Ensure.ArgumentNotNullOrEmptyString(reference, "reference"); + + return _client.Repository.Content.GetContents(owner, name, path, reference).ToObservable(); + } + /// /// Creates a commit that creates a new file in a repository. ///