
io.apicurio.registry.rest.client.groups.item.WithGroupItemRequestBuilder Maven / Gradle / Ivy
package io.apicurio.registry.rest.client.groups.item;
import com.microsoft.kiota.BaseRequestBuilder;
import com.microsoft.kiota.BaseRequestConfiguration;
import com.microsoft.kiota.HttpMethod;
import com.microsoft.kiota.RequestAdapter;
import com.microsoft.kiota.RequestInformation;
import com.microsoft.kiota.RequestOption;
import com.microsoft.kiota.serialization.Parsable;
import com.microsoft.kiota.serialization.ParsableFactory;
import io.apicurio.registry.rest.client.groups.item.artifacts.ArtifactsRequestBuilder;
import io.apicurio.registry.rest.client.groups.item.rules.RulesRequestBuilder;
import io.apicurio.registry.rest.client.models.EditableGroupMetaData;
import io.apicurio.registry.rest.client.models.GroupMetaData;
import io.apicurio.registry.rest.client.models.ProblemDetails;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* Collection to manage a single group in the registry.
*/
@jakarta.annotation.Generated("com.microsoft.kiota")
public class WithGroupItemRequestBuilder extends BaseRequestBuilder {
/**
* Manage the collection of artifacts within a single group in the registry.
* @return a {@link ArtifactsRequestBuilder}
*/
@jakarta.annotation.Nonnull
public ArtifactsRequestBuilder artifacts() {
return new ArtifactsRequestBuilder(pathParameters, requestAdapter);
}
/**
* Manage the rules for a group.
* @return a {@link RulesRequestBuilder}
*/
@jakarta.annotation.Nonnull
public RulesRequestBuilder rules() {
return new RulesRequestBuilder(pathParameters, requestAdapter);
}
/**
* Instantiates a new {@link WithGroupItemRequestBuilder} and sets the default values.
* @param pathParameters Path parameters for the request
* @param requestAdapter The request adapter to use to execute the requests.
*/
public WithGroupItemRequestBuilder(@jakarta.annotation.Nonnull final HashMap pathParameters, @jakarta.annotation.Nonnull final RequestAdapter requestAdapter) {
super(requestAdapter, "{+baseurl}/groups/{groupId}", pathParameters);
}
/**
* Instantiates a new {@link WithGroupItemRequestBuilder} and sets the default values.
* @param rawUrl The raw URL to use for the request builder.
* @param requestAdapter The request adapter to use to execute the requests.
*/
public WithGroupItemRequestBuilder(@jakarta.annotation.Nonnull final String rawUrl, @jakarta.annotation.Nonnull final RequestAdapter requestAdapter) {
super(requestAdapter, "{+baseurl}/groups/{groupId}", rawUrl);
}
/**
* Deletes a group by identifier. This operation also deletes all artifacts withinthe group, so should be used very carefully.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`)* The group does not exist (HTTP error `404`)
* @throws ProblemDetails When receiving a 404 status code
* @throws ProblemDetails When receiving a 405 status code
* @throws ProblemDetails When receiving a 500 status code
*/
public void delete() {
delete(null);
}
/**
* Deletes a group by identifier. This operation also deletes all artifacts withinthe group, so should be used very carefully.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`)* The group does not exist (HTTP error `404`)
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @throws ProblemDetails When receiving a 404 status code
* @throws ProblemDetails When receiving a 405 status code
* @throws ProblemDetails When receiving a 500 status code
*/
public void delete(@jakarta.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
final RequestInformation requestInfo = toDeleteRequestInformation(requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("404", ProblemDetails::createFromDiscriminatorValue);
errorMapping.put("405", ProblemDetails::createFromDiscriminatorValue);
errorMapping.put("500", ProblemDetails::createFromDiscriminatorValue);
this.requestAdapter.sendPrimitive(requestInfo, errorMapping, Void.class);
}
/**
* Returns a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @return a {@link GroupMetaData}
* @throws ProblemDetails When receiving a 404 status code
* @throws ProblemDetails When receiving a 500 status code
*/
@jakarta.annotation.Nullable
public GroupMetaData get() {
return get(null);
}
/**
* Returns a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a {@link GroupMetaData}
* @throws ProblemDetails When receiving a 404 status code
* @throws ProblemDetails When receiving a 500 status code
*/
@jakarta.annotation.Nullable
public GroupMetaData get(@jakarta.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
final RequestInformation requestInfo = toGetRequestInformation(requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("404", ProblemDetails::createFromDiscriminatorValue);
errorMapping.put("500", ProblemDetails::createFromDiscriminatorValue);
return this.requestAdapter.send(requestInfo, errorMapping, GroupMetaData::createFromDiscriminatorValue);
}
/**
* Updates the metadata of a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @param body The request body
* @throws ProblemDetails When receiving a 404 status code
* @throws ProblemDetails When receiving a 500 status code
*/
public void put(@jakarta.annotation.Nonnull final EditableGroupMetaData body) {
put(body, null);
}
/**
* Updates the metadata of a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @throws ProblemDetails When receiving a 404 status code
* @throws ProblemDetails When receiving a 500 status code
*/
public void put(@jakarta.annotation.Nonnull final EditableGroupMetaData body, @jakarta.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
Objects.requireNonNull(body);
final RequestInformation requestInfo = toPutRequestInformation(body, requestConfiguration);
final HashMap> errorMapping = new HashMap>();
errorMapping.put("404", ProblemDetails::createFromDiscriminatorValue);
errorMapping.put("500", ProblemDetails::createFromDiscriminatorValue);
this.requestAdapter.sendPrimitive(requestInfo, errorMapping, Void.class);
}
/**
* Deletes a group by identifier. This operation also deletes all artifacts withinthe group, so should be used very carefully.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`)* The group does not exist (HTTP error `404`)
* @return a {@link RequestInformation}
*/
@jakarta.annotation.Nonnull
public RequestInformation toDeleteRequestInformation() {
return toDeleteRequestInformation(null);
}
/**
* Deletes a group by identifier. This operation also deletes all artifacts withinthe group, so should be used very carefully.This operation can fail for the following reasons:* A server error occurred (HTTP error `500`)* The group does not exist (HTTP error `404`)
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a {@link RequestInformation}
*/
@jakarta.annotation.Nonnull
public RequestInformation toDeleteRequestInformation(@jakarta.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
final RequestInformation requestInfo = new RequestInformation(HttpMethod.DELETE, urlTemplate, pathParameters);
requestInfo.configure(requestConfiguration, DeleteRequestConfiguration::new);
requestInfo.headers.tryAdd("Accept", "application/json");
return requestInfo;
}
/**
* Returns a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @return a {@link RequestInformation}
*/
@jakarta.annotation.Nonnull
public RequestInformation toGetRequestInformation() {
return toGetRequestInformation(null);
}
/**
* Returns a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a {@link RequestInformation}
*/
@jakarta.annotation.Nonnull
public RequestInformation toGetRequestInformation(@jakarta.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
final RequestInformation requestInfo = new RequestInformation(HttpMethod.GET, urlTemplate, pathParameters);
requestInfo.configure(requestConfiguration, GetRequestConfiguration::new);
requestInfo.headers.tryAdd("Accept", "application/json");
return requestInfo;
}
/**
* Updates the metadata of a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @param body The request body
* @return a {@link RequestInformation}
*/
@jakarta.annotation.Nonnull
public RequestInformation toPutRequestInformation(@jakarta.annotation.Nonnull final EditableGroupMetaData body) {
return toPutRequestInformation(body, null);
}
/**
* Updates the metadata of a group using the specified id.This operation can fail for the following reasons:* No group exists with the specified ID (HTTP error `404`)* A server error occurred (HTTP error `500`)
* @param body The request body
* @param requestConfiguration Configuration for the request such as headers, query parameters, and middleware options.
* @return a {@link RequestInformation}
*/
@jakarta.annotation.Nonnull
public RequestInformation toPutRequestInformation(@jakarta.annotation.Nonnull final EditableGroupMetaData body, @jakarta.annotation.Nullable final java.util.function.Consumer requestConfiguration) {
Objects.requireNonNull(body);
final RequestInformation requestInfo = new RequestInformation(HttpMethod.PUT, urlTemplate, pathParameters);
requestInfo.configure(requestConfiguration, PutRequestConfiguration::new);
requestInfo.headers.tryAdd("Accept", "application/json");
requestInfo.setContentFromParsable(requestAdapter, "application/json", body);
return requestInfo;
}
/**
* Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
* @param rawUrl The raw URL to use for the request builder.
* @return a {@link WithGroupItemRequestBuilder}
*/
@jakarta.annotation.Nonnull
public WithGroupItemRequestBuilder withUrl(@jakarta.annotation.Nonnull final String rawUrl) {
Objects.requireNonNull(rawUrl);
return new WithGroupItemRequestBuilder(rawUrl, requestAdapter);
}
/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
@jakarta.annotation.Generated("com.microsoft.kiota")
public class DeleteRequestConfiguration extends BaseRequestConfiguration {
}
/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
@jakarta.annotation.Generated("com.microsoft.kiota")
public class GetRequestConfiguration extends BaseRequestConfiguration {
}
/**
* Configuration for the request such as headers, query parameters, and middleware options.
*/
@jakarta.annotation.Generated("com.microsoft.kiota")
public class PutRequestConfiguration extends BaseRequestConfiguration {
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy