Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Oct 1, 2024
1 parent b8d3c2c commit 4e5bd56
Show file tree
Hide file tree
Showing 8 changed files with 2,122 additions and 7,056 deletions.
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 59
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/manugoyal%2Fbraintrust-sdk-kotlin-770b93fa08a7313e047f99e36199af1ec4939f724565d3eb991fe455473a82d5.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/manugoyal%2Fbraintrust-sdk-kotlin-8c69b494e9958f062448f0e4bd2a61abccb4a223502869729fea0565f91ffaca.yml
3,164 changes: 593 additions & 2,571 deletions braintrust-kotlin-core/src/main/kotlin/com/braintrust/api/models/Acl.kt

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,83 @@
package com.braintrust.api.models

import com.braintrust.api.models.*
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

class AclCreateParamsTest {

@Test
fun createAclCreateParams() {
AclCreateParams.builder()
.forCreateUserPermissionAcl(
AclCreateParams.CreateUserPermissionAcl.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclCreateParams.CreateUserPermissionAcl.ObjectType.ORGANIZATION)
.permission(AclCreateParams.CreateUserPermissionAcl.Permission.CREATE)
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.restrictObjectType(
AclCreateParams.CreateUserPermissionAcl.RestrictObjectType.ofUnionMember0(
AclCreateParams.CreateUserPermissionAcl.RestrictObjectType.UnionMember0
.ORGANIZATION
)
)
.build()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclCreateParams.ObjectType.ORGANIZATION)
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(
AclCreateParams.Permission.ofUnionMember0(
AclCreateParams.Permission.UnionMember0.CREATE
)
)
.restrictObjectType(
AclCreateParams.RestrictObjectType.ofUnionMember0(
AclCreateParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
}

@Test
fun getBody() {
val params =
AclCreateParams.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclCreateParams.ObjectType.ORGANIZATION)
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(
AclCreateParams.Permission.ofUnionMember0(
AclCreateParams.Permission.UnionMember0.CREATE
)
)
.restrictObjectType(
AclCreateParams.RestrictObjectType.ofUnionMember0(
AclCreateParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
val body = params.getBody()
assertThat(body).isNotNull
assertThat(body.objectId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.objectType()).isEqualTo(AclCreateParams.ObjectType.ORGANIZATION)
assertThat(body.groupId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.permission())
.isEqualTo(
AclCreateParams.Permission.ofUnionMember0(
AclCreateParams.Permission.UnionMember0.CREATE
)
)
assertThat(body.restrictObjectType())
.isEqualTo(
AclCreateParams.RestrictObjectType.ofUnionMember0(
AclCreateParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
assertThat(body.roleId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.userId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}

@Test
fun getBodyWithoutOptionalFields() {
val params =
AclCreateParams.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclCreateParams.ObjectType.ORGANIZATION)
.build()
val body = params.getBody()
assertThat(body).isNotNull
assertThat(body.objectId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.objectType()).isEqualTo(AclCreateParams.ObjectType.ORGANIZATION)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,83 @@
package com.braintrust.api.models

import com.braintrust.api.models.*
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

class AclReplaceParamsTest {

@Test
fun createAclReplaceParams() {
AclReplaceParams.builder()
.forCreateUserPermissionAcl(
AclReplaceParams.CreateUserPermissionAcl.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclReplaceParams.CreateUserPermissionAcl.ObjectType.ORGANIZATION)
.permission(AclReplaceParams.CreateUserPermissionAcl.Permission.CREATE)
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.restrictObjectType(
AclReplaceParams.CreateUserPermissionAcl.RestrictObjectType.ofUnionMember0(
AclReplaceParams.CreateUserPermissionAcl.RestrictObjectType.UnionMember0
.ORGANIZATION
)
)
.build()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclReplaceParams.ObjectType.ORGANIZATION)
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(
AclReplaceParams.Permission.ofUnionMember0(
AclReplaceParams.Permission.UnionMember0.CREATE
)
)
.restrictObjectType(
AclReplaceParams.RestrictObjectType.ofUnionMember0(
AclReplaceParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
}

@Test
fun getBody() {
val params =
AclReplaceParams.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclReplaceParams.ObjectType.ORGANIZATION)
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(
AclReplaceParams.Permission.ofUnionMember0(
AclReplaceParams.Permission.UnionMember0.CREATE
)
)
.restrictObjectType(
AclReplaceParams.RestrictObjectType.ofUnionMember0(
AclReplaceParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
val body = params.getBody()
assertThat(body).isNotNull
assertThat(body.objectId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.objectType()).isEqualTo(AclReplaceParams.ObjectType.ORGANIZATION)
assertThat(body.groupId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.permission())
.isEqualTo(
AclReplaceParams.Permission.ofUnionMember0(
AclReplaceParams.Permission.UnionMember0.CREATE
)
)
assertThat(body.restrictObjectType())
.isEqualTo(
AclReplaceParams.RestrictObjectType.ofUnionMember0(
AclReplaceParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
assertThat(body.roleId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.userId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}

@Test
fun getBodyWithoutOptionalFields() {
val params =
AclReplaceParams.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclReplaceParams.ObjectType.ORGANIZATION)
.build()
val body = params.getBody()
assertThat(body).isNotNull
assertThat(body.objectId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(body.objectType()).isEqualTo(AclReplaceParams.ObjectType.ORGANIZATION)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// File generated from our OpenAPI spec by Stainless.

package com.braintrust.api.models

import java.time.OffsetDateTime
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.Test

class AclTest {

@Test
fun createAcl() {
val acl =
Acl.builder()
.id("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
._objectOrgId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(Acl.ObjectType.ORGANIZATION)
.created(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(Acl.Permission.ofUnionMember0(Acl.Permission.UnionMember0.CREATE))
.restrictObjectType(
Acl.RestrictObjectType.ofUnionMember0(
Acl.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
assertThat(acl).isNotNull
assertThat(acl.id()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(acl._objectOrgId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(acl.objectId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(acl.objectType()).isEqualTo(Acl.ObjectType.ORGANIZATION)
assertThat(acl.created()).isEqualTo(OffsetDateTime.parse("2019-12-27T18:11:19.117Z"))
assertThat(acl.groupId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(acl.permission())
.isEqualTo(Acl.Permission.ofUnionMember0(Acl.Permission.UnionMember0.CREATE))
assertThat(acl.restrictObjectType())
.isEqualTo(
Acl.RestrictObjectType.ofUnionMember0(
Acl.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
assertThat(acl.roleId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
assertThat(acl.userId()).isEqualTo("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,27 +23,25 @@ class AclServiceTest {
val acl =
aclService.create(
AclCreateParams.builder()
.forCreateUserPermissionAcl(
AclCreateParams.CreateUserPermissionAcl.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(
AclCreateParams.CreateUserPermissionAcl.ObjectType.ORGANIZATION
)
.permission(AclCreateParams.CreateUserPermissionAcl.Permission.CREATE)
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.restrictObjectType(
AclCreateParams.CreateUserPermissionAcl.RestrictObjectType
.ofUnionMember0(
AclCreateParams.CreateUserPermissionAcl.RestrictObjectType
.UnionMember0
.ORGANIZATION
)
)
.build()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclCreateParams.ObjectType.ORGANIZATION)
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(
AclCreateParams.Permission.ofUnionMember0(
AclCreateParams.Permission.UnionMember0.CREATE
)
)
.restrictObjectType(
AclCreateParams.RestrictObjectType.ofUnionMember0(
AclCreateParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
println(acl)
acl.validate()
}

@Test
Expand All @@ -59,6 +57,7 @@ class AclServiceTest {
AclRetrieveParams.builder().aclId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build()
)
println(acl)
acl.validate()
}

@Test
Expand Down Expand Up @@ -93,6 +92,7 @@ class AclServiceTest {
AclDeleteParams.builder().aclId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e").build()
)
println(acl)
acl.validate()
}

@Test
Expand All @@ -106,26 +106,24 @@ class AclServiceTest {
val acl =
aclService.replace(
AclReplaceParams.builder()
.forCreateUserPermissionAcl(
AclReplaceParams.CreateUserPermissionAcl.builder()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(
AclReplaceParams.CreateUserPermissionAcl.ObjectType.ORGANIZATION
)
.permission(AclReplaceParams.CreateUserPermissionAcl.Permission.CREATE)
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.restrictObjectType(
AclReplaceParams.CreateUserPermissionAcl.RestrictObjectType
.ofUnionMember0(
AclReplaceParams.CreateUserPermissionAcl.RestrictObjectType
.UnionMember0
.ORGANIZATION
)
)
.build()
.objectId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.objectType(AclReplaceParams.ObjectType.ORGANIZATION)
.groupId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.permission(
AclReplaceParams.Permission.ofUnionMember0(
AclReplaceParams.Permission.UnionMember0.CREATE
)
)
.restrictObjectType(
AclReplaceParams.RestrictObjectType.ofUnionMember0(
AclReplaceParams.RestrictObjectType.UnionMember0.ORGANIZATION
)
)
.roleId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.userId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
.build()
)
println(acl)
acl.validate()
}
}

0 comments on commit 4e5bd56

Please sign in to comment.