override fun toXContent()

in opensearch-notebooks/src/main/kotlin/org/opensearch/notebooks/model/Notebook.kt [127:149]


    override fun toXContent(builder: XContentBuilder?, params: ToXContent.Params?): XContentBuilder {
        val xContentParams = params ?: RestTag.REST_OUTPUT_PARAMS
        builder!!
        builder.startObject()
        if (name != null) {
            builder.field(NAME_TAG, name)
        }
        if (dateCreated != null) {
            builder.field(DATE_CREATED_TAG, dateCreated)
        }
        if (dateModified != null) {
            builder.field(DATE_MODIFIED_TAG, dateModified)
        }
        if (backend != null) {
            builder.field(BACKEND_TAG, backend)
        }
        if (paragraphs != null) {
            builder.startArray(PARAGRAPHS_TAG)
            paragraphs.forEach { it.toXContent(builder, xContentParams) }
            builder.endArray()
        }
        return builder.endObject()
    }