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

com.azure.messaging.eventgrid.systemevents.AcsIncomingCallCustomContext Maven / Gradle / Ivy

There is a newer version: 4.27.0
Show 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.messaging.eventgrid.systemevents;

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;
import java.util.Map;

/**
 * Custom Context of Incoming Call.
 */
@Fluent
public final class AcsIncomingCallCustomContext implements JsonSerializable {
    /*
     * Sip Headers for incoming call
     */
    private Map sipHeaders;

    /*
     * Voip Headers for incoming call
     */
    private Map voipHeaders;

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

    /**
     * Get the sipHeaders property: Sip Headers for incoming call.
     * 
     * @return the sipHeaders value.
     */
    public Map getSipHeaders() {
        return this.sipHeaders;
    }

    /**
     * Set the sipHeaders property: Sip Headers for incoming call.
     * 
     * @param sipHeaders the sipHeaders value to set.
     * @return the AcsIncomingCallCustomContext object itself.
     */
    public AcsIncomingCallCustomContext setSipHeaders(Map sipHeaders) {
        this.sipHeaders = sipHeaders;
        return this;
    }

    /**
     * Get the voipHeaders property: Voip Headers for incoming call.
     * 
     * @return the voipHeaders value.
     */
    public Map getVoipHeaders() {
        return this.voipHeaders;
    }

    /**
     * Set the voipHeaders property: Voip Headers for incoming call.
     * 
     * @param voipHeaders the voipHeaders value to set.
     * @return the AcsIncomingCallCustomContext object itself.
     */
    public AcsIncomingCallCustomContext setVoipHeaders(Map voipHeaders) {
        this.voipHeaders = voipHeaders;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeMapField("sipHeaders", this.sipHeaders, (writer, element) -> writer.writeString(element));
        jsonWriter.writeMapField("voipHeaders", this.voipHeaders, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("sipHeaders".equals(fieldName)) {
                    Map sipHeaders = reader.readMap(reader1 -> reader1.getString());
                    deserializedAcsIncomingCallCustomContext.sipHeaders = sipHeaders;
                } else if ("voipHeaders".equals(fieldName)) {
                    Map voipHeaders = reader.readMap(reader1 -> reader1.getString());
                    deserializedAcsIncomingCallCustomContext.voipHeaders = voipHeaders;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedAcsIncomingCallCustomContext;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy