diff --git a/README.md b/README.md index 12acf30..c5a997c 100755 --- a/README.md +++ b/README.md @@ -72,13 +72,13 @@ To create a new project, first use the `ProjectCreateParams` builder to specify then pass that to the `create` method of the `project` service. ```java -import com.braintrustdata.api.models.Project; import com.braintrustdata.api.models.ProjectCreateParams; +import com.braintrustdata.api.models.ProjectModel; ProjectCreateParams params = ProjectCreateParams.builder() .name("foobar") .build(); -Project project = client.project().create(params); +ProjectModel projectModel = client.project().create(params); ``` ### Example: listing resources @@ -88,10 +88,10 @@ You can retrieve the first page by: ```java import com.braintrustdata.api.models.Page; -import com.braintrustdata.api.models.Project; +import com.braintrustdata.api.models.ProjectModel; ProjectListPage page = client.project().list(); -for (Project project : page.objects()) { +for (ProjectModel project : page.objects()) { System.out.println(project); } ``` @@ -127,7 +127,7 @@ ProjectCreateParams params = ProjectCreateParams.builder() When receiving a response, the Braintrust Java SDK will deserialize it into instances of the typed model classes. In rare cases, the API may return a response property that doesn't match the expected Java type. If you directly access the mistaken property, the SDK will throw an unchecked `BraintrustInvalidDataException` at runtime. If you would prefer to check in advance that that response is completely well-typed, call `.validate()` on the returned model. ```java -Project project = client.project().create().validate(); +ProjectModel projectModel = client.project().create().validate(); ``` ### Response properties as JSON @@ -177,7 +177,7 @@ which automatically handles fetching more pages for you: ```java // As an Iterable: ProjectListPage page = client.project().list(params); -for (Project project : page.autoPager()) { +for (ProjectModel project : page.autoPager()) { System.out.println(project); }; @@ -205,7 +205,7 @@ A page of results has a `data()` method to fetch the list of objects, as well as ```java ProjectListPage page = client.project().list(params); while (page != null) { - for (Project project : page.objects()) { + for (ProjectModel project : page.objects()) { System.out.println(project); } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPage.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPage.kt index 99ee938..fe3b5cb 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPage.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPage.kt @@ -27,7 +27,7 @@ private constructor( fun response(): Response = response - fun objects(): List = response().objects() + fun objects(): List = response().objects() override fun equals(other: Any?): Boolean { if (this === other) { @@ -98,16 +98,16 @@ private constructor( @NoAutoDetect class Response constructor( - private val objects: JsonField>, + private val objects: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - fun objects(): List = objects.getNullable("objects") ?: listOf() + fun objects(): List = objects.getNullable("objects") ?: listOf() @JsonProperty("objects") - fun _objects(): Optional>> = Optional.ofNullable(objects) + fun _objects(): Optional>> = Optional.ofNullable(objects) @JsonAnyGetter @ExcludeMissing @@ -146,7 +146,7 @@ private constructor( class Builder { - private var objects: JsonField> = JsonMissing.of() + private var objects: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -155,10 +155,10 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun objects(objects: List) = objects(JsonField.of(objects)) + fun objects(objects: List) = objects(JsonField.of(objects)) @JsonProperty("objects") - fun objects(objects: JsonField>) = apply { this.objects = objects } + fun objects(objects: JsonField>) = apply { this.objects = objects } @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { @@ -172,9 +172,9 @@ private constructor( class AutoPager constructor( private val firstPage: ProjectListPage, - ) : Iterable { + ) : Iterable { - override fun iterator(): Iterator = iterator { + override fun iterator(): Iterator = iterator { var page = firstPage var index = 0 while (true) { @@ -186,7 +186,7 @@ private constructor( } } - fun stream(): Stream { + fun stream(): Stream { return StreamSupport.stream(spliterator(), false) } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPageAsync.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPageAsync.kt index 4892f56..896cdd0 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPageAsync.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectListPageAsync.kt @@ -28,7 +28,7 @@ private constructor( fun response(): Response = response - fun objects(): List = response().objects() + fun objects(): List = response().objects() override fun equals(other: Any?): Boolean { if (this === other) { @@ -101,16 +101,16 @@ private constructor( @NoAutoDetect class Response constructor( - private val objects: JsonField>, + private val objects: JsonField>, private val additionalProperties: Map, ) { private var validated: Boolean = false - fun objects(): List = objects.getNullable("objects") ?: listOf() + fun objects(): List = objects.getNullable("objects") ?: listOf() @JsonProperty("objects") - fun _objects(): Optional>> = Optional.ofNullable(objects) + fun _objects(): Optional>> = Optional.ofNullable(objects) @JsonAnyGetter @ExcludeMissing @@ -149,7 +149,7 @@ private constructor( class Builder { - private var objects: JsonField> = JsonMissing.of() + private var objects: JsonField> = JsonMissing.of() private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic @@ -158,10 +158,10 @@ private constructor( this.additionalProperties.putAll(page.additionalProperties) } - fun objects(objects: List) = objects(JsonField.of(objects)) + fun objects(objects: List) = objects(JsonField.of(objects)) @JsonProperty("objects") - fun objects(objects: JsonField>) = apply { this.objects = objects } + fun objects(objects: JsonField>) = apply { this.objects = objects } @JsonAnySetter fun putAdditionalProperty(key: String, value: JsonValue) = apply { @@ -177,9 +177,9 @@ private constructor( private val firstPage: ProjectListPageAsync, ) { - fun forEach(action: Predicate, executor: Executor): CompletableFuture { + fun forEach(action: Predicate, executor: Executor): CompletableFuture { fun CompletableFuture>.forEach( - action: (Project) -> Boolean, + action: (ProjectModel) -> Boolean, executor: Executor ): CompletableFuture = thenComposeAsync( @@ -195,8 +195,8 @@ private constructor( .forEach(action::test, executor) } - fun toList(executor: Executor): CompletableFuture> { - val values = mutableListOf() + fun toList(executor: Executor): CompletableFuture> { + val values = mutableListOf() return forEach(values::add, executor).thenApply { values } } } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectModel.kt old mode 100755 new mode 100644 similarity index 92% rename from braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt rename to braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectModel.kt index cb54d37..4e1d580 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/Project.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/models/ProjectModel.kt @@ -16,9 +16,9 @@ import java.time.OffsetDateTime import java.util.Objects import java.util.Optional -@JsonDeserialize(builder = Project.Builder::class) +@JsonDeserialize(builder = ProjectModel.Builder::class) @NoAutoDetect -class Project +class ProjectModel private constructor( private val id: JsonField, private val orgId: JsonField, @@ -79,7 +79,7 @@ private constructor( @ExcludeMissing fun _additionalProperties(): Map = additionalProperties - fun validate(): Project = apply { + fun validate(): ProjectModel = apply { if (!validated) { id() orgId() @@ -99,7 +99,7 @@ private constructor( return true } - return other is Project && + return other is ProjectModel && this.id == other.id && this.orgId == other.orgId && this.name == other.name && @@ -128,7 +128,7 @@ private constructor( } override fun toString() = - "Project{id=$id, orgId=$orgId, name=$name, created=$created, deletedAt=$deletedAt, userId=$userId, settings=$settings, additionalProperties=$additionalProperties}" + "ProjectModel{id=$id, orgId=$orgId, name=$name, created=$created, deletedAt=$deletedAt, userId=$userId, settings=$settings, additionalProperties=$additionalProperties}" companion object { @@ -147,15 +147,15 @@ private constructor( private var additionalProperties: MutableMap = mutableMapOf() @JvmSynthetic - internal fun from(project: Project) = apply { - this.id = project.id - this.orgId = project.orgId - this.name = project.name - this.created = project.created - this.deletedAt = project.deletedAt - this.userId = project.userId - this.settings = project.settings - additionalProperties(project.additionalProperties) + internal fun from(projectModel: ProjectModel) = apply { + this.id = projectModel.id + this.orgId = projectModel.orgId + this.name = projectModel.name + this.created = projectModel.created + this.deletedAt = projectModel.deletedAt + this.userId = projectModel.userId + this.settings = projectModel.settings + additionalProperties(projectModel.additionalProperties) } /** Unique identifier for the project */ @@ -224,8 +224,8 @@ private constructor( this.additionalProperties.putAll(additionalProperties) } - fun build(): Project = - Project( + fun build(): ProjectModel = + ProjectModel( id, orgId, name, diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsync.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsync.kt index b954e38..f1ed1db 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsync.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsync.kt @@ -5,11 +5,11 @@ package com.braintrustdata.api.services.async import com.braintrustdata.api.core.RequestOptions -import com.braintrustdata.api.models.Project import com.braintrustdata.api.models.ProjectCreateParams import com.braintrustdata.api.models.ProjectDeleteParams import com.braintrustdata.api.models.ProjectListPageAsync import com.braintrustdata.api.models.ProjectListParams +import com.braintrustdata.api.models.ProjectModel import com.braintrustdata.api.models.ProjectRetrieveParams import com.braintrustdata.api.models.ProjectUpdateParams import com.braintrustdata.api.services.async.project.LogServiceAsync @@ -27,14 +27,14 @@ interface ProjectServiceAsync { fun create( params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture /** Get a project object by its id */ @JvmOverloads fun retrieve( params: ProjectRetrieveParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture /** * Partially update a project object. Specify the fields to update in the payload. Any @@ -45,7 +45,7 @@ interface ProjectServiceAsync { fun update( params: ProjectUpdateParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture /** * List out all projects. The projects are sorted by creation date, with the most @@ -62,5 +62,5 @@ interface ProjectServiceAsync { fun delete( params: ProjectDeleteParams, requestOptions: RequestOptions = RequestOptions.none() - ): CompletableFuture + ): CompletableFuture } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsyncImpl.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsyncImpl.kt index 5945984..e85462e 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsyncImpl.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/async/ProjectServiceAsyncImpl.kt @@ -8,11 +8,11 @@ import com.braintrustdata.api.core.http.HttpMethod import com.braintrustdata.api.core.http.HttpRequest import com.braintrustdata.api.core.http.HttpResponse.Handler import com.braintrustdata.api.errors.BraintrustError -import com.braintrustdata.api.models.Project import com.braintrustdata.api.models.ProjectCreateParams import com.braintrustdata.api.models.ProjectDeleteParams import com.braintrustdata.api.models.ProjectListPageAsync import com.braintrustdata.api.models.ProjectListParams +import com.braintrustdata.api.models.ProjectModel import com.braintrustdata.api.models.ProjectRetrieveParams import com.braintrustdata.api.models.ProjectUpdateParams import com.braintrustdata.api.services.async.project.LogServiceAsync @@ -34,8 +34,8 @@ constructor( override fun logs(): LogServiceAsync = logs - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** * Create a new project. If there is an existing project with the same name as the one specified @@ -44,7 +44,7 @@ constructor( override fun create( params: ProjectCreateParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -67,14 +67,14 @@ constructor( } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Get a project object by its id */ override fun retrieve( params: ProjectRetrieveParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -96,8 +96,8 @@ constructor( } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** * Partially update a project object. Specify the fields to update in the payload. Any @@ -107,7 +107,7 @@ constructor( override fun update( params: ProjectUpdateParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.PATCH) @@ -164,14 +164,14 @@ constructor( } } - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val deleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Delete a project object by its id */ override fun delete( params: ProjectDeleteParams, requestOptions: RequestOptions - ): CompletableFuture { + ): CompletableFuture { val request = HttpRequest.builder() .method(HttpMethod.DELETE) diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectService.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectService.kt index ae7726e..a6fe064 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectService.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectService.kt @@ -5,11 +5,11 @@ package com.braintrustdata.api.services.blocking import com.braintrustdata.api.core.RequestOptions -import com.braintrustdata.api.models.Project import com.braintrustdata.api.models.ProjectCreateParams import com.braintrustdata.api.models.ProjectDeleteParams import com.braintrustdata.api.models.ProjectListPage import com.braintrustdata.api.models.ProjectListParams +import com.braintrustdata.api.models.ProjectModel import com.braintrustdata.api.models.ProjectRetrieveParams import com.braintrustdata.api.models.ProjectUpdateParams import com.braintrustdata.api.services.blocking.project.LogService @@ -26,14 +26,14 @@ interface ProjectService { fun create( params: ProjectCreateParams, requestOptions: RequestOptions = RequestOptions.none() - ): Project + ): ProjectModel /** Get a project object by its id */ @JvmOverloads fun retrieve( params: ProjectRetrieveParams, requestOptions: RequestOptions = RequestOptions.none() - ): Project + ): ProjectModel /** * Partially update a project object. Specify the fields to update in the payload. Any @@ -44,7 +44,7 @@ interface ProjectService { fun update( params: ProjectUpdateParams, requestOptions: RequestOptions = RequestOptions.none() - ): Project + ): ProjectModel /** * List out all projects. The projects are sorted by creation date, with the most @@ -61,5 +61,5 @@ interface ProjectService { fun delete( params: ProjectDeleteParams, requestOptions: RequestOptions = RequestOptions.none() - ): Project + ): ProjectModel } diff --git a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceImpl.kt b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceImpl.kt index 468a451..a0b65df 100755 --- a/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceImpl.kt +++ b/braintrust-java-core/src/main/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceImpl.kt @@ -8,11 +8,11 @@ import com.braintrustdata.api.core.http.HttpMethod import com.braintrustdata.api.core.http.HttpRequest import com.braintrustdata.api.core.http.HttpResponse.Handler import com.braintrustdata.api.errors.BraintrustError -import com.braintrustdata.api.models.Project import com.braintrustdata.api.models.ProjectCreateParams import com.braintrustdata.api.models.ProjectDeleteParams import com.braintrustdata.api.models.ProjectListPage import com.braintrustdata.api.models.ProjectListParams +import com.braintrustdata.api.models.ProjectModel import com.braintrustdata.api.models.ProjectRetrieveParams import com.braintrustdata.api.models.ProjectUpdateParams import com.braintrustdata.api.services.blocking.project.LogService @@ -33,14 +33,14 @@ constructor( override fun logs(): LogService = logs - private val createHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val createHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** * Create a new project. If there is an existing project with the same name as the one specified * in the request, will return the existing project unmodified */ - override fun create(params: ProjectCreateParams, requestOptions: RequestOptions): Project { + override fun create(params: ProjectCreateParams, requestOptions: RequestOptions): ProjectModel { val request = HttpRequest.builder() .method(HttpMethod.POST) @@ -62,11 +62,14 @@ constructor( } } - private val retrieveHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val retrieveHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Get a project object by its id */ - override fun retrieve(params: ProjectRetrieveParams, requestOptions: RequestOptions): Project { + override fun retrieve( + params: ProjectRetrieveParams, + requestOptions: RequestOptions + ): ProjectModel { val request = HttpRequest.builder() .method(HttpMethod.GET) @@ -87,15 +90,15 @@ constructor( } } - private val updateHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val updateHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** * Partially update a project object. Specify the fields to update in the payload. Any * object-type fields will be deep-merged with existing content. Currently we do not support * removing fields or setting them to null. */ - override fun update(params: ProjectUpdateParams, requestOptions: RequestOptions): Project { + override fun update(params: ProjectUpdateParams, requestOptions: RequestOptions): ProjectModel { val request = HttpRequest.builder() .method(HttpMethod.PATCH) @@ -147,11 +150,11 @@ constructor( } } - private val deleteHandler: Handler = - jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) + private val deleteHandler: Handler = + jsonHandler(clientOptions.jsonMapper).withErrorHandler(errorHandler) /** Delete a project object by its id */ - override fun delete(params: ProjectDeleteParams, requestOptions: RequestOptions): Project { + override fun delete(params: ProjectDeleteParams, requestOptions: RequestOptions): ProjectModel { val request = HttpRequest.builder() .method(HttpMethod.DELETE) diff --git a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/models/ProjectModelTest.kt b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/models/ProjectModelTest.kt new file mode 100644 index 0000000..2f8e5f4 --- /dev/null +++ b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/models/ProjectModelTest.kt @@ -0,0 +1,35 @@ +// File generated from our OpenAPI spec by Stainless. + +package com.braintrustdata.api.models + +import java.time.OffsetDateTime +import org.assertj.core.api.Assertions.assertThat +import org.junit.jupiter.api.Test + +class ProjectModelTest { + + @Test + fun createProjectModel() { + val projectModel = + ProjectModel.builder() + .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .name("name") + .orgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .deletedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + .settings(ProjectModel.Settings.builder().comparisonKey("comparison_key").build()) + .userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + .build() + assertThat(projectModel).isNotNull + assertThat(projectModel.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(projectModel.name()).isEqualTo("name") + assertThat(projectModel.orgId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + assertThat(projectModel.created()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(projectModel.deletedAt()) + .contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) + assertThat(projectModel.settings()) + .contains(ProjectModel.Settings.builder().comparisonKey("comparison_key").build()) + assertThat(projectModel.userId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") + } +} diff --git a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/models/ProjectTest.kt b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/models/ProjectTest.kt deleted file mode 100755 index 08b9f5f..0000000 --- a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/models/ProjectTest.kt +++ /dev/null @@ -1,33 +0,0 @@ -// File generated from our OpenAPI spec by Stainless. - -package com.braintrustdata.api.models - -import java.time.OffsetDateTime -import org.assertj.core.api.Assertions.assertThat -import org.junit.jupiter.api.Test - -class ProjectTest { - - @Test - fun createProject() { - val project = - Project.builder() - .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .name("name") - .orgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .deletedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .settings(Project.Settings.builder().comparisonKey("comparison_key").build()) - .userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - .build() - assertThat(project).isNotNull - assertThat(project.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(project.name()).isEqualTo("name") - assertThat(project.orgId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - assertThat(project.created()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(project.deletedAt()).contains(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - assertThat(project.settings()) - .contains(Project.Settings.builder().comparisonKey("comparison_key").build()) - assertThat(project.userId()).contains("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") - } -} diff --git a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ErrorHandlingTest.kt b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ErrorHandlingTest.kt index 5f1e69c..3eb8525 100755 --- a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ErrorHandlingTest.kt +++ b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ErrorHandlingTest.kt @@ -60,13 +60,13 @@ class ErrorHandlingTest { val params = ProjectCreateParams.builder().name("name").orgName("org_name").build() val expected = - Project.builder() + ProjectModel.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .orgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .deletedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .settings(Project.Settings.builder().comparisonKey("comparison_key").build()) + .settings(ProjectModel.Settings.builder().comparisonKey("comparison_key").build()) .userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() diff --git a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ServiceParamsTest.kt b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ServiceParamsTest.kt index 2d94aab..95f7393 100755 --- a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ServiceParamsTest.kt +++ b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/ServiceParamsTest.kt @@ -65,13 +65,13 @@ class ServiceParamsTest { .build() val apiResponse = - Project.builder() + ProjectModel.builder() .id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .name("name") .orgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) .deletedAt(OffsetDateTime.parse("2019-12-27T18:11:19.117Z")) - .settings(Project.Settings.builder().comparisonKey("comparison_key").build()) + .settings(ProjectModel.Settings.builder().comparisonKey("comparison_key").build()) .userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() diff --git a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceTest.kt b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceTest.kt index 5f8606e..2b171bc 100755 --- a/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceTest.kt +++ b/braintrust-java-core/src/test/kotlin/com/braintrustdata/api/services/blocking/ProjectServiceTest.kt @@ -20,12 +20,12 @@ class ProjectServiceTest { .apiKey("My API Key") .build() val projectService = client.project() - val project = + val projectModel = projectService.create( ProjectCreateParams.builder().name("name").orgName("org_name").build() ) - println(project) - project.validate() + println(projectModel) + projectModel.validate() } @Test @@ -36,14 +36,14 @@ class ProjectServiceTest { .apiKey("My API Key") .build() val projectService = client.project() - val project = + val projectModel = projectService.retrieve( ProjectRetrieveParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - println(project) - project.validate() + println(projectModel) + projectModel.validate() } @Test @@ -54,7 +54,7 @@ class ProjectServiceTest { .apiKey("My API Key") .build() val projectService = client.project() - val project = + val projectModel = projectService.update( ProjectUpdateParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") @@ -66,8 +66,8 @@ class ProjectServiceTest { ) .build() ) - println(project) - project.validate() + println(projectModel) + projectModel.validate() } @Test @@ -91,13 +91,13 @@ class ProjectServiceTest { .apiKey("My API Key") .build() val projectService = client.project() - val project = + val projectModel = projectService.delete( ProjectDeleteParams.builder() .projectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e") .build() ) - println(project) - project.validate() + println(projectModel) + projectModel.validate() } }