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 @@ -151,6 +151,11 @@ class BraintrustOkHttpClient private constructor() {

fun fromEnv() = apply { clientOptions.fromEnv() }

/**
* Returns an immutable instance of [BraintrustClient].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): BraintrustClient =
BraintrustClientImpl(
clientOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ class BraintrustOkHttpClientAsync private constructor() {

fun fromEnv() = apply { clientOptions.fromEnv() }

/**
* Returns an immutable instance of [BraintrustClientAsync].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): BraintrustClientAsync =
BraintrustClientAsyncImpl(
clientOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ private constructor(

fun fromEnv() = apply { System.getenv("BRAINTRUST_API_KEY")?.let { apiKey(it) } }

/**
* Returns an immutable instance of [ClientOptions].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .httpClient()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): ClientOptions {
val httpClient = checkRequired("httpClient", httpClient)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ private constructor(
/** Alias for calling [Builder.request] with `request.orElse(null)`. */
fun request(request: Optional<Duration>) = request(request.getOrNull())

/**
* Returns an immutable instance of [Timeout].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Timeout = Timeout(connect, read, write, request)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [BraintrustError].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): BraintrustError = BraintrustError(additionalProperties.toImmutable())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,20 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [AISecret].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .id()
* .name()
* .orgId()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AISecret =
AISecret(
checkRequired("id", id),
Expand Down Expand Up @@ -428,6 +442,11 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Metadata].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Metadata = Metadata(additionalProperties.toImmutable())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,21 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Acl].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .id()
* ._objectOrgId()
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Acl =
Acl(
checkRequired("id", id),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,11 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Body].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Body =
Body(
(addAcls ?: JsonMissing.of()).map { it.toImmutable() },
Expand Down Expand Up @@ -520,6 +525,11 @@ private constructor(
additionalQueryParams.removeAll(keys)
}

/**
* Returns an immutable instance of [AclBatchUpdateParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): AclBatchUpdateParams =
AclBatchUpdateParams(
body.build(),
Expand Down Expand Up @@ -888,6 +898,19 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [AddAcl].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AddAcl =
AddAcl(
checkRequired("objectId", objectId),
Expand Down Expand Up @@ -1279,6 +1302,19 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [RemoveAcl].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): RemoveAcl =
RemoveAcl(
checkRequired("objectId", objectId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,19 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [AclBatchUpdateResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .addedAcls()
* .removedAcls()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AclBatchUpdateResponse =
AclBatchUpdateResponse(
checkRequired("addedAcls", addedAcls).map { it.toImmutable() },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,19 @@ private constructor(
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
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Body =
Body(
checkRequired("objectId", objectId),
Expand Down Expand Up @@ -804,6 +817,19 @@ private constructor(
additionalQueryParams.removeAll(keys)
}

/**
* Returns an immutable instance of [AclCreateParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AclCreateParams =
AclCreateParams(body.build(), additionalHeaders.build(), additionalQueryParams.build())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,18 @@ private constructor(
keys.forEach(::removeAdditionalBodyProperty)
}

/**
* Returns an immutable instance of [AclDeleteParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .aclId()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AclDeleteParams =
AclDeleteParams(
checkRequired("aclId", aclId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,19 @@ private constructor(
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
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Body =
Body(
checkRequired("objectId", objectId),
Expand Down Expand Up @@ -801,6 +814,19 @@ private constructor(
additionalQueryParams.removeAll(keys)
}

/**
* Returns an immutable instance of [AclFindAndDeleteParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AclFindAndDeleteParams =
AclFindAndDeleteParams(
body.build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ private constructor(
this.additionalProperties.put(key, value)
}

fun build() = Response(objects, additionalProperties.toImmutable())
/**
* Returns an immutable instance of [Response].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Response = Response(objects, additionalProperties.toImmutable())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ private constructor(
this.additionalProperties.put(key, value)
}

fun build() = Response(objects, additionalProperties.toImmutable())
/**
* Returns an immutable instance of [Response].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Response = Response(objects, additionalProperties.toImmutable())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,19 @@ private constructor(
additionalQueryParams.removeAll(keys)
}

/**
* Returns an immutable instance of [AclListParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .objectId()
* .objectType()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AclListParams =
AclListParams(
checkRequired("objectId", objectId),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,18 @@ private constructor(
additionalQueryParams.removeAll(keys)
}

/**
* Returns an immutable instance of [AclRetrieveParams].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .aclId()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): AclRetrieveParams =
AclRetrieveParams(
checkRequired("aclId", aclId),
Expand Down
Loading