-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add custom properties model and clients * observable * observable tests * add search * error CS8370: 'target-typed object creation' * Error CS8370: 'target-typed object creation' * add patch with body that return status code * fixes for failed ConventionTests * working UnitTests * (de)serialization and model tests * Update Repository.cs
- Loading branch information
1 parent
7d54cb0
commit 9a3177e
Showing
53 changed files
with
3,121 additions
and
1 deletion.
There are no files selected for viewing
72 changes: 72 additions & 0 deletions
72
Octokit.Reactive/Clients/IObservableOrganizationCustomPropertiesClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
using System; | ||
using System.Reactive; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Organization Custom Properties API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See <a href="https://docs.github.com/rest/orgs/custom-properties">Custom Properties API documentation</a> for more information. | ||
/// </remarks> | ||
public interface IObservableOrganizationCustomPropertiesClient | ||
{ | ||
/// <summary> | ||
/// Get all custom properties for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
IObservable<OrganizationCustomProperty> GetAll(string org); | ||
|
||
/// <summary> | ||
/// Get a single custom property by name. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyName">The name of the custom property</param> | ||
IObservable<OrganizationCustomProperty> Get(string org, string propertyName); | ||
|
||
/// <summary> | ||
/// Create new or update existing custom properties for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="properties">The custom properties to create or update</param> | ||
IObservable<OrganizationCustomProperty> CreateOrUpdate(string org, UpsertOrganizationCustomProperties properties); | ||
|
||
/// <summary> | ||
/// Create new or update existing custom property for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyName">The name of the custom property</param> | ||
/// <param name="property">The custom property to create or update</param> | ||
IObservable<OrganizationCustomProperty> CreateOrUpdate(string org, string propertyName, UpsertOrganizationCustomProperty property); | ||
|
||
/// <summary> | ||
/// Removes a custom property that is defined for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyName">The name of the custom property</param> | ||
IObservable<Unit> Delete(string org, string propertyName); | ||
|
||
/// <summary> | ||
/// A client for GitHub's Organization Custom Property Values API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties">Custom Properties API documentation</a> for more information. | ||
/// </remarks> | ||
IObservableOrganizationCustomPropertyValuesClient Values { get; } | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
Octokit.Reactive/Clients/IObservableOrganizationCustomPropertyValuesClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
using System; | ||
using System.Reactive; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Organization Custom Property Values API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See <a href="https://docs.github.com/rest/orgs/custom-properties">Custom Properties API documentation</a> for more information. | ||
/// </remarks> | ||
public interface IObservableOrganizationCustomPropertyValuesClient | ||
{ | ||
/// <summary> | ||
/// Get all custom property values for repositories an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
IObservable<OrganizationCustomPropertyValues> GetAll(string org); | ||
|
||
/// <summary> | ||
/// Get all custom property values for repositories an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="options">Options for changing the API response</param> | ||
IObservable<OrganizationCustomPropertyValues> GetAll(string org, ApiOptions options); | ||
|
||
/// <summary> | ||
/// Get all custom property values for repositories an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#list-custom-property-values-for-organization-repositories">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="repositoryQuery">Finds repositories in the organization with a query containing one or more search keywords and qualifiers.</param> | ||
IObservable<OrganizationCustomPropertyValues> GetAll(string org, OrganizationCustomPropertyValuesRequest repositoryQuery); | ||
|
||
/// <summary> | ||
/// Create new or update existing custom property values for repositories an organization. | ||
/// Using a value of null for a custom property will remove or 'unset' the property value from the repository. | ||
/// A maximum of 30 repositories can be updated in a single request. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-property-values-for-organization-repositories">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyValues">The custom property values to create or update</param> | ||
IObservable<Unit> CreateOrUpdate(string org, UpsertOrganizationCustomPropertyValues propertyValues); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Octokit.Reactive/Clients/IObservableRepositoryCustomPropertiesClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System; | ||
using System.Reactive; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
/// <summary> | ||
/// A client for GitHub's Repository Custom Property Values API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/repos/custom-properties">Custom Properties API documentation</a> for more information. | ||
/// </remarks> | ||
public interface IObservableRepositoryCustomPropertiesClient | ||
{ | ||
/// <summary> | ||
/// Get all custom property values for a repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/repos/custom-properties#get-all-custom-property-values-for-a-repository">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="owner">The owner of the repository.</param> | ||
/// <param name="repoName">The name of the repository.</param> | ||
IObservable<CustomPropertyValue> GetAll(string owner, string repoName); | ||
|
||
/// <summary> | ||
/// Create new or update existing custom property values for a repository. Using a value of null for a custom property will remove or 'unset' the property value from the repository. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/repos/custom-properties#create-or-update-custom-property-values-for-a-repository">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="owner">The owner of the repository</param> | ||
/// <param name="repoName">The name of the repository</param> | ||
/// <param name="propertyValues">The custom property values to create or update</param> | ||
IObservable<Unit> CreateOrUpdate(string owner, string repoName, UpsertRepositoryCustomPropertyValues propertyValues); | ||
} | ||
} |
113 changes: 113 additions & 0 deletions
113
Octokit.Reactive/Clients/ObservableOrganizationCustomPropertiesClient.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
using System; | ||
using System.Reactive; | ||
using System.Reactive.Linq; | ||
using System.Reactive.Threading.Tasks; | ||
|
||
namespace Octokit.Reactive | ||
{ | ||
public class ObservableOrganizationCustomPropertiesClient : IObservableOrganizationCustomPropertiesClient | ||
{ | ||
readonly IOrganizationCustomPropertiesClient _client; | ||
readonly IConnection _connection; | ||
|
||
public ObservableOrganizationCustomPropertiesClient(IGitHubClient client) | ||
{ | ||
Ensure.ArgumentNotNull(client, nameof(client)); | ||
|
||
Values = new ObservableOrganizationCustomPropertyValuesClient(client); | ||
|
||
_client = client.Organization.CustomProperty; | ||
_connection = client.Connection; | ||
} | ||
|
||
/// <summary> | ||
/// Get all custom properties for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#get-all-custom-properties-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
public IObservable<OrganizationCustomProperty> GetAll(string org) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); | ||
|
||
return _client.GetAll(org).ToObservable().SelectMany(p => p); | ||
} | ||
|
||
/// <summary> | ||
/// Get a single custom property by name. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#get-a-custom-property-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyName">The name of the custom property</param> | ||
public IObservable<OrganizationCustomProperty> Get(string org, string propertyName) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); | ||
Ensure.ArgumentNotNullOrEmptyString(propertyName, nameof(propertyName)); | ||
|
||
return _client.Get(org, propertyName).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// Create new or update existing custom properties for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#create-or-update-custom-properties-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="properties">The custom properties to create or update</param> | ||
public IObservable<OrganizationCustomProperty> CreateOrUpdate(string org, UpsertOrganizationCustomProperties properties) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); | ||
Ensure.ArgumentNotNull(properties, nameof(properties)); | ||
Ensure.ArgumentNotNullOrEmptyEnumerable(properties.Properties, nameof(properties.Properties)); | ||
|
||
return _client.CreateOrUpdate(org, properties).ToObservable().SelectMany(p => p); | ||
} | ||
|
||
/// <summary> | ||
/// Create new or update existing custom property for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#create-or-update-a-custom-property-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyName">The name of the custom property</param> | ||
/// <param name="property">The custom property to create or update</param> | ||
public IObservable<OrganizationCustomProperty> CreateOrUpdate(string org, string propertyName, UpsertOrganizationCustomProperty property) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); | ||
Ensure.ArgumentNotNullOrEmptyString(propertyName, nameof(propertyName)); | ||
Ensure.ArgumentNotNull(property, nameof(property)); | ||
Ensure.ArgumentNotNullOrDefault(property.ValueType, nameof(property.ValueType)); | ||
|
||
return _client.CreateOrUpdate(org, propertyName, property).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// Removes a custom property that is defined for an organization. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties#remove-a-custom-property-for-an-organization">API documentation</a> for more information. | ||
/// </remarks> | ||
/// <param name="org">The name of the organization</param> | ||
/// <param name="propertyName">The name of the custom property</param> | ||
public IObservable<Unit> Delete(string org, string propertyName) | ||
{ | ||
Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); | ||
Ensure.ArgumentNotNullOrEmptyString(propertyName, nameof(propertyName)); | ||
|
||
return _client.Delete(org, propertyName).ToObservable(); | ||
} | ||
|
||
/// <summary> | ||
/// A client for GitHub's Organization Custom Property Values API. | ||
/// </summary> | ||
/// <remarks> | ||
/// See the <a href="https://docs.github.com/rest/orgs/custom-properties">Custom Properties API documentation</a> for more information. | ||
/// </remarks> | ||
public IObservableOrganizationCustomPropertyValuesClient Values { get; private set; } | ||
} | ||
} |
Oops, something went wrong.