gas-types-detailed
Version:
Enhanced Google Apps Script Type Definitions with detailed documentation. Includes type definitions plus code snippets, return values, required authorization scopes, and other details not found in @types/google-apps-script.
1,275 lines (1,165 loc) • 68.3 kB
TypeScript
// Type definitions for Google Apps Script 2025-11-10
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
namespace XML {
/**
* A representation of an XML attribute.
*
* // Reads the first and last name of each person and adds a new attribute with
* // the full name.
* let xml = '<roster>' +
* '<person first="John" last="Doe"/>' +
* '<person first="Mary" last="Smith"/>' +
* '</roster>';
* const document = XmlService.parse(xml);
* const people = document.getRootElement().getChildren('person');
* for (let i = 0; i < people.length; i++) {
* const person = people[i];
* const firstName = person.getAttribute('first').getValue();
* const lastName = person.getAttribute('last').getValue();
* person.setAttribute('full', `${firstName} ${lastName}`);
* }
* xml = XmlService.getPrettyFormat().format(document);
* Logger.log(xml);
*/
interface Attribute {
/**
* Gets the local name of the attribute. If the attribute has a namespace prefix, use getNamespace().getPrefix() to get the prefix.
*
* Return:
* - String — the local name of the attribute
*
* https://developers.google.com/apps-script/reference/xml-service/attribute#getName()
*/
getName(): string;
/**
* Gets the namespace for the attribute.
*
* Return:
* - Namespace — the namespace for the attribute
*
* https://developers.google.com/apps-script/reference/xml-service/attribute#getNamespace()
*/
getNamespace(): Namespace;
/**
* Gets the value of the attribute.
*
* Return:
* - String — the value of the attribute
*
* https://developers.google.com/apps-script/reference/xml-service/attribute#getValue()
*/
getValue(): string;
/**
* Sets the local name of the attribute. To set a namespace prefix for the attribute, use setNamespace(namespace) in conjunction with XmlService.getNamespace(prefix, uri).
*
* Return:
* - Attribute — the attribute, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/attribute#setName(String)
* @param name the local name to set
*/
setName(name: string): Attribute;
/**
* Sets the namespace for the attribute. The namespace must have a prefix.
*
* Return:
* - Attribute — the attribute, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/attribute#setNamespace(Namespace)
* @param namespace the namespace to set
*/
setNamespace(namespace: Namespace): Attribute;
/**
* Sets the value of the attribute.
*
* Return:
* - Attribute — the attribute, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/attribute#setValue(String)
* @param value the value to set
*/
setValue(value: string): Attribute;
}
/**
* A representation of an XML CDATASection node.
*
* // Create and log an XML document that shows how special characters like '<',
* // '>', and '&' are stored in a CDATASection node as compared to in a Text node.
* const illegalCharacters = '<em>The Amazing Adventures of Kavalier & Clay</em>';
* const cdata = XmlService.createCdata(illegalCharacters);
* const text = XmlService.createText(illegalCharacters);
* const root =
* XmlService.createElement('root').addContent(cdata).addContent(text);
* const document = XmlService.createDocument(root);
* const xml = XmlService.getPrettyFormat().format(document);
* Logger.log(xml);
*/
interface Cdata {
/**
* Appends the given text to any content that already exists in the node.
*
* Return:
* - Text — the Text node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/cdata#append(String)
* @param text the text to append to the node
*/
append(text: string): Text;
/**
* Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect.
*
* Return:
* - Content — the detached node
*
* https://developers.google.com/apps-script/reference/xml-service/cdata#detach()
*/
detach(): Content;
/**
* Gets the node's parent Element node. If the node does not have a parent, this method returns null.
*
* Return:
* - Element — the parent Element node
*
* https://developers.google.com/apps-script/reference/xml-service/cdata#getParentElement()
*/
getParentElement(): Element;
/**
* Gets the text value of the Text node.
*
* Return:
* - String — the text value of the Text node
*
* https://developers.google.com/apps-script/reference/xml-service/cdata#getText()
*/
getText(): string;
/**
* Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
*
* Return:
* - String — the text value of all nodes that are direct or indirect children of the node
*
* https://developers.google.com/apps-script/reference/xml-service/cdata#getValue()
*/
getValue(): string;
/**
* Sets the text value of the Text node.
*
* Return:
* - Text — the Text node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/cdata#setText(String)
* @param text the text value to set
*/
setText(text: string): Text;
}
/**
* A representation of an XML Comment node.
*/
interface Comment {
/**
* Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect.
*
* Return:
* - Content — the detached node
*
* https://developers.google.com/apps-script/reference/xml-service/comment#detach()
*/
detach(): Content;
/**
* Gets the node's parent Element node. If the node does not have a parent, this method returns null.
*
* Return:
* - Element — the parent Element node
*
* https://developers.google.com/apps-script/reference/xml-service/comment#getParentElement()
*/
getParentElement(): Element;
/**
* Gets the text value of the Comment node.
*
* Return:
* - String — the text value of the Comment node
*
* https://developers.google.com/apps-script/reference/xml-service/comment#getText()
*/
getText(): string;
/**
* Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
*
* Return:
* - String — the text value of all nodes that are direct or indirect children of the node
*
* https://developers.google.com/apps-script/reference/xml-service/comment#getValue()
*/
getValue(): string;
/**
* Sets the text value of the Comment node.
*
* Return:
* - Comment — the Comment node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/comment#setText(String)
* @param text the text value to set
*/
setText(text: string): Comment;
}
/**
* A representation of a generic XML node.
* Implementing classes
*
* NameBrief description
*
* CdataA representation of an XML CDATASection node.
*
* CommentA representation of an XML Comment node.
*
* DocTypeA representation of an XML DocumentType node.
*
* ElementA representation of an XML Element node.
*
* EntityRefA representation of an XML EntityReference node.
*
* ProcessingInstructionA representation of an XML ProcessingInstruction node.
*
* TextA representation of an XML Text node.
*/
interface Content {
/**
* Casts the node as a CDATASection node for the purposes of autocomplete. If the node's ContentType is not already CDATA, this method returns null.
*
* Return:
* - Cdata — the CDATASection node
*
* https://developers.google.com/apps-script/reference/xml-service/content#asCdata()
*/
asCdata(): Cdata;
/**
* Casts the node as a Comment node for the purposes of autocomplete. If the node's ContentType is not already COMMENT, this method returns null.
*
* Return:
* - Comment — the Comment node, or null if the node's content type is not COMMENT
*
* https://developers.google.com/apps-script/reference/xml-service/content#asComment()
*/
asComment(): Comment;
/**
* Casts the node as a DocumentType node for the purposes of autocomplete. If the node's ContentType is not already DOCTYPE, this method returns null.
*
* Return:
* - DocType — the DocumentType node
*
* https://developers.google.com/apps-script/reference/xml-service/content#asDocType()
*/
asDocType(): DocType;
/**
* Casts the node as an Element node for the purposes of autocomplete. If the node's ContentType is not already ELEMENT, this method returns null.
*
* Return:
* - Element — the Element node
*
* https://developers.google.com/apps-script/reference/xml-service/content#asElement()
*/
asElement(): Element;
/**
* Casts the node as a EntityReference node for the purposes of autocomplete. If the node's ContentType is not already ENTITYREF, this method returns null.
*
* Return:
* - EntityRef — the EntityReference node
*
* https://developers.google.com/apps-script/reference/xml-service/content#asEntityRef()
*/
asEntityRef(): EntityRef;
/**
* Casts the node as a ProcessingInstruction node for the purposes of autocomplete. If the node's ContentType is not already PROCESSINGINSTRUCTION, this method returns null.
*
* Return:
* - ProcessingInstruction — the ProcessingInstruction node
*
* https://developers.google.com/apps-script/reference/xml-service/content#asProcessingInstruction()
*/
asProcessingInstruction(): ProcessingInstruction;
/**
* Casts the node as a Text node for the purposes of autocomplete. If the node's ContentType is not already TEXT, this method returns null.
*
* Return:
* - Text — the Text node
*
* https://developers.google.com/apps-script/reference/xml-service/content#asText()
*/
asText(): Text;
/**
* Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect.
*
* Return:
* - Content — the detached node
*
* https://developers.google.com/apps-script/reference/xml-service/content#detach()
*/
detach(): Content;
/**
* Gets the node's parent Element node. If the node does not have a parent, this method returns null.
*
* Return:
* - Element — the parent Element node
*
* https://developers.google.com/apps-script/reference/xml-service/content#getParentElement()
*/
getParentElement(): Element;
/**
* Gets the node's content type.
*
* Return:
* - ContentType — the node's content type
*
* https://developers.google.com/apps-script/reference/xml-service/content#getType()
*/
getType(): ContentType;
/**
* Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
*
* Return:
* - String — the text value of all nodes that are direct or indirect children of the node
*
* https://developers.google.com/apps-script/reference/xml-service/content#getValue()
*/
getValue(): string;
}
/**
* An enumeration representing the types of XML content nodes.
*
* To call an enum, you call its parent class, name, and property. For example,
* XmlService.ContentType.CDATA.
*/
enum ContentType { CDATA, COMMENT, DOCTYPE, ELEMENT, ENTITYREF, PROCESSINGINSTRUCTION, TEXT }
/**
* A representation of an XML DocumentType node.
*/
interface DocType {
/**
* Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect.
*
* Return:
* - Content — the detached node
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#detach()
*/
detach(): Content;
/**
* Gets the name of the root Element node specified in the DocType declaration.
*
* Return:
* - String — the name of the root Element node specified in the DocType declaration
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#getElementName()
*/
getElementName(): string;
/**
* Gets the internal subset data for the DocumentType node.
*
* Return:
* - String — the internal subset data
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#getInternalSubset()
*/
getInternalSubset(): string;
/**
* Gets the node's parent Element node. If the node does not have a parent, this method returns null.
*
* Return:
* - Element — the parent Element node
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#getParentElement()
*/
getParentElement(): Element;
/**
* Gets the public ID of the external subset data for the DocumentType node.
*
* Return:
* - String — the public ID of the external subset data
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#getPublicId()
*/
getPublicId(): string;
/**
* Gets the system ID of the external subset data for the DocumentType node.
*
* Return:
* - String — the system ID of the external subset data
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#getSystemId()
*/
getSystemId(): string;
/**
* Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
*
* Return:
* - String — the text value of all nodes that are direct or indirect children of the node
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#getValue()
*/
getValue(): string;
/**
* Sets the name of the root Element node to specify in the DocType declaration.
*
* Return:
* - DocType — the DocumentType node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#setElementName(String)
* @param name the name of the root Element node to specify in the DocType declaration
*/
setElementName(name: string): DocType;
/**
* Sets the internal subset data for the DocumentType node.
*
* Return:
* - DocType — the DocumentType node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#setInternalSubset(String)
* @param data the internal subset data to set
*/
setInternalSubset(data: string): DocType;
/**
* Sets the public ID of the external subset data for the DocumentType node.
*
* Return:
* - DocType — the DocumentType node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#setPublicId(String)
* @param id the public ID of the external subset data to set
*/
setPublicId(id: string): DocType;
/**
* Sets the system ID of the external subset data for the DocumentType node.
*
* Return:
* - DocType — the DocumentType node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/doc-type#setSystemId(String)
* @param id the system ID of the external subset data to set
*/
setSystemId(id: string): DocType;
}
/**
* A representation of an XML document.
*/
interface Document {
/**
* Appends the given node to the end of the document. The content argument can be a Content object or any node object that corresponds to a type listed in ContentType. Note, however, that a document can only have one child Element node, which is implicitly the root Element node.
*
* Return:
* - Document — the document, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/document#addContent(Content)
* @param content the node to append
*/
addContent(content: Content): Document;
/**
* Inserts the given node at the given index among all nodes that are immediate children of the document. The content argument can be a Content object or any node object that corresponds to a type listed in ContentType. Note, however, that a document can only have one child Element node, which is implicitly the root Element node.
*
* Return:
* - Document — the document, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/document#addContent(Integer,Content)
* @param index the index at which to insert the node among all nodes that are immediate children of the document
* @param content the node to insert
*/
addContent(index: Integer, content: Content): Document;
/**
* Creates unattached copies of all nodes that are immediate children of the document.
*
* Return:
* - Content[] — an array of unattached copies of all nodes that are immediate children of the document
*
* https://developers.google.com/apps-script/reference/xml-service/document#cloneContent()
*/
cloneContent(): Content[];
/**
* Detaches and returns the document's root Element node. If the document does not have a root Element node, this method returns null.
*
* Return:
* - Element — the detached Element node, or null if the document does not have a root Element node
*
* https://developers.google.com/apps-script/reference/xml-service/document#detachRootElement()
*/
detachRootElement(): Element;
/**
* Gets all nodes that are immediate children of the document.
*
* Return:
* - Content[] — an array of all nodes that are immediate children of the document
*
* https://developers.google.com/apps-script/reference/xml-service/document#getAllContent()
*/
getAllContent(): Content[];
/**
* Gets the node at the given index among all nodes that are immediate children of the document. If there is no node at the given index, this method returns null.
*
* Return:
* - Content — the node, or null if there is no node at the given index
*
* https://developers.google.com/apps-script/reference/xml-service/document#getContent(Integer)
* @param index the index for the node among all nodes that are immediate children of the document
*/
getContent(index: Integer): Content;
/**
* Gets the number of nodes that are immediate children of the document.
*
* Return:
* - Integer — the number of nodes that are immediate children of the document
*
* https://developers.google.com/apps-script/reference/xml-service/document#getContentSize()
*/
getContentSize(): Integer;
/**
* Gets all nodes that are direct or indirect children of the document, in the order they appear in the document.
*
* Return:
* - Content[] — an array of all nodes that are direct or indirect children of the document
*
* https://developers.google.com/apps-script/reference/xml-service/document#getDescendants()
*/
getDescendants(): Content[];
/**
* Gets the document's DocType declaration. If the document does not have a DocumentType node, this method returns null.
*
* Return:
* - DocType — the DocumentType node, or null if the document does not have a DocumentType node
*
* https://developers.google.com/apps-script/reference/xml-service/document#getDocType()
*/
getDocType(): DocType;
/**
* Gets the document's root Element node. If the document does not have a root Element node, this method returns null.
*
* Return:
* - Element — the root Element node, or null if the document does not have a root Element node
*
* https://developers.google.com/apps-script/reference/xml-service/document#getRootElement()
*/
getRootElement(): Element;
/**
* Determines whether the document has a root Element node.
*
* Return:
* - Boolean — true if the document has a root Element node; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/document#hasRootElement()
*/
hasRootElement(): boolean;
/**
* Removes all nodes that are immediate children of the document.
*
* Return:
* - Content[] — an array of all nodes that were immediate children of the document before they were removed
*
* https://developers.google.com/apps-script/reference/xml-service/document#removeContent()
*/
removeContent(): Content[];
/**
* Removes the given node, if the node is an immediate child of the document. The content argument can be a Content object or any node object that corresponds to a type listed in ContentType.
*
* Return:
* - Boolean — true if the node was an immediate child and was removed; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/document#removeContent(Content)
* @param content the node to remove
*/
removeContent(content: Content): boolean;
/**
* Removes the node at the given index among all nodes that are immediate children of the document. If there is no node at the given index, this method returns null.
*
* Return:
* - Content — the node that was removed, or null if there is no node at the given index
*
* https://developers.google.com/apps-script/reference/xml-service/document#removeContent(Integer)
* @param index the index for the node among all nodes that are immediate children of the document
*/
removeContent(index: Integer): Content;
/**
* Sets the document's DocType declaration. If the document already has a different DocType node, this method overwrites the old node. This method throws an exception if the document already contains the same DocType node that is being set.
*
* Return:
* - Document — the document, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/document#setDocType(DocType)
* @param docType the DocumentType to set
*/
setDocType(docType: DocType): Document;
/**
* Sets the document's root Element node. If the document already has a root Element node, this method overwrites the old node.
*
* Return:
* - Document — the document, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/document#setRootElement(Element)
* @param element the root Element node to set
*/
setRootElement(element: Element): Document;
}
/**
* A representation of an XML Element node.
*
* // Adds up the values listed in a sample XML document and adds a new element
* // with the total.
* let xml = '<things>' +
* '<plates>12</plates>' +
* '<bowls>18</bowls>' +
* '<cups>25</cups>' +
* '</things>';
* const document = XmlService.parse(xml);
* const root = document.getRootElement();
* const items = root.getChildren();
* let total = 0;
* for (let i = 0; i < items.length; i++) {
* total += Number(items[i].getText());
* }
* const totalElement = XmlService.createElement('total').setText(total);
* root.addContent(totalElement);
* xml = XmlService.getPrettyFormat().format(document);
* Logger.log(xml);
*/
interface Element {
/**
* Appends the given node as the last child of the Element node. The content argument can be a Element object or any node object that corresponds to a type listed in ContentType.
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#addContent(Content)
* @param content the node to append
*/
addContent(content: Content): Element;
/**
* Inserts the given node at the given index among all nodes that are immediate children of the Element node. The content argument can be a Element object or any node object that corresponds to a type listed in ContentType.
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#addContent(Integer,Content)
* @param index the index at which to insert the node among all nodes that are immediate children of the Element node
* @param content the node to insert
*/
addContent(index: Integer, content: Content): Element;
/**
* Creates unattached copies of all nodes that are immediate children of the {@code Element} node.
*
* Return:
* - Content[] — an array of unattached copies of all nodes that are immediate children of the {@code Element} node
*
* https://developers.google.com/apps-script/reference/xml-service/element#cloneContent()
*/
cloneContent(): Content[];
/**
* Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect.
*
* Return:
* - Content — the detached node
*
* https://developers.google.com/apps-script/reference/xml-service/element#detach()
*/
detach(): Content;
/**
* Gets all nodes that are immediate children of the {@code Element} node.
*
* Return:
* - Content[] — an array of all nodes that are immediate children of the {@code Element} node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getAllContent()
*/
getAllContent(): Content[];
/**
* Gets the attribute for this Element node with the given name and no namespace. If there is no such attribute, this method returns null.
*
* Return:
* - Attribute — the attribute, or null if there is no attribute with the given name and no namespace
*
* https://developers.google.com/apps-script/reference/xml-service/element#getAttribute(String)
* @param name the name of the attribute
*/
getAttribute(name: string): Attribute;
/**
* Gets the attribute for this Element node with the given name and namespace. If there is no such node, this method returns null.
*
* Return:
* - Attribute — the attribute, or null if there is no attribute with the given name and namespace
*
* https://developers.google.com/apps-script/reference/xml-service/element#getAttribute(String,Namespace)
* @param name the name of the attribute
* @param namespace the namespace of the attribute
*/
getAttribute(name: string, namespace: Namespace): Attribute;
/**
* Gets all attributes for this Element node, in the order they appear in the document.
*
* Return:
* - Attribute[] — an array of all attributes for this Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getAttributes()
*/
getAttributes(): Attribute[];
/**
* Gets the first Element node with the given name and no namespace that is an immediate child of this Element node. If there is no such node, this method returns null.
*
* Return:
* - Element — the Element node, or null if there is no immediate child Element node with the given name and no namespace
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChild(String)
* @param name the name of the child Element node
*/
getChild(name: string): Element;
/**
* Gets the first Element node with the given name and namespace that is an immediate child of this Element node. If there is no such node, this method returns null.
*
* Return:
* - Element — the Element node, or null if there is no immediate child Element node with the given name and namespace
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChild(String,Namespace)
* @param name the name of the child Element node
* @param namespace the namespace of the child Element node
*/
getChild(name: string, namespace: Namespace): Element;
/**
* Gets the text value of the node with the given name and no namespace, if the node is an immediate child of the Element node. If there is no such node, this method returns null.
*
* Return:
* - String — the text value of the child node, or null if there is no immediate child node with the given name and no namespace
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChildText(String)
* @param name the name of the child node
*/
getChildText(name: string): string;
/**
* Gets the text value of the node with the given name and namespace, if the node is an immediate child of the Element node. If there is no such node, this method returns null.
*
* Return:
* - String — the text value of the child node, or null if there is no immediate child node with the given name and namespace
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChildText(String,Namespace)
* @param name the name of the child node
* @param namespace the namespace of the child node
*/
getChildText(name: string, namespace: Namespace): string;
/**
* Gets all Element nodes that are immediate children of this Element node, in the order they appear in the document.
*
* Return:
* - Element[] — an array of all Element nodes that are immediate children of this Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChildren()
*/
getChildren(): Element[];
/**
* Gets all Element nodes with the given name and no namespace that are immediate children of this Element node, in the order they appear in the document.
*
* Return:
* - Element[] — an array of all Element nodes with the given name and no namespace that are immediate children of this Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChildren(String)
* @param name the name of the child Element nodes
*/
getChildren(name: string): Element[];
/**
* Gets all Element nodes with the given name and namespace that are immediate children of this Element node, in the order they appear in the document.
*
* Return:
* - Element[] — an array of all Element nodes with the given name and namespace that are immediate children of this Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getChildren(String,Namespace)
* @param name the name of the child Element nodes
* @param namespace the namespace of the child Element nodes
*/
getChildren(name: string, namespace: Namespace): Element[];
/**
* Gets the node at the given index among all nodes that are immediate children of the {@code Element} node. If there is no node at the given index, this method returns null.
*
* Return:
* - Content — the node, or null if there is no node at the given index
*
* https://developers.google.com/apps-script/reference/xml-service/element#getContent(Integer)
* @param index the index for the node among all nodes that are immediate children of the {@code Element} node
*/
getContent(index: Integer): Content;
/**
* Gets the number of nodes that are immediate children of the {@code Element} node.
*
* Return:
* - Integer — the number of nodes that are immediate children of the {@code Element} node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getContentSize()
*/
getContentSize(): Integer;
/**
* Gets all nodes that are direct or indirect children of the {@code Element} node, in the order they appear in the document.
*
* Return:
* - Content[] — an array of all nodes that are direct or indirect children of the {@code Element} node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getDescendants()
*/
getDescendants(): Content[];
/**
* Gets the XML document that contains the {@code Element} node.
*
* Return:
* - Document — the document that contains the {@code Element} node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getDocument()
*/
getDocument(): Document;
/**
* Gets the local name of the Element node. If the node has a namespace prefix, use getQualifiedName() or getNamespace().getPrefix() to get the prefix.
*
* Return:
* - String — the local name of the Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getName()
*/
getName(): string;
/**
* Gets the namespace for the Element node.
*
* Return:
* - Namespace — the namespace for the Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getNamespace()
*/
getNamespace(): Namespace;
/**
* Gets the namespace with the given prefix for the Element node.
*
* Return:
* - Namespace — the namespace with the given prefix for the Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getNamespace(String)
* @param prefix the prefix for the namespace
*/
getNamespace(prefix: string): Namespace;
/**
* Gets the node's parent Element node. If the node does not have a parent, this method returns null.
*
* Return:
* - Element — the parent Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getParentElement()
*/
getParentElement(): Element;
/**
* Gets the local name and namespace prefix of the Element node, in the form [namespacePrefix]:[localName]. If the node does not have a namespace prefix, use getName().
*
* Return:
* - String — the local name and namespace prefix of the Element node, in the form [namespacePrefix]:[localName]
*
* https://developers.google.com/apps-script/reference/xml-service/element#getQualifiedName()
*/
getQualifiedName(): string;
/**
* Gets the text value of the Element node.
*
* Return:
* - String — the text value of the Element node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getText()
*/
getText(): string;
/**
* Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
*
* Return:
* - String — the text value of all nodes that are direct or indirect children of the node
*
* https://developers.google.com/apps-script/reference/xml-service/element#getValue()
*/
getValue(): string;
/**
* Determines whether this Element node is a direct or indirect parent of a given Element node.
*
* Return:
* - Boolean — true if this Element node is a direct or indirect parent of the given Element node; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/element#isAncestorOf(Element)
* @param other the other Element node
*/
isAncestorOf(other: Element): boolean;
/**
* Determines whether the Element node is the document's root node.
*
* Return:
* - Boolean — true if the Element node is the document's root node; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/element#isRootElement()
*/
isRootElement(): boolean;
/**
* Removes the given attribute for this Element node, if such an attribute exists.
*
* Return:
* - Boolean — true if the attribute existed and was removed; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/element#removeAttribute(Attribute)
* @param attribute the attribute
*/
removeAttribute(attribute: Attribute): boolean;
/**
* Removes the attribute for this Element node with the given name and no namespace, if such an attribute exists.
*
* Return:
* - Boolean — true if the attribute existed and was removed; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/element#removeAttribute(String)
* @param attributeName the name of the attribute
*/
removeAttribute(attributeName: string): boolean;
/**
* Removes the attribute for this Element node with the given name and namespace, if such an attribute exists.
*
* Return:
* - Boolean — true if the attribute existed and was removed; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/element#removeAttribute(String,Namespace)
* @param attributeName the name of the attribute
* @param namespace the namespace of the attribute
*/
removeAttribute(attributeName: string, namespace: Namespace): boolean;
/**
* Removes all nodes that are immediate children of the {@code Element} node.
*
* Return:
* - Content[] — an array of all nodes that were immediate children of the {@code Element} node before they were removed
*
* https://developers.google.com/apps-script/reference/xml-service/element#removeContent()
*/
removeContent(): Content[];
/**
* Removes the given node, if the node is an immediate child of the {@code Element} node. The content argument can be a Element object or any node object that corresponds to a type listed in ContentType.
*
* Return:
* - Boolean — true if the node was an immediate child and was removed; false if not
*
* https://developers.google.com/apps-script/reference/xml-service/element#removeContent(Content)
* @param content the node to remove
*/
removeContent(content: Content): boolean;
/**
* Removes the node at the given index among all nodes that are immediate children of the {@code Element} node. If there is no node at the given index, this method returns null.
*
* Return:
* - Content — the node that was removed, or null if there is no node at the given index
*
* https://developers.google.com/apps-script/reference/xml-service/element#removeContent(Integer)
* @param index the index for the node among all nodes that are immediate children of the {@code Element} node
*/
removeContent(index: Integer): Content;
/**
* Sets the given attribute for this Element node.
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#setAttribute(Attribute)
* @param attribute the attribute to set
*/
setAttribute(attribute: Attribute): Element;
/**
* Sets the attribute for this Element node with the given name, value, and no namespace.
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#setAttribute(String,String)
* @param name the name of the attribute to set
* @param value the value of the attribute to set
*/
setAttribute(name: string, value: string): Element;
/**
* Sets the attribute for this Element node with the given name, value, and namespace.
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#setAttribute(String,String,Namespace)
* @param name the name of the attribute to set
* @param value the value of the attribute to set
* @param namespace the namespace of the attribute to set
*/
setAttribute(name: string, value: string, namespace: Namespace): Element;
/**
* Sets the local name of the Element node. To set a namespace prefix for the node, use setNamespace(namespace) in conjunction with XmlService.getNamespace(prefix, uri).
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#setName(String)
* @param name the local name to set
*/
setName(name: string): Element;
/**
* Sets the namespace for the Element node.
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#setNamespace(Namespace)
* @param namespace the namespace to set
*/
setNamespace(namespace: Namespace): Element;
/**
* Sets the text value of the Element node. If the node already contains a text value or any child nodes, this method overwrites the old content. To append or insert content instead, use addContent(content) or addContent(index, content).
*
* Return:
* - Element — the Element node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/element#setText(String)
* @param text the text to set
*/
setText(text: string): Element;
}
/**
* A representation of an XML EntityReference node.
*/
interface EntityRef {
/**
* Detaches the node from its parent Element node. If the node does not have a parent, this method has no effect.
*
* Return:
* - Content — the detached node
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#detach()
*/
detach(): Content;
/**
* Gets the name of the EntityReference node.
*
* Return:
* - String — the name of the EntityReference node
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#getName()
*/
getName(): string;
/**
* Gets the node's parent Element node. If the node does not have a parent, this method returns null.
*
* Return:
* - Element — the parent Element node
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#getParentElement()
*/
getParentElement(): Element;
/**
* Gets the public ID of the EntityReference node. If the node does not have a public ID, this method returns null.
*
* Return:
* - String — the public ID of the EntityReference node, or null if it has none
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#getPublicId()
*/
getPublicId(): string;
/**
* Gets the system ID of the EntityReference node. If the node does not have a system ID, this method returns null.
*
* Return:
* - String — the system ID of the EntityReference node, or null if it has none
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#getSystemId()
*/
getSystemId(): string;
/**
* Gets the text value of all nodes that are direct or indirect children of the node, in the order they appear in the document.
*
* Return:
* - String — the text value of all nodes that are direct or indirect children of the node
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#getValue()
*/
getValue(): string;
/**
* Sets the name of the EntityReference node.
*
* Return:
* - EntityRef — the EntityReference node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#setName(String)
* @param name the name to set
*/
setName(name: string): EntityRef;
/**
* Sets the public ID of the EntityReference node.
*
* Return:
* - EntityRef — the EntityReference node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#setPublicId(String)
* @param id the public ID to set
*/
setPublicId(id: string): EntityRef;
/**
* Sets the system ID of the EntityReference node.
*
* Return:
* - EntityRef — the EntityReference node, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/entity-ref#setSystemId(String)
* @param id the system ID to set
*/
setSystemId(id: string): EntityRef;
}
/**
* A formatter for outputting an XML document, with three pre-defined formats that can be further
* customized.
*
* // Log an XML document with specified formatting options.
* const xml = '<root><a><b>Text!</b><b>More text!</b></a></root>';
* const document = XmlService.parse(xml);
* const output = XmlService.getCompactFormat()
* .setLineSeparator('\n')
* .setEncoding('UTF-8')
* .setIndent(' ')
* .format(document);
* Logger.log(output);
*/
interface Format {
/**
* Outputs the given Document as a formatted string.
*
* Return:
* - String — the formatted document
*
* https://developers.google.com/apps-script/reference/xml-service/format#format(Document)
* @param document the document to format
*/
format(document: Document): string;
/**
* Outputs the given Element node as a formatted string.
*
* Return:
* - String — the formatted element
*
* https://developers.google.com/apps-script/reference/xml-service/format#format(Element)
* @param element the element to format
*/
format(element: Element): string;
/**
* Sets the character encoding that the formatter should use. The encoding argument must be an accepted XML encoding like ISO-8859-1, US-ASCII, UTF-8, or UTF-16.
*
* // Log an XML document with encoding that does not support certain special
* // characters.
* const xml = '<root><a><b>ಠ‿ಠ</b><b>ಠ‿ಠ</b></a></root>';
* const document = XmlService.parse(xml);
* const output =
* XmlService.getRawFormat().setEncoding('ISO-8859-1').format(document);
* Logger.log(output);
*
* Return:
* - Format — the formatter, for chaining
*
* https://developers.google.com/apps-script/reference/xml-service/format#setEncoding(String)
* @param encoding the encoding to use
*/
setEncoding(encoding: string): Format;
/**
* Sets the string used to indent child nodes relative to their parents. Setting an indent other than null will cause the formatter to insert a line break after every node.
*
*