Skip to content

Commit a4b898c

Browse files
feat(api): update via SDK Studio (#35)
1 parent 9b10b06 commit a4b898c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+762
-298
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -78,26 +78,26 @@ Read the documentation for more configuration options.
7878
### Example: creating a resource
7979

8080
To create a new project, first use the `ProjectCreateParams` builder to specify attributes,
81-
then pass that to the `create` method of the `project` service.
81+
then pass that to the `create` method of the `projects` service.
8282

8383
```java
8484
import com.braintrustdata.api.models.Project;
8585
import com.braintrustdata.api.models.ProjectCreateParams;
8686

8787
ProjectCreateParams params = ProjectCreateParams.builder().build();
88-
Project project = client.project().create(params);
88+
Project project = client.projects().create(params);
8989
```
9090

9191
### Example: listing resources
9292

93-
The Braintrust API provides a `list` method to get a paginated list of project.
93+
The Braintrust API provides a `list` method to get a paginated list of projects.
9494
You can retrieve the first page by:
9595

9696
```java
9797
import com.braintrustdata.api.models.Page;
9898
import com.braintrustdata.api.models.Project;
9999

100-
ProjectListPage page = client.project().list();
100+
ProjectListPage page = client.projects().list();
101101
for (Project project : page.objects()) {
102102
System.out.println(project);
103103
}
@@ -114,7 +114,7 @@ See [Pagination](#pagination) below for more information on transparently workin
114114
To make a request to the Braintrust API, you generally build an instance of the appropriate `Params` class.
115115

116116
In [Example: creating a resource](#example-creating-a-resource) above, we used the `ProjectCreateParams.builder()` to pass to
117-
the `create` method of the `project` service.
117+
the `create` method of the `projects` service.
118118

119119
Sometimes, the API may support other properties that are not yet supported in the Java SDK types. In that case,
120120
you can attach them using the `putAdditionalProperty` method.
@@ -133,7 +133,7 @@ ProjectCreateParams params = ProjectCreateParams.builder()
133133
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.
134134

135135
```java
136-
Project project = client.project().create().validate();
136+
Project project = client.projects().create().validate();
137137
```
138138

139139
### Response properties as JSON
@@ -182,13 +182,13 @@ which automatically handles fetching more pages for you:
182182

183183
```java
184184
// As an Iterable:
185-
ProjectListPage page = client.project().list(params);
185+
ProjectListPage page = client.projects().list(params);
186186
for (Project project : page.autoPager()) {
187187
System.out.println(project);
188188
};
189189

190190
// As a Stream:
191-
client.project().list(params).autoPager().stream()
191+
client.projects().list(params).autoPager().stream()
192192
.limit(50)
193193
.forEach(project -> System.out.println(project));
194194
```
@@ -197,7 +197,7 @@ client.project().list(params).autoPager().stream()
197197

198198
```java
199199
// Using forEach, which returns CompletableFuture<Void>:
200-
asyncClient.project().list(params).autoPager()
200+
asyncClient.projects().list(params).autoPager()
201201
.forEach(project -> System.out.println(project), executor);
202202
```
203203

@@ -209,7 +209,7 @@ A page of results has a `data()` method to fetch the list of objects, as well as
209209
`hasNextPage`, `getNextPage`, and `getNextPageParams` methods to help with pagination.
210210

211211
```java
212-
ProjectListPage page = client.project().list(params);
212+
ProjectListPage page = client.projects().list(params);
213213
while (page != null) {
214214
for (Project project : page.objects()) {
215215
System.out.println(project);

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClient.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@ interface BraintrustClient {
3232

3333
fun topLevel(): TopLevelService
3434

35-
fun project(): ProjectService
35+
fun projects(): ProjectService
3636

37-
fun experiment(): ExperimentService
37+
fun experiments(): ExperimentService
3838

39-
fun dataset(): DatasetService
39+
fun datasets(): DatasetService
4040

41-
fun prompt(): PromptService
41+
fun prompts(): PromptService
4242

43-
fun role(): RoleService
43+
fun roles(): RoleService
4444

45-
fun group(): GroupService
45+
fun groups(): GroupService
4646

47-
fun acl(): AclService
47+
fun acls(): AclService
4848

49-
fun user(): UserService
49+
fun users(): UserService
5050

51-
fun projectScore(): ProjectScoreService
51+
fun projectScores(): ProjectScoreService
5252

53-
fun projectTag(): ProjectTagService
53+
fun projectTags(): ProjectTagService
5454

55-
fun function(): FunctionService
55+
fun functions(): FunctionService
5656

57-
fun view(): ViewService
57+
fun views(): ViewService
5858

59-
fun organization(): OrganizationService
59+
fun organizations(): OrganizationService
6060

61-
fun apiKey(): ApiKeyService
61+
fun apiKeys(): ApiKeyService
6262
}

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsync.kt

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@ interface BraintrustClientAsync {
3232

3333
fun topLevel(): TopLevelServiceAsync
3434

35-
fun project(): ProjectServiceAsync
35+
fun projects(): ProjectServiceAsync
3636

37-
fun experiment(): ExperimentServiceAsync
37+
fun experiments(): ExperimentServiceAsync
3838

39-
fun dataset(): DatasetServiceAsync
39+
fun datasets(): DatasetServiceAsync
4040

41-
fun prompt(): PromptServiceAsync
41+
fun prompts(): PromptServiceAsync
4242

43-
fun role(): RoleServiceAsync
43+
fun roles(): RoleServiceAsync
4444

45-
fun group(): GroupServiceAsync
45+
fun groups(): GroupServiceAsync
4646

47-
fun acl(): AclServiceAsync
47+
fun acls(): AclServiceAsync
4848

49-
fun user(): UserServiceAsync
49+
fun users(): UserServiceAsync
5050

51-
fun projectScore(): ProjectScoreServiceAsync
51+
fun projectScores(): ProjectScoreServiceAsync
5252

53-
fun projectTag(): ProjectTagServiceAsync
53+
fun projectTags(): ProjectTagServiceAsync
5454

55-
fun function(): FunctionServiceAsync
55+
fun functions(): FunctionServiceAsync
5656

57-
fun view(): ViewServiceAsync
57+
fun views(): ViewServiceAsync
5858

59-
fun organization(): OrganizationServiceAsync
59+
fun organizations(): OrganizationServiceAsync
6060

61-
fun apiKey(): ApiKeyServiceAsync
61+
fun apiKeys(): ApiKeyServiceAsync
6262
}

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientAsyncImpl.kt

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,63 +32,63 @@ class BraintrustClientAsyncImpl constructor(private val clientOptions: ClientOpt
3232

3333
private val topLevel: TopLevelServiceAsync by lazy { TopLevelServiceAsyncImpl(clientOptions) }
3434

35-
private val project: ProjectServiceAsync by lazy { ProjectServiceAsyncImpl(clientOptions) }
35+
private val projects: ProjectServiceAsync by lazy { ProjectServiceAsyncImpl(clientOptions) }
3636

37-
private val experiment: ExperimentServiceAsync by lazy { ExperimentServiceAsyncImpl(clientOptions) }
37+
private val experiments: ExperimentServiceAsync by lazy { ExperimentServiceAsyncImpl(clientOptions) }
3838

39-
private val dataset: DatasetServiceAsync by lazy { DatasetServiceAsyncImpl(clientOptions) }
39+
private val datasets: DatasetServiceAsync by lazy { DatasetServiceAsyncImpl(clientOptions) }
4040

41-
private val prompt: PromptServiceAsync by lazy { PromptServiceAsyncImpl(clientOptions) }
41+
private val prompts: PromptServiceAsync by lazy { PromptServiceAsyncImpl(clientOptions) }
4242

43-
private val role: RoleServiceAsync by lazy { RoleServiceAsyncImpl(clientOptions) }
43+
private val roles: RoleServiceAsync by lazy { RoleServiceAsyncImpl(clientOptions) }
4444

45-
private val group: GroupServiceAsync by lazy { GroupServiceAsyncImpl(clientOptions) }
45+
private val groups: GroupServiceAsync by lazy { GroupServiceAsyncImpl(clientOptions) }
4646

47-
private val acl: AclServiceAsync by lazy { AclServiceAsyncImpl(clientOptions) }
47+
private val acls: AclServiceAsync by lazy { AclServiceAsyncImpl(clientOptions) }
4848

49-
private val user: UserServiceAsync by lazy { UserServiceAsyncImpl(clientOptions) }
49+
private val users: UserServiceAsync by lazy { UserServiceAsyncImpl(clientOptions) }
5050

51-
private val projectScore: ProjectScoreServiceAsync by lazy { ProjectScoreServiceAsyncImpl(clientOptions) }
51+
private val projectScores: ProjectScoreServiceAsync by lazy { ProjectScoreServiceAsyncImpl(clientOptions) }
5252

53-
private val projectTag: ProjectTagServiceAsync by lazy { ProjectTagServiceAsyncImpl(clientOptions) }
53+
private val projectTags: ProjectTagServiceAsync by lazy { ProjectTagServiceAsyncImpl(clientOptions) }
5454

55-
private val function: FunctionServiceAsync by lazy { FunctionServiceAsyncImpl(clientOptions) }
55+
private val functions: FunctionServiceAsync by lazy { FunctionServiceAsyncImpl(clientOptions) }
5656

57-
private val view: ViewServiceAsync by lazy { ViewServiceAsyncImpl(clientOptions) }
57+
private val views: ViewServiceAsync by lazy { ViewServiceAsyncImpl(clientOptions) }
5858

59-
private val organization: OrganizationServiceAsync by lazy { OrganizationServiceAsyncImpl(clientOptions) }
59+
private val organizations: OrganizationServiceAsync by lazy { OrganizationServiceAsyncImpl(clientOptions) }
6060

61-
private val apiKey: ApiKeyServiceAsync by lazy { ApiKeyServiceAsyncImpl(clientOptions) }
61+
private val apiKeys: ApiKeyServiceAsync by lazy { ApiKeyServiceAsyncImpl(clientOptions) }
6262

6363
override fun sync(): BraintrustClient = sync
6464

6565
override fun topLevel(): TopLevelServiceAsync = topLevel
6666

67-
override fun project(): ProjectServiceAsync = project
67+
override fun projects(): ProjectServiceAsync = projects
6868

69-
override fun experiment(): ExperimentServiceAsync = experiment
69+
override fun experiments(): ExperimentServiceAsync = experiments
7070

71-
override fun dataset(): DatasetServiceAsync = dataset
71+
override fun datasets(): DatasetServiceAsync = datasets
7272

73-
override fun prompt(): PromptServiceAsync = prompt
73+
override fun prompts(): PromptServiceAsync = prompts
7474

75-
override fun role(): RoleServiceAsync = role
75+
override fun roles(): RoleServiceAsync = roles
7676

77-
override fun group(): GroupServiceAsync = group
77+
override fun groups(): GroupServiceAsync = groups
7878

79-
override fun acl(): AclServiceAsync = acl
79+
override fun acls(): AclServiceAsync = acls
8080

81-
override fun user(): UserServiceAsync = user
81+
override fun users(): UserServiceAsync = users
8282

83-
override fun projectScore(): ProjectScoreServiceAsync = projectScore
83+
override fun projectScores(): ProjectScoreServiceAsync = projectScores
8484

85-
override fun projectTag(): ProjectTagServiceAsync = projectTag
85+
override fun projectTags(): ProjectTagServiceAsync = projectTags
8686

87-
override fun function(): FunctionServiceAsync = function
87+
override fun functions(): FunctionServiceAsync = functions
8888

89-
override fun view(): ViewServiceAsync = view
89+
override fun views(): ViewServiceAsync = views
9090

91-
override fun organization(): OrganizationServiceAsync = organization
91+
override fun organizations(): OrganizationServiceAsync = organizations
9292

93-
override fun apiKey(): ApiKeyServiceAsync = apiKey
93+
override fun apiKeys(): ApiKeyServiceAsync = apiKeys
9494
}

braintrust-java-core/src/main/kotlin/com/braintrustdata/api/client/BraintrustClientImpl.kt

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -32,63 +32,63 @@ class BraintrustClientImpl constructor(private val clientOptions: ClientOptions,
3232

3333
private val topLevel: TopLevelService by lazy { TopLevelServiceImpl(clientOptions) }
3434

35-
private val project: ProjectService by lazy { ProjectServiceImpl(clientOptions) }
35+
private val projects: ProjectService by lazy { ProjectServiceImpl(clientOptions) }
3636

37-
private val experiment: ExperimentService by lazy { ExperimentServiceImpl(clientOptions) }
37+
private val experiments: ExperimentService by lazy { ExperimentServiceImpl(clientOptions) }
3838

39-
private val dataset: DatasetService by lazy { DatasetServiceImpl(clientOptions) }
39+
private val datasets: DatasetService by lazy { DatasetServiceImpl(clientOptions) }
4040

41-
private val prompt: PromptService by lazy { PromptServiceImpl(clientOptions) }
41+
private val prompts: PromptService by lazy { PromptServiceImpl(clientOptions) }
4242

43-
private val role: RoleService by lazy { RoleServiceImpl(clientOptions) }
43+
private val roles: RoleService by lazy { RoleServiceImpl(clientOptions) }
4444

45-
private val group: GroupService by lazy { GroupServiceImpl(clientOptions) }
45+
private val groups: GroupService by lazy { GroupServiceImpl(clientOptions) }
4646

47-
private val acl: AclService by lazy { AclServiceImpl(clientOptions) }
47+
private val acls: AclService by lazy { AclServiceImpl(clientOptions) }
4848

49-
private val user: UserService by lazy { UserServiceImpl(clientOptions) }
49+
private val users: UserService by lazy { UserServiceImpl(clientOptions) }
5050

51-
private val projectScore: ProjectScoreService by lazy { ProjectScoreServiceImpl(clientOptions) }
51+
private val projectScores: ProjectScoreService by lazy { ProjectScoreServiceImpl(clientOptions) }
5252

53-
private val projectTag: ProjectTagService by lazy { ProjectTagServiceImpl(clientOptions) }
53+
private val projectTags: ProjectTagService by lazy { ProjectTagServiceImpl(clientOptions) }
5454

55-
private val function: FunctionService by lazy { FunctionServiceImpl(clientOptions) }
55+
private val functions: FunctionService by lazy { FunctionServiceImpl(clientOptions) }
5656

57-
private val view: ViewService by lazy { ViewServiceImpl(clientOptions) }
57+
private val views: ViewService by lazy { ViewServiceImpl(clientOptions) }
5858

59-
private val organization: OrganizationService by lazy { OrganizationServiceImpl(clientOptions) }
59+
private val organizations: OrganizationService by lazy { OrganizationServiceImpl(clientOptions) }
6060

61-
private val apiKey: ApiKeyService by lazy { ApiKeyServiceImpl(clientOptions) }
61+
private val apiKeys: ApiKeyService by lazy { ApiKeyServiceImpl(clientOptions) }
6262

6363
override fun async(): BraintrustClientAsync = async
6464

6565
override fun topLevel(): TopLevelService = topLevel
6666

67-
override fun project(): ProjectService = project
67+
override fun projects(): ProjectService = projects
6868

69-
override fun experiment(): ExperimentService = experiment
69+
override fun experiments(): ExperimentService = experiments
7070

71-
override fun dataset(): DatasetService = dataset
71+
override fun datasets(): DatasetService = datasets
7272

73-
override fun prompt(): PromptService = prompt
73+
override fun prompts(): PromptService = prompts
7474

75-
override fun role(): RoleService = role
75+
override fun roles(): RoleService = roles
7676

77-
override fun group(): GroupService = group
77+
override fun groups(): GroupService = groups
7878

79-
override fun acl(): AclService = acl
79+
override fun acls(): AclService = acls
8080

81-
override fun user(): UserService = user
81+
override fun users(): UserService = users
8282

83-
override fun projectScore(): ProjectScoreService = projectScore
83+
override fun projectScores(): ProjectScoreService = projectScores
8484

85-
override fun projectTag(): ProjectTagService = projectTag
85+
override fun projectTags(): ProjectTagService = projectTags
8686

87-
override fun function(): FunctionService = function
87+
override fun functions(): FunctionService = functions
8888

89-
override fun view(): ViewService = view
89+
override fun views(): ViewService = views
9090

91-
override fun organization(): OrganizationService = organization
91+
override fun organizations(): OrganizationService = organizations
9292

93-
override fun apiKey(): ApiKeyService = apiKey
93+
override fun apiKeys(): ApiKeyService = apiKeys
9494
}

0 commit comments

Comments
 (0)