diff --git a/Octokit.Reactive/Clients/IObservablePackagesClient.cs b/Octokit.Reactive/Clients/IObservablePackagesClient.cs index 6814cad8..717ae04d 100644 --- a/Octokit.Reactive/Clients/IObservablePackagesClient.cs +++ b/Octokit.Reactive/Clients/IObservablePackagesClient.cs @@ -7,6 +7,27 @@ namespace Octokit.Reactive { IObservablePackageVersionsClient PackageVersions { get; } + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + IObservable GetAllForOrg(string org, PackageType packageType); + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Options for changing the API response + IObservable GetAllForOrg(string org, PackageType packageType, ApiOptions options); + /// /// List all packages for an organisations, readable by the current user /// @@ -16,7 +37,19 @@ namespace Octokit.Reactive /// Required: Organisation Name /// Required: The type of package /// Optional: The visibility of the package - IObservable GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility = null); + IObservable GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility); + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + IObservable GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options); /// /// Get a specific package for an Organization. @@ -51,6 +84,25 @@ namespace Octokit.Reactive /// Required: The name of the package IObservable RestoreForOrg(string org, PackageType packageType, string packageName); + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + IObservable GetAllForActiveUser(PackageType packageType); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Options for changing the API response + IObservable GetAllForActiveUser(PackageType packageType, ApiOptions options); + /// /// Lists packages owned by the authenticated user within the user's namespace /// @@ -59,7 +111,18 @@ namespace Octokit.Reactive /// /// Required: The type of package /// Optional: The visibility of the package - IObservable GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility = null); + IObservable GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + IObservable GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options); /// /// Gets a specific package for a package owned by the authenticated user. @@ -91,6 +154,27 @@ namespace Octokit.Reactive /// Required: The name of the package IObservable RestoreForActiveUser(PackageType packageType, string packageName); + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + IObservable GetAllForUser(string username, PackageType packageType); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Options for changing the API response + IObservable GetAllForUser(string username, PackageType packageType, ApiOptions options); + /// /// Lists packages owned by the authenticated user within the user's namespace /// @@ -100,7 +184,19 @@ namespace Octokit.Reactive /// Required: Username /// Required: The type of package /// Optional: The visibility of the package - IObservable GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility = null); + IObservable GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + IObservable GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options); /// /// Gets a specific package metadata for a public package owned by a user. diff --git a/Octokit.Reactive/Clients/ObservablePackagesClient.cs b/Octokit.Reactive/Clients/ObservablePackagesClient.cs index 662efb55..a1e0981c 100644 --- a/Octokit.Reactive/Clients/ObservablePackagesClient.cs +++ b/Octokit.Reactive/Clients/ObservablePackagesClient.cs @@ -28,16 +28,69 @@ namespace Octokit.Reactive /// /// Required: Organisation Name /// Required: The type of package - /// Optional: The visibility of the package - public IObservable GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility = null) + public IObservable GetAllForOrg(string org, PackageType packageType) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNull(packageType, nameof(packageType)); + return GetAllForOrg(org, packageType, (PackageVisibility?)null); + } + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Options for changing the API response + public IObservable GetAllForOrg(string org, PackageType packageType, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAllForOrg(org, packageType, null, options); + } + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Optional: The visibility of the package + public IObservable GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility) + { + Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForOrg(org, packageType, packageVisibility, ApiOptions.None); + } + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + public IObservable GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + var route = ApiUrls.PackagesOrg(org); var parameters = ParameterBuilder.AddParameter("package_type", packageType).AddOptionalParameter("visibility", packageVisibility); - return _connection.GetAndFlattenAllPages(route, parameters); + return _connection.GetAndFlattenAllPages(route, parameters, options); } /// @@ -101,13 +154,62 @@ namespace Octokit.Reactive /// See the API documentation for more details /// /// Required: The type of package - /// Optional: The visibility of the package - public IObservable GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility = null) + public IObservable GetAllForActiveUser(PackageType packageType) { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForActiveUser(packageType, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Options for changing the API response + public IObservable GetAllForActiveUser(PackageType packageType, ApiOptions options) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAllForActiveUser(packageType, null, options); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Optional: The visibility of the package + public IObservable GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForActiveUser(packageType, packageVisibility, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + public IObservable GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + var route = ApiUrls.PackagesActiveUser(); var parameters = ParameterBuilder.AddParameter("package_type", packageType).AddOptionalParameter("visibility", packageVisibility); - return _connection.GetAndFlattenAllPages(route, parameters); + return _connection.GetAndFlattenAllPages(route, parameters, options); } /// @@ -166,16 +268,69 @@ namespace Octokit.Reactive /// /// Required: Username /// Required: The type of package - /// Optional: The visibility of the package - public IObservable GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility = null) + public IObservable GetAllForUser(string username, PackageType packageType) { Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); Ensure.ArgumentNotNull(packageType, nameof(packageType)); + return GetAllForUser(username, packageType, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Options for changing the API response + public IObservable GetAllForUser(string username, PackageType packageType, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAllForUser(username, packageType, null, options); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Optional: The visibility of the package + public IObservable GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility) + { + Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForUser(username, packageType, packageVisibility, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + public IObservable GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + var route = ApiUrls.PackagesUser(username); var parameters = ParameterBuilder.AddParameter("package_type", packageType).AddOptionalParameter("visibility", packageVisibility); - return _connection.GetAndFlattenAllPages(route, parameters); + return _connection.GetAndFlattenAllPages(route, parameters, options); } /// diff --git a/Octokit.Tests/Clients/PackagesClientTests.cs b/Octokit.Tests/Clients/PackagesClientTests.cs index 2da109bf..7832ac6b 100644 --- a/Octokit.Tests/Clients/PackagesClientTests.cs +++ b/Octokit.Tests/Clients/PackagesClientTests.cs @@ -27,7 +27,7 @@ namespace Octokit.Tests.Clients await client.GetAllForOrg("fake", PackageType.RubyGems); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type")), Args.ApiOptions); } [Fact] @@ -39,7 +39,7 @@ namespace Octokit.Tests.Clients await client.GetAllForOrg("fake", PackageType.RubyGems, PackageVisibility.Public); var calls = connection.ReceivedCalls(); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type") && d.ContainsKey("visibility"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "orgs/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type") && d.ContainsKey("visibility")), Args.ApiOptions); } [Fact] @@ -141,7 +141,7 @@ namespace Octokit.Tests.Clients await client.GetAllForActiveUser(PackageType.RubyGems); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "user/packages"), Arg.Is>(d => d.ContainsKey("package_type"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "user/packages"), Arg.Is>(d => d.ContainsKey("package_type")), Args.ApiOptions); } [Fact] @@ -153,7 +153,7 @@ namespace Octokit.Tests.Clients await client.GetAllForActiveUser(PackageType.RubyGems, PackageVisibility.Public); var calls = connection.ReceivedCalls(); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "user/packages"), Arg.Is>(d => d.ContainsKey("package_type") && d.ContainsKey("visibility"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "user/packages"), Arg.Is>(d => d.ContainsKey("package_type") && d.ContainsKey("visibility")), Args.ApiOptions); } } @@ -236,7 +236,7 @@ namespace Octokit.Tests.Clients await client.GetAllForUser("fake", PackageType.RubyGems); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type")), Args.ApiOptions); } [Fact] @@ -248,7 +248,7 @@ namespace Octokit.Tests.Clients await client.GetAllForUser("fake", PackageType.RubyGems, PackageVisibility.Public); var calls = connection.ReceivedCalls(); - connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type") && d.ContainsKey("visibility"))); + connection.Received().GetAll(Arg.Is(u => u.ToString() == "users/fake/packages"), Arg.Is>(d => d.ContainsKey("package_type") && d.ContainsKey("visibility")), Args.ApiOptions); } [Fact] diff --git a/Octokit/Clients/IPackagesClient.cs b/Octokit/Clients/IPackagesClient.cs index 25dac896..5c657b87 100644 --- a/Octokit/Clients/IPackagesClient.cs +++ b/Octokit/Clients/IPackagesClient.cs @@ -7,6 +7,27 @@ namespace Octokit { IPackageVersionsClient PackageVersions { get; } + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + Task> GetAllForOrg(string org, PackageType packageType); + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Options for changing the API response + Task> GetAllForOrg(string org, PackageType packageType, ApiOptions options); + /// /// List all packages for an organisations, readable by the current user /// @@ -16,8 +37,20 @@ namespace Octokit /// Required: Organisation Name /// Required: The type of package /// Optional: The visibility of the package - [ExcludeFromPaginationApiOptionsConventionTest("No api options available according to the documentation")] - Task> GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility = null); + Task> GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility); + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// The default page size on GitHub.com is 30. + /// + /// Required: Organisation Name + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + Task> GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options); /// /// Get a specific package for an Organization. @@ -52,6 +85,25 @@ namespace Octokit /// Required: The name of the package Task RestoreForOrg(string org, PackageType packageType, string packageName); + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + Task> GetAllForActiveUser(PackageType packageType); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Options for changing the API response + Task> GetAllForActiveUser(PackageType packageType, ApiOptions options); + /// /// Lists packages owned by the authenticated user within the user's namespace /// @@ -60,8 +112,19 @@ namespace Octokit /// /// Required: The type of package /// Optional: The visibility of the package - [ExcludeFromPaginationApiOptionsConventionTest("No api options available according to the documentation")] - Task> GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility = null); + Task> GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// The default page size on GitHub.com is 30. + /// + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + Task> GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options); /// /// Gets a specific package for a package owned by the authenticated user. @@ -93,6 +156,27 @@ namespace Octokit /// Required: The name of the package Task RestoreForActiveUser(PackageType packageType, string packageName); + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + Task> GetAllForUser(string username, PackageType packageType); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Options for changing the API response + Task> GetAllForUser(string username, PackageType packageType, ApiOptions options); + /// /// Lists packages owned by the authenticated user within the user's namespace /// @@ -102,8 +186,20 @@ namespace Octokit /// Required: Username /// Required: The type of package /// Optional: The visibility of the package - [ExcludeFromPaginationApiOptionsConventionTest("No api options available according to the documentation")] - Task> GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility = null); + Task> GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility); + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// The default page size on GitHub.com is 30. + /// + /// Required: Username + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + Task> GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options); /// /// Gets a specific package metadata for a public package owned by a user. diff --git a/Octokit/Clients/PackagesClient.cs b/Octokit/Clients/PackagesClient.cs index 91a69833..9ace9828 100644 --- a/Octokit/Clients/PackagesClient.cs +++ b/Octokit/Clients/PackagesClient.cs @@ -27,16 +27,73 @@ namespace Octokit /// /// Required: Organisation Name /// Required: The type of package - /// Optional: The visibility of the package [ManualRoute("GET", "/orgs/{org}/packages")] - public Task> GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility = null) + public Task> GetAllForOrg(string org, PackageType packageType) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForOrg(org, packageType, ApiOptions.None); + } + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Options for changing the API response + [ManualRoute("GET", "/orgs/{org}/packages")] + public Task> GetAllForOrg(string org, PackageType packageType, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAllForOrg(org, packageType, null, options); + } + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Optional: The visibility of the package + [ManualRoute("GET", "/orgs/{org}/packages")] + public Task> GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility) + { + Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForOrg(org, packageType, packageVisibility, ApiOptions.None); + } + + /// + /// List all packages for an organisations, readable by the current user + /// + /// + /// See the API documentation for more details + /// + /// Required: Organisation Name + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + [ManualRoute("GET", "/orgs/{org}/packages")] + public Task> GetAllForOrg(string org, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); var route = ApiUrls.PackagesOrg(org); var parameters = ParameterBuilder.AddParameter("package_type", packageType).AddOptionalParameter("visibility", packageVisibility); - return ApiConnection.GetAll(route, parameters); + return ApiConnection.GetAll(route, parameters, options); } /// @@ -73,6 +130,7 @@ namespace Octokit { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNullOrEmptyString(packageName, nameof(packageName)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); var route = ApiUrls.PackageOrg(org, packageType, packageName); @@ -101,6 +159,38 @@ namespace Octokit #endregion #region Active User + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + [ManualRoute("GET", "/user/packages")] + public Task> GetAllForActiveUser(PackageType packageType) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForActiveUser(packageType, (PackageVisibility?)null); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Options for changing the API response + [ManualRoute("GET", "/user/packages")] + public Task> GetAllForActiveUser(PackageType packageType, ApiOptions options) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAllForActiveUser(packageType, null, options); + } + /// /// Lists packages owned by the authenticated user within the user's namespace /// @@ -110,12 +200,32 @@ namespace Octokit /// Required: The type of package /// Optional: The visibility of the package [ManualRoute("GET", "/user/packages")] - public Task> GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility = null) + public Task> GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility) { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForActiveUser(packageType, packageVisibility, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + [ManualRoute("GET", "/user/packages")] + public Task> GetAllForActiveUser(PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + var route = ApiUrls.PackagesActiveUser(); var parameters = ParameterBuilder.AddParameter("package_type", packageType).AddOptionalParameter("visibility", packageVisibility); - return ApiConnection.GetAll(route, parameters); + return ApiConnection.GetAll(route, parameters, options); } /// @@ -182,16 +292,72 @@ namespace Octokit /// /// Required: Username /// Required: The type of package - /// Optional: The visibility of the package [ManualRoute("GET", "/users/{username}/packages")] - public Task> GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility = null) + public Task> GetAllForUser(string username, PackageType packageType) { Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForUser(username, packageType, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Options for changing the API response + [ManualRoute("GET", "/users/{username}/packages")] + public Task> GetAllForUser(string username, PackageType packageType, ApiOptions options) + { + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); + + return GetAllForUser(username, packageType, null, options); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Optional: The visibility of the package + [ManualRoute("GET", "/users/{username}/packages")] + public Task> GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility) + { + Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + + return GetAllForUser(username, packageType, packageVisibility, ApiOptions.None); + } + + /// + /// Lists packages owned by the authenticated user within the user's namespace + /// + /// + /// See the API documentation for more details + /// + /// Required: Username + /// Required: The type of package + /// Optional: The visibility of the package + /// Options for changing the API response + [ManualRoute("GET", "/users/{username}/packages")] + public Task> GetAllForUser(string username, PackageType packageType, PackageVisibility? packageVisibility, ApiOptions options) + { + Ensure.ArgumentNotNullOrEmptyString(username, nameof(username)); + Ensure.ArgumentNotNull(packageType, nameof(packageType)); + Ensure.ArgumentNotNull(options, nameof(options)); var route = ApiUrls.PackagesUser(username); var parameters = ParameterBuilder.AddParameter("package_type", packageType).AddOptionalParameter("visibility", packageVisibility); - return ApiConnection.GetAll(route, parameters); + return ApiConnection.GetAll(route, parameters, options); } ///