All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.communication.identity.implementation.models.CommunicationIdentity Maven / Gradle / Ivy

Go to download

This package contains APIs for application identity in Microsoft Azure Communication Services. For this release, see notes - https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-identity/README.md and https://github.com/Azure/azure-sdk-for-java/blob/master/sdk/communication/azure-communication-identity/CHANGELOG.md. Microsoft Azure Communication Identity quickstart - https://docs.microsoft.com/azure/communication-services/quickstarts/access-tokens?pivots=programming-language-java

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.communication.identity.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
 * A communication identity.
 */
@Fluent
public final class CommunicationIdentity implements JsonSerializable {
    /*
     * Identifier of the identity.
     */
    private String id;

    /**
     * Creates an instance of CommunicationIdentity class.
     */
    public CommunicationIdentity() {
    }

    /**
     * Get the id property: Identifier of the identity.
     * 
     * @return the id value.
     */
    public String getId() {
        return this.id;
    }

    /**
     * Set the id property: Identifier of the identity.
     * 
     * @param id the id value to set.
     * @return the CommunicationIdentity object itself.
     */
    public CommunicationIdentity setId(String id) {
        this.id = id;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("id", this.id);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of CommunicationIdentity from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of CommunicationIdentity if the JsonReader was pointing to an instance of it, or null if it
     * was pointing to JSON null.
     * @throws IllegalStateException If the deserialized JSON object was missing any required properties.
     * @throws IOException If an error occurs while reading the CommunicationIdentity.
     */
    public static CommunicationIdentity fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            CommunicationIdentity deserializedCommunicationIdentity = new CommunicationIdentity();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedCommunicationIdentity.id = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedCommunicationIdentity;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy