From 2df52d92058b47552d1dff5c64eda95dfb9804de Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Sun, 23 Aug 2026 00:59:39 +0000 Subject: [PATCH 1/3] Build SDK Stainless-Generated-From: d0b5dde6d3cc03090fffc72aa7516826a32d03a8 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dca1092..df3ea3c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Maven Central](https://img.shields.io/maven-central/v/ai.llamaindex.llamacloud/llama-cloud)](https://central.sonatype.com/artifact/ai.llamaindex.llamacloud/llama-cloud/1.5.1) -[![javadoc](https://javadoc.io/badge2/ai.llamaindex.llamacloud/llama-cloud/1.5.1/javadoc.svg)](https://javadoc.io/doc/ai.llamaindex.llamacloud/llama-cloud/1.5.0) +[![javadoc](https://javadoc.io/badge2/ai.llamaindex.llamacloud/llama-cloud/1.5.1/javadoc.svg)](https://javadoc.io/doc/ai.llamaindex.llamacloud/llama-cloud/1.5.1) From a137c54f8d6390217d4336d5c6fbcd34999c049c Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Wed, 26 Aug 2026 06:31:48 +0000 Subject: [PATCH 2/3] Build SDK Stainless-Generated-From: 54e37700263233d755d8fc2af5bf8a792309621f --- .stats.yml | 2 +- .../models/beta/sheets/SheetCreateParams.kt | 1816 ----------- .../beta/sheets/SheetDeleteJobParams.kt | 272 -- .../beta/sheets/SheetDeleteJobResponse.kt | 122 - .../models/beta/sheets/SheetGetParams.kt | 291 -- .../beta/sheets/SheetGetResultTableParams.kt | 444 --- .../models/beta/sheets/SheetListPage.kt | 131 - .../models/beta/sheets/SheetListPageAsync.kt | 145 - .../beta/sheets/SheetListPageResponse.kt | 301 -- .../models/beta/sheets/SheetListParams.kt | 544 ---- .../models/beta/sheets/SheetsJob.kt | 2884 ----------------- .../models/beta/sheets/SheetsParsingConfig.kt | 881 ----- .../models/sheets/SheetCreateParams.kt | 1816 ----------- .../models/sheets/SheetDeleteJobParams.kt | 271 -- .../models/sheets/SheetDeleteJobResponse.kt | 122 - .../models/sheets/SheetGetParams.kt | 290 -- .../sheets/SheetGetResultTableParams.kt | 443 --- .../llamacloud/models/sheets/SheetListPage.kt | 131 - .../models/sheets/SheetListPageAsync.kt | 145 - .../models/sheets/SheetListPageResponse.kt | 302 -- .../models/sheets/SheetListParams.kt | 543 ---- .../services/async/SheetServiceAsync.kt | 295 -- .../services/async/SheetServiceAsyncImpl.kt | 242 -- .../services/async/beta/SheetServiceAsync.kt | 339 -- .../async/beta/SheetServiceAsyncImpl.kt | 254 -- .../services/blocking/SheetService.kt | 293 -- .../services/blocking/SheetServiceImpl.kt | 216 -- .../services/blocking/beta/SheetService.kt | 337 -- .../blocking/beta/SheetServiceImpl.kt | 228 -- .../beta/sheets/SheetCreateParamsTest.kt | 271 -- .../beta/sheets/SheetDeleteJobParamsTest.kt | 57 - .../beta/sheets/SheetDeleteJobResponseTest.kt | 30 - .../models/beta/sheets/SheetGetParamsTest.kt | 63 - .../sheets/SheetGetResultTableParamsTest.kt | 76 - .../beta/sheets/SheetListPageResponseTest.kt | 419 --- .../models/beta/sheets/SheetListParamsTest.kt | 74 - .../models/beta/sheets/SheetsJobTest.kt | 379 --- .../beta/sheets/SheetsParsingConfigTest.kt | 64 - .../models/sheets/SheetCreateParamsTest.kt | 272 -- .../models/sheets/SheetDeleteJobParamsTest.kt | 57 - .../sheets/SheetDeleteJobResponseTest.kt | 30 - .../models/sheets/SheetGetParamsTest.kt | 63 - .../sheets/SheetGetResultTableParamsTest.kt | 76 - .../sheets/SheetListPageResponseTest.kt | 421 --- .../models/sheets/SheetListParamsTest.kt | 74 - .../services/async/SheetServiceAsyncTest.kt | 159 - .../async/beta/SheetServiceAsyncTest.kt | 159 - .../services/blocking/SheetServiceTest.kt | 154 - .../blocking/beta/SheetServiceTest.kt | 154 - 49 files changed, 1 insertion(+), 17151 deletions(-) delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponse.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPage.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageAsync.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponse.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJob.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponse.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParams.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPage.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageAsync.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponse.kt delete mode 100644 llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParams.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponseTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponseTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParamsTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt delete mode 100644 llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt diff --git a/.stats.yml b/.stats.yml index 77de729..f9d1086 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 150 +configured_endpoints: 140 diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParams.kt deleted file mode 100644 index d12a465..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParams.kt +++ /dev/null @@ -1,1816 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.JsonMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.checkKnown -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (an inline parsing configuration) or `configuration_id` (a - * saved configuration preset). If neither is provided, a default configuration is used. Optionally - * include `webhook_configurations` to receive `sheets.*` status notifications. - */ -@Deprecated("deprecated") -class SheetCreateParams -private constructor( - private val organizationId: String?, - private val projectId: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** - * The ID of the file to parse - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileId(): String = body.fileId() - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") fun config(): Optional = body.config() - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun configuration(): Optional = body.configuration() - - /** - * Saved configuration ID - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun configurationId(): Optional = body.configurationId() - - /** - * IDs of saved webhook configurations to notify for this job. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun webhookConfigurationIds(): Optional> = body.webhookConfigurationIds() - - /** - * Outbound webhook endpoints to notify on job status changes - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun webhookConfigurations(): Optional> = body.webhookConfigurations() - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _fileId(): JsonField = body._fileId() - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") fun _config(): JsonField = body._config() - - /** - * Returns the raw JSON value of [configuration]. - * - * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _configuration(): JsonField = body._configuration() - - /** - * Returns the raw JSON value of [configurationId]. - * - * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _configurationId(): JsonField = body._configurationId() - - /** - * Returns the raw JSON value of [webhookConfigurationIds]. - * - * Unlike [webhookConfigurationIds], this method doesn't throw if the JSON field has an - * unexpected type. - */ - fun _webhookConfigurationIds(): JsonField> = body._webhookConfigurationIds() - - /** - * Returns the raw JSON value of [webhookConfigurations]. - * - * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _webhookConfigurations(): JsonField> = - body._webhookConfigurations() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetCreateParams]. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetCreateParams]. */ - class Builder internal constructor() { - - private var organizationId: String? = null - private var projectId: String? = null - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetCreateParams: SheetCreateParams) = apply { - organizationId = sheetCreateParams.organizationId - projectId = sheetCreateParams.projectId - body = sheetCreateParams.body.toBuilder() - additionalHeaders = sheetCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetCreateParams.additionalQueryParams.toBuilder() - } - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [fileId] - * - [config] - * - [configuration] - * - [configurationId] - * - [webhookConfigurationIds] - * - etc. - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The ID of the file to parse */ - fun fileId(fileId: String) = apply { body.fileId(fileId) } - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { body.fileId(fileId) } - - /** Configuration for spreadsheet parsing and region extraction */ - @Deprecated("deprecated") - fun config(config: SheetsParsingConfig?) = apply { body.config(config) } - - /** Alias for calling [Builder.config] with `config.orElse(null)`. */ - @Deprecated("deprecated") - fun config(config: Optional) = config(config.getOrNull()) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun config(config: JsonField) = apply { body.config(config) } - - /** Configuration for spreadsheet parsing and region extraction */ - fun configuration(configuration: SheetsParsingConfig?) = apply { - body.configuration(configuration) - } - - /** Alias for calling [Builder.configuration] with `configuration.orElse(null)`. */ - fun configuration(configuration: Optional) = - configuration(configuration.getOrNull()) - - /** - * Sets [Builder.configuration] to an arbitrary JSON value. - * - * You should usually call [Builder.configuration] with a well-typed [SheetsParsingConfig] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun configuration(configuration: JsonField) = apply { - body.configuration(configuration) - } - - /** Saved configuration ID */ - fun configurationId(configurationId: String?) = apply { - body.configurationId(configurationId) - } - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** - * Sets [Builder.configurationId] to an arbitrary JSON value. - * - * You should usually call [Builder.configurationId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun configurationId(configurationId: JsonField) = apply { - body.configurationId(configurationId) - } - - /** IDs of saved webhook configurations to notify for this job. */ - fun webhookConfigurationIds(webhookConfigurationIds: List?) = apply { - body.webhookConfigurationIds(webhookConfigurationIds) - } - - /** - * Alias for calling [Builder.webhookConfigurationIds] with - * `webhookConfigurationIds.orElse(null)`. - */ - fun webhookConfigurationIds(webhookConfigurationIds: Optional>) = - webhookConfigurationIds(webhookConfigurationIds.getOrNull()) - - /** - * Sets [Builder.webhookConfigurationIds] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurationIds] with a well-typed - * `List` value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun webhookConfigurationIds(webhookConfigurationIds: JsonField>) = apply { - body.webhookConfigurationIds(webhookConfigurationIds) - } - - /** - * Adds a single [String] to [webhookConfigurationIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfigurationId(webhookConfigurationId: String) = apply { - body.addWebhookConfigurationId(webhookConfigurationId) - } - - /** Outbound webhook endpoints to notify on job status changes */ - fun webhookConfigurations(webhookConfigurations: List?) = apply { - body.webhookConfigurations(webhookConfigurations) - } - - /** - * Alias for calling [Builder.webhookConfigurations] with - * `webhookConfigurations.orElse(null)`. - */ - fun webhookConfigurations(webhookConfigurations: Optional>) = - webhookConfigurations(webhookConfigurations.getOrNull()) - - /** - * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurations] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun webhookConfigurations(webhookConfigurations: JsonField>) = - apply { - body.webhookConfigurations(webhookConfigurations) - } - - /** - * Adds a single [WebhookConfiguration] to [webhookConfigurations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { - body.addWebhookConfiguration(webhookConfiguration) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetCreateParams = - SheetCreateParams( - organizationId, - projectId, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - /** - * Request to create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (inline) or `configuration_id` (saved preset). If - * neither is provided, a default inline configuration is used. - */ - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val fileId: JsonField, - private val config: JsonField, - private val configuration: JsonField, - private val configurationId: JsonField, - private val webhookConfigurationIds: JsonField>, - private val webhookConfigurations: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), - @JsonProperty("config") - @ExcludeMissing - config: JsonField = JsonMissing.of(), - @JsonProperty("configuration") - @ExcludeMissing - configuration: JsonField = JsonMissing.of(), - @JsonProperty("configuration_id") - @ExcludeMissing - configurationId: JsonField = JsonMissing.of(), - @JsonProperty("webhook_configuration_ids") - @ExcludeMissing - webhookConfigurationIds: JsonField> = JsonMissing.of(), - @JsonProperty("webhook_configurations") - @ExcludeMissing - webhookConfigurations: JsonField> = JsonMissing.of(), - ) : this( - fileId, - config, - configuration, - configurationId, - webhookConfigurationIds, - webhookConfigurations, - mutableMapOf(), - ) - - /** - * The ID of the file to parse - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileId(): String = fileId.getRequired("file_id") - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun config(): Optional = config.getOptional("config") - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun configuration(): Optional = - configuration.getOptional("configuration") - - /** - * Saved configuration ID - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun configurationId(): Optional = configurationId.getOptional("configuration_id") - - /** - * IDs of saved webhook configurations to notify for this job. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookConfigurationIds(): Optional> = - webhookConfigurationIds.getOptional("webhook_configuration_ids") - - /** - * Outbound webhook endpoints to notify on job status changes - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookConfigurations(): Optional> = - webhookConfigurations.getOptional("webhook_configurations") - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("config") - @ExcludeMissing - fun _config(): JsonField = config - - /** - * Returns the raw JSON value of [configuration]. - * - * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("configuration") - @ExcludeMissing - fun _configuration(): JsonField = configuration - - /** - * Returns the raw JSON value of [configurationId]. - * - * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("configuration_id") - @ExcludeMissing - fun _configurationId(): JsonField = configurationId - - /** - * Returns the raw JSON value of [webhookConfigurationIds]. - * - * Unlike [webhookConfigurationIds], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_configuration_ids") - @ExcludeMissing - fun _webhookConfigurationIds(): JsonField> = webhookConfigurationIds - - /** - * Returns the raw JSON value of [webhookConfigurations]. - * - * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_configurations") - @ExcludeMissing - fun _webhookConfigurations(): JsonField> = webhookConfigurations - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var fileId: JsonField? = null - private var config: JsonField = JsonMissing.of() - private var configuration: JsonField = JsonMissing.of() - private var configurationId: JsonField = JsonMissing.of() - private var webhookConfigurationIds: JsonField>? = null - private var webhookConfigurations: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - fileId = body.fileId - config = body.config - configuration = body.configuration - configurationId = body.configurationId - webhookConfigurationIds = body.webhookConfigurationIds.map { it.toMutableList() } - webhookConfigurations = body.webhookConfigurations.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The ID of the file to parse */ - fun fileId(fileId: String) = fileId(JsonField.of(fileId)) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - /** Configuration for spreadsheet parsing and region extraction */ - @Deprecated("deprecated") - fun config(config: SheetsParsingConfig?) = config(JsonField.ofNullable(config)) - - /** Alias for calling [Builder.config] with `config.orElse(null)`. */ - @Deprecated("deprecated") - fun config(config: Optional) = config(config.getOrNull()) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - @Deprecated("deprecated") - fun config(config: JsonField) = apply { this.config = config } - - /** Configuration for spreadsheet parsing and region extraction */ - fun configuration(configuration: SheetsParsingConfig?) = - configuration(JsonField.ofNullable(configuration)) - - /** Alias for calling [Builder.configuration] with `configuration.orElse(null)`. */ - fun configuration(configuration: Optional) = - configuration(configuration.getOrNull()) - - /** - * Sets [Builder.configuration] to an arbitrary JSON value. - * - * You should usually call [Builder.configuration] with a well-typed - * [SheetsParsingConfig] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun configuration(configuration: JsonField) = apply { - this.configuration = configuration - } - - /** Saved configuration ID */ - fun configurationId(configurationId: String?) = - configurationId(JsonField.ofNullable(configurationId)) - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** - * Sets [Builder.configurationId] to an arbitrary JSON value. - * - * You should usually call [Builder.configurationId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun configurationId(configurationId: JsonField) = apply { - this.configurationId = configurationId - } - - /** IDs of saved webhook configurations to notify for this job. */ - fun webhookConfigurationIds(webhookConfigurationIds: List?) = - webhookConfigurationIds(JsonField.ofNullable(webhookConfigurationIds)) - - /** - * Alias for calling [Builder.webhookConfigurationIds] with - * `webhookConfigurationIds.orElse(null)`. - */ - fun webhookConfigurationIds(webhookConfigurationIds: Optional>) = - webhookConfigurationIds(webhookConfigurationIds.getOrNull()) - - /** - * Sets [Builder.webhookConfigurationIds] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurationIds] with a well-typed - * `List` value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun webhookConfigurationIds(webhookConfigurationIds: JsonField>) = apply { - this.webhookConfigurationIds = webhookConfigurationIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [webhookConfigurationIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfigurationId(webhookConfigurationId: String) = apply { - webhookConfigurationIds = - (webhookConfigurationIds ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookConfigurationIds", it).add(webhookConfigurationId) - } - } - - /** Outbound webhook endpoints to notify on job status changes */ - fun webhookConfigurations(webhookConfigurations: List?) = - webhookConfigurations(JsonField.ofNullable(webhookConfigurations)) - - /** - * Alias for calling [Builder.webhookConfigurations] with - * `webhookConfigurations.orElse(null)`. - */ - fun webhookConfigurations(webhookConfigurations: Optional>) = - webhookConfigurations(webhookConfigurations.getOrNull()) - - /** - * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurations] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun webhookConfigurations( - webhookConfigurations: JsonField> - ) = apply { - this.webhookConfigurations = webhookConfigurations.map { it.toMutableList() } - } - - /** - * Adds a single [WebhookConfiguration] to [webhookConfigurations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { - webhookConfigurations = - (webhookConfigurations ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookConfigurations", it).add(webhookConfiguration) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("fileId", fileId), - config, - configuration, - configurationId, - (webhookConfigurationIds ?: JsonMissing.of()).map { it.toImmutable() }, - (webhookConfigurations ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Body = apply { - if (validated) { - return@apply - } - - fileId() - config().ifPresent { it.validate() } - configuration().ifPresent { it.validate() } - configurationId() - webhookConfigurationIds() - webhookConfigurations().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (fileId.asKnown().isPresent) 1 else 0) + - (config.asKnown().getOrNull()?.validity() ?: 0) + - (configuration.asKnown().getOrNull()?.validity() ?: 0) + - (if (configurationId.asKnown().isPresent) 1 else 0) + - (webhookConfigurationIds.asKnown().getOrNull()?.size ?: 0) + - (webhookConfigurations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - fileId == other.fileId && - config == other.config && - configuration == other.configuration && - configurationId == other.configurationId && - webhookConfigurationIds == other.webhookConfigurationIds && - webhookConfigurations == other.webhookConfigurations && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - fileId, - config, - configuration, - configurationId, - webhookConfigurationIds, - webhookConfigurations, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{fileId=$fileId, config=$config, configuration=$configuration, configurationId=$configurationId, webhookConfigurationIds=$webhookConfigurationIds, webhookConfigurations=$webhookConfigurations, additionalProperties=$additionalProperties}" - } - - /** Configuration for a single outbound webhook endpoint. */ - class WebhookConfiguration - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val webhookEvents: JsonField>, - private val webhookHeaders: JsonField, - private val webhookOutputFormat: JsonField, - private val webhookSigningSecret: JsonField, - private val webhookUrl: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("webhook_events") - @ExcludeMissing - webhookEvents: JsonField> = JsonMissing.of(), - @JsonProperty("webhook_headers") - @ExcludeMissing - webhookHeaders: JsonField = JsonMissing.of(), - @JsonProperty("webhook_output_format") - @ExcludeMissing - webhookOutputFormat: JsonField = JsonMissing.of(), - @JsonProperty("webhook_signing_secret") - @ExcludeMissing - webhookSigningSecret: JsonField = JsonMissing.of(), - @JsonProperty("webhook_url") - @ExcludeMissing - webhookUrl: JsonField = JsonMissing.of(), - ) : this( - webhookEvents, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - mutableMapOf(), - ) - - /** - * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events are - * delivered. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookEvents(): Optional> = - webhookEvents.getOptional("webhook_events") - - /** - * Custom HTTP headers sent with each webhook request (e.g. auth tokens) - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookHeaders(): Optional = - webhookHeaders.getOptional("webhook_headers") - - /** - * Response format sent to the webhook: 'string' (default) or 'json' - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookOutputFormat(): Optional = - webhookOutputFormat.getOptional("webhook_output_format") - - /** - * Shared signing secret used to sign webhook deliveries. When set, each request includes an - * HMAC-SHA256 signature of the request body in the 'LC-Signature' header (value - * 'sha256='). Recompute the HMAC over the raw request body with this secret to verify - * the delivery is authentic. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookSigningSecret(): Optional = - webhookSigningSecret.getOptional("webhook_signing_secret") - - /** - * URL to receive webhook POST notifications - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookUrl(): Optional = webhookUrl.getOptional("webhook_url") - - /** - * Returns the raw JSON value of [webhookEvents]. - * - * Unlike [webhookEvents], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("webhook_events") - @ExcludeMissing - fun _webhookEvents(): JsonField> = webhookEvents - - /** - * Returns the raw JSON value of [webhookHeaders]. - * - * Unlike [webhookHeaders], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("webhook_headers") - @ExcludeMissing - fun _webhookHeaders(): JsonField = webhookHeaders - - /** - * Returns the raw JSON value of [webhookOutputFormat]. - * - * Unlike [webhookOutputFormat], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_output_format") - @ExcludeMissing - fun _webhookOutputFormat(): JsonField = webhookOutputFormat - - /** - * Returns the raw JSON value of [webhookSigningSecret]. - * - * Unlike [webhookSigningSecret], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_signing_secret") - @ExcludeMissing - fun _webhookSigningSecret(): JsonField = webhookSigningSecret - - /** - * Returns the raw JSON value of [webhookUrl]. - * - * Unlike [webhookUrl], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("webhook_url") - @ExcludeMissing - fun _webhookUrl(): JsonField = webhookUrl - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [WebhookConfiguration]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WebhookConfiguration]. */ - class Builder internal constructor() { - - private var webhookEvents: JsonField>? = null - private var webhookHeaders: JsonField = JsonMissing.of() - private var webhookOutputFormat: JsonField = JsonMissing.of() - private var webhookSigningSecret: JsonField = JsonMissing.of() - private var webhookUrl: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(webhookConfiguration: WebhookConfiguration) = apply { - webhookEvents = webhookConfiguration.webhookEvents.map { it.toMutableList() } - webhookHeaders = webhookConfiguration.webhookHeaders - webhookOutputFormat = webhookConfiguration.webhookOutputFormat - webhookSigningSecret = webhookConfiguration.webhookSigningSecret - webhookUrl = webhookConfiguration.webhookUrl - additionalProperties = webhookConfiguration.additionalProperties.toMutableMap() - } - - /** - * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events - * are delivered. - */ - fun webhookEvents(webhookEvents: List?) = - webhookEvents(JsonField.ofNullable(webhookEvents)) - - /** Alias for calling [Builder.webhookEvents] with `webhookEvents.orElse(null)`. */ - fun webhookEvents(webhookEvents: Optional>) = - webhookEvents(webhookEvents.getOrNull()) - - /** - * Sets [Builder.webhookEvents] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookEvents] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun webhookEvents(webhookEvents: JsonField>) = apply { - this.webhookEvents = webhookEvents.map { it.toMutableList() } - } - - /** - * Adds a single [WebhookEvent] to [webhookEvents]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookEvent(webhookEvent: WebhookEvent) = apply { - webhookEvents = - (webhookEvents ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookEvents", it).add(webhookEvent) - } - } - - /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ - fun webhookHeaders(webhookHeaders: WebhookHeaders?) = - webhookHeaders(JsonField.ofNullable(webhookHeaders)) - - /** Alias for calling [Builder.webhookHeaders] with `webhookHeaders.orElse(null)`. */ - fun webhookHeaders(webhookHeaders: Optional) = - webhookHeaders(webhookHeaders.getOrNull()) - - /** - * Sets [Builder.webhookHeaders] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookHeaders] with a well-typed [WebhookHeaders] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun webhookHeaders(webhookHeaders: JsonField) = apply { - this.webhookHeaders = webhookHeaders - } - - /** Response format sent to the webhook: 'string' (default) or 'json' */ - fun webhookOutputFormat(webhookOutputFormat: String?) = - webhookOutputFormat(JsonField.ofNullable(webhookOutputFormat)) - - /** - * Alias for calling [Builder.webhookOutputFormat] with - * `webhookOutputFormat.orElse(null)`. - */ - fun webhookOutputFormat(webhookOutputFormat: Optional) = - webhookOutputFormat(webhookOutputFormat.getOrNull()) - - /** - * Sets [Builder.webhookOutputFormat] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookOutputFormat] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun webhookOutputFormat(webhookOutputFormat: JsonField) = apply { - this.webhookOutputFormat = webhookOutputFormat - } - - /** - * Shared signing secret used to sign webhook deliveries. When set, each request - * includes an HMAC-SHA256 signature of the request body in the 'LC-Signature' header - * (value 'sha256='). Recompute the HMAC over the raw request body with this secret - * to verify the delivery is authentic. - */ - fun webhookSigningSecret(webhookSigningSecret: String?) = - webhookSigningSecret(JsonField.ofNullable(webhookSigningSecret)) - - /** - * Alias for calling [Builder.webhookSigningSecret] with - * `webhookSigningSecret.orElse(null)`. - */ - fun webhookSigningSecret(webhookSigningSecret: Optional) = - webhookSigningSecret(webhookSigningSecret.getOrNull()) - - /** - * Sets [Builder.webhookSigningSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookSigningSecret] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun webhookSigningSecret(webhookSigningSecret: JsonField) = apply { - this.webhookSigningSecret = webhookSigningSecret - } - - /** URL to receive webhook POST notifications */ - fun webhookUrl(webhookUrl: String?) = webhookUrl(JsonField.ofNullable(webhookUrl)) - - /** Alias for calling [Builder.webhookUrl] with `webhookUrl.orElse(null)`. */ - fun webhookUrl(webhookUrl: Optional) = webhookUrl(webhookUrl.getOrNull()) - - /** - * Sets [Builder.webhookUrl] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookUrl] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun webhookUrl(webhookUrl: JsonField) = apply { this.webhookUrl = webhookUrl } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WebhookConfiguration]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): WebhookConfiguration = - WebhookConfiguration( - (webhookEvents ?: JsonMissing.of()).map { it.toImmutable() }, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): WebhookConfiguration = apply { - if (validated) { - return@apply - } - - webhookEvents().ifPresent { it.forEach { it.validate() } } - webhookHeaders().ifPresent { it.validate() } - webhookOutputFormat() - webhookSigningSecret() - webhookUrl() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (webhookEvents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (webhookHeaders.asKnown().getOrNull()?.validity() ?: 0) + - (if (webhookOutputFormat.asKnown().isPresent) 1 else 0) + - (if (webhookSigningSecret.asKnown().isPresent) 1 else 0) + - (if (webhookUrl.asKnown().isPresent) 1 else 0) - - class WebhookEvent @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BATCH_CANCELLED = of("batch.cancelled") - - @JvmField val BATCH_ERROR = of("batch.error") - - @JvmField val BATCH_PENDING = of("batch.pending") - - @JvmField val BATCH_RUNNING = of("batch.running") - - @JvmField val BATCH_SUCCESS = of("batch.success") - - @JvmField val CLASSIFY_CANCELLED = of("classify.cancelled") - - @JvmField val CLASSIFY_ERROR = of("classify.error") - - @JvmField val CLASSIFY_PARTIAL_SUCCESS = of("classify.partial_success") - - @JvmField val CLASSIFY_PENDING = of("classify.pending") - - @JvmField val CLASSIFY_RUNNING = of("classify.running") - - @JvmField val CLASSIFY_SUCCESS = of("classify.success") - - @JvmField val EXTRACT_CANCELLED = of("extract.cancelled") - - @JvmField val EXTRACT_ERROR = of("extract.error") - - @JvmField val EXTRACT_PARTIAL_SUCCESS = of("extract.partial_success") - - @JvmField val EXTRACT_PENDING = of("extract.pending") - - @JvmField val EXTRACT_SUCCESS = of("extract.success") - - @JvmField val PARSE_CANCELLED = of("parse.cancelled") - - @JvmField val PARSE_ERROR = of("parse.error") - - @JvmField val PARSE_PARTIAL_SUCCESS = of("parse.partial_success") - - @JvmField val PARSE_PENDING = of("parse.pending") - - @JvmField val PARSE_RUNNING = of("parse.running") - - @JvmField val PARSE_SUCCESS = of("parse.success") - - @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") - - @JvmField val SHEETS_ERROR = of("sheets.error") - - @JvmField val SHEETS_PARTIAL_SUCCESS = of("sheets.partial_success") - - @JvmField val SHEETS_PENDING = of("sheets.pending") - - @JvmField val SHEETS_SUCCESS = of("sheets.success") - - @JvmField val SPLIT_CANCELLED = of("split.cancelled") - - @JvmField val SPLIT_ERROR = of("split.error") - - @JvmField val SPLIT_PENDING = of("split.pending") - - @JvmField val SPLIT_PROCESSING = of("split.processing") - - @JvmField val SPLIT_SUCCESS = of("split.success") - - @JvmField val UNMAPPED_EVENT = of("unmapped_event") - - @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) - } - - /** An enum containing [WebhookEvent]'s known values. */ - enum class Known { - BATCH_CANCELLED, - BATCH_ERROR, - BATCH_PENDING, - BATCH_RUNNING, - BATCH_SUCCESS, - CLASSIFY_CANCELLED, - CLASSIFY_ERROR, - CLASSIFY_PARTIAL_SUCCESS, - CLASSIFY_PENDING, - CLASSIFY_RUNNING, - CLASSIFY_SUCCESS, - EXTRACT_CANCELLED, - EXTRACT_ERROR, - EXTRACT_PARTIAL_SUCCESS, - EXTRACT_PENDING, - EXTRACT_SUCCESS, - PARSE_CANCELLED, - PARSE_ERROR, - PARSE_PARTIAL_SUCCESS, - PARSE_PENDING, - PARSE_RUNNING, - PARSE_SUCCESS, - SHEETS_CANCELLED, - SHEETS_ERROR, - SHEETS_PARTIAL_SUCCESS, - SHEETS_PENDING, - SHEETS_SUCCESS, - SPLIT_CANCELLED, - SPLIT_ERROR, - SPLIT_PENDING, - SPLIT_PROCESSING, - SPLIT_SUCCESS, - UNMAPPED_EVENT, - } - - /** - * An enum containing [WebhookEvent]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WebhookEvent] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BATCH_CANCELLED, - BATCH_ERROR, - BATCH_PENDING, - BATCH_RUNNING, - BATCH_SUCCESS, - CLASSIFY_CANCELLED, - CLASSIFY_ERROR, - CLASSIFY_PARTIAL_SUCCESS, - CLASSIFY_PENDING, - CLASSIFY_RUNNING, - CLASSIFY_SUCCESS, - EXTRACT_CANCELLED, - EXTRACT_ERROR, - EXTRACT_PARTIAL_SUCCESS, - EXTRACT_PENDING, - EXTRACT_SUCCESS, - PARSE_CANCELLED, - PARSE_ERROR, - PARSE_PARTIAL_SUCCESS, - PARSE_PENDING, - PARSE_RUNNING, - PARSE_SUCCESS, - SHEETS_CANCELLED, - SHEETS_ERROR, - SHEETS_PARTIAL_SUCCESS, - SHEETS_PENDING, - SHEETS_SUCCESS, - SPLIT_CANCELLED, - SPLIT_ERROR, - SPLIT_PENDING, - SPLIT_PROCESSING, - SPLIT_SUCCESS, - UNMAPPED_EVENT, - /** - * An enum member indicating that [WebhookEvent] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BATCH_CANCELLED -> Value.BATCH_CANCELLED - BATCH_ERROR -> Value.BATCH_ERROR - BATCH_PENDING -> Value.BATCH_PENDING - BATCH_RUNNING -> Value.BATCH_RUNNING - BATCH_SUCCESS -> Value.BATCH_SUCCESS - CLASSIFY_CANCELLED -> Value.CLASSIFY_CANCELLED - CLASSIFY_ERROR -> Value.CLASSIFY_ERROR - CLASSIFY_PARTIAL_SUCCESS -> Value.CLASSIFY_PARTIAL_SUCCESS - CLASSIFY_PENDING -> Value.CLASSIFY_PENDING - CLASSIFY_RUNNING -> Value.CLASSIFY_RUNNING - CLASSIFY_SUCCESS -> Value.CLASSIFY_SUCCESS - EXTRACT_CANCELLED -> Value.EXTRACT_CANCELLED - EXTRACT_ERROR -> Value.EXTRACT_ERROR - EXTRACT_PARTIAL_SUCCESS -> Value.EXTRACT_PARTIAL_SUCCESS - EXTRACT_PENDING -> Value.EXTRACT_PENDING - EXTRACT_SUCCESS -> Value.EXTRACT_SUCCESS - PARSE_CANCELLED -> Value.PARSE_CANCELLED - PARSE_ERROR -> Value.PARSE_ERROR - PARSE_PARTIAL_SUCCESS -> Value.PARSE_PARTIAL_SUCCESS - PARSE_PENDING -> Value.PARSE_PENDING - PARSE_RUNNING -> Value.PARSE_RUNNING - PARSE_SUCCESS -> Value.PARSE_SUCCESS - SHEETS_CANCELLED -> Value.SHEETS_CANCELLED - SHEETS_ERROR -> Value.SHEETS_ERROR - SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS - SHEETS_PENDING -> Value.SHEETS_PENDING - SHEETS_SUCCESS -> Value.SHEETS_SUCCESS - SPLIT_CANCELLED -> Value.SPLIT_CANCELLED - SPLIT_ERROR -> Value.SPLIT_ERROR - SPLIT_PENDING -> Value.SPLIT_PENDING - SPLIT_PROCESSING -> Value.SPLIT_PROCESSING - SPLIT_SUCCESS -> Value.SPLIT_SUCCESS - UNMAPPED_EVENT -> Value.UNMAPPED_EVENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BATCH_CANCELLED -> Known.BATCH_CANCELLED - BATCH_ERROR -> Known.BATCH_ERROR - BATCH_PENDING -> Known.BATCH_PENDING - BATCH_RUNNING -> Known.BATCH_RUNNING - BATCH_SUCCESS -> Known.BATCH_SUCCESS - CLASSIFY_CANCELLED -> Known.CLASSIFY_CANCELLED - CLASSIFY_ERROR -> Known.CLASSIFY_ERROR - CLASSIFY_PARTIAL_SUCCESS -> Known.CLASSIFY_PARTIAL_SUCCESS - CLASSIFY_PENDING -> Known.CLASSIFY_PENDING - CLASSIFY_RUNNING -> Known.CLASSIFY_RUNNING - CLASSIFY_SUCCESS -> Known.CLASSIFY_SUCCESS - EXTRACT_CANCELLED -> Known.EXTRACT_CANCELLED - EXTRACT_ERROR -> Known.EXTRACT_ERROR - EXTRACT_PARTIAL_SUCCESS -> Known.EXTRACT_PARTIAL_SUCCESS - EXTRACT_PENDING -> Known.EXTRACT_PENDING - EXTRACT_SUCCESS -> Known.EXTRACT_SUCCESS - PARSE_CANCELLED -> Known.PARSE_CANCELLED - PARSE_ERROR -> Known.PARSE_ERROR - PARSE_PARTIAL_SUCCESS -> Known.PARSE_PARTIAL_SUCCESS - PARSE_PENDING -> Known.PARSE_PENDING - PARSE_RUNNING -> Known.PARSE_RUNNING - PARSE_SUCCESS -> Known.PARSE_SUCCESS - SHEETS_CANCELLED -> Known.SHEETS_CANCELLED - SHEETS_ERROR -> Known.SHEETS_ERROR - SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS - SHEETS_PENDING -> Known.SHEETS_PENDING - SHEETS_SUCCESS -> Known.SHEETS_SUCCESS - SPLIT_CANCELLED -> Known.SPLIT_CANCELLED - SPLIT_ERROR -> Known.SPLIT_ERROR - SPLIT_PENDING -> Known.SPLIT_PENDING - SPLIT_PROCESSING -> Known.SPLIT_PROCESSING - SPLIT_SUCCESS -> Known.SPLIT_SUCCESS - UNMAPPED_EVENT -> Known.UNMAPPED_EVENT - else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): WebhookEvent = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookEvent && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ - class WebhookHeaders - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [WebhookHeaders]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WebhookHeaders]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(webhookHeaders: WebhookHeaders) = apply { - additionalProperties = webhookHeaders.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WebhookHeaders]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): WebhookHeaders = WebhookHeaders(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): WebhookHeaders = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookHeaders && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "WebhookHeaders{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookConfiguration && - webhookEvents == other.webhookEvents && - webhookHeaders == other.webhookHeaders && - webhookOutputFormat == other.webhookOutputFormat && - webhookSigningSecret == other.webhookSigningSecret && - webhookUrl == other.webhookUrl && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - webhookEvents, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WebhookConfiguration{webhookEvents=$webhookEvents, webhookHeaders=$webhookHeaders, webhookOutputFormat=$webhookOutputFormat, webhookSigningSecret=$webhookSigningSecret, webhookUrl=$webhookUrl, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetCreateParams && - organizationId == other.organizationId && - projectId == other.projectId && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(organizationId, projectId, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "SheetCreateParams{organizationId=$organizationId, projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParams.kt deleted file mode 100644 index 2c956bb..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParams.kt +++ /dev/null @@ -1,272 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Delete a spreadsheet parsing job and its associated data. */ -@Deprecated("deprecated") -class SheetDeleteJobParams -private constructor( - private val spreadsheetJobId: String?, - private val organizationId: String?, - private val projectId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - fun spreadsheetJobId(): Optional = Optional.ofNullable(spreadsheetJobId) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SheetDeleteJobParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [SheetDeleteJobParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetDeleteJobParams]. */ - class Builder internal constructor() { - - private var spreadsheetJobId: String? = null - private var organizationId: String? = null - private var projectId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetDeleteJobParams: SheetDeleteJobParams) = apply { - spreadsheetJobId = sheetDeleteJobParams.spreadsheetJobId - organizationId = sheetDeleteJobParams.organizationId - projectId = sheetDeleteJobParams.projectId - additionalHeaders = sheetDeleteJobParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetDeleteJobParams.additionalQueryParams.toBuilder() - additionalBodyProperties = sheetDeleteJobParams.additionalBodyProperties.toMutableMap() - } - - fun spreadsheetJobId(spreadsheetJobId: String?) = apply { - this.spreadsheetJobId = spreadsheetJobId - } - - /** Alias for calling [Builder.spreadsheetJobId] with `spreadsheetJobId.orElse(null)`. */ - fun spreadsheetJobId(spreadsheetJobId: Optional) = - spreadsheetJobId(spreadsheetJobId.getOrNull()) - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [SheetDeleteJobParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetDeleteJobParams = - SheetDeleteJobParams( - spreadsheetJobId, - organizationId, - projectId, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> spreadsheetJobId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetDeleteJobParams && - spreadsheetJobId == other.spreadsheetJobId && - organizationId == other.organizationId && - projectId == other.projectId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash( - spreadsheetJobId, - organizationId, - projectId, - additionalHeaders, - additionalQueryParams, - additionalBodyProperties, - ) - - override fun toString() = - "SheetDeleteJobParams{spreadsheetJobId=$spreadsheetJobId, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponse.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponse.kt deleted file mode 100644 index a63c228..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponse.kt +++ /dev/null @@ -1,122 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import java.util.Collections -import java.util.Objects - -class SheetDeleteJobResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [SheetDeleteJobResponse]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetDeleteJobResponse]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetDeleteJobResponse: SheetDeleteJobResponse) = apply { - additionalProperties = sheetDeleteJobResponse.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SheetDeleteJobResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetDeleteJobResponse = - SheetDeleteJobResponse(additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SheetDeleteJobResponse = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = 0 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetDeleteJobResponse && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "SheetDeleteJobResponse{additionalProperties=$additionalProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParams.kt deleted file mode 100644 index a058db1..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParams.kt +++ /dev/null @@ -1,291 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted regions - * and results if complete, skipping the separate `/results` call. - */ -@Deprecated("deprecated") -class SheetGetParams -private constructor( - private val spreadsheetJobId: String?, - private val expand: List?, - private val includeResults: Boolean?, - private val organizationId: String?, - private val projectId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun spreadsheetJobId(): Optional = Optional.ofNullable(spreadsheetJobId) - - /** Optional fields to populate on the response. Valid values: metadata_state_transitions. */ - fun expand(): Optional> = Optional.ofNullable(expand) - - fun includeResults(): Optional = Optional.ofNullable(includeResults) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SheetGetParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [SheetGetParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetGetParams]. */ - class Builder internal constructor() { - - private var spreadsheetJobId: String? = null - private var expand: MutableList? = null - private var includeResults: Boolean? = null - private var organizationId: String? = null - private var projectId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetGetParams: SheetGetParams) = apply { - spreadsheetJobId = sheetGetParams.spreadsheetJobId - expand = sheetGetParams.expand?.toMutableList() - includeResults = sheetGetParams.includeResults - organizationId = sheetGetParams.organizationId - projectId = sheetGetParams.projectId - additionalHeaders = sheetGetParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetGetParams.additionalQueryParams.toBuilder() - } - - fun spreadsheetJobId(spreadsheetJobId: String?) = apply { - this.spreadsheetJobId = spreadsheetJobId - } - - /** Alias for calling [Builder.spreadsheetJobId] with `spreadsheetJobId.orElse(null)`. */ - fun spreadsheetJobId(spreadsheetJobId: Optional) = - spreadsheetJobId(spreadsheetJobId.getOrNull()) - - /** - * Optional fields to populate on the response. Valid values: metadata_state_transitions. - */ - fun expand(expand: List?) = apply { this.expand = expand?.toMutableList() } - - /** Alias for calling [Builder.expand] with `expand.orElse(null)`. */ - fun expand(expand: Optional>) = expand(expand.getOrNull()) - - /** - * Adds a single [String] to [Builder.expand]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExpand(expand: String) = apply { - this.expand = (this.expand ?: mutableListOf()).apply { add(expand) } - } - - fun includeResults(includeResults: Boolean?) = apply { - this.includeResults = includeResults - } - - /** - * Alias for [Builder.includeResults]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) - - /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ - fun includeResults(includeResults: Optional) = - includeResults(includeResults.getOrNull()) - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetGetParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetGetParams = - SheetGetParams( - spreadsheetJobId, - expand?.toImmutable(), - includeResults, - organizationId, - projectId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> spreadsheetJobId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - expand?.forEach { put("expand", it) } - includeResults?.let { put("include_results", it.toString()) } - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetGetParams && - spreadsheetJobId == other.spreadsheetJobId && - expand == other.expand && - includeResults == other.includeResults && - organizationId == other.organizationId && - projectId == other.projectId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - spreadsheetJobId, - expand, - includeResults, - organizationId, - projectId, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "SheetGetParams{spreadsheetJobId=$spreadsheetJobId, expand=$expand, includeResults=$includeResults, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParams.kt deleted file mode 100644 index 85a11cc..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParams.kt +++ /dev/null @@ -1,444 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonCreator -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Generate a presigned URL to download a specific extracted region. */ -@Deprecated("deprecated") -class SheetGetResultTableParams -private constructor( - private val spreadsheetJobId: String, - private val regionId: String, - private val regionType: RegionType?, - private val expiresAtSeconds: Long?, - private val organizationId: String?, - private val projectId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun spreadsheetJobId(): String = spreadsheetJobId - - fun regionId(): String = regionId - - fun regionType(): Optional = Optional.ofNullable(regionType) - - fun expiresAtSeconds(): Optional = Optional.ofNullable(expiresAtSeconds) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetGetResultTableParams]. - * - * The following fields are required: - * ```java - * .spreadsheetJobId() - * .regionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetGetResultTableParams]. */ - class Builder internal constructor() { - - private var spreadsheetJobId: String? = null - private var regionId: String? = null - private var regionType: RegionType? = null - private var expiresAtSeconds: Long? = null - private var organizationId: String? = null - private var projectId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetGetResultTableParams: SheetGetResultTableParams) = apply { - spreadsheetJobId = sheetGetResultTableParams.spreadsheetJobId - regionId = sheetGetResultTableParams.regionId - regionType = sheetGetResultTableParams.regionType - expiresAtSeconds = sheetGetResultTableParams.expiresAtSeconds - organizationId = sheetGetResultTableParams.organizationId - projectId = sheetGetResultTableParams.projectId - additionalHeaders = sheetGetResultTableParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetGetResultTableParams.additionalQueryParams.toBuilder() - } - - fun spreadsheetJobId(spreadsheetJobId: String) = apply { - this.spreadsheetJobId = spreadsheetJobId - } - - fun regionId(regionId: String) = apply { this.regionId = regionId } - - fun regionType(regionType: RegionType?) = apply { this.regionType = regionType } - - /** Alias for calling [Builder.regionType] with `regionType.orElse(null)`. */ - fun regionType(regionType: Optional) = regionType(regionType.getOrNull()) - - fun expiresAtSeconds(expiresAtSeconds: Long?) = apply { - this.expiresAtSeconds = expiresAtSeconds - } - - /** - * Alias for [Builder.expiresAtSeconds]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun expiresAtSeconds(expiresAtSeconds: Long) = expiresAtSeconds(expiresAtSeconds as Long?) - - /** Alias for calling [Builder.expiresAtSeconds] with `expiresAtSeconds.orElse(null)`. */ - fun expiresAtSeconds(expiresAtSeconds: Optional) = - expiresAtSeconds(expiresAtSeconds.getOrNull()) - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetGetResultTableParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .spreadsheetJobId() - * .regionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetGetResultTableParams = - SheetGetResultTableParams( - checkRequired("spreadsheetJobId", spreadsheetJobId), - checkRequired("regionId", regionId), - regionType, - expiresAtSeconds, - organizationId, - projectId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> spreadsheetJobId - 1 -> regionId - 2 -> regionType?.toString() ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - expiresAtSeconds?.let { put("expires_at_seconds", it.toString()) } - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - class RegionType @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CELL_METADATA = of("cell_metadata") - - @JvmField val EXTRA = of("extra") - - @JvmField val TABLE = of("table") - - @JvmStatic fun of(value: String) = RegionType(JsonField.of(value)) - } - - /** An enum containing [RegionType]'s known values. */ - enum class Known { - CELL_METADATA, - EXTRA, - TABLE, - } - - /** - * An enum containing [RegionType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [RegionType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CELL_METADATA, - EXTRA, - TABLE, - /** - * An enum member indicating that [RegionType] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CELL_METADATA -> Value.CELL_METADATA - EXTRA -> Value.EXTRA - TABLE -> Value.TABLE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CELL_METADATA -> Known.CELL_METADATA - EXTRA -> Known.EXTRA - TABLE -> Known.TABLE - else -> throw LlamaCloudInvalidDataException("Unknown RegionType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): RegionType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RegionType && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetGetResultTableParams && - spreadsheetJobId == other.spreadsheetJobId && - regionId == other.regionId && - regionType == other.regionType && - expiresAtSeconds == other.expiresAtSeconds && - organizationId == other.organizationId && - projectId == other.projectId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - spreadsheetJobId, - regionId, - regionType, - expiresAtSeconds, - organizationId, - projectId, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "SheetGetResultTableParams{spreadsheetJobId=$spreadsheetJobId, regionId=$regionId, regionType=$regionType, expiresAtSeconds=$expiresAtSeconds, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPage.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPage.kt deleted file mode 100644 index 7f97cd8..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPage.kt +++ /dev/null @@ -1,131 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.AutoPager -import ai.llamaindex.llamacloud.core.Page -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.services.blocking.beta.SheetService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see SheetService.list */ -@Deprecated("deprecated") -class SheetListPage -private constructor( - private val service: SheetService, - private val params: SheetListParams, - private val response: SheetListPageResponse, -) : Page { - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.items - */ - override fun items(): List = - response._items().getOptional("items").getOrNull() ?: emptyList() - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.nextPageToken - */ - fun nextPageToken(): Optional = response._nextPageToken().getOptional("next_page_token") - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageToken().isPresent - - fun nextPageParams(): SheetListParams { - val nextCursor = - nextPageToken().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().pageToken(nextCursor).build() - } - - override fun nextPage(): SheetListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): SheetListParams = params - - /** The response that this page was parsed from. */ - fun response(): SheetListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListPage]. */ - class Builder internal constructor() { - - private var service: SheetService? = null - private var params: SheetListParams? = null - private var response: SheetListPageResponse? = null - - @JvmSynthetic - internal fun from(sheetListPage: SheetListPage) = apply { - service = sheetListPage.service - params = sheetListPage.params - response = sheetListPage.response - } - - fun service(service: SheetService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: SheetListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: SheetListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [SheetListPage]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetListPage = - SheetListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = "SheetListPage{service=$service, params=$params, response=$response}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageAsync.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageAsync.kt deleted file mode 100644 index 0f6fa9c..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageAsync.kt +++ /dev/null @@ -1,145 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.AutoPagerAsync -import ai.llamaindex.llamacloud.core.PageAsync -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.services.async.beta.SheetServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see SheetServiceAsync.list */ -@Deprecated("deprecated") -class SheetListPageAsync -private constructor( - private val service: SheetServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: SheetListParams, - private val response: SheetListPageResponse, -) : PageAsync { - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.items - */ - override fun items(): List = - response._items().getOptional("items").getOrNull() ?: emptyList() - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.nextPageToken - */ - fun nextPageToken(): Optional = response._nextPageToken().getOptional("next_page_token") - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageToken().isPresent - - fun nextPageParams(): SheetListParams { - val nextCursor = - nextPageToken().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().pageToken(nextCursor).build() - } - - override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - - fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) - - /** The parameters that were used to request this page. */ - fun params(): SheetListParams = params - - /** The response that this page was parsed from. */ - fun response(): SheetListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListPageAsync]. */ - class Builder internal constructor() { - - private var service: SheetServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: SheetListParams? = null - private var response: SheetListPageResponse? = null - - @JvmSynthetic - internal fun from(sheetListPageAsync: SheetListPageAsync) = apply { - service = sheetListPageAsync.service - streamHandlerExecutor = sheetListPageAsync.streamHandlerExecutor - params = sheetListPageAsync.params - response = sheetListPageAsync.response - } - - fun service(service: SheetServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: SheetListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: SheetListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [SheetListPageAsync]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetListPageAsync = - SheetListPageAsync( - checkRequired("service", service), - checkRequired("streamHandlerExecutor", streamHandlerExecutor), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListPageAsync && - service == other.service && - streamHandlerExecutor == other.streamHandlerExecutor && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) - - override fun toString() = - "SheetListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponse.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponse.kt deleted file mode 100644 index 8d60ff4..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponse.kt +++ /dev/null @@ -1,301 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.JsonMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.checkKnown -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Response schema for paginated spreadsheet job queries. */ -class SheetListPageResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val items: JsonField>, - private val nextPageToken: JsonField, - private val totalSize: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), - @JsonProperty("next_page_token") - @ExcludeMissing - nextPageToken: JsonField = JsonMissing.of(), - @JsonProperty("total_size") @ExcludeMissing totalSize: JsonField = JsonMissing.of(), - ) : this(items, nextPageToken, totalSize, mutableMapOf()) - - /** - * The list of items. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun items(): List = items.getRequired("items") - - /** - * A token, which can be sent as page_token to retrieve the next page. If this field is omitted, - * there are no subsequent pages. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun nextPageToken(): Optional = nextPageToken.getOptional("next_page_token") - - /** - * The total number of items available. This is only populated when specifically requested. The - * value may be an estimate and can be used for display purposes only. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun totalSize(): Optional = totalSize.getOptional("total_size") - - /** - * Returns the raw JSON value of [items]. - * - * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items - - /** - * Returns the raw JSON value of [nextPageToken]. - * - * Unlike [nextPageToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("next_page_token") - @ExcludeMissing - fun _nextPageToken(): JsonField = nextPageToken - - /** - * Returns the raw JSON value of [totalSize]. - * - * Unlike [totalSize], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("total_size") @ExcludeMissing fun _totalSize(): JsonField = totalSize - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetListPageResponse]. - * - * The following fields are required: - * ```java - * .items() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListPageResponse]. */ - class Builder internal constructor() { - - private var items: JsonField>? = null - private var nextPageToken: JsonField = JsonMissing.of() - private var totalSize: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetListPageResponse: SheetListPageResponse) = apply { - items = sheetListPageResponse.items.map { it.toMutableList() } - nextPageToken = sheetListPageResponse.nextPageToken - totalSize = sheetListPageResponse.totalSize - additionalProperties = sheetListPageResponse.additionalProperties.toMutableMap() - } - - /** The list of items. */ - fun items(items: List) = items(JsonField.of(items)) - - /** - * Sets [Builder.items] to an arbitrary JSON value. - * - * You should usually call [Builder.items] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun items(items: JsonField>) = apply { - this.items = items.map { it.toMutableList() } - } - - /** - * Adds a single [SheetsJob] to [items]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addItem(item: SheetsJob) = apply { - items = - (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } - } - - /** - * A token, which can be sent as page_token to retrieve the next page. If this field is - * omitted, there are no subsequent pages. - */ - fun nextPageToken(nextPageToken: String?) = - nextPageToken(JsonField.ofNullable(nextPageToken)) - - /** Alias for calling [Builder.nextPageToken] with `nextPageToken.orElse(null)`. */ - fun nextPageToken(nextPageToken: Optional) = - nextPageToken(nextPageToken.getOrNull()) - - /** - * Sets [Builder.nextPageToken] to an arbitrary JSON value. - * - * You should usually call [Builder.nextPageToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun nextPageToken(nextPageToken: JsonField) = apply { - this.nextPageToken = nextPageToken - } - - /** - * The total number of items available. This is only populated when specifically requested. - * The value may be an estimate and can be used for display purposes only. - */ - fun totalSize(totalSize: Long?) = totalSize(JsonField.ofNullable(totalSize)) - - /** - * Alias for [Builder.totalSize]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalSize(totalSize: Long) = totalSize(totalSize as Long?) - - /** Alias for calling [Builder.totalSize] with `totalSize.orElse(null)`. */ - fun totalSize(totalSize: Optional) = totalSize(totalSize.getOrNull()) - - /** - * Sets [Builder.totalSize] to an arbitrary JSON value. - * - * You should usually call [Builder.totalSize] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun totalSize(totalSize: JsonField) = apply { this.totalSize = totalSize } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SheetListPageResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .items() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetListPageResponse = - SheetListPageResponse( - checkRequired("items", items).map { it.toImmutable() }, - nextPageToken, - totalSize, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SheetListPageResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - nextPageToken() - totalSize() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (nextPageToken.asKnown().isPresent) 1 else 0) + - (if (totalSize.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListPageResponse && - items == other.items && - nextPageToken == other.nextPageToken && - totalSize == other.totalSize && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(items, nextPageToken, totalSize, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "SheetListPageResponse{items=$items, nextPageToken=$nextPageToken, totalSize=$totalSize, additionalProperties=$additionalProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParams.kt deleted file mode 100644 index b5d3e77..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParams.kt +++ /dev/null @@ -1,544 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonCreator -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** List spreadsheet parsing jobs. */ -@Deprecated("deprecated") -class SheetListParams -private constructor( - private val configurationId: String?, - private val createdAtOnOrAfter: OffsetDateTime?, - private val createdAtOnOrBefore: OffsetDateTime?, - private val includeResults: Boolean?, - private val jobIds: List?, - private val organizationId: String?, - private val pageSize: Long?, - private val pageToken: String?, - private val projectId: String?, - private val status: Status?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Filter by saved configuration ID */ - fun configurationId(): Optional = Optional.ofNullable(configurationId) - - /** Include items created at or after this timestamp (inclusive) */ - fun createdAtOnOrAfter(): Optional = Optional.ofNullable(createdAtOnOrAfter) - - /** Include items created at or before this timestamp (inclusive) */ - fun createdAtOnOrBefore(): Optional = Optional.ofNullable(createdAtOnOrBefore) - - fun includeResults(): Optional = Optional.ofNullable(includeResults) - - /** Filter by specific job IDs */ - fun jobIds(): Optional> = Optional.ofNullable(jobIds) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun pageSize(): Optional = Optional.ofNullable(pageSize) - - fun pageToken(): Optional = Optional.ofNullable(pageToken) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Filter by job status */ - fun status(): Optional = Optional.ofNullable(status) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SheetListParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [SheetListParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListParams]. */ - class Builder internal constructor() { - - private var configurationId: String? = null - private var createdAtOnOrAfter: OffsetDateTime? = null - private var createdAtOnOrBefore: OffsetDateTime? = null - private var includeResults: Boolean? = null - private var jobIds: MutableList? = null - private var organizationId: String? = null - private var pageSize: Long? = null - private var pageToken: String? = null - private var projectId: String? = null - private var status: Status? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetListParams: SheetListParams) = apply { - configurationId = sheetListParams.configurationId - createdAtOnOrAfter = sheetListParams.createdAtOnOrAfter - createdAtOnOrBefore = sheetListParams.createdAtOnOrBefore - includeResults = sheetListParams.includeResults - jobIds = sheetListParams.jobIds?.toMutableList() - organizationId = sheetListParams.organizationId - pageSize = sheetListParams.pageSize - pageToken = sheetListParams.pageToken - projectId = sheetListParams.projectId - status = sheetListParams.status - additionalHeaders = sheetListParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetListParams.additionalQueryParams.toBuilder() - } - - /** Filter by saved configuration ID */ - fun configurationId(configurationId: String?) = apply { - this.configurationId = configurationId - } - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** Include items created at or after this timestamp (inclusive) */ - fun createdAtOnOrAfter(createdAtOnOrAfter: OffsetDateTime?) = apply { - this.createdAtOnOrAfter = createdAtOnOrAfter - } - - /** - * Alias for calling [Builder.createdAtOnOrAfter] with `createdAtOnOrAfter.orElse(null)`. - */ - fun createdAtOnOrAfter(createdAtOnOrAfter: Optional) = - createdAtOnOrAfter(createdAtOnOrAfter.getOrNull()) - - /** Include items created at or before this timestamp (inclusive) */ - fun createdAtOnOrBefore(createdAtOnOrBefore: OffsetDateTime?) = apply { - this.createdAtOnOrBefore = createdAtOnOrBefore - } - - /** - * Alias for calling [Builder.createdAtOnOrBefore] with `createdAtOnOrBefore.orElse(null)`. - */ - fun createdAtOnOrBefore(createdAtOnOrBefore: Optional) = - createdAtOnOrBefore(createdAtOnOrBefore.getOrNull()) - - fun includeResults(includeResults: Boolean?) = apply { - this.includeResults = includeResults - } - - /** - * Alias for [Builder.includeResults]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) - - /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ - fun includeResults(includeResults: Optional) = - includeResults(includeResults.getOrNull()) - - /** Filter by specific job IDs */ - fun jobIds(jobIds: List?) = apply { this.jobIds = jobIds?.toMutableList() } - - /** Alias for calling [Builder.jobIds] with `jobIds.orElse(null)`. */ - fun jobIds(jobIds: Optional>) = jobIds(jobIds.getOrNull()) - - /** - * Adds a single [String] to [jobIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addJobId(jobId: String) = apply { - jobIds = (jobIds ?: mutableListOf()).apply { add(jobId) } - } - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize } - - /** - * Alias for [Builder.pageSize]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun pageSize(pageSize: Long) = pageSize(pageSize as Long?) - - /** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */ - fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull()) - - fun pageToken(pageToken: String?) = apply { this.pageToken = pageToken } - - /** Alias for calling [Builder.pageToken] with `pageToken.orElse(null)`. */ - fun pageToken(pageToken: Optional) = pageToken(pageToken.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - /** Filter by job status */ - fun status(status: Status?) = apply { this.status = status } - - /** Alias for calling [Builder.status] with `status.orElse(null)`. */ - fun status(status: Optional) = status(status.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetListParams = - SheetListParams( - configurationId, - createdAtOnOrAfter, - createdAtOnOrBefore, - includeResults, - jobIds?.toImmutable(), - organizationId, - pageSize, - pageToken, - projectId, - status, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - configurationId?.let { put("configuration_id", it) } - createdAtOnOrAfter?.let { - put("created_at_on_or_after", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) - } - createdAtOnOrBefore?.let { - put( - "created_at_on_or_before", - DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), - ) - } - includeResults?.let { put("include_results", it.toString()) } - jobIds?.forEach { put("job_ids", it) } - organizationId?.let { put("organization_id", it) } - pageSize?.let { put("page_size", it.toString()) } - pageToken?.let { put("page_token", it) } - projectId?.let { put("project_id", it) } - status?.let { put("status", it.toString()) } - putAll(additionalQueryParams) - } - .build() - - /** Filter by job status */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val ERROR = of("ERROR") - - @JvmField val PARTIAL_SUCCESS = of("PARTIAL_SUCCESS") - - @JvmField val PENDING = of("PENDING") - - @JvmField val SUCCESS = of("SUCCESS") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - CANCELLED, - ERROR, - PARTIAL_SUCCESS, - PENDING, - SUCCESS, - } - - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CANCELLED, - ERROR, - PARTIAL_SUCCESS, - PENDING, - SUCCESS, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CANCELLED -> Value.CANCELLED - ERROR -> Value.ERROR - PARTIAL_SUCCESS -> Value.PARTIAL_SUCCESS - PENDING -> Value.PENDING - SUCCESS -> Value.SUCCESS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CANCELLED -> Known.CANCELLED - ERROR -> Known.ERROR - PARTIAL_SUCCESS -> Known.PARTIAL_SUCCESS - PENDING -> Known.PENDING - SUCCESS -> Known.SUCCESS - else -> throw LlamaCloudInvalidDataException("Unknown Status: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Status = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListParams && - configurationId == other.configurationId && - createdAtOnOrAfter == other.createdAtOnOrAfter && - createdAtOnOrBefore == other.createdAtOnOrBefore && - includeResults == other.includeResults && - jobIds == other.jobIds && - organizationId == other.organizationId && - pageSize == other.pageSize && - pageToken == other.pageToken && - projectId == other.projectId && - status == other.status && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - configurationId, - createdAtOnOrAfter, - createdAtOnOrBefore, - includeResults, - jobIds, - organizationId, - pageSize, - pageToken, - projectId, - status, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "SheetListParams{configurationId=$configurationId, createdAtOnOrAfter=$createdAtOnOrAfter, createdAtOnOrBefore=$createdAtOnOrBefore, includeResults=$includeResults, jobIds=$jobIds, organizationId=$organizationId, pageSize=$pageSize, pageToken=$pageToken, projectId=$projectId, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJob.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJob.kt deleted file mode 100644 index c902811..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJob.kt +++ /dev/null @@ -1,2884 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.JsonMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.checkKnown -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import ai.llamaindex.llamacloud.models.files.File -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** A spreadsheet parsing job. */ -class SheetsJob -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val id: JsonField, - private val configuration: JsonField, - private val createdAt: JsonField, - private val fileId: JsonField, - private val projectId: JsonField, - private val status: JsonField, - private val updatedAt: JsonField, - private val userId: JsonField, - private val config: JsonField, - private val configurationId: JsonField, - private val errors: JsonField>, - private val file: JsonField, - private val metadataStateTransitions: JsonField, - private val parameters: JsonField, - private val regions: JsonField>, - private val success: JsonField, - private val worksheetMetadata: JsonField>, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("id") @ExcludeMissing id: JsonField = JsonMissing.of(), - @JsonProperty("configuration") - @ExcludeMissing - configuration: JsonField = JsonMissing.of(), - @JsonProperty("created_at") @ExcludeMissing createdAt: JsonField = JsonMissing.of(), - @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), - @JsonProperty("project_id") @ExcludeMissing projectId: JsonField = JsonMissing.of(), - @JsonProperty("status") @ExcludeMissing status: JsonField = JsonMissing.of(), - @JsonProperty("updated_at") @ExcludeMissing updatedAt: JsonField = JsonMissing.of(), - @JsonProperty("user_id") @ExcludeMissing userId: JsonField = JsonMissing.of(), - @JsonProperty("config") - @ExcludeMissing - config: JsonField = JsonMissing.of(), - @JsonProperty("configuration_id") - @ExcludeMissing - configurationId: JsonField = JsonMissing.of(), - @JsonProperty("errors") @ExcludeMissing errors: JsonField> = JsonMissing.of(), - @JsonProperty("file") @ExcludeMissing file: JsonField = JsonMissing.of(), - @JsonProperty("metadata_state_transitions") - @ExcludeMissing - metadataStateTransitions: JsonField = JsonMissing.of(), - @JsonProperty("parameters") - @ExcludeMissing - parameters: JsonField = JsonMissing.of(), - @JsonProperty("regions") - @ExcludeMissing - regions: JsonField> = JsonMissing.of(), - @JsonProperty("success") @ExcludeMissing success: JsonField = JsonMissing.of(), - @JsonProperty("worksheet_metadata") - @ExcludeMissing - worksheetMetadata: JsonField> = JsonMissing.of(), - ) : this( - id, - configuration, - createdAt, - fileId, - projectId, - status, - updatedAt, - userId, - config, - configurationId, - errors, - file, - metadataStateTransitions, - parameters, - regions, - success, - worksheetMetadata, - mutableMapOf(), - ) - - /** - * The ID of the job - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun id(): String = id.getRequired("id") - - /** - * Configuration applied to the parsing job (inline or resolved from a saved preset). - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun configuration(): SheetsParsingConfig = configuration.getRequired("configuration") - - /** - * When the job was created - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun createdAt(): String = createdAt.getRequired("created_at") - - /** - * The ID of the input file - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun fileId(): Optional = fileId.getOptional("file_id") - - /** - * The ID of the project - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun projectId(): String = projectId.getRequired("project_id") - - /** - * The status of the parsing job - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun status(): Status = status.getRequired("status") - - /** - * When the job was last updated - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun updatedAt(): String = updatedAt.getRequired("updated_at") - - /** - * The ID of the user - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun userId(): String = userId.getRequired("user_id") - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun config(): Optional = config.getOptional("config") - - /** - * The saved product configuration ID used at create time, if any. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun configurationId(): Optional = configurationId.getOptional("configuration_id") - - /** - * Any errors encountered - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun errors(): Optional> = errors.getOptional("errors") - - /** - * Schema for a file. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") fun file(): Optional = file.getOptional("file") - - /** - * Per-status entry timestamps. Returned only when requested via - * `?expand=metadata_state_transitions`. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun metadataStateTransitions(): Optional = - metadataStateTransitions.getOptional("metadata_state_transitions") - - /** - * Job-time parameters such as webhook configurations. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun parameters(): Optional = parameters.getOptional("parameters") - - /** - * All extracted regions (populated when job is complete) - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun regions(): Optional> = regions.getOptional("regions") - - /** - * Whether the job completed successfully - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun success(): Optional = success.getOptional("success") - - /** - * Metadata for each processed worksheet (populated when job is complete) - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun worksheetMetadata(): Optional> = - worksheetMetadata.getOptional("worksheet_metadata") - - /** - * Returns the raw JSON value of [id]. - * - * Unlike [id], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("id") @ExcludeMissing fun _id(): JsonField = id - - /** - * Returns the raw JSON value of [configuration]. - * - * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("configuration") - @ExcludeMissing - fun _configuration(): JsonField = configuration - - /** - * Returns the raw JSON value of [createdAt]. - * - * Unlike [createdAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("created_at") @ExcludeMissing fun _createdAt(): JsonField = createdAt - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId - - /** - * Returns the raw JSON value of [projectId]. - * - * Unlike [projectId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("project_id") @ExcludeMissing fun _projectId(): JsonField = projectId - - /** - * Returns the raw JSON value of [status]. - * - * Unlike [status], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("status") @ExcludeMissing fun _status(): JsonField = status - - /** - * Returns the raw JSON value of [updatedAt]. - * - * Unlike [updatedAt], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("updated_at") @ExcludeMissing fun _updatedAt(): JsonField = updatedAt - - /** - * Returns the raw JSON value of [userId]. - * - * Unlike [userId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("user_id") @ExcludeMissing fun _userId(): JsonField = userId - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("config") - @ExcludeMissing - fun _config(): JsonField = config - - /** - * Returns the raw JSON value of [configurationId]. - * - * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("configuration_id") - @ExcludeMissing - fun _configurationId(): JsonField = configurationId - - /** - * Returns the raw JSON value of [errors]. - * - * Unlike [errors], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("errors") @ExcludeMissing fun _errors(): JsonField> = errors - - /** - * Returns the raw JSON value of [file]. - * - * Unlike [file], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("file") - @ExcludeMissing - fun _file(): JsonField = file - - /** - * Returns the raw JSON value of [metadataStateTransitions]. - * - * Unlike [metadataStateTransitions], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("metadata_state_transitions") - @ExcludeMissing - fun _metadataStateTransitions(): JsonField = metadataStateTransitions - - /** - * Returns the raw JSON value of [parameters]. - * - * Unlike [parameters], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("parameters") - @ExcludeMissing - fun _parameters(): JsonField = parameters - - /** - * Returns the raw JSON value of [regions]. - * - * Unlike [regions], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("regions") @ExcludeMissing fun _regions(): JsonField> = regions - - /** - * Returns the raw JSON value of [success]. - * - * Unlike [success], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("success") @ExcludeMissing fun _success(): JsonField = success - - /** - * Returns the raw JSON value of [worksheetMetadata]. - * - * Unlike [worksheetMetadata], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("worksheet_metadata") - @ExcludeMissing - fun _worksheetMetadata(): JsonField> = worksheetMetadata - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetsJob]. - * - * The following fields are required: - * ```java - * .id() - * .configuration() - * .createdAt() - * .fileId() - * .projectId() - * .status() - * .updatedAt() - * .userId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetsJob]. */ - class Builder internal constructor() { - - private var id: JsonField? = null - private var configuration: JsonField? = null - private var createdAt: JsonField? = null - private var fileId: JsonField? = null - private var projectId: JsonField? = null - private var status: JsonField? = null - private var updatedAt: JsonField? = null - private var userId: JsonField? = null - private var config: JsonField = JsonMissing.of() - private var configurationId: JsonField = JsonMissing.of() - private var errors: JsonField>? = null - private var file: JsonField = JsonMissing.of() - private var metadataStateTransitions: JsonField = JsonMissing.of() - private var parameters: JsonField = JsonMissing.of() - private var regions: JsonField>? = null - private var success: JsonField = JsonMissing.of() - private var worksheetMetadata: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetsJob: SheetsJob) = apply { - id = sheetsJob.id - configuration = sheetsJob.configuration - createdAt = sheetsJob.createdAt - fileId = sheetsJob.fileId - projectId = sheetsJob.projectId - status = sheetsJob.status - updatedAt = sheetsJob.updatedAt - userId = sheetsJob.userId - config = sheetsJob.config - configurationId = sheetsJob.configurationId - errors = sheetsJob.errors.map { it.toMutableList() } - file = sheetsJob.file - metadataStateTransitions = sheetsJob.metadataStateTransitions - parameters = sheetsJob.parameters - regions = sheetsJob.regions.map { it.toMutableList() } - success = sheetsJob.success - worksheetMetadata = sheetsJob.worksheetMetadata.map { it.toMutableList() } - additionalProperties = sheetsJob.additionalProperties.toMutableMap() - } - - /** The ID of the job */ - fun id(id: String) = id(JsonField.of(id)) - - /** - * Sets [Builder.id] to an arbitrary JSON value. - * - * You should usually call [Builder.id] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun id(id: JsonField) = apply { this.id = id } - - /** Configuration applied to the parsing job (inline or resolved from a saved preset). */ - fun configuration(configuration: SheetsParsingConfig) = - configuration(JsonField.of(configuration)) - - /** - * Sets [Builder.configuration] to an arbitrary JSON value. - * - * You should usually call [Builder.configuration] with a well-typed [SheetsParsingConfig] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun configuration(configuration: JsonField) = apply { - this.configuration = configuration - } - - /** When the job was created */ - fun createdAt(createdAt: String) = createdAt(JsonField.of(createdAt)) - - /** - * Sets [Builder.createdAt] to an arbitrary JSON value. - * - * You should usually call [Builder.createdAt] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun createdAt(createdAt: JsonField) = apply { this.createdAt = createdAt } - - /** The ID of the input file */ - fun fileId(fileId: String?) = fileId(JsonField.ofNullable(fileId)) - - /** Alias for calling [Builder.fileId] with `fileId.orElse(null)`. */ - fun fileId(fileId: Optional) = fileId(fileId.getOrNull()) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - /** The ID of the project */ - fun projectId(projectId: String) = projectId(JsonField.of(projectId)) - - /** - * Sets [Builder.projectId] to an arbitrary JSON value. - * - * You should usually call [Builder.projectId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun projectId(projectId: JsonField) = apply { this.projectId = projectId } - - /** The status of the parsing job */ - fun status(status: Status) = status(JsonField.of(status)) - - /** - * Sets [Builder.status] to an arbitrary JSON value. - * - * You should usually call [Builder.status] with a well-typed [Status] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun status(status: JsonField) = apply { this.status = status } - - /** When the job was last updated */ - fun updatedAt(updatedAt: String) = updatedAt(JsonField.of(updatedAt)) - - /** - * Sets [Builder.updatedAt] to an arbitrary JSON value. - * - * You should usually call [Builder.updatedAt] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun updatedAt(updatedAt: JsonField) = apply { this.updatedAt = updatedAt } - - /** The ID of the user */ - fun userId(userId: String) = userId(JsonField.of(userId)) - - /** - * Sets [Builder.userId] to an arbitrary JSON value. - * - * You should usually call [Builder.userId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun userId(userId: JsonField) = apply { this.userId = userId } - - /** Configuration for spreadsheet parsing and region extraction */ - @Deprecated("deprecated") - fun config(config: SheetsParsingConfig?) = config(JsonField.ofNullable(config)) - - /** Alias for calling [Builder.config] with `config.orElse(null)`. */ - @Deprecated("deprecated") - fun config(config: Optional) = config(config.getOrNull()) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun config(config: JsonField) = apply { this.config = config } - - /** The saved product configuration ID used at create time, if any. */ - fun configurationId(configurationId: String?) = - configurationId(JsonField.ofNullable(configurationId)) - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** - * Sets [Builder.configurationId] to an arbitrary JSON value. - * - * You should usually call [Builder.configurationId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun configurationId(configurationId: JsonField) = apply { - this.configurationId = configurationId - } - - /** Any errors encountered */ - fun errors(errors: List) = errors(JsonField.of(errors)) - - /** - * Sets [Builder.errors] to an arbitrary JSON value. - * - * You should usually call [Builder.errors] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun errors(errors: JsonField>) = apply { - this.errors = errors.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [errors]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addError(error: String) = apply { - errors = - (errors ?: JsonField.of(mutableListOf())).also { - checkKnown("errors", it).add(error) - } - } - - /** Schema for a file. */ - @Deprecated("deprecated") fun file(file: File?) = file(JsonField.ofNullable(file)) - - /** Alias for calling [Builder.file] with `file.orElse(null)`. */ - @Deprecated("deprecated") fun file(file: Optional) = file(file.getOrNull()) - - /** - * Sets [Builder.file] to an arbitrary JSON value. - * - * You should usually call [Builder.file] with a well-typed [File] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - @Deprecated("deprecated") fun file(file: JsonField) = apply { this.file = file } - - /** - * Per-status entry timestamps. Returned only when requested via - * `?expand=metadata_state_transitions`. - */ - fun metadataStateTransitions(metadataStateTransitions: MetadataStateTransitions?) = - metadataStateTransitions(JsonField.ofNullable(metadataStateTransitions)) - - /** - * Alias for calling [Builder.metadataStateTransitions] with - * `metadataStateTransitions.orElse(null)`. - */ - fun metadataStateTransitions(metadataStateTransitions: Optional) = - metadataStateTransitions(metadataStateTransitions.getOrNull()) - - /** - * Sets [Builder.metadataStateTransitions] to an arbitrary JSON value. - * - * You should usually call [Builder.metadataStateTransitions] with a well-typed - * [MetadataStateTransitions] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun metadataStateTransitions( - metadataStateTransitions: JsonField - ) = apply { this.metadataStateTransitions = metadataStateTransitions } - - /** Job-time parameters such as webhook configurations. */ - fun parameters(parameters: Parameters) = parameters(JsonField.of(parameters)) - - /** - * Sets [Builder.parameters] to an arbitrary JSON value. - * - * You should usually call [Builder.parameters] with a well-typed [Parameters] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun parameters(parameters: JsonField) = apply { this.parameters = parameters } - - /** All extracted regions (populated when job is complete) */ - fun regions(regions: List) = regions(JsonField.of(regions)) - - /** - * Sets [Builder.regions] to an arbitrary JSON value. - * - * You should usually call [Builder.regions] with a well-typed `List` value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun regions(regions: JsonField>) = apply { - this.regions = regions.map { it.toMutableList() } - } - - /** - * Adds a single [Region] to [regions]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addRegion(region: Region) = apply { - regions = - (regions ?: JsonField.of(mutableListOf())).also { - checkKnown("regions", it).add(region) - } - } - - /** Whether the job completed successfully */ - fun success(success: Boolean?) = success(JsonField.ofNullable(success)) - - /** - * Alias for [Builder.success]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun success(success: Boolean) = success(success as Boolean?) - - /** Alias for calling [Builder.success] with `success.orElse(null)`. */ - fun success(success: Optional) = success(success.getOrNull()) - - /** - * Sets [Builder.success] to an arbitrary JSON value. - * - * You should usually call [Builder.success] with a well-typed [Boolean] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun success(success: JsonField) = apply { this.success = success } - - /** Metadata for each processed worksheet (populated when job is complete) */ - fun worksheetMetadata(worksheetMetadata: List) = - worksheetMetadata(JsonField.of(worksheetMetadata)) - - /** - * Sets [Builder.worksheetMetadata] to an arbitrary JSON value. - * - * You should usually call [Builder.worksheetMetadata] with a well-typed - * `List` value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun worksheetMetadata(worksheetMetadata: JsonField>) = apply { - this.worksheetMetadata = worksheetMetadata.map { it.toMutableList() } - } - - /** - * Adds a single [WorksheetMetadata] to [Builder.worksheetMetadata]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWorksheetMetadata(worksheetMetadata: WorksheetMetadata) = apply { - this.worksheetMetadata = - (this.worksheetMetadata ?: JsonField.of(mutableListOf())).also { - checkKnown("worksheetMetadata", it).add(worksheetMetadata) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SheetsJob]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .id() - * .configuration() - * .createdAt() - * .fileId() - * .projectId() - * .status() - * .updatedAt() - * .userId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetsJob = - SheetsJob( - checkRequired("id", id), - checkRequired("configuration", configuration), - checkRequired("createdAt", createdAt), - checkRequired("fileId", fileId), - checkRequired("projectId", projectId), - checkRequired("status", status), - checkRequired("updatedAt", updatedAt), - checkRequired("userId", userId), - config, - configurationId, - (errors ?: JsonMissing.of()).map { it.toImmutable() }, - file, - metadataStateTransitions, - parameters, - (regions ?: JsonMissing.of()).map { it.toImmutable() }, - success, - (worksheetMetadata ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SheetsJob = apply { - if (validated) { - return@apply - } - - id() - configuration().validate() - createdAt() - fileId() - projectId() - status().validate() - updatedAt() - userId() - config().ifPresent { it.validate() } - configurationId() - errors() - file().ifPresent { it.validate() } - metadataStateTransitions().ifPresent { it.validate() } - parameters().ifPresent { it.validate() } - regions().ifPresent { it.forEach { it.validate() } } - success() - worksheetMetadata().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (id.asKnown().isPresent) 1 else 0) + - (configuration.asKnown().getOrNull()?.validity() ?: 0) + - (if (createdAt.asKnown().isPresent) 1 else 0) + - (if (fileId.asKnown().isPresent) 1 else 0) + - (if (projectId.asKnown().isPresent) 1 else 0) + - (status.asKnown().getOrNull()?.validity() ?: 0) + - (if (updatedAt.asKnown().isPresent) 1 else 0) + - (if (userId.asKnown().isPresent) 1 else 0) + - (config.asKnown().getOrNull()?.validity() ?: 0) + - (if (configurationId.asKnown().isPresent) 1 else 0) + - (errors.asKnown().getOrNull()?.size ?: 0) + - (file.asKnown().getOrNull()?.validity() ?: 0) + - (metadataStateTransitions.asKnown().getOrNull()?.validity() ?: 0) + - (parameters.asKnown().getOrNull()?.validity() ?: 0) + - (regions.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (success.asKnown().isPresent) 1 else 0) + - (worksheetMetadata.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** The status of the parsing job */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val ERROR = of("ERROR") - - @JvmField val PARTIAL_SUCCESS = of("PARTIAL_SUCCESS") - - @JvmField val PENDING = of("PENDING") - - @JvmField val SUCCESS = of("SUCCESS") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - CANCELLED, - ERROR, - PARTIAL_SUCCESS, - PENDING, - SUCCESS, - } - - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CANCELLED, - ERROR, - PARTIAL_SUCCESS, - PENDING, - SUCCESS, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CANCELLED -> Value.CANCELLED - ERROR -> Value.ERROR - PARTIAL_SUCCESS -> Value.PARTIAL_SUCCESS - PENDING -> Value.PENDING - SUCCESS -> Value.SUCCESS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CANCELLED -> Known.CANCELLED - ERROR -> Known.ERROR - PARTIAL_SUCCESS -> Known.PARTIAL_SUCCESS - PENDING -> Known.PENDING - SUCCESS -> Known.SUCCESS - else -> throw LlamaCloudInvalidDataException("Unknown Status: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Status = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Per-status entry timestamps. Returned only when requested via - * `?expand=metadata_state_transitions`. - */ - class MetadataStateTransitions - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [MetadataStateTransitions]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [MetadataStateTransitions]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(metadataStateTransitions: MetadataStateTransitions) = apply { - additionalProperties = metadataStateTransitions.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [MetadataStateTransitions]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): MetadataStateTransitions = - MetadataStateTransitions(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): MetadataStateTransitions = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is MetadataStateTransitions && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "MetadataStateTransitions{additionalProperties=$additionalProperties}" - } - - /** Job-time parameters such as webhook configurations. */ - class Parameters - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val webhookConfigurations: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("webhook_configurations") - @ExcludeMissing - webhookConfigurations: JsonField> = JsonMissing.of() - ) : this(webhookConfigurations, mutableMapOf()) - - /** - * Webhook configurations for job status notifications. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookConfigurations(): Optional> = - webhookConfigurations.getOptional("webhook_configurations") - - /** - * Returns the raw JSON value of [webhookConfigurations]. - * - * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_configurations") - @ExcludeMissing - fun _webhookConfigurations(): JsonField> = webhookConfigurations - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [Parameters]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Parameters]. */ - class Builder internal constructor() { - - private var webhookConfigurations: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(parameters: Parameters) = apply { - webhookConfigurations = parameters.webhookConfigurations.map { it.toMutableList() } - additionalProperties = parameters.additionalProperties.toMutableMap() - } - - /** Webhook configurations for job status notifications. */ - fun webhookConfigurations(webhookConfigurations: List?) = - webhookConfigurations(JsonField.ofNullable(webhookConfigurations)) - - /** - * Alias for calling [Builder.webhookConfigurations] with - * `webhookConfigurations.orElse(null)`. - */ - fun webhookConfigurations(webhookConfigurations: Optional>) = - webhookConfigurations(webhookConfigurations.getOrNull()) - - /** - * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurations] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun webhookConfigurations( - webhookConfigurations: JsonField> - ) = apply { - this.webhookConfigurations = webhookConfigurations.map { it.toMutableList() } - } - - /** - * Adds a single [WebhookConfiguration] to [webhookConfigurations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { - webhookConfigurations = - (webhookConfigurations ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookConfigurations", it).add(webhookConfiguration) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Parameters]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): Parameters = - Parameters( - (webhookConfigurations ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Parameters = apply { - if (validated) { - return@apply - } - - webhookConfigurations().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (webhookConfigurations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - /** Configuration for a single outbound webhook endpoint. */ - class WebhookConfiguration - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val webhookEvents: JsonField>, - private val webhookHeaders: JsonField, - private val webhookOutputFormat: JsonField, - private val webhookSigningSecret: JsonField, - private val webhookUrl: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("webhook_events") - @ExcludeMissing - webhookEvents: JsonField> = JsonMissing.of(), - @JsonProperty("webhook_headers") - @ExcludeMissing - webhookHeaders: JsonField = JsonMissing.of(), - @JsonProperty("webhook_output_format") - @ExcludeMissing - webhookOutputFormat: JsonField = JsonMissing.of(), - @JsonProperty("webhook_signing_secret") - @ExcludeMissing - webhookSigningSecret: JsonField = JsonMissing.of(), - @JsonProperty("webhook_url") - @ExcludeMissing - webhookUrl: JsonField = JsonMissing.of(), - ) : this( - webhookEvents, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - mutableMapOf(), - ) - - /** - * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events - * are delivered. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun webhookEvents(): Optional> = - webhookEvents.getOptional("webhook_events") - - /** - * Custom HTTP headers sent with each webhook request (e.g. auth tokens) - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun webhookHeaders(): Optional = - webhookHeaders.getOptional("webhook_headers") - - /** - * Response format sent to the webhook: 'string' (default) or 'json' - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun webhookOutputFormat(): Optional = - webhookOutputFormat.getOptional("webhook_output_format") - - /** - * Shared signing secret used to sign webhook deliveries. When set, each request - * includes an HMAC-SHA256 signature of the request body in the 'LC-Signature' header - * (value 'sha256='). Recompute the HMAC over the raw request body with this secret - * to verify the delivery is authentic. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun webhookSigningSecret(): Optional = - webhookSigningSecret.getOptional("webhook_signing_secret") - - /** - * URL to receive webhook POST notifications - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. - * if the server responded with an unexpected value). - */ - fun webhookUrl(): Optional = webhookUrl.getOptional("webhook_url") - - /** - * Returns the raw JSON value of [webhookEvents]. - * - * Unlike [webhookEvents], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("webhook_events") - @ExcludeMissing - fun _webhookEvents(): JsonField> = webhookEvents - - /** - * Returns the raw JSON value of [webhookHeaders]. - * - * Unlike [webhookHeaders], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_headers") - @ExcludeMissing - fun _webhookHeaders(): JsonField = webhookHeaders - - /** - * Returns the raw JSON value of [webhookOutputFormat]. - * - * Unlike [webhookOutputFormat], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_output_format") - @ExcludeMissing - fun _webhookOutputFormat(): JsonField = webhookOutputFormat - - /** - * Returns the raw JSON value of [webhookSigningSecret]. - * - * Unlike [webhookSigningSecret], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_signing_secret") - @ExcludeMissing - fun _webhookSigningSecret(): JsonField = webhookSigningSecret - - /** - * Returns the raw JSON value of [webhookUrl]. - * - * Unlike [webhookUrl], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("webhook_url") - @ExcludeMissing - fun _webhookUrl(): JsonField = webhookUrl - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [WebhookConfiguration]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WebhookConfiguration]. */ - class Builder internal constructor() { - - private var webhookEvents: JsonField>? = null - private var webhookHeaders: JsonField = JsonMissing.of() - private var webhookOutputFormat: JsonField = JsonMissing.of() - private var webhookSigningSecret: JsonField = JsonMissing.of() - private var webhookUrl: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(webhookConfiguration: WebhookConfiguration) = apply { - webhookEvents = webhookConfiguration.webhookEvents.map { it.toMutableList() } - webhookHeaders = webhookConfiguration.webhookHeaders - webhookOutputFormat = webhookConfiguration.webhookOutputFormat - webhookSigningSecret = webhookConfiguration.webhookSigningSecret - webhookUrl = webhookConfiguration.webhookUrl - additionalProperties = webhookConfiguration.additionalProperties.toMutableMap() - } - - /** - * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all - * events are delivered. - */ - fun webhookEvents(webhookEvents: List?) = - webhookEvents(JsonField.ofNullable(webhookEvents)) - - /** Alias for calling [Builder.webhookEvents] with `webhookEvents.orElse(null)`. */ - fun webhookEvents(webhookEvents: Optional>) = - webhookEvents(webhookEvents.getOrNull()) - - /** - * Sets [Builder.webhookEvents] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookEvents] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun webhookEvents(webhookEvents: JsonField>) = apply { - this.webhookEvents = webhookEvents.map { it.toMutableList() } - } - - /** - * Adds a single [WebhookEvent] to [webhookEvents]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookEvent(webhookEvent: WebhookEvent) = apply { - webhookEvents = - (webhookEvents ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookEvents", it).add(webhookEvent) - } - } - - /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ - fun webhookHeaders(webhookHeaders: WebhookHeaders?) = - webhookHeaders(JsonField.ofNullable(webhookHeaders)) - - /** - * Alias for calling [Builder.webhookHeaders] with `webhookHeaders.orElse(null)`. - */ - fun webhookHeaders(webhookHeaders: Optional) = - webhookHeaders(webhookHeaders.getOrNull()) - - /** - * Sets [Builder.webhookHeaders] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookHeaders] with a well-typed - * [WebhookHeaders] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun webhookHeaders(webhookHeaders: JsonField) = apply { - this.webhookHeaders = webhookHeaders - } - - /** Response format sent to the webhook: 'string' (default) or 'json' */ - fun webhookOutputFormat(webhookOutputFormat: String?) = - webhookOutputFormat(JsonField.ofNullable(webhookOutputFormat)) - - /** - * Alias for calling [Builder.webhookOutputFormat] with - * `webhookOutputFormat.orElse(null)`. - */ - fun webhookOutputFormat(webhookOutputFormat: Optional) = - webhookOutputFormat(webhookOutputFormat.getOrNull()) - - /** - * Sets [Builder.webhookOutputFormat] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookOutputFormat] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun webhookOutputFormat(webhookOutputFormat: JsonField) = apply { - this.webhookOutputFormat = webhookOutputFormat - } - - /** - * Shared signing secret used to sign webhook deliveries. When set, each request - * includes an HMAC-SHA256 signature of the request body in the 'LC-Signature' - * header (value 'sha256='). Recompute the HMAC over the raw request body with - * this secret to verify the delivery is authentic. - */ - fun webhookSigningSecret(webhookSigningSecret: String?) = - webhookSigningSecret(JsonField.ofNullable(webhookSigningSecret)) - - /** - * Alias for calling [Builder.webhookSigningSecret] with - * `webhookSigningSecret.orElse(null)`. - */ - fun webhookSigningSecret(webhookSigningSecret: Optional) = - webhookSigningSecret(webhookSigningSecret.getOrNull()) - - /** - * Sets [Builder.webhookSigningSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookSigningSecret] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented - * or not yet supported value. - */ - fun webhookSigningSecret(webhookSigningSecret: JsonField) = apply { - this.webhookSigningSecret = webhookSigningSecret - } - - /** URL to receive webhook POST notifications */ - fun webhookUrl(webhookUrl: String?) = webhookUrl(JsonField.ofNullable(webhookUrl)) - - /** Alias for calling [Builder.webhookUrl] with `webhookUrl.orElse(null)`. */ - fun webhookUrl(webhookUrl: Optional) = webhookUrl(webhookUrl.getOrNull()) - - /** - * Sets [Builder.webhookUrl] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookUrl] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun webhookUrl(webhookUrl: JsonField) = apply { - this.webhookUrl = webhookUrl - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WebhookConfiguration]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): WebhookConfiguration = - WebhookConfiguration( - (webhookEvents ?: JsonMissing.of()).map { it.toImmutable() }, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): WebhookConfiguration = apply { - if (validated) { - return@apply - } - - webhookEvents().ifPresent { it.forEach { it.validate() } } - webhookHeaders().ifPresent { it.validate() } - webhookOutputFormat() - webhookSigningSecret() - webhookUrl() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (webhookEvents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (webhookHeaders.asKnown().getOrNull()?.validity() ?: 0) + - (if (webhookOutputFormat.asKnown().isPresent) 1 else 0) + - (if (webhookSigningSecret.asKnown().isPresent) 1 else 0) + - (if (webhookUrl.asKnown().isPresent) 1 else 0) - - class WebhookEvent - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that - * doesn't match any known member, and you want to know that value. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BATCH_CANCELLED = of("batch.cancelled") - - @JvmField val BATCH_ERROR = of("batch.error") - - @JvmField val BATCH_PENDING = of("batch.pending") - - @JvmField val BATCH_RUNNING = of("batch.running") - - @JvmField val BATCH_SUCCESS = of("batch.success") - - @JvmField val CLASSIFY_CANCELLED = of("classify.cancelled") - - @JvmField val CLASSIFY_ERROR = of("classify.error") - - @JvmField val CLASSIFY_PARTIAL_SUCCESS = of("classify.partial_success") - - @JvmField val CLASSIFY_PENDING = of("classify.pending") - - @JvmField val CLASSIFY_RUNNING = of("classify.running") - - @JvmField val CLASSIFY_SUCCESS = of("classify.success") - - @JvmField val EXTRACT_CANCELLED = of("extract.cancelled") - - @JvmField val EXTRACT_ERROR = of("extract.error") - - @JvmField val EXTRACT_PARTIAL_SUCCESS = of("extract.partial_success") - - @JvmField val EXTRACT_PENDING = of("extract.pending") - - @JvmField val EXTRACT_SUCCESS = of("extract.success") - - @JvmField val PARSE_CANCELLED = of("parse.cancelled") - - @JvmField val PARSE_ERROR = of("parse.error") - - @JvmField val PARSE_PARTIAL_SUCCESS = of("parse.partial_success") - - @JvmField val PARSE_PENDING = of("parse.pending") - - @JvmField val PARSE_RUNNING = of("parse.running") - - @JvmField val PARSE_SUCCESS = of("parse.success") - - @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") - - @JvmField val SHEETS_ERROR = of("sheets.error") - - @JvmField val SHEETS_PARTIAL_SUCCESS = of("sheets.partial_success") - - @JvmField val SHEETS_PENDING = of("sheets.pending") - - @JvmField val SHEETS_SUCCESS = of("sheets.success") - - @JvmField val SPLIT_CANCELLED = of("split.cancelled") - - @JvmField val SPLIT_ERROR = of("split.error") - - @JvmField val SPLIT_PENDING = of("split.pending") - - @JvmField val SPLIT_PROCESSING = of("split.processing") - - @JvmField val SPLIT_SUCCESS = of("split.success") - - @JvmField val UNMAPPED_EVENT = of("unmapped_event") - - @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) - } - - /** An enum containing [WebhookEvent]'s known values. */ - enum class Known { - BATCH_CANCELLED, - BATCH_ERROR, - BATCH_PENDING, - BATCH_RUNNING, - BATCH_SUCCESS, - CLASSIFY_CANCELLED, - CLASSIFY_ERROR, - CLASSIFY_PARTIAL_SUCCESS, - CLASSIFY_PENDING, - CLASSIFY_RUNNING, - CLASSIFY_SUCCESS, - EXTRACT_CANCELLED, - EXTRACT_ERROR, - EXTRACT_PARTIAL_SUCCESS, - EXTRACT_PENDING, - EXTRACT_SUCCESS, - PARSE_CANCELLED, - PARSE_ERROR, - PARSE_PARTIAL_SUCCESS, - PARSE_PENDING, - PARSE_RUNNING, - PARSE_SUCCESS, - SHEETS_CANCELLED, - SHEETS_ERROR, - SHEETS_PARTIAL_SUCCESS, - SHEETS_PENDING, - SHEETS_SUCCESS, - SPLIT_CANCELLED, - SPLIT_ERROR, - SPLIT_PENDING, - SPLIT_PROCESSING, - SPLIT_SUCCESS, - UNMAPPED_EVENT, - } - - /** - * An enum containing [WebhookEvent]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [WebhookEvent] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, - * if the SDK is on an older version than the API, then the API may respond with - * new members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BATCH_CANCELLED, - BATCH_ERROR, - BATCH_PENDING, - BATCH_RUNNING, - BATCH_SUCCESS, - CLASSIFY_CANCELLED, - CLASSIFY_ERROR, - CLASSIFY_PARTIAL_SUCCESS, - CLASSIFY_PENDING, - CLASSIFY_RUNNING, - CLASSIFY_SUCCESS, - EXTRACT_CANCELLED, - EXTRACT_ERROR, - EXTRACT_PARTIAL_SUCCESS, - EXTRACT_PENDING, - EXTRACT_SUCCESS, - PARSE_CANCELLED, - PARSE_ERROR, - PARSE_PARTIAL_SUCCESS, - PARSE_PENDING, - PARSE_RUNNING, - PARSE_SUCCESS, - SHEETS_CANCELLED, - SHEETS_ERROR, - SHEETS_PARTIAL_SUCCESS, - SHEETS_PENDING, - SHEETS_SUCCESS, - SPLIT_CANCELLED, - SPLIT_ERROR, - SPLIT_PENDING, - SPLIT_PROCESSING, - SPLIT_SUCCESS, - UNMAPPED_EVENT, - /** - * An enum member indicating that [WebhookEvent] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if - * you want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BATCH_CANCELLED -> Value.BATCH_CANCELLED - BATCH_ERROR -> Value.BATCH_ERROR - BATCH_PENDING -> Value.BATCH_PENDING - BATCH_RUNNING -> Value.BATCH_RUNNING - BATCH_SUCCESS -> Value.BATCH_SUCCESS - CLASSIFY_CANCELLED -> Value.CLASSIFY_CANCELLED - CLASSIFY_ERROR -> Value.CLASSIFY_ERROR - CLASSIFY_PARTIAL_SUCCESS -> Value.CLASSIFY_PARTIAL_SUCCESS - CLASSIFY_PENDING -> Value.CLASSIFY_PENDING - CLASSIFY_RUNNING -> Value.CLASSIFY_RUNNING - CLASSIFY_SUCCESS -> Value.CLASSIFY_SUCCESS - EXTRACT_CANCELLED -> Value.EXTRACT_CANCELLED - EXTRACT_ERROR -> Value.EXTRACT_ERROR - EXTRACT_PARTIAL_SUCCESS -> Value.EXTRACT_PARTIAL_SUCCESS - EXTRACT_PENDING -> Value.EXTRACT_PENDING - EXTRACT_SUCCESS -> Value.EXTRACT_SUCCESS - PARSE_CANCELLED -> Value.PARSE_CANCELLED - PARSE_ERROR -> Value.PARSE_ERROR - PARSE_PARTIAL_SUCCESS -> Value.PARSE_PARTIAL_SUCCESS - PARSE_PENDING -> Value.PARSE_PENDING - PARSE_RUNNING -> Value.PARSE_RUNNING - PARSE_SUCCESS -> Value.PARSE_SUCCESS - SHEETS_CANCELLED -> Value.SHEETS_CANCELLED - SHEETS_ERROR -> Value.SHEETS_ERROR - SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS - SHEETS_PENDING -> Value.SHEETS_PENDING - SHEETS_SUCCESS -> Value.SHEETS_SUCCESS - SPLIT_CANCELLED -> Value.SPLIT_CANCELLED - SPLIT_ERROR -> Value.SPLIT_ERROR - SPLIT_PENDING -> Value.SPLIT_PENDING - SPLIT_PROCESSING -> Value.SPLIT_PROCESSING - SPLIT_SUCCESS -> Value.SPLIT_SUCCESS - UNMAPPED_EVENT -> Value.UNMAPPED_EVENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BATCH_CANCELLED -> Known.BATCH_CANCELLED - BATCH_ERROR -> Known.BATCH_ERROR - BATCH_PENDING -> Known.BATCH_PENDING - BATCH_RUNNING -> Known.BATCH_RUNNING - BATCH_SUCCESS -> Known.BATCH_SUCCESS - CLASSIFY_CANCELLED -> Known.CLASSIFY_CANCELLED - CLASSIFY_ERROR -> Known.CLASSIFY_ERROR - CLASSIFY_PARTIAL_SUCCESS -> Known.CLASSIFY_PARTIAL_SUCCESS - CLASSIFY_PENDING -> Known.CLASSIFY_PENDING - CLASSIFY_RUNNING -> Known.CLASSIFY_RUNNING - CLASSIFY_SUCCESS -> Known.CLASSIFY_SUCCESS - EXTRACT_CANCELLED -> Known.EXTRACT_CANCELLED - EXTRACT_ERROR -> Known.EXTRACT_ERROR - EXTRACT_PARTIAL_SUCCESS -> Known.EXTRACT_PARTIAL_SUCCESS - EXTRACT_PENDING -> Known.EXTRACT_PENDING - EXTRACT_SUCCESS -> Known.EXTRACT_SUCCESS - PARSE_CANCELLED -> Known.PARSE_CANCELLED - PARSE_ERROR -> Known.PARSE_ERROR - PARSE_PARTIAL_SUCCESS -> Known.PARSE_PARTIAL_SUCCESS - PARSE_PENDING -> Known.PARSE_PENDING - PARSE_RUNNING -> Known.PARSE_RUNNING - PARSE_SUCCESS -> Known.PARSE_SUCCESS - SHEETS_CANCELLED -> Known.SHEETS_CANCELLED - SHEETS_ERROR -> Known.SHEETS_ERROR - SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS - SHEETS_PENDING -> Known.SHEETS_PENDING - SHEETS_SUCCESS -> Known.SHEETS_SUCCESS - SPLIT_CANCELLED -> Known.SPLIT_CANCELLED - SPLIT_ERROR -> Known.SPLIT_ERROR - SPLIT_PENDING -> Known.SPLIT_PENDING - SPLIT_PROCESSING -> Known.SPLIT_PROCESSING - SPLIT_SUCCESS -> Known.SPLIT_SUCCESS - UNMAPPED_EVENT -> Known.UNMAPPED_EVENT - else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not - * have the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WebhookEvent = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookEvent && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ - class WebhookHeaders - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [WebhookHeaders]. - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WebhookHeaders]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(webhookHeaders: WebhookHeaders) = apply { - additionalProperties = webhookHeaders.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WebhookHeaders]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): WebhookHeaders = WebhookHeaders(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't - * match its expected type. - */ - fun validate(): WebhookHeaders = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> - !value.isNull() && !value.isMissing() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookHeaders && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WebhookHeaders{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookConfiguration && - webhookEvents == other.webhookEvents && - webhookHeaders == other.webhookHeaders && - webhookOutputFormat == other.webhookOutputFormat && - webhookSigningSecret == other.webhookSigningSecret && - webhookUrl == other.webhookUrl && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - webhookEvents, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WebhookConfiguration{webhookEvents=$webhookEvents, webhookHeaders=$webhookHeaders, webhookOutputFormat=$webhookOutputFormat, webhookSigningSecret=$webhookSigningSecret, webhookUrl=$webhookUrl, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Parameters && - webhookConfigurations == other.webhookConfigurations && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(webhookConfigurations, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Parameters{webhookConfigurations=$webhookConfigurations, additionalProperties=$additionalProperties}" - } - - /** A summary of a single extracted region from a spreadsheet */ - class Region - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val location: JsonField, - private val regionType: JsonField, - private val sheetName: JsonField, - private val description: JsonField, - private val regionId: JsonField, - private val title: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("location") - @ExcludeMissing - location: JsonField = JsonMissing.of(), - @JsonProperty("region_type") - @ExcludeMissing - regionType: JsonField = JsonMissing.of(), - @JsonProperty("sheet_name") - @ExcludeMissing - sheetName: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - description: JsonField = JsonMissing.of(), - @JsonProperty("region_id") - @ExcludeMissing - regionId: JsonField = JsonMissing.of(), - @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), - ) : this(location, regionType, sheetName, description, regionId, title, mutableMapOf()) - - /** - * Location of the region in the spreadsheet - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun location(): String = location.getRequired("location") - - /** - * Type of the extracted region - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun regionType(): String = regionType.getRequired("region_type") - - /** - * Worksheet name where region was found - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun sheetName(): String = sheetName.getRequired("sheet_name") - - /** - * Generated description for the region - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun description(): Optional = description.getOptional("description") - - /** - * Unique identifier for this region within the file - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun regionId(): Optional = regionId.getOptional("region_id") - - /** - * Generated title for the region - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun title(): Optional = title.getOptional("title") - - /** - * Returns the raw JSON value of [location]. - * - * Unlike [location], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("location") @ExcludeMissing fun _location(): JsonField = location - - /** - * Returns the raw JSON value of [regionType]. - * - * Unlike [regionType], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("region_type") - @ExcludeMissing - fun _regionType(): JsonField = regionType - - /** - * Returns the raw JSON value of [sheetName]. - * - * Unlike [sheetName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("sheet_name") @ExcludeMissing fun _sheetName(): JsonField = sheetName - - /** - * Returns the raw JSON value of [description]. - * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * Returns the raw JSON value of [regionId]. - * - * Unlike [regionId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("region_id") @ExcludeMissing fun _regionId(): JsonField = regionId - - /** - * Returns the raw JSON value of [title]. - * - * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Region]. - * - * The following fields are required: - * ```java - * .location() - * .regionType() - * .sheetName() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Region]. */ - class Builder internal constructor() { - - private var location: JsonField? = null - private var regionType: JsonField? = null - private var sheetName: JsonField? = null - private var description: JsonField = JsonMissing.of() - private var regionId: JsonField = JsonMissing.of() - private var title: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(region: Region) = apply { - location = region.location - regionType = region.regionType - sheetName = region.sheetName - description = region.description - regionId = region.regionId - title = region.title - additionalProperties = region.additionalProperties.toMutableMap() - } - - /** Location of the region in the spreadsheet */ - fun location(location: String) = location(JsonField.of(location)) - - /** - * Sets [Builder.location] to an arbitrary JSON value. - * - * You should usually call [Builder.location] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun location(location: JsonField) = apply { this.location = location } - - /** Type of the extracted region */ - fun regionType(regionType: String) = regionType(JsonField.of(regionType)) - - /** - * Sets [Builder.regionType] to an arbitrary JSON value. - * - * You should usually call [Builder.regionType] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun regionType(regionType: JsonField) = apply { this.regionType = regionType } - - /** Worksheet name where region was found */ - fun sheetName(sheetName: String) = sheetName(JsonField.of(sheetName)) - - /** - * Sets [Builder.sheetName] to an arbitrary JSON value. - * - * You should usually call [Builder.sheetName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun sheetName(sheetName: JsonField) = apply { this.sheetName = sheetName } - - /** Generated description for the region */ - fun description(description: String?) = description(JsonField.ofNullable(description)) - - /** Alias for calling [Builder.description] with `description.orElse(null)`. */ - fun description(description: Optional) = description(description.getOrNull()) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun description(description: JsonField) = apply { - this.description = description - } - - /** Unique identifier for this region within the file */ - fun regionId(regionId: String) = regionId(JsonField.of(regionId)) - - /** - * Sets [Builder.regionId] to an arbitrary JSON value. - * - * You should usually call [Builder.regionId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun regionId(regionId: JsonField) = apply { this.regionId = regionId } - - /** Generated title for the region */ - fun title(title: String?) = title(JsonField.ofNullable(title)) - - /** Alias for calling [Builder.title] with `title.orElse(null)`. */ - fun title(title: Optional) = title(title.getOrNull()) - - /** - * Sets [Builder.title] to an arbitrary JSON value. - * - * You should usually call [Builder.title] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun title(title: JsonField) = apply { this.title = title } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Region]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .location() - * .regionType() - * .sheetName() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Region = - Region( - checkRequired("location", location), - checkRequired("regionType", regionType), - checkRequired("sheetName", sheetName), - description, - regionId, - title, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Region = apply { - if (validated) { - return@apply - } - - location() - regionType() - sheetName() - description() - regionId() - title() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (location.asKnown().isPresent) 1 else 0) + - (if (regionType.asKnown().isPresent) 1 else 0) + - (if (sheetName.asKnown().isPresent) 1 else 0) + - (if (description.asKnown().isPresent) 1 else 0) + - (if (regionId.asKnown().isPresent) 1 else 0) + - (if (title.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Region && - location == other.location && - regionType == other.regionType && - sheetName == other.sheetName && - description == other.description && - regionId == other.regionId && - title == other.title && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - location, - regionType, - sheetName, - description, - regionId, - title, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Region{location=$location, regionType=$regionType, sheetName=$sheetName, description=$description, regionId=$regionId, title=$title, additionalProperties=$additionalProperties}" - } - - /** Metadata about a worksheet in a spreadsheet */ - class WorksheetMetadata - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val sheetName: JsonField, - private val description: JsonField, - private val title: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("sheet_name") - @ExcludeMissing - sheetName: JsonField = JsonMissing.of(), - @JsonProperty("description") - @ExcludeMissing - description: JsonField = JsonMissing.of(), - @JsonProperty("title") @ExcludeMissing title: JsonField = JsonMissing.of(), - ) : this(sheetName, description, title, mutableMapOf()) - - /** - * Name of the worksheet - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun sheetName(): String = sheetName.getRequired("sheet_name") - - /** - * Generated description of the worksheet - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun description(): Optional = description.getOptional("description") - - /** - * Generated title for the worksheet - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun title(): Optional = title.getOptional("title") - - /** - * Returns the raw JSON value of [sheetName]. - * - * Unlike [sheetName], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("sheet_name") @ExcludeMissing fun _sheetName(): JsonField = sheetName - - /** - * Returns the raw JSON value of [description]. - * - * Unlike [description], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("description") - @ExcludeMissing - fun _description(): JsonField = description - - /** - * Returns the raw JSON value of [title]. - * - * Unlike [title], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("title") @ExcludeMissing fun _title(): JsonField = title - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [WorksheetMetadata]. - * - * The following fields are required: - * ```java - * .sheetName() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WorksheetMetadata]. */ - class Builder internal constructor() { - - private var sheetName: JsonField? = null - private var description: JsonField = JsonMissing.of() - private var title: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(worksheetMetadata: WorksheetMetadata) = apply { - sheetName = worksheetMetadata.sheetName - description = worksheetMetadata.description - title = worksheetMetadata.title - additionalProperties = worksheetMetadata.additionalProperties.toMutableMap() - } - - /** Name of the worksheet */ - fun sheetName(sheetName: String) = sheetName(JsonField.of(sheetName)) - - /** - * Sets [Builder.sheetName] to an arbitrary JSON value. - * - * You should usually call [Builder.sheetName] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun sheetName(sheetName: JsonField) = apply { this.sheetName = sheetName } - - /** Generated description of the worksheet */ - fun description(description: String?) = description(JsonField.ofNullable(description)) - - /** Alias for calling [Builder.description] with `description.orElse(null)`. */ - fun description(description: Optional) = description(description.getOrNull()) - - /** - * Sets [Builder.description] to an arbitrary JSON value. - * - * You should usually call [Builder.description] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun description(description: JsonField) = apply { - this.description = description - } - - /** Generated title for the worksheet */ - fun title(title: String?) = title(JsonField.ofNullable(title)) - - /** Alias for calling [Builder.title] with `title.orElse(null)`. */ - fun title(title: Optional) = title(title.getOrNull()) - - /** - * Sets [Builder.title] to an arbitrary JSON value. - * - * You should usually call [Builder.title] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun title(title: JsonField) = apply { this.title = title } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WorksheetMetadata]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .sheetName() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): WorksheetMetadata = - WorksheetMetadata( - checkRequired("sheetName", sheetName), - description, - title, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): WorksheetMetadata = apply { - if (validated) { - return@apply - } - - sheetName() - description() - title() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (sheetName.asKnown().isPresent) 1 else 0) + - (if (description.asKnown().isPresent) 1 else 0) + - (if (title.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WorksheetMetadata && - sheetName == other.sheetName && - description == other.description && - title == other.title && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(sheetName, description, title, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WorksheetMetadata{sheetName=$sheetName, description=$description, title=$title, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetsJob && - id == other.id && - configuration == other.configuration && - createdAt == other.createdAt && - fileId == other.fileId && - projectId == other.projectId && - status == other.status && - updatedAt == other.updatedAt && - userId == other.userId && - config == other.config && - configurationId == other.configurationId && - errors == other.errors && - file == other.file && - metadataStateTransitions == other.metadataStateTransitions && - parameters == other.parameters && - regions == other.regions && - success == other.success && - worksheetMetadata == other.worksheetMetadata && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - id, - configuration, - createdAt, - fileId, - projectId, - status, - updatedAt, - userId, - config, - configurationId, - errors, - file, - metadataStateTransitions, - parameters, - regions, - success, - worksheetMetadata, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "SheetsJob{id=$id, configuration=$configuration, createdAt=$createdAt, fileId=$fileId, projectId=$projectId, status=$status, updatedAt=$updatedAt, userId=$userId, config=$config, configurationId=$configurationId, errors=$errors, file=$file, metadataStateTransitions=$metadataStateTransitions, parameters=$parameters, regions=$regions, success=$success, worksheetMetadata=$worksheetMetadata, additionalProperties=$additionalProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt deleted file mode 100644 index 917c401..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfig.kt +++ /dev/null @@ -1,881 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.JsonMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.checkKnown -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Configuration for spreadsheet parsing and region extraction */ -class SheetsParsingConfig -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val extractionRange: JsonField, - private val flattenHierarchicalTables: JsonField, - private val generateAdditionalMetadata: JsonField, - private val includeHiddenCells: JsonField, - private val sheetNames: JsonField>, - private val specialization: JsonField, - private val tableMergeSensitivity: JsonField, - private val tier: JsonField, - private val useExperimentalProcessing: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("extraction_range") - @ExcludeMissing - extractionRange: JsonField = JsonMissing.of(), - @JsonProperty("flatten_hierarchical_tables") - @ExcludeMissing - flattenHierarchicalTables: JsonField = JsonMissing.of(), - @JsonProperty("generate_additional_metadata") - @ExcludeMissing - generateAdditionalMetadata: JsonField = JsonMissing.of(), - @JsonProperty("include_hidden_cells") - @ExcludeMissing - includeHiddenCells: JsonField = JsonMissing.of(), - @JsonProperty("sheet_names") - @ExcludeMissing - sheetNames: JsonField> = JsonMissing.of(), - @JsonProperty("specialization") - @ExcludeMissing - specialization: JsonField = JsonMissing.of(), - @JsonProperty("table_merge_sensitivity") - @ExcludeMissing - tableMergeSensitivity: JsonField = JsonMissing.of(), - @JsonProperty("tier") @ExcludeMissing tier: JsonField = JsonMissing.of(), - @JsonProperty("use_experimental_processing") - @ExcludeMissing - useExperimentalProcessing: JsonField = JsonMissing.of(), - ) : this( - extractionRange, - flattenHierarchicalTables, - generateAdditionalMetadata, - includeHiddenCells, - sheetNames, - specialization, - tableMergeSensitivity, - tier, - useExperimentalProcessing, - mutableMapOf(), - ) - - /** - * A1 notation of the range to extract a single region from. If None, the entire sheet is used. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun extractionRange(): Optional = extractionRange.getOptional("extraction_range") - - /** - * Return a flattened dataframe when a detected table is recognized as hierarchical. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun flattenHierarchicalTables(): Optional = - flattenHierarchicalTables.getOptional("flatten_hierarchical_tables") - - /** - * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, - * description) for each extracted region. Honored only on `agentic`. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun generateAdditionalMetadata(): Optional = - generateAdditionalMetadata.getOptional("generate_additional_metadata") - - /** - * Whether to include hidden cells when extracting regions from the spreadsheet. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun includeHiddenCells(): Optional = - includeHiddenCells.getOptional("include_hidden_cells") - - /** - * The names of the sheets to extract regions from. If empty, all sheets will be processed. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun sheetNames(): Optional> = sheetNames.getOptional("sheet_names") - - /** - * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific - * extraction. Supported values: 'financial-standard', 'financial-enhanced', - * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on - * `agentic`. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun specialization(): Optional = specialization.getOptional("specialization") - - /** - * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are merged - * into a single table. Honored only on `agentic`. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tableMergeSensitivity(): Optional = - tableMergeSensitivity.getOptional("table_merge_sensitivity") - - /** - * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; `agentic` - * uses the full pipeline. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun tier(): Optional = tier.getOptional("tier") - - /** - * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on `agentic`. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun useExperimentalProcessing(): Optional = - useExperimentalProcessing.getOptional("use_experimental_processing") - - /** - * Returns the raw JSON value of [extractionRange]. - * - * Unlike [extractionRange], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("extraction_range") - @ExcludeMissing - fun _extractionRange(): JsonField = extractionRange - - /** - * Returns the raw JSON value of [flattenHierarchicalTables]. - * - * Unlike [flattenHierarchicalTables], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("flatten_hierarchical_tables") - @ExcludeMissing - fun _flattenHierarchicalTables(): JsonField = flattenHierarchicalTables - - /** - * Returns the raw JSON value of [generateAdditionalMetadata]. - * - * Unlike [generateAdditionalMetadata], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("generate_additional_metadata") - @ExcludeMissing - fun _generateAdditionalMetadata(): JsonField = generateAdditionalMetadata - - /** - * Returns the raw JSON value of [includeHiddenCells]. - * - * Unlike [includeHiddenCells], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("include_hidden_cells") - @ExcludeMissing - fun _includeHiddenCells(): JsonField = includeHiddenCells - - /** - * Returns the raw JSON value of [sheetNames]. - * - * Unlike [sheetNames], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("sheet_names") - @ExcludeMissing - fun _sheetNames(): JsonField> = sheetNames - - /** - * Returns the raw JSON value of [specialization]. - * - * Unlike [specialization], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("specialization") - @ExcludeMissing - fun _specialization(): JsonField = specialization - - /** - * Returns the raw JSON value of [tableMergeSensitivity]. - * - * Unlike [tableMergeSensitivity], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("table_merge_sensitivity") - @ExcludeMissing - fun _tableMergeSensitivity(): JsonField = tableMergeSensitivity - - /** - * Returns the raw JSON value of [tier]. - * - * Unlike [tier], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("tier") @ExcludeMissing fun _tier(): JsonField = tier - - /** - * Returns the raw JSON value of [useExperimentalProcessing]. - * - * Unlike [useExperimentalProcessing], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("use_experimental_processing") - @ExcludeMissing - fun _useExperimentalProcessing(): JsonField = useExperimentalProcessing - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [SheetsParsingConfig]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetsParsingConfig]. */ - class Builder internal constructor() { - - private var extractionRange: JsonField = JsonMissing.of() - private var flattenHierarchicalTables: JsonField = JsonMissing.of() - private var generateAdditionalMetadata: JsonField = JsonMissing.of() - private var includeHiddenCells: JsonField = JsonMissing.of() - private var sheetNames: JsonField>? = null - private var specialization: JsonField = JsonMissing.of() - private var tableMergeSensitivity: JsonField = JsonMissing.of() - private var tier: JsonField = JsonMissing.of() - private var useExperimentalProcessing: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetsParsingConfig: SheetsParsingConfig) = apply { - extractionRange = sheetsParsingConfig.extractionRange - flattenHierarchicalTables = sheetsParsingConfig.flattenHierarchicalTables - generateAdditionalMetadata = sheetsParsingConfig.generateAdditionalMetadata - includeHiddenCells = sheetsParsingConfig.includeHiddenCells - sheetNames = sheetsParsingConfig.sheetNames.map { it.toMutableList() } - specialization = sheetsParsingConfig.specialization - tableMergeSensitivity = sheetsParsingConfig.tableMergeSensitivity - tier = sheetsParsingConfig.tier - useExperimentalProcessing = sheetsParsingConfig.useExperimentalProcessing - additionalProperties = sheetsParsingConfig.additionalProperties.toMutableMap() - } - - /** - * A1 notation of the range to extract a single region from. If None, the entire sheet is - * used. - */ - fun extractionRange(extractionRange: String?) = - extractionRange(JsonField.ofNullable(extractionRange)) - - /** Alias for calling [Builder.extractionRange] with `extractionRange.orElse(null)`. */ - fun extractionRange(extractionRange: Optional) = - extractionRange(extractionRange.getOrNull()) - - /** - * Sets [Builder.extractionRange] to an arbitrary JSON value. - * - * You should usually call [Builder.extractionRange] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun extractionRange(extractionRange: JsonField) = apply { - this.extractionRange = extractionRange - } - - /** Return a flattened dataframe when a detected table is recognized as hierarchical. */ - fun flattenHierarchicalTables(flattenHierarchicalTables: Boolean) = - flattenHierarchicalTables(JsonField.of(flattenHierarchicalTables)) - - /** - * Sets [Builder.flattenHierarchicalTables] to an arbitrary JSON value. - * - * You should usually call [Builder.flattenHierarchicalTables] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun flattenHierarchicalTables(flattenHierarchicalTables: JsonField) = apply { - this.flattenHierarchicalTables = flattenHierarchicalTables - } - - /** - * Deprecated: controlled by `tier`. Whether to generate additional metadata (title, - * description) for each extracted region. Honored only on `agentic`. - */ - fun generateAdditionalMetadata(generateAdditionalMetadata: Boolean) = - generateAdditionalMetadata(JsonField.of(generateAdditionalMetadata)) - - /** - * Sets [Builder.generateAdditionalMetadata] to an arbitrary JSON value. - * - * You should usually call [Builder.generateAdditionalMetadata] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun generateAdditionalMetadata(generateAdditionalMetadata: JsonField) = apply { - this.generateAdditionalMetadata = generateAdditionalMetadata - } - - /** Whether to include hidden cells when extracting regions from the spreadsheet. */ - fun includeHiddenCells(includeHiddenCells: Boolean) = - includeHiddenCells(JsonField.of(includeHiddenCells)) - - /** - * Sets [Builder.includeHiddenCells] to an arbitrary JSON value. - * - * You should usually call [Builder.includeHiddenCells] with a well-typed [Boolean] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun includeHiddenCells(includeHiddenCells: JsonField) = apply { - this.includeHiddenCells = includeHiddenCells - } - - /** - * The names of the sheets to extract regions from. If empty, all sheets will be processed. - */ - fun sheetNames(sheetNames: List?) = sheetNames(JsonField.ofNullable(sheetNames)) - - /** Alias for calling [Builder.sheetNames] with `sheetNames.orElse(null)`. */ - fun sheetNames(sheetNames: Optional>) = sheetNames(sheetNames.getOrNull()) - - /** - * Sets [Builder.sheetNames] to an arbitrary JSON value. - * - * You should usually call [Builder.sheetNames] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun sheetNames(sheetNames: JsonField>) = apply { - this.sheetNames = sheetNames.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [sheetNames]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addSheetName(sheetName: String) = apply { - sheetNames = - (sheetNames ?: JsonField.of(mutableListOf())).also { - checkKnown("sheetNames", it).add(sheetName) - } - } - - /** - * Deprecated: controlled by `tier`. Optional specialization mode for domain-specific - * extraction. Supported values: 'financial-standard', 'financial-enhanced', - * 'financial-precise'. Default None uses the general-purpose pipeline. Honored only on - * `agentic`. - */ - fun specialization(specialization: String?) = - specialization(JsonField.ofNullable(specialization)) - - /** Alias for calling [Builder.specialization] with `specialization.orElse(null)`. */ - fun specialization(specialization: Optional) = - specialization(specialization.getOrNull()) - - /** - * Sets [Builder.specialization] to an arbitrary JSON value. - * - * You should usually call [Builder.specialization] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun specialization(specialization: JsonField) = apply { - this.specialization = specialization - } - - /** - * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are - * merged into a single table. Honored only on `agentic`. - */ - fun tableMergeSensitivity(tableMergeSensitivity: TableMergeSensitivity) = - tableMergeSensitivity(JsonField.of(tableMergeSensitivity)) - - /** - * Sets [Builder.tableMergeSensitivity] to an arbitrary JSON value. - * - * You should usually call [Builder.tableMergeSensitivity] with a well-typed - * [TableMergeSensitivity] value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun tableMergeSensitivity(tableMergeSensitivity: JsonField) = apply { - this.tableMergeSensitivity = tableMergeSensitivity - } - - /** - * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; - * `agentic` uses the full pipeline. - */ - fun tier(tier: Tier) = tier(JsonField.of(tier)) - - /** - * Sets [Builder.tier] to an arbitrary JSON value. - * - * You should usually call [Builder.tier] with a well-typed [Tier] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun tier(tier: JsonField) = apply { this.tier = tier } - - /** - * Deprecated: controlled by `tier`. Enables experimental processing. Honored only on - * `agentic`. - */ - fun useExperimentalProcessing(useExperimentalProcessing: Boolean) = - useExperimentalProcessing(JsonField.of(useExperimentalProcessing)) - - /** - * Sets [Builder.useExperimentalProcessing] to an arbitrary JSON value. - * - * You should usually call [Builder.useExperimentalProcessing] with a well-typed [Boolean] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun useExperimentalProcessing(useExperimentalProcessing: JsonField) = apply { - this.useExperimentalProcessing = useExperimentalProcessing - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SheetsParsingConfig]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetsParsingConfig = - SheetsParsingConfig( - extractionRange, - flattenHierarchicalTables, - generateAdditionalMetadata, - includeHiddenCells, - (sheetNames ?: JsonMissing.of()).map { it.toImmutable() }, - specialization, - tableMergeSensitivity, - tier, - useExperimentalProcessing, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SheetsParsingConfig = apply { - if (validated) { - return@apply - } - - extractionRange() - flattenHierarchicalTables() - generateAdditionalMetadata() - includeHiddenCells() - sheetNames() - specialization() - tableMergeSensitivity().ifPresent { it.validate() } - tier().ifPresent { it.validate() } - useExperimentalProcessing() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (extractionRange.asKnown().isPresent) 1 else 0) + - (if (flattenHierarchicalTables.asKnown().isPresent) 1 else 0) + - (if (generateAdditionalMetadata.asKnown().isPresent) 1 else 0) + - (if (includeHiddenCells.asKnown().isPresent) 1 else 0) + - (sheetNames.asKnown().getOrNull()?.size ?: 0) + - (if (specialization.asKnown().isPresent) 1 else 0) + - (tableMergeSensitivity.asKnown().getOrNull()?.validity() ?: 0) + - (tier.asKnown().getOrNull()?.validity() ?: 0) + - (if (useExperimentalProcessing.asKnown().isPresent) 1 else 0) - - /** - * Deprecated: controlled by `tier`. Influences how likely similar-looking regions are merged - * into a single table. Honored only on `agentic`. - */ - class TableMergeSensitivity - @JsonCreator - private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val STRONG = of("strong") - - @JvmField val WEAK = of("weak") - - @JvmStatic fun of(value: String) = TableMergeSensitivity(JsonField.of(value)) - } - - /** An enum containing [TableMergeSensitivity]'s known values. */ - enum class Known { - STRONG, - WEAK, - } - - /** - * An enum containing [TableMergeSensitivity]'s known values, as well as an [_UNKNOWN] - * member. - * - * An instance of [TableMergeSensitivity] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - STRONG, - WEAK, - /** - * An enum member indicating that [TableMergeSensitivity] was instantiated with an - * unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - STRONG -> Value.STRONG - WEAK -> Value.WEAK - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - STRONG -> Known.STRONG - WEAK -> Known.WEAK - else -> - throw LlamaCloudInvalidDataException("Unknown TableMergeSensitivity: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): TableMergeSensitivity = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is TableMergeSensitivity && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** - * Spreadsheet extraction tier. `cost_effective` uses the rule-based/ML-only pipeline; `agentic` - * uses the full pipeline. - */ - class Tier @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val AGENTIC = of("agentic") - - @JvmField val COST_EFFECTIVE = of("cost_effective") - - @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) - } - - /** An enum containing [Tier]'s known values. */ - enum class Known { - AGENTIC, - COST_EFFECTIVE, - } - - /** - * An enum containing [Tier]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Tier] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - AGENTIC, - COST_EFFECTIVE, - /** An enum member indicating that [Tier] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - AGENTIC -> Value.AGENTIC - COST_EFFECTIVE -> Value.COST_EFFECTIVE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - AGENTIC -> Known.AGENTIC - COST_EFFECTIVE -> Known.COST_EFFECTIVE - else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Tier = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Tier && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetsParsingConfig && - extractionRange == other.extractionRange && - flattenHierarchicalTables == other.flattenHierarchicalTables && - generateAdditionalMetadata == other.generateAdditionalMetadata && - includeHiddenCells == other.includeHiddenCells && - sheetNames == other.sheetNames && - specialization == other.specialization && - tableMergeSensitivity == other.tableMergeSensitivity && - tier == other.tier && - useExperimentalProcessing == other.useExperimentalProcessing && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - extractionRange, - flattenHierarchicalTables, - generateAdditionalMetadata, - includeHiddenCells, - sheetNames, - specialization, - tableMergeSensitivity, - tier, - useExperimentalProcessing, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "SheetsParsingConfig{extractionRange=$extractionRange, flattenHierarchicalTables=$flattenHierarchicalTables, generateAdditionalMetadata=$generateAdditionalMetadata, includeHiddenCells=$includeHiddenCells, sheetNames=$sheetNames, specialization=$specialization, tableMergeSensitivity=$tableMergeSensitivity, tier=$tier, useExperimentalProcessing=$useExperimentalProcessing, additionalProperties=$additionalProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParams.kt deleted file mode 100644 index 59a1cf5..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParams.kt +++ /dev/null @@ -1,1816 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.JsonMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.checkKnown -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (an inline parsing configuration) or `configuration_id` (a - * saved configuration preset). If neither is provided, a default configuration is used. Optionally - * include `webhook_configurations` to receive `sheets.*` status notifications. - */ -class SheetCreateParams -private constructor( - private val organizationId: String?, - private val projectId: String?, - private val body: Body, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** - * The ID of the file to parse - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileId(): String = body.fileId() - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - @Deprecated("deprecated") fun config(): Optional = body.config() - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun configuration(): Optional = body.configuration() - - /** - * Saved configuration ID - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun configurationId(): Optional = body.configurationId() - - /** - * IDs of saved webhook configurations to notify for this job. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun webhookConfigurationIds(): Optional> = body.webhookConfigurationIds() - - /** - * Outbound webhook endpoints to notify on job status changes - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun webhookConfigurations(): Optional> = body.webhookConfigurations() - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _fileId(): JsonField = body._fileId() - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") fun _config(): JsonField = body._config() - - /** - * Returns the raw JSON value of [configuration]. - * - * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _configuration(): JsonField = body._configuration() - - /** - * Returns the raw JSON value of [configurationId]. - * - * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected type. - */ - fun _configurationId(): JsonField = body._configurationId() - - /** - * Returns the raw JSON value of [webhookConfigurationIds]. - * - * Unlike [webhookConfigurationIds], this method doesn't throw if the JSON field has an - * unexpected type. - */ - fun _webhookConfigurationIds(): JsonField> = body._webhookConfigurationIds() - - /** - * Returns the raw JSON value of [webhookConfigurations]. - * - * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an unexpected - * type. - */ - fun _webhookConfigurations(): JsonField> = - body._webhookConfigurations() - - fun _additionalBodyProperties(): Map = body._additionalProperties() - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetCreateParams]. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetCreateParams]. */ - class Builder internal constructor() { - - private var organizationId: String? = null - private var projectId: String? = null - private var body: Body.Builder = Body.builder() - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetCreateParams: SheetCreateParams) = apply { - organizationId = sheetCreateParams.organizationId - projectId = sheetCreateParams.projectId - body = sheetCreateParams.body.toBuilder() - additionalHeaders = sheetCreateParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetCreateParams.additionalQueryParams.toBuilder() - } - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - /** - * Sets the entire request body. - * - * This is generally only useful if you are already constructing the body separately. - * Otherwise, it's more convenient to use the top-level setters instead: - * - [fileId] - * - [config] - * - [configuration] - * - [configurationId] - * - [webhookConfigurationIds] - * - etc. - */ - fun body(body: Body) = apply { this.body = body.toBuilder() } - - /** The ID of the file to parse */ - fun fileId(fileId: String) = apply { body.fileId(fileId) } - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun fileId(fileId: JsonField) = apply { body.fileId(fileId) } - - /** Configuration for spreadsheet parsing and region extraction */ - @Deprecated("deprecated") - fun config(config: SheetsParsingConfig?) = apply { body.config(config) } - - /** Alias for calling [Builder.config] with `config.orElse(null)`. */ - @Deprecated("deprecated") - fun config(config: Optional) = config(config.getOrNull()) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - @Deprecated("deprecated") - fun config(config: JsonField) = apply { body.config(config) } - - /** Configuration for spreadsheet parsing and region extraction */ - fun configuration(configuration: SheetsParsingConfig?) = apply { - body.configuration(configuration) - } - - /** Alias for calling [Builder.configuration] with `configuration.orElse(null)`. */ - fun configuration(configuration: Optional) = - configuration(configuration.getOrNull()) - - /** - * Sets [Builder.configuration] to an arbitrary JSON value. - * - * You should usually call [Builder.configuration] with a well-typed [SheetsParsingConfig] - * value instead. This method is primarily for setting the field to an undocumented or not - * yet supported value. - */ - fun configuration(configuration: JsonField) = apply { - body.configuration(configuration) - } - - /** Saved configuration ID */ - fun configurationId(configurationId: String?) = apply { - body.configurationId(configurationId) - } - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** - * Sets [Builder.configurationId] to an arbitrary JSON value. - * - * You should usually call [Builder.configurationId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun configurationId(configurationId: JsonField) = apply { - body.configurationId(configurationId) - } - - /** IDs of saved webhook configurations to notify for this job. */ - fun webhookConfigurationIds(webhookConfigurationIds: List?) = apply { - body.webhookConfigurationIds(webhookConfigurationIds) - } - - /** - * Alias for calling [Builder.webhookConfigurationIds] with - * `webhookConfigurationIds.orElse(null)`. - */ - fun webhookConfigurationIds(webhookConfigurationIds: Optional>) = - webhookConfigurationIds(webhookConfigurationIds.getOrNull()) - - /** - * Sets [Builder.webhookConfigurationIds] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurationIds] with a well-typed - * `List` value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun webhookConfigurationIds(webhookConfigurationIds: JsonField>) = apply { - body.webhookConfigurationIds(webhookConfigurationIds) - } - - /** - * Adds a single [String] to [webhookConfigurationIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfigurationId(webhookConfigurationId: String) = apply { - body.addWebhookConfigurationId(webhookConfigurationId) - } - - /** Outbound webhook endpoints to notify on job status changes */ - fun webhookConfigurations(webhookConfigurations: List?) = apply { - body.webhookConfigurations(webhookConfigurations) - } - - /** - * Alias for calling [Builder.webhookConfigurations] with - * `webhookConfigurations.orElse(null)`. - */ - fun webhookConfigurations(webhookConfigurations: Optional>) = - webhookConfigurations(webhookConfigurations.getOrNull()) - - /** - * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurations] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun webhookConfigurations(webhookConfigurations: JsonField>) = - apply { - body.webhookConfigurations(webhookConfigurations) - } - - /** - * Adds a single [WebhookConfiguration] to [webhookConfigurations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { - body.addWebhookConfiguration(webhookConfiguration) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - body.additionalProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - body.putAdditionalProperty(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - body.putAllAdditionalProperties(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { body.removeAdditionalProperty(key) } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - body.removeAllAdditionalProperties(keys) - } - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetCreateParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetCreateParams = - SheetCreateParams( - organizationId, - projectId, - body.build(), - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _body(): Body = body - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - /** - * Request to create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (inline) or `configuration_id` (saved preset). If - * neither is provided, a default inline configuration is used. - */ - class Body - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val fileId: JsonField, - private val config: JsonField, - private val configuration: JsonField, - private val configurationId: JsonField, - private val webhookConfigurationIds: JsonField>, - private val webhookConfigurations: JsonField>, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("file_id") @ExcludeMissing fileId: JsonField = JsonMissing.of(), - @JsonProperty("config") - @ExcludeMissing - config: JsonField = JsonMissing.of(), - @JsonProperty("configuration") - @ExcludeMissing - configuration: JsonField = JsonMissing.of(), - @JsonProperty("configuration_id") - @ExcludeMissing - configurationId: JsonField = JsonMissing.of(), - @JsonProperty("webhook_configuration_ids") - @ExcludeMissing - webhookConfigurationIds: JsonField> = JsonMissing.of(), - @JsonProperty("webhook_configurations") - @ExcludeMissing - webhookConfigurations: JsonField> = JsonMissing.of(), - ) : this( - fileId, - config, - configuration, - configurationId, - webhookConfigurationIds, - webhookConfigurations, - mutableMapOf(), - ) - - /** - * The ID of the file to parse - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun fileId(): String = fileId.getRequired("file_id") - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - @Deprecated("deprecated") - fun config(): Optional = config.getOptional("config") - - /** - * Configuration for spreadsheet parsing and region extraction - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun configuration(): Optional = - configuration.getOptional("configuration") - - /** - * Saved configuration ID - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun configurationId(): Optional = configurationId.getOptional("configuration_id") - - /** - * IDs of saved webhook configurations to notify for this job. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookConfigurationIds(): Optional> = - webhookConfigurationIds.getOptional("webhook_configuration_ids") - - /** - * Outbound webhook endpoints to notify on job status changes - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookConfigurations(): Optional> = - webhookConfigurations.getOptional("webhook_configurations") - - /** - * Returns the raw JSON value of [fileId]. - * - * Unlike [fileId], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("file_id") @ExcludeMissing fun _fileId(): JsonField = fileId - - /** - * Returns the raw JSON value of [config]. - * - * Unlike [config], this method doesn't throw if the JSON field has an unexpected type. - */ - @Deprecated("deprecated") - @JsonProperty("config") - @ExcludeMissing - fun _config(): JsonField = config - - /** - * Returns the raw JSON value of [configuration]. - * - * Unlike [configuration], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("configuration") - @ExcludeMissing - fun _configuration(): JsonField = configuration - - /** - * Returns the raw JSON value of [configurationId]. - * - * Unlike [configurationId], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("configuration_id") - @ExcludeMissing - fun _configurationId(): JsonField = configurationId - - /** - * Returns the raw JSON value of [webhookConfigurationIds]. - * - * Unlike [webhookConfigurationIds], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_configuration_ids") - @ExcludeMissing - fun _webhookConfigurationIds(): JsonField> = webhookConfigurationIds - - /** - * Returns the raw JSON value of [webhookConfigurations]. - * - * Unlike [webhookConfigurations], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_configurations") - @ExcludeMissing - fun _webhookConfigurations(): JsonField> = webhookConfigurations - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [Body]. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [Body]. */ - class Builder internal constructor() { - - private var fileId: JsonField? = null - private var config: JsonField = JsonMissing.of() - private var configuration: JsonField = JsonMissing.of() - private var configurationId: JsonField = JsonMissing.of() - private var webhookConfigurationIds: JsonField>? = null - private var webhookConfigurations: JsonField>? = null - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(body: Body) = apply { - fileId = body.fileId - config = body.config - configuration = body.configuration - configurationId = body.configurationId - webhookConfigurationIds = body.webhookConfigurationIds.map { it.toMutableList() } - webhookConfigurations = body.webhookConfigurations.map { it.toMutableList() } - additionalProperties = body.additionalProperties.toMutableMap() - } - - /** The ID of the file to parse */ - fun fileId(fileId: String) = fileId(JsonField.of(fileId)) - - /** - * Sets [Builder.fileId] to an arbitrary JSON value. - * - * You should usually call [Builder.fileId] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun fileId(fileId: JsonField) = apply { this.fileId = fileId } - - /** Configuration for spreadsheet parsing and region extraction */ - @Deprecated("deprecated") - fun config(config: SheetsParsingConfig?) = config(JsonField.ofNullable(config)) - - /** Alias for calling [Builder.config] with `config.orElse(null)`. */ - @Deprecated("deprecated") - fun config(config: Optional) = config(config.getOrNull()) - - /** - * Sets [Builder.config] to an arbitrary JSON value. - * - * You should usually call [Builder.config] with a well-typed [SheetsParsingConfig] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - @Deprecated("deprecated") - fun config(config: JsonField) = apply { this.config = config } - - /** Configuration for spreadsheet parsing and region extraction */ - fun configuration(configuration: SheetsParsingConfig?) = - configuration(JsonField.ofNullable(configuration)) - - /** Alias for calling [Builder.configuration] with `configuration.orElse(null)`. */ - fun configuration(configuration: Optional) = - configuration(configuration.getOrNull()) - - /** - * Sets [Builder.configuration] to an arbitrary JSON value. - * - * You should usually call [Builder.configuration] with a well-typed - * [SheetsParsingConfig] value instead. This method is primarily for setting the field - * to an undocumented or not yet supported value. - */ - fun configuration(configuration: JsonField) = apply { - this.configuration = configuration - } - - /** Saved configuration ID */ - fun configurationId(configurationId: String?) = - configurationId(JsonField.ofNullable(configurationId)) - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** - * Sets [Builder.configurationId] to an arbitrary JSON value. - * - * You should usually call [Builder.configurationId] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun configurationId(configurationId: JsonField) = apply { - this.configurationId = configurationId - } - - /** IDs of saved webhook configurations to notify for this job. */ - fun webhookConfigurationIds(webhookConfigurationIds: List?) = - webhookConfigurationIds(JsonField.ofNullable(webhookConfigurationIds)) - - /** - * Alias for calling [Builder.webhookConfigurationIds] with - * `webhookConfigurationIds.orElse(null)`. - */ - fun webhookConfigurationIds(webhookConfigurationIds: Optional>) = - webhookConfigurationIds(webhookConfigurationIds.getOrNull()) - - /** - * Sets [Builder.webhookConfigurationIds] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurationIds] with a well-typed - * `List` value instead. This method is primarily for setting the field to an - * undocumented or not yet supported value. - */ - fun webhookConfigurationIds(webhookConfigurationIds: JsonField>) = apply { - this.webhookConfigurationIds = webhookConfigurationIds.map { it.toMutableList() } - } - - /** - * Adds a single [String] to [webhookConfigurationIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfigurationId(webhookConfigurationId: String) = apply { - webhookConfigurationIds = - (webhookConfigurationIds ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookConfigurationIds", it).add(webhookConfigurationId) - } - } - - /** Outbound webhook endpoints to notify on job status changes */ - fun webhookConfigurations(webhookConfigurations: List?) = - webhookConfigurations(JsonField.ofNullable(webhookConfigurations)) - - /** - * Alias for calling [Builder.webhookConfigurations] with - * `webhookConfigurations.orElse(null)`. - */ - fun webhookConfigurations(webhookConfigurations: Optional>) = - webhookConfigurations(webhookConfigurations.getOrNull()) - - /** - * Sets [Builder.webhookConfigurations] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookConfigurations] with a well-typed - * `List` value instead. This method is primarily for setting the - * field to an undocumented or not yet supported value. - */ - fun webhookConfigurations( - webhookConfigurations: JsonField> - ) = apply { - this.webhookConfigurations = webhookConfigurations.map { it.toMutableList() } - } - - /** - * Adds a single [WebhookConfiguration] to [webhookConfigurations]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookConfiguration(webhookConfiguration: WebhookConfiguration) = apply { - webhookConfigurations = - (webhookConfigurations ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookConfigurations", it).add(webhookConfiguration) - } - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [Body]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .fileId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): Body = - Body( - checkRequired("fileId", fileId), - config, - configuration, - configurationId, - (webhookConfigurationIds ?: JsonMissing.of()).map { it.toImmutable() }, - (webhookConfigurations ?: JsonMissing.of()).map { it.toImmutable() }, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Body = apply { - if (validated) { - return@apply - } - - fileId() - config().ifPresent { it.validate() } - configuration().ifPresent { it.validate() } - configurationId() - webhookConfigurationIds() - webhookConfigurations().ifPresent { it.forEach { it.validate() } } - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (if (fileId.asKnown().isPresent) 1 else 0) + - (config.asKnown().getOrNull()?.validity() ?: 0) + - (configuration.asKnown().getOrNull()?.validity() ?: 0) + - (if (configurationId.asKnown().isPresent) 1 else 0) + - (webhookConfigurationIds.asKnown().getOrNull()?.size ?: 0) + - (webhookConfigurations.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Body && - fileId == other.fileId && - config == other.config && - configuration == other.configuration && - configurationId == other.configurationId && - webhookConfigurationIds == other.webhookConfigurationIds && - webhookConfigurations == other.webhookConfigurations && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - fileId, - config, - configuration, - configurationId, - webhookConfigurationIds, - webhookConfigurations, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "Body{fileId=$fileId, config=$config, configuration=$configuration, configurationId=$configurationId, webhookConfigurationIds=$webhookConfigurationIds, webhookConfigurations=$webhookConfigurations, additionalProperties=$additionalProperties}" - } - - /** Configuration for a single outbound webhook endpoint. */ - class WebhookConfiguration - @JsonCreator(mode = JsonCreator.Mode.DISABLED) - private constructor( - private val webhookEvents: JsonField>, - private val webhookHeaders: JsonField, - private val webhookOutputFormat: JsonField, - private val webhookSigningSecret: JsonField, - private val webhookUrl: JsonField, - private val additionalProperties: MutableMap, - ) { - - @JsonCreator - private constructor( - @JsonProperty("webhook_events") - @ExcludeMissing - webhookEvents: JsonField> = JsonMissing.of(), - @JsonProperty("webhook_headers") - @ExcludeMissing - webhookHeaders: JsonField = JsonMissing.of(), - @JsonProperty("webhook_output_format") - @ExcludeMissing - webhookOutputFormat: JsonField = JsonMissing.of(), - @JsonProperty("webhook_signing_secret") - @ExcludeMissing - webhookSigningSecret: JsonField = JsonMissing.of(), - @JsonProperty("webhook_url") - @ExcludeMissing - webhookUrl: JsonField = JsonMissing.of(), - ) : this( - webhookEvents, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - mutableMapOf(), - ) - - /** - * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events are - * delivered. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookEvents(): Optional> = - webhookEvents.getOptional("webhook_events") - - /** - * Custom HTTP headers sent with each webhook request (e.g. auth tokens) - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookHeaders(): Optional = - webhookHeaders.getOptional("webhook_headers") - - /** - * Response format sent to the webhook: 'string' (default) or 'json' - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookOutputFormat(): Optional = - webhookOutputFormat.getOptional("webhook_output_format") - - /** - * Shared signing secret used to sign webhook deliveries. When set, each request includes an - * HMAC-SHA256 signature of the request body in the 'LC-Signature' header (value - * 'sha256='). Recompute the HMAC over the raw request body with this secret to verify - * the delivery is authentic. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookSigningSecret(): Optional = - webhookSigningSecret.getOptional("webhook_signing_secret") - - /** - * URL to receive webhook POST notifications - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if - * the server responded with an unexpected value). - */ - fun webhookUrl(): Optional = webhookUrl.getOptional("webhook_url") - - /** - * Returns the raw JSON value of [webhookEvents]. - * - * Unlike [webhookEvents], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("webhook_events") - @ExcludeMissing - fun _webhookEvents(): JsonField> = webhookEvents - - /** - * Returns the raw JSON value of [webhookHeaders]. - * - * Unlike [webhookHeaders], this method doesn't throw if the JSON field has an unexpected - * type. - */ - @JsonProperty("webhook_headers") - @ExcludeMissing - fun _webhookHeaders(): JsonField = webhookHeaders - - /** - * Returns the raw JSON value of [webhookOutputFormat]. - * - * Unlike [webhookOutputFormat], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_output_format") - @ExcludeMissing - fun _webhookOutputFormat(): JsonField = webhookOutputFormat - - /** - * Returns the raw JSON value of [webhookSigningSecret]. - * - * Unlike [webhookSigningSecret], this method doesn't throw if the JSON field has an - * unexpected type. - */ - @JsonProperty("webhook_signing_secret") - @ExcludeMissing - fun _webhookSigningSecret(): JsonField = webhookSigningSecret - - /** - * Returns the raw JSON value of [webhookUrl]. - * - * Unlike [webhookUrl], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("webhook_url") - @ExcludeMissing - fun _webhookUrl(): JsonField = webhookUrl - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [WebhookConfiguration]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WebhookConfiguration]. */ - class Builder internal constructor() { - - private var webhookEvents: JsonField>? = null - private var webhookHeaders: JsonField = JsonMissing.of() - private var webhookOutputFormat: JsonField = JsonMissing.of() - private var webhookSigningSecret: JsonField = JsonMissing.of() - private var webhookUrl: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(webhookConfiguration: WebhookConfiguration) = apply { - webhookEvents = webhookConfiguration.webhookEvents.map { it.toMutableList() } - webhookHeaders = webhookConfiguration.webhookHeaders - webhookOutputFormat = webhookConfiguration.webhookOutputFormat - webhookSigningSecret = webhookConfiguration.webhookSigningSecret - webhookUrl = webhookConfiguration.webhookUrl - additionalProperties = webhookConfiguration.additionalProperties.toMutableMap() - } - - /** - * Events to subscribe to (e.g. 'parse.success', 'extract.error'). If null, all events - * are delivered. - */ - fun webhookEvents(webhookEvents: List?) = - webhookEvents(JsonField.ofNullable(webhookEvents)) - - /** Alias for calling [Builder.webhookEvents] with `webhookEvents.orElse(null)`. */ - fun webhookEvents(webhookEvents: Optional>) = - webhookEvents(webhookEvents.getOrNull()) - - /** - * Sets [Builder.webhookEvents] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookEvents] with a well-typed - * `List` value instead. This method is primarily for setting the field to - * an undocumented or not yet supported value. - */ - fun webhookEvents(webhookEvents: JsonField>) = apply { - this.webhookEvents = webhookEvents.map { it.toMutableList() } - } - - /** - * Adds a single [WebhookEvent] to [webhookEvents]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addWebhookEvent(webhookEvent: WebhookEvent) = apply { - webhookEvents = - (webhookEvents ?: JsonField.of(mutableListOf())).also { - checkKnown("webhookEvents", it).add(webhookEvent) - } - } - - /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ - fun webhookHeaders(webhookHeaders: WebhookHeaders?) = - webhookHeaders(JsonField.ofNullable(webhookHeaders)) - - /** Alias for calling [Builder.webhookHeaders] with `webhookHeaders.orElse(null)`. */ - fun webhookHeaders(webhookHeaders: Optional) = - webhookHeaders(webhookHeaders.getOrNull()) - - /** - * Sets [Builder.webhookHeaders] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookHeaders] with a well-typed [WebhookHeaders] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun webhookHeaders(webhookHeaders: JsonField) = apply { - this.webhookHeaders = webhookHeaders - } - - /** Response format sent to the webhook: 'string' (default) or 'json' */ - fun webhookOutputFormat(webhookOutputFormat: String?) = - webhookOutputFormat(JsonField.ofNullable(webhookOutputFormat)) - - /** - * Alias for calling [Builder.webhookOutputFormat] with - * `webhookOutputFormat.orElse(null)`. - */ - fun webhookOutputFormat(webhookOutputFormat: Optional) = - webhookOutputFormat(webhookOutputFormat.getOrNull()) - - /** - * Sets [Builder.webhookOutputFormat] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookOutputFormat] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun webhookOutputFormat(webhookOutputFormat: JsonField) = apply { - this.webhookOutputFormat = webhookOutputFormat - } - - /** - * Shared signing secret used to sign webhook deliveries. When set, each request - * includes an HMAC-SHA256 signature of the request body in the 'LC-Signature' header - * (value 'sha256='). Recompute the HMAC over the raw request body with this secret - * to verify the delivery is authentic. - */ - fun webhookSigningSecret(webhookSigningSecret: String?) = - webhookSigningSecret(JsonField.ofNullable(webhookSigningSecret)) - - /** - * Alias for calling [Builder.webhookSigningSecret] with - * `webhookSigningSecret.orElse(null)`. - */ - fun webhookSigningSecret(webhookSigningSecret: Optional) = - webhookSigningSecret(webhookSigningSecret.getOrNull()) - - /** - * Sets [Builder.webhookSigningSecret] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookSigningSecret] with a well-typed [String] - * value instead. This method is primarily for setting the field to an undocumented or - * not yet supported value. - */ - fun webhookSigningSecret(webhookSigningSecret: JsonField) = apply { - this.webhookSigningSecret = webhookSigningSecret - } - - /** URL to receive webhook POST notifications */ - fun webhookUrl(webhookUrl: String?) = webhookUrl(JsonField.ofNullable(webhookUrl)) - - /** Alias for calling [Builder.webhookUrl] with `webhookUrl.orElse(null)`. */ - fun webhookUrl(webhookUrl: Optional) = webhookUrl(webhookUrl.getOrNull()) - - /** - * Sets [Builder.webhookUrl] to an arbitrary JSON value. - * - * You should usually call [Builder.webhookUrl] with a well-typed [String] value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun webhookUrl(webhookUrl: JsonField) = apply { this.webhookUrl = webhookUrl } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WebhookConfiguration]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): WebhookConfiguration = - WebhookConfiguration( - (webhookEvents ?: JsonMissing.of()).map { it.toImmutable() }, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): WebhookConfiguration = apply { - if (validated) { - return@apply - } - - webhookEvents().ifPresent { it.forEach { it.validate() } } - webhookHeaders().ifPresent { it.validate() } - webhookOutputFormat() - webhookSigningSecret() - webhookUrl() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (webhookEvents.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (webhookHeaders.asKnown().getOrNull()?.validity() ?: 0) + - (if (webhookOutputFormat.asKnown().isPresent) 1 else 0) + - (if (webhookSigningSecret.asKnown().isPresent) 1 else 0) + - (if (webhookUrl.asKnown().isPresent) 1 else 0) - - class WebhookEvent @JsonCreator private constructor(private val value: JsonField) : - Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is - * on an older version than the API, then the API may respond with new members that the - * SDK is unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val BATCH_CANCELLED = of("batch.cancelled") - - @JvmField val BATCH_ERROR = of("batch.error") - - @JvmField val BATCH_PENDING = of("batch.pending") - - @JvmField val BATCH_RUNNING = of("batch.running") - - @JvmField val BATCH_SUCCESS = of("batch.success") - - @JvmField val CLASSIFY_CANCELLED = of("classify.cancelled") - - @JvmField val CLASSIFY_ERROR = of("classify.error") - - @JvmField val CLASSIFY_PARTIAL_SUCCESS = of("classify.partial_success") - - @JvmField val CLASSIFY_PENDING = of("classify.pending") - - @JvmField val CLASSIFY_RUNNING = of("classify.running") - - @JvmField val CLASSIFY_SUCCESS = of("classify.success") - - @JvmField val EXTRACT_CANCELLED = of("extract.cancelled") - - @JvmField val EXTRACT_ERROR = of("extract.error") - - @JvmField val EXTRACT_PARTIAL_SUCCESS = of("extract.partial_success") - - @JvmField val EXTRACT_PENDING = of("extract.pending") - - @JvmField val EXTRACT_SUCCESS = of("extract.success") - - @JvmField val PARSE_CANCELLED = of("parse.cancelled") - - @JvmField val PARSE_ERROR = of("parse.error") - - @JvmField val PARSE_PARTIAL_SUCCESS = of("parse.partial_success") - - @JvmField val PARSE_PENDING = of("parse.pending") - - @JvmField val PARSE_RUNNING = of("parse.running") - - @JvmField val PARSE_SUCCESS = of("parse.success") - - @JvmField val SHEETS_CANCELLED = of("sheets.cancelled") - - @JvmField val SHEETS_ERROR = of("sheets.error") - - @JvmField val SHEETS_PARTIAL_SUCCESS = of("sheets.partial_success") - - @JvmField val SHEETS_PENDING = of("sheets.pending") - - @JvmField val SHEETS_SUCCESS = of("sheets.success") - - @JvmField val SPLIT_CANCELLED = of("split.cancelled") - - @JvmField val SPLIT_ERROR = of("split.error") - - @JvmField val SPLIT_PENDING = of("split.pending") - - @JvmField val SPLIT_PROCESSING = of("split.processing") - - @JvmField val SPLIT_SUCCESS = of("split.success") - - @JvmField val UNMAPPED_EVENT = of("unmapped_event") - - @JvmStatic fun of(value: String) = WebhookEvent(JsonField.of(value)) - } - - /** An enum containing [WebhookEvent]'s known values. */ - enum class Known { - BATCH_CANCELLED, - BATCH_ERROR, - BATCH_PENDING, - BATCH_RUNNING, - BATCH_SUCCESS, - CLASSIFY_CANCELLED, - CLASSIFY_ERROR, - CLASSIFY_PARTIAL_SUCCESS, - CLASSIFY_PENDING, - CLASSIFY_RUNNING, - CLASSIFY_SUCCESS, - EXTRACT_CANCELLED, - EXTRACT_ERROR, - EXTRACT_PARTIAL_SUCCESS, - EXTRACT_PENDING, - EXTRACT_SUCCESS, - PARSE_CANCELLED, - PARSE_ERROR, - PARSE_PARTIAL_SUCCESS, - PARSE_PENDING, - PARSE_RUNNING, - PARSE_SUCCESS, - SHEETS_CANCELLED, - SHEETS_ERROR, - SHEETS_PARTIAL_SUCCESS, - SHEETS_PENDING, - SHEETS_SUCCESS, - SPLIT_CANCELLED, - SPLIT_ERROR, - SPLIT_PENDING, - SPLIT_PROCESSING, - SPLIT_SUCCESS, - UNMAPPED_EVENT, - } - - /** - * An enum containing [WebhookEvent]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [WebhookEvent] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if - * the SDK is on an older version than the API, then the API may respond with new - * members that the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - BATCH_CANCELLED, - BATCH_ERROR, - BATCH_PENDING, - BATCH_RUNNING, - BATCH_SUCCESS, - CLASSIFY_CANCELLED, - CLASSIFY_ERROR, - CLASSIFY_PARTIAL_SUCCESS, - CLASSIFY_PENDING, - CLASSIFY_RUNNING, - CLASSIFY_SUCCESS, - EXTRACT_CANCELLED, - EXTRACT_ERROR, - EXTRACT_PARTIAL_SUCCESS, - EXTRACT_PENDING, - EXTRACT_SUCCESS, - PARSE_CANCELLED, - PARSE_ERROR, - PARSE_PARTIAL_SUCCESS, - PARSE_PENDING, - PARSE_RUNNING, - PARSE_SUCCESS, - SHEETS_CANCELLED, - SHEETS_ERROR, - SHEETS_PARTIAL_SUCCESS, - SHEETS_PENDING, - SHEETS_SUCCESS, - SPLIT_CANCELLED, - SPLIT_ERROR, - SPLIT_PENDING, - SPLIT_PROCESSING, - SPLIT_SUCCESS, - UNMAPPED_EVENT, - /** - * An enum member indicating that [WebhookEvent] was instantiated with an unknown - * value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or - * [Value._UNKNOWN] if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you - * want to throw for the unknown case. - */ - fun value(): Value = - when (this) { - BATCH_CANCELLED -> Value.BATCH_CANCELLED - BATCH_ERROR -> Value.BATCH_ERROR - BATCH_PENDING -> Value.BATCH_PENDING - BATCH_RUNNING -> Value.BATCH_RUNNING - BATCH_SUCCESS -> Value.BATCH_SUCCESS - CLASSIFY_CANCELLED -> Value.CLASSIFY_CANCELLED - CLASSIFY_ERROR -> Value.CLASSIFY_ERROR - CLASSIFY_PARTIAL_SUCCESS -> Value.CLASSIFY_PARTIAL_SUCCESS - CLASSIFY_PENDING -> Value.CLASSIFY_PENDING - CLASSIFY_RUNNING -> Value.CLASSIFY_RUNNING - CLASSIFY_SUCCESS -> Value.CLASSIFY_SUCCESS - EXTRACT_CANCELLED -> Value.EXTRACT_CANCELLED - EXTRACT_ERROR -> Value.EXTRACT_ERROR - EXTRACT_PARTIAL_SUCCESS -> Value.EXTRACT_PARTIAL_SUCCESS - EXTRACT_PENDING -> Value.EXTRACT_PENDING - EXTRACT_SUCCESS -> Value.EXTRACT_SUCCESS - PARSE_CANCELLED -> Value.PARSE_CANCELLED - PARSE_ERROR -> Value.PARSE_ERROR - PARSE_PARTIAL_SUCCESS -> Value.PARSE_PARTIAL_SUCCESS - PARSE_PENDING -> Value.PARSE_PENDING - PARSE_RUNNING -> Value.PARSE_RUNNING - PARSE_SUCCESS -> Value.PARSE_SUCCESS - SHEETS_CANCELLED -> Value.SHEETS_CANCELLED - SHEETS_ERROR -> Value.SHEETS_ERROR - SHEETS_PARTIAL_SUCCESS -> Value.SHEETS_PARTIAL_SUCCESS - SHEETS_PENDING -> Value.SHEETS_PENDING - SHEETS_SUCCESS -> Value.SHEETS_SUCCESS - SPLIT_CANCELLED -> Value.SPLIT_CANCELLED - SPLIT_ERROR -> Value.SPLIT_ERROR - SPLIT_PENDING -> Value.SPLIT_PENDING - SPLIT_PROCESSING -> Value.SPLIT_PROCESSING - SPLIT_SUCCESS -> Value.SPLIT_SUCCESS - UNMAPPED_EVENT -> Value.UNMAPPED_EVENT - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and - * don't want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a - * known member. - */ - fun known(): Known = - when (this) { - BATCH_CANCELLED -> Known.BATCH_CANCELLED - BATCH_ERROR -> Known.BATCH_ERROR - BATCH_PENDING -> Known.BATCH_PENDING - BATCH_RUNNING -> Known.BATCH_RUNNING - BATCH_SUCCESS -> Known.BATCH_SUCCESS - CLASSIFY_CANCELLED -> Known.CLASSIFY_CANCELLED - CLASSIFY_ERROR -> Known.CLASSIFY_ERROR - CLASSIFY_PARTIAL_SUCCESS -> Known.CLASSIFY_PARTIAL_SUCCESS - CLASSIFY_PENDING -> Known.CLASSIFY_PENDING - CLASSIFY_RUNNING -> Known.CLASSIFY_RUNNING - CLASSIFY_SUCCESS -> Known.CLASSIFY_SUCCESS - EXTRACT_CANCELLED -> Known.EXTRACT_CANCELLED - EXTRACT_ERROR -> Known.EXTRACT_ERROR - EXTRACT_PARTIAL_SUCCESS -> Known.EXTRACT_PARTIAL_SUCCESS - EXTRACT_PENDING -> Known.EXTRACT_PENDING - EXTRACT_SUCCESS -> Known.EXTRACT_SUCCESS - PARSE_CANCELLED -> Known.PARSE_CANCELLED - PARSE_ERROR -> Known.PARSE_ERROR - PARSE_PARTIAL_SUCCESS -> Known.PARSE_PARTIAL_SUCCESS - PARSE_PENDING -> Known.PARSE_PENDING - PARSE_RUNNING -> Known.PARSE_RUNNING - PARSE_SUCCESS -> Known.PARSE_SUCCESS - SHEETS_CANCELLED -> Known.SHEETS_CANCELLED - SHEETS_ERROR -> Known.SHEETS_ERROR - SHEETS_PARTIAL_SUCCESS -> Known.SHEETS_PARTIAL_SUCCESS - SHEETS_PENDING -> Known.SHEETS_PENDING - SHEETS_SUCCESS -> Known.SHEETS_SUCCESS - SPLIT_CANCELLED -> Known.SPLIT_CANCELLED - SPLIT_ERROR -> Known.SPLIT_ERROR - SPLIT_PENDING -> Known.SPLIT_PENDING - SPLIT_PROCESSING -> Known.SPLIT_PROCESSING - SPLIT_SUCCESS -> Known.SPLIT_SUCCESS - UNMAPPED_EVENT -> Known.UNMAPPED_EVENT - else -> throw LlamaCloudInvalidDataException("Unknown WebhookEvent: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for - * debugging and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have - * the expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): WebhookEvent = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookEvent && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - /** Custom HTTP headers sent with each webhook request (e.g. auth tokens) */ - class WebhookHeaders - @JsonCreator - private constructor( - @com.fasterxml.jackson.annotation.JsonValue - private val additionalProperties: Map - ) { - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = additionalProperties - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [WebhookHeaders]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [WebhookHeaders]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(webhookHeaders: WebhookHeaders) = apply { - additionalProperties = webhookHeaders.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = - apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { - additionalProperties.remove(key) - } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [WebhookHeaders]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): WebhookHeaders = WebhookHeaders(additionalProperties.toImmutable()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing - * fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match - * its expected type. - */ - fun validate(): WebhookHeaders = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - additionalProperties.count { (_, value) -> !value.isNull() && !value.isMissing() } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookHeaders && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "WebhookHeaders{additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is WebhookConfiguration && - webhookEvents == other.webhookEvents && - webhookHeaders == other.webhookHeaders && - webhookOutputFormat == other.webhookOutputFormat && - webhookSigningSecret == other.webhookSigningSecret && - webhookUrl == other.webhookUrl && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash( - webhookEvents, - webhookHeaders, - webhookOutputFormat, - webhookSigningSecret, - webhookUrl, - additionalProperties, - ) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "WebhookConfiguration{webhookEvents=$webhookEvents, webhookHeaders=$webhookHeaders, webhookOutputFormat=$webhookOutputFormat, webhookSigningSecret=$webhookSigningSecret, webhookUrl=$webhookUrl, additionalProperties=$additionalProperties}" - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetCreateParams && - organizationId == other.organizationId && - projectId == other.projectId && - body == other.body && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash(organizationId, projectId, body, additionalHeaders, additionalQueryParams) - - override fun toString() = - "SheetCreateParams{organizationId=$organizationId, projectId=$projectId, body=$body, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParams.kt deleted file mode 100644 index 18b9462..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParams.kt +++ /dev/null @@ -1,271 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Delete a spreadsheet parsing job and its associated data. */ -class SheetDeleteJobParams -private constructor( - private val spreadsheetJobId: String?, - private val organizationId: String?, - private val projectId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, - private val additionalBodyProperties: Map, -) : Params { - - fun spreadsheetJobId(): Optional = Optional.ofNullable(spreadsheetJobId) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Additional body properties to send with the request. */ - fun _additionalBodyProperties(): Map = additionalBodyProperties - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SheetDeleteJobParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [SheetDeleteJobParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetDeleteJobParams]. */ - class Builder internal constructor() { - - private var spreadsheetJobId: String? = null - private var organizationId: String? = null - private var projectId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - private var additionalBodyProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetDeleteJobParams: SheetDeleteJobParams) = apply { - spreadsheetJobId = sheetDeleteJobParams.spreadsheetJobId - organizationId = sheetDeleteJobParams.organizationId - projectId = sheetDeleteJobParams.projectId - additionalHeaders = sheetDeleteJobParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetDeleteJobParams.additionalQueryParams.toBuilder() - additionalBodyProperties = sheetDeleteJobParams.additionalBodyProperties.toMutableMap() - } - - fun spreadsheetJobId(spreadsheetJobId: String?) = apply { - this.spreadsheetJobId = spreadsheetJobId - } - - /** Alias for calling [Builder.spreadsheetJobId] with `spreadsheetJobId.orElse(null)`. */ - fun spreadsheetJobId(spreadsheetJobId: Optional) = - spreadsheetJobId(spreadsheetJobId.getOrNull()) - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - fun additionalBodyProperties(additionalBodyProperties: Map) = apply { - this.additionalBodyProperties.clear() - putAllAdditionalBodyProperties(additionalBodyProperties) - } - - fun putAdditionalBodyProperty(key: String, value: JsonValue) = apply { - additionalBodyProperties.put(key, value) - } - - fun putAllAdditionalBodyProperties(additionalBodyProperties: Map) = - apply { - this.additionalBodyProperties.putAll(additionalBodyProperties) - } - - fun removeAdditionalBodyProperty(key: String) = apply { - additionalBodyProperties.remove(key) - } - - fun removeAllAdditionalBodyProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalBodyProperty) - } - - /** - * Returns an immutable instance of [SheetDeleteJobParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetDeleteJobParams = - SheetDeleteJobParams( - spreadsheetJobId, - organizationId, - projectId, - additionalHeaders.build(), - additionalQueryParams.build(), - additionalBodyProperties.toImmutable(), - ) - } - - fun _body(): Optional> = - Optional.ofNullable(additionalBodyProperties.ifEmpty { null }) - - fun _pathParam(index: Int): String = - when (index) { - 0 -> spreadsheetJobId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetDeleteJobParams && - spreadsheetJobId == other.spreadsheetJobId && - organizationId == other.organizationId && - projectId == other.projectId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams && - additionalBodyProperties == other.additionalBodyProperties - } - - override fun hashCode(): Int = - Objects.hash( - spreadsheetJobId, - organizationId, - projectId, - additionalHeaders, - additionalQueryParams, - additionalBodyProperties, - ) - - override fun toString() = - "SheetDeleteJobParams{spreadsheetJobId=$spreadsheetJobId, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams, additionalBodyProperties=$additionalBodyProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponse.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponse.kt deleted file mode 100644 index dabd888..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponse.kt +++ /dev/null @@ -1,122 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import java.util.Collections -import java.util.Objects - -class SheetDeleteJobResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor(private val additionalProperties: MutableMap) { - - @JsonCreator private constructor() : this(mutableMapOf()) - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** Returns a mutable builder for constructing an instance of [SheetDeleteJobResponse]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetDeleteJobResponse]. */ - class Builder internal constructor() { - - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetDeleteJobResponse: SheetDeleteJobResponse) = apply { - additionalProperties = sheetDeleteJobResponse.additionalProperties.toMutableMap() - } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SheetDeleteJobResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetDeleteJobResponse = - SheetDeleteJobResponse(additionalProperties.toMutableMap()) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SheetDeleteJobResponse = apply { - if (validated) { - return@apply - } - - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = 0 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetDeleteJobResponse && additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { Objects.hash(additionalProperties) } - - override fun hashCode(): Int = hashCode - - override fun toString() = "SheetDeleteJobResponse{additionalProperties=$additionalProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParams.kt deleted file mode 100644 index 2b9ae01..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParams.kt +++ /dev/null @@ -1,290 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** - * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted regions - * and results if complete, skipping the separate `/results` call. - */ -class SheetGetParams -private constructor( - private val spreadsheetJobId: String?, - private val expand: List?, - private val includeResults: Boolean?, - private val organizationId: String?, - private val projectId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun spreadsheetJobId(): Optional = Optional.ofNullable(spreadsheetJobId) - - /** Optional fields to populate on the response. Valid values: metadata_state_transitions. */ - fun expand(): Optional> = Optional.ofNullable(expand) - - fun includeResults(): Optional = Optional.ofNullable(includeResults) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SheetGetParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [SheetGetParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetGetParams]. */ - class Builder internal constructor() { - - private var spreadsheetJobId: String? = null - private var expand: MutableList? = null - private var includeResults: Boolean? = null - private var organizationId: String? = null - private var projectId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetGetParams: SheetGetParams) = apply { - spreadsheetJobId = sheetGetParams.spreadsheetJobId - expand = sheetGetParams.expand?.toMutableList() - includeResults = sheetGetParams.includeResults - organizationId = sheetGetParams.organizationId - projectId = sheetGetParams.projectId - additionalHeaders = sheetGetParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetGetParams.additionalQueryParams.toBuilder() - } - - fun spreadsheetJobId(spreadsheetJobId: String?) = apply { - this.spreadsheetJobId = spreadsheetJobId - } - - /** Alias for calling [Builder.spreadsheetJobId] with `spreadsheetJobId.orElse(null)`. */ - fun spreadsheetJobId(spreadsheetJobId: Optional) = - spreadsheetJobId(spreadsheetJobId.getOrNull()) - - /** - * Optional fields to populate on the response. Valid values: metadata_state_transitions. - */ - fun expand(expand: List?) = apply { this.expand = expand?.toMutableList() } - - /** Alias for calling [Builder.expand] with `expand.orElse(null)`. */ - fun expand(expand: Optional>) = expand(expand.getOrNull()) - - /** - * Adds a single [String] to [Builder.expand]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addExpand(expand: String) = apply { - this.expand = (this.expand ?: mutableListOf()).apply { add(expand) } - } - - fun includeResults(includeResults: Boolean?) = apply { - this.includeResults = includeResults - } - - /** - * Alias for [Builder.includeResults]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) - - /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ - fun includeResults(includeResults: Optional) = - includeResults(includeResults.getOrNull()) - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetGetParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetGetParams = - SheetGetParams( - spreadsheetJobId, - expand?.toImmutable(), - includeResults, - organizationId, - projectId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> spreadsheetJobId ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - expand?.forEach { put("expand", it) } - includeResults?.let { put("include_results", it.toString()) } - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetGetParams && - spreadsheetJobId == other.spreadsheetJobId && - expand == other.expand && - includeResults == other.includeResults && - organizationId == other.organizationId && - projectId == other.projectId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - spreadsheetJobId, - expand, - includeResults, - organizationId, - projectId, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "SheetGetParams{spreadsheetJobId=$spreadsheetJobId, expand=$expand, includeResults=$includeResults, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParams.kt deleted file mode 100644 index 354eeb7..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParams.kt +++ /dev/null @@ -1,443 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonCreator -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Generate a presigned URL to download a specific extracted region. */ -class SheetGetResultTableParams -private constructor( - private val spreadsheetJobId: String, - private val regionId: String, - private val regionType: RegionType?, - private val expiresAtSeconds: Long?, - private val organizationId: String?, - private val projectId: String?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - fun spreadsheetJobId(): String = spreadsheetJobId - - fun regionId(): String = regionId - - fun regionType(): Optional = Optional.ofNullable(regionType) - - fun expiresAtSeconds(): Optional = Optional.ofNullable(expiresAtSeconds) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetGetResultTableParams]. - * - * The following fields are required: - * ```java - * .spreadsheetJobId() - * .regionId() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetGetResultTableParams]. */ - class Builder internal constructor() { - - private var spreadsheetJobId: String? = null - private var regionId: String? = null - private var regionType: RegionType? = null - private var expiresAtSeconds: Long? = null - private var organizationId: String? = null - private var projectId: String? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetGetResultTableParams: SheetGetResultTableParams) = apply { - spreadsheetJobId = sheetGetResultTableParams.spreadsheetJobId - regionId = sheetGetResultTableParams.regionId - regionType = sheetGetResultTableParams.regionType - expiresAtSeconds = sheetGetResultTableParams.expiresAtSeconds - organizationId = sheetGetResultTableParams.organizationId - projectId = sheetGetResultTableParams.projectId - additionalHeaders = sheetGetResultTableParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetGetResultTableParams.additionalQueryParams.toBuilder() - } - - fun spreadsheetJobId(spreadsheetJobId: String) = apply { - this.spreadsheetJobId = spreadsheetJobId - } - - fun regionId(regionId: String) = apply { this.regionId = regionId } - - fun regionType(regionType: RegionType?) = apply { this.regionType = regionType } - - /** Alias for calling [Builder.regionType] with `regionType.orElse(null)`. */ - fun regionType(regionType: Optional) = regionType(regionType.getOrNull()) - - fun expiresAtSeconds(expiresAtSeconds: Long?) = apply { - this.expiresAtSeconds = expiresAtSeconds - } - - /** - * Alias for [Builder.expiresAtSeconds]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun expiresAtSeconds(expiresAtSeconds: Long) = expiresAtSeconds(expiresAtSeconds as Long?) - - /** Alias for calling [Builder.expiresAtSeconds] with `expiresAtSeconds.orElse(null)`. */ - fun expiresAtSeconds(expiresAtSeconds: Optional) = - expiresAtSeconds(expiresAtSeconds.getOrNull()) - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetGetResultTableParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .spreadsheetJobId() - * .regionId() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetGetResultTableParams = - SheetGetResultTableParams( - checkRequired("spreadsheetJobId", spreadsheetJobId), - checkRequired("regionId", regionId), - regionType, - expiresAtSeconds, - organizationId, - projectId, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - fun _pathParam(index: Int): String = - when (index) { - 0 -> spreadsheetJobId - 1 -> regionId - 2 -> regionType?.toString() ?: "" - else -> "" - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - expiresAtSeconds?.let { put("expires_at_seconds", it.toString()) } - organizationId?.let { put("organization_id", it) } - projectId?.let { put("project_id", it) } - putAll(additionalQueryParams) - } - .build() - - class RegionType @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CELL_METADATA = of("cell_metadata") - - @JvmField val EXTRA = of("extra") - - @JvmField val TABLE = of("table") - - @JvmStatic fun of(value: String) = RegionType(JsonField.of(value)) - } - - /** An enum containing [RegionType]'s known values. */ - enum class Known { - CELL_METADATA, - EXTRA, - TABLE, - } - - /** - * An enum containing [RegionType]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [RegionType] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CELL_METADATA, - EXTRA, - TABLE, - /** - * An enum member indicating that [RegionType] was instantiated with an unknown value. - */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CELL_METADATA -> Value.CELL_METADATA - EXTRA -> Value.EXTRA - TABLE -> Value.TABLE - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CELL_METADATA -> Known.CELL_METADATA - EXTRA -> Known.EXTRA - TABLE -> Known.TABLE - else -> throw LlamaCloudInvalidDataException("Unknown RegionType: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): RegionType = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is RegionType && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetGetResultTableParams && - spreadsheetJobId == other.spreadsheetJobId && - regionId == other.regionId && - regionType == other.regionType && - expiresAtSeconds == other.expiresAtSeconds && - organizationId == other.organizationId && - projectId == other.projectId && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - spreadsheetJobId, - regionId, - regionType, - expiresAtSeconds, - organizationId, - projectId, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "SheetGetResultTableParams{spreadsheetJobId=$spreadsheetJobId, regionId=$regionId, regionType=$regionType, expiresAtSeconds=$expiresAtSeconds, organizationId=$organizationId, projectId=$projectId, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPage.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPage.kt deleted file mode 100644 index 67eb8ae..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPage.kt +++ /dev/null @@ -1,131 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.AutoPager -import ai.llamaindex.llamacloud.core.Page -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.services.blocking.SheetService -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** @see SheetService.list */ -class SheetListPage -private constructor( - private val service: SheetService, - private val params: SheetListParams, - private val response: SheetListPageResponse, -) : Page { - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.items - */ - override fun items(): List = - response._items().getOptional("items").getOrNull() ?: emptyList() - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.nextPageToken - */ - fun nextPageToken(): Optional = response._nextPageToken().getOptional("next_page_token") - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageToken().isPresent - - fun nextPageParams(): SheetListParams { - val nextCursor = - nextPageToken().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().pageToken(nextCursor).build() - } - - override fun nextPage(): SheetListPage = service.list(nextPageParams()) - - fun autoPager(): AutoPager = AutoPager.from(this) - - /** The parameters that were used to request this page. */ - fun params(): SheetListParams = params - - /** The response that this page was parsed from. */ - fun response(): SheetListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetListPage]. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListPage]. */ - class Builder internal constructor() { - - private var service: SheetService? = null - private var params: SheetListParams? = null - private var response: SheetListPageResponse? = null - - @JvmSynthetic - internal fun from(sheetListPage: SheetListPage) = apply { - service = sheetListPage.service - params = sheetListPage.params - response = sheetListPage.response - } - - fun service(service: SheetService) = apply { this.service = service } - - /** The parameters that were used to request this page. */ - fun params(params: SheetListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: SheetListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [SheetListPage]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetListPage = - SheetListPage( - checkRequired("service", service), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListPage && - service == other.service && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, params, response) - - override fun toString() = "SheetListPage{service=$service, params=$params, response=$response}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageAsync.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageAsync.kt deleted file mode 100644 index 0731373..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageAsync.kt +++ /dev/null @@ -1,145 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.AutoPagerAsync -import ai.llamaindex.llamacloud.core.PageAsync -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.services.async.SheetServiceAsync -import java.util.Objects -import java.util.Optional -import java.util.concurrent.CompletableFuture -import java.util.concurrent.Executor -import kotlin.jvm.optionals.getOrNull - -/** @see SheetServiceAsync.list */ -class SheetListPageAsync -private constructor( - private val service: SheetServiceAsync, - private val streamHandlerExecutor: Executor, - private val params: SheetListParams, - private val response: SheetListPageResponse, -) : PageAsync { - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.items - */ - override fun items(): List = - response._items().getOptional("items").getOrNull() ?: emptyList() - - /** - * Delegates to [SheetListPageResponse], but gracefully handles missing data. - * - * @see SheetListPageResponse.nextPageToken - */ - fun nextPageToken(): Optional = response._nextPageToken().getOptional("next_page_token") - - override fun hasNextPage(): Boolean = items().isNotEmpty() && nextPageToken().isPresent - - fun nextPageParams(): SheetListParams { - val nextCursor = - nextPageToken().getOrNull() - ?: throw IllegalStateException("Cannot construct next page params") - return params.toBuilder().pageToken(nextCursor).build() - } - - override fun nextPage(): CompletableFuture = service.list(nextPageParams()) - - fun autoPager(): AutoPagerAsync = AutoPagerAsync.from(this, streamHandlerExecutor) - - /** The parameters that were used to request this page. */ - fun params(): SheetListParams = params - - /** The response that this page was parsed from. */ - fun response(): SheetListPageResponse = response - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetListPageAsync]. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListPageAsync]. */ - class Builder internal constructor() { - - private var service: SheetServiceAsync? = null - private var streamHandlerExecutor: Executor? = null - private var params: SheetListParams? = null - private var response: SheetListPageResponse? = null - - @JvmSynthetic - internal fun from(sheetListPageAsync: SheetListPageAsync) = apply { - service = sheetListPageAsync.service - streamHandlerExecutor = sheetListPageAsync.streamHandlerExecutor - params = sheetListPageAsync.params - response = sheetListPageAsync.response - } - - fun service(service: SheetServiceAsync) = apply { this.service = service } - - fun streamHandlerExecutor(streamHandlerExecutor: Executor) = apply { - this.streamHandlerExecutor = streamHandlerExecutor - } - - /** The parameters that were used to request this page. */ - fun params(params: SheetListParams) = apply { this.params = params } - - /** The response that this page was parsed from. */ - fun response(response: SheetListPageResponse) = apply { this.response = response } - - /** - * Returns an immutable instance of [SheetListPageAsync]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .service() - * .streamHandlerExecutor() - * .params() - * .response() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetListPageAsync = - SheetListPageAsync( - checkRequired("service", service), - checkRequired("streamHandlerExecutor", streamHandlerExecutor), - checkRequired("params", params), - checkRequired("response", response), - ) - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListPageAsync && - service == other.service && - streamHandlerExecutor == other.streamHandlerExecutor && - params == other.params && - response == other.response - } - - override fun hashCode(): Int = Objects.hash(service, streamHandlerExecutor, params, response) - - override fun toString() = - "SheetListPageAsync{service=$service, streamHandlerExecutor=$streamHandlerExecutor, params=$params, response=$response}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponse.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponse.kt deleted file mode 100644 index faf7e40..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponse.kt +++ /dev/null @@ -1,302 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.ExcludeMissing -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.JsonMissing -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.checkKnown -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import com.fasterxml.jackson.annotation.JsonAnyGetter -import com.fasterxml.jackson.annotation.JsonAnySetter -import com.fasterxml.jackson.annotation.JsonCreator -import com.fasterxml.jackson.annotation.JsonProperty -import java.util.Collections -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** Response schema for paginated spreadsheet job queries. */ -class SheetListPageResponse -@JsonCreator(mode = JsonCreator.Mode.DISABLED) -private constructor( - private val items: JsonField>, - private val nextPageToken: JsonField, - private val totalSize: JsonField, - private val additionalProperties: MutableMap, -) { - - @JsonCreator - private constructor( - @JsonProperty("items") @ExcludeMissing items: JsonField> = JsonMissing.of(), - @JsonProperty("next_page_token") - @ExcludeMissing - nextPageToken: JsonField = JsonMissing.of(), - @JsonProperty("total_size") @ExcludeMissing totalSize: JsonField = JsonMissing.of(), - ) : this(items, nextPageToken, totalSize, mutableMapOf()) - - /** - * The list of items. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type or is - * unexpectedly missing or null (e.g. if the server responded with an unexpected value). - */ - fun items(): List = items.getRequired("items") - - /** - * A token, which can be sent as page_token to retrieve the next page. If this field is omitted, - * there are no subsequent pages. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun nextPageToken(): Optional = nextPageToken.getOptional("next_page_token") - - /** - * The total number of items available. This is only populated when specifically requested. The - * value may be an estimate and can be used for display purposes only. - * - * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the - * server responded with an unexpected value). - */ - fun totalSize(): Optional = totalSize.getOptional("total_size") - - /** - * Returns the raw JSON value of [items]. - * - * Unlike [items], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("items") @ExcludeMissing fun _items(): JsonField> = items - - /** - * Returns the raw JSON value of [nextPageToken]. - * - * Unlike [nextPageToken], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("next_page_token") - @ExcludeMissing - fun _nextPageToken(): JsonField = nextPageToken - - /** - * Returns the raw JSON value of [totalSize]. - * - * Unlike [totalSize], this method doesn't throw if the JSON field has an unexpected type. - */ - @JsonProperty("total_size") @ExcludeMissing fun _totalSize(): JsonField = totalSize - - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { - additionalProperties.put(key, value) - } - - @JsonAnyGetter - @ExcludeMissing - fun _additionalProperties(): Map = - Collections.unmodifiableMap(additionalProperties) - - fun toBuilder() = Builder().from(this) - - companion object { - - /** - * Returns a mutable builder for constructing an instance of [SheetListPageResponse]. - * - * The following fields are required: - * ```java - * .items() - * ``` - */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListPageResponse]. */ - class Builder internal constructor() { - - private var items: JsonField>? = null - private var nextPageToken: JsonField = JsonMissing.of() - private var totalSize: JsonField = JsonMissing.of() - private var additionalProperties: MutableMap = mutableMapOf() - - @JvmSynthetic - internal fun from(sheetListPageResponse: SheetListPageResponse) = apply { - items = sheetListPageResponse.items.map { it.toMutableList() } - nextPageToken = sheetListPageResponse.nextPageToken - totalSize = sheetListPageResponse.totalSize - additionalProperties = sheetListPageResponse.additionalProperties.toMutableMap() - } - - /** The list of items. */ - fun items(items: List) = items(JsonField.of(items)) - - /** - * Sets [Builder.items] to an arbitrary JSON value. - * - * You should usually call [Builder.items] with a well-typed `List` value - * instead. This method is primarily for setting the field to an undocumented or not yet - * supported value. - */ - fun items(items: JsonField>) = apply { - this.items = items.map { it.toMutableList() } - } - - /** - * Adds a single [SheetsJob] to [items]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addItem(item: SheetsJob) = apply { - items = - (items ?: JsonField.of(mutableListOf())).also { checkKnown("items", it).add(item) } - } - - /** - * A token, which can be sent as page_token to retrieve the next page. If this field is - * omitted, there are no subsequent pages. - */ - fun nextPageToken(nextPageToken: String?) = - nextPageToken(JsonField.ofNullable(nextPageToken)) - - /** Alias for calling [Builder.nextPageToken] with `nextPageToken.orElse(null)`. */ - fun nextPageToken(nextPageToken: Optional) = - nextPageToken(nextPageToken.getOrNull()) - - /** - * Sets [Builder.nextPageToken] to an arbitrary JSON value. - * - * You should usually call [Builder.nextPageToken] with a well-typed [String] value instead. - * This method is primarily for setting the field to an undocumented or not yet supported - * value. - */ - fun nextPageToken(nextPageToken: JsonField) = apply { - this.nextPageToken = nextPageToken - } - - /** - * The total number of items available. This is only populated when specifically requested. - * The value may be an estimate and can be used for display purposes only. - */ - fun totalSize(totalSize: Long?) = totalSize(JsonField.ofNullable(totalSize)) - - /** - * Alias for [Builder.totalSize]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun totalSize(totalSize: Long) = totalSize(totalSize as Long?) - - /** Alias for calling [Builder.totalSize] with `totalSize.orElse(null)`. */ - fun totalSize(totalSize: Optional) = totalSize(totalSize.getOrNull()) - - /** - * Sets [Builder.totalSize] to an arbitrary JSON value. - * - * You should usually call [Builder.totalSize] with a well-typed [Long] value instead. This - * method is primarily for setting the field to an undocumented or not yet supported value. - */ - fun totalSize(totalSize: JsonField) = apply { this.totalSize = totalSize } - - fun additionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.clear() - putAllAdditionalProperties(additionalProperties) - } - - fun putAdditionalProperty(key: String, value: JsonValue) = apply { - additionalProperties.put(key, value) - } - - fun putAllAdditionalProperties(additionalProperties: Map) = apply { - this.additionalProperties.putAll(additionalProperties) - } - - fun removeAdditionalProperty(key: String) = apply { additionalProperties.remove(key) } - - fun removeAllAdditionalProperties(keys: Set) = apply { - keys.forEach(::removeAdditionalProperty) - } - - /** - * Returns an immutable instance of [SheetListPageResponse]. - * - * Further updates to this [Builder] will not mutate the returned instance. - * - * The following fields are required: - * ```java - * .items() - * ``` - * - * @throws IllegalStateException if any required field is unset. - */ - fun build(): SheetListPageResponse = - SheetListPageResponse( - checkRequired("items", items).map { it.toImmutable() }, - nextPageToken, - totalSize, - additionalProperties.toMutableMap(), - ) - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): SheetListPageResponse = apply { - if (validated) { - return@apply - } - - items().forEach { it.validate() } - nextPageToken() - totalSize() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic - internal fun validity(): Int = - (items.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + - (if (nextPageToken.asKnown().isPresent) 1 else 0) + - (if (totalSize.asKnown().isPresent) 1 else 0) - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListPageResponse && - items == other.items && - nextPageToken == other.nextPageToken && - totalSize == other.totalSize && - additionalProperties == other.additionalProperties - } - - private val hashCode: Int by lazy { - Objects.hash(items, nextPageToken, totalSize, additionalProperties) - } - - override fun hashCode(): Int = hashCode - - override fun toString() = - "SheetListPageResponse{items=$items, nextPageToken=$nextPageToken, totalSize=$totalSize, additionalProperties=$additionalProperties}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParams.kt deleted file mode 100644 index ba24f31..0000000 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParams.kt +++ /dev/null @@ -1,543 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.Enum -import ai.llamaindex.llamacloud.core.JsonField -import ai.llamaindex.llamacloud.core.Params -import ai.llamaindex.llamacloud.core.http.Headers -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.core.toImmutable -import ai.llamaindex.llamacloud.errors.LlamaCloudInvalidDataException -import com.fasterxml.jackson.annotation.JsonCreator -import java.time.OffsetDateTime -import java.time.format.DateTimeFormatter -import java.util.Objects -import java.util.Optional -import kotlin.jvm.optionals.getOrNull - -/** List spreadsheet parsing jobs. */ -class SheetListParams -private constructor( - private val configurationId: String?, - private val createdAtOnOrAfter: OffsetDateTime?, - private val createdAtOnOrBefore: OffsetDateTime?, - private val includeResults: Boolean?, - private val jobIds: List?, - private val organizationId: String?, - private val pageSize: Long?, - private val pageToken: String?, - private val projectId: String?, - private val status: Status?, - private val additionalHeaders: Headers, - private val additionalQueryParams: QueryParams, -) : Params { - - /** Filter by saved configuration ID */ - fun configurationId(): Optional = Optional.ofNullable(configurationId) - - /** Include items created at or after this timestamp (inclusive) */ - fun createdAtOnOrAfter(): Optional = Optional.ofNullable(createdAtOnOrAfter) - - /** Include items created at or before this timestamp (inclusive) */ - fun createdAtOnOrBefore(): Optional = Optional.ofNullable(createdAtOnOrBefore) - - fun includeResults(): Optional = Optional.ofNullable(includeResults) - - /** Filter by specific job IDs */ - fun jobIds(): Optional> = Optional.ofNullable(jobIds) - - fun organizationId(): Optional = Optional.ofNullable(organizationId) - - fun pageSize(): Optional = Optional.ofNullable(pageSize) - - fun pageToken(): Optional = Optional.ofNullable(pageToken) - - fun projectId(): Optional = Optional.ofNullable(projectId) - - /** Filter by job status */ - fun status(): Optional = Optional.ofNullable(status) - - /** Additional headers to send with the request. */ - fun _additionalHeaders(): Headers = additionalHeaders - - /** Additional query param to send with the request. */ - fun _additionalQueryParams(): QueryParams = additionalQueryParams - - fun toBuilder() = Builder().from(this) - - companion object { - - @JvmStatic fun none(): SheetListParams = builder().build() - - /** Returns a mutable builder for constructing an instance of [SheetListParams]. */ - @JvmStatic fun builder() = Builder() - } - - /** A builder for [SheetListParams]. */ - class Builder internal constructor() { - - private var configurationId: String? = null - private var createdAtOnOrAfter: OffsetDateTime? = null - private var createdAtOnOrBefore: OffsetDateTime? = null - private var includeResults: Boolean? = null - private var jobIds: MutableList? = null - private var organizationId: String? = null - private var pageSize: Long? = null - private var pageToken: String? = null - private var projectId: String? = null - private var status: Status? = null - private var additionalHeaders: Headers.Builder = Headers.builder() - private var additionalQueryParams: QueryParams.Builder = QueryParams.builder() - - @JvmSynthetic - internal fun from(sheetListParams: SheetListParams) = apply { - configurationId = sheetListParams.configurationId - createdAtOnOrAfter = sheetListParams.createdAtOnOrAfter - createdAtOnOrBefore = sheetListParams.createdAtOnOrBefore - includeResults = sheetListParams.includeResults - jobIds = sheetListParams.jobIds?.toMutableList() - organizationId = sheetListParams.organizationId - pageSize = sheetListParams.pageSize - pageToken = sheetListParams.pageToken - projectId = sheetListParams.projectId - status = sheetListParams.status - additionalHeaders = sheetListParams.additionalHeaders.toBuilder() - additionalQueryParams = sheetListParams.additionalQueryParams.toBuilder() - } - - /** Filter by saved configuration ID */ - fun configurationId(configurationId: String?) = apply { - this.configurationId = configurationId - } - - /** Alias for calling [Builder.configurationId] with `configurationId.orElse(null)`. */ - fun configurationId(configurationId: Optional) = - configurationId(configurationId.getOrNull()) - - /** Include items created at or after this timestamp (inclusive) */ - fun createdAtOnOrAfter(createdAtOnOrAfter: OffsetDateTime?) = apply { - this.createdAtOnOrAfter = createdAtOnOrAfter - } - - /** - * Alias for calling [Builder.createdAtOnOrAfter] with `createdAtOnOrAfter.orElse(null)`. - */ - fun createdAtOnOrAfter(createdAtOnOrAfter: Optional) = - createdAtOnOrAfter(createdAtOnOrAfter.getOrNull()) - - /** Include items created at or before this timestamp (inclusive) */ - fun createdAtOnOrBefore(createdAtOnOrBefore: OffsetDateTime?) = apply { - this.createdAtOnOrBefore = createdAtOnOrBefore - } - - /** - * Alias for calling [Builder.createdAtOnOrBefore] with `createdAtOnOrBefore.orElse(null)`. - */ - fun createdAtOnOrBefore(createdAtOnOrBefore: Optional) = - createdAtOnOrBefore(createdAtOnOrBefore.getOrNull()) - - fun includeResults(includeResults: Boolean?) = apply { - this.includeResults = includeResults - } - - /** - * Alias for [Builder.includeResults]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun includeResults(includeResults: Boolean) = includeResults(includeResults as Boolean?) - - /** Alias for calling [Builder.includeResults] with `includeResults.orElse(null)`. */ - fun includeResults(includeResults: Optional) = - includeResults(includeResults.getOrNull()) - - /** Filter by specific job IDs */ - fun jobIds(jobIds: List?) = apply { this.jobIds = jobIds?.toMutableList() } - - /** Alias for calling [Builder.jobIds] with `jobIds.orElse(null)`. */ - fun jobIds(jobIds: Optional>) = jobIds(jobIds.getOrNull()) - - /** - * Adds a single [String] to [jobIds]. - * - * @throws IllegalStateException if the field was previously set to a non-list. - */ - fun addJobId(jobId: String) = apply { - jobIds = (jobIds ?: mutableListOf()).apply { add(jobId) } - } - - fun organizationId(organizationId: String?) = apply { this.organizationId = organizationId } - - /** Alias for calling [Builder.organizationId] with `organizationId.orElse(null)`. */ - fun organizationId(organizationId: Optional) = - organizationId(organizationId.getOrNull()) - - fun pageSize(pageSize: Long?) = apply { this.pageSize = pageSize } - - /** - * Alias for [Builder.pageSize]. - * - * This unboxed primitive overload exists for backwards compatibility. - */ - fun pageSize(pageSize: Long) = pageSize(pageSize as Long?) - - /** Alias for calling [Builder.pageSize] with `pageSize.orElse(null)`. */ - fun pageSize(pageSize: Optional) = pageSize(pageSize.getOrNull()) - - fun pageToken(pageToken: String?) = apply { this.pageToken = pageToken } - - /** Alias for calling [Builder.pageToken] with `pageToken.orElse(null)`. */ - fun pageToken(pageToken: Optional) = pageToken(pageToken.getOrNull()) - - fun projectId(projectId: String?) = apply { this.projectId = projectId } - - /** Alias for calling [Builder.projectId] with `projectId.orElse(null)`. */ - fun projectId(projectId: Optional) = projectId(projectId.getOrNull()) - - /** Filter by job status */ - fun status(status: Status?) = apply { this.status = status } - - /** Alias for calling [Builder.status] with `status.orElse(null)`. */ - fun status(status: Optional) = status(status.getOrNull()) - - fun additionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun additionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.clear() - putAllAdditionalHeaders(additionalHeaders) - } - - fun putAdditionalHeader(name: String, value: String) = apply { - additionalHeaders.put(name, value) - } - - fun putAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.put(name, values) - } - - fun putAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun putAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.putAll(additionalHeaders) - } - - fun replaceAdditionalHeaders(name: String, value: String) = apply { - additionalHeaders.replace(name, value) - } - - fun replaceAdditionalHeaders(name: String, values: Iterable) = apply { - additionalHeaders.replace(name, values) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Headers) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun replaceAllAdditionalHeaders(additionalHeaders: Map>) = apply { - this.additionalHeaders.replaceAll(additionalHeaders) - } - - fun removeAdditionalHeaders(name: String) = apply { additionalHeaders.remove(name) } - - fun removeAllAdditionalHeaders(names: Set) = apply { - additionalHeaders.removeAll(names) - } - - fun additionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun additionalQueryParams(additionalQueryParams: Map>) = apply { - this.additionalQueryParams.clear() - putAllAdditionalQueryParams(additionalQueryParams) - } - - fun putAdditionalQueryParam(key: String, value: String) = apply { - additionalQueryParams.put(key, value) - } - - fun putAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.put(key, values) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun putAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.putAll(additionalQueryParams) - } - - fun replaceAdditionalQueryParams(key: String, value: String) = apply { - additionalQueryParams.replace(key, value) - } - - fun replaceAdditionalQueryParams(key: String, values: Iterable) = apply { - additionalQueryParams.replace(key, values) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: QueryParams) = apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun replaceAllAdditionalQueryParams(additionalQueryParams: Map>) = - apply { - this.additionalQueryParams.replaceAll(additionalQueryParams) - } - - fun removeAdditionalQueryParams(key: String) = apply { additionalQueryParams.remove(key) } - - fun removeAllAdditionalQueryParams(keys: Set) = apply { - additionalQueryParams.removeAll(keys) - } - - /** - * Returns an immutable instance of [SheetListParams]. - * - * Further updates to this [Builder] will not mutate the returned instance. - */ - fun build(): SheetListParams = - SheetListParams( - configurationId, - createdAtOnOrAfter, - createdAtOnOrBefore, - includeResults, - jobIds?.toImmutable(), - organizationId, - pageSize, - pageToken, - projectId, - status, - additionalHeaders.build(), - additionalQueryParams.build(), - ) - } - - override fun _headers(): Headers = additionalHeaders - - override fun _queryParams(): QueryParams = - QueryParams.builder() - .apply { - configurationId?.let { put("configuration_id", it) } - createdAtOnOrAfter?.let { - put("created_at_on_or_after", DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it)) - } - createdAtOnOrBefore?.let { - put( - "created_at_on_or_before", - DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(it), - ) - } - includeResults?.let { put("include_results", it.toString()) } - jobIds?.forEach { put("job_ids", it) } - organizationId?.let { put("organization_id", it) } - pageSize?.let { put("page_size", it.toString()) } - pageToken?.let { put("page_token", it) } - projectId?.let { put("project_id", it) } - status?.let { put("status", it.toString()) } - putAll(additionalQueryParams) - } - .build() - - /** Filter by job status */ - class Status @JsonCreator private constructor(private val value: JsonField) : Enum { - - /** - * Returns this class instance's raw value. - * - * This is usually only useful if this instance was deserialized from data that doesn't - * match any known member, and you want to know that value. For example, if the SDK is on an - * older version than the API, then the API may respond with new members that the SDK is - * unaware of. - */ - @com.fasterxml.jackson.annotation.JsonValue fun _value(): JsonField = value - - companion object { - - @JvmField val CANCELLED = of("CANCELLED") - - @JvmField val ERROR = of("ERROR") - - @JvmField val PARTIAL_SUCCESS = of("PARTIAL_SUCCESS") - - @JvmField val PENDING = of("PENDING") - - @JvmField val SUCCESS = of("SUCCESS") - - @JvmStatic fun of(value: String) = Status(JsonField.of(value)) - } - - /** An enum containing [Status]'s known values. */ - enum class Known { - CANCELLED, - ERROR, - PARTIAL_SUCCESS, - PENDING, - SUCCESS, - } - - /** - * An enum containing [Status]'s known values, as well as an [_UNKNOWN] member. - * - * An instance of [Status] can contain an unknown value in a couple of cases: - * - It was deserialized from data that doesn't match any known member. For example, if the - * SDK is on an older version than the API, then the API may respond with new members that - * the SDK is unaware of. - * - It was constructed with an arbitrary value using the [of] method. - */ - enum class Value { - CANCELLED, - ERROR, - PARTIAL_SUCCESS, - PENDING, - SUCCESS, - /** An enum member indicating that [Status] was instantiated with an unknown value. */ - _UNKNOWN, - } - - /** - * Returns an enum member corresponding to this class instance's value, or [Value._UNKNOWN] - * if the class was instantiated with an unknown value. - * - * Use the [known] method instead if you're certain the value is always known or if you want - * to throw for the unknown case. - */ - fun value(): Value = - when (this) { - CANCELLED -> Value.CANCELLED - ERROR -> Value.ERROR - PARTIAL_SUCCESS -> Value.PARTIAL_SUCCESS - PENDING -> Value.PENDING - SUCCESS -> Value.SUCCESS - else -> Value._UNKNOWN - } - - /** - * Returns an enum member corresponding to this class instance's value. - * - * Use the [value] method instead if you're uncertain the value is always known and don't - * want to throw for the unknown case. - * - * @throws LlamaCloudInvalidDataException if this class instance's value is a not a known - * member. - */ - fun known(): Known = - when (this) { - CANCELLED -> Known.CANCELLED - ERROR -> Known.ERROR - PARTIAL_SUCCESS -> Known.PARTIAL_SUCCESS - PENDING -> Known.PENDING - SUCCESS -> Known.SUCCESS - else -> throw LlamaCloudInvalidDataException("Unknown Status: $value") - } - - /** - * Returns this class instance's primitive wire representation. - * - * This differs from the [toString] method because that method is primarily for debugging - * and generally doesn't throw. - * - * @throws LlamaCloudInvalidDataException if this class instance's value does not have the - * expected primitive type. - */ - fun asString(): String = - _value().asString().orElseThrow { - LlamaCloudInvalidDataException("Value is not a String") - } - - private var validated: Boolean = false - - /** - * Validates that the types of all values in this object match their expected types - * recursively. - * - * This method is _not_ forwards compatible with new types from the API for existing fields. - * - * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match its - * expected type. - */ - fun validate(): Status = apply { - if (validated) { - return@apply - } - - known() - validated = true - } - - fun isValid(): Boolean = - try { - validate() - true - } catch (e: LlamaCloudInvalidDataException) { - false - } - - /** - * Returns a score indicating how many valid values are contained in this object - * recursively. - * - * Used for best match union deserialization. - */ - @JvmSynthetic internal fun validity(): Int = if (value() == Value._UNKNOWN) 0 else 1 - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is Status && value == other.value - } - - override fun hashCode() = value.hashCode() - - override fun toString() = value.toString() - } - - override fun equals(other: Any?): Boolean { - if (this === other) { - return true - } - - return other is SheetListParams && - configurationId == other.configurationId && - createdAtOnOrAfter == other.createdAtOnOrAfter && - createdAtOnOrBefore == other.createdAtOnOrBefore && - includeResults == other.includeResults && - jobIds == other.jobIds && - organizationId == other.organizationId && - pageSize == other.pageSize && - pageToken == other.pageToken && - projectId == other.projectId && - status == other.status && - additionalHeaders == other.additionalHeaders && - additionalQueryParams == other.additionalQueryParams - } - - override fun hashCode(): Int = - Objects.hash( - configurationId, - createdAtOnOrAfter, - createdAtOnOrBefore, - includeResults, - jobIds, - organizationId, - pageSize, - pageToken, - projectId, - status, - additionalHeaders, - additionalQueryParams, - ) - - override fun toString() = - "SheetListParams{configurationId=$configurationId, createdAtOnOrAfter=$createdAtOnOrAfter, createdAtOnOrBefore=$createdAtOnOrBefore, includeResults=$includeResults, jobIds=$jobIds, organizationId=$organizationId, pageSize=$pageSize, pageToken=$pageToken, projectId=$projectId, status=$status, additionalHeaders=$additionalHeaders, additionalQueryParams=$additionalQueryParams}" -} diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsync.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsync.kt index d45bb96..e4812cc 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsync.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsync.kt @@ -3,18 +3,6 @@ package ai.llamaindex.llamacloud.services.async import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import ai.llamaindex.llamacloud.models.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.sheets.SheetListPageAsync -import ai.llamaindex.llamacloud.models.sheets.SheetListParams -import java.util.concurrent.CompletableFuture import java.util.function.Consumer interface SheetServiceAsync { @@ -31,138 +19,6 @@ interface SheetServiceAsync { */ fun withOptions(modifier: Consumer): SheetServiceAsync - /** - * Create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (an inline parsing configuration) or - * `configuration_id` (a saved configuration preset). If neither is provided, a default - * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` - * status notifications. - */ - fun create(params: SheetCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** List spreadsheet parsing jobs. */ - fun list(): CompletableFuture = list(SheetListParams.none()) - - /** @see list */ - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - fun list( - params: SheetListParams = SheetListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): CompletableFuture = - list(SheetListParams.none(), requestOptions) - - /** Delete a spreadsheet parsing job and its associated data. */ - fun deleteJob(spreadsheetJobId: String): CompletableFuture = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): CompletableFuture = - deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see deleteJob */ - fun deleteJob(params: SheetDeleteJobParams): CompletableFuture = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted - * regions and results if complete, skipping the separate `/results` call. - */ - fun get(spreadsheetJobId: String): CompletableFuture = - get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - ): CompletableFuture = get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see get */ - fun get(params: SheetGetParams): CompletableFuture = - get(params, RequestOptions.none()) - - /** @see get */ - fun get( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** Generate a presigned URL to download a specific extracted region. */ - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): CompletableFuture = getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - fun getResultTable(params: SheetGetResultTableParams): CompletableFuture = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - /** A view of [SheetServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -174,156 +30,5 @@ interface SheetServiceAsync { fun withOptions( modifier: Consumer ): SheetServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /api/v1/sheets/jobs`, but is otherwise the same as - * [SheetServiceAsync.create]. - */ - fun create(params: SheetCreateParams): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /api/v1/sheets/jobs`, but is otherwise the same as - * [SheetServiceAsync.list]. - */ - fun list(): CompletableFuture> = - list(SheetListParams.none()) - - /** @see list */ - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - fun list( - params: SheetListParams = SheetListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(SheetListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is - * otherwise the same as [SheetServiceAsync.deleteJob]. - */ - fun deleteJob( - spreadsheetJobId: String - ): CompletableFuture> = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): CompletableFuture> = - deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see deleteJob */ - fun deleteJob( - params: SheetDeleteJobParams - ): CompletableFuture> = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is - * otherwise the same as [SheetServiceAsync.get]. - */ - fun get(spreadsheetJobId: String): CompletableFuture> = - get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - ): CompletableFuture> = - get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see get */ - fun get(params: SheetGetParams): CompletableFuture> = - get(params, RequestOptions.none()) - - /** @see get */ - fun get( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get - * /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, but - * is otherwise the same as [SheetServiceAsync.getResultTable]. - */ - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): CompletableFuture> = - getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - fun getResultTable( - params: SheetGetResultTableParams - ): CompletableFuture> = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncImpl.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncImpl.kt index ff53901..80d3203 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncImpl.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncImpl.kt @@ -3,32 +3,7 @@ package ai.llamaindex.llamacloud.services.async import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.handlers.errorBodyHandler -import ai.llamaindex.llamacloud.core.handlers.errorHandler -import ai.llamaindex.llamacloud.core.handlers.jsonHandler -import ai.llamaindex.llamacloud.core.http.HttpMethod -import ai.llamaindex.llamacloud.core.http.HttpRequest -import ai.llamaindex.llamacloud.core.http.HttpResponse -import ai.llamaindex.llamacloud.core.http.HttpResponse.Handler -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.core.http.json -import ai.llamaindex.llamacloud.core.http.parseable -import ai.llamaindex.llamacloud.core.prepareAsync -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import ai.llamaindex.llamacloud.models.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.sheets.SheetListPageAsync -import ai.llamaindex.llamacloud.models.sheets.SheetListPageResponse -import ai.llamaindex.llamacloud.models.sheets.SheetListParams -import java.util.concurrent.CompletableFuture import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull class SheetServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SheetServiceAsync { @@ -42,231 +17,14 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withOptions(modifier: Consumer): SheetServiceAsync = SheetServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create( - params: SheetCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /api/v1/sheets/jobs - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - override fun list( - params: SheetListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /api/v1/sheets/jobs - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // delete /api/v1/sheets/jobs/{spreadsheet_job_id} - withRawResponse().deleteJob(params, requestOptions).thenApply { it.parse() } - - override fun get( - params: SheetGetParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /api/v1/sheets/jobs/{spreadsheet_job_id} - withRawResponse().get(params, requestOptions).thenApply { it.parse() } - - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type} - withRawResponse().getResultTable(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : SheetServiceAsync.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): SheetServiceAsync.WithRawResponse = SheetServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: SheetCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: SheetListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - SheetListPageAsync.builder() - .service(SheetServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - - private val deleteJobHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { deleteJobHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val getHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun get( - params: SheetGetParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { getHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val getResultTableHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("regionType", params.regionType().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments( - "api", - "v1", - "sheets", - "jobs", - params._pathParam(0), - "regions", - params._pathParam(1), - "result", - params._pathParam(2), - ) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { getResultTableHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsync.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsync.kt index de0a95a..ce32e59 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsync.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsync.kt @@ -3,18 +3,6 @@ package ai.llamaindex.llamacloud.services.async.beta import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.models.beta.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListPageAsync -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import java.util.concurrent.CompletableFuture import java.util.function.Consumer interface SheetServiceAsync { @@ -31,160 +19,6 @@ interface SheetServiceAsync { */ fun withOptions(modifier: Consumer): SheetServiceAsync - /** - * Create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (an inline parsing configuration) or - * `configuration_id` (a saved configuration preset). If neither is provided, a default - * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` - * status notifications. - */ - @Deprecated("deprecated") - fun create(params: SheetCreateParams): CompletableFuture = - create(params, RequestOptions.none()) - - /** @see create */ - @Deprecated("deprecated") - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** List spreadsheet parsing jobs. */ - @Deprecated("deprecated") - fun list(): CompletableFuture = list(SheetListParams.none()) - - /** @see list */ - @Deprecated("deprecated") - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see list */ - @Deprecated("deprecated") - fun list( - params: SheetListParams = SheetListParams.none() - ): CompletableFuture = list(params, RequestOptions.none()) - - /** @see list */ - @Deprecated("deprecated") - fun list(requestOptions: RequestOptions): CompletableFuture = - list(SheetListParams.none(), requestOptions) - - /** Delete a spreadsheet parsing job and its associated data. */ - @Deprecated("deprecated") - fun deleteJob(spreadsheetJobId: String): CompletableFuture = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): CompletableFuture = - deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob(params: SheetDeleteJobParams): CompletableFuture = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted - * regions and results if complete, skipping the separate `/results` call. - */ - @Deprecated("deprecated") - fun get(spreadsheetJobId: String): CompletableFuture = - get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - ): CompletableFuture = get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - - /** @see get */ - @Deprecated("deprecated") - fun get(params: SheetGetParams): CompletableFuture = - get(params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** Generate a presigned URL to download a specific extracted region. */ - @Deprecated("deprecated") - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): CompletableFuture = getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable(params: SheetGetResultTableParams): CompletableFuture = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture - /** A view of [SheetServiceAsync] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -196,178 +30,5 @@ interface SheetServiceAsync { fun withOptions( modifier: Consumer ): SheetServiceAsync.WithRawResponse - - /** - * Returns a raw HTTP response for `post /api/v1/beta/sheets/jobs`, but is otherwise the - * same as [SheetServiceAsync.create]. - */ - @Deprecated("deprecated") - fun create(params: SheetCreateParams): CompletableFuture> = - create(params, RequestOptions.none()) - - /** @see create */ - @Deprecated("deprecated") - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** - * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs`, but is otherwise the same - * as [SheetServiceAsync.list]. - */ - @Deprecated("deprecated") - fun list(): CompletableFuture> = - list(SheetListParams.none()) - - /** @see list */ - @Deprecated("deprecated") - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see list */ - @Deprecated("deprecated") - fun list( - params: SheetListParams = SheetListParams.none() - ): CompletableFuture> = - list(params, RequestOptions.none()) - - /** @see list */ - @Deprecated("deprecated") - fun list( - requestOptions: RequestOptions - ): CompletableFuture> = - list(SheetListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, - * but is otherwise the same as [SheetServiceAsync.deleteJob]. - */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String - ): CompletableFuture> = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): CompletableFuture> = - deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - params: SheetDeleteJobParams - ): CompletableFuture> = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, but - * is otherwise the same as [SheetServiceAsync.get]. - */ - @Deprecated("deprecated") - fun get(spreadsheetJobId: String): CompletableFuture> = - get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - ): CompletableFuture> = - get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> - - /** @see get */ - @Deprecated("deprecated") - fun get(params: SheetGetParams): CompletableFuture> = - get(params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): CompletableFuture> = - get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get - * /api/v1/beta/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, - * but is otherwise the same as [SheetServiceAsync.getResultTable]. - */ - @Deprecated("deprecated") - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): CompletableFuture> = - getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - params: SheetGetResultTableParams - ): CompletableFuture> = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): CompletableFuture> } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncImpl.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncImpl.kt index 5e1d96f..e8c4237 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncImpl.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncImpl.kt @@ -3,32 +3,7 @@ package ai.llamaindex.llamacloud.services.async.beta import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.handlers.errorBodyHandler -import ai.llamaindex.llamacloud.core.handlers.errorHandler -import ai.llamaindex.llamacloud.core.handlers.jsonHandler -import ai.llamaindex.llamacloud.core.http.HttpMethod -import ai.llamaindex.llamacloud.core.http.HttpRequest -import ai.llamaindex.llamacloud.core.http.HttpResponse -import ai.llamaindex.llamacloud.core.http.HttpResponse.Handler -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.core.http.json -import ai.llamaindex.llamacloud.core.http.parseable -import ai.llamaindex.llamacloud.core.prepareAsync -import ai.llamaindex.llamacloud.models.beta.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListPageAsync -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListPageResponse -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import java.util.concurrent.CompletableFuture import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull class SheetServiceAsyncImpl internal constructor(private val clientOptions: ClientOptions) : SheetServiceAsync { @@ -42,243 +17,14 @@ class SheetServiceAsyncImpl internal constructor(private val clientOptions: Clie override fun withOptions(modifier: Consumer): SheetServiceAsync = SheetServiceAsyncImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - @Deprecated("deprecated") - override fun create( - params: SheetCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // post /api/v1/beta/sheets/jobs - withRawResponse().create(params, requestOptions).thenApply { it.parse() } - - @Deprecated("deprecated") - override fun list( - params: SheetListParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /api/v1/beta/sheets/jobs - withRawResponse().list(params, requestOptions).thenApply { it.parse() } - - @Deprecated("deprecated") - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id} - withRawResponse().deleteJob(params, requestOptions).thenApply { it.parse() } - - @Deprecated("deprecated") - override fun get( - params: SheetGetParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get /api/v1/beta/sheets/jobs/{spreadsheet_job_id} - withRawResponse().get(params, requestOptions).thenApply { it.parse() } - - @Deprecated("deprecated") - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): CompletableFuture = - // get - // /api/v1/beta/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type} - withRawResponse().getResultTable(params, requestOptions).thenApply { it.parse() } - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : SheetServiceAsync.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): SheetServiceAsync.WithRawResponse = SheetServiceAsyncImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun create( - params: SheetCreateParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun list( - params: SheetListParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs") - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - SheetListPageAsync.builder() - .service(SheetServiceAsyncImpl(clientOptions)) - .streamHandlerExecutor(clientOptions.streamHandlerExecutor) - .params(params) - .response(it) - .build() - } - } - } - } - - private val deleteJobHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { deleteJobHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val getHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun get( - params: SheetGetParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs", params._pathParam(0)) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { getHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } - - private val getResultTableHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): CompletableFuture> { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("regionType", params.regionType().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments( - "api", - "v1", - "beta", - "sheets", - "jobs", - params._pathParam(0), - "regions", - params._pathParam(1), - "result", - params._pathParam(2), - ) - .build() - .prepareAsync(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - return request - .thenComposeAsync { clientOptions.httpClient.executeAsync(it, requestOptions) } - .thenApply { response -> - errorHandler.handle(response).parseable { - response - .use { getResultTableHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - } } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetService.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetService.kt index 5ee7098..bf7a636 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetService.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetService.kt @@ -3,18 +3,6 @@ package ai.llamaindex.llamacloud.services.blocking import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import ai.llamaindex.llamacloud.models.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.sheets.SheetListPage -import ai.llamaindex.llamacloud.models.sheets.SheetListParams -import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer interface SheetService { @@ -31,129 +19,6 @@ interface SheetService { */ fun withOptions(modifier: Consumer): SheetService - /** - * Create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (an inline parsing configuration) or - * `configuration_id` (a saved configuration preset). If neither is provided, a default - * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` - * status notifications. - */ - fun create(params: SheetCreateParams): SheetsJob = create(params, RequestOptions.none()) - - /** @see create */ - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetsJob - - /** List spreadsheet parsing jobs. */ - fun list(): SheetListPage = list(SheetListParams.none()) - - /** @see list */ - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetListPage - - /** @see list */ - fun list(params: SheetListParams = SheetListParams.none()): SheetListPage = - list(params, RequestOptions.none()) - - /** @see list */ - fun list(requestOptions: RequestOptions): SheetListPage = - list(SheetListParams.none(), requestOptions) - - /** Delete a spreadsheet parsing job and its associated data. */ - fun deleteJob(spreadsheetJobId: String): SheetDeleteJobResponse = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetDeleteJobResponse = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): SheetDeleteJobResponse = deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetDeleteJobResponse - - /** @see deleteJob */ - fun deleteJob(params: SheetDeleteJobParams): SheetDeleteJobResponse = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): SheetDeleteJobResponse = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted - * regions and results if complete, skipping the separate `/results` call. - */ - fun get(spreadsheetJobId: String): SheetsJob = get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetsJob = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - fun get(spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none()): SheetsJob = - get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetsJob - - /** @see get */ - fun get(params: SheetGetParams): SheetsJob = get(params, RequestOptions.none()) - - /** @see get */ - fun get(spreadsheetJobId: String, requestOptions: RequestOptions): SheetsJob = - get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** Generate a presigned URL to download a specific extracted region. */ - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): PresignedUrl = getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PresignedUrl = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - fun getResultTable(params: SheetGetResultTableParams): PresignedUrl = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PresignedUrl - /** A view of [SheetService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -163,163 +28,5 @@ interface SheetService { * The original service is not modified. */ fun withOptions(modifier: Consumer): SheetService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /api/v1/sheets/jobs`, but is otherwise the same as - * [SheetService.create]. - */ - @MustBeClosed - fun create(params: SheetCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @MustBeClosed - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /api/v1/sheets/jobs`, but is otherwise the same as - * [SheetService.list]. - */ - @MustBeClosed fun list(): HttpResponseFor = list(SheetListParams.none()) - - /** @see list */ - @MustBeClosed - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @MustBeClosed - fun list(params: SheetListParams = SheetListParams.none()): HttpResponseFor = - list(params, RequestOptions.none()) - - /** @see list */ - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(SheetListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is - * otherwise the same as [SheetService.deleteJob]. - */ - @MustBeClosed - fun deleteJob(spreadsheetJobId: String): HttpResponseFor = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - @MustBeClosed - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - @MustBeClosed - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): HttpResponseFor = - deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - @MustBeClosed - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see deleteJob */ - @MustBeClosed - fun deleteJob(params: SheetDeleteJobParams): HttpResponseFor = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - @MustBeClosed - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /api/v1/sheets/jobs/{spreadsheet_job_id}`, but is - * otherwise the same as [SheetService.get]. - */ - @MustBeClosed - fun get(spreadsheetJobId: String): HttpResponseFor = - get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - @MustBeClosed - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - @MustBeClosed - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - ): HttpResponseFor = get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - @MustBeClosed - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see get */ - @MustBeClosed - fun get(params: SheetGetParams): HttpResponseFor = - get(params, RequestOptions.none()) - - /** @see get */ - @MustBeClosed - fun get( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get - * /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, but - * is otherwise the same as [SheetService.getResultTable]. - */ - @MustBeClosed - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): HttpResponseFor = getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - @MustBeClosed - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - @MustBeClosed - fun getResultTable(params: SheetGetResultTableParams): HttpResponseFor = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - @MustBeClosed - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceImpl.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceImpl.kt index 9f29d00..6b40e6e 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceImpl.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceImpl.kt @@ -3,31 +3,7 @@ package ai.llamaindex.llamacloud.services.blocking import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.handlers.errorBodyHandler -import ai.llamaindex.llamacloud.core.handlers.errorHandler -import ai.llamaindex.llamacloud.core.handlers.jsonHandler -import ai.llamaindex.llamacloud.core.http.HttpMethod -import ai.llamaindex.llamacloud.core.http.HttpRequest -import ai.llamaindex.llamacloud.core.http.HttpResponse -import ai.llamaindex.llamacloud.core.http.HttpResponse.Handler -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.core.http.json -import ai.llamaindex.llamacloud.core.http.parseable -import ai.llamaindex.llamacloud.core.prepare -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import ai.llamaindex.llamacloud.models.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.sheets.SheetListPage -import ai.llamaindex.llamacloud.models.sheets.SheetListPageResponse -import ai.llamaindex.llamacloud.models.sheets.SheetListParams import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull class SheetServiceImpl internal constructor(private val clientOptions: ClientOptions) : SheetService { @@ -41,206 +17,14 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withOptions(modifier: Consumer): SheetService = SheetServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - override fun create(params: SheetCreateParams, requestOptions: RequestOptions): SheetsJob = - // post /api/v1/sheets/jobs - withRawResponse().create(params, requestOptions).parse() - - override fun list(params: SheetListParams, requestOptions: RequestOptions): SheetListPage = - // get /api/v1/sheets/jobs - withRawResponse().list(params, requestOptions).parse() - - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): SheetDeleteJobResponse = - // delete /api/v1/sheets/jobs/{spreadsheet_job_id} - withRawResponse().deleteJob(params, requestOptions).parse() - - override fun get(params: SheetGetParams, requestOptions: RequestOptions): SheetsJob = - // get /api/v1/sheets/jobs/{spreadsheet_job_id} - withRawResponse().get(params, requestOptions).parse() - - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): PresignedUrl = - // get /api/v1/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type} - withRawResponse().getResultTable(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : SheetService.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): SheetService.WithRawResponse = SheetServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun create( - params: SheetCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun list( - params: SheetListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - SheetListPage.builder() - .service(SheetServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - - private val deleteJobHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { deleteJobHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val getHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun get( - params: SheetGetParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "sheets", "jobs", params._pathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { getHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val getResultTableHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("regionType", params.regionType().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments( - "api", - "v1", - "sheets", - "jobs", - params._pathParam(0), - "regions", - params._pathParam(1), - "result", - params._pathParam(2), - ) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { getResultTableHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetService.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetService.kt index bca352e..eb363a3 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetService.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetService.kt @@ -3,18 +3,6 @@ package ai.llamaindex.llamacloud.services.blocking.beta import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.models.beta.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListPage -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl -import com.google.errorprone.annotations.MustBeClosed import java.util.function.Consumer interface SheetService { @@ -31,150 +19,6 @@ interface SheetService { */ fun withOptions(modifier: Consumer): SheetService - /** - * Create a spreadsheet parsing job. - * - * Provide at most one of `configuration` (an inline parsing configuration) or - * `configuration_id` (a saved configuration preset). If neither is provided, a default - * configuration is used. Optionally include `webhook_configurations` to receive `sheets.*` - * status notifications. - */ - @Deprecated("deprecated") - fun create(params: SheetCreateParams): SheetsJob = create(params, RequestOptions.none()) - - /** @see create */ - @Deprecated("deprecated") - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetsJob - - /** List spreadsheet parsing jobs. */ - @Deprecated("deprecated") fun list(): SheetListPage = list(SheetListParams.none()) - - /** @see list */ - @Deprecated("deprecated") - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetListPage - - /** @see list */ - @Deprecated("deprecated") - fun list(params: SheetListParams = SheetListParams.none()): SheetListPage = - list(params, RequestOptions.none()) - - /** @see list */ - @Deprecated("deprecated") - fun list(requestOptions: RequestOptions): SheetListPage = - list(SheetListParams.none(), requestOptions) - - /** Delete a spreadsheet parsing job and its associated data. */ - @Deprecated("deprecated") - fun deleteJob(spreadsheetJobId: String): SheetDeleteJobResponse = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetDeleteJobResponse = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): SheetDeleteJobResponse = deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetDeleteJobResponse - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob(params: SheetDeleteJobParams): SheetDeleteJobResponse = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): SheetDeleteJobResponse = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Get a spreadsheet parsing job. When `include_results=True` (default), embeds extracted - * regions and results if complete, skipping the separate `/results` call. - */ - @Deprecated("deprecated") - fun get(spreadsheetJobId: String): SheetsJob = get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetsJob = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - @Deprecated("deprecated") - fun get(spreadsheetJobId: String, params: SheetGetParams = SheetGetParams.none()): SheetsJob = - get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): SheetsJob - - /** @see get */ - @Deprecated("deprecated") - fun get(params: SheetGetParams): SheetsJob = get(params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - fun get(spreadsheetJobId: String, requestOptions: RequestOptions): SheetsJob = - get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** Generate a presigned URL to download a specific extracted region. */ - @Deprecated("deprecated") - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): PresignedUrl = getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PresignedUrl = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable(params: SheetGetResultTableParams): PresignedUrl = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): PresignedUrl - /** A view of [SheetService] that provides access to raw HTTP responses for each method. */ interface WithRawResponse { @@ -184,186 +28,5 @@ interface SheetService { * The original service is not modified. */ fun withOptions(modifier: Consumer): SheetService.WithRawResponse - - /** - * Returns a raw HTTP response for `post /api/v1/beta/sheets/jobs`, but is otherwise the - * same as [SheetService.create]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun create(params: SheetCreateParams): HttpResponseFor = - create(params, RequestOptions.none()) - - /** @see create */ - @Deprecated("deprecated") - @MustBeClosed - fun create( - params: SheetCreateParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** - * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs`, but is otherwise the same - * as [SheetService.list]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun list(): HttpResponseFor = list(SheetListParams.none()) - - /** @see list */ - @Deprecated("deprecated") - @MustBeClosed - fun list( - params: SheetListParams = SheetListParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see list */ - @Deprecated("deprecated") - @MustBeClosed - fun list(params: SheetListParams = SheetListParams.none()): HttpResponseFor = - list(params, RequestOptions.none()) - - /** @see list */ - @Deprecated("deprecated") - @MustBeClosed - fun list(requestOptions: RequestOptions): HttpResponseFor = - list(SheetListParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, - * but is otherwise the same as [SheetService.deleteJob]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun deleteJob(spreadsheetJobId: String): HttpResponseFor = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - @MustBeClosed - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - deleteJob(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see deleteJob */ - @Deprecated("deprecated") - @MustBeClosed - fun deleteJob( - spreadsheetJobId: String, - params: SheetDeleteJobParams = SheetDeleteJobParams.none(), - ): HttpResponseFor = - deleteJob(spreadsheetJobId, params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - @MustBeClosed - fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see deleteJob */ - @Deprecated("deprecated") - @MustBeClosed - fun deleteJob(params: SheetDeleteJobParams): HttpResponseFor = - deleteJob(params, RequestOptions.none()) - - /** @see deleteJob */ - @Deprecated("deprecated") - @MustBeClosed - fun deleteJob( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = - deleteJob(spreadsheetJobId, SheetDeleteJobParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get /api/v1/beta/sheets/jobs/{spreadsheet_job_id}`, but - * is otherwise the same as [SheetService.get]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun get(spreadsheetJobId: String): HttpResponseFor = - get(spreadsheetJobId, SheetGetParams.none()) - - /** @see get */ - @Deprecated("deprecated") - @MustBeClosed - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - get(params.toBuilder().spreadsheetJobId(spreadsheetJobId).build(), requestOptions) - - /** @see get */ - @Deprecated("deprecated") - @MustBeClosed - fun get( - spreadsheetJobId: String, - params: SheetGetParams = SheetGetParams.none(), - ): HttpResponseFor = get(spreadsheetJobId, params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - @MustBeClosed - fun get( - params: SheetGetParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor - - /** @see get */ - @Deprecated("deprecated") - @MustBeClosed - fun get(params: SheetGetParams): HttpResponseFor = - get(params, RequestOptions.none()) - - /** @see get */ - @Deprecated("deprecated") - @MustBeClosed - fun get( - spreadsheetJobId: String, - requestOptions: RequestOptions, - ): HttpResponseFor = get(spreadsheetJobId, SheetGetParams.none(), requestOptions) - - /** - * Returns a raw HTTP response for `get - * /api/v1/beta/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type}`, - * but is otherwise the same as [SheetService.getResultTable]. - */ - @Deprecated("deprecated") - @MustBeClosed - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - ): HttpResponseFor = getResultTable(regionType, params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - @MustBeClosed - fun getResultTable( - regionType: SheetGetResultTableParams.RegionType, - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor = - getResultTable(params.toBuilder().regionType(regionType).build(), requestOptions) - - /** @see getResultTable */ - @Deprecated("deprecated") - @MustBeClosed - fun getResultTable(params: SheetGetResultTableParams): HttpResponseFor = - getResultTable(params, RequestOptions.none()) - - /** @see getResultTable */ - @Deprecated("deprecated") - @MustBeClosed - fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions = RequestOptions.none(), - ): HttpResponseFor } } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceImpl.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceImpl.kt index 79d5596..8b50a3b 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceImpl.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceImpl.kt @@ -3,31 +3,7 @@ package ai.llamaindex.llamacloud.services.blocking.beta import ai.llamaindex.llamacloud.core.ClientOptions -import ai.llamaindex.llamacloud.core.RequestOptions -import ai.llamaindex.llamacloud.core.checkRequired -import ai.llamaindex.llamacloud.core.handlers.errorBodyHandler -import ai.llamaindex.llamacloud.core.handlers.errorHandler -import ai.llamaindex.llamacloud.core.handlers.jsonHandler -import ai.llamaindex.llamacloud.core.http.HttpMethod -import ai.llamaindex.llamacloud.core.http.HttpRequest -import ai.llamaindex.llamacloud.core.http.HttpResponse -import ai.llamaindex.llamacloud.core.http.HttpResponse.Handler -import ai.llamaindex.llamacloud.core.http.HttpResponseFor -import ai.llamaindex.llamacloud.core.http.json -import ai.llamaindex.llamacloud.core.http.parseable -import ai.llamaindex.llamacloud.core.prepare -import ai.llamaindex.llamacloud.models.beta.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobResponse -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListPage -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListPageResponse -import ai.llamaindex.llamacloud.models.beta.sheets.SheetListParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.files.PresignedUrl import java.util.function.Consumer -import kotlin.jvm.optionals.getOrNull class SheetServiceImpl internal constructor(private val clientOptions: ClientOptions) : SheetService { @@ -41,218 +17,14 @@ class SheetServiceImpl internal constructor(private val clientOptions: ClientOpt override fun withOptions(modifier: Consumer): SheetService = SheetServiceImpl(clientOptions.toBuilder().apply(modifier::accept).build()) - @Deprecated("deprecated") - override fun create(params: SheetCreateParams, requestOptions: RequestOptions): SheetsJob = - // post /api/v1/beta/sheets/jobs - withRawResponse().create(params, requestOptions).parse() - - @Deprecated("deprecated") - override fun list(params: SheetListParams, requestOptions: RequestOptions): SheetListPage = - // get /api/v1/beta/sheets/jobs - withRawResponse().list(params, requestOptions).parse() - - @Deprecated("deprecated") - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): SheetDeleteJobResponse = - // delete /api/v1/beta/sheets/jobs/{spreadsheet_job_id} - withRawResponse().deleteJob(params, requestOptions).parse() - - @Deprecated("deprecated") - override fun get(params: SheetGetParams, requestOptions: RequestOptions): SheetsJob = - // get /api/v1/beta/sheets/jobs/{spreadsheet_job_id} - withRawResponse().get(params, requestOptions).parse() - - @Deprecated("deprecated") - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): PresignedUrl = - // get - // /api/v1/beta/sheets/jobs/{spreadsheet_job_id}/regions/{region_id}/result/{region_type} - withRawResponse().getResultTable(params, requestOptions).parse() - class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) : SheetService.WithRawResponse { - private val errorHandler: Handler = - errorHandler(errorBodyHandler(clientOptions.jsonMapper)) - override fun withOptions( modifier: Consumer ): SheetService.WithRawResponse = SheetServiceImpl.WithRawResponseImpl( clientOptions.toBuilder().apply(modifier::accept).build() ) - - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun create( - params: SheetCreateParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.POST) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs") - .body(json(clientOptions.jsonMapper, params._body())) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { createHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val listHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun list( - params: SheetListParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs") - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { listHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - .let { - SheetListPage.builder() - .service(SheetServiceImpl(clientOptions)) - .params(params) - .response(it) - .build() - } - } - } - - private val deleteJobHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun deleteJob( - params: SheetDeleteJobParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.DELETE) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs", params._pathParam(0)) - .apply { params._body().ifPresent { body(json(clientOptions.jsonMapper, it)) } } - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { deleteJobHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val getHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun get( - params: SheetGetParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("spreadsheetJobId", params.spreadsheetJobId().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments("api", "v1", "beta", "sheets", "jobs", params._pathParam(0)) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { getHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } - - private val getResultTableHandler: Handler = - jsonHandler(clientOptions.jsonMapper) - - @Deprecated("deprecated") - override fun getResultTable( - params: SheetGetResultTableParams, - requestOptions: RequestOptions, - ): HttpResponseFor { - // We check here instead of in the params builder because this can be specified - // positionally or in the params class. - checkRequired("regionType", params.regionType().getOrNull()) - val request = - HttpRequest.builder() - .method(HttpMethod.GET) - .baseUrl(clientOptions.baseUrl()) - .addPathSegments( - "api", - "v1", - "beta", - "sheets", - "jobs", - params._pathParam(0), - "regions", - params._pathParam(1), - "result", - params._pathParam(2), - ) - .build() - .prepare(clientOptions, params) - val requestOptions = requestOptions.applyDefaults(RequestOptions.from(clientOptions)) - val response = clientOptions.httpClient.execute(request, requestOptions) - return errorHandler.handle(response).parseable { - response - .use { getResultTableHandler.handle(it) } - .also { - if (requestOptions.responseValidation!!) { - it.validate() - } - } - } - } } } diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt deleted file mode 100644 index 772ae91..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetCreateParamsTest.kt +++ /dev/null @@ -1,271 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.http.QueryParams -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetCreateParamsTest { - - @Test - fun create() { - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty("Authorization", JsonValue.from("Bearer sk-...")) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - } - - @Test - fun queryParams() { - val params = - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = - SheetCreateParams.builder().fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } - - @Test - fun body() { - val params = - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - - val body = params._body() - - assertThat(body.fileId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(body.config()) - .contains( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - assertThat(body.configuration()) - .contains( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - assertThat(body.configurationId()).contains("cfg-11111111-2222-3333-4444-555555555555") - assertThat(body.webhookConfigurationIds().getOrNull()).containsExactly("whc-...", "whc-...") - assertThat(body.webhookConfigurations().getOrNull()) - .containsExactly( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty("Authorization", JsonValue.from("Bearer sk-...")) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - SheetCreateParams.builder().fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - - val body = params._body() - - assertThat(body.fileId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParamsTest.kt deleted file mode 100644 index 5c6b9d8..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobParamsTest.kt +++ /dev/null @@ -1,57 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetDeleteJobParamsTest { - - @Test - fun create() { - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = SheetDeleteJobParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = SheetDeleteJobParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponseTest.kt deleted file mode 100644 index e1bf054..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetDeleteJobResponseTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetDeleteJobResponseTest { - - @Test - fun create() { - val sheetDeleteJobResponse = SheetDeleteJobResponse.builder().build() - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val sheetDeleteJobResponse = SheetDeleteJobResponse.builder().build() - - val roundtrippedSheetDeleteJobResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(sheetDeleteJobResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedSheetDeleteJobResponse).isEqualTo(sheetDeleteJobResponse) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParamsTest.kt deleted file mode 100644 index 4117c30..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetParamsTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetGetParamsTest { - - @Test - fun create() { - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = SheetGetParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("expand", "string") - .put("include_results", "true") - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = SheetGetParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParamsTest.kt deleted file mode 100644 index 2691170..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetGetResultTableParamsTest.kt +++ /dev/null @@ -1,76 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetGetResultTableParamsTest { - - @Test - fun create() { - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .build() - - assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") - assertThat(params._pathParam(1)).isEqualTo("region_id") - assertThat(params._pathParam(2)).isEqualTo("cell_metadata") - // out-of-bound path param - assertThat(params._pathParam(3)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("expires_at_seconds", "0") - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt deleted file mode 100644 index 270203a..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListPageResponseTest.kt +++ /dev/null @@ -1,419 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.jsonMapper -import ai.llamaindex.llamacloud.models.files.File -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetListPageResponseTest { - - @Test - fun create() { - val sheetListPageResponse = - SheetListPageResponse.builder() - .addItem( - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - ) - .nextPageToken("next_page_token") - .totalSize(0L) - .build() - - assertThat(sheetListPageResponse.items()) - .containsExactly( - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - ) - assertThat(sheetListPageResponse.nextPageToken()).contains("next_page_token") - assertThat(sheetListPageResponse.totalSize()).contains(0L) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val sheetListPageResponse = - SheetListPageResponse.builder() - .addItem( - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - ) - .nextPageToken("next_page_token") - .totalSize(0L) - .build() - - val roundtrippedSheetListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(sheetListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedSheetListPageResponse).isEqualTo(sheetListPageResponse) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParamsTest.kt deleted file mode 100644 index 8b474cd..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetListParamsTest.kt +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetListParamsTest { - - @Test - fun create() { - SheetListParams.builder() - .configurationId("configuration_id") - .createdAtOnOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .createdAtOnOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .includeResults(true) - .addJobId("string") - .addJobId("string") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pageSize(0L) - .pageToken("page_token") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetListParams.Status.CANCELLED) - .build() - } - - @Test - fun queryParams() { - val params = - SheetListParams.builder() - .configurationId("configuration_id") - .createdAtOnOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .createdAtOnOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .includeResults(true) - .addJobId("string") - .addJobId("string") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pageSize(0L) - .pageToken("page_token") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetListParams.Status.CANCELLED) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("configuration_id", "configuration_id") - .put("created_at_on_or_after", "2019-12-27T18:11:19.117Z") - .put("created_at_on_or_before", "2019-12-27T18:11:19.117Z") - .put("include_results", "true") - .put("job_ids", "string") - .put("job_ids", "string") - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("page_size", "0") - .put("page_token", "page_token") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("status", "CANCELLED") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = SheetListParams.builder().build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt deleted file mode 100644 index 9a724af..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsJobTest.kt +++ /dev/null @@ -1,379 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.jsonMapper -import ai.llamaindex.llamacloud.models.files.File -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.OffsetDateTime -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetsJobTest { - - @Test - fun create() { - val sheetsJob = - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar"))) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar"))) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - - assertThat(sheetsJob.id()).isEqualTo("id") - assertThat(sheetsJob.configuration()) - .isEqualTo( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - assertThat(sheetsJob.createdAt()).isEqualTo("created_at") - assertThat(sheetsJob.fileId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(sheetsJob.projectId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(sheetsJob.status()).isEqualTo(SheetsJob.Status.CANCELLED) - assertThat(sheetsJob.updatedAt()).isEqualTo("updated_at") - assertThat(sheetsJob.userId()).isEqualTo("user_id") - assertThat(sheetsJob.config()) - .contains( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - assertThat(sheetsJob.configurationId()).contains("configuration_id") - assertThat(sheetsJob.errors().getOrNull()).containsExactly("string") - assertThat(sheetsJob.file()) - .contains( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar"))) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar"))) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - assertThat(sheetsJob.metadataStateTransitions()) - .contains( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - assertThat(sheetsJob.parameters()) - .contains( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - assertThat(sheetsJob.regions().getOrNull()) - .containsExactly( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - assertThat(sheetsJob.success()).contains(true) - assertThat(sheetsJob.worksheetMetadata().getOrNull()) - .containsExactly( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val sheetsJob = - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar"))) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty("foo", JsonValue.from(mapOf("foo" to "bar"))) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - - val roundtrippedSheetsJob = - jsonMapper.readValue( - jsonMapper.writeValueAsString(sheetsJob), - jacksonTypeRef(), - ) - - assertThat(roundtrippedSheetsJob).isEqualTo(sheetsJob) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt deleted file mode 100644 index 1524262..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/beta/sheets/SheetsParsingConfigTest.kt +++ /dev/null @@ -1,64 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.beta.sheets - -import ai.llamaindex.llamacloud.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetsParsingConfigTest { - - @Test - fun create() { - val sheetsParsingConfig = - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - - assertThat(sheetsParsingConfig.extractionRange()).contains("extraction_range") - assertThat(sheetsParsingConfig.flattenHierarchicalTables()).contains(true) - assertThat(sheetsParsingConfig.generateAdditionalMetadata()).contains(true) - assertThat(sheetsParsingConfig.includeHiddenCells()).contains(true) - assertThat(sheetsParsingConfig.sheetNames().getOrNull()).containsExactly("string") - assertThat(sheetsParsingConfig.specialization()).contains("specialization") - assertThat(sheetsParsingConfig.tableMergeSensitivity()) - .contains(SheetsParsingConfig.TableMergeSensitivity.STRONG) - assertThat(sheetsParsingConfig.tier()).contains(SheetsParsingConfig.Tier.AGENTIC) - assertThat(sheetsParsingConfig.useExperimentalProcessing()).contains(true) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val sheetsParsingConfig = - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - - val roundtrippedSheetsParsingConfig = - jsonMapper.readValue( - jsonMapper.writeValueAsString(sheetsParsingConfig), - jacksonTypeRef(), - ) - - assertThat(roundtrippedSheetsParsingConfig).isEqualTo(sheetsParsingConfig) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt deleted file mode 100644 index 6255d7a..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetCreateParamsTest.kt +++ /dev/null @@ -1,272 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.http.QueryParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import kotlin.jvm.optionals.getOrNull -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetCreateParamsTest { - - @Test - fun create() { - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty("Authorization", JsonValue.from("Bearer sk-...")) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - } - - @Test - fun queryParams() { - val params = - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = - SheetCreateParams.builder().fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } - - @Test - fun body() { - val params = - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - - val body = params._body() - - assertThat(body.fileId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(body.config()) - .contains( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - assertThat(body.configuration()) - .contains( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - assertThat(body.configurationId()).contains("cfg-11111111-2222-3333-4444-555555555555") - assertThat(body.webhookConfigurationIds().getOrNull()).containsExactly("whc-...", "whc-...") - assertThat(body.webhookConfigurations().getOrNull()) - .containsExactly( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty("Authorization", JsonValue.from("Bearer sk-...")) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - } - - @Test - fun bodyWithoutOptionalFields() { - val params = - SheetCreateParams.builder().fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build() - - val body = params._body() - - assertThat(body.fileId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParamsTest.kt deleted file mode 100644 index 9b4509a..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobParamsTest.kt +++ /dev/null @@ -1,57 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetDeleteJobParamsTest { - - @Test - fun create() { - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = SheetDeleteJobParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = SheetDeleteJobParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponseTest.kt deleted file mode 100644 index bd8ef71..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetDeleteJobResponseTest.kt +++ /dev/null @@ -1,30 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.jsonMapper -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetDeleteJobResponseTest { - - @Test - fun create() { - val sheetDeleteJobResponse = SheetDeleteJobResponse.builder().build() - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val sheetDeleteJobResponse = SheetDeleteJobResponse.builder().build() - - val roundtrippedSheetDeleteJobResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(sheetDeleteJobResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedSheetDeleteJobResponse).isEqualTo(sheetDeleteJobResponse) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParamsTest.kt deleted file mode 100644 index dd6ccff..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetParamsTest.kt +++ /dev/null @@ -1,63 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetGetParamsTest { - - @Test - fun create() { - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = SheetGetParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") - // out-of-bound path param - assertThat(params._pathParam(1)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("expand", "string") - .put("include_results", "true") - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = SheetGetParams.builder().spreadsheetJobId("spreadsheet_job_id").build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParamsTest.kt deleted file mode 100644 index 6d6c57c..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetGetResultTableParamsTest.kt +++ /dev/null @@ -1,76 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetGetResultTableParamsTest { - - @Test - fun create() { - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - } - - @Test - fun pathParams() { - val params = - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .build() - - assertThat(params._pathParam(0)).isEqualTo("spreadsheet_job_id") - assertThat(params._pathParam(1)).isEqualTo("region_id") - assertThat(params._pathParam(2)).isEqualTo("cell_metadata") - // out-of-bound path param - assertThat(params._pathParam(3)).isEqualTo("") - } - - @Test - fun queryParams() { - val params = - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("expires_at_seconds", "0") - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt deleted file mode 100644 index 13091cf..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListPageResponseTest.kt +++ /dev/null @@ -1,421 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.core.jsonMapper -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsJob -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import ai.llamaindex.llamacloud.models.files.File -import com.fasterxml.jackson.module.kotlin.jacksonTypeRef -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetListPageResponseTest { - - @Test - fun create() { - val sheetListPageResponse = - SheetListPageResponse.builder() - .addItem( - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - ) - .nextPageToken("next_page_token") - .totalSize(0L) - .build() - - assertThat(sheetListPageResponse.items()) - .containsExactly( - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - ) - assertThat(sheetListPageResponse.nextPageToken()).contains("next_page_token") - assertThat(sheetListPageResponse.totalSize()).contains(0L) - } - - @Test - fun roundtrip() { - val jsonMapper = jsonMapper() - val sheetListPageResponse = - SheetListPageResponse.builder() - .addItem( - SheetsJob.builder() - .id("id") - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .createdAt("created_at") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetsJob.Status.CANCELLED) - .updatedAt("updated_at") - .userId("user_id") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity( - SheetsParsingConfig.TableMergeSensitivity.STRONG - ) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("configuration_id") - .addError("string") - .file( - File.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("x") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .createdAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .dataSourceId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .expiresAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .externalFileId("external_file_id") - .fileSize(0L) - .fileType("x") - .lastModifiedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .permissionInfo( - File.PermissionInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .purpose("purpose") - .resourceInfo( - File.ResourceInfo.builder() - .putAdditionalProperty( - "foo", - JsonValue.from(mapOf("foo" to "bar")), - ) - .build() - ) - .updatedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .build() - ) - .metadataStateTransitions( - SheetsJob.MetadataStateTransitions.builder() - .putAdditionalProperty("foo", JsonValue.from("bar")) - .build() - ) - .parameters( - SheetsJob.Parameters.builder() - .addWebhookConfiguration( - SheetsJob.Parameters.WebhookConfiguration.builder() - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_SUCCESS - ) - .addWebhookEvent( - SheetsJob.Parameters.WebhookConfiguration.WebhookEvent - .PARSE_ERROR - ) - .webhookHeaders( - SheetsJob.Parameters.WebhookConfiguration.WebhookHeaders - .builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - .addRegion( - SheetsJob.Region.builder() - .location("location") - .regionType("region_type") - .sheetName("sheet_name") - .description("description") - .regionId("region_id") - .title("title") - .build() - ) - .success(true) - .addWorksheetMetadata( - SheetsJob.WorksheetMetadata.builder() - .sheetName("sheet_name") - .description("description") - .title("title") - .build() - ) - .build() - ) - .nextPageToken("next_page_token") - .totalSize(0L) - .build() - - val roundtrippedSheetListPageResponse = - jsonMapper.readValue( - jsonMapper.writeValueAsString(sheetListPageResponse), - jacksonTypeRef(), - ) - - assertThat(roundtrippedSheetListPageResponse).isEqualTo(sheetListPageResponse) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParamsTest.kt deleted file mode 100644 index aa0978d..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/sheets/SheetListParamsTest.kt +++ /dev/null @@ -1,74 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.models.sheets - -import ai.llamaindex.llamacloud.core.http.QueryParams -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -internal class SheetListParamsTest { - - @Test - fun create() { - SheetListParams.builder() - .configurationId("configuration_id") - .createdAtOnOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .createdAtOnOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .includeResults(true) - .addJobId("string") - .addJobId("string") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pageSize(0L) - .pageToken("page_token") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetListParams.Status.CANCELLED) - .build() - } - - @Test - fun queryParams() { - val params = - SheetListParams.builder() - .configurationId("configuration_id") - .createdAtOnOrAfter(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .createdAtOnOrBefore(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .includeResults(true) - .addJobId("string") - .addJobId("string") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .pageSize(0L) - .pageToken("page_token") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .status(SheetListParams.Status.CANCELLED) - .build() - - val queryParams = params._queryParams() - - assertThat(queryParams) - .isEqualTo( - QueryParams.builder() - .put("configuration_id", "configuration_id") - .put("created_at_on_or_after", "2019-12-27T18:11:19.117Z") - .put("created_at_on_or_before", "2019-12-27T18:11:19.117Z") - .put("include_results", "true") - .put("job_ids", "string") - .put("job_ids", "string") - .put("organization_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("page_size", "0") - .put("page_token", "page_token") - .put("project_id", "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .put("status", "CANCELLED") - .build() - ) - } - - @Test - fun queryParamsWithoutOptionalFields() { - val params = SheetListParams.builder().build() - - val queryParams = params._queryParams() - - assertThat(queryParams).isEqualTo(QueryParams.builder().build()) - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt deleted file mode 100644 index 031df70..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/SheetServiceAsyncTest.kt +++ /dev/null @@ -1,159 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.services.async - -import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClientAsync -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import ai.llamaindex.llamacloud.models.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetResultTableParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class SheetServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.sheets() - - val sheetsJobFuture = - sheetServiceAsync.create( - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - - val sheetsJob = sheetsJobFuture.get() - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.sheets() - - val pageFuture = sheetServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun deleteJob() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.sheets() - - val responseFuture = - sheetServiceAsync.deleteJob( - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - val response = responseFuture.get() - response.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun get() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.sheets() - - val sheetsJobFuture = - sheetServiceAsync.get( - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - val sheetsJob = sheetsJobFuture.get() - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun getResultTable() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.sheets() - - val presignedUrlFuture = - sheetServiceAsync.getResultTable( - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - val presignedUrl = presignedUrlFuture.get() - presignedUrl.validate() - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt deleted file mode 100644 index 71a1c4d..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/beta/SheetServiceAsyncTest.kt +++ /dev/null @@ -1,159 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.services.async.beta - -import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClientAsync -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.models.beta.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class SheetServiceAsyncTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.beta().sheets() - - val sheetsJobFuture = - sheetServiceAsync.create( - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - - val sheetsJob = sheetsJobFuture.get() - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.beta().sheets() - - val pageFuture = sheetServiceAsync.list() - - val page = pageFuture.get() - page.response().validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun deleteJob() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.beta().sheets() - - val responseFuture = - sheetServiceAsync.deleteJob( - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - val response = responseFuture.get() - response.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun get() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.beta().sheets() - - val sheetsJobFuture = - sheetServiceAsync.get( - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - val sheetsJob = sheetsJobFuture.get() - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun getResultTable() { - val client = LlamaCloudOkHttpClientAsync.builder().apiKey("My API Key").build() - val sheetServiceAsync = client.beta().sheets() - - val presignedUrlFuture = - sheetServiceAsync.getResultTable( - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - val presignedUrl = presignedUrlFuture.get() - presignedUrl.validate() - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt deleted file mode 100644 index ea0b2c5..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/SheetServiceTest.kt +++ /dev/null @@ -1,154 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.services.blocking - -import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClient -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import ai.llamaindex.llamacloud.models.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.sheets.SheetGetResultTableParams -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class SheetServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.sheets() - - val sheetsJob = - sheetService.create( - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.sheets() - - val page = sheetService.list() - - page.response().validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun deleteJob() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.sheets() - - val response = - sheetService.deleteJob( - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - response.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun get() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.sheets() - - val sheetsJob = - sheetService.get( - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun getResultTable() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.sheets() - - val presignedUrl = - sheetService.getResultTable( - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - presignedUrl.validate() - } -} diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt deleted file mode 100644 index c8f8a6d..0000000 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/beta/SheetServiceTest.kt +++ /dev/null @@ -1,154 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package ai.llamaindex.llamacloud.services.blocking.beta - -import ai.llamaindex.llamacloud.client.okhttp.LlamaCloudOkHttpClient -import ai.llamaindex.llamacloud.core.JsonValue -import ai.llamaindex.llamacloud.models.beta.sheets.SheetCreateParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetDeleteJobParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetGetResultTableParams -import ai.llamaindex.llamacloud.models.beta.sheets.SheetsParsingConfig -import org.junit.jupiter.api.Disabled -import org.junit.jupiter.api.Test - -internal class SheetServiceTest { - - @Disabled("Mock server tests are disabled") - @Test - fun create() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.beta().sheets() - - val sheetsJob = - sheetService.create( - SheetCreateParams.builder() - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .config( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configuration( - SheetsParsingConfig.builder() - .extractionRange("extraction_range") - .flattenHierarchicalTables(true) - .generateAdditionalMetadata(true) - .includeHiddenCells(true) - .addSheetName("string") - .specialization("specialization") - .tableMergeSensitivity(SheetsParsingConfig.TableMergeSensitivity.STRONG) - .tier(SheetsParsingConfig.Tier.AGENTIC) - .useExperimentalProcessing(true) - .build() - ) - .configurationId("cfg-11111111-2222-3333-4444-555555555555") - .addWebhookConfigurationId("whc-...") - .addWebhookConfigurationId("whc-...") - .addWebhookConfiguration( - SheetCreateParams.WebhookConfiguration.builder() - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_SUCCESS - ) - .addWebhookEvent( - SheetCreateParams.WebhookConfiguration.WebhookEvent.PARSE_ERROR - ) - .webhookHeaders( - SheetCreateParams.WebhookConfiguration.WebhookHeaders.builder() - .putAdditionalProperty( - "Authorization", - JsonValue.from("Bearer sk-..."), - ) - .build() - ) - .webhookOutputFormat("json") - .webhookSigningSecret("whsec_...") - .webhookUrl("https://example.com/webhooks/llamacloud") - .build() - ) - .build() - ) - - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun list() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.beta().sheets() - - val page = sheetService.list() - - page.response().validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun deleteJob() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.beta().sheets() - - val response = - sheetService.deleteJob( - SheetDeleteJobParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - response.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun get() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.beta().sheets() - - val sheetsJob = - sheetService.get( - SheetGetParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .addExpand("string") - .includeResults(true) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - sheetsJob.validate() - } - - @Disabled("Mock server tests are disabled") - @Test - fun getResultTable() { - val client = LlamaCloudOkHttpClient.builder().apiKey("My API Key").build() - val sheetService = client.beta().sheets() - - val presignedUrl = - sheetService.getResultTable( - SheetGetResultTableParams.builder() - .spreadsheetJobId("spreadsheet_job_id") - .regionId("region_id") - .regionType(SheetGetResultTableParams.RegionType.CELL_METADATA) - .expiresAtSeconds(0L) - .organizationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - ) - - presignedUrl.validate() - } -} From 8161d3a802a5548c5e30915e560d27b74c06ea7f Mon Sep 17 00:00:00 2001 From: stlc-bot Date: Thu, 27 Aug 2026 01:25:09 +0000 Subject: [PATCH 3/3] feat(extract): publish the turbo tier on the public API surface (LI-8873) (#25281) Stainless-Generated-From: d5726c4fb25a9d942135c16b89f46fbc91fb9d1d --- .../configurations/ExtractV2Parameters.kt | 18 +- .../configurations/ParseV2Parameters.kt | 73 +- .../models/extract/ExtractConfiguration.kt | 18 +- .../models/parsing/ParsingCreateParams.kt | 73 +- .../models/parsing/ParsingGetResponse.kt | 907 +++++++++++++++++- .../models/pipelines/LlamaParseParameters.kt | 59 +- .../configurations/ParseV2ParametersTest.kt | 3 + .../models/parsing/ParsingCreateParamsTest.kt | 4 + .../models/parsing/ParsingGetResponseTest.kt | 62 ++ .../pipelines/LlamaParseParametersTest.kt | 3 + .../pipelines/PipelineCreateParamsTest.kt | 4 + .../models/pipelines/PipelineCreateTest.kt | 3 + .../models/pipelines/PipelineTest.kt | 3 + .../pipelines/PipelineUpdateParamsTest.kt | 3 + .../pipelines/PipelineUpsertParamsTest.kt | 4 + .../llamacloud/services/ServiceParamsTest.kt | 1 + .../services/async/ParsingServiceAsyncTest.kt | 1 + .../async/PipelineServiceAsyncTest.kt | 3 + .../services/blocking/ParsingServiceTest.kt | 1 + .../services/blocking/PipelineServiceTest.kt | 3 + 20 files changed, 1217 insertions(+), 29 deletions(-) diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ExtractV2Parameters.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ExtractV2Parameters.kt index b725b0c..5494722 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ExtractV2Parameters.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ExtractV2Parameters.kt @@ -223,8 +223,8 @@ private constructor( fun targetPages(): Optional = targetPages.getOptional("target_pages") /** - * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), or agentic_plus (50 - * credits/page) + * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), agentic_plus (50 + * credits/page), or turbo (35 credits/page, experimental) * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -674,8 +674,8 @@ private constructor( fun targetPages(targetPages: JsonField) = apply { this.targetPages = targetPages } /** - * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), or agentic_plus - * (50 credits/page) + * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), agentic_plus + * (50 credits/page), or turbo (35 credits/page, experimental) */ fun tier(tier: Tier) = tier(JsonField.of(tier)) @@ -1086,8 +1086,8 @@ private constructor( } /** - * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), or agentic_plus (50 - * credits/page) + * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), agentic_plus (50 + * credits/page), or turbo (35 credits/page, experimental) */ class Tier @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1109,6 +1109,8 @@ private constructor( @JvmField val COST_EFFECTIVE = of("cost_effective") + @JvmField val TURBO = of("turbo") + @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) } @@ -1117,6 +1119,7 @@ private constructor( AGENTIC, AGENTIC_PLUS, COST_EFFECTIVE, + TURBO, } /** @@ -1132,6 +1135,7 @@ private constructor( AGENTIC, AGENTIC_PLUS, COST_EFFECTIVE, + TURBO, /** An enum member indicating that [Tier] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1148,6 +1152,7 @@ private constructor( AGENTIC -> Value.AGENTIC AGENTIC_PLUS -> Value.AGENTIC_PLUS COST_EFFECTIVE -> Value.COST_EFFECTIVE + TURBO -> Value.TURBO else -> Value._UNKNOWN } @@ -1165,6 +1170,7 @@ private constructor( AGENTIC -> Known.AGENTIC AGENTIC_PLUS -> Known.AGENTIC_PLUS COST_EFFECTIVE -> Known.COST_EFFECTIVE + TURBO -> Known.TURBO else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2Parameters.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2Parameters.kt index b5e396a..cfaa831 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2Parameters.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2Parameters.kt @@ -3921,6 +3921,7 @@ private constructor( class Markdown @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val annotateLineNumbers: JsonField, private val annotateLinks: JsonField, private val annotateRevisions: JsonField, private val inlineImages: JsonField, @@ -3930,6 +3931,9 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("annotate_line_numbers") + @ExcludeMissing + annotateLineNumbers: JsonField = JsonMissing.of(), @JsonProperty("annotate_links") @ExcludeMissing annotateLinks: JsonField = JsonMissing.of(), @@ -3940,7 +3944,23 @@ private constructor( @ExcludeMissing inlineImages: JsonField = JsonMissing.of(), @JsonProperty("tables") @ExcludeMissing tables: JsonField = JsonMissing.of(), - ) : this(annotateLinks, annotateRevisions, inlineImages, tables, mutableMapOf()) + ) : this( + annotateLineNumbers, + annotateLinks, + annotateRevisions, + inlineImages, + tables, + mutableMapOf(), + ) + + /** + * Detect printed gutter line numbers and return their Markdown offsets + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun annotateLineNumbers(): Optional = + annotateLineNumbers.getOptional("annotate_line_numbers") /** * Add link annotations to markdown output in the format [text](url). When false, only @@ -3977,6 +3997,16 @@ private constructor( */ fun tables(): Optional = tables.getOptional("tables") + /** + * Returns the raw JSON value of [annotateLineNumbers]. + * + * Unlike [annotateLineNumbers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("annotate_line_numbers") + @ExcludeMissing + fun _annotateLineNumbers(): JsonField = annotateLineNumbers + /** * Returns the raw JSON value of [annotateLinks]. * @@ -4035,6 +4065,7 @@ private constructor( /** A builder for [Markdown]. */ class Builder internal constructor() { + private var annotateLineNumbers: JsonField = JsonMissing.of() private var annotateLinks: JsonField = JsonMissing.of() private var annotateRevisions: JsonField = JsonMissing.of() private var inlineImages: JsonField = JsonMissing.of() @@ -4043,6 +4074,7 @@ private constructor( @JvmSynthetic internal fun from(markdown: Markdown) = apply { + annotateLineNumbers = markdown.annotateLineNumbers annotateLinks = markdown.annotateLinks annotateRevisions = markdown.annotateRevisions inlineImages = markdown.inlineImages @@ -4050,6 +4082,36 @@ private constructor( additionalProperties = markdown.additionalProperties.toMutableMap() } + /** Detect printed gutter line numbers and return their Markdown offsets */ + fun annotateLineNumbers(annotateLineNumbers: Boolean?) = + annotateLineNumbers(JsonField.ofNullable(annotateLineNumbers)) + + /** + * Alias for [Builder.annotateLineNumbers]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun annotateLineNumbers(annotateLineNumbers: Boolean) = + annotateLineNumbers(annotateLineNumbers as Boolean?) + + /** + * Alias for calling [Builder.annotateLineNumbers] with + * `annotateLineNumbers.orElse(null)`. + */ + fun annotateLineNumbers(annotateLineNumbers: Optional) = + annotateLineNumbers(annotateLineNumbers.getOrNull()) + + /** + * Sets [Builder.annotateLineNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.annotateLineNumbers] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun annotateLineNumbers(annotateLineNumbers: JsonField) = apply { + this.annotateLineNumbers = annotateLineNumbers + } + /** * Add link annotations to markdown output in the format [text](url). When false, * only the link text is included @@ -4181,6 +4243,7 @@ private constructor( */ fun build(): Markdown = Markdown( + annotateLineNumbers, annotateLinks, annotateRevisions, inlineImages, @@ -4206,6 +4269,7 @@ private constructor( return@apply } + annotateLineNumbers() annotateLinks() annotateRevisions() inlineImages() @@ -4229,7 +4293,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (annotateLinks.asKnown().isPresent) 1 else 0) + + (if (annotateLineNumbers.asKnown().isPresent) 1 else 0) + + (if (annotateLinks.asKnown().isPresent) 1 else 0) + (if (annotateRevisions.asKnown().isPresent) 1 else 0) + (if (inlineImages.asKnown().isPresent) 1 else 0) + (tables.asKnown().getOrNull()?.validity() ?: 0) @@ -4634,6 +4699,7 @@ private constructor( } return other is Markdown && + annotateLineNumbers == other.annotateLineNumbers && annotateLinks == other.annotateLinks && annotateRevisions == other.annotateRevisions && inlineImages == other.inlineImages && @@ -4643,6 +4709,7 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( + annotateLineNumbers, annotateLinks, annotateRevisions, inlineImages, @@ -4654,7 +4721,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Markdown{annotateLinks=$annotateLinks, annotateRevisions=$annotateRevisions, inlineImages=$inlineImages, tables=$tables, additionalProperties=$additionalProperties}" + "Markdown{annotateLineNumbers=$annotateLineNumbers, annotateLinks=$annotateLinks, annotateRevisions=$annotateRevisions, inlineImages=$inlineImages, tables=$tables, additionalProperties=$additionalProperties}" } /** Spatial text output options for preserving document layout structure */ diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractConfiguration.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractConfiguration.kt index 0433f48..2348429 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractConfiguration.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/extract/ExtractConfiguration.kt @@ -207,8 +207,8 @@ private constructor( fun targetPages(): Optional = targetPages.getOptional("target_pages") /** - * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), or agentic_plus (50 - * credits/page) + * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), agentic_plus (50 + * credits/page), or turbo (35 credits/page, experimental) * * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -642,8 +642,8 @@ private constructor( fun targetPages(targetPages: JsonField) = apply { this.targetPages = targetPages } /** - * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), or agentic_plus - * (50 credits/page) + * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), agentic_plus + * (50 credits/page), or turbo (35 credits/page, experimental) */ fun tier(tier: Tier) = tier(JsonField.of(tier)) @@ -1047,8 +1047,8 @@ private constructor( } /** - * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), or agentic_plus (50 - * credits/page) + * Extract tier: cost_effective (5 credits/page), agentic (15 credits/page), agentic_plus (50 + * credits/page), or turbo (35 credits/page, experimental) */ class Tier @JsonCreator private constructor(private val value: JsonField) : Enum { @@ -1070,6 +1070,8 @@ private constructor( @JvmField val COST_EFFECTIVE = of("cost_effective") + @JvmField val TURBO = of("turbo") + @JvmStatic fun of(value: String) = Tier(JsonField.of(value)) } @@ -1078,6 +1080,7 @@ private constructor( AGENTIC, AGENTIC_PLUS, COST_EFFECTIVE, + TURBO, } /** @@ -1093,6 +1096,7 @@ private constructor( AGENTIC, AGENTIC_PLUS, COST_EFFECTIVE, + TURBO, /** An enum member indicating that [Tier] was instantiated with an unknown value. */ _UNKNOWN, } @@ -1109,6 +1113,7 @@ private constructor( AGENTIC -> Value.AGENTIC AGENTIC_PLUS -> Value.AGENTIC_PLUS COST_EFFECTIVE -> Value.COST_EFFECTIVE + TURBO -> Value.TURBO else -> Value._UNKNOWN } @@ -1126,6 +1131,7 @@ private constructor( AGENTIC -> Known.AGENTIC AGENTIC_PLUS -> Known.AGENTIC_PLUS COST_EFFECTIVE -> Known.COST_EFFECTIVE + TURBO -> Known.TURBO else -> throw LlamaCloudInvalidDataException("Unknown Tier: $value") } diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParams.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParams.kt index 8403fc3..191f819 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParams.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParams.kt @@ -5126,6 +5126,7 @@ private constructor( class Markdown @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( + private val annotateLineNumbers: JsonField, private val annotateLinks: JsonField, private val annotateRevisions: JsonField, private val inlineImages: JsonField, @@ -5135,6 +5136,9 @@ private constructor( @JsonCreator private constructor( + @JsonProperty("annotate_line_numbers") + @ExcludeMissing + annotateLineNumbers: JsonField = JsonMissing.of(), @JsonProperty("annotate_links") @ExcludeMissing annotateLinks: JsonField = JsonMissing.of(), @@ -5145,7 +5149,23 @@ private constructor( @ExcludeMissing inlineImages: JsonField = JsonMissing.of(), @JsonProperty("tables") @ExcludeMissing tables: JsonField = JsonMissing.of(), - ) : this(annotateLinks, annotateRevisions, inlineImages, tables, mutableMapOf()) + ) : this( + annotateLineNumbers, + annotateLinks, + annotateRevisions, + inlineImages, + tables, + mutableMapOf(), + ) + + /** + * Detect printed gutter line numbers and return their Markdown offsets + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun annotateLineNumbers(): Optional = + annotateLineNumbers.getOptional("annotate_line_numbers") /** * Add link annotations to markdown output in the format [text](url). When false, only @@ -5182,6 +5202,16 @@ private constructor( */ fun tables(): Optional = tables.getOptional("tables") + /** + * Returns the raw JSON value of [annotateLineNumbers]. + * + * Unlike [annotateLineNumbers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("annotate_line_numbers") + @ExcludeMissing + fun _annotateLineNumbers(): JsonField = annotateLineNumbers + /** * Returns the raw JSON value of [annotateLinks]. * @@ -5240,6 +5270,7 @@ private constructor( /** A builder for [Markdown]. */ class Builder internal constructor() { + private var annotateLineNumbers: JsonField = JsonMissing.of() private var annotateLinks: JsonField = JsonMissing.of() private var annotateRevisions: JsonField = JsonMissing.of() private var inlineImages: JsonField = JsonMissing.of() @@ -5248,6 +5279,7 @@ private constructor( @JvmSynthetic internal fun from(markdown: Markdown) = apply { + annotateLineNumbers = markdown.annotateLineNumbers annotateLinks = markdown.annotateLinks annotateRevisions = markdown.annotateRevisions inlineImages = markdown.inlineImages @@ -5255,6 +5287,36 @@ private constructor( additionalProperties = markdown.additionalProperties.toMutableMap() } + /** Detect printed gutter line numbers and return their Markdown offsets */ + fun annotateLineNumbers(annotateLineNumbers: Boolean?) = + annotateLineNumbers(JsonField.ofNullable(annotateLineNumbers)) + + /** + * Alias for [Builder.annotateLineNumbers]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun annotateLineNumbers(annotateLineNumbers: Boolean) = + annotateLineNumbers(annotateLineNumbers as Boolean?) + + /** + * Alias for calling [Builder.annotateLineNumbers] with + * `annotateLineNumbers.orElse(null)`. + */ + fun annotateLineNumbers(annotateLineNumbers: Optional) = + annotateLineNumbers(annotateLineNumbers.getOrNull()) + + /** + * Sets [Builder.annotateLineNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.annotateLineNumbers] with a well-typed [Boolean] + * value instead. This method is primarily for setting the field to an undocumented + * or not yet supported value. + */ + fun annotateLineNumbers(annotateLineNumbers: JsonField) = apply { + this.annotateLineNumbers = annotateLineNumbers + } + /** * Add link annotations to markdown output in the format [text](url). When false, * only the link text is included @@ -5386,6 +5448,7 @@ private constructor( */ fun build(): Markdown = Markdown( + annotateLineNumbers, annotateLinks, annotateRevisions, inlineImages, @@ -5411,6 +5474,7 @@ private constructor( return@apply } + annotateLineNumbers() annotateLinks() annotateRevisions() inlineImages() @@ -5434,7 +5498,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (if (annotateLinks.asKnown().isPresent) 1 else 0) + + (if (annotateLineNumbers.asKnown().isPresent) 1 else 0) + + (if (annotateLinks.asKnown().isPresent) 1 else 0) + (if (annotateRevisions.asKnown().isPresent) 1 else 0) + (if (inlineImages.asKnown().isPresent) 1 else 0) + (tables.asKnown().getOrNull()?.validity() ?: 0) @@ -5839,6 +5904,7 @@ private constructor( } return other is Markdown && + annotateLineNumbers == other.annotateLineNumbers && annotateLinks == other.annotateLinks && annotateRevisions == other.annotateRevisions && inlineImages == other.inlineImages && @@ -5848,6 +5914,7 @@ private constructor( private val hashCode: Int by lazy { Objects.hash( + annotateLineNumbers, annotateLinks, annotateRevisions, inlineImages, @@ -5859,7 +5926,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "Markdown{annotateLinks=$annotateLinks, annotateRevisions=$annotateRevisions, inlineImages=$inlineImages, tables=$tables, additionalProperties=$additionalProperties}" + "Markdown{annotateLineNumbers=$annotateLineNumbers, annotateLinks=$annotateLinks, annotateRevisions=$annotateRevisions, inlineImages=$inlineImages, tables=$tables, additionalProperties=$additionalProperties}" } /** Spatial text output options for preserving document layout structure */ diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponse.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponse.kt index 50d796f..349a6d9 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponse.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponse.kt @@ -7988,6 +7988,7 @@ private constructor( private val success: JsonValue, private val footer: JsonField, private val header: JsonField, + private val lineNumbers: JsonField>, private val additionalProperties: MutableMap, ) { @@ -8006,7 +8007,10 @@ private constructor( @JsonProperty("header") @ExcludeMissing header: JsonField = JsonMissing.of(), - ) : this(markdown, pageNumber, success, footer, header, mutableMapOf()) + @JsonProperty("line_numbers") + @ExcludeMissing + lineNumbers: JsonField> = JsonMissing.of(), + ) : this(markdown, pageNumber, success, footer, header, lineNumbers, mutableMapOf()) /** * Markdown content of the page @@ -8055,6 +8059,15 @@ private constructor( */ fun header(): Optional = header.getOptional("header") + /** + * Printed line numbers linked to final page markdown + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type + * (e.g. if the server responded with an unexpected value). + */ + fun lineNumbers(): Optional> = + lineNumbers.getOptional("line_numbers") + /** * Returns the raw JSON value of [markdown]. * @@ -8091,6 +8104,16 @@ private constructor( */ @JsonProperty("header") @ExcludeMissing fun _header(): JsonField = header + /** + * Returns the raw JSON value of [lineNumbers]. + * + * Unlike [lineNumbers], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("line_numbers") + @ExcludeMissing + fun _lineNumbers(): JsonField> = lineNumbers + @JsonAnySetter private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) @@ -8126,6 +8149,7 @@ private constructor( private var success: JsonValue = JsonValue.from(true) private var footer: JsonField = JsonMissing.of() private var header: JsonField = JsonMissing.of() + private var lineNumbers: JsonField>? = null private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -8135,6 +8159,7 @@ private constructor( success = markdownResultPage.success footer = markdownResultPage.footer header = markdownResultPage.header + lineNumbers = markdownResultPage.lineNumbers.map { it.toMutableList() } additionalProperties = markdownResultPage.additionalProperties.toMutableMap() } @@ -8209,6 +8234,37 @@ private constructor( */ fun header(header: JsonField) = apply { this.header = header } + /** Printed line numbers linked to final page markdown */ + fun lineNumbers(lineNumbers: List?) = + lineNumbers(JsonField.ofNullable(lineNumbers)) + + /** Alias for calling [Builder.lineNumbers] with `lineNumbers.orElse(null)`. */ + fun lineNumbers(lineNumbers: Optional>) = + lineNumbers(lineNumbers.getOrNull()) + + /** + * Sets [Builder.lineNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.lineNumbers] with a well-typed + * `List` value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun lineNumbers(lineNumbers: JsonField>) = apply { + this.lineNumbers = lineNumbers.map { it.toMutableList() } + } + + /** + * Adds a single [LineNumber] to [lineNumbers]. + * + * @throws IllegalStateException if the field was previously set to a non-list. + */ + fun addLineNumber(lineNumber: LineNumber) = apply { + lineNumbers = + (lineNumbers ?: JsonField.of(mutableListOf())).also { + checkKnown("lineNumbers", it).add(lineNumber) + } + } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8251,6 +8307,7 @@ private constructor( success, footer, header, + (lineNumbers ?: JsonMissing.of()).map { it.toImmutable() }, additionalProperties.toMutableMap(), ) } @@ -8283,6 +8340,7 @@ private constructor( } footer() header() + lineNumbers().ifPresent { it.forEach { it.validate() } } validated = true } @@ -8306,7 +8364,282 @@ private constructor( (if (pageNumber.asKnown().isPresent) 1 else 0) + success.let { if (it == JsonValue.from(true)) 1 else 0 } + (if (footer.asKnown().isPresent) 1 else 0) + - (if (header.asKnown().isPresent) 1 else 0) + (if (header.asKnown().isPresent) 1 else 0) + + (lineNumbers.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + /** Source line number linked to final page markdown. */ + class LineNumber + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val endIndex: JsonField, + private val lineNumber: JsonField, + private val startIndex: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("end_index") + @ExcludeMissing + endIndex: JsonField = JsonMissing.of(), + @JsonProperty("line_number") + @ExcludeMissing + lineNumber: JsonField = JsonMissing.of(), + @JsonProperty("start_index") + @ExcludeMissing + startIndex: JsonField = JsonMissing.of(), + ) : this(endIndex, lineNumber, startIndex, mutableMapOf()) + + /** + * Zero-based exclusive UTF-16 code-unit offset in final page markdown + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun endIndex(): Long = endIndex.getRequired("end_index") + + /** + * Printed source line number + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun lineNumber(): String = lineNumber.getRequired("line_number") + + /** + * Zero-based inclusive UTF-16 code-unit offset in final page markdown + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected + * type or is unexpectedly missing or null (e.g. if the server responded with + * an unexpected value). + */ + fun startIndex(): Long = startIndex.getRequired("start_index") + + /** + * Returns the raw JSON value of [endIndex]. + * + * Unlike [endIndex], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("end_index") + @ExcludeMissing + fun _endIndex(): JsonField = endIndex + + /** + * Returns the raw JSON value of [lineNumber]. + * + * Unlike [lineNumber], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("line_number") + @ExcludeMissing + fun _lineNumber(): JsonField = lineNumber + + /** + * Returns the raw JSON value of [startIndex]. + * + * Unlike [startIndex], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("start_index") + @ExcludeMissing + fun _startIndex(): JsonField = startIndex + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of [LineNumber]. + * + * The following fields are required: + * ```java + * .endIndex() + * .lineNumber() + * .startIndex() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [LineNumber]. */ + class Builder internal constructor() { + + private var endIndex: JsonField? = null + private var lineNumber: JsonField? = null + private var startIndex: JsonField? = null + private var additionalProperties: MutableMap = + mutableMapOf() + + @JvmSynthetic + internal fun from(lineNumber: LineNumber) = apply { + endIndex = lineNumber.endIndex + this.lineNumber = lineNumber.lineNumber + startIndex = lineNumber.startIndex + additionalProperties = lineNumber.additionalProperties.toMutableMap() + } + + /** Zero-based exclusive UTF-16 code-unit offset in final page markdown */ + fun endIndex(endIndex: Long) = endIndex(JsonField.of(endIndex)) + + /** + * Sets [Builder.endIndex] to an arbitrary JSON value. + * + * You should usually call [Builder.endIndex] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun endIndex(endIndex: JsonField) = apply { this.endIndex = endIndex } + + /** Printed source line number */ + fun lineNumber(lineNumber: String) = lineNumber(JsonField.of(lineNumber)) + + /** + * Sets [Builder.lineNumber] to an arbitrary JSON value. + * + * You should usually call [Builder.lineNumber] with a well-typed [String] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun lineNumber(lineNumber: JsonField) = apply { + this.lineNumber = lineNumber + } + + /** Zero-based inclusive UTF-16 code-unit offset in final page markdown */ + fun startIndex(startIndex: Long) = startIndex(JsonField.of(startIndex)) + + /** + * Sets [Builder.startIndex] to an arbitrary JSON value. + * + * You should usually call [Builder.startIndex] with a well-typed [Long] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun startIndex(startIndex: JsonField) = apply { + this.startIndex = startIndex + } + + fun additionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties( + additionalProperties: Map + ) = apply { this.additionalProperties.putAll(additionalProperties) } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [LineNumber]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .endIndex() + * .lineNumber() + * .startIndex() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): LineNumber = + LineNumber( + checkRequired("endIndex", endIndex), + checkRequired("lineNumber", lineNumber), + checkRequired("startIndex", startIndex), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected + * types recursively. + * + * This method is _not_ forwards compatible with new types from the API for + * existing fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object + * doesn't match its expected type. + */ + fun validate(): LineNumber = apply { + if (validated) { + return@apply + } + + endIndex() + lineNumber() + startIndex() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (endIndex.asKnown().isPresent) 1 else 0) + + (if (lineNumber.asKnown().isPresent) 1 else 0) + + (if (startIndex.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is LineNumber && + endIndex == other.endIndex && + lineNumber == other.lineNumber && + startIndex == other.startIndex && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(endIndex, lineNumber, startIndex, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "LineNumber{endIndex=$endIndex, lineNumber=$lineNumber, startIndex=$startIndex, additionalProperties=$additionalProperties}" + } override fun equals(other: Any?): Boolean { if (this === other) { @@ -8319,6 +8652,7 @@ private constructor( success == other.success && footer == other.footer && header == other.header && + lineNumbers == other.lineNumbers && additionalProperties == other.additionalProperties } @@ -8329,6 +8663,7 @@ private constructor( success, footer, header, + lineNumbers, additionalProperties, ) } @@ -8336,7 +8671,7 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "MarkdownResultPage{markdown=$markdown, pageNumber=$pageNumber, success=$success, footer=$footer, header=$header, additionalProperties=$additionalProperties}" + "MarkdownResultPage{markdown=$markdown, pageNumber=$pageNumber, success=$success, footer=$footer, header=$header, lineNumbers=$lineNumbers, additionalProperties=$additionalProperties}" } class FailedMarkdownPage @@ -8631,13 +8966,17 @@ private constructor( @JsonCreator(mode = JsonCreator.Mode.DISABLED) private constructor( private val pages: JsonField>, + private val document: JsonField, private val additionalProperties: MutableMap, ) { @JsonCreator private constructor( - @JsonProperty("pages") @ExcludeMissing pages: JsonField> = JsonMissing.of() - ) : this(pages, mutableMapOf()) + @JsonProperty("pages") @ExcludeMissing pages: JsonField> = JsonMissing.of(), + @JsonProperty("document") + @ExcludeMissing + document: JsonField = JsonMissing.of(), + ) : this(pages, document, mutableMapOf()) /** * List of page metadata entries @@ -8647,6 +8986,14 @@ private constructor( */ fun pages(): List = pages.getRequired("pages") + /** + * Document-level metadata information. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if + * the server responded with an unexpected value). + */ + fun document(): Optional = document.getOptional("document") + /** * Returns the raw JSON value of [pages]. * @@ -8654,8 +9001,15 @@ private constructor( */ @JsonProperty("pages") @ExcludeMissing fun _pages(): JsonField> = pages - @JsonAnySetter - private fun putAdditionalProperty(key: String, value: JsonValue) { + /** + * Returns the raw JSON value of [document]. + * + * Unlike [document], this method doesn't throw if the JSON field has an unexpected type. + */ + @JsonProperty("document") @ExcludeMissing fun _document(): JsonField = document + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { additionalProperties.put(key, value) } @@ -8683,11 +9037,13 @@ private constructor( class Builder internal constructor() { private var pages: JsonField>? = null + private var document: JsonField = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic internal fun from(metadata: Metadata) = apply { pages = metadata.pages.map { it.toMutableList() } + document = metadata.document additionalProperties = metadata.additionalProperties.toMutableMap() } @@ -8717,6 +9073,21 @@ private constructor( } } + /** Document-level metadata information. */ + fun document(document: Document?) = document(JsonField.ofNullable(document)) + + /** Alias for calling [Builder.document] with `document.orElse(null)`. */ + fun document(document: Optional) = document(document.getOrNull()) + + /** + * Sets [Builder.document] to an arbitrary JSON value. + * + * You should usually call [Builder.document] with a well-typed [Document] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun document(document: JsonField) = apply { this.document = document } + fun additionalProperties(additionalProperties: Map) = apply { this.additionalProperties.clear() putAllAdditionalProperties(additionalProperties) @@ -8751,6 +9122,7 @@ private constructor( fun build(): Metadata = Metadata( checkRequired("pages", pages).map { it.toImmutable() }, + document, additionalProperties.toMutableMap(), ) } @@ -8772,6 +9144,7 @@ private constructor( } pages().forEach { it.validate() } + document().ifPresent { it.validate() } validated = true } @@ -8791,7 +9164,8 @@ private constructor( */ @JvmSynthetic internal fun validity(): Int = - (pages.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + (pages.asKnown().getOrNull()?.sumOf { it.validity().toInt() } ?: 0) + + (document.asKnown().getOrNull()?.validity() ?: 0) /** Page-level metadata including confidence scores and presentation-specific data. */ class Page @@ -9369,6 +9743,518 @@ private constructor( "Page{pageNumber=$pageNumber, confidence=$confidence, costOptimized=$costOptimized, originalOrientationAngle=$originalOrientationAngle, printedPageNumber=$printedPageNumber, slideSectionName=$slideSectionName, speakerNotes=$speakerNotes, triggeredAutoMode=$triggeredAutoMode, additionalProperties=$additionalProperties}" } + /** Document-level metadata information. */ + class Document + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val confidence: JsonField, + private val confidenceBreakdown: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("confidence") + @ExcludeMissing + confidence: JsonField = JsonMissing.of(), + @JsonProperty("confidence_breakdown") + @ExcludeMissing + confidenceBreakdown: JsonField = JsonMissing.of(), + ) : this(confidence, confidenceBreakdown, mutableMapOf()) + + /** + * Mean confidence score across pages scored by the high-effort confidence judge (0-1) + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun confidence(): Optional = confidence.getOptional("confidence") + + /** + * Coverage and worst-page details for document confidence. + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. + * if the server responded with an unexpected value). + */ + fun confidenceBreakdown(): Optional = + confidenceBreakdown.getOptional("confidence_breakdown") + + /** + * Returns the raw JSON value of [confidence]. + * + * Unlike [confidence], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("confidence") + @ExcludeMissing + fun _confidence(): JsonField = confidence + + /** + * Returns the raw JSON value of [confidenceBreakdown]. + * + * Unlike [confidenceBreakdown], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("confidence_breakdown") + @ExcludeMissing + fun _confidenceBreakdown(): JsonField = confidenceBreakdown + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** Returns a mutable builder for constructing an instance of [Document]. */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [Document]. */ + class Builder internal constructor() { + + private var confidence: JsonField = JsonMissing.of() + private var confidenceBreakdown: JsonField = JsonMissing.of() + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(document: Document) = apply { + confidence = document.confidence + confidenceBreakdown = document.confidenceBreakdown + additionalProperties = document.additionalProperties.toMutableMap() + } + + /** + * Mean confidence score across pages scored by the high-effort confidence judge + * (0-1) + */ + fun confidence(confidence: Double?) = confidence(JsonField.ofNullable(confidence)) + + /** + * Alias for [Builder.confidence]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun confidence(confidence: Double) = confidence(confidence as Double?) + + /** Alias for calling [Builder.confidence] with `confidence.orElse(null)`. */ + fun confidence(confidence: Optional) = confidence(confidence.getOrNull()) + + /** + * Sets [Builder.confidence] to an arbitrary JSON value. + * + * You should usually call [Builder.confidence] with a well-typed [Double] value + * instead. This method is primarily for setting the field to an undocumented or not + * yet supported value. + */ + fun confidence(confidence: JsonField) = apply { + this.confidence = confidence + } + + /** Coverage and worst-page details for document confidence. */ + fun confidenceBreakdown(confidenceBreakdown: ConfidenceBreakdown?) = + confidenceBreakdown(JsonField.ofNullable(confidenceBreakdown)) + + /** + * Alias for calling [Builder.confidenceBreakdown] with + * `confidenceBreakdown.orElse(null)`. + */ + fun confidenceBreakdown(confidenceBreakdown: Optional) = + confidenceBreakdown(confidenceBreakdown.getOrNull()) + + /** + * Sets [Builder.confidenceBreakdown] to an arbitrary JSON value. + * + * You should usually call [Builder.confidenceBreakdown] with a well-typed + * [ConfidenceBreakdown] value instead. This method is primarily for setting the + * field to an undocumented or not yet supported value. + */ + fun confidenceBreakdown(confidenceBreakdown: JsonField) = + apply { + this.confidenceBreakdown = confidenceBreakdown + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [Document]. + * + * Further updates to this [Builder] will not mutate the returned instance. + */ + fun build(): Document = + Document(confidence, confidenceBreakdown, additionalProperties.toMutableMap()) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't match + * its expected type. + */ + fun validate(): Document = apply { + if (validated) { + return@apply + } + + confidence() + confidenceBreakdown().ifPresent { it.validate() } + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (confidence.asKnown().isPresent) 1 else 0) + + (confidenceBreakdown.asKnown().getOrNull()?.validity() ?: 0) + + /** Coverage and worst-page details for document confidence. */ + class ConfidenceBreakdown + @JsonCreator(mode = JsonCreator.Mode.DISABLED) + private constructor( + private val minPageScore: JsonField, + private val scoredPages: JsonField, + private val totalPages: JsonField, + private val additionalProperties: MutableMap, + ) { + + @JsonCreator + private constructor( + @JsonProperty("min_page_score") + @ExcludeMissing + minPageScore: JsonField = JsonMissing.of(), + @JsonProperty("scored_pages") + @ExcludeMissing + scoredPages: JsonField = JsonMissing.of(), + @JsonProperty("total_pages") + @ExcludeMissing + totalPages: JsonField = JsonMissing.of(), + ) : this(minPageScore, scoredPages, totalPages, mutableMapOf()) + + /** + * Lowest confidence score among pages scored by the high-effort confidence judge + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun minPageScore(): Double = minPageScore.getRequired("min_page_score") + + /** + * Number of pages successfully scored by the high-effort confidence judge + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun scoredPages(): Long = scoredPages.getRequired("scored_pages") + + /** + * Total number of pages in the parsed document + * + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type + * or is unexpectedly missing or null (e.g. if the server responded with an + * unexpected value). + */ + fun totalPages(): Long = totalPages.getRequired("total_pages") + + /** + * Returns the raw JSON value of [minPageScore]. + * + * Unlike [minPageScore], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("min_page_score") + @ExcludeMissing + fun _minPageScore(): JsonField = minPageScore + + /** + * Returns the raw JSON value of [scoredPages]. + * + * Unlike [scoredPages], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("scored_pages") + @ExcludeMissing + fun _scoredPages(): JsonField = scoredPages + + /** + * Returns the raw JSON value of [totalPages]. + * + * Unlike [totalPages], this method doesn't throw if the JSON field has an + * unexpected type. + */ + @JsonProperty("total_pages") + @ExcludeMissing + fun _totalPages(): JsonField = totalPages + + @JsonAnySetter + private fun putAdditionalProperty(key: String, value: JsonValue) { + additionalProperties.put(key, value) + } + + @JsonAnyGetter + @ExcludeMissing + fun _additionalProperties(): Map = + Collections.unmodifiableMap(additionalProperties) + + fun toBuilder() = Builder().from(this) + + companion object { + + /** + * Returns a mutable builder for constructing an instance of + * [ConfidenceBreakdown]. + * + * The following fields are required: + * ```java + * .minPageScore() + * .scoredPages() + * .totalPages() + * ``` + */ + @JvmStatic fun builder() = Builder() + } + + /** A builder for [ConfidenceBreakdown]. */ + class Builder internal constructor() { + + private var minPageScore: JsonField? = null + private var scoredPages: JsonField? = null + private var totalPages: JsonField? = null + private var additionalProperties: MutableMap = mutableMapOf() + + @JvmSynthetic + internal fun from(confidenceBreakdown: ConfidenceBreakdown) = apply { + minPageScore = confidenceBreakdown.minPageScore + scoredPages = confidenceBreakdown.scoredPages + totalPages = confidenceBreakdown.totalPages + additionalProperties = + confidenceBreakdown.additionalProperties.toMutableMap() + } + + /** + * Lowest confidence score among pages scored by the high-effort confidence + * judge + */ + fun minPageScore(minPageScore: Double) = + minPageScore(JsonField.of(minPageScore)) + + /** + * Sets [Builder.minPageScore] to an arbitrary JSON value. + * + * You should usually call [Builder.minPageScore] with a well-typed [Double] + * value instead. This method is primarily for setting the field to an + * undocumented or not yet supported value. + */ + fun minPageScore(minPageScore: JsonField) = apply { + this.minPageScore = minPageScore + } + + /** Number of pages successfully scored by the high-effort confidence judge */ + fun scoredPages(scoredPages: Long) = scoredPages(JsonField.of(scoredPages)) + + /** + * Sets [Builder.scoredPages] to an arbitrary JSON value. + * + * You should usually call [Builder.scoredPages] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun scoredPages(scoredPages: JsonField) = apply { + this.scoredPages = scoredPages + } + + /** Total number of pages in the parsed document */ + fun totalPages(totalPages: Long) = totalPages(JsonField.of(totalPages)) + + /** + * Sets [Builder.totalPages] to an arbitrary JSON value. + * + * You should usually call [Builder.totalPages] with a well-typed [Long] value + * instead. This method is primarily for setting the field to an undocumented or + * not yet supported value. + */ + fun totalPages(totalPages: JsonField) = apply { + this.totalPages = totalPages + } + + fun additionalProperties(additionalProperties: Map) = apply { + this.additionalProperties.clear() + putAllAdditionalProperties(additionalProperties) + } + + fun putAdditionalProperty(key: String, value: JsonValue) = apply { + additionalProperties.put(key, value) + } + + fun putAllAdditionalProperties(additionalProperties: Map) = + apply { + this.additionalProperties.putAll(additionalProperties) + } + + fun removeAdditionalProperty(key: String) = apply { + additionalProperties.remove(key) + } + + fun removeAllAdditionalProperties(keys: Set) = apply { + keys.forEach(::removeAdditionalProperty) + } + + /** + * Returns an immutable instance of [ConfidenceBreakdown]. + * + * Further updates to this [Builder] will not mutate the returned instance. + * + * The following fields are required: + * ```java + * .minPageScore() + * .scoredPages() + * .totalPages() + * ``` + * + * @throws IllegalStateException if any required field is unset. + */ + fun build(): ConfidenceBreakdown = + ConfidenceBreakdown( + checkRequired("minPageScore", minPageScore), + checkRequired("scoredPages", scoredPages), + checkRequired("totalPages", totalPages), + additionalProperties.toMutableMap(), + ) + } + + private var validated: Boolean = false + + /** + * Validates that the types of all values in this object match their expected types + * recursively. + * + * This method is _not_ forwards compatible with new types from the API for existing + * fields. + * + * @throws LlamaCloudInvalidDataException if any value type in this object doesn't + * match its expected type. + */ + fun validate(): ConfidenceBreakdown = apply { + if (validated) { + return@apply + } + + minPageScore() + scoredPages() + totalPages() + validated = true + } + + fun isValid(): Boolean = + try { + validate() + true + } catch (e: LlamaCloudInvalidDataException) { + false + } + + /** + * Returns a score indicating how many valid values are contained in this object + * recursively. + * + * Used for best match union deserialization. + */ + @JvmSynthetic + internal fun validity(): Int = + (if (minPageScore.asKnown().isPresent) 1 else 0) + + (if (scoredPages.asKnown().isPresent) 1 else 0) + + (if (totalPages.asKnown().isPresent) 1 else 0) + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is ConfidenceBreakdown && + minPageScore == other.minPageScore && + scoredPages == other.scoredPages && + totalPages == other.totalPages && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(minPageScore, scoredPages, totalPages, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "ConfidenceBreakdown{minPageScore=$minPageScore, scoredPages=$scoredPages, totalPages=$totalPages, additionalProperties=$additionalProperties}" + } + + override fun equals(other: Any?): Boolean { + if (this === other) { + return true + } + + return other is Document && + confidence == other.confidence && + confidenceBreakdown == other.confidenceBreakdown && + additionalProperties == other.additionalProperties + } + + private val hashCode: Int by lazy { + Objects.hash(confidence, confidenceBreakdown, additionalProperties) + } + + override fun hashCode(): Int = hashCode + + override fun toString() = + "Document{confidence=$confidence, confidenceBreakdown=$confidenceBreakdown, additionalProperties=$additionalProperties}" + } + override fun equals(other: Any?): Boolean { if (this === other) { return true @@ -9376,15 +10262,16 @@ private constructor( return other is Metadata && pages == other.pages && + document == other.document && additionalProperties == other.additionalProperties } - private val hashCode: Int by lazy { Objects.hash(pages, additionalProperties) } + private val hashCode: Int by lazy { Objects.hash(pages, document, additionalProperties) } override fun hashCode(): Int = hashCode override fun toString() = - "Metadata{pages=$pages, additionalProperties=$additionalProperties}" + "Metadata{pages=$pages, document=$document, additionalProperties=$additionalProperties}" } class RawParameters diff --git a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParameters.kt b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParameters.kt index 61f3601..ae46367 100644 --- a/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParameters.kt +++ b/llama-cloud-core/src/main/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParameters.kt @@ -27,6 +27,7 @@ class LlamaParseParameters private constructor( private val adaptiveLongTable: JsonField, private val aggressiveTableExtraction: JsonField, + private val annotateLineNumbers: JsonField, private val annotateLinks: JsonField, private val annotateRevisions: JsonField, private val autoMode: JsonField, @@ -157,6 +158,9 @@ private constructor( @JsonProperty("aggressive_table_extraction") @ExcludeMissing aggressiveTableExtraction: JsonField = JsonMissing.of(), + @JsonProperty("annotate_line_numbers") + @ExcludeMissing + annotateLineNumbers: JsonField = JsonMissing.of(), @JsonProperty("annotate_links") @ExcludeMissing annotateLinks: JsonField = JsonMissing.of(), @@ -489,6 +493,7 @@ private constructor( ) : this( adaptiveLongTable, aggressiveTableExtraction, + annotateLineNumbers, annotateLinks, annotateRevisions, autoMode, @@ -625,6 +630,13 @@ private constructor( fun aggressiveTableExtraction(): Optional = aggressiveTableExtraction.getOptional("aggressive_table_extraction") + /** + * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the + * server responded with an unexpected value). + */ + fun annotateLineNumbers(): Optional = + annotateLineNumbers.getOptional("annotate_line_numbers") + /** * @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the * server responded with an unexpected value). @@ -1442,6 +1454,16 @@ private constructor( @ExcludeMissing fun _aggressiveTableExtraction(): JsonField = aggressiveTableExtraction + /** + * Returns the raw JSON value of [annotateLineNumbers]. + * + * Unlike [annotateLineNumbers], this method doesn't throw if the JSON field has an unexpected + * type. + */ + @JsonProperty("annotate_line_numbers") + @ExcludeMissing + fun _annotateLineNumbers(): JsonField = annotateLineNumbers + /** * Returns the raw JSON value of [annotateLinks]. * @@ -2567,6 +2589,7 @@ private constructor( private var adaptiveLongTable: JsonField = JsonMissing.of() private var aggressiveTableExtraction: JsonField = JsonMissing.of() + private var annotateLineNumbers: JsonField = JsonMissing.of() private var annotateLinks: JsonField = JsonMissing.of() private var annotateRevisions: JsonField = JsonMissing.of() private var autoMode: JsonField = JsonMissing.of() @@ -2692,6 +2715,7 @@ private constructor( internal fun from(llamaParseParameters: LlamaParseParameters) = apply { adaptiveLongTable = llamaParseParameters.adaptiveLongTable aggressiveTableExtraction = llamaParseParameters.aggressiveTableExtraction + annotateLineNumbers = llamaParseParameters.annotateLineNumbers annotateLinks = llamaParseParameters.annotateLinks annotateRevisions = llamaParseParameters.annotateRevisions autoMode = llamaParseParameters.autoMode @@ -2879,6 +2903,34 @@ private constructor( this.aggressiveTableExtraction = aggressiveTableExtraction } + fun annotateLineNumbers(annotateLineNumbers: Boolean?) = + annotateLineNumbers(JsonField.ofNullable(annotateLineNumbers)) + + /** + * Alias for [Builder.annotateLineNumbers]. + * + * This unboxed primitive overload exists for backwards compatibility. + */ + fun annotateLineNumbers(annotateLineNumbers: Boolean) = + annotateLineNumbers(annotateLineNumbers as Boolean?) + + /** + * Alias for calling [Builder.annotateLineNumbers] with `annotateLineNumbers.orElse(null)`. + */ + fun annotateLineNumbers(annotateLineNumbers: Optional) = + annotateLineNumbers(annotateLineNumbers.getOrNull()) + + /** + * Sets [Builder.annotateLineNumbers] to an arbitrary JSON value. + * + * You should usually call [Builder.annotateLineNumbers] with a well-typed [Boolean] value + * instead. This method is primarily for setting the field to an undocumented or not yet + * supported value. + */ + fun annotateLineNumbers(annotateLineNumbers: JsonField) = apply { + this.annotateLineNumbers = annotateLineNumbers + } + fun annotateLinks(annotateLinks: Boolean?) = annotateLinks(JsonField.ofNullable(annotateLinks)) @@ -5713,6 +5765,7 @@ private constructor( LlamaParseParameters( adaptiveLongTable, aggressiveTableExtraction, + annotateLineNumbers, annotateLinks, annotateRevisions, autoMode, @@ -5853,6 +5906,7 @@ private constructor( adaptiveLongTable() aggressiveTableExtraction() + annotateLineNumbers() annotateLinks() annotateRevisions() autoMode() @@ -5992,6 +6046,7 @@ private constructor( internal fun validity(): Int = (if (adaptiveLongTable.asKnown().isPresent) 1 else 0) + (if (aggressiveTableExtraction.asKnown().isPresent) 1 else 0) + + (if (annotateLineNumbers.asKnown().isPresent) 1 else 0) + (if (annotateLinks.asKnown().isPresent) 1 else 0) + (if (annotateRevisions.asKnown().isPresent) 1 else 0) + (if (autoMode.asKnown().isPresent) 1 else 0) + @@ -7259,6 +7314,7 @@ private constructor( return other is LlamaParseParameters && adaptiveLongTable == other.adaptiveLongTable && aggressiveTableExtraction == other.aggressiveTableExtraction && + annotateLineNumbers == other.annotateLineNumbers && annotateLinks == other.annotateLinks && annotateRevisions == other.annotateRevisions && autoMode == other.autoMode && @@ -7388,6 +7444,7 @@ private constructor( Objects.hash( adaptiveLongTable, aggressiveTableExtraction, + annotateLineNumbers, annotateLinks, annotateRevisions, autoMode, @@ -7514,5 +7571,5 @@ private constructor( override fun hashCode(): Int = hashCode override fun toString() = - "LlamaParseParameters{adaptiveLongTable=$adaptiveLongTable, aggressiveTableExtraction=$aggressiveTableExtraction, annotateLinks=$annotateLinks, annotateRevisions=$annotateRevisions, autoMode=$autoMode, autoModeConfigurationJson=$autoModeConfigurationJson, autoModeTriggerOnImageInPage=$autoModeTriggerOnImageInPage, autoModeTriggerOnRegexpInPage=$autoModeTriggerOnRegexpInPage, autoModeTriggerOnTableInPage=$autoModeTriggerOnTableInPage, autoModeTriggerOnTextInPage=$autoModeTriggerOnTextInPage, azureOpenAIApiVersion=$azureOpenAIApiVersion, azureOpenAIDeploymentName=$azureOpenAIDeploymentName, azureOpenAIEndpoint=$azureOpenAIEndpoint, azureOpenAIKey=$azureOpenAIKey, bboxBottom=$bboxBottom, bboxLeft=$bboxLeft, bboxRight=$bboxRight, bboxTop=$bboxTop, boundingBox=$boundingBox, compactMarkdownTable=$compactMarkdownTable, complementalFormattingInstruction=$complementalFormattingInstruction, confidenceScoreEffort=$confidenceScoreEffort, contentGuidelineInstruction=$contentGuidelineInstruction, continuousMode=$continuousMode, disableImageExtraction=$disableImageExtraction, disableOcr=$disableOcr, disableReconstruction=$disableReconstruction, doNotCache=$doNotCache, doNotUnrollColumns=$doNotUnrollColumns, enableCostOptimizer=$enableCostOptimizer, extractCharts=$extractCharts, extractLayout=$extractLayout, extractPrintedPageNumber=$extractPrintedPageNumber, fastMode=$fastMode, formattingInstruction=$formattingInstruction, gpt4oApiKey=$gpt4oApiKey, gpt4oMode=$gpt4oMode, guessXlsxSheetName=$guessXlsxSheetName, hideFooters=$hideFooters, hideHeaders=$hideHeaders, highResOcr=$highResOcr, htmlMakeAllElementsVisible=$htmlMakeAllElementsVisible, htmlRemoveFixedElements=$htmlRemoveFixedElements, htmlRemoveNavigationElements=$htmlRemoveNavigationElements, httpProxy=$httpProxy, ignoreDocumentElementsForLayoutDetection=$ignoreDocumentElementsForLayoutDetection, imagesToSave=$imagesToSave, inlineImagesInMarkdown=$inlineImagesInMarkdown, inputS3Path=$inputS3Path, inputS3Region=$inputS3Region, inputUrl=$inputUrl, internalIsScreenshotJob=$internalIsScreenshotJob, invalidateCache=$invalidateCache, isFormattingInstruction=$isFormattingInstruction, jobTimeoutExtraTimePerPageInSeconds=$jobTimeoutExtraTimePerPageInSeconds, jobTimeoutInSeconds=$jobTimeoutInSeconds, keepPageSeparatorWhenMergingTables=$keepPageSeparatorWhenMergingTables, languages=$languages, layoutAware=$layoutAware, lineLevelBoundingBox=$lineLevelBoundingBox, markdownTableMultilineHeaderSeparator=$markdownTableMultilineHeaderSeparator, maxPages=$maxPages, maxPagesEnforced=$maxPagesEnforced, mergeTablesAcrossPagesInMarkdown=$mergeTablesAcrossPagesInMarkdown, model=$model, outlinedTableExtraction=$outlinedTableExtraction, outputPdfOfDocument=$outputPdfOfDocument, outputS3PathPrefix=$outputS3PathPrefix, outputS3Region=$outputS3Region, outputTablesAsHtml=$outputTablesAsHtml, pageErrorTolerance=$pageErrorTolerance, pageFooterPrefix=$pageFooterPrefix, pageFooterSuffix=$pageFooterSuffix, pageHeaderPrefix=$pageHeaderPrefix, pageHeaderSuffix=$pageHeaderSuffix, pagePrefix=$pagePrefix, pageSeparator=$pageSeparator, pageSuffix=$pageSuffix, parseMode=$parseMode, parsingInstruction=$parsingInstruction, preciseBoundingBox=$preciseBoundingBox, premiumMode=$premiumMode, presentationOutOfBoundsContent=$presentationOutOfBoundsContent, presentationSkipEmbeddedData=$presentationSkipEmbeddedData, preserveLayoutAlignmentAcrossPages=$preserveLayoutAlignmentAcrossPages, preserveVerySmallText=$preserveVerySmallText, preset=$preset, priority=$priority, projectId=$projectId, removeHiddenText=$removeHiddenText, replaceFailedPageMode=$replaceFailedPageMode, replaceFailedPageWithErrorMessagePrefix=$replaceFailedPageWithErrorMessagePrefix, replaceFailedPageWithErrorMessageSuffix=$replaceFailedPageWithErrorMessageSuffix, saveImages=$saveImages, skipDiagonalText=$skipDiagonalText, specializedChartParsingAgentic=$specializedChartParsingAgentic, specializedChartParsingEfficient=$specializedChartParsingEfficient, specializedChartParsingPlus=$specializedChartParsingPlus, specializedImageParsing=$specializedImageParsing, spreadsheetExtractSubTables=$spreadsheetExtractSubTables, spreadsheetForceFormulaComputation=$spreadsheetForceFormulaComputation, spreadsheetIncludeHiddenSheets=$spreadsheetIncludeHiddenSheets, strictModeBuggyFont=$strictModeBuggyFont, strictModeImageExtraction=$strictModeImageExtraction, strictModeImageOcr=$strictModeImageOcr, strictModeReconstruction=$strictModeReconstruction, structuredOutput=$structuredOutput, structuredOutputJsonSchema=$structuredOutputJsonSchema, structuredOutputJsonSchemaName=$structuredOutputJsonSchemaName, systemPrompt=$systemPrompt, systemPromptAppend=$systemPromptAppend, takeScreenshot=$takeScreenshot, targetPages=$targetPages, tier=$tier, useVendorMultimodalModel=$useVendorMultimodalModel, userPrompt=$userPrompt, vendorMultimodalApiKey=$vendorMultimodalApiKey, vendorMultimodalModelName=$vendorMultimodalModelName, version=$version, webhookConfigurations=$webhookConfigurations, webhookUrl=$webhookUrl, additionalProperties=$additionalProperties}" + "LlamaParseParameters{adaptiveLongTable=$adaptiveLongTable, aggressiveTableExtraction=$aggressiveTableExtraction, annotateLineNumbers=$annotateLineNumbers, annotateLinks=$annotateLinks, annotateRevisions=$annotateRevisions, autoMode=$autoMode, autoModeConfigurationJson=$autoModeConfigurationJson, autoModeTriggerOnImageInPage=$autoModeTriggerOnImageInPage, autoModeTriggerOnRegexpInPage=$autoModeTriggerOnRegexpInPage, autoModeTriggerOnTableInPage=$autoModeTriggerOnTableInPage, autoModeTriggerOnTextInPage=$autoModeTriggerOnTextInPage, azureOpenAIApiVersion=$azureOpenAIApiVersion, azureOpenAIDeploymentName=$azureOpenAIDeploymentName, azureOpenAIEndpoint=$azureOpenAIEndpoint, azureOpenAIKey=$azureOpenAIKey, bboxBottom=$bboxBottom, bboxLeft=$bboxLeft, bboxRight=$bboxRight, bboxTop=$bboxTop, boundingBox=$boundingBox, compactMarkdownTable=$compactMarkdownTable, complementalFormattingInstruction=$complementalFormattingInstruction, confidenceScoreEffort=$confidenceScoreEffort, contentGuidelineInstruction=$contentGuidelineInstruction, continuousMode=$continuousMode, disableImageExtraction=$disableImageExtraction, disableOcr=$disableOcr, disableReconstruction=$disableReconstruction, doNotCache=$doNotCache, doNotUnrollColumns=$doNotUnrollColumns, enableCostOptimizer=$enableCostOptimizer, extractCharts=$extractCharts, extractLayout=$extractLayout, extractPrintedPageNumber=$extractPrintedPageNumber, fastMode=$fastMode, formattingInstruction=$formattingInstruction, gpt4oApiKey=$gpt4oApiKey, gpt4oMode=$gpt4oMode, guessXlsxSheetName=$guessXlsxSheetName, hideFooters=$hideFooters, hideHeaders=$hideHeaders, highResOcr=$highResOcr, htmlMakeAllElementsVisible=$htmlMakeAllElementsVisible, htmlRemoveFixedElements=$htmlRemoveFixedElements, htmlRemoveNavigationElements=$htmlRemoveNavigationElements, httpProxy=$httpProxy, ignoreDocumentElementsForLayoutDetection=$ignoreDocumentElementsForLayoutDetection, imagesToSave=$imagesToSave, inlineImagesInMarkdown=$inlineImagesInMarkdown, inputS3Path=$inputS3Path, inputS3Region=$inputS3Region, inputUrl=$inputUrl, internalIsScreenshotJob=$internalIsScreenshotJob, invalidateCache=$invalidateCache, isFormattingInstruction=$isFormattingInstruction, jobTimeoutExtraTimePerPageInSeconds=$jobTimeoutExtraTimePerPageInSeconds, jobTimeoutInSeconds=$jobTimeoutInSeconds, keepPageSeparatorWhenMergingTables=$keepPageSeparatorWhenMergingTables, languages=$languages, layoutAware=$layoutAware, lineLevelBoundingBox=$lineLevelBoundingBox, markdownTableMultilineHeaderSeparator=$markdownTableMultilineHeaderSeparator, maxPages=$maxPages, maxPagesEnforced=$maxPagesEnforced, mergeTablesAcrossPagesInMarkdown=$mergeTablesAcrossPagesInMarkdown, model=$model, outlinedTableExtraction=$outlinedTableExtraction, outputPdfOfDocument=$outputPdfOfDocument, outputS3PathPrefix=$outputS3PathPrefix, outputS3Region=$outputS3Region, outputTablesAsHtml=$outputTablesAsHtml, pageErrorTolerance=$pageErrorTolerance, pageFooterPrefix=$pageFooterPrefix, pageFooterSuffix=$pageFooterSuffix, pageHeaderPrefix=$pageHeaderPrefix, pageHeaderSuffix=$pageHeaderSuffix, pagePrefix=$pagePrefix, pageSeparator=$pageSeparator, pageSuffix=$pageSuffix, parseMode=$parseMode, parsingInstruction=$parsingInstruction, preciseBoundingBox=$preciseBoundingBox, premiumMode=$premiumMode, presentationOutOfBoundsContent=$presentationOutOfBoundsContent, presentationSkipEmbeddedData=$presentationSkipEmbeddedData, preserveLayoutAlignmentAcrossPages=$preserveLayoutAlignmentAcrossPages, preserveVerySmallText=$preserveVerySmallText, preset=$preset, priority=$priority, projectId=$projectId, removeHiddenText=$removeHiddenText, replaceFailedPageMode=$replaceFailedPageMode, replaceFailedPageWithErrorMessagePrefix=$replaceFailedPageWithErrorMessagePrefix, replaceFailedPageWithErrorMessageSuffix=$replaceFailedPageWithErrorMessageSuffix, saveImages=$saveImages, skipDiagonalText=$skipDiagonalText, specializedChartParsingAgentic=$specializedChartParsingAgentic, specializedChartParsingEfficient=$specializedChartParsingEfficient, specializedChartParsingPlus=$specializedChartParsingPlus, specializedImageParsing=$specializedImageParsing, spreadsheetExtractSubTables=$spreadsheetExtractSubTables, spreadsheetForceFormulaComputation=$spreadsheetForceFormulaComputation, spreadsheetIncludeHiddenSheets=$spreadsheetIncludeHiddenSheets, strictModeBuggyFont=$strictModeBuggyFont, strictModeImageExtraction=$strictModeImageExtraction, strictModeImageOcr=$strictModeImageOcr, strictModeReconstruction=$strictModeReconstruction, structuredOutput=$structuredOutput, structuredOutputJsonSchema=$structuredOutputJsonSchema, structuredOutputJsonSchemaName=$structuredOutputJsonSchemaName, systemPrompt=$systemPrompt, systemPromptAppend=$systemPromptAppend, takeScreenshot=$takeScreenshot, targetPages=$targetPages, tier=$tier, useVendorMultimodalModel=$useVendorMultimodalModel, userPrompt=$userPrompt, vendorMultimodalApiKey=$vendorMultimodalApiKey, vendorMultimodalModelName=$vendorMultimodalModelName, version=$version, webhookConfigurations=$webhookConfigurations, webhookUrl=$webhookUrl, additionalProperties=$additionalProperties}" } diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2ParametersTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2ParametersTest.kt index 7e566f3..50183da 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2ParametersTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/configurations/ParseV2ParametersTest.kt @@ -78,6 +78,7 @@ internal class ParseV2ParametersTest { .addImagesToSave(ParseV2Parameters.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParseV2Parameters.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) @@ -366,6 +367,7 @@ internal class ParseV2ParametersTest { .addImagesToSave(ParseV2Parameters.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParseV2Parameters.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) @@ -652,6 +654,7 @@ internal class ParseV2ParametersTest { .addImagesToSave(ParseV2Parameters.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParseV2Parameters.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParamsTest.kt index 0265305..2a3629a 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingCreateParamsTest.kt @@ -80,6 +80,7 @@ internal class ParsingCreateParamsTest { .addImagesToSave(ParsingCreateParams.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) @@ -376,6 +377,7 @@ internal class ParsingCreateParamsTest { .addImagesToSave(ParsingCreateParams.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) @@ -702,6 +704,7 @@ internal class ParsingCreateParamsTest { .addImagesToSave(ParsingCreateParams.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) @@ -1002,6 +1005,7 @@ internal class ParsingCreateParamsTest { .addImagesToSave(ParsingCreateParams.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponseTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponseTest.kt index f366394..02fb869 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponseTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/parsing/ParsingGetResponseTest.kt @@ -252,6 +252,14 @@ internal class ParsingGetResponseTest { .pageNumber(0L) .footer("footer") .header("header") + .addLineNumber( + ParsingGetResponse.Markdown.Page.MarkdownResultPage.LineNumber + .builder() + .endIndex(0L) + .lineNumber("line_number") + .startIndex(0L) + .build() + ) .build() ) .build() @@ -271,6 +279,19 @@ internal class ParsingGetResponseTest { .triggeredAutoMode(true) .build() ) + .document( + ParsingGetResponse.Metadata.Document.builder() + .confidence(0.0) + .confidenceBreakdown( + ParsingGetResponse.Metadata.Document.ConfidenceBreakdown + .builder() + .minPageScore(0.0) + .scoredPages(0L) + .totalPages(0L) + .build() + ) + .build() + ) .build() ) .rawParameters( @@ -541,6 +562,14 @@ internal class ParsingGetResponseTest { .pageNumber(0L) .footer("footer") .header("header") + .addLineNumber( + ParsingGetResponse.Markdown.Page.MarkdownResultPage.LineNumber + .builder() + .endIndex(0L) + .lineNumber("line_number") + .startIndex(0L) + .build() + ) .build() ) .build() @@ -561,6 +590,18 @@ internal class ParsingGetResponseTest { .triggeredAutoMode(true) .build() ) + .document( + ParsingGetResponse.Metadata.Document.builder() + .confidence(0.0) + .confidenceBreakdown( + ParsingGetResponse.Metadata.Document.ConfidenceBreakdown.builder() + .minPageScore(0.0) + .scoredPages(0L) + .totalPages(0L) + .build() + ) + .build() + ) .build() ) assertThat(parsingGetResponse.rawParameters()) @@ -837,6 +878,14 @@ internal class ParsingGetResponseTest { .pageNumber(0L) .footer("footer") .header("header") + .addLineNumber( + ParsingGetResponse.Markdown.Page.MarkdownResultPage.LineNumber + .builder() + .endIndex(0L) + .lineNumber("line_number") + .startIndex(0L) + .build() + ) .build() ) .build() @@ -856,6 +905,19 @@ internal class ParsingGetResponseTest { .triggeredAutoMode(true) .build() ) + .document( + ParsingGetResponse.Metadata.Document.builder() + .confidence(0.0) + .confidenceBreakdown( + ParsingGetResponse.Metadata.Document.ConfidenceBreakdown + .builder() + .minPageScore(0.0) + .scoredPages(0L) + .totalPages(0L) + .build() + ) + .build() + ) .build() ) .rawParameters( diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParametersTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParametersTest.kt index e695f4b..59c3cd8 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParametersTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/LlamaParseParametersTest.kt @@ -20,6 +20,7 @@ internal class LlamaParseParametersTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -167,6 +168,7 @@ internal class LlamaParseParametersTest { assertThat(llamaParseParameters.adaptiveLongTable()).contains(true) assertThat(llamaParseParameters.aggressiveTableExtraction()).contains(true) + assertThat(llamaParseParameters.annotateLineNumbers()).contains(true) assertThat(llamaParseParameters.annotateLinks()).contains(true) assertThat(llamaParseParameters.annotateRevisions()).contains(true) assertThat(llamaParseParameters.autoMode()).contains(true) @@ -329,6 +331,7 @@ internal class LlamaParseParametersTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateParamsTest.kt index 3b92f4c..cc8ef6a 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateParamsTest.kt @@ -69,6 +69,7 @@ internal class PipelineCreateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -348,6 +349,7 @@ internal class PipelineCreateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -653,6 +655,7 @@ internal class PipelineCreateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -929,6 +932,7 @@ internal class PipelineCreateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateTest.kt index 9a1e16c..c45c55f 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineCreateTest.kt @@ -67,6 +67,7 @@ internal class PipelineCreateTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -333,6 +334,7 @@ internal class PipelineCreateTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -601,6 +603,7 @@ internal class PipelineCreateTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineTest.kt index e083de2..58895f5 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineTest.kt @@ -126,6 +126,7 @@ internal class PipelineTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -449,6 +450,7 @@ internal class PipelineTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -774,6 +776,7 @@ internal class PipelineTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpdateParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpdateParamsTest.kt index 3ce70d1..2abb0fc 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpdateParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpdateParamsTest.kt @@ -64,6 +64,7 @@ internal class PipelineUpdateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -337,6 +338,7 @@ internal class PipelineUpdateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -603,6 +605,7 @@ internal class PipelineUpdateParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpsertParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpsertParamsTest.kt index 52743a8..0693a94 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpsertParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/models/pipelines/PipelineUpsertParamsTest.kt @@ -69,6 +69,7 @@ internal class PipelineUpsertParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -348,6 +349,7 @@ internal class PipelineUpsertParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -653,6 +655,7 @@ internal class PipelineUpsertParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -929,6 +932,7 @@ internal class PipelineUpsertParamsTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/ServiceParamsTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/ServiceParamsTest.kt index 54c008b..d065691 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/ServiceParamsTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/ServiceParamsTest.kt @@ -137,6 +137,7 @@ internal class ServiceParamsTest { .addImagesToSave(ParsingCreateParams.OutputOptions.ImagesToSave.EMBEDDED) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/ParsingServiceAsyncTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/ParsingServiceAsyncTest.kt index d1eb789..3d8140a 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/ParsingServiceAsyncTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/ParsingServiceAsyncTest.kt @@ -93,6 +93,7 @@ internal class ParsingServiceAsyncTest { ) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/PipelineServiceAsyncTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/PipelineServiceAsyncTest.kt index d6407de..ff7b5c0 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/PipelineServiceAsyncTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/async/PipelineServiceAsyncTest.kt @@ -99,6 +99,7 @@ internal class PipelineServiceAsyncTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -441,6 +442,7 @@ internal class PipelineServiceAsyncTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -792,6 +794,7 @@ internal class PipelineServiceAsyncTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/ParsingServiceTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/ParsingServiceTest.kt index e72f74c..9e72335 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/ParsingServiceTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/ParsingServiceTest.kt @@ -93,6 +93,7 @@ internal class ParsingServiceTest { ) .markdown( ParsingCreateParams.OutputOptions.Markdown.builder() + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .inlineImages(true) diff --git a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/PipelineServiceTest.kt b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/PipelineServiceTest.kt index 828eae7..9cd260f 100644 --- a/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/PipelineServiceTest.kt +++ b/llama-cloud-core/src/test/kotlin/ai/llamaindex/llamacloud/services/blocking/PipelineServiceTest.kt @@ -99,6 +99,7 @@ internal class PipelineServiceTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -439,6 +440,7 @@ internal class PipelineServiceTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true) @@ -784,6 +786,7 @@ internal class PipelineServiceTest { LlamaParseParameters.builder() .adaptiveLongTable(true) .aggressiveTableExtraction(true) + .annotateLineNumbers(true) .annotateLinks(true) .annotateRevisions(true) .autoMode(true)