using System.Collections.Generic; using System.Threading.Tasks; namespace Octokit { public class OrganizationCustomPropertyValuesClient : ApiClient, IOrganizationCustomPropertyValuesClient { /// /// Initializes a new GitHub Organization Custom Property Values API client. /// /// An API connection. public OrganizationCustomPropertyValuesClient(IApiConnection apiConnection) : base(apiConnection) { } /// /// Get all custom property values for repositories an organization. /// /// /// See the API documentation for more information. /// /// The name of the organization /// Thrown when a general API error occurs. [ManualRoute("GET", "orgs/{org}/properties/values")] public Task> GetAll(string org) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); return GetAll(org, new OrganizationCustomPropertyValuesRequest()); } /// /// Get all custom property values for repositories an organization. /// /// /// See the API documentation for more information. /// /// The name of the organization /// Options for changing the API response /// Thrown when a general API error occurs. [ManualRoute("GET", "orgs/{org}/properties/values")] public Task> GetAll(string org, ApiOptions options) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNull(options, nameof(options)); var url = ApiUrls.OrganizationCustomPropertyValues(org); return ApiConnection.GetAll(url, options); } /// /// Get all custom property values for repositories an organization. /// /// /// See the API documentation for more information. /// /// The name of the organization /// Finds repositories in the organization with a query containing one or more search keywords and qualifiers. /// Thrown when a general API error occurs. [ManualRoute("GET", "orgs/{org}/properties/values")] public Task> GetAll(string org, OrganizationCustomPropertyValuesRequest repositoryQuery) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNull(repositoryQuery, nameof(repositoryQuery)); var url = ApiUrls.OrganizationCustomPropertyValues(org); return ApiConnection.GetAll(url, repositoryQuery.Parameters); } /// /// 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. /// /// /// See the API documentation for more information. /// /// The name of the organization /// The custom property values to create or update /// Thrown when a general API error occurs. [ManualRoute("PATCH", "orgs/{org}/properties/values")] public Task CreateOrUpdate(string org, UpsertOrganizationCustomPropertyValues propertyValues) { Ensure.ArgumentNotNullOrEmptyString(org, nameof(org)); Ensure.ArgumentNotNull(propertyValues, nameof(propertyValues)); Ensure.ArgumentNotNullOrEmptyEnumerable(propertyValues.Properties, nameof(propertyValues.Properties)); var url = ApiUrls.OrganizationCustomPropertyValues(org); return ApiConnection.Patch(url, propertyValues); } } }