/// <summary> /// Edits an existing <see cref="PreReceiveEnvironment"/>. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/enterprise-admin/pre_receive_environments/#edit-a-pre-receive-environment">API documentation</a> for more information. /// </remarks> /// <param name="environmentId">The id of the pre-receive environment</param> /// <param name="updatePreReceiveEnvironment">A description of the pre-receive environment to edit</param> /// <exception cref="NotFoundException">Thrown when the specified <paramref name="environmentId"/> does not exist.</exception> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public Task <PreReceiveEnvironment> Edit(long environmentId, UpdatePreReceiveEnvironment updatePreReceiveEnvironment) { Ensure.ArgumentNotNull(updatePreReceiveEnvironment, nameof(updatePreReceiveEnvironment)); var endpoint = ApiUrls.AdminPreReceiveEnvironments(environmentId); return(ApiConnection.Patch <PreReceiveEnvironment>(endpoint, updatePreReceiveEnvironment, AcceptHeaders.PreReceiveEnvironmentsPreview)); }
/// <summary> /// Creates a new <see cref="PreReceiveEnvironment"/>. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/enterprise-admin/pre_receive_environments/#create-a-pre-receive-environment">API documentation</a> for more information. /// </remarks> /// <param name="newPreReceiveEnvironment">A description of the pre-receive environment to create</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public Task <PreReceiveEnvironment> Create(NewPreReceiveEnvironment newPreReceiveEnvironment) { Ensure.ArgumentNotNull(newPreReceiveEnvironment, nameof(newPreReceiveEnvironment)); var endpoint = ApiUrls.AdminPreReceiveEnvironments(); return(ApiConnection.Post <PreReceiveEnvironment>(endpoint, newPreReceiveEnvironment, AcceptHeaders.PreReceiveEnvironmentsPreview)); }
/// <summary> /// Gets all <see cref="PreReceiveEnvironment"/>s. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/enterprise-admin/pre_receive_environments/#list-pre-receive-environments">API documentation</a> for more information. /// </remarks> /// <param name="options">Options for changing the API response</param> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public Task <IReadOnlyList <PreReceiveEnvironment> > GetAll(ApiOptions options) { var endpoint = ApiUrls.AdminPreReceiveEnvironments(); return(ApiConnection.GetAll <PreReceiveEnvironment>(endpoint, null, AcceptHeaders.PreReceiveEnvironmentsPreview, options)); }
/// <summary> /// Gets a single <see cref="PreReceiveEnvironment"/>. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/enterprise-admin/pre_receive_environments/#get-a-single-pre-receive-environment">API documentation</a> for more information. /// </remarks> /// <param name="environmentId">The id of the pre-receive environment</param> /// <exception cref="NotFoundException">Thrown when the specified <paramref name="environmentId"/> does not exist.</exception> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public Task <PreReceiveEnvironment> Get(long environmentId) { var endpoint = ApiUrls.AdminPreReceiveEnvironments(environmentId); return(ApiConnection.Get <PreReceiveEnvironment>(endpoint, null, AcceptHeaders.PreReceiveEnvironmentsPreview)); }
/// <summary> /// Deletes an existing <see cref="PreReceiveEnvironment"/>. /// </summary> /// <remarks> /// See the <a href="https://developer.github.com/v3/enterprise-admin/pre_receive_environments/#delete-a-pre-receive-environment">API documentation</a> for more information. /// </remarks> /// <param name="environmentId">The id of the pre-receive environment</param> /// <exception cref="NotFoundException">Thrown when the specified <paramref name="environmentId"/> does not exist.</exception> /// <exception cref="ApiException">Thrown when a general API error occurs.</exception> public Task Delete(long environmentId) { var endpoint = ApiUrls.AdminPreReceiveEnvironments(environmentId); return(ApiConnection.Delete(endpoint, new object(), AcceptHeaders.PreReceiveEnvironmentsPreview)); }