cadl-output/java/src/main/java/com/notificationhubs/RegistrationsClient.java
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.notificationhubs;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.exception.ClientAuthenticationException;
import com.azure.core.exception.HttpResponseException;
import com.azure.core.exception.ResourceModifiedException;
import com.azure.core.exception.ResourceNotFoundException;
import com.azure.core.http.rest.RequestOptions;
import com.azure.core.http.rest.Response;
import com.azure.core.util.BinaryData;

/** Initializes a new instance of the synchronous AzureNotificationHubsServiceClient type. */
@ServiceClient(builder = RegistrationsClientBuilder.class)
public final class RegistrationsClient {
    @Generated private final RegistrationsAsyncClient client;

    /**
     * Initializes an instance of RegistrationsClient class.
     *
     * @param client the async client.
     */
    @Generated
    RegistrationsClient(RegistrationsAsyncClient client) {
        this.client = client;
    }

    /**
     * Create an Azure Notification Hubs registration description.
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     registrationId: String (Optional)
     *     tags: String (Optional)
     *     etag: String (Optional)
     *     pushVariables (Optional): {
     *         String: String (Optional)
     *     }
     *     expirationTime: String (Optional)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     registrationId: String (Optional)
     *     tags: String (Optional)
     *     etag: String (Optional)
     *     pushVariables (Optional): {
     *         String: String (Optional)
     *     }
     *     expirationTime: String (Optional)
     * }
     * }</pre>
     *
     * @param body The registration description.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return represents an Azure Notification Hubs registration description along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> createWithResponse(BinaryData body, RequestOptions requestOptions) {
        return this.client.createWithResponse(body, requestOptions).block();
    }

    /**
     * Create or update an Azure Notification Hubs registration description.
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>If-Match</td><td>String</td><td>No</td><td>The If-Match HTTP header</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addHeader}
     *
     * <p><strong>Request Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     registrationId: String (Optional)
     *     tags: String (Optional)
     *     etag: String (Optional)
     *     pushVariables (Optional): {
     *         String: String (Optional)
     *     }
     *     expirationTime: String (Optional)
     * }
     * }</pre>
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     registrationId: String (Optional)
     *     tags: String (Optional)
     *     etag: String (Optional)
     *     pushVariables (Optional): {
     *         String: String (Optional)
     *     }
     *     expirationTime: String (Optional)
     * }
     * }</pre>
     *
     * @param registrationId The registration ID.
     * @param body The registration description.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return represents an Azure Notification Hubs registration description along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> createOrUpdateWithResponse(
            String registrationId, BinaryData body, RequestOptions requestOptions) {
        return this.client.createOrUpdateWithResponse(registrationId, body, requestOptions).block();
    }

    /**
     * Delete an Azure Notification Hubs registration description.
     *
     * <p><strong>Header Parameters</strong>
     *
     * <table border="1">
     *     <caption>Header Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>If-Match</td><td>String</td><td>No</td><td>The If-Match HTTP header</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addHeader}
     *
     * @param registrationId The registration ID.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<Void> deleteWithResponse(String registrationId, RequestOptions requestOptions) {
        return this.client.deleteWithResponse(registrationId, requestOptions).block();
    }

    /**
     * Get an Azure Notification Hubs registration description.
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * {
     *     registrationId: String (Optional)
     *     tags: String (Optional)
     *     etag: String (Optional)
     *     pushVariables (Optional): {
     *         String: String (Optional)
     *     }
     *     expirationTime: String (Optional)
     * }
     * }</pre>
     *
     * @param registrationId The registration ID.
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return an Azure Notification Hubs registration description along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> getWithResponse(String registrationId, RequestOptions requestOptions) {
        return this.client.getWithResponse(registrationId, requestOptions).block();
    }

    /**
     * List Azure Notification Hubs registration descriptions.
     *
     * <p><strong>Query Parameters</strong>
     *
     * <table border="1">
     *     <caption>Query Parameters</caption>
     *     <tr><th>Name</th><th>Type</th><th>Required</th><th>Description</th></tr>
     *     <tr><td>$top</td><td>String</td><td>No</td><td>The limit to the number of records to retrieve</td></tr>
     *     <tr><td>$fitler</td><td>String</td><td>No</td><td>The filter query to find registrations</td></tr>
     *     <tr><td>continuationToken</td><td>String</td><td>No</td><td>The continuation token for more results</td></tr>
     * </table>
     *
     * You can add these to a request with {@link RequestOptions#addQueryParam}
     *
     * <p><strong>Response Body Schema</strong>
     *
     * <pre>{@code
     * [
     *      (Required){
     *         registrationId: String (Optional)
     *         tags: String (Optional)
     *         etag: String (Optional)
     *         pushVariables (Optional): {
     *             String: String (Optional)
     *         }
     *         expirationTime: String (Optional)
     *     }
     * ]
     * }</pre>
     *
     * @param requestOptions The options to configure the HTTP request before HTTP client sends it.
     * @throws HttpResponseException thrown if the request is rejected by server.
     * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401.
     * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404.
     * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409.
     * @return the response body along with {@link Response}.
     */
    @Generated
    @ServiceMethod(returns = ReturnType.SINGLE)
    public Response<BinaryData> listWithResponse(RequestOptions requestOptions) {
        return this.client.listWithResponse(requestOptions).block();
    }
}
