Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CloudGoogleDriveDataSource
private constructor(
private val folderId: JsonField<String>,
private val className: JsonField<String>,
private val folderName: JsonField<String>,
private val serviceAccountKey: JsonField<ServiceAccountKey>,
private val supportsAccessControl: JsonField<Boolean>,
private val additionalProperties: MutableMap<String, JsonValue>,
Expand All @@ -32,13 +33,23 @@ private constructor(
private constructor(
@JsonProperty("folder_id") @ExcludeMissing folderId: JsonField<String> = JsonMissing.of(),
@JsonProperty("class_name") @ExcludeMissing className: JsonField<String> = JsonMissing.of(),
@JsonProperty("folder_name")
@ExcludeMissing
folderName: JsonField<String> = JsonMissing.of(),
@JsonProperty("service_account_key")
@ExcludeMissing
serviceAccountKey: JsonField<ServiceAccountKey> = JsonMissing.of(),
@JsonProperty("supports_access_control")
@ExcludeMissing
supportsAccessControl: JsonField<Boolean> = JsonMissing.of(),
) : this(folderId, className, serviceAccountKey, supportsAccessControl, mutableMapOf())
) : this(
folderId,
className,
folderName,
serviceAccountKey,
supportsAccessControl,
mutableMapOf(),
)

/**
* The ID of the Google Drive folder to read from.
Expand All @@ -54,6 +65,14 @@ private constructor(
*/
fun className(): Optional<String> = className.getOptional("class_name")

/**
* Human-readable name of the selected folder, for display.
*
* @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
*/
fun folderName(): Optional<String> = folderName.getOptional("folder_name")

/**
* A dictionary containing secret values
*
Expand Down Expand Up @@ -84,6 +103,13 @@ private constructor(
*/
@JsonProperty("class_name") @ExcludeMissing fun _className(): JsonField<String> = className

/**
* Returns the raw JSON value of [folderName].
*
* Unlike [folderName], this method doesn't throw if the JSON field has an unexpected type.
*/
@JsonProperty("folder_name") @ExcludeMissing fun _folderName(): JsonField<String> = folderName

/**
* Returns the raw JSON value of [serviceAccountKey].
*
Expand Down Expand Up @@ -134,6 +160,7 @@ private constructor(

private var folderId: JsonField<String>? = null
private var className: JsonField<String> = JsonMissing.of()
private var folderName: JsonField<String> = JsonMissing.of()
private var serviceAccountKey: JsonField<ServiceAccountKey> = JsonMissing.of()
private var supportsAccessControl: JsonField<Boolean> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
Expand All @@ -142,6 +169,7 @@ private constructor(
internal fun from(cloudGoogleDriveDataSource: CloudGoogleDriveDataSource) = apply {
folderId = cloudGoogleDriveDataSource.folderId
className = cloudGoogleDriveDataSource.className
folderName = cloudGoogleDriveDataSource.folderName
serviceAccountKey = cloudGoogleDriveDataSource.serviceAccountKey
supportsAccessControl = cloudGoogleDriveDataSource.supportsAccessControl
additionalProperties = cloudGoogleDriveDataSource.additionalProperties.toMutableMap()
Expand Down Expand Up @@ -169,6 +197,21 @@ private constructor(
*/
fun className(className: JsonField<String>) = apply { this.className = className }

/** Human-readable name of the selected folder, for display. */
fun folderName(folderName: String?) = folderName(JsonField.ofNullable(folderName))

/** Alias for calling [Builder.folderName] with `folderName.orElse(null)`. */
fun folderName(folderName: Optional<String>) = folderName(folderName.getOrNull())

/**
* Sets [Builder.folderName] to an arbitrary JSON value.
*
* You should usually call [Builder.folderName] with a well-typed [String] value instead.
* This method is primarily for setting the field to an undocumented or not yet supported
* value.
*/
fun folderName(folderName: JsonField<String>) = apply { this.folderName = folderName }

/** A dictionary containing secret values */
fun serviceAccountKey(serviceAccountKey: ServiceAccountKey?) =
serviceAccountKey(JsonField.ofNullable(serviceAccountKey))
Expand Down Expand Up @@ -237,6 +280,7 @@ private constructor(
CloudGoogleDriveDataSource(
checkRequired("folderId", folderId),
className,
folderName,
serviceAccountKey,
supportsAccessControl,
additionalProperties.toMutableMap(),
Expand All @@ -260,6 +304,7 @@ private constructor(

folderId()
className()
folderName()
serviceAccountKey().ifPresent { it.validate() }
supportsAccessControl()
validated = true
Expand All @@ -282,6 +327,7 @@ private constructor(
internal fun validity(): Int =
(if (folderId.asKnown().isPresent) 1 else 0) +
(if (className.asKnown().isPresent) 1 else 0) +
(if (folderName.asKnown().isPresent) 1 else 0) +
(serviceAccountKey.asKnown().getOrNull()?.validity() ?: 0) +
(if (supportsAccessControl.asKnown().isPresent) 1 else 0)

Expand Down Expand Up @@ -402,6 +448,7 @@ private constructor(
return other is CloudGoogleDriveDataSource &&
folderId == other.folderId &&
className == other.className &&
folderName == other.folderName &&
serviceAccountKey == other.serviceAccountKey &&
supportsAccessControl == other.supportsAccessControl &&
additionalProperties == other.additionalProperties
Expand All @@ -411,6 +458,7 @@ private constructor(
Objects.hash(
folderId,
className,
folderName,
serviceAccountKey,
supportsAccessControl,
additionalProperties,
Expand All @@ -420,5 +468,5 @@ private constructor(
override fun hashCode(): Int = hashCode

override fun toString() =
"CloudGoogleDriveDataSource{folderId=$folderId, className=$className, serviceAccountKey=$serviceAccountKey, supportsAccessControl=$supportsAccessControl, additionalProperties=$additionalProperties}"
"CloudGoogleDriveDataSource{folderId=$folderId, className=$className, folderName=$folderName, serviceAccountKey=$serviceAccountKey, supportsAccessControl=$supportsAccessControl, additionalProperties=$additionalProperties}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private constructor(
fun systemMetadata(): Optional<SystemMetadata> = systemMetadata.getOptional("system_metadata")

/**
* Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'.
* Directory type: 'user', 'index', or 'ephemeral'.
*
* @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -405,7 +405,7 @@ private constructor(
this.systemMetadata = systemMetadata
}

/** Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. */
/** Directory type: 'user', 'index', or 'ephemeral'. */
fun type(type: Type?) = type(JsonField.ofNullable(type))

/** Alias for calling [Builder.type] with `type.orElse(null)`. */
Expand Down Expand Up @@ -646,7 +646,7 @@ private constructor(
override fun toString() = "SystemMetadata{additionalProperties=$additionalProperties}"
}

/** Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. */
/** Directory type: 'user', 'index', or 'ephemeral'. */
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

/**
Expand All @@ -665,8 +665,6 @@ private constructor(

@JvmField val INDEX = of("index")

@JvmField val SYSTEM_EPHEMERAL = of("system_ephemeral")

@JvmField val USER = of("user")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
Expand All @@ -676,7 +674,6 @@ private constructor(
enum class Known {
EPHEMERAL,
INDEX,
SYSTEM_EPHEMERAL,
USER,
}

Expand All @@ -692,7 +689,6 @@ private constructor(
enum class Value {
EPHEMERAL,
INDEX,
SYSTEM_EPHEMERAL,
USER,
/** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
Expand All @@ -709,7 +705,6 @@ private constructor(
when (this) {
EPHEMERAL -> Value.EPHEMERAL
INDEX -> Value.INDEX
SYSTEM_EPHEMERAL -> Value.SYSTEM_EPHEMERAL
USER -> Value.USER
else -> Value._UNKNOWN
}
Expand All @@ -727,7 +722,6 @@ private constructor(
when (this) {
EPHEMERAL -> Known.EPHEMERAL
INDEX -> Known.INDEX
SYSTEM_EPHEMERAL -> Known.SYSTEM_EPHEMERAL
USER -> Known.USER
else -> throw LlamaCloudInvalidDataException("Unknown Type: $value")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private constructor(
fun systemMetadata(): Optional<SystemMetadata> = systemMetadata.getOptional("system_metadata")

/**
* Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'.
* Directory type: 'user', 'index', or 'ephemeral'.
*
* @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -405,7 +405,7 @@ private constructor(
this.systemMetadata = systemMetadata
}

/** Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. */
/** Directory type: 'user', 'index', or 'ephemeral'. */
fun type(type: Type?) = type(JsonField.ofNullable(type))

/** Alias for calling [Builder.type] with `type.orElse(null)`. */
Expand Down Expand Up @@ -646,7 +646,7 @@ private constructor(
override fun toString() = "SystemMetadata{additionalProperties=$additionalProperties}"
}

/** Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. */
/** Directory type: 'user', 'index', or 'ephemeral'. */
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

/**
Expand All @@ -665,8 +665,6 @@ private constructor(

@JvmField val INDEX = of("index")

@JvmField val SYSTEM_EPHEMERAL = of("system_ephemeral")

@JvmField val USER = of("user")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
Expand All @@ -676,7 +674,6 @@ private constructor(
enum class Known {
EPHEMERAL,
INDEX,
SYSTEM_EPHEMERAL,
USER,
}

Expand All @@ -692,7 +689,6 @@ private constructor(
enum class Value {
EPHEMERAL,
INDEX,
SYSTEM_EPHEMERAL,
USER,
/** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
Expand All @@ -709,7 +705,6 @@ private constructor(
when (this) {
EPHEMERAL -> Value.EPHEMERAL
INDEX -> Value.INDEX
SYSTEM_EPHEMERAL -> Value.SYSTEM_EPHEMERAL
USER -> Value.USER
else -> Value._UNKNOWN
}
Expand All @@ -727,7 +722,6 @@ private constructor(
when (this) {
EPHEMERAL -> Known.EPHEMERAL
INDEX -> Known.INDEX
SYSTEM_EPHEMERAL -> Known.SYSTEM_EPHEMERAL
USER -> Known.USER
else -> throw LlamaCloudInvalidDataException("Unknown Type: $value")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private constructor(
fun systemMetadata(): Optional<SystemMetadata> = systemMetadata.getOptional("system_metadata")

/**
* Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'.
* Directory type: 'user', 'index', or 'ephemeral'.
*
* @throws LlamaCloudInvalidDataException if the JSON field has an unexpected type (e.g. if the
* server responded with an unexpected value).
Expand Down Expand Up @@ -405,7 +405,7 @@ private constructor(
this.systemMetadata = systemMetadata
}

/** Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. */
/** Directory type: 'user', 'index', or 'ephemeral'. */
fun type(type: Type?) = type(JsonField.ofNullable(type))

/** Alias for calling [Builder.type] with `type.orElse(null)`. */
Expand Down Expand Up @@ -646,7 +646,7 @@ private constructor(
override fun toString() = "SystemMetadata{additionalProperties=$additionalProperties}"
}

/** Directory type: 'user', 'index', 'ephemeral', or 'system_ephemeral'. */
/** Directory type: 'user', 'index', or 'ephemeral'. */
class Type @JsonCreator private constructor(private val value: JsonField<String>) : Enum {

/**
Expand All @@ -665,8 +665,6 @@ private constructor(

@JvmField val INDEX = of("index")

@JvmField val SYSTEM_EPHEMERAL = of("system_ephemeral")

@JvmField val USER = of("user")

@JvmStatic fun of(value: String) = Type(JsonField.of(value))
Expand All @@ -676,7 +674,6 @@ private constructor(
enum class Known {
EPHEMERAL,
INDEX,
SYSTEM_EPHEMERAL,
USER,
}

Expand All @@ -692,7 +689,6 @@ private constructor(
enum class Value {
EPHEMERAL,
INDEX,
SYSTEM_EPHEMERAL,
USER,
/** An enum member indicating that [Type] was instantiated with an unknown value. */
_UNKNOWN,
Expand All @@ -709,7 +705,6 @@ private constructor(
when (this) {
EPHEMERAL -> Value.EPHEMERAL
INDEX -> Value.INDEX
SYSTEM_EPHEMERAL -> Value.SYSTEM_EPHEMERAL
USER -> Value.USER
else -> Value._UNKNOWN
}
Expand All @@ -727,7 +722,6 @@ private constructor(
when (this) {
EPHEMERAL -> Known.EPHEMERAL
INDEX -> Known.INDEX
SYSTEM_EPHEMERAL -> Known.SYSTEM_EPHEMERAL
USER -> Known.USER
else -> throw LlamaCloudInvalidDataException("Unknown Type: $value")
}
Expand Down
Loading
Loading