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

com.azure.resourcemanager.billing.models.DocumentDownloadRequest Maven / Gradle / Ivy

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

package com.azure.resourcemanager.billing.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 list of download details for individual documents.
 */
@Fluent
public final class DocumentDownloadRequest implements JsonSerializable {
    /*
     * The ID that uniquely identifies an invoice document. This ID may be an identifier for an invoice PDF, a credit
     * note, or a tax receipt. If omitted, the most recent invoice PDF for the invoice will be returned.
     */
    private String documentName;

    /*
     * The ID that uniquely identifies an invoice.
     */
    private String invoiceName;

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

    /**
     * Get the documentName property: The ID that uniquely identifies an invoice document. This ID may be an identifier
     * for an invoice PDF, a credit note, or a tax receipt. If omitted, the most recent invoice PDF for the invoice will
     * be returned.
     * 
     * @return the documentName value.
     */
    public String documentName() {
        return this.documentName;
    }

    /**
     * Set the documentName property: The ID that uniquely identifies an invoice document. This ID may be an identifier
     * for an invoice PDF, a credit note, or a tax receipt. If omitted, the most recent invoice PDF for the invoice will
     * be returned.
     * 
     * @param documentName the documentName value to set.
     * @return the DocumentDownloadRequest object itself.
     */
    public DocumentDownloadRequest withDocumentName(String documentName) {
        this.documentName = documentName;
        return this;
    }

    /**
     * Get the invoiceName property: The ID that uniquely identifies an invoice.
     * 
     * @return the invoiceName value.
     */
    public String invoiceName() {
        return this.invoiceName;
    }

    /**
     * Set the invoiceName property: The ID that uniquely identifies an invoice.
     * 
     * @param invoiceName the invoiceName value to set.
     * @return the DocumentDownloadRequest object itself.
     */
    public DocumentDownloadRequest withInvoiceName(String invoiceName) {
        this.invoiceName = invoiceName;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("documentName", this.documentName);
        jsonWriter.writeStringField("invoiceName", this.invoiceName);
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of DocumentDownloadRequest from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of DocumentDownloadRequest 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 DocumentDownloadRequest.
     */
    public static DocumentDownloadRequest fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            DocumentDownloadRequest deserializedDocumentDownloadRequest = new DocumentDownloadRequest();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("documentName".equals(fieldName)) {
                    deserializedDocumentDownloadRequest.documentName = reader.getString();
                } else if ("invoiceName".equals(fieldName)) {
                    deserializedDocumentDownloadRequest.invoiceName = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDocumentDownloadRequest;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy