Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

docs: add build method comments #86

Merged
merged 1 commit into from
Mar 17, 2025
Merged
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
@@ -151,6 +151,11 @@ class OpenlayerOkHttpClient private constructor() {

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

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

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

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

fun fromEnv() = apply { System.getenv("OPENLAYER_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)

Original file line number Diff line number Diff line change
@@ -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)
}

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

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

Original file line number Diff line number Diff line change
@@ -166,6 +166,18 @@ private constructor(
additionalQueryParams.removeAll(keys)
}

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

/**
* Returns an immutable instance of [CommitRetrieveResponse].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .id()
* .commit()
* .dateArchived()
* .dateCreated()
* .failingGoalCount()
* .mlModelId()
* .passingGoalCount()
* .projectId()
* .status()
* .statusMessage()
* .storageUri()
* .totalGoalCount()
* .trainingDatasetId()
* .validationDatasetId()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): CommitRetrieveResponse =
CommitRetrieveResponse(
checkRequired("id", id),
@@ -1293,6 +1318,25 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Commit].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .id()
* .authorId()
* .fileSize()
* .message()
* .mlModelId()
* .storageUri()
* .trainingDatasetId()
* .validationDatasetId()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Commit =
Commit(
checkRequired("id", id),
@@ -1551,6 +1595,18 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

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

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

/**
* Returns an immutable instance of [TestResultListResponse].
*
* 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(): TestResultListResponse =
TestResultListResponse(
checkRequired("items", items).map { it.toImmutable() },
@@ -647,6 +659,26 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Item].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .id()
* .dateCreated()
* .dateDataEnds()
* .dateDataStarts()
* .dateUpdated()
* .inferencePipelineId()
* .projectVersionId()
* .status()
* .statusMessage()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Item =
Item(
checkRequired("id", id),
@@ -1725,6 +1757,31 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Goal].
*
* Further updates to this [Builder] will not mutate the returned instance.
*
* The following fields are required:
* ```java
* .id()
* .commentCount()
* .creatorId()
* .dateArchived()
* .dateCreated()
* .dateUpdated()
* .description()
* .name()
* .number()
* .originProjectVersionId()
* .subtype()
* .suggested()
* .thresholds()
* .type()
* ```
*
* @throws IllegalStateException if any required field is unset.
*/
fun build(): Goal =
Goal(
checkRequired("id", id),
@@ -2025,6 +2082,11 @@ private constructor(
keys.forEach(::removeAdditionalProperty)
}

/**
* Returns an immutable instance of [Threshold].
*
* Further updates to this [Builder] will not mutate the returned instance.
*/
fun build(): Threshold =
Threshold(
insightName,
Original file line number Diff line number Diff line change
@@ -202,6 +202,18 @@ private constructor(
keys.forEach(::removeAdditionalBodyProperty)
}

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

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