@cjavdev/believe-mcp 0.20.1 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +45 -3
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +12 -3
- package/code-tool-worker.mjs.map +1 -1
- package/docs-search-tool.js +1 -1
- package/docs-search-tool.js.map +1 -1
- package/docs-search-tool.mjs +1 -1
- package/docs-search-tool.mjs.map +1 -1
- package/http.d.mts.map +1 -1
- package/http.d.ts.map +1 -1
- package/http.js +10 -3
- package/http.js.map +1 -1
- package/http.mjs +10 -3
- package/http.mjs.map +1 -1
- package/instructions.js +1 -1
- package/instructions.js.map +1 -1
- package/instructions.mjs +1 -1
- package/instructions.mjs.map +1 -1
- package/local-docs-search.d.mts.map +1 -1
- package/local-docs-search.d.ts.map +1 -1
- package/local-docs-search.js +613 -6
- package/local-docs-search.js.map +1 -1
- package/local-docs-search.mjs +613 -6
- package/local-docs-search.mjs.map +1 -1
- package/package.json +2 -2
- package/server.js +1 -1
- package/server.mjs +1 -1
- package/src/code-tool-worker.ts +12 -3
- package/src/docs-search-tool.ts +1 -1
- package/src/http.ts +13 -4
- package/src/instructions.ts +1 -1
- package/src/local-docs-search.ts +762 -6
- package/src/server.ts +1 -1
- package/src/util.ts +2 -2
- package/util.js +2 -2
- package/util.js.map +1 -1
- package/util.mjs +2 -2
- package/util.mjs.map +1 -1
package/local-docs-search.js
CHANGED
|
@@ -58,6 +58,10 @@ const EMBEDDED_METHODS = [
|
|
|
58
58
|
method: '$client get_welcome',
|
|
59
59
|
example: "believe get-welcome \\\n --api-key 'My API Key'",
|
|
60
60
|
},
|
|
61
|
+
csharp: {
|
|
62
|
+
method: 'GetWelcome',
|
|
63
|
+
example: 'ClientGetWelcomeParams parameters = new();\n\nvar response = await client.GetWelcome(parameters);\n\nConsole.WriteLine(response);',
|
|
64
|
+
},
|
|
61
65
|
go: {
|
|
62
66
|
method: 'client.GetWelcome',
|
|
63
67
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.GetWelcome(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -73,6 +77,10 @@ const EMBEDDED_METHODS = [
|
|
|
73
77
|
method: 'getWelcome',
|
|
74
78
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.ClientGetWelcomeParams\nimport com.believe.api.models.ClientGetWelcomeResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: ClientGetWelcomeResponse = client.getWelcome()\n}',
|
|
75
79
|
},
|
|
80
|
+
php: {
|
|
81
|
+
method: 'getWelcome',
|
|
82
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->getWelcome();\n\nvar_dump($response);",
|
|
83
|
+
},
|
|
76
84
|
python: {
|
|
77
85
|
method: 'get_welcome',
|
|
78
86
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.get_welcome()\nprint(response)',
|
|
@@ -109,6 +117,10 @@ const EMBEDDED_METHODS = [
|
|
|
109
117
|
method: 'characters list',
|
|
110
118
|
example: "believe characters list \\\n --api-key 'My API Key'",
|
|
111
119
|
},
|
|
120
|
+
csharp: {
|
|
121
|
+
method: 'Characters.List',
|
|
122
|
+
example: 'CharacterListParams parameters = new();\n\nvar page = await client.Characters.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
123
|
+
},
|
|
112
124
|
go: {
|
|
113
125
|
method: 'client.Characters.List',
|
|
114
126
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -124,6 +136,10 @@ const EMBEDDED_METHODS = [
|
|
|
124
136
|
method: 'characters().list',
|
|
125
137
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterListPage\nimport com.believe.api.models.characters.CharacterListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: CharacterListPage = client.characters().list()\n}',
|
|
126
138
|
},
|
|
139
|
+
php: {
|
|
140
|
+
method: 'characters->list',
|
|
141
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->characters->list(\n limit: 10,\n minOptimism: 0,\n role: CharacterRole::COACH,\n skip: 0,\n teamID: 'team_id',\n);\n\nvar_dump($page);",
|
|
142
|
+
},
|
|
127
143
|
python: {
|
|
128
144
|
method: 'characters.list',
|
|
129
145
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.characters.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -168,6 +184,10 @@ const EMBEDDED_METHODS = [
|
|
|
168
184
|
method: 'characters create',
|
|
169
185
|
example: "believe characters create \\\n --api-key 'My API Key' \\\n --background 'Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.' \\\n --emotional-stats '{curiosity: 40, empathy: 85, optimism: 45, resilience: 95, vulnerability: 60}' \\\n --name 'Roy Kent' \\\n --personality-trait intense \\\n --personality-trait loyal \\\n --personality-trait 'secretly caring' \\\n --personality-trait profane \\\n --role coach",
|
|
170
186
|
},
|
|
187
|
+
csharp: {
|
|
188
|
+
method: 'Characters.Create',
|
|
189
|
+
example: 'CharacterCreateParams parameters = new()\n{\n Background = "Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.",\n EmotionalStats = new()\n {\n Curiosity = 40,\n Empathy = 85,\n Optimism = 45,\n Resilience = 95,\n Vulnerability = 60,\n },\n Name = "Roy Kent",\n PersonalityTraits =\n [\n "intense", "loyal", "secretly caring", "profane"\n ],\n Role = CharacterRole.Coach,\n};\n\nvar character = await client.Characters.Create(parameters);\n\nConsole.WriteLine(character);',
|
|
190
|
+
},
|
|
171
191
|
go: {
|
|
172
192
|
method: 'client.Characters.New',
|
|
173
193
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tcharacter, err := client.Characters.New(context.TODO(), believe.CharacterNewParams{\n\t\tBackground: "Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.",\n\t\tEmotionalStats: believe.EmotionalStatsParam{\n\t\t\tCuriosity: 40,\n\t\t\tEmpathy: 85,\n\t\t\tOptimism: 45,\n\t\t\tResilience: 95,\n\t\t\tVulnerability: 60,\n\t\t},\n\t\tName: "Roy Kent",\n\t\tPersonalityTraits: []string{"intense", "loyal", "secretly caring", "profane"},\n\t\tRole: believe.CharacterRoleCoach,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", character.ID)\n}\n',
|
|
@@ -183,6 +203,10 @@ const EMBEDDED_METHODS = [
|
|
|
183
203
|
method: 'characters().create',
|
|
184
204
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.Character\nimport com.believe.api.models.characters.CharacterCreateParams\nimport com.believe.api.models.characters.CharacterRole\nimport com.believe.api.models.characters.EmotionalStats\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: CharacterCreateParams = CharacterCreateParams.builder()\n .background("Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.")\n .emotionalStats(EmotionalStats.builder()\n .curiosity(40L)\n .empathy(85L)\n .optimism(45L)\n .resilience(95L)\n .vulnerability(60L)\n .build())\n .name("Roy Kent")\n .personalityTraits(listOf(\n "intense",\n "loyal",\n "secretly caring",\n "profane",\n ))\n .role(CharacterRole.COACH)\n .build()\n val character: Character = client.characters().create(params)\n}',
|
|
185
205
|
},
|
|
206
|
+
php: {
|
|
207
|
+
method: 'characters->create',
|
|
208
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$character = $client->characters->create(\n background: 'Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.',\n emotionalStats: [\n 'curiosity' => 40,\n 'empathy' => 85,\n 'optimism' => 45,\n 'resilience' => 95,\n 'vulnerability' => 60,\n ],\n name: 'Roy Kent',\n personalityTraits: ['intense', 'loyal', 'secretly caring', 'profane'],\n role: CharacterRole::COACH,\n dateOfBirth: '1977-03-15',\n email: 'roy.kent@afcrichmond.com',\n growthArcs: [\n [\n 'breakthrough' => 'Finding purpose beyond playing',\n 'challenge' => 'Accepting his body\\'s limitations',\n 'endingPoint' => 'Retired but lost',\n 'season' => 1,\n 'startingPoint' => 'Aging footballer facing retirement',\n ],\n ],\n heightMeters: 1.78,\n profileImageURL: 'https://afcrichmond.com/images/roy-kent.jpg',\n salaryGbp: '175000.00',\n signatureQuotes: [\n 'He\\'s here, he\\'s there, he\\'s every-f***ing-where, Roy Kent!', 'Whistle!'\n ],\n teamID: 'afc-richmond',\n);\n\nvar_dump($character);",
|
|
209
|
+
},
|
|
186
210
|
python: {
|
|
187
211
|
method: 'characters.create',
|
|
188
212
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\ncharacter = client.characters.create(\n background="Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.",\n emotional_stats={\n "curiosity": 40,\n "empathy": 85,\n "optimism": 45,\n "resilience": 95,\n "vulnerability": 60,\n },\n name="Roy Kent",\n personality_traits=["intense", "loyal", "secretly caring", "profane"],\n role="coach",\n)\nprint(character.id)',
|
|
@@ -213,6 +237,10 @@ const EMBEDDED_METHODS = [
|
|
|
213
237
|
method: 'characters retrieve',
|
|
214
238
|
example: "believe characters retrieve \\\n --api-key 'My API Key' \\\n --character-id character_id",
|
|
215
239
|
},
|
|
240
|
+
csharp: {
|
|
241
|
+
method: 'Characters.Retrieve',
|
|
242
|
+
example: 'CharacterRetrieveParams parameters = new() { CharacterID = "character_id" };\n\nvar character = await client.Characters.Retrieve(parameters);\n\nConsole.WriteLine(character);',
|
|
243
|
+
},
|
|
216
244
|
go: {
|
|
217
245
|
method: 'client.Characters.Get',
|
|
218
246
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tcharacter, err := client.Characters.Get(context.TODO(), "character_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", character.ID)\n}\n',
|
|
@@ -228,6 +256,10 @@ const EMBEDDED_METHODS = [
|
|
|
228
256
|
method: 'characters().retrieve',
|
|
229
257
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.Character\nimport com.believe.api.models.characters.CharacterRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val character: Character = client.characters().retrieve("character_id")\n}',
|
|
230
258
|
},
|
|
259
|
+
php: {
|
|
260
|
+
method: 'characters->retrieve',
|
|
261
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$character = $client->characters->retrieve('character_id');\n\nvar_dump($character);",
|
|
262
|
+
},
|
|
231
263
|
python: {
|
|
232
264
|
method: 'characters.retrieve',
|
|
233
265
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\ncharacter = client.characters.retrieve(\n "character_id",\n)\nprint(character.id)',
|
|
@@ -273,6 +305,10 @@ const EMBEDDED_METHODS = [
|
|
|
273
305
|
method: 'characters update',
|
|
274
306
|
example: "believe characters update \\\n --api-key 'My API Key' \\\n --character-id character_id",
|
|
275
307
|
},
|
|
308
|
+
csharp: {
|
|
309
|
+
method: 'Characters.Update',
|
|
310
|
+
example: 'CharacterUpdateParams parameters = new() { CharacterID = "character_id" };\n\nvar character = await client.Characters.Update(parameters);\n\nConsole.WriteLine(character);',
|
|
311
|
+
},
|
|
276
312
|
go: {
|
|
277
313
|
method: 'client.Characters.Update',
|
|
278
314
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tcharacter, err := client.Characters.Update(\n\t\tcontext.TODO(),\n\t\t"character_id",\n\t\tbelieve.CharacterUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", character.ID)\n}\n',
|
|
@@ -288,6 +324,10 @@ const EMBEDDED_METHODS = [
|
|
|
288
324
|
method: 'characters().update',
|
|
289
325
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.Character\nimport com.believe.api.models.characters.CharacterUpdateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val character: Character = client.characters().update("character_id")\n}',
|
|
290
326
|
},
|
|
327
|
+
php: {
|
|
328
|
+
method: 'characters->update',
|
|
329
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$character = $client->characters->update(\n 'character_id',\n background: 'background',\n dateOfBirth: '2019-12-27',\n email: 'dev@stainless.com',\n emotionalStats: [\n 'curiosity' => 99,\n 'empathy' => 100,\n 'optimism' => 95,\n 'resilience' => 90,\n 'vulnerability' => 80,\n ],\n growthArcs: [\n [\n 'breakthrough' => 'breakthrough',\n 'challenge' => 'challenge',\n 'endingPoint' => 'ending_point',\n 'season' => 1,\n 'startingPoint' => 'starting_point',\n ],\n ],\n heightMeters: 1,\n name: 'x',\n personalityTraits: ['string'],\n profileImageURL: 'https://example.com',\n role: CharacterRole::COACH,\n salaryGbp: 0,\n signatureQuotes: ['string'],\n teamID: 'team_id',\n);\n\nvar_dump($character);",
|
|
330
|
+
},
|
|
291
331
|
python: {
|
|
292
332
|
method: 'characters.update',
|
|
293
333
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\ncharacter = client.characters.update(\n character_id="character_id",\n)\nprint(character.id)',
|
|
@@ -317,6 +357,10 @@ const EMBEDDED_METHODS = [
|
|
|
317
357
|
method: 'characters delete',
|
|
318
358
|
example: "believe characters delete \\\n --api-key 'My API Key' \\\n --character-id character_id",
|
|
319
359
|
},
|
|
360
|
+
csharp: {
|
|
361
|
+
method: 'Characters.Delete',
|
|
362
|
+
example: 'CharacterDeleteParams parameters = new() { CharacterID = "character_id" };\n\nawait client.Characters.Delete(parameters);',
|
|
363
|
+
},
|
|
320
364
|
go: {
|
|
321
365
|
method: 'client.Characters.Delete',
|
|
322
366
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Characters.Delete(context.TODO(), "character_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -332,6 +376,10 @@ const EMBEDDED_METHODS = [
|
|
|
332
376
|
method: 'characters().delete',
|
|
333
377
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.characters().delete("character_id")\n}',
|
|
334
378
|
},
|
|
379
|
+
php: {
|
|
380
|
+
method: 'characters->delete',
|
|
381
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->characters->delete('character_id');\n\nvar_dump($result);",
|
|
382
|
+
},
|
|
335
383
|
python: {
|
|
336
384
|
method: 'characters.delete',
|
|
337
385
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.characters.delete(\n "character_id",\n)',
|
|
@@ -362,6 +410,10 @@ const EMBEDDED_METHODS = [
|
|
|
362
410
|
method: 'characters get_quotes',
|
|
363
411
|
example: "believe characters get-quotes \\\n --api-key 'My API Key' \\\n --character-id character_id",
|
|
364
412
|
},
|
|
413
|
+
csharp: {
|
|
414
|
+
method: 'Characters.GetQuotes',
|
|
415
|
+
example: 'CharacterGetQuotesParams parameters = new() { CharacterID = "character_id" };\n\nvar response = await client.Characters.GetQuotes(parameters);\n\nConsole.WriteLine(response);',
|
|
416
|
+
},
|
|
365
417
|
go: {
|
|
366
418
|
method: 'client.Characters.GetQuotes',
|
|
367
419
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Characters.GetQuotes(context.TODO(), "character_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -377,6 +429,10 @@ const EMBEDDED_METHODS = [
|
|
|
377
429
|
method: 'characters().getQuotes',
|
|
378
430
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterGetQuotesParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: List<String> = client.characters().getQuotes("character_id")\n}',
|
|
379
431
|
},
|
|
432
|
+
php: {
|
|
433
|
+
method: 'characters->getQuotes',
|
|
434
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->characters->getQuotes('character_id');\n\nvar_dump($response);",
|
|
435
|
+
},
|
|
380
436
|
python: {
|
|
381
437
|
method: 'characters.get_quotes',
|
|
382
438
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.characters.get_quotes(\n "character_id",\n)\nprint(response)',
|
|
@@ -407,6 +463,10 @@ const EMBEDDED_METHODS = [
|
|
|
407
463
|
method: 'teams list',
|
|
408
464
|
example: "believe teams list \\\n --api-key 'My API Key'",
|
|
409
465
|
},
|
|
466
|
+
csharp: {
|
|
467
|
+
method: 'Teams.List',
|
|
468
|
+
example: 'TeamListParams parameters = new();\n\nvar page = await client.Teams.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
469
|
+
},
|
|
410
470
|
go: {
|
|
411
471
|
method: 'client.Teams.List',
|
|
412
472
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Teams.List(context.TODO(), believe.TeamListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -422,6 +482,10 @@ const EMBEDDED_METHODS = [
|
|
|
422
482
|
method: 'teams().list',
|
|
423
483
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.TeamListPage\nimport com.believe.api.models.teams.TeamListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: TeamListPage = client.teams().list()\n}',
|
|
424
484
|
},
|
|
485
|
+
php: {
|
|
486
|
+
method: 'teams->list',
|
|
487
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->teams->list(\n league: League::PREMIER_LEAGUE, limit: 10, minCultureScore: 0, skip: 0\n);\n\nvar_dump($page);",
|
|
488
|
+
},
|
|
425
489
|
python: {
|
|
426
490
|
method: 'teams.list',
|
|
427
491
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.teams.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -470,6 +534,10 @@ const EMBEDDED_METHODS = [
|
|
|
470
534
|
method: 'teams create',
|
|
471
535
|
example: "believe teams create \\\n --api-key 'My API Key' \\\n --culture-score 70 \\\n --founded-year 1895 \\\n --league 'Premier League' \\\n --name 'West Ham United' \\\n --stadium 'London Stadium' \\\n --values '{primary_value: Pride, secondary_values: [History, Community, Passion], team_motto: Forever Blowing Bubbles}'",
|
|
472
536
|
},
|
|
537
|
+
csharp: {
|
|
538
|
+
method: 'Teams.Create',
|
|
539
|
+
example: 'TeamCreateParams parameters = new()\n{\n CultureScore = 70,\n FoundedYear = 1895,\n League = League.PremierLeague,\n Name = "West Ham United",\n Stadium = "London Stadium",\n Values = new()\n {\n PrimaryValue = "Pride",\n SecondaryValues =\n [\n "History", "Community", "Passion"\n ],\n TeamMotto = "Forever Blowing Bubbles",\n },\n};\n\nvar team = await client.Teams.Create(parameters);\n\nConsole.WriteLine(team);',
|
|
540
|
+
},
|
|
473
541
|
go: {
|
|
474
542
|
method: 'client.Teams.New',
|
|
475
543
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteam, err := client.Teams.New(context.TODO(), believe.TeamNewParams{\n\t\tCultureScore: 70,\n\t\tFoundedYear: 1895,\n\t\tLeague: believe.LeaguePremierLeague,\n\t\tName: "West Ham United",\n\t\tStadium: "London Stadium",\n\t\tValues: believe.TeamValuesParam{\n\t\t\tPrimaryValue: "Pride",\n\t\t\tSecondaryValues: []string{"History", "Community", "Passion"},\n\t\t\tTeamMotto: "Forever Blowing Bubbles",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", team.ID)\n}\n',
|
|
@@ -485,6 +553,10 @@ const EMBEDDED_METHODS = [
|
|
|
485
553
|
method: 'teams().create',
|
|
486
554
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.League\nimport com.believe.api.models.teams.Team\nimport com.believe.api.models.teams.TeamCreateParams\nimport com.believe.api.models.teams.TeamValues\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: TeamCreateParams = TeamCreateParams.builder()\n .cultureScore(70L)\n .foundedYear(1895L)\n .league(League.PREMIER_LEAGUE)\n .name("West Ham United")\n .stadium("London Stadium")\n .values(TeamValues.builder()\n .primaryValue("Pride")\n .secondaryValues(listOf(\n "History",\n "Community",\n "Passion",\n ))\n .teamMotto("Forever Blowing Bubbles")\n .build())\n .build()\n val team: Team = client.teams().create(params)\n}',
|
|
487
555
|
},
|
|
556
|
+
php: {
|
|
557
|
+
method: 'teams->create',
|
|
558
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$team = $client->teams->create(\n cultureScore: 70,\n foundedYear: 1895,\n league: League::PREMIER_LEAGUE,\n name: 'West Ham United',\n stadium: 'London Stadium',\n values: [\n 'primaryValue' => 'Pride',\n 'secondaryValues' => ['History', 'Community', 'Passion'],\n 'teamMotto' => 'Forever Blowing Bubbles',\n ],\n annualBudgetGbp: '150000000.00',\n averageAttendance: 59988,\n contactEmail: 'info@westhamunited.co.uk',\n isActive: true,\n nickname: 'The Hammers',\n primaryColor: '#7A263A',\n rivalTeams: ['afc-richmond', 'tottenham'],\n secondaryColor: '#1BB1E7',\n stadiumLocation: ['latitude' => 51.5387, 'longitude' => -0.0166],\n website: 'https://www.whufc.com',\n winPercentage: 52.3,\n);\n\nvar_dump($team);",
|
|
559
|
+
},
|
|
488
560
|
python: {
|
|
489
561
|
method: 'teams.create',
|
|
490
562
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteam = client.teams.create(\n culture_score=70,\n founded_year=1895,\n league="Premier League",\n name="West Ham United",\n stadium="London Stadium",\n values={\n "primary_value": "Pride",\n "secondary_values": ["History", "Community", "Passion"],\n "team_motto": "Forever Blowing Bubbles",\n },\n)\nprint(team.id)',
|
|
@@ -515,6 +587,10 @@ const EMBEDDED_METHODS = [
|
|
|
515
587
|
method: 'teams retrieve',
|
|
516
588
|
example: "believe teams retrieve \\\n --api-key 'My API Key' \\\n --team-id team_id",
|
|
517
589
|
},
|
|
590
|
+
csharp: {
|
|
591
|
+
method: 'Teams.Retrieve',
|
|
592
|
+
example: 'TeamRetrieveParams parameters = new() { TeamID = "team_id" };\n\nvar team = await client.Teams.Retrieve(parameters);\n\nConsole.WriteLine(team);',
|
|
593
|
+
},
|
|
518
594
|
go: {
|
|
519
595
|
method: 'client.Teams.Get',
|
|
520
596
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteam, err := client.Teams.Get(context.TODO(), "team_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", team.ID)\n}\n',
|
|
@@ -530,6 +606,10 @@ const EMBEDDED_METHODS = [
|
|
|
530
606
|
method: 'teams().retrieve',
|
|
531
607
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.Team\nimport com.believe.api.models.teams.TeamRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val team: Team = client.teams().retrieve("team_id")\n}',
|
|
532
608
|
},
|
|
609
|
+
php: {
|
|
610
|
+
method: 'teams->retrieve',
|
|
611
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$team = $client->teams->retrieve('team_id');\n\nvar_dump($team);",
|
|
612
|
+
},
|
|
533
613
|
python: {
|
|
534
614
|
method: 'teams.retrieve',
|
|
535
615
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteam = client.teams.retrieve(\n "team_id",\n)\nprint(team.id)',
|
|
@@ -579,6 +659,10 @@ const EMBEDDED_METHODS = [
|
|
|
579
659
|
method: 'teams update',
|
|
580
660
|
example: "believe teams update \\\n --api-key 'My API Key' \\\n --team-id team_id",
|
|
581
661
|
},
|
|
662
|
+
csharp: {
|
|
663
|
+
method: 'Teams.Update',
|
|
664
|
+
example: 'TeamUpdateParams parameters = new() { TeamID = "team_id" };\n\nvar team = await client.Teams.Update(parameters);\n\nConsole.WriteLine(team);',
|
|
665
|
+
},
|
|
582
666
|
go: {
|
|
583
667
|
method: 'client.Teams.Update',
|
|
584
668
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteam, err := client.Teams.Update(\n\t\tcontext.TODO(),\n\t\t"team_id",\n\t\tbelieve.TeamUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", team.ID)\n}\n',
|
|
@@ -594,6 +678,10 @@ const EMBEDDED_METHODS = [
|
|
|
594
678
|
method: 'teams().update',
|
|
595
679
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.Team\nimport com.believe.api.models.teams.TeamUpdateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val team: Team = client.teams().update("team_id")\n}',
|
|
596
680
|
},
|
|
681
|
+
php: {
|
|
682
|
+
method: 'teams->update',
|
|
683
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$team = $client->teams->update(\n 'team_id',\n annualBudgetGbp: 0,\n averageAttendance: 0,\n contactEmail: 'dev@stainless.com',\n cultureScore: 0,\n foundedYear: 1800,\n isActive: true,\n league: League::PREMIER_LEAGUE,\n name: 'x',\n nickname: 'nickname',\n primaryColor: 'primary_color',\n rivalTeams: ['string'],\n secondaryColor: 'secondary_color',\n stadium: 'stadium',\n stadiumLocation: ['latitude' => 51.4816, 'longitude' => -0.191],\n values: [\n 'primaryValue' => 'Believe',\n 'secondaryValues' => ['Family', 'Resilience', 'Joy'],\n 'teamMotto' => 'Football is life!',\n ],\n website: 'https://example.com',\n winPercentage: 0,\n);\n\nvar_dump($team);",
|
|
684
|
+
},
|
|
597
685
|
python: {
|
|
598
686
|
method: 'teams.update',
|
|
599
687
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteam = client.teams.update(\n team_id="team_id",\n)\nprint(team.id)',
|
|
@@ -623,6 +711,10 @@ const EMBEDDED_METHODS = [
|
|
|
623
711
|
method: 'teams delete',
|
|
624
712
|
example: "believe teams delete \\\n --api-key 'My API Key' \\\n --team-id team_id",
|
|
625
713
|
},
|
|
714
|
+
csharp: {
|
|
715
|
+
method: 'Teams.Delete',
|
|
716
|
+
example: 'TeamDeleteParams parameters = new() { TeamID = "team_id" };\n\nawait client.Teams.Delete(parameters);',
|
|
717
|
+
},
|
|
626
718
|
go: {
|
|
627
719
|
method: 'client.Teams.Delete',
|
|
628
720
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Teams.Delete(context.TODO(), "team_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -638,6 +730,10 @@ const EMBEDDED_METHODS = [
|
|
|
638
730
|
method: 'teams().delete',
|
|
639
731
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.TeamDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.teams().delete("team_id")\n}',
|
|
640
732
|
},
|
|
733
|
+
php: {
|
|
734
|
+
method: 'teams->delete',
|
|
735
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->teams->delete('team_id');\n\nvar_dump($result);",
|
|
736
|
+
},
|
|
641
737
|
python: {
|
|
642
738
|
method: 'teams.delete',
|
|
643
739
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.teams.delete(\n "team_id",\n)',
|
|
@@ -668,6 +764,10 @@ const EMBEDDED_METHODS = [
|
|
|
668
764
|
method: 'teams get_rivals',
|
|
669
765
|
example: "believe teams get-rivals \\\n --api-key 'My API Key' \\\n --team-id team_id",
|
|
670
766
|
},
|
|
767
|
+
csharp: {
|
|
768
|
+
method: 'Teams.GetRivals',
|
|
769
|
+
example: 'TeamGetRivalsParams parameters = new() { TeamID = "team_id" };\n\nvar teams = await client.Teams.GetRivals(parameters);\n\nConsole.WriteLine(teams);',
|
|
770
|
+
},
|
|
671
771
|
go: {
|
|
672
772
|
method: 'client.Teams.GetRivals',
|
|
673
773
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteams, err := client.Teams.GetRivals(context.TODO(), "team_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", teams)\n}\n',
|
|
@@ -683,6 +783,10 @@ const EMBEDDED_METHODS = [
|
|
|
683
783
|
method: 'teams().getRivals',
|
|
684
784
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.Team\nimport com.believe.api.models.teams.TeamGetRivalsParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val teams: List<Team> = client.teams().getRivals("team_id")\n}',
|
|
685
785
|
},
|
|
786
|
+
php: {
|
|
787
|
+
method: 'teams->getRivals',
|
|
788
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$teams = $client->teams->getRivals('team_id');\n\nvar_dump($teams);",
|
|
789
|
+
},
|
|
686
790
|
python: {
|
|
687
791
|
method: 'teams.get_rivals',
|
|
688
792
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteams = client.teams.get_rivals(\n "team_id",\n)\nprint(teams)',
|
|
@@ -713,6 +817,10 @@ const EMBEDDED_METHODS = [
|
|
|
713
817
|
method: 'teams get_culture',
|
|
714
818
|
example: "believe teams get-culture \\\n --api-key 'My API Key' \\\n --team-id team_id",
|
|
715
819
|
},
|
|
820
|
+
csharp: {
|
|
821
|
+
method: 'Teams.GetCulture',
|
|
822
|
+
example: 'TeamGetCultureParams parameters = new() { TeamID = "team_id" };\n\nvar response = await client.Teams.GetCulture(parameters);\n\nConsole.WriteLine(response);',
|
|
823
|
+
},
|
|
716
824
|
go: {
|
|
717
825
|
method: 'client.Teams.GetCulture',
|
|
718
826
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Teams.GetCulture(context.TODO(), "team_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -728,6 +836,10 @@ const EMBEDDED_METHODS = [
|
|
|
728
836
|
method: 'teams().getCulture',
|
|
729
837
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.TeamGetCultureParams\nimport com.believe.api.models.teams.TeamGetCultureResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: TeamGetCultureResponse = client.teams().getCulture("team_id")\n}',
|
|
730
838
|
},
|
|
839
|
+
php: {
|
|
840
|
+
method: 'teams->getCulture',
|
|
841
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->teams->getCulture('team_id');\n\nvar_dump($response);",
|
|
842
|
+
},
|
|
731
843
|
python: {
|
|
732
844
|
method: 'teams.get_culture',
|
|
733
845
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.teams.get_culture(\n "team_id",\n)\nprint(response)',
|
|
@@ -758,6 +870,10 @@ const EMBEDDED_METHODS = [
|
|
|
758
870
|
method: 'teams list_logos',
|
|
759
871
|
example: "believe teams list-logos \\\n --api-key 'My API Key' \\\n --team-id team_id",
|
|
760
872
|
},
|
|
873
|
+
csharp: {
|
|
874
|
+
method: 'Teams.ListLogos',
|
|
875
|
+
example: 'TeamListLogosParams parameters = new() { TeamID = "team_id" };\n\nvar fileUploads = await client.Teams.ListLogos(parameters);\n\nConsole.WriteLine(fileUploads);',
|
|
876
|
+
},
|
|
761
877
|
go: {
|
|
762
878
|
method: 'client.Teams.ListLogos',
|
|
763
879
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tfileUploads, err := client.Teams.ListLogos(context.TODO(), "team_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", fileUploads)\n}\n',
|
|
@@ -773,6 +889,10 @@ const EMBEDDED_METHODS = [
|
|
|
773
889
|
method: 'teams().listLogos',
|
|
774
890
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.TeamListLogosParams\nimport com.believe.api.models.teams.logo.FileUpload\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val fileUploads: List<FileUpload> = client.teams().listLogos("team_id")\n}',
|
|
775
891
|
},
|
|
892
|
+
php: {
|
|
893
|
+
method: 'teams->listLogos',
|
|
894
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$fileUploads = $client->teams->listLogos('team_id');\n\nvar_dump($fileUploads);",
|
|
895
|
+
},
|
|
776
896
|
python: {
|
|
777
897
|
method: 'teams.list_logos',
|
|
778
898
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nfile_uploads = client.teams.list_logos(\n "team_id",\n)\nprint(file_uploads)',
|
|
@@ -803,6 +923,10 @@ const EMBEDDED_METHODS = [
|
|
|
803
923
|
method: 'logo upload',
|
|
804
924
|
example: "believe teams:logo upload \\\n --api-key 'My API Key' \\\n --team-id team_id \\\n --file 'Example data'",
|
|
805
925
|
},
|
|
926
|
+
csharp: {
|
|
927
|
+
method: 'Teams.Logo.Upload',
|
|
928
|
+
example: 'LogoUploadParams parameters = new()\n{\n TeamID = "team_id",\n File = Encoding.UTF8.GetBytes("Example data"),\n};\n\nvar fileUpload = await client.Teams.Logo.Upload(parameters);\n\nConsole.WriteLine(fileUpload);',
|
|
929
|
+
},
|
|
806
930
|
go: {
|
|
807
931
|
method: 'client.Teams.Logo.Upload',
|
|
808
932
|
example: 'package main\n\nimport (\n\t"bytes"\n\t"context"\n\t"fmt"\n\t"io"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tfileUpload, err := client.Teams.Logo.Upload(\n\t\tcontext.TODO(),\n\t\t"team_id",\n\t\tbelieve.TeamLogoUploadParams{\n\t\t\tFile: io.Reader(bytes.NewBuffer([]byte("Example data"))),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", fileUpload.FileID)\n}\n',
|
|
@@ -818,6 +942,10 @@ const EMBEDDED_METHODS = [
|
|
|
818
942
|
method: 'teams().logo().upload',
|
|
819
943
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.io.ByteArrayInputStream\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file("Example data".byteInputStream())\n .build()\n val fileUpload: FileUpload = client.teams().logo().upload(params)\n}',
|
|
820
944
|
},
|
|
945
|
+
php: {
|
|
946
|
+
method: 'teams->logo->upload',
|
|
947
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$fileUpload = $client->teams->logo->upload('team_id', file: 'file');\n\nvar_dump($fileUpload);",
|
|
948
|
+
},
|
|
821
949
|
python: {
|
|
822
950
|
method: 'teams.logo.upload',
|
|
823
951
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nfile_upload = client.teams.logo.upload(\n team_id="team_id",\n file=b"Example data",\n)\nprint(file_upload.file_id)',
|
|
@@ -848,6 +976,10 @@ const EMBEDDED_METHODS = [
|
|
|
848
976
|
method: 'logo download',
|
|
849
977
|
example: "believe teams:logo download \\\n --api-key 'My API Key' \\\n --team-id team_id \\\n --file-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
850
978
|
},
|
|
979
|
+
csharp: {
|
|
980
|
+
method: 'Teams.Logo.Download',
|
|
981
|
+
example: 'LogoDownloadParams parameters = new()\n{\n TeamID = "team_id",\n FileID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n};\n\nvar response = await client.Teams.Logo.Download(parameters);\n\nConsole.WriteLine(response);',
|
|
982
|
+
},
|
|
851
983
|
go: {
|
|
852
984
|
method: 'client.Teams.Logo.Download',
|
|
853
985
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Teams.Logo.Download(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tbelieve.TeamLogoDownloadParams{\n\t\t\tTeamID: "team_id",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -863,6 +995,10 @@ const EMBEDDED_METHODS = [
|
|
|
863
995
|
method: 'teams().logo().download',
|
|
864
996
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.logo.LogoDownloadParams\nimport com.believe.api.models.teams.logo.LogoDownloadResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: LogoDownloadParams = LogoDownloadParams.builder()\n .teamId("team_id")\n .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build()\n val response: LogoDownloadResponse = client.teams().logo().download(params)\n}',
|
|
865
997
|
},
|
|
998
|
+
php: {
|
|
999
|
+
method: 'teams->logo->download',
|
|
1000
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->teams->logo->download(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', teamID: 'team_id'\n);\n\nvar_dump($response);",
|
|
1001
|
+
},
|
|
866
1002
|
python: {
|
|
867
1003
|
method: 'teams.logo.download',
|
|
868
1004
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.teams.logo.download(\n file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n team_id="team_id",\n)\nprint(response)',
|
|
@@ -892,6 +1028,10 @@ const EMBEDDED_METHODS = [
|
|
|
892
1028
|
method: 'logo delete',
|
|
893
1029
|
example: "believe teams:logo delete \\\n --api-key 'My API Key' \\\n --team-id team_id \\\n --file-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
894
1030
|
},
|
|
1031
|
+
csharp: {
|
|
1032
|
+
method: 'Teams.Logo.Delete',
|
|
1033
|
+
example: 'LogoDeleteParams parameters = new()\n{\n TeamID = "team_id",\n FileID = "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n};\n\nawait client.Teams.Logo.Delete(parameters);',
|
|
1034
|
+
},
|
|
895
1035
|
go: {
|
|
896
1036
|
method: 'client.Teams.Logo.Delete',
|
|
897
1037
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Teams.Logo.Delete(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tbelieve.TeamLogoDeleteParams{\n\t\t\tTeamID: "team_id",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -907,6 +1047,10 @@ const EMBEDDED_METHODS = [
|
|
|
907
1047
|
method: 'teams().logo().delete',
|
|
908
1048
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teams.logo.LogoDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: LogoDeleteParams = LogoDeleteParams.builder()\n .teamId("team_id")\n .fileId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build()\n client.teams().logo().delete(params)\n}',
|
|
909
1049
|
},
|
|
1050
|
+
php: {
|
|
1051
|
+
method: 'teams->logo->delete',
|
|
1052
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->teams->logo->delete(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', teamID: 'team_id'\n);\n\nvar_dump($result);",
|
|
1053
|
+
},
|
|
910
1054
|
python: {
|
|
911
1055
|
method: 'teams.logo.delete',
|
|
912
1056
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.teams.logo.delete(\n file_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n team_id="team_id",\n)',
|
|
@@ -943,6 +1087,10 @@ const EMBEDDED_METHODS = [
|
|
|
943
1087
|
method: 'matches list',
|
|
944
1088
|
example: "believe matches list \\\n --api-key 'My API Key'",
|
|
945
1089
|
},
|
|
1090
|
+
csharp: {
|
|
1091
|
+
method: 'Matches.List',
|
|
1092
|
+
example: 'MatchListParams parameters = new();\n\nvar page = await client.Matches.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
1093
|
+
},
|
|
946
1094
|
go: {
|
|
947
1095
|
method: 'client.Matches.List',
|
|
948
1096
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Matches.List(context.TODO(), believe.MatchListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -958,6 +1106,10 @@ const EMBEDDED_METHODS = [
|
|
|
958
1106
|
method: 'matches().list',
|
|
959
1107
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.MatchListPage\nimport com.believe.api.models.matches.MatchListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: MatchListPage = client.matches().list()\n}',
|
|
960
1108
|
},
|
|
1109
|
+
php: {
|
|
1110
|
+
method: 'matches->list',
|
|
1111
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->matches->list(\n limit: 10,\n matchType: MatchType::LEAGUE,\n result: MatchResult::WIN,\n skip: 0,\n teamID: 'team_id',\n);\n\nvar_dump($page);",
|
|
1112
|
+
},
|
|
961
1113
|
python: {
|
|
962
1114
|
method: 'matches.list',
|
|
963
1115
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.matches.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -1004,6 +1156,10 @@ const EMBEDDED_METHODS = [
|
|
|
1004
1156
|
method: 'matches create',
|
|
1005
1157
|
example: "believe matches create \\\n --api-key 'My API Key' \\\n --away-team-id tottenham \\\n --date \"'2024-02-20T19:45:00Z'\" \\\n --home-team-id afc-richmond \\\n --match-type cup",
|
|
1006
1158
|
},
|
|
1159
|
+
csharp: {
|
|
1160
|
+
method: 'Matches.Create',
|
|
1161
|
+
example: 'MatchCreateParams parameters = new()\n{\n AwayTeamID = "tottenham",\n Date = DateTimeOffset.Parse("2024-02-20T19:45:00Z"),\n HomeTeamID = "afc-richmond",\n MatchType = MatchType.Cup,\n};\n\nvar match = await client.Matches.Create(parameters);\n\nConsole.WriteLine(match);',
|
|
1162
|
+
},
|
|
1007
1163
|
go: {
|
|
1008
1164
|
method: 'client.Matches.New',
|
|
1009
1165
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\t"time"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tmatch, err := client.Matches.New(context.TODO(), believe.MatchNewParams{\n\t\tAwayTeamID: "tottenham",\n\t\tDate: time.Now(),\n\t\tHomeTeamID: "afc-richmond",\n\t\tMatchType: believe.MatchTypeCup,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", match.ID)\n}\n',
|
|
@@ -1019,6 +1175,10 @@ const EMBEDDED_METHODS = [
|
|
|
1019
1175
|
method: 'matches().create',
|
|
1020
1176
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.Match\nimport com.believe.api.models.matches.MatchCreateParams\nimport com.believe.api.models.matches.MatchType\nimport java.time.OffsetDateTime\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: MatchCreateParams = MatchCreateParams.builder()\n .awayTeamId("tottenham")\n .date(OffsetDateTime.parse("2024-02-20T19:45:00Z"))\n .homeTeamId("afc-richmond")\n .matchType(MatchType.CUP)\n .build()\n val match: Match = client.matches().create(params)\n}',
|
|
1021
1177
|
},
|
|
1178
|
+
php: {
|
|
1179
|
+
method: 'matches->create',
|
|
1180
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$match = $client->matches->create(\n awayTeamID: 'tottenham',\n date: new \\DateTimeImmutable('2024-02-20T19:45:00Z'),\n homeTeamID: 'afc-richmond',\n matchType: MatchType::CUP,\n attendance: 24500,\n awayScore: 0,\n episodeID: 's02e05',\n homeScore: 0,\n lessonLearned: 'It\\'s not about the wins and losses, it\\'s about helping these young fellas be the best versions of themselves.',\n possessionPercentage: 50,\n result: MatchResult::PENDING,\n tedHalftimeSpeech: 'You know what the happiest animal on Earth is? It\\'s a goldfish. You know why? It\\'s got a 10-second memory.',\n ticketRevenueGbp: '735000.00',\n turningPoints: [\n [\n 'description' => 'description',\n 'emotionalImpact' => 'Galvanized the team\\'s fighting spirit',\n 'minute' => 0,\n 'characterInvolved' => 'jamie-tartt',\n ],\n ],\n weatherTempCelsius: 8.5,\n);\n\nvar_dump($match);",
|
|
1181
|
+
},
|
|
1022
1182
|
python: {
|
|
1023
1183
|
method: 'matches.create',
|
|
1024
1184
|
example: 'import os\nfrom datetime import datetime\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nmatch = client.matches.create(\n away_team_id="tottenham",\n date=datetime.fromisoformat("2024-02-20T19:45:00"),\n home_team_id="afc-richmond",\n match_type="cup",\n)\nprint(match.id)',
|
|
@@ -1049,6 +1209,10 @@ const EMBEDDED_METHODS = [
|
|
|
1049
1209
|
method: 'matches retrieve',
|
|
1050
1210
|
example: "believe matches retrieve \\\n --api-key 'My API Key' \\\n --match-id match_id",
|
|
1051
1211
|
},
|
|
1212
|
+
csharp: {
|
|
1213
|
+
method: 'Matches.Retrieve',
|
|
1214
|
+
example: 'MatchRetrieveParams parameters = new() { MatchID = "match_id" };\n\nvar match = await client.Matches.Retrieve(parameters);\n\nConsole.WriteLine(match);',
|
|
1215
|
+
},
|
|
1052
1216
|
go: {
|
|
1053
1217
|
method: 'client.Matches.Get',
|
|
1054
1218
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tmatch, err := client.Matches.Get(context.TODO(), "match_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", match.ID)\n}\n',
|
|
@@ -1064,6 +1228,10 @@ const EMBEDDED_METHODS = [
|
|
|
1064
1228
|
method: 'matches().retrieve',
|
|
1065
1229
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.Match\nimport com.believe.api.models.matches.MatchRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val match: Match = client.matches().retrieve("match_id")\n}',
|
|
1066
1230
|
},
|
|
1231
|
+
php: {
|
|
1232
|
+
method: 'matches->retrieve',
|
|
1233
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$match = $client->matches->retrieve('match_id');\n\nvar_dump($match);",
|
|
1234
|
+
},
|
|
1067
1235
|
python: {
|
|
1068
1236
|
method: 'matches.retrieve',
|
|
1069
1237
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nmatch = client.matches.retrieve(\n "match_id",\n)\nprint(match.id)',
|
|
@@ -1111,6 +1279,10 @@ const EMBEDDED_METHODS = [
|
|
|
1111
1279
|
method: 'matches update',
|
|
1112
1280
|
example: "believe matches update \\\n --api-key 'My API Key' \\\n --match-id match_id",
|
|
1113
1281
|
},
|
|
1282
|
+
csharp: {
|
|
1283
|
+
method: 'Matches.Update',
|
|
1284
|
+
example: 'MatchUpdateParams parameters = new() { MatchID = "match_id" };\n\nvar match = await client.Matches.Update(parameters);\n\nConsole.WriteLine(match);',
|
|
1285
|
+
},
|
|
1114
1286
|
go: {
|
|
1115
1287
|
method: 'client.Matches.Update',
|
|
1116
1288
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tmatch, err := client.Matches.Update(\n\t\tcontext.TODO(),\n\t\t"match_id",\n\t\tbelieve.MatchUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", match.ID)\n}\n',
|
|
@@ -1126,6 +1298,10 @@ const EMBEDDED_METHODS = [
|
|
|
1126
1298
|
method: 'matches().update',
|
|
1127
1299
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.Match\nimport com.believe.api.models.matches.MatchUpdateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val match: Match = client.matches().update("match_id")\n}',
|
|
1128
1300
|
},
|
|
1301
|
+
php: {
|
|
1302
|
+
method: 'matches->update',
|
|
1303
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$match = $client->matches->update(\n 'match_id',\n attendance: 0,\n awayScore: 0,\n awayTeamID: 'away_team_id',\n date: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n episodeID: 'episode_id',\n homeScore: 0,\n homeTeamID: 'home_team_id',\n lessonLearned: 'lesson_learned',\n matchType: MatchType::LEAGUE,\n possessionPercentage: 0,\n result: MatchResult::WIN,\n tedHalftimeSpeech: 'ted_halftime_speech',\n ticketRevenueGbp: 0,\n turningPoints: [\n [\n 'description' => 'description',\n 'emotionalImpact' => 'Galvanized the team\\'s fighting spirit',\n 'minute' => 0,\n 'characterInvolved' => 'jamie-tartt',\n ],\n ],\n weatherTempCelsius: -30,\n);\n\nvar_dump($match);",
|
|
1304
|
+
},
|
|
1129
1305
|
python: {
|
|
1130
1306
|
method: 'matches.update',
|
|
1131
1307
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nmatch = client.matches.update(\n match_id="match_id",\n)\nprint(match.id)',
|
|
@@ -1155,6 +1331,10 @@ const EMBEDDED_METHODS = [
|
|
|
1155
1331
|
method: 'matches delete',
|
|
1156
1332
|
example: "believe matches delete \\\n --api-key 'My API Key' \\\n --match-id match_id",
|
|
1157
1333
|
},
|
|
1334
|
+
csharp: {
|
|
1335
|
+
method: 'Matches.Delete',
|
|
1336
|
+
example: 'MatchDeleteParams parameters = new() { MatchID = "match_id" };\n\nawait client.Matches.Delete(parameters);',
|
|
1337
|
+
},
|
|
1158
1338
|
go: {
|
|
1159
1339
|
method: 'client.Matches.Delete',
|
|
1160
1340
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Matches.Delete(context.TODO(), "match_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -1170,6 +1350,10 @@ const EMBEDDED_METHODS = [
|
|
|
1170
1350
|
method: 'matches().delete',
|
|
1171
1351
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.MatchDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.matches().delete("match_id")\n}',
|
|
1172
1352
|
},
|
|
1353
|
+
php: {
|
|
1354
|
+
method: 'matches->delete',
|
|
1355
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->matches->delete('match_id');\n\nvar_dump($result);",
|
|
1356
|
+
},
|
|
1173
1357
|
python: {
|
|
1174
1358
|
method: 'matches.delete',
|
|
1175
1359
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.matches.delete(\n "match_id",\n)',
|
|
@@ -1200,6 +1384,10 @@ const EMBEDDED_METHODS = [
|
|
|
1200
1384
|
method: 'matches get_turning_points',
|
|
1201
1385
|
example: "believe matches get-turning-points \\\n --api-key 'My API Key' \\\n --match-id match_id",
|
|
1202
1386
|
},
|
|
1387
|
+
csharp: {
|
|
1388
|
+
method: 'Matches.GetTurningPoints',
|
|
1389
|
+
example: 'MatchGetTurningPointsParams parameters = new() { MatchID = "match_id" };\n\nvar response = await client.Matches.GetTurningPoints(parameters);\n\nConsole.WriteLine(response);',
|
|
1390
|
+
},
|
|
1203
1391
|
go: {
|
|
1204
1392
|
method: 'client.Matches.GetTurningPoints',
|
|
1205
1393
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Matches.GetTurningPoints(context.TODO(), "match_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -1215,6 +1403,10 @@ const EMBEDDED_METHODS = [
|
|
|
1215
1403
|
method: 'matches().getTurningPoints',
|
|
1216
1404
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.MatchGetTurningPointsParams\nimport com.believe.api.models.matches.MatchGetTurningPointsResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: List<MatchGetTurningPointsResponse> = client.matches().getTurningPoints("match_id")\n}',
|
|
1217
1405
|
},
|
|
1406
|
+
php: {
|
|
1407
|
+
method: 'matches->getTurningPoints',
|
|
1408
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->matches->getTurningPoints('match_id');\n\nvar_dump($response);",
|
|
1409
|
+
},
|
|
1218
1410
|
python: {
|
|
1219
1411
|
method: 'matches.get_turning_points',
|
|
1220
1412
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.matches.get_turning_points(\n "match_id",\n)\nprint(response)',
|
|
@@ -1245,6 +1437,10 @@ const EMBEDDED_METHODS = [
|
|
|
1245
1437
|
method: 'matches get_lesson',
|
|
1246
1438
|
example: "believe matches get-lesson \\\n --api-key 'My API Key' \\\n --match-id match_id",
|
|
1247
1439
|
},
|
|
1440
|
+
csharp: {
|
|
1441
|
+
method: 'Matches.GetLesson',
|
|
1442
|
+
example: 'MatchGetLessonParams parameters = new() { MatchID = "match_id" };\n\nvar response = await client.Matches.GetLesson(parameters);\n\nConsole.WriteLine(response);',
|
|
1443
|
+
},
|
|
1248
1444
|
go: {
|
|
1249
1445
|
method: 'client.Matches.GetLesson',
|
|
1250
1446
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Matches.GetLesson(context.TODO(), "match_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -1260,6 +1456,10 @@ const EMBEDDED_METHODS = [
|
|
|
1260
1456
|
method: 'matches().getLesson',
|
|
1261
1457
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.MatchGetLessonParams\nimport com.believe.api.models.matches.MatchGetLessonResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: MatchGetLessonResponse = client.matches().getLesson("match_id")\n}',
|
|
1262
1458
|
},
|
|
1459
|
+
php: {
|
|
1460
|
+
method: 'matches->getLesson',
|
|
1461
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->matches->getLesson('match_id');\n\nvar_dump($response);",
|
|
1462
|
+
},
|
|
1263
1463
|
python: {
|
|
1264
1464
|
method: 'matches.get_lesson',
|
|
1265
1465
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.matches.get_lesson(\n "match_id",\n)\nprint(response)',
|
|
@@ -1289,6 +1489,10 @@ const EMBEDDED_METHODS = [
|
|
|
1289
1489
|
method: 'matches stream_live',
|
|
1290
1490
|
example: "believe matches stream-live \\\n --api-key 'My API Key'",
|
|
1291
1491
|
},
|
|
1492
|
+
csharp: {
|
|
1493
|
+
method: 'Matches.StreamLive',
|
|
1494
|
+
example: 'MatchStreamLiveParams parameters = new();\n\nawait client.Matches.StreamLive(parameters);',
|
|
1495
|
+
},
|
|
1292
1496
|
go: {
|
|
1293
1497
|
method: 'client.Matches.StreamLive',
|
|
1294
1498
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Matches.StreamLive(context.TODO(), believe.MatchStreamLiveParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -1304,6 +1508,10 @@ const EMBEDDED_METHODS = [
|
|
|
1304
1508
|
method: 'matches().streamLive',
|
|
1305
1509
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.MatchStreamLiveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.matches().streamLive()\n}',
|
|
1306
1510
|
},
|
|
1511
|
+
php: {
|
|
1512
|
+
method: 'matches->streamLive',
|
|
1513
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->matches->streamLive(\n awayTeam: 'away_team', excitementLevel: 1, homeTeam: 'home_team', speed: 0.1\n);\n\nvar_dump($result);",
|
|
1514
|
+
},
|
|
1307
1515
|
python: {
|
|
1308
1516
|
method: 'matches.stream_live',
|
|
1309
1517
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.matches.stream_live()',
|
|
@@ -1334,6 +1542,10 @@ const EMBEDDED_METHODS = [
|
|
|
1334
1542
|
method: 'commentary stream',
|
|
1335
1543
|
example: "believe matches:commentary stream \\\n --api-key 'My API Key' \\\n --match-id match_id",
|
|
1336
1544
|
},
|
|
1545
|
+
csharp: {
|
|
1546
|
+
method: 'Matches.Commentary.Stream',
|
|
1547
|
+
example: 'CommentaryStreamParams parameters = new() { MatchID = "match_id" };\n\nvar response = await client.Matches.Commentary.Stream(parameters);\n\nConsole.WriteLine(response);',
|
|
1548
|
+
},
|
|
1337
1549
|
go: {
|
|
1338
1550
|
method: 'client.Matches.Commentary.Stream',
|
|
1339
1551
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Matches.Commentary.Stream(context.TODO(), "match_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -1349,6 +1561,10 @@ const EMBEDDED_METHODS = [
|
|
|
1349
1561
|
method: 'matches().commentary().stream',
|
|
1350
1562
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.matches.commentary.CommentaryStreamParams\nimport com.believe.api.models.matches.commentary.CommentaryStreamResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: CommentaryStreamResponse = client.matches().commentary().stream("match_id")\n}',
|
|
1351
1563
|
},
|
|
1564
|
+
php: {
|
|
1565
|
+
method: 'matches->commentary->stream',
|
|
1566
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->matches->commentary->stream('match_id');\n\nvar_dump($response);",
|
|
1567
|
+
},
|
|
1352
1568
|
python: {
|
|
1353
1569
|
method: 'matches.commentary.stream',
|
|
1354
1570
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.matches.commentary.stream(\n "match_id",\n)\nprint(response)',
|
|
@@ -1379,6 +1595,10 @@ const EMBEDDED_METHODS = [
|
|
|
1379
1595
|
method: 'episodes list',
|
|
1380
1596
|
example: "believe episodes list \\\n --api-key 'My API Key'",
|
|
1381
1597
|
},
|
|
1598
|
+
csharp: {
|
|
1599
|
+
method: 'Episodes.List',
|
|
1600
|
+
example: 'EpisodeListParams parameters = new();\n\nvar page = await client.Episodes.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
1601
|
+
},
|
|
1382
1602
|
go: {
|
|
1383
1603
|
method: 'client.Episodes.List',
|
|
1384
1604
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Episodes.List(context.TODO(), believe.EpisodeListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -1394,6 +1614,10 @@ const EMBEDDED_METHODS = [
|
|
|
1394
1614
|
method: 'episodes().list',
|
|
1395
1615
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.episodes.EpisodeListPage\nimport com.believe.api.models.episodes.EpisodeListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: EpisodeListPage = client.episodes().list()\n}',
|
|
1396
1616
|
},
|
|
1617
|
+
php: {
|
|
1618
|
+
method: 'episodes->list',
|
|
1619
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->episodes->list(\n characterFocus: 'character_focus', limit: 10, season: 1, skip: 0\n);\n\nvar_dump($page);",
|
|
1620
|
+
},
|
|
1397
1621
|
python: {
|
|
1398
1622
|
method: 'episodes.list',
|
|
1399
1623
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.episodes.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -1440,6 +1664,10 @@ const EMBEDDED_METHODS = [
|
|
|
1440
1664
|
method: 'episodes create',
|
|
1441
1665
|
example: "believe episodes create \\\n --api-key 'My API Key' \\\n --air-date \"'2020-10-02'\" \\\n --character-focus ted-lasso \\\n --character-focus coach-beard \\\n --character-focus higgins \\\n --character-focus nate \\\n --director 'MJ Delaney' \\\n --episode-number 8 \\\n --main-theme 'The power of vulnerability and male friendship' \\\n --runtime-minutes 29 \\\n --season 1 \\\n --synopsis 'Ted creates a support group for the coaching staff while Rebecca faces a difficult decision about her future.' \\\n --ted-wisdom \"There's two buttons I never like to hit: that's panic and snooze.\" \\\n --title 'The Diamond Dogs' \\\n --writer 'Jason Sudeikis, Brendan Hunt, Joe Kelly'",
|
|
1442
1666
|
},
|
|
1667
|
+
csharp: {
|
|
1668
|
+
method: 'Episodes.Create',
|
|
1669
|
+
example: 'EpisodeCreateParams parameters = new()\n{\n AirDate = "2020-10-02",\n CharacterFocus =\n [\n "ted-lasso", "coach-beard", "higgins", "nate"\n ],\n Director = "MJ Delaney",\n EpisodeNumber = 8,\n MainTheme = "The power of vulnerability and male friendship",\n RuntimeMinutes = 29,\n Season = 1,\n Synopsis = "Ted creates a support group for the coaching staff while Rebecca faces a difficult decision about her future.",\n TedWisdom = "There\'s two buttons I never like to hit: that\'s panic and snooze.",\n Title = "The Diamond Dogs",\n Writer = "Jason Sudeikis, Brendan Hunt, Joe Kelly",\n};\n\nvar episode = await client.Episodes.Create(parameters);\n\nConsole.WriteLine(episode);',
|
|
1670
|
+
},
|
|
1443
1671
|
go: {
|
|
1444
1672
|
method: 'client.Episodes.New',
|
|
1445
1673
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\t"time"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tepisode, err := client.Episodes.New(context.TODO(), believe.EpisodeNewParams{\n\t\tAirDate: time.Now(),\n\t\tCharacterFocus: []string{"ted-lasso", "coach-beard", "higgins", "nate"},\n\t\tDirector: "MJ Delaney",\n\t\tEpisodeNumber: 8,\n\t\tMainTheme: "The power of vulnerability and male friendship",\n\t\tRuntimeMinutes: 29,\n\t\tSeason: 1,\n\t\tSynopsis: "Ted creates a support group for the coaching staff while Rebecca faces a difficult decision about her future.",\n\t\tTedWisdom: "There\'s two buttons I never like to hit: that\'s panic and snooze.",\n\t\tTitle: "The Diamond Dogs",\n\t\tWriter: "Jason Sudeikis, Brendan Hunt, Joe Kelly",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", episode.ID)\n}\n',
|
|
@@ -1455,6 +1683,10 @@ const EMBEDDED_METHODS = [
|
|
|
1455
1683
|
method: 'episodes().create',
|
|
1456
1684
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.episodes.Episode\nimport com.believe.api.models.episodes.EpisodeCreateParams\nimport java.time.LocalDate\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: EpisodeCreateParams = EpisodeCreateParams.builder()\n .airDate(LocalDate.parse("2020-10-02"))\n .characterFocus(listOf(\n "ted-lasso",\n "coach-beard",\n "higgins",\n "nate",\n ))\n .director("MJ Delaney")\n .episodeNumber(8L)\n .mainTheme("The power of vulnerability and male friendship")\n .runtimeMinutes(29L)\n .season(1L)\n .synopsis("Ted creates a support group for the coaching staff while Rebecca faces a difficult decision about her future.")\n .tedWisdom("There\'s two buttons I never like to hit: that\'s panic and snooze.")\n .title("The Diamond Dogs")\n .writer("Jason Sudeikis, Brendan Hunt, Joe Kelly")\n .build()\n val episode: Episode = client.episodes().create(params)\n}',
|
|
1457
1685
|
},
|
|
1686
|
+
php: {
|
|
1687
|
+
method: 'episodes->create',
|
|
1688
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$episode = $client->episodes->create(\n airDate: '2020-10-02',\n characterFocus: ['ted-lasso', 'coach-beard', 'higgins', 'nate'],\n director: 'MJ Delaney',\n episodeNumber: 8,\n mainTheme: 'The power of vulnerability and male friendship',\n runtimeMinutes: 29,\n season: 1,\n synopsis: 'Ted creates a support group for the coaching staff while Rebecca faces a difficult decision about her future.',\n tedWisdom: 'There\\'s two buttons I never like to hit: that\\'s panic and snooze.',\n title: 'The Diamond Dogs',\n writer: 'Jason Sudeikis, Brendan Hunt, Joe Kelly',\n biscuitsWithBossMoment: 'Ted and Rebecca have an honest conversation about trust.',\n memorableMoments: [\n 'First Diamond Dogs meeting',\n 'The famous dart scene with Rupert',\n 'Be curious, not judgmental speech',\n ],\n usViewersMillions: 1.42,\n viewerRating: 9.1,\n);\n\nvar_dump($episode);",
|
|
1689
|
+
},
|
|
1458
1690
|
python: {
|
|
1459
1691
|
method: 'episodes.create',
|
|
1460
1692
|
example: 'import os\nfrom datetime import date\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nepisode = client.episodes.create(\n air_date=date.fromisoformat("2020-10-02"),\n character_focus=["ted-lasso", "coach-beard", "higgins", "nate"],\n director="MJ Delaney",\n episode_number=8,\n main_theme="The power of vulnerability and male friendship",\n runtime_minutes=29,\n season=1,\n synopsis="Ted creates a support group for the coaching staff while Rebecca faces a difficult decision about her future.",\n ted_wisdom="There\'s two buttons I never like to hit: that\'s panic and snooze.",\n title="The Diamond Dogs",\n writer="Jason Sudeikis, Brendan Hunt, Joe Kelly",\n)\nprint(episode.id)',
|
|
@@ -1485,6 +1717,10 @@ const EMBEDDED_METHODS = [
|
|
|
1485
1717
|
method: 'episodes retrieve',
|
|
1486
1718
|
example: "believe episodes retrieve \\\n --api-key 'My API Key' \\\n --episode-id episode_id",
|
|
1487
1719
|
},
|
|
1720
|
+
csharp: {
|
|
1721
|
+
method: 'Episodes.Retrieve',
|
|
1722
|
+
example: 'EpisodeRetrieveParams parameters = new() { EpisodeID = "episode_id" };\n\nvar episode = await client.Episodes.Retrieve(parameters);\n\nConsole.WriteLine(episode);',
|
|
1723
|
+
},
|
|
1488
1724
|
go: {
|
|
1489
1725
|
method: 'client.Episodes.Get',
|
|
1490
1726
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tepisode, err := client.Episodes.Get(context.TODO(), "episode_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", episode.ID)\n}\n',
|
|
@@ -1500,6 +1736,10 @@ const EMBEDDED_METHODS = [
|
|
|
1500
1736
|
method: 'episodes().retrieve',
|
|
1501
1737
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.episodes.Episode\nimport com.believe.api.models.episodes.EpisodeRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val episode: Episode = client.episodes().retrieve("episode_id")\n}',
|
|
1502
1738
|
},
|
|
1739
|
+
php: {
|
|
1740
|
+
method: 'episodes->retrieve',
|
|
1741
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$episode = $client->episodes->retrieve('episode_id');\n\nvar_dump($episode);",
|
|
1742
|
+
},
|
|
1503
1743
|
python: {
|
|
1504
1744
|
method: 'episodes.retrieve',
|
|
1505
1745
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nepisode = client.episodes.retrieve(\n "episode_id",\n)\nprint(episode.id)',
|
|
@@ -1547,6 +1787,10 @@ const EMBEDDED_METHODS = [
|
|
|
1547
1787
|
method: 'episodes update',
|
|
1548
1788
|
example: "believe episodes update \\\n --api-key 'My API Key' \\\n --episode-id episode_id",
|
|
1549
1789
|
},
|
|
1790
|
+
csharp: {
|
|
1791
|
+
method: 'Episodes.Update',
|
|
1792
|
+
example: 'EpisodeUpdateParams parameters = new() { EpisodeID = "episode_id" };\n\nvar episode = await client.Episodes.Update(parameters);\n\nConsole.WriteLine(episode);',
|
|
1793
|
+
},
|
|
1550
1794
|
go: {
|
|
1551
1795
|
method: 'client.Episodes.Update',
|
|
1552
1796
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tepisode, err := client.Episodes.Update(\n\t\tcontext.TODO(),\n\t\t"episode_id",\n\t\tbelieve.EpisodeUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", episode.ID)\n}\n',
|
|
@@ -1562,6 +1806,10 @@ const EMBEDDED_METHODS = [
|
|
|
1562
1806
|
method: 'episodes().update',
|
|
1563
1807
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.episodes.Episode\nimport com.believe.api.models.episodes.EpisodeUpdateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val episode: Episode = client.episodes().update("episode_id")\n}',
|
|
1564
1808
|
},
|
|
1809
|
+
php: {
|
|
1810
|
+
method: 'episodes->update',
|
|
1811
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$episode = $client->episodes->update(\n 'episode_id',\n airDate: '2019-12-27',\n biscuitsWithBossMoment: 'biscuits_with_boss_moment',\n characterFocus: ['string'],\n director: 'director',\n episodeNumber: 1,\n mainTheme: 'main_theme',\n memorableMoments: ['string'],\n runtimeMinutes: 20,\n season: 1,\n synopsis: 'synopsis',\n tedWisdom: 'ted_wisdom',\n title: 'x',\n usViewersMillions: 0,\n viewerRating: 0,\n writer: 'writer',\n);\n\nvar_dump($episode);",
|
|
1812
|
+
},
|
|
1565
1813
|
python: {
|
|
1566
1814
|
method: 'episodes.update',
|
|
1567
1815
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nepisode = client.episodes.update(\n episode_id="episode_id",\n)\nprint(episode.id)',
|
|
@@ -1591,6 +1839,10 @@ const EMBEDDED_METHODS = [
|
|
|
1591
1839
|
method: 'episodes delete',
|
|
1592
1840
|
example: "believe episodes delete \\\n --api-key 'My API Key' \\\n --episode-id episode_id",
|
|
1593
1841
|
},
|
|
1842
|
+
csharp: {
|
|
1843
|
+
method: 'Episodes.Delete',
|
|
1844
|
+
example: 'EpisodeDeleteParams parameters = new() { EpisodeID = "episode_id" };\n\nawait client.Episodes.Delete(parameters);',
|
|
1845
|
+
},
|
|
1594
1846
|
go: {
|
|
1595
1847
|
method: 'client.Episodes.Delete',
|
|
1596
1848
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Episodes.Delete(context.TODO(), "episode_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -1606,6 +1858,10 @@ const EMBEDDED_METHODS = [
|
|
|
1606
1858
|
method: 'episodes().delete',
|
|
1607
1859
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.episodes.EpisodeDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.episodes().delete("episode_id")\n}',
|
|
1608
1860
|
},
|
|
1861
|
+
php: {
|
|
1862
|
+
method: 'episodes->delete',
|
|
1863
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->episodes->delete('episode_id');\n\nvar_dump($result);",
|
|
1864
|
+
},
|
|
1609
1865
|
python: {
|
|
1610
1866
|
method: 'episodes.delete',
|
|
1611
1867
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.episodes.delete(\n "episode_id",\n)',
|
|
@@ -1636,6 +1892,10 @@ const EMBEDDED_METHODS = [
|
|
|
1636
1892
|
method: 'episodes get_wisdom',
|
|
1637
1893
|
example: "believe episodes get-wisdom \\\n --api-key 'My API Key' \\\n --episode-id episode_id",
|
|
1638
1894
|
},
|
|
1895
|
+
csharp: {
|
|
1896
|
+
method: 'Episodes.GetWisdom',
|
|
1897
|
+
example: 'EpisodeGetWisdomParams parameters = new() { EpisodeID = "episode_id" };\n\nvar response = await client.Episodes.GetWisdom(parameters);\n\nConsole.WriteLine(response);',
|
|
1898
|
+
},
|
|
1639
1899
|
go: {
|
|
1640
1900
|
method: 'client.Episodes.GetWisdom',
|
|
1641
1901
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Episodes.GetWisdom(context.TODO(), "episode_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -1651,6 +1911,10 @@ const EMBEDDED_METHODS = [
|
|
|
1651
1911
|
method: 'episodes().getWisdom',
|
|
1652
1912
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.episodes.EpisodeGetWisdomParams\nimport com.believe.api.models.episodes.EpisodeGetWisdomResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: EpisodeGetWisdomResponse = client.episodes().getWisdom("episode_id")\n}',
|
|
1653
1913
|
},
|
|
1914
|
+
php: {
|
|
1915
|
+
method: 'episodes->getWisdom',
|
|
1916
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->episodes->getWisdom('episode_id');\n\nvar_dump($response);",
|
|
1917
|
+
},
|
|
1654
1918
|
python: {
|
|
1655
1919
|
method: 'episodes.get_wisdom',
|
|
1656
1920
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.episodes.get_wisdom(\n "episode_id",\n)\nprint(response)',
|
|
@@ -1689,6 +1953,10 @@ const EMBEDDED_METHODS = [
|
|
|
1689
1953
|
method: 'quotes list',
|
|
1690
1954
|
example: "believe quotes list \\\n --api-key 'My API Key'",
|
|
1691
1955
|
},
|
|
1956
|
+
csharp: {
|
|
1957
|
+
method: 'Quotes.List',
|
|
1958
|
+
example: 'QuoteListParams parameters = new();\n\nvar page = await client.Quotes.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
1959
|
+
},
|
|
1692
1960
|
go: {
|
|
1693
1961
|
method: 'client.Quotes.List',
|
|
1694
1962
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Quotes.List(context.TODO(), believe.QuoteListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -1704,6 +1972,10 @@ const EMBEDDED_METHODS = [
|
|
|
1704
1972
|
method: 'quotes().list',
|
|
1705
1973
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.QuoteListPage\nimport com.believe.api.models.quotes.QuoteListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: QuoteListPage = client.quotes().list()\n}',
|
|
1706
1974
|
},
|
|
1975
|
+
php: {
|
|
1976
|
+
method: 'quotes->list',
|
|
1977
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->quotes->list(\n characterID: 'character_id',\n funny: true,\n inspirational: true,\n limit: 10,\n momentType: QuoteMoment::HALFTIME_SPEECH,\n skip: 0,\n theme: QuoteTheme::BELIEF,\n);\n\nvar_dump($page);",
|
|
1978
|
+
},
|
|
1707
1979
|
python: {
|
|
1708
1980
|
method: 'quotes.list',
|
|
1709
1981
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.quotes.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -1746,6 +2018,10 @@ const EMBEDDED_METHODS = [
|
|
|
1746
2018
|
method: 'quotes create',
|
|
1747
2019
|
example: "believe quotes create \\\n --api-key 'My API Key' \\\n --character-id ted-lasso \\\n --context \"Ted's first team meeting, revealing his coaching philosophy\" \\\n --moment-type locker_room \\\n --text 'I believe in believe.' \\\n --theme belief",
|
|
1748
2020
|
},
|
|
2021
|
+
csharp: {
|
|
2022
|
+
method: 'Quotes.Create',
|
|
2023
|
+
example: 'QuoteCreateParams parameters = new()\n{\n CharacterID = "ted-lasso",\n Context = "Ted\'s first team meeting, revealing his coaching philosophy",\n MomentType = QuoteMoment.LockerRoom,\n Text = "I believe in believe.",\n Theme = QuoteTheme.Belief,\n};\n\nvar quote = await client.Quotes.Create(parameters);\n\nConsole.WriteLine(quote);',
|
|
2024
|
+
},
|
|
1749
2025
|
go: {
|
|
1750
2026
|
method: 'client.Quotes.New',
|
|
1751
2027
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tquote, err := client.Quotes.New(context.TODO(), believe.QuoteNewParams{\n\t\tCharacterID: "ted-lasso",\n\t\tContext: "Ted\'s first team meeting, revealing his coaching philosophy",\n\t\tMomentType: believe.QuoteMomentLockerRoom,\n\t\tText: "I believe in believe.",\n\t\tTheme: believe.QuoteThemeBelief,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", quote.ID)\n}\n',
|
|
@@ -1761,6 +2037,10 @@ const EMBEDDED_METHODS = [
|
|
|
1761
2037
|
method: 'quotes().create',
|
|
1762
2038
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.Quote\nimport com.believe.api.models.quotes.QuoteCreateParams\nimport com.believe.api.models.quotes.QuoteMoment\nimport com.believe.api.models.quotes.QuoteTheme\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: QuoteCreateParams = QuoteCreateParams.builder()\n .characterId("ted-lasso")\n .context("Ted\'s first team meeting, revealing his coaching philosophy")\n .momentType(QuoteMoment.LOCKER_ROOM)\n .text("I believe in believe.")\n .theme(QuoteTheme.BELIEF)\n .build()\n val quote: Quote = client.quotes().create(params)\n}',
|
|
1763
2039
|
},
|
|
2040
|
+
php: {
|
|
2041
|
+
method: 'quotes->create',
|
|
2042
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$quote = $client->quotes->create(\n characterID: 'ted-lasso',\n context: 'Ted\\'s first team meeting, revealing his coaching philosophy',\n momentType: QuoteMoment::LOCKER_ROOM,\n text: 'I believe in believe.',\n theme: QuoteTheme::BELIEF,\n episodeID: 's01e01',\n isFunny: false,\n isInspirational: true,\n popularityScore: 98.5,\n secondaryThemes: [QuoteTheme::LEADERSHIP, QuoteTheme::TEAMWORK],\n timesShared: 250000,\n);\n\nvar_dump($quote);",
|
|
2043
|
+
},
|
|
1764
2044
|
python: {
|
|
1765
2045
|
method: 'quotes.create',
|
|
1766
2046
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nquote = client.quotes.create(\n character_id="ted-lasso",\n context="Ted\'s first team meeting, revealing his coaching philosophy",\n moment_type="locker_room",\n text="I believe in believe.",\n theme="belief",\n)\nprint(quote.id)',
|
|
@@ -1791,6 +2071,10 @@ const EMBEDDED_METHODS = [
|
|
|
1791
2071
|
method: 'quotes get_random',
|
|
1792
2072
|
example: "believe quotes get-random \\\n --api-key 'My API Key'",
|
|
1793
2073
|
},
|
|
2074
|
+
csharp: {
|
|
2075
|
+
method: 'Quotes.GetRandom',
|
|
2076
|
+
example: 'QuoteGetRandomParams parameters = new();\n\nvar quote = await client.Quotes.GetRandom(parameters);\n\nConsole.WriteLine(quote);',
|
|
2077
|
+
},
|
|
1794
2078
|
go: {
|
|
1795
2079
|
method: 'client.Quotes.GetRandom',
|
|
1796
2080
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tquote, err := client.Quotes.GetRandom(context.TODO(), believe.QuoteGetRandomParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", quote.ID)\n}\n',
|
|
@@ -1806,6 +2090,10 @@ const EMBEDDED_METHODS = [
|
|
|
1806
2090
|
method: 'quotes().getRandom',
|
|
1807
2091
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.Quote\nimport com.believe.api.models.quotes.QuoteGetRandomParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val quote: Quote = client.quotes().getRandom()\n}',
|
|
1808
2092
|
},
|
|
2093
|
+
php: {
|
|
2094
|
+
method: 'quotes->getRandom',
|
|
2095
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$quote = $client->quotes->getRandom(\n characterID: 'character_id', inspirational: true, theme: QuoteTheme::BELIEF\n);\n\nvar_dump($quote);",
|
|
2096
|
+
},
|
|
1809
2097
|
python: {
|
|
1810
2098
|
method: 'quotes.get_random',
|
|
1811
2099
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nquote = client.quotes.get_random()\nprint(quote.id)',
|
|
@@ -1836,6 +2124,10 @@ const EMBEDDED_METHODS = [
|
|
|
1836
2124
|
method: 'quotes retrieve',
|
|
1837
2125
|
example: "believe quotes retrieve \\\n --api-key 'My API Key' \\\n --quote-id quote_id",
|
|
1838
2126
|
},
|
|
2127
|
+
csharp: {
|
|
2128
|
+
method: 'Quotes.Retrieve',
|
|
2129
|
+
example: 'QuoteRetrieveParams parameters = new() { QuoteID = "quote_id" };\n\nvar quote = await client.Quotes.Retrieve(parameters);\n\nConsole.WriteLine(quote);',
|
|
2130
|
+
},
|
|
1839
2131
|
go: {
|
|
1840
2132
|
method: 'client.Quotes.Get',
|
|
1841
2133
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tquote, err := client.Quotes.Get(context.TODO(), "quote_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", quote.ID)\n}\n',
|
|
@@ -1851,6 +2143,10 @@ const EMBEDDED_METHODS = [
|
|
|
1851
2143
|
method: 'quotes().retrieve',
|
|
1852
2144
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.Quote\nimport com.believe.api.models.quotes.QuoteRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val quote: Quote = client.quotes().retrieve("quote_id")\n}',
|
|
1853
2145
|
},
|
|
2146
|
+
php: {
|
|
2147
|
+
method: 'quotes->retrieve',
|
|
2148
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$quote = $client->quotes->retrieve('quote_id');\n\nvar_dump($quote);",
|
|
2149
|
+
},
|
|
1854
2150
|
python: {
|
|
1855
2151
|
method: 'quotes.retrieve',
|
|
1856
2152
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nquote = client.quotes.retrieve(\n "quote_id",\n)\nprint(quote.id)',
|
|
@@ -1894,6 +2190,10 @@ const EMBEDDED_METHODS = [
|
|
|
1894
2190
|
method: 'quotes update',
|
|
1895
2191
|
example: "believe quotes update \\\n --api-key 'My API Key' \\\n --quote-id quote_id",
|
|
1896
2192
|
},
|
|
2193
|
+
csharp: {
|
|
2194
|
+
method: 'Quotes.Update',
|
|
2195
|
+
example: 'QuoteUpdateParams parameters = new() { QuoteID = "quote_id" };\n\nvar quote = await client.Quotes.Update(parameters);\n\nConsole.WriteLine(quote);',
|
|
2196
|
+
},
|
|
1897
2197
|
go: {
|
|
1898
2198
|
method: 'client.Quotes.Update',
|
|
1899
2199
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tquote, err := client.Quotes.Update(\n\t\tcontext.TODO(),\n\t\t"quote_id",\n\t\tbelieve.QuoteUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", quote.ID)\n}\n',
|
|
@@ -1909,6 +2209,10 @@ const EMBEDDED_METHODS = [
|
|
|
1909
2209
|
method: 'quotes().update',
|
|
1910
2210
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.Quote\nimport com.believe.api.models.quotes.QuoteUpdateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val quote: Quote = client.quotes().update("quote_id")\n}',
|
|
1911
2211
|
},
|
|
2212
|
+
php: {
|
|
2213
|
+
method: 'quotes->update',
|
|
2214
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$quote = $client->quotes->update(\n 'quote_id',\n characterID: 'character_id',\n context: 'context',\n episodeID: 'episode_id',\n isFunny: true,\n isInspirational: true,\n momentType: QuoteMoment::HALFTIME_SPEECH,\n popularityScore: 0,\n secondaryThemes: [QuoteTheme::BELIEF],\n text: 'x',\n theme: QuoteTheme::BELIEF,\n timesShared: 0,\n);\n\nvar_dump($quote);",
|
|
2215
|
+
},
|
|
1912
2216
|
python: {
|
|
1913
2217
|
method: 'quotes.update',
|
|
1914
2218
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nquote = client.quotes.update(\n quote_id="quote_id",\n)\nprint(quote.id)',
|
|
@@ -1938,6 +2242,10 @@ const EMBEDDED_METHODS = [
|
|
|
1938
2242
|
method: 'quotes delete',
|
|
1939
2243
|
example: "believe quotes delete \\\n --api-key 'My API Key' \\\n --quote-id quote_id",
|
|
1940
2244
|
},
|
|
2245
|
+
csharp: {
|
|
2246
|
+
method: 'Quotes.Delete',
|
|
2247
|
+
example: 'QuoteDeleteParams parameters = new() { QuoteID = "quote_id" };\n\nawait client.Quotes.Delete(parameters);',
|
|
2248
|
+
},
|
|
1941
2249
|
go: {
|
|
1942
2250
|
method: 'client.Quotes.Delete',
|
|
1943
2251
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Quotes.Delete(context.TODO(), "quote_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -1953,6 +2261,10 @@ const EMBEDDED_METHODS = [
|
|
|
1953
2261
|
method: 'quotes().delete',
|
|
1954
2262
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.QuoteDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.quotes().delete("quote_id")\n}',
|
|
1955
2263
|
},
|
|
2264
|
+
php: {
|
|
2265
|
+
method: 'quotes->delete',
|
|
2266
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->quotes->delete('quote_id');\n\nvar_dump($result);",
|
|
2267
|
+
},
|
|
1956
2268
|
python: {
|
|
1957
2269
|
method: 'quotes.delete',
|
|
1958
2270
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.quotes.delete(\n "quote_id",\n)',
|
|
@@ -1983,6 +2295,10 @@ const EMBEDDED_METHODS = [
|
|
|
1983
2295
|
method: 'quotes list_by_theme',
|
|
1984
2296
|
example: "believe quotes list-by-theme \\\n --api-key 'My API Key' \\\n --theme belief",
|
|
1985
2297
|
},
|
|
2298
|
+
csharp: {
|
|
2299
|
+
method: 'Quotes.ListByTheme',
|
|
2300
|
+
example: 'QuoteListByThemeParams parameters = new() { Theme = QuoteTheme.Belief };\n\nvar page = await client.Quotes.ListByTheme(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
2301
|
+
},
|
|
1986
2302
|
go: {
|
|
1987
2303
|
method: 'client.Quotes.ListByTheme',
|
|
1988
2304
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Quotes.ListByTheme(\n\t\tcontext.TODO(),\n\t\tbelieve.QuoteThemeBelief,\n\t\tbelieve.QuoteListByThemeParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -1998,6 +2314,10 @@ const EMBEDDED_METHODS = [
|
|
|
1998
2314
|
method: 'quotes().listByTheme',
|
|
1999
2315
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.QuoteListByThemePage\nimport com.believe.api.models.quotes.QuoteListByThemeParams\nimport com.believe.api.models.quotes.QuoteTheme\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: QuoteListByThemePage = client.quotes().listByTheme(QuoteTheme.BELIEF)\n}',
|
|
2000
2316
|
},
|
|
2317
|
+
php: {
|
|
2318
|
+
method: 'quotes->listByTheme',
|
|
2319
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->quotes->listByTheme(QuoteTheme::BELIEF, limit: 10, skip: 0);\n\nvar_dump($page);",
|
|
2320
|
+
},
|
|
2001
2321
|
python: {
|
|
2002
2322
|
method: 'quotes.list_by_theme',
|
|
2003
2323
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.quotes.list_by_theme(\n theme="belief",\n)\npage = page.data[0]\nprint(page.id)',
|
|
@@ -2028,6 +2348,10 @@ const EMBEDDED_METHODS = [
|
|
|
2028
2348
|
method: 'quotes list_by_character',
|
|
2029
2349
|
example: "believe quotes list-by-character \\\n --api-key 'My API Key' \\\n --character-id character_id",
|
|
2030
2350
|
},
|
|
2351
|
+
csharp: {
|
|
2352
|
+
method: 'Quotes.ListByCharacter',
|
|
2353
|
+
example: 'QuoteListByCharacterParams parameters = new() { CharacterID = "character_id" };\n\nvar page = await client.Quotes.ListByCharacter(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
2354
|
+
},
|
|
2031
2355
|
go: {
|
|
2032
2356
|
method: 'client.Quotes.ListByCharacter',
|
|
2033
2357
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Quotes.ListByCharacter(\n\t\tcontext.TODO(),\n\t\t"character_id",\n\t\tbelieve.QuoteListByCharacterParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2043,6 +2367,10 @@ const EMBEDDED_METHODS = [
|
|
|
2043
2367
|
method: 'quotes().listByCharacter',
|
|
2044
2368
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.quotes.QuoteListByCharacterPage\nimport com.believe.api.models.quotes.QuoteListByCharacterParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: QuoteListByCharacterPage = client.quotes().listByCharacter("character_id")\n}',
|
|
2045
2369
|
},
|
|
2370
|
+
php: {
|
|
2371
|
+
method: 'quotes->listByCharacter',
|
|
2372
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->quotes->listByCharacter('character_id', limit: 10, skip: 0);\n\nvar_dump($page);",
|
|
2373
|
+
},
|
|
2046
2374
|
python: {
|
|
2047
2375
|
method: 'quotes.list_by_character',
|
|
2048
2376
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.quotes.list_by_character(\n character_id="character_id",\n)\npage = page.data[0]\nprint(page.id)',
|
|
@@ -2073,6 +2401,10 @@ const EMBEDDED_METHODS = [
|
|
|
2073
2401
|
method: 'believe submit',
|
|
2074
2402
|
example: "believe believe submit \\\n --api-key 'My API Key' \\\n --situation \"I just got passed over for a promotion I've been working toward for two years.\" \\\n --situation-type work_challenge",
|
|
2075
2403
|
},
|
|
2404
|
+
csharp: {
|
|
2405
|
+
method: 'Believe.Submit',
|
|
2406
|
+
example: 'BelieveSubmitParams parameters = new()\n{\n Situation = "I just got passed over for a promotion I\'ve been working toward for two years.",\n SituationType = SituationType.WorkChallenge,\n};\n\nvar response = await client.Believe.Submit(parameters);\n\nConsole.WriteLine(response);',
|
|
2407
|
+
},
|
|
2076
2408
|
go: {
|
|
2077
2409
|
method: 'client.Believe.Submit',
|
|
2078
2410
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Believe.Submit(context.TODO(), believe.BelieveSubmitParams{\n\t\tSituation: "I just got passed over for a promotion I\'ve been working toward for two years.",\n\t\tSituationType: believe.BelieveSubmitParamsSituationTypeWorkChallenge,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ActionSuggestion)\n}\n',
|
|
@@ -2088,6 +2420,10 @@ const EMBEDDED_METHODS = [
|
|
|
2088
2420
|
method: 'believe().submit',
|
|
2089
2421
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.believe.BelieveSubmitParams\nimport com.believe.api.models.believe.BelieveSubmitResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: BelieveSubmitParams = BelieveSubmitParams.builder()\n .situation("I just got passed over for a promotion I\'ve been working toward for two years.")\n .situationType(BelieveSubmitParams.SituationType.WORK_CHALLENGE)\n .build()\n val response: BelieveSubmitResponse = client.believe().submit(params)\n}',
|
|
2090
2422
|
},
|
|
2423
|
+
php: {
|
|
2424
|
+
method: 'believe->submit',
|
|
2425
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->believe->submit(\n situation: 'I just got passed over for a promotion I\\'ve been working toward for two years.',\n situationType: 'work_challenge',\n context: 'I\\'ve always tried to be a team player and support my colleagues.',\n intensity: 7,\n);\n\nvar_dump($response);",
|
|
2426
|
+
},
|
|
2091
2427
|
python: {
|
|
2092
2428
|
method: 'believe.submit',
|
|
2093
2429
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.believe.submit(\n situation="I just got passed over for a promotion I\'ve been working toward for two years.",\n situation_type="work_challenge",\n)\nprint(response.action_suggestion)',
|
|
@@ -2123,6 +2459,10 @@ const EMBEDDED_METHODS = [
|
|
|
2123
2459
|
method: 'conflicts resolve',
|
|
2124
2460
|
example: "believe conflicts resolve \\\n --api-key 'My API Key' \\\n --conflict-type interpersonal \\\n --description \"Alex keeps taking credit for my ideas in meetings and I'm getting resentful.\" \\\n --parties-involved Me \\\n --parties-involved 'My teammate Alex'",
|
|
2125
2461
|
},
|
|
2462
|
+
csharp: {
|
|
2463
|
+
method: 'Conflicts.Resolve',
|
|
2464
|
+
example: 'ConflictResolveParams parameters = new()\n{\n ConflictType = ConflictType.Interpersonal,\n Description = "Alex keeps taking credit for my ideas in meetings and I\'m getting resentful.",\n PartiesInvolved =\n [\n "Me", "My teammate Alex"\n ],\n};\n\nvar response = await client.Conflicts.Resolve(parameters);\n\nConsole.WriteLine(response);',
|
|
2465
|
+
},
|
|
2126
2466
|
go: {
|
|
2127
2467
|
method: 'client.Conflicts.Resolve',
|
|
2128
2468
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Conflicts.Resolve(context.TODO(), believe.ConflictResolveParams{\n\t\tConflictType: believe.ConflictResolveParamsConflictTypeInterpersonal,\n\t\tDescription: "Alex keeps taking credit for my ideas in meetings and I\'m getting resentful.",\n\t\tPartiesInvolved: []string{"Me", "My teammate Alex"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.BarbecueSauceWisdom)\n}\n',
|
|
@@ -2138,6 +2478,10 @@ const EMBEDDED_METHODS = [
|
|
|
2138
2478
|
method: 'conflicts().resolve',
|
|
2139
2479
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.conflicts.ConflictResolveParams\nimport com.believe.api.models.conflicts.ConflictResolveResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: ConflictResolveParams = ConflictResolveParams.builder()\n .conflictType(ConflictResolveParams.ConflictType.INTERPERSONAL)\n .description("Alex keeps taking credit for my ideas in meetings and I\'m getting resentful.")\n .addPartiesInvolved("Me")\n .addPartiesInvolved("My teammate Alex")\n .build()\n val response: ConflictResolveResponse = client.conflicts().resolve(params)\n}',
|
|
2140
2480
|
},
|
|
2481
|
+
php: {
|
|
2482
|
+
method: 'conflicts->resolve',
|
|
2483
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->conflicts->resolve(\n conflictType: 'interpersonal',\n description: 'Alex keeps taking credit for my ideas in meetings and I\\'m getting resentful.',\n partiesInvolved: ['Me', 'My teammate Alex'],\n attemptsMade: ['Mentioned it casually', 'Avoided them'],\n);\n\nvar_dump($response);",
|
|
2484
|
+
},
|
|
2141
2485
|
python: {
|
|
2142
2486
|
method: 'conflicts.resolve',
|
|
2143
2487
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.conflicts.resolve(\n conflict_type="interpersonal",\n description="Alex keeps taking credit for my ideas in meetings and I\'m getting resentful.",\n parties_involved=["Me", "My teammate Alex"],\n)\nprint(response.barbecue_sauce_wisdom)',
|
|
@@ -2168,6 +2512,10 @@ const EMBEDDED_METHODS = [
|
|
|
2168
2512
|
method: 'reframe transform_negative_thoughts',
|
|
2169
2513
|
example: "believe reframe transform-negative-thoughts \\\n --api-key 'My API Key' \\\n --negative-thought \"I'm not good enough for this job.\"",
|
|
2170
2514
|
},
|
|
2515
|
+
csharp: {
|
|
2516
|
+
method: 'Reframe.TransformNegativeThoughts',
|
|
2517
|
+
example: 'ReframeTransformNegativeThoughtsParams parameters = new()\n{\n NegativeThought = "I\'m not good enough for this job."\n};\n\nvar response = await client.Reframe.TransformNegativeThoughts(parameters);\n\nConsole.WriteLine(response);',
|
|
2518
|
+
},
|
|
2171
2519
|
go: {
|
|
2172
2520
|
method: 'client.Reframe.TransformNegativeThoughts',
|
|
2173
2521
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Reframe.TransformNegativeThoughts(context.TODO(), believe.ReframeTransformNegativeThoughtsParams{\n\t\tNegativeThought: "I\'m not good enough for this job.",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.DailyAffirmation)\n}\n',
|
|
@@ -2183,6 +2531,10 @@ const EMBEDDED_METHODS = [
|
|
|
2183
2531
|
method: 'reframe().transformNegativeThoughts',
|
|
2184
2532
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.reframe.ReframeTransformNegativeThoughtsParams\nimport com.believe.api.models.reframe.ReframeTransformNegativeThoughtsResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: ReframeTransformNegativeThoughtsParams = ReframeTransformNegativeThoughtsParams.builder()\n .negativeThought("I\'m not good enough for this job.")\n .build()\n val response: ReframeTransformNegativeThoughtsResponse = client.reframe().transformNegativeThoughts(params)\n}',
|
|
2185
2533
|
},
|
|
2534
|
+
php: {
|
|
2535
|
+
method: 'reframe->transformNegativeThoughts',
|
|
2536
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->reframe->transformNegativeThoughts(\n negativeThought: 'I\\'m not good enough for this job.', recurring: true\n);\n\nvar_dump($response);",
|
|
2537
|
+
},
|
|
2186
2538
|
python: {
|
|
2187
2539
|
method: 'reframe.transform_negative_thoughts',
|
|
2188
2540
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.reframe.transform_negative_thoughts(\n negative_thought="I\'m not good enough for this job.",\n)\nprint(response.daily_affirmation)',
|
|
@@ -2213,6 +2565,10 @@ const EMBEDDED_METHODS = [
|
|
|
2213
2565
|
method: 'press simulate',
|
|
2214
2566
|
example: "believe press simulate \\\n --api-key 'My API Key' \\\n --question 'Ted, your team just lost 5-0. How do you explain this embarrassing defeat?'",
|
|
2215
2567
|
},
|
|
2568
|
+
csharp: {
|
|
2569
|
+
method: 'Press.Simulate',
|
|
2570
|
+
example: 'PressSimulateParams parameters = new()\n{\n Question = "Ted, your team just lost 5-0. How do you explain this embarrassing defeat?",\n};\n\nvar response = await client.Press.Simulate(parameters);\n\nConsole.WriteLine(response);',
|
|
2571
|
+
},
|
|
2216
2572
|
go: {
|
|
2217
2573
|
method: 'client.Press.Simulate',
|
|
2218
2574
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Press.Simulate(context.TODO(), believe.PressSimulateParams{\n\t\tQuestion: "Ted, your team just lost 5-0. How do you explain this embarrassing defeat?",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ActualWisdom)\n}\n',
|
|
@@ -2228,6 +2584,10 @@ const EMBEDDED_METHODS = [
|
|
|
2228
2584
|
method: 'press().simulate',
|
|
2229
2585
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.press.PressSimulateParams\nimport com.believe.api.models.press.PressSimulateResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: PressSimulateParams = PressSimulateParams.builder()\n .question("Ted, your team just lost 5-0. How do you explain this embarrassing defeat?")\n .build()\n val response: PressSimulateResponse = client.press().simulate(params)\n}',
|
|
2230
2586
|
},
|
|
2587
|
+
php: {
|
|
2588
|
+
method: 'press->simulate',
|
|
2589
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->press->simulate(\n question: 'Ted, your team just lost 5-0. How do you explain this embarrassing defeat?',\n hostile: true,\n topic: 'match_result',\n);\n\nvar_dump($response);",
|
|
2590
|
+
},
|
|
2231
2591
|
python: {
|
|
2232
2592
|
method: 'press.simulate',
|
|
2233
2593
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.press.simulate(\n question="Ted, your team just lost 5-0. How do you explain this embarrassing defeat?",\n)\nprint(response.actual_wisdom)',
|
|
@@ -2258,6 +2618,10 @@ const EMBEDDED_METHODS = [
|
|
|
2258
2618
|
method: 'principles list',
|
|
2259
2619
|
example: "believe coaching:principles list \\\n --api-key 'My API Key'",
|
|
2260
2620
|
},
|
|
2621
|
+
csharp: {
|
|
2622
|
+
method: 'Coaching.Principles.List',
|
|
2623
|
+
example: 'PrincipleListParams parameters = new();\n\nvar page = await client.Coaching.Principles.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
2624
|
+
},
|
|
2261
2625
|
go: {
|
|
2262
2626
|
method: 'client.Coaching.Principles.List',
|
|
2263
2627
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Coaching.Principles.List(context.TODO(), believe.CoachingPrincipleListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2273,6 +2637,10 @@ const EMBEDDED_METHODS = [
|
|
|
2273
2637
|
method: 'coaching().principles().list',
|
|
2274
2638
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.coaching.principles.PrincipleListPage\nimport com.believe.api.models.coaching.principles.PrincipleListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: PrincipleListPage = client.coaching().principles().list()\n}',
|
|
2275
2639
|
},
|
|
2640
|
+
php: {
|
|
2641
|
+
method: 'coaching->principles->list',
|
|
2642
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->coaching->principles->list(limit: 10, skip: 0);\n\nvar_dump($page);",
|
|
2643
|
+
},
|
|
2276
2644
|
python: {
|
|
2277
2645
|
method: 'coaching.principles.list',
|
|
2278
2646
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.coaching.principles.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -2303,6 +2671,10 @@ const EMBEDDED_METHODS = [
|
|
|
2303
2671
|
method: 'principles retrieve',
|
|
2304
2672
|
example: "believe coaching:principles retrieve \\\n --api-key 'My API Key' \\\n --principle-id principle_id",
|
|
2305
2673
|
},
|
|
2674
|
+
csharp: {
|
|
2675
|
+
method: 'Coaching.Principles.Retrieve',
|
|
2676
|
+
example: 'PrincipleRetrieveParams parameters = new() { PrincipleID = "principle_id" };\n\nvar coachingPrinciple = await client.Coaching.Principles.Retrieve(parameters);\n\nConsole.WriteLine(coachingPrinciple);',
|
|
2677
|
+
},
|
|
2306
2678
|
go: {
|
|
2307
2679
|
method: 'client.Coaching.Principles.Get',
|
|
2308
2680
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tcoachingPrinciple, err := client.Coaching.Principles.Get(context.TODO(), "principle_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", coachingPrinciple.ID)\n}\n',
|
|
@@ -2318,6 +2690,10 @@ const EMBEDDED_METHODS = [
|
|
|
2318
2690
|
method: 'coaching().principles().retrieve',
|
|
2319
2691
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.coaching.principles.CoachingPrinciple\nimport com.believe.api.models.coaching.principles.PrincipleRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val coachingPrinciple: CoachingPrinciple = client.coaching().principles().retrieve("principle_id")\n}',
|
|
2320
2692
|
},
|
|
2693
|
+
php: {
|
|
2694
|
+
method: 'coaching->principles->retrieve',
|
|
2695
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$coachingPrinciple = $client->coaching->principles->retrieve('principle_id');\n\nvar_dump($coachingPrinciple);",
|
|
2696
|
+
},
|
|
2321
2697
|
python: {
|
|
2322
2698
|
method: 'coaching.principles.retrieve',
|
|
2323
2699
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\ncoaching_principle = client.coaching.principles.retrieve(\n "principle_id",\n)\nprint(coaching_principle.id)',
|
|
@@ -2347,6 +2723,10 @@ const EMBEDDED_METHODS = [
|
|
|
2347
2723
|
method: 'principles get_random',
|
|
2348
2724
|
example: "believe coaching:principles get-random \\\n --api-key 'My API Key'",
|
|
2349
2725
|
},
|
|
2726
|
+
csharp: {
|
|
2727
|
+
method: 'Coaching.Principles.GetRandom',
|
|
2728
|
+
example: 'PrincipleGetRandomParams parameters = new();\n\nvar coachingPrinciple = await client.Coaching.Principles.GetRandom(parameters);\n\nConsole.WriteLine(coachingPrinciple);',
|
|
2729
|
+
},
|
|
2350
2730
|
go: {
|
|
2351
2731
|
method: 'client.Coaching.Principles.GetRandom',
|
|
2352
2732
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tcoachingPrinciple, err := client.Coaching.Principles.GetRandom(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", coachingPrinciple.ID)\n}\n',
|
|
@@ -2362,6 +2742,10 @@ const EMBEDDED_METHODS = [
|
|
|
2362
2742
|
method: 'coaching().principles().getRandom',
|
|
2363
2743
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.coaching.principles.CoachingPrinciple\nimport com.believe.api.models.coaching.principles.PrincipleGetRandomParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val coachingPrinciple: CoachingPrinciple = client.coaching().principles().getRandom()\n}',
|
|
2364
2744
|
},
|
|
2745
|
+
php: {
|
|
2746
|
+
method: 'coaching->principles->getRandom',
|
|
2747
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$coachingPrinciple = $client->coaching->principles->getRandom();\n\nvar_dump($coachingPrinciple);",
|
|
2748
|
+
},
|
|
2365
2749
|
python: {
|
|
2366
2750
|
method: 'coaching.principles.get_random',
|
|
2367
2751
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\ncoaching_principle = client.coaching.principles.get_random()\nprint(coaching_principle.id)',
|
|
@@ -2392,6 +2776,10 @@ const EMBEDDED_METHODS = [
|
|
|
2392
2776
|
method: 'biscuits list',
|
|
2393
2777
|
example: "believe biscuits list \\\n --api-key 'My API Key'",
|
|
2394
2778
|
},
|
|
2779
|
+
csharp: {
|
|
2780
|
+
method: 'Biscuits.List',
|
|
2781
|
+
example: 'BiscuitListParams parameters = new();\n\nvar page = await client.Biscuits.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
2782
|
+
},
|
|
2395
2783
|
go: {
|
|
2396
2784
|
method: 'client.Biscuits.List',
|
|
2397
2785
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Biscuits.List(context.TODO(), believe.BiscuitListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2407,6 +2795,10 @@ const EMBEDDED_METHODS = [
|
|
|
2407
2795
|
method: 'biscuits().list',
|
|
2408
2796
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.biscuits.BiscuitListPage\nimport com.believe.api.models.biscuits.BiscuitListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: BiscuitListPage = client.biscuits().list()\n}',
|
|
2409
2797
|
},
|
|
2798
|
+
php: {
|
|
2799
|
+
method: 'biscuits->list',
|
|
2800
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->biscuits->list(limit: 10, skip: 0);\n\nvar_dump($page);",
|
|
2801
|
+
},
|
|
2410
2802
|
python: {
|
|
2411
2803
|
method: 'biscuits.list',
|
|
2412
2804
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.biscuits.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -2436,6 +2828,10 @@ const EMBEDDED_METHODS = [
|
|
|
2436
2828
|
method: 'biscuits get_fresh',
|
|
2437
2829
|
example: "believe biscuits get-fresh \\\n --api-key 'My API Key'",
|
|
2438
2830
|
},
|
|
2831
|
+
csharp: {
|
|
2832
|
+
method: 'Biscuits.GetFresh',
|
|
2833
|
+
example: 'BiscuitGetFreshParams parameters = new();\n\nvar biscuit = await client.Biscuits.GetFresh(parameters);\n\nConsole.WriteLine(biscuit);',
|
|
2834
|
+
},
|
|
2439
2835
|
go: {
|
|
2440
2836
|
method: 'client.Biscuits.GetFresh',
|
|
2441
2837
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbiscuit, err := client.Biscuits.GetFresh(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", biscuit.ID)\n}\n',
|
|
@@ -2451,6 +2847,10 @@ const EMBEDDED_METHODS = [
|
|
|
2451
2847
|
method: 'biscuits().getFresh',
|
|
2452
2848
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.biscuits.Biscuit\nimport com.believe.api.models.biscuits.BiscuitGetFreshParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val biscuit: Biscuit = client.biscuits().getFresh()\n}',
|
|
2453
2849
|
},
|
|
2850
|
+
php: {
|
|
2851
|
+
method: 'biscuits->getFresh',
|
|
2852
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$biscuit = $client->biscuits->getFresh();\n\nvar_dump($biscuit);",
|
|
2853
|
+
},
|
|
2454
2854
|
python: {
|
|
2455
2855
|
method: 'biscuits.get_fresh',
|
|
2456
2856
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nbiscuit = client.biscuits.get_fresh()\nprint(biscuit.id)',
|
|
@@ -2481,6 +2881,10 @@ const EMBEDDED_METHODS = [
|
|
|
2481
2881
|
method: 'biscuits retrieve',
|
|
2482
2882
|
example: "believe biscuits retrieve \\\n --api-key 'My API Key' \\\n --biscuit-id biscuit_id",
|
|
2483
2883
|
},
|
|
2884
|
+
csharp: {
|
|
2885
|
+
method: 'Biscuits.Retrieve',
|
|
2886
|
+
example: 'BiscuitRetrieveParams parameters = new() { BiscuitID = "biscuit_id" };\n\nvar biscuit = await client.Biscuits.Retrieve(parameters);\n\nConsole.WriteLine(biscuit);',
|
|
2887
|
+
},
|
|
2484
2888
|
go: {
|
|
2485
2889
|
method: 'client.Biscuits.Get',
|
|
2486
2890
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbiscuit, err := client.Biscuits.Get(context.TODO(), "biscuit_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", biscuit.ID)\n}\n',
|
|
@@ -2496,6 +2900,10 @@ const EMBEDDED_METHODS = [
|
|
|
2496
2900
|
method: 'biscuits().retrieve',
|
|
2497
2901
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.biscuits.Biscuit\nimport com.believe.api.models.biscuits.BiscuitRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val biscuit: Biscuit = client.biscuits().retrieve("biscuit_id")\n}',
|
|
2498
2902
|
},
|
|
2903
|
+
php: {
|
|
2904
|
+
method: 'biscuits->retrieve',
|
|
2905
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$biscuit = $client->biscuits->retrieve('biscuit_id');\n\nvar_dump($biscuit);",
|
|
2906
|
+
},
|
|
2499
2907
|
python: {
|
|
2500
2908
|
method: 'biscuits.retrieve',
|
|
2501
2909
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nbiscuit = client.biscuits.retrieve(\n "biscuit_id",\n)\nprint(biscuit.id)',
|
|
@@ -2526,6 +2934,10 @@ const EMBEDDED_METHODS = [
|
|
|
2526
2934
|
method: 'pep_talk retrieve',
|
|
2527
2935
|
example: "believe pep-talk retrieve \\\n --api-key 'My API Key'",
|
|
2528
2936
|
},
|
|
2937
|
+
csharp: {
|
|
2938
|
+
method: 'PepTalk.Retrieve',
|
|
2939
|
+
example: 'PepTalkRetrieveParams parameters = new();\n\nvar pepTalk = await client.PepTalk.Retrieve(parameters);\n\nConsole.WriteLine(pepTalk);',
|
|
2940
|
+
},
|
|
2529
2941
|
go: {
|
|
2530
2942
|
method: 'client.PepTalk.Get',
|
|
2531
2943
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpepTalk, err := client.PepTalk.Get(context.TODO(), believe.PepTalkGetParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", pepTalk.Chunks)\n}\n',
|
|
@@ -2541,6 +2953,10 @@ const EMBEDDED_METHODS = [
|
|
|
2541
2953
|
method: 'pepTalk().retrieve',
|
|
2542
2954
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.peptalk.PepTalkRetrieveParams\nimport com.believe.api.models.peptalk.PepTalkRetrieveResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val pepTalk: PepTalkRetrieveResponse = client.pepTalk().retrieve()\n}',
|
|
2543
2955
|
},
|
|
2956
|
+
php: {
|
|
2957
|
+
method: 'pepTalk->retrieve',
|
|
2958
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$pepTalk = $client->pepTalk->retrieve(stream: true);\n\nvar_dump($pepTalk);",
|
|
2959
|
+
},
|
|
2544
2960
|
python: {
|
|
2545
2961
|
method: 'pep_talk.retrieve',
|
|
2546
2962
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npep_talk = client.pep_talk.retrieve()\nprint(pep_talk.chunks)',
|
|
@@ -2570,6 +2986,10 @@ const EMBEDDED_METHODS = [
|
|
|
2570
2986
|
method: 'stream test_connection',
|
|
2571
2987
|
example: "believe stream test-connection \\\n --api-key 'My API Key'",
|
|
2572
2988
|
},
|
|
2989
|
+
csharp: {
|
|
2990
|
+
method: 'Stream.TestConnection',
|
|
2991
|
+
example: 'StreamTestConnectionParams parameters = new();\n\nvar response = await client.Stream.TestConnection(parameters);\n\nConsole.WriteLine(response);',
|
|
2992
|
+
},
|
|
2573
2993
|
go: {
|
|
2574
2994
|
method: 'client.Stream.TestConnection',
|
|
2575
2995
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Stream.TestConnection(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -2585,6 +3005,10 @@ const EMBEDDED_METHODS = [
|
|
|
2585
3005
|
method: 'stream().testConnection',
|
|
2586
3006
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.stream.StreamTestConnectionParams\nimport com.believe.api.models.stream.StreamTestConnectionResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: StreamTestConnectionResponse = client.stream().testConnection()\n}',
|
|
2587
3007
|
},
|
|
3008
|
+
php: {
|
|
3009
|
+
method: 'stream->testConnection',
|
|
3010
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->stream->testConnection();\n\nvar_dump($response);",
|
|
3011
|
+
},
|
|
2588
3012
|
python: {
|
|
2589
3013
|
method: 'stream.test_connection',
|
|
2590
3014
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.stream.test_connection()\nprint(response)',
|
|
@@ -2620,6 +3044,10 @@ const EMBEDDED_METHODS = [
|
|
|
2620
3044
|
method: 'team_members list',
|
|
2621
3045
|
example: "believe team-members list \\\n --api-key 'My API Key'",
|
|
2622
3046
|
},
|
|
3047
|
+
csharp: {
|
|
3048
|
+
method: 'TeamMembers.List',
|
|
3049
|
+
example: 'TeamMemberListParams parameters = new();\n\nvar page = await client.TeamMembers.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
3050
|
+
},
|
|
2623
3051
|
go: {
|
|
2624
3052
|
method: 'client.TeamMembers.List',
|
|
2625
3053
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.TeamMembers.List(context.TODO(), believe.TeamMemberListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2635,6 +3063,10 @@ const EMBEDDED_METHODS = [
|
|
|
2635
3063
|
method: 'teamMembers().list',
|
|
2636
3064
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberListPage\nimport com.believe.api.models.teammembers.TeamMemberListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: TeamMemberListPage = client.teamMembers().list()\n}',
|
|
2637
3065
|
},
|
|
3066
|
+
php: {
|
|
3067
|
+
method: 'teamMembers->list',
|
|
3068
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->teamMembers->list(\n limit: 10, memberType: 'player', skip: 0, teamID: 'team_id'\n);\n\nvar_dump($page);",
|
|
3069
|
+
},
|
|
2638
3070
|
python: {
|
|
2639
3071
|
method: 'team_members.list',
|
|
2640
3072
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.team_members.list()\npage = page.data[0]\nprint(page)',
|
|
@@ -2667,6 +3099,10 @@ const EMBEDDED_METHODS = [
|
|
|
2667
3099
|
method: 'team_members create',
|
|
2668
3100
|
example: "believe team-members create \\\n --api-key 'My API Key' \\\n --member '{character_id: jamie-tartt, jersey_number: 9, position: forward, team_id: afc-richmond, years_with_team: 3, member_type: player}'",
|
|
2669
3101
|
},
|
|
3102
|
+
csharp: {
|
|
3103
|
+
method: 'TeamMembers.Create',
|
|
3104
|
+
example: 'TeamMemberCreateParams parameters = new()\n{\n Member = new Player()\n {\n CharacterID = "jamie-tartt",\n JerseyNumber = 9,\n Position = Position.Forward,\n TeamID = "afc-richmond",\n YearsWithTeam = 3,\n Assists = 23,\n GoalsScored = 47,\n IsCaptain = false,\n MemberType = MemberType.Player,\n },\n};\n\nvar teamMember = await client.TeamMembers.Create(parameters);\n\nConsole.WriteLine(teamMember);',
|
|
3105
|
+
},
|
|
2670
3106
|
go: {
|
|
2671
3107
|
method: 'client.TeamMembers.New',
|
|
2672
3108
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteamMember, err := client.TeamMembers.New(context.TODO(), believe.TeamMemberNewParams{\n\t\tOfPlayer: &believe.TeamMemberNewParamsMemberPlayer{\n\t\t\tCharacterID: "jamie-tartt",\n\t\t\tJerseyNumber: 9,\n\t\t\tPosition: believe.PositionForward,\n\t\t\tTeamID: "afc-richmond",\n\t\t\tYearsWithTeam: 3,\n\t\t\tMemberType: "player",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", teamMember)\n}\n',
|
|
@@ -2682,6 +3118,10 @@ const EMBEDDED_METHODS = [
|
|
|
2682
3118
|
method: 'teamMembers().create',
|
|
2683
3119
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.Position\nimport com.believe.api.models.teammembers.TeamMemberCreateParams\nimport com.believe.api.models.teammembers.TeamMemberCreateResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: TeamMemberCreateParams.Member.Player = TeamMemberCreateParams.Member.Player.builder()\n .characterId("jamie-tartt")\n .jerseyNumber(9L)\n .position(Position.FORWARD)\n .teamId("afc-richmond")\n .yearsWithTeam(3L)\n .memberType(TeamMemberCreateParams.Member.Player.MemberType.PLAYER)\n .build()\n val teamMember: TeamMemberCreateResponse = client.teamMembers().create(params)\n}',
|
|
2684
3120
|
},
|
|
3121
|
+
php: {
|
|
3122
|
+
method: 'teamMembers->create',
|
|
3123
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$teamMember = $client->teamMembers->create(\n member: [\n 'characterID' => 'jamie-tartt',\n 'jerseyNumber' => 9,\n 'position' => Position::FORWARD,\n 'teamID' => 'afc-richmond',\n 'yearsWithTeam' => 3,\n 'assists' => 23,\n 'goalsScored' => 47,\n 'isCaptain' => false,\n 'memberType' => 'player',\n ],\n);\n\nvar_dump($teamMember);",
|
|
3124
|
+
},
|
|
2685
3125
|
python: {
|
|
2686
3126
|
method: 'team_members.create',
|
|
2687
3127
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteam_member = client.team_members.create(\n member={\n "character_id": "jamie-tartt",\n "jersey_number": 9,\n "position": "forward",\n "team_id": "afc-richmond",\n "years_with_team": 3,\n "member_type": "player",\n },\n)\nprint(team_member)',
|
|
@@ -2712,6 +3152,10 @@ const EMBEDDED_METHODS = [
|
|
|
2712
3152
|
method: 'team_members retrieve',
|
|
2713
3153
|
example: "believe team-members retrieve \\\n --api-key 'My API Key' \\\n --member-id member_id",
|
|
2714
3154
|
},
|
|
3155
|
+
csharp: {
|
|
3156
|
+
method: 'TeamMembers.Retrieve',
|
|
3157
|
+
example: 'TeamMemberRetrieveParams parameters = new() { MemberID = "member_id" };\n\nvar teamMember = await client.TeamMembers.Retrieve(parameters);\n\nConsole.WriteLine(teamMember);',
|
|
3158
|
+
},
|
|
2715
3159
|
go: {
|
|
2716
3160
|
method: 'client.TeamMembers.Get',
|
|
2717
3161
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteamMember, err := client.TeamMembers.Get(context.TODO(), "member_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", teamMember)\n}\n',
|
|
@@ -2727,6 +3171,10 @@ const EMBEDDED_METHODS = [
|
|
|
2727
3171
|
method: 'teamMembers().retrieve',
|
|
2728
3172
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberRetrieveParams\nimport com.believe.api.models.teammembers.TeamMemberRetrieveResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val teamMember: TeamMemberRetrieveResponse = client.teamMembers().retrieve("member_id")\n}',
|
|
2729
3173
|
},
|
|
3174
|
+
php: {
|
|
3175
|
+
method: 'teamMembers->retrieve',
|
|
3176
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$teamMember = $client->teamMembers->retrieve('member_id');\n\nvar_dump($teamMember);",
|
|
3177
|
+
},
|
|
2730
3178
|
python: {
|
|
2731
3179
|
method: 'team_members.retrieve',
|
|
2732
3180
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteam_member = client.team_members.retrieve(\n "member_id",\n)\nprint(team_member)',
|
|
@@ -2760,6 +3208,10 @@ const EMBEDDED_METHODS = [
|
|
|
2760
3208
|
method: 'team_members update',
|
|
2761
3209
|
example: "believe team-members update \\\n --api-key 'My API Key' \\\n --member-id member_id \\\n --updates '{}'",
|
|
2762
3210
|
},
|
|
3211
|
+
csharp: {
|
|
3212
|
+
method: 'TeamMembers.Update',
|
|
3213
|
+
example: 'TeamMemberUpdateParams parameters = new()\n{\n MemberID = "member_id",\n Updates = new PlayerUpdate()\n {\n Assists = 0,\n GoalsScored = 0,\n IsCaptain = true,\n JerseyNumber = 1,\n Position = Position.Goalkeeper,\n TeamID = "team_id",\n YearsWithTeam = 0,\n },\n};\n\nvar teamMember = await client.TeamMembers.Update(parameters);\n\nConsole.WriteLine(teamMember);',
|
|
3214
|
+
},
|
|
2763
3215
|
go: {
|
|
2764
3216
|
method: 'client.TeamMembers.Update',
|
|
2765
3217
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tteamMember, err := client.TeamMembers.Update(\n\t\tcontext.TODO(),\n\t\t"member_id",\n\t\tbelieve.TeamMemberUpdateParams{\n\t\t\tOfPlayerUpdate: &believe.TeamMemberUpdateParamsUpdatesPlayerUpdate{},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", teamMember)\n}\n',
|
|
@@ -2775,6 +3227,10 @@ const EMBEDDED_METHODS = [
|
|
|
2775
3227
|
method: 'teamMembers().update',
|
|
2776
3228
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberUpdateParams\nimport com.believe.api.models.teammembers.TeamMemberUpdateResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: TeamMemberUpdateParams = TeamMemberUpdateParams.builder()\n .memberId("member_id")\n .updates(TeamMemberUpdateParams.Updates.PlayerUpdate.builder().build())\n .build()\n val teamMember: TeamMemberUpdateResponse = client.teamMembers().update(params)\n}',
|
|
2777
3229
|
},
|
|
3230
|
+
php: {
|
|
3231
|
+
method: 'teamMembers->update',
|
|
3232
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$teamMember = $client->teamMembers->update(\n 'member_id',\n updates: [\n 'assists' => 0,\n 'goalsScored' => 0,\n 'isCaptain' => true,\n 'jerseyNumber' => 1,\n 'position' => Position::GOALKEEPER,\n 'teamID' => 'team_id',\n 'yearsWithTeam' => 0,\n ],\n);\n\nvar_dump($teamMember);",
|
|
3233
|
+
},
|
|
2778
3234
|
python: {
|
|
2779
3235
|
method: 'team_members.update',
|
|
2780
3236
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nteam_member = client.team_members.update(\n member_id="member_id",\n updates={},\n)\nprint(team_member)',
|
|
@@ -2804,6 +3260,10 @@ const EMBEDDED_METHODS = [
|
|
|
2804
3260
|
method: 'team_members delete',
|
|
2805
3261
|
example: "believe team-members delete \\\n --api-key 'My API Key' \\\n --member-id member_id",
|
|
2806
3262
|
},
|
|
3263
|
+
csharp: {
|
|
3264
|
+
method: 'TeamMembers.Delete',
|
|
3265
|
+
example: 'TeamMemberDeleteParams parameters = new() { MemberID = "member_id" };\n\nawait client.TeamMembers.Delete(parameters);',
|
|
3266
|
+
},
|
|
2807
3267
|
go: {
|
|
2808
3268
|
method: 'client.TeamMembers.Delete',
|
|
2809
3269
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.TeamMembers.Delete(context.TODO(), "member_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -2819,6 +3279,10 @@ const EMBEDDED_METHODS = [
|
|
|
2819
3279
|
method: 'teamMembers().delete',
|
|
2820
3280
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.teamMembers().delete("member_id")\n}',
|
|
2821
3281
|
},
|
|
3282
|
+
php: {
|
|
3283
|
+
method: 'teamMembers->delete',
|
|
3284
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->teamMembers->delete('member_id');\n\nvar_dump($result);",
|
|
3285
|
+
},
|
|
2822
3286
|
python: {
|
|
2823
3287
|
method: 'team_members.delete',
|
|
2824
3288
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.team_members.delete(\n "member_id",\n)',
|
|
@@ -2854,6 +3318,10 @@ const EMBEDDED_METHODS = [
|
|
|
2854
3318
|
method: 'team_members list_players',
|
|
2855
3319
|
example: "believe team-members list-players \\\n --api-key 'My API Key'",
|
|
2856
3320
|
},
|
|
3321
|
+
csharp: {
|
|
3322
|
+
method: 'TeamMembers.ListPlayers',
|
|
3323
|
+
example: 'TeamMemberListPlayersParams parameters = new();\n\nvar page = await client.TeamMembers.ListPlayers(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
3324
|
+
},
|
|
2857
3325
|
go: {
|
|
2858
3326
|
method: 'client.TeamMembers.ListPlayers',
|
|
2859
3327
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.TeamMembers.ListPlayers(context.TODO(), believe.TeamMemberListPlayersParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2869,6 +3337,10 @@ const EMBEDDED_METHODS = [
|
|
|
2869
3337
|
method: 'teamMembers().listPlayers',
|
|
2870
3338
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberListPlayersPage\nimport com.believe.api.models.teammembers.TeamMemberListPlayersParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: TeamMemberListPlayersPage = client.teamMembers().listPlayers()\n}',
|
|
2871
3339
|
},
|
|
3340
|
+
php: {
|
|
3341
|
+
method: 'teamMembers->listPlayers',
|
|
3342
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->teamMembers->listPlayers(\n limit: 10, position: Position::GOALKEEPER, skip: 0, teamID: 'team_id'\n);\n\nvar_dump($page);",
|
|
3343
|
+
},
|
|
2872
3344
|
python: {
|
|
2873
3345
|
method: 'team_members.list_players',
|
|
2874
3346
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.team_members.list_players()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -2904,6 +3376,10 @@ const EMBEDDED_METHODS = [
|
|
|
2904
3376
|
method: 'team_members list_coaches',
|
|
2905
3377
|
example: "believe team-members list-coaches \\\n --api-key 'My API Key'",
|
|
2906
3378
|
},
|
|
3379
|
+
csharp: {
|
|
3380
|
+
method: 'TeamMembers.ListCoaches',
|
|
3381
|
+
example: 'TeamMemberListCoachesParams parameters = new();\n\nvar page = await client.TeamMembers.ListCoaches(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
3382
|
+
},
|
|
2907
3383
|
go: {
|
|
2908
3384
|
method: 'client.TeamMembers.ListCoaches',
|
|
2909
3385
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.TeamMembers.ListCoaches(context.TODO(), believe.TeamMemberListCoachesParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2919,6 +3395,10 @@ const EMBEDDED_METHODS = [
|
|
|
2919
3395
|
method: 'teamMembers().listCoaches',
|
|
2920
3396
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberListCoachesPage\nimport com.believe.api.models.teammembers.TeamMemberListCoachesParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: TeamMemberListCoachesPage = client.teamMembers().listCoaches()\n}',
|
|
2921
3397
|
},
|
|
3398
|
+
php: {
|
|
3399
|
+
method: 'teamMembers->listCoaches',
|
|
3400
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->teamMembers->listCoaches(\n limit: 10, skip: 0, specialty: CoachSpecialty::HEAD_COACH, teamID: 'team_id'\n);\n\nvar_dump($page);",
|
|
3401
|
+
},
|
|
2922
3402
|
python: {
|
|
2923
3403
|
method: 'team_members.list_coaches',
|
|
2924
3404
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.team_members.list_coaches()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -2949,6 +3429,10 @@ const EMBEDDED_METHODS = [
|
|
|
2949
3429
|
method: 'team_members list_staff',
|
|
2950
3430
|
example: "believe team-members list-staff \\\n --api-key 'My API Key'",
|
|
2951
3431
|
},
|
|
3432
|
+
csharp: {
|
|
3433
|
+
method: 'TeamMembers.ListStaff',
|
|
3434
|
+
example: 'TeamMemberListStaffParams parameters = new();\n\nvar page = await client.TeamMembers.ListStaff(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
3435
|
+
},
|
|
2952
3436
|
go: {
|
|
2953
3437
|
method: 'client.TeamMembers.ListStaff',
|
|
2954
3438
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.TeamMembers.ListStaff(context.TODO(), believe.TeamMemberListStaffParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -2964,6 +3448,10 @@ const EMBEDDED_METHODS = [
|
|
|
2964
3448
|
method: 'teamMembers().listStaff',
|
|
2965
3449
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.teammembers.TeamMemberListStaffPage\nimport com.believe.api.models.teammembers.TeamMemberListStaffParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: TeamMemberListStaffPage = client.teamMembers().listStaff()\n}',
|
|
2966
3450
|
},
|
|
3451
|
+
php: {
|
|
3452
|
+
method: 'teamMembers->listStaff',
|
|
3453
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->teamMembers->listStaff(limit: 10, skip: 0, teamID: 'team_id');\n\nvar_dump($page);",
|
|
3454
|
+
},
|
|
2967
3455
|
python: {
|
|
2968
3456
|
method: 'team_members.list_staff',
|
|
2969
3457
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.team_members.list_staff()\npage = page.data[0]\nprint(page)',
|
|
@@ -2993,6 +3481,10 @@ const EMBEDDED_METHODS = [
|
|
|
2993
3481
|
method: 'webhooks list',
|
|
2994
3482
|
example: "believe webhooks list \\\n --api-key 'My API Key'",
|
|
2995
3483
|
},
|
|
3484
|
+
csharp: {
|
|
3485
|
+
method: 'Webhooks.List',
|
|
3486
|
+
example: 'WebhookListParams parameters = new();\n\nvar registeredWebhooks = await client.Webhooks.List(parameters);\n\nConsole.WriteLine(registeredWebhooks);',
|
|
3487
|
+
},
|
|
2996
3488
|
go: {
|
|
2997
3489
|
method: 'client.Webhooks.List',
|
|
2998
3490
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tregisteredWebhooks, err := client.Webhooks.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", registeredWebhooks)\n}\n',
|
|
@@ -3008,6 +3500,10 @@ const EMBEDDED_METHODS = [
|
|
|
3008
3500
|
method: 'webhooks().list',
|
|
3009
3501
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.webhooks.RegisteredWebhook\nimport com.believe.api.models.webhooks.WebhookListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val registeredWebhooks: List<RegisteredWebhook> = client.webhooks().list()\n}',
|
|
3010
3502
|
},
|
|
3503
|
+
php: {
|
|
3504
|
+
method: 'webhooks->list',
|
|
3505
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$registeredWebhooks = $client->webhooks->list();\n\nvar_dump($registeredWebhooks);",
|
|
3506
|
+
},
|
|
3011
3507
|
python: {
|
|
3012
3508
|
method: 'webhooks.list',
|
|
3013
3509
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nregistered_webhooks = client.webhooks.list()\nprint(registered_webhooks)',
|
|
@@ -3042,6 +3538,10 @@ const EMBEDDED_METHODS = [
|
|
|
3042
3538
|
method: 'webhooks create',
|
|
3043
3539
|
example: "believe webhooks create \\\n --api-key 'My API Key' \\\n --url https://example.com/webhooks",
|
|
3044
3540
|
},
|
|
3541
|
+
csharp: {
|
|
3542
|
+
method: 'Webhooks.Create',
|
|
3543
|
+
example: 'WebhookCreateParams parameters = new() { Url = "https://example.com/webhooks" };\n\nvar webhook = await client.Webhooks.Create(parameters);\n\nConsole.WriteLine(webhook);',
|
|
3544
|
+
},
|
|
3045
3545
|
go: {
|
|
3046
3546
|
method: 'client.Webhooks.New',
|
|
3047
3547
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhook, err := client.Webhooks.New(context.TODO(), believe.WebhookNewParams{\n\t\tURL: "https://example.com/webhooks",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhook.Webhook)\n}\n',
|
|
@@ -3057,6 +3557,10 @@ const EMBEDDED_METHODS = [
|
|
|
3057
3557
|
method: 'webhooks().create',
|
|
3058
3558
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.webhooks.WebhookCreateParams\nimport com.believe.api.models.webhooks.WebhookCreateResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: WebhookCreateParams = WebhookCreateParams.builder()\n .url("https://example.com/webhooks")\n .build()\n val webhook: WebhookCreateResponse = client.webhooks().create(params)\n}',
|
|
3059
3559
|
},
|
|
3560
|
+
php: {
|
|
3561
|
+
method: 'webhooks->create',
|
|
3562
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$webhook = $client->webhooks->create(\n url: 'https://example.com/webhooks',\n description: 'Production webhook for match notifications',\n eventTypes: ['match.completed', 'team_member.transferred'],\n);\n\nvar_dump($webhook);",
|
|
3563
|
+
},
|
|
3060
3564
|
python: {
|
|
3061
3565
|
method: 'webhooks.create',
|
|
3062
3566
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nwebhook = client.webhooks.create(\n url="https://example.com/webhooks",\n)\nprint(webhook.webhook)',
|
|
@@ -3087,6 +3591,10 @@ const EMBEDDED_METHODS = [
|
|
|
3087
3591
|
method: 'webhooks retrieve',
|
|
3088
3592
|
example: "believe webhooks retrieve \\\n --api-key 'My API Key' \\\n --webhook-id webhook_id",
|
|
3089
3593
|
},
|
|
3594
|
+
csharp: {
|
|
3595
|
+
method: 'Webhooks.Retrieve',
|
|
3596
|
+
example: 'WebhookRetrieveParams parameters = new() { WebhookID = "webhook_id" };\n\nvar registeredWebhook = await client.Webhooks.Retrieve(parameters);\n\nConsole.WriteLine(registeredWebhook);',
|
|
3597
|
+
},
|
|
3090
3598
|
go: {
|
|
3091
3599
|
method: 'client.Webhooks.Get',
|
|
3092
3600
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tregisteredWebhook, err := client.Webhooks.Get(context.TODO(), "webhook_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", registeredWebhook.ID)\n}\n',
|
|
@@ -3102,6 +3610,10 @@ const EMBEDDED_METHODS = [
|
|
|
3102
3610
|
method: 'webhooks().retrieve',
|
|
3103
3611
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.webhooks.RegisteredWebhook\nimport com.believe.api.models.webhooks.WebhookRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val registeredWebhook: RegisteredWebhook = client.webhooks().retrieve("webhook_id")\n}',
|
|
3104
3612
|
},
|
|
3613
|
+
php: {
|
|
3614
|
+
method: 'webhooks->retrieve',
|
|
3615
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$registeredWebhook = $client->webhooks->retrieve('webhook_id');\n\nvar_dump($registeredWebhook);",
|
|
3616
|
+
},
|
|
3105
3617
|
python: {
|
|
3106
3618
|
method: 'webhooks.retrieve',
|
|
3107
3619
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nregistered_webhook = client.webhooks.retrieve(\n "webhook_id",\n)\nprint(registered_webhook.id)',
|
|
@@ -3132,6 +3644,10 @@ const EMBEDDED_METHODS = [
|
|
|
3132
3644
|
method: 'webhooks delete',
|
|
3133
3645
|
example: "believe webhooks delete \\\n --api-key 'My API Key' \\\n --webhook-id webhook_id",
|
|
3134
3646
|
},
|
|
3647
|
+
csharp: {
|
|
3648
|
+
method: 'Webhooks.Delete',
|
|
3649
|
+
example: 'WebhookDeleteParams parameters = new() { WebhookID = "webhook_id" };\n\nvar webhook = await client.Webhooks.Delete(parameters);\n\nConsole.WriteLine(webhook);',
|
|
3650
|
+
},
|
|
3135
3651
|
go: {
|
|
3136
3652
|
method: 'client.Webhooks.Delete',
|
|
3137
3653
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhook, err := client.Webhooks.Delete(context.TODO(), "webhook_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhook)\n}\n',
|
|
@@ -3147,6 +3663,10 @@ const EMBEDDED_METHODS = [
|
|
|
3147
3663
|
method: 'webhooks().delete',
|
|
3148
3664
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.webhooks.WebhookDeleteParams\nimport com.believe.api.models.webhooks.WebhookDeleteResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val webhook: WebhookDeleteResponse = client.webhooks().delete("webhook_id")\n}',
|
|
3149
3665
|
},
|
|
3666
|
+
php: {
|
|
3667
|
+
method: 'webhooks->delete',
|
|
3668
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$webhook = $client->webhooks->delete('webhook_id');\n\nvar_dump($webhook);",
|
|
3669
|
+
},
|
|
3150
3670
|
python: {
|
|
3151
3671
|
method: 'webhooks.delete',
|
|
3152
3672
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nwebhook = client.webhooks.delete(\n "webhook_id",\n)\nprint(webhook)',
|
|
@@ -3180,6 +3700,10 @@ const EMBEDDED_METHODS = [
|
|
|
3180
3700
|
method: 'webhooks trigger_event',
|
|
3181
3701
|
example: "believe webhooks trigger-event \\\n --api-key 'My API Key' \\\n --event-type match.completed",
|
|
3182
3702
|
},
|
|
3703
|
+
csharp: {
|
|
3704
|
+
method: 'Webhooks.TriggerEvent',
|
|
3705
|
+
example: 'WebhookTriggerEventParams parameters = new()\n{\n EventType = EventType.MatchCompleted\n};\n\nvar response = await client.Webhooks.TriggerEvent(parameters);\n\nConsole.WriteLine(response);',
|
|
3706
|
+
},
|
|
3183
3707
|
go: {
|
|
3184
3708
|
method: 'client.Webhooks.TriggerEvent',
|
|
3185
3709
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Webhooks.TriggerEvent(context.TODO(), believe.WebhookTriggerEventParams{\n\t\tEventType: believe.WebhookTriggerEventParamsEventTypeMatchCompleted,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.EventID)\n}\n',
|
|
@@ -3195,6 +3719,10 @@ const EMBEDDED_METHODS = [
|
|
|
3195
3719
|
method: 'webhooks().triggerEvent',
|
|
3196
3720
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.webhooks.WebhookTriggerEventParams\nimport com.believe.api.models.webhooks.WebhookTriggerEventResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: WebhookTriggerEventParams = WebhookTriggerEventParams.builder()\n .eventType(WebhookTriggerEventParams.EventType.MATCH_COMPLETED)\n .build()\n val response: WebhookTriggerEventResponse = client.webhooks().triggerEvent(params)\n}',
|
|
3197
3721
|
},
|
|
3722
|
+
php: {
|
|
3723
|
+
method: 'webhooks->triggerEvent',
|
|
3724
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->webhooks->triggerEvent(\n eventType: 'match.completed',\n payload: [\n 'data' => [\n 'awayScore' => 0,\n 'awayTeamID' => 'away_team_id',\n 'completedAt' => new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n 'homeScore' => 0,\n 'homeTeamID' => 'home_team_id',\n 'matchID' => 'match_id',\n 'matchType' => 'league',\n 'result' => 'home_win',\n 'tedPostMatchQuote' => 'ted_post_match_quote',\n 'lessonLearned' => 'lesson_learned',\n 'manOfTheMatch' => 'man_of_the_match',\n ],\n 'eventType' => 'match.completed',\n ],\n);\n\nvar_dump($response);",
|
|
3725
|
+
},
|
|
3198
3726
|
python: {
|
|
3199
3727
|
method: 'webhooks.trigger_event',
|
|
3200
3728
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.webhooks.trigger_event(\n event_type="match.completed",\n)\nprint(response.event_id)',
|
|
@@ -3221,6 +3749,9 @@ const EMBEDDED_METHODS = [
|
|
|
3221
3749
|
cli: {
|
|
3222
3750
|
example: "believe webhooks unwrap \\\n --api-key 'My API Key'",
|
|
3223
3751
|
},
|
|
3752
|
+
csharp: {
|
|
3753
|
+
example: 'WebhookUnwrapParams parameters = new();\n\nawait client.Webhooks.Unwrap(parameters);',
|
|
3754
|
+
},
|
|
3224
3755
|
go: {
|
|
3225
3756
|
method: 'client.Webhooks.Unwrap',
|
|
3226
3757
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Webhooks.Unwrap(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -3231,6 +3762,10 @@ const EMBEDDED_METHODS = [
|
|
|
3231
3762
|
kotlin: {
|
|
3232
3763
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.webhooks.WebhookUnwrapParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.webhooks().unwrap()\n}',
|
|
3233
3764
|
},
|
|
3765
|
+
php: {
|
|
3766
|
+
method: 'webhooks->unwrap',
|
|
3767
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->webhooks->unwrap();\n\nvar_dump($result);",
|
|
3768
|
+
},
|
|
3234
3769
|
python: {
|
|
3235
3770
|
method: 'webhooks.unwrap',
|
|
3236
3771
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.webhooks.unwrap()',
|
|
@@ -3268,6 +3803,10 @@ const EMBEDDED_METHODS = [
|
|
|
3268
3803
|
method: 'ticket_sales list',
|
|
3269
3804
|
example: "believe ticket-sales list \\\n --api-key 'My API Key'",
|
|
3270
3805
|
},
|
|
3806
|
+
csharp: {
|
|
3807
|
+
method: 'TicketSales.List',
|
|
3808
|
+
example: 'TicketSaleListParams parameters = new();\n\nvar page = await client.TicketSales.List(parameters);\nawait foreach (var item in page.Paginate())\n{\n Console.WriteLine(item);\n}',
|
|
3809
|
+
},
|
|
3271
3810
|
go: {
|
|
3272
3811
|
method: 'client.TicketSales.List',
|
|
3273
3812
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.TicketSales.List(context.TODO(), believe.TicketSaleListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
@@ -3283,6 +3822,10 @@ const EMBEDDED_METHODS = [
|
|
|
3283
3822
|
method: 'ticketSales().list',
|
|
3284
3823
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.ticketsales.TicketSaleListPage\nimport com.believe.api.models.ticketsales.TicketSaleListParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val page: TicketSaleListPage = client.ticketSales().list()\n}',
|
|
3285
3824
|
},
|
|
3825
|
+
php: {
|
|
3826
|
+
method: 'ticketSales->list',
|
|
3827
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$page = $client->ticketSales->list(\n couponCode: 'coupon_code',\n currency: 'currency',\n limit: 10,\n matchID: 'match_id',\n purchaseMethod: PurchaseMethod::ONLINE,\n skip: 0,\n);\n\nvar_dump($page);",
|
|
3828
|
+
},
|
|
3286
3829
|
python: {
|
|
3287
3830
|
method: 'ticket_sales.list',
|
|
3288
3831
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\npage = client.ticket_sales.list()\npage = page.data[0]\nprint(page.id)',
|
|
@@ -3326,6 +3869,10 @@ const EMBEDDED_METHODS = [
|
|
|
3326
3869
|
method: 'ticket_sales create',
|
|
3327
3870
|
example: "believe ticket-sales create \\\n --api-key 'My API Key' \\\n --buyer-name 'Mae Green' \\\n --currency GBP \\\n --discount 9.00 \\\n --match-id match-001 \\\n --purchase-method online \\\n --quantity 2 \\\n --subtotal 90.00 \\\n --tax 16.20 \\\n --total 97.20 \\\n --unit-price 45.00",
|
|
3328
3871
|
},
|
|
3872
|
+
csharp: {
|
|
3873
|
+
method: 'TicketSales.Create',
|
|
3874
|
+
example: 'TicketSaleCreateParams parameters = new()\n{\n BuyerName = "Mae Green",\n Currency = "GBP",\n Discount = "9.00",\n MatchID = "match-001",\n PurchaseMethod = PurchaseMethod.Online,\n Quantity = 2,\n Subtotal = "90.00",\n Tax = "16.20",\n Total = "97.20",\n UnitPrice = "45.00",\n};\n\nvar ticketSale = await client.TicketSales.Create(parameters);\n\nConsole.WriteLine(ticketSale);',
|
|
3875
|
+
},
|
|
3329
3876
|
go: {
|
|
3330
3877
|
method: 'client.TicketSales.New',
|
|
3331
3878
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tticketSale, err := client.TicketSales.New(context.TODO(), believe.TicketSaleNewParams{\n\t\tBuyerName: "Mae Green",\n\t\tCurrency: "GBP",\n\t\tDiscount: "9.00",\n\t\tMatchID: "match-001",\n\t\tPurchaseMethod: believe.PurchaseMethodOnline,\n\t\tQuantity: 2,\n\t\tSubtotal: "90.00",\n\t\tTax: "16.20",\n\t\tTotal: "97.20",\n\t\tUnitPrice: "45.00",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", ticketSale.ID)\n}\n',
|
|
@@ -3341,6 +3888,10 @@ const EMBEDDED_METHODS = [
|
|
|
3341
3888
|
method: 'ticketSales().create',
|
|
3342
3889
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.ticketsales.PurchaseMethod\nimport com.believe.api.models.ticketsales.TicketSale\nimport com.believe.api.models.ticketsales.TicketSaleCreateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val params: TicketSaleCreateParams = TicketSaleCreateParams.builder()\n .buyerName("Mae Green")\n .currency("GBP")\n .discount("9.00")\n .matchId("match-001")\n .purchaseMethod(PurchaseMethod.ONLINE)\n .quantity(2L)\n .subtotal("90.00")\n .tax("16.20")\n .total("97.20")\n .unitPrice("45.00")\n .build()\n val ticketSale: TicketSale = client.ticketSales().create(params)\n}',
|
|
3343
3890
|
},
|
|
3891
|
+
php: {
|
|
3892
|
+
method: 'ticketSales->create',
|
|
3893
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$ticketSale = $client->ticketSales->create(\n buyerName: 'Mae Green',\n currency: 'GBP',\n discount: '9.00',\n matchID: 'match-001',\n purchaseMethod: PurchaseMethod::ONLINE,\n quantity: 2,\n subtotal: '90.00',\n tax: '16.20',\n total: '97.20',\n unitPrice: '45.00',\n buyerEmail: 'mae.green@example.com',\n couponCode: 'BELIEVE10',\n);\n\nvar_dump($ticketSale);",
|
|
3894
|
+
},
|
|
3344
3895
|
python: {
|
|
3345
3896
|
method: 'ticket_sales.create',
|
|
3346
3897
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nticket_sale = client.ticket_sales.create(\n buyer_name="Mae Green",\n currency="GBP",\n discount="9.00",\n match_id="match-001",\n purchase_method="online",\n quantity=2,\n subtotal="90.00",\n tax="16.20",\n total="97.20",\n unit_price="45.00",\n)\nprint(ticket_sale.id)',
|
|
@@ -3370,6 +3921,10 @@ const EMBEDDED_METHODS = [
|
|
|
3370
3921
|
method: 'ticket_sales delete',
|
|
3371
3922
|
example: "believe ticket-sales delete \\\n --api-key 'My API Key' \\\n --ticket-sale-id ticket_sale_id",
|
|
3372
3923
|
},
|
|
3924
|
+
csharp: {
|
|
3925
|
+
method: 'TicketSales.Delete',
|
|
3926
|
+
example: 'TicketSaleDeleteParams parameters = new() { TicketSaleID = "ticket_sale_id" };\n\nawait client.TicketSales.Delete(parameters);',
|
|
3927
|
+
},
|
|
3373
3928
|
go: {
|
|
3374
3929
|
method: 'client.TicketSales.Delete',
|
|
3375
3930
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.TicketSales.Delete(context.TODO(), "ticket_sale_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -3385,6 +3940,10 @@ const EMBEDDED_METHODS = [
|
|
|
3385
3940
|
method: 'ticketSales().delete',
|
|
3386
3941
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.ticketsales.TicketSaleDeleteParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.ticketSales().delete("ticket_sale_id")\n}',
|
|
3387
3942
|
},
|
|
3943
|
+
php: {
|
|
3944
|
+
method: 'ticketSales->delete',
|
|
3945
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->ticketSales->delete('ticket_sale_id');\n\nvar_dump($result);",
|
|
3946
|
+
},
|
|
3388
3947
|
python: {
|
|
3389
3948
|
method: 'ticket_sales.delete',
|
|
3390
3949
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.ticket_sales.delete(\n "ticket_sale_id",\n)',
|
|
@@ -3415,6 +3974,10 @@ const EMBEDDED_METHODS = [
|
|
|
3415
3974
|
method: 'ticket_sales retrieve',
|
|
3416
3975
|
example: "believe ticket-sales retrieve \\\n --api-key 'My API Key' \\\n --ticket-sale-id ticket_sale_id",
|
|
3417
3976
|
},
|
|
3977
|
+
csharp: {
|
|
3978
|
+
method: 'TicketSales.Retrieve',
|
|
3979
|
+
example: 'TicketSaleRetrieveParams parameters = new() { TicketSaleID = "ticket_sale_id" };\n\nvar ticketSale = await client.TicketSales.Retrieve(parameters);\n\nConsole.WriteLine(ticketSale);',
|
|
3980
|
+
},
|
|
3418
3981
|
go: {
|
|
3419
3982
|
method: 'client.TicketSales.Get',
|
|
3420
3983
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tticketSale, err := client.TicketSales.Get(context.TODO(), "ticket_sale_id")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", ticketSale.ID)\n}\n',
|
|
@@ -3430,6 +3993,10 @@ const EMBEDDED_METHODS = [
|
|
|
3430
3993
|
method: 'ticketSales().retrieve',
|
|
3431
3994
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.ticketsales.TicketSale\nimport com.believe.api.models.ticketsales.TicketSaleRetrieveParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val ticketSale: TicketSale = client.ticketSales().retrieve("ticket_sale_id")\n}',
|
|
3432
3995
|
},
|
|
3996
|
+
php: {
|
|
3997
|
+
method: 'ticketSales->retrieve',
|
|
3998
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$ticketSale = $client->ticketSales->retrieve('ticket_sale_id');\n\nvar_dump($ticketSale);",
|
|
3999
|
+
},
|
|
3433
4000
|
python: {
|
|
3434
4001
|
method: 'ticket_sales.retrieve',
|
|
3435
4002
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nticket_sale = client.ticket_sales.retrieve(\n "ticket_sale_id",\n)\nprint(ticket_sale.id)',
|
|
@@ -3474,6 +4041,10 @@ const EMBEDDED_METHODS = [
|
|
|
3474
4041
|
method: 'ticket_sales update',
|
|
3475
4042
|
example: "believe ticket-sales update \\\n --api-key 'My API Key' \\\n --ticket-sale-id ticket_sale_id",
|
|
3476
4043
|
},
|
|
4044
|
+
csharp: {
|
|
4045
|
+
method: 'TicketSales.Update',
|
|
4046
|
+
example: 'TicketSaleUpdateParams parameters = new() { TicketSaleID = "ticket_sale_id" };\n\nvar ticketSale = await client.TicketSales.Update(parameters);\n\nConsole.WriteLine(ticketSale);',
|
|
4047
|
+
},
|
|
3477
4048
|
go: {
|
|
3478
4049
|
method: 'client.TicketSales.Update',
|
|
3479
4050
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tticketSale, err := client.TicketSales.Update(\n\t\tcontext.TODO(),\n\t\t"ticket_sale_id",\n\t\tbelieve.TicketSaleUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", ticketSale.ID)\n}\n',
|
|
@@ -3489,6 +4060,10 @@ const EMBEDDED_METHODS = [
|
|
|
3489
4060
|
method: 'ticketSales().update',
|
|
3490
4061
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.ticketsales.TicketSale\nimport com.believe.api.models.ticketsales.TicketSaleUpdateParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val ticketSale: TicketSale = client.ticketSales().update("ticket_sale_id")\n}',
|
|
3491
4062
|
},
|
|
4063
|
+
php: {
|
|
4064
|
+
method: 'ticketSales->update',
|
|
4065
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$ticketSale = $client->ticketSales->update(\n 'ticket_sale_id',\n buyerEmail: 'dev@stainless.com',\n buyerName: 'buyer_name',\n couponCode: 'coupon_code',\n currency: 'currency',\n discount: 'discount',\n matchID: 'match_id',\n purchaseMethod: PurchaseMethod::ONLINE,\n quantity: 1,\n subtotal: 'subtotal',\n tax: 'tax',\n total: 'total',\n unitPrice: 'unit_price',\n);\n\nvar_dump($ticketSale);",
|
|
4066
|
+
},
|
|
3492
4067
|
python: {
|
|
3493
4068
|
method: 'ticket_sales.update',
|
|
3494
4069
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nticket_sale = client.ticket_sales.update(\n ticket_sale_id="ticket_sale_id",\n)\nprint(ticket_sale.id)',
|
|
@@ -3518,6 +4093,10 @@ const EMBEDDED_METHODS = [
|
|
|
3518
4093
|
method: 'health check',
|
|
3519
4094
|
example: "believe health check \\\n --api-key 'My API Key'",
|
|
3520
4095
|
},
|
|
4096
|
+
csharp: {
|
|
4097
|
+
method: 'Health.Check',
|
|
4098
|
+
example: 'HealthCheckParams parameters = new();\n\nvar response = await client.Health.Check(parameters);\n\nConsole.WriteLine(response);',
|
|
4099
|
+
},
|
|
3521
4100
|
go: {
|
|
3522
4101
|
method: 'client.Health.Check',
|
|
3523
4102
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Health.Check(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response)\n}\n',
|
|
@@ -3533,6 +4112,10 @@ const EMBEDDED_METHODS = [
|
|
|
3533
4112
|
method: 'health().check',
|
|
3534
4113
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.health.HealthCheckParams\nimport com.believe.api.models.health.HealthCheckResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val response: HealthCheckResponse = client.health().check()\n}',
|
|
3535
4114
|
},
|
|
4115
|
+
php: {
|
|
4116
|
+
method: 'health->check',
|
|
4117
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$response = $client->health->check();\n\nvar_dump($response);",
|
|
4118
|
+
},
|
|
3536
4119
|
python: {
|
|
3537
4120
|
method: 'health.check',
|
|
3538
4121
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.health.check()\nprint(response)',
|
|
@@ -3562,6 +4145,10 @@ const EMBEDDED_METHODS = [
|
|
|
3562
4145
|
method: 'version retrieve',
|
|
3563
4146
|
example: "believe version retrieve \\\n --api-key 'My API Key'",
|
|
3564
4147
|
},
|
|
4148
|
+
csharp: {
|
|
4149
|
+
method: 'Version.Retrieve',
|
|
4150
|
+
example: 'VersionRetrieveParams parameters = new();\n\nvar version = await client.Version.Retrieve(parameters);\n\nConsole.WriteLine(version);',
|
|
4151
|
+
},
|
|
3565
4152
|
go: {
|
|
3566
4153
|
method: 'client.Version.Get',
|
|
3567
4154
|
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tversion, err := client.Version.Get(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", version)\n}\n',
|
|
@@ -3577,6 +4164,10 @@ const EMBEDDED_METHODS = [
|
|
|
3577
4164
|
method: 'version().retrieve',
|
|
3578
4165
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.version.VersionRetrieveParams\nimport com.believe.api.models.version.VersionRetrieveResponse\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n val version: VersionRetrieveResponse = client.version().retrieve()\n}',
|
|
3579
4166
|
},
|
|
4167
|
+
php: {
|
|
4168
|
+
method: 'version->retrieve',
|
|
4169
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$version = $client->version->retrieve();\n\nvar_dump($version);",
|
|
4170
|
+
},
|
|
3580
4171
|
python: {
|
|
3581
4172
|
method: 'version.retrieve',
|
|
3582
4173
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nversion = client.version.retrieve()\nprint(version)',
|
|
@@ -3605,6 +4196,10 @@ const EMBEDDED_METHODS = [
|
|
|
3605
4196
|
method: 'ws test',
|
|
3606
4197
|
example: "believe client:ws test \\\n --api-key 'My API Key'",
|
|
3607
4198
|
},
|
|
4199
|
+
csharp: {
|
|
4200
|
+
method: 'Client.Ws.Test',
|
|
4201
|
+
example: 'WTestParams parameters = new();\n\nawait client.Client.Ws.Test(parameters);',
|
|
4202
|
+
},
|
|
3608
4203
|
go: {
|
|
3609
4204
|
method: 'client.Client.Ws.Test',
|
|
3610
4205
|
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Client.Ws.Test(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
@@ -3620,6 +4215,10 @@ const EMBEDDED_METHODS = [
|
|
|
3620
4215
|
method: 'client().ws().test',
|
|
3621
4216
|
example: 'package com.believe.api.example\n\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.client.ws.WTestParams\n\nfun main() {\n val client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\n client.client().ws().test()\n}',
|
|
3622
4217
|
},
|
|
4218
|
+
php: {
|
|
4219
|
+
method: 'client->ws->test',
|
|
4220
|
+
example: "<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key');\n\n$result = $client->client->ws->test();\n\nvar_dump($result);",
|
|
4221
|
+
},
|
|
3623
4222
|
python: {
|
|
3624
4223
|
method: 'client.ws.test',
|
|
3625
4224
|
example: 'import os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\nclient.client.ws.test()',
|
|
@@ -3638,11 +4237,11 @@ const EMBEDDED_METHODS = [
|
|
|
3638
4237
|
const EMBEDDED_READMES = [
|
|
3639
4238
|
{
|
|
3640
4239
|
language: 'python',
|
|
3641
|
-
content: '# Believe Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/believe/)\n\nThe Believe Python library provides convenient access to the Believe REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJuYW1lIjoiQGNqYXZkZXYvYmVsaWV2ZS1tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9iZWxpZXZlLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtYmVsaWV2ZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbelieve.stlmcp.com%22%2C%22headers%22%3A%7B%22x-believe-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\n The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from the production repo\npip install git+ssh://git@github.com/cjavdev/believe-python.git\n```\n> [!NOTE]\n> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install believe`\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\n\npage = client.characters.list()\nprint(page.data)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `BELIEVE_API_KEY="My API Key"` to your `.env` file\nso that your API Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncBelieve` instead of `Believe` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom believe import AsyncBelieve\n\nclient = AsyncBelieve(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n page = await client.characters.list()\n print(page.data)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from the production repo\npip install \'believe[aiohttp] @ git+ssh://git@github.com/cjavdev/believe-python.git\'\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom believe import DefaultAioHttpClient\nfrom believe import AsyncBelieve\n\nasync def main() -> None:\n async with AsyncBelieve(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n page = await client.characters.list()\n print(page.data)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Believe API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom believe import Believe\n\nclient = Believe()\n\nall_characters = []\n# Automatically fetches more pages as needed.\nfor character in client.characters.list():\n # Do something with character here\n all_characters.append(character)\nprint(all_characters)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom believe import AsyncBelieve\n\nclient = AsyncBelieve()\n\nasync def main() -> None:\n all_characters = []\n # Iterate through items across all pages, issuing requests as needed.\n async for character in client.characters.list():\n all_characters.append(character)\n print(all_characters)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.characters.list()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.data)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.characters.list()\n\nprint(f"the current start offset for this page: {first_page.skip}") # => "the current start offset for this page: 1"\nfor character in first_page.data:\n print(character.id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom believe import Believe\n\nclient = Believe()\n\ncharacter = client.characters.create(\n background="Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.",\n emotional_stats={\n "curiosity": 40,\n "empathy": 85,\n "optimism": 45,\n "resilience": 95,\n "vulnerability": 60,\n },\n name="Roy Kent",\n personality_traits=["intense", "loyal", "secretly caring", "profane"],\n role="coach",\n)\nprint(character.emotional_stats)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom believe import Believe\n\nclient = Believe()\n\nclient.teams.logo.upload(\n team_id="team_id",\n file=Path("/path/to/file"),\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `believe.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `believe.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `believe.APIError`.\n\n```python\nimport believe\nfrom believe import Believe\n\nclient = Believe()\n\ntry:\n client.characters.list()\nexcept believe.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept believe.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept believe.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom believe import Believe\n\n# Configure the default for all requests:\nclient = Believe(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).characters.list()\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom believe import Believe\n\n# Configure the default for all requests:\nclient = Believe(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = Believe(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).characters.list()\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `BELIEVE_LOG` to `info`.\n\n```shell\n$ export BELIEVE_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom believe import Believe\n\nclient = Believe()\nresponse = client.characters.with_raw_response.list()\nprint(response.headers.get(\'X-My-Header\'))\n\ncharacter = response.parse() # get the object that `characters.list()` would have returned\nprint(character.id)\n```\n\nThese methods return an [`APIResponse`](https://github.com/cjavdev/believe-python/tree/main/src/believe/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/cjavdev/believe-python/tree/main/src/believe/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.characters.with_streaming_response.list() as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom believe import Believe, DefaultHttpxClient\n\nclient = Believe(\n # Or use the `BELIEVE_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom believe import Believe\n\nwith Believe() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport believe\nprint(believe.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
4240
|
+
content: '# Believe Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/believe/)\n\nThe Believe Python library provides convenient access to the Believe REST API from any Python 3.9+\napplication. The library includes type definitions for all request params and response fields,\nand offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjamF2ZGV2L2JlbGlldmUtbWNwIl0sImVudiI6eyJCRUxJRVZFX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cjavdev%2Fbelieve-mcp%22%5D%2C%22env%22%3A%7B%22BELIEVE_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\n The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from the production repo\npip install git+ssh://git@github.com/cjavdev/believe-python.git\n```\n> [!NOTE]\n> Once this package is [published to PyPI](https://www.stainless.com/docs/guides/publish), this will become: `pip install believe`\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom believe import Believe\n\nclient = Believe(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\n\npage = client.characters.list()\nprint(page.data)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `BELIEVE_API_KEY="My API Key"` to your `.env` file\nso that your API Key is not stored in source control.\n\n## Async usage\n\nSimply import `AsyncBelieve` instead of `Believe` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom believe import AsyncBelieve\n\nclient = AsyncBelieve(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n page = await client.characters.list()\n print(page.data)\n\nasyncio.run(main())\n```\n\nFunctionality between the synchronous and asynchronous clients is otherwise identical.\n\n### With aiohttp\n\nBy default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend.\n\nYou can enable this by installing `aiohttp`:\n\n```sh\n# install from the production repo\npip install \'believe[aiohttp] @ git+ssh://git@github.com/cjavdev/believe-python.git\'\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom believe import DefaultAioHttpClient\nfrom believe import AsyncBelieve\n\nasync def main() -> None:\n async with AsyncBelieve(\n api_key=os.environ.get("BELIEVE_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n page = await client.characters.list()\n print(page.data)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Believe API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom believe import Believe\n\nclient = Believe()\n\nall_characters = []\n# Automatically fetches more pages as needed.\nfor character in client.characters.list():\n # Do something with character here\n all_characters.append(character)\nprint(all_characters)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom believe import AsyncBelieve\n\nclient = AsyncBelieve()\n\nasync def main() -> None:\n all_characters = []\n # Iterate through items across all pages, issuing requests as needed.\n async for character in client.characters.list():\n all_characters.append(character)\n print(all_characters)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.characters.list()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.data)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.characters.list()\n\nprint(f"the current start offset for this page: {first_page.skip}") # => "the current start offset for this page: 1"\nfor character in first_page.data:\n print(character.id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom believe import Believe\n\nclient = Believe()\n\ncharacter = client.characters.create(\n background="Legendary midfielder for Chelsea and AFC Richmond, now assistant coach. Known for his gruff exterior hiding a heart of gold.",\n emotional_stats={\n "curiosity": 40,\n "empathy": 85,\n "optimism": 45,\n "resilience": 95,\n "vulnerability": 60,\n },\n name="Roy Kent",\n personality_traits=["intense", "loyal", "secretly caring", "profane"],\n role="coach",\n)\nprint(character.emotional_stats)\n```\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`.\n\n```python\nfrom pathlib import Path\nfrom believe import Believe\n\nclient = Believe()\n\nclient.teams.logo.upload(\n team_id="team_id",\n file=Path("/path/to/file"),\n)\n```\n\nThe async client uses the exact same interface. If you pass a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance, the file contents will be read asynchronously automatically.\n\n## Handling errors\n\nWhen the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `believe.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `believe.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `believe.APIError`.\n\n```python\nimport believe\nfrom believe import Believe\n\nclient = Believe()\n\ntry:\n client.characters.list()\nexcept believe.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept believe.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept believe.APIStatusError as e:\n print("Another non-200-range status code was received")\n print(e.status_code)\n print(e.response)\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors are automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors are all retried by default.\n\nYou can use the `max_retries` option to configure or disable retry settings:\n\n```python\nfrom believe import Believe\n\n# Configure the default for all requests:\nclient = Believe(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).characters.list()\n```\n\n### Timeouts\n\nBy default requests time out after 1 minute. You can configure this with a `timeout` option,\nwhich accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:\n\n```python\nfrom believe import Believe\n\n# Configure the default for all requests:\nclient = Believe(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = Believe(\n timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),\n)\n\n# Override per-request:\nclient.with_options(timeout = 5.0).characters.list()\n```\n\nOn timeout, an `APITimeoutError` is thrown.\n\nNote that requests that time out are [retried twice by default](#retries).\n\n\n\n## Advanced\n\n### Logging\n\nWe use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.\n\nYou can enable logging by setting the environment variable `BELIEVE_LOG` to `info`.\n\n```shell\n$ export BELIEVE_LOG=info\n```\n\nOr to `debug` for more verbose logging.\n\n### How to tell whether `None` means `null` or missing\n\nIn an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`:\n\n```py\nif response.my_field is None:\n if \'my_field\' not in response.model_fields_set:\n print(\'Got json like {}, without a "my_field" key present at all.\')\n else:\n print(\'Got json like {"my_field": null}.\')\n```\n\n### Accessing raw response data (e.g. headers)\n\nThe "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,\n\n```py\nfrom believe import Believe\n\nclient = Believe()\nresponse = client.characters.with_raw_response.list()\nprint(response.headers.get(\'X-My-Header\'))\n\ncharacter = response.parse() # get the object that `characters.list()` would have returned\nprint(character.id)\n```\n\nThese methods return an [`APIResponse`](https://github.com/cjavdev/believe-python/tree/main/src/believe/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/cjavdev/believe-python/tree/main/src/believe/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.\n\n#### `.with_streaming_response`\n\nThe above interface eagerly reads the full response body when you make the request, which may not always be what you want.\n\nTo stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.\n\n```python\nwith client.characters.with_streaming_response.list() as response :\n print(response.headers.get(\'X-My-Header\'))\n\n for line in response.iter_lines():\n print(line)\n```\n\nThe context manager is required so that the response will reliably be closed.\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API.\n\nIf you need to access undocumented endpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can make requests using `client.get`, `client.post`, and other\nhttp verbs. Options on the client will be respected (such as retries) when making this request.\n\n```py\nimport httpx\n\nresponse = client.post(\n "/foo",\n cast_to=httpx.Response,\n body={"my_param": True},\n)\n\nprint(response.headers.get("x-foo"))\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You\ncan also get all the extra fields on the Pydantic model as a dict with\n[`response.model_extra`](https://docs.pydantic.dev/latest/api/base_model/#pydantic.BaseModel.model_extra).\n\n### Configuring the HTTP client\n\nYou can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including:\n\n- Support for [proxies](https://www.python-httpx.org/advanced/proxies/)\n- Custom [transports](https://www.python-httpx.org/advanced/transports/)\n- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality\n\n```python\nimport httpx\nfrom believe import Believe, DefaultHttpxClient\n\nclient = Believe(\n # Or use the `BELIEVE_BASE_URL` env var\n base_url="http://my.test.server.example.com:8083",\n http_client=DefaultHttpxClient(proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0")),\n)\n```\n\nYou can also customize the client on a per-request basis by using `with_options()`:\n\n```python\nclient.with_options(http_client=DefaultHttpxClient(...))\n```\n\n### Managing HTTP resources\n\nBy default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.\n\n```py\nfrom believe import Believe\n\nwith Believe() as client:\n # make requests here\n ...\n\n# HTTP client is now closed\n```\n\n## Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-python/issues) with questions, bugs, or suggestions.\n\n### Determining the installed version\n\nIf you\'ve upgraded to the latest version but aren\'t seeing any new features you were expecting then your python environment is likely still using an older version.\n\nYou can determine the version that is being used at runtime with:\n\n```py\nimport believe\nprint(believe.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
3642
4241
|
},
|
|
3643
4242
|
{
|
|
3644
4243
|
language: 'go',
|
|
3645
|
-
content: '# Believe Go API Library\n\n<a href="https://pkg.go.dev/github.com/cjavdev/believe-go"><img src="https://pkg.go.dev/badge/github.com/cjavdev/believe-go.svg" alt="Go Reference"></a>\n\nThe Believe Go library provides convenient access to the Believe REST API\nfrom applications written in Go.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJuYW1lIjoiQGNqYXZkZXYvYmVsaWV2ZS1tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9iZWxpZXZlLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtYmVsaWV2ZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbelieve.stlmcp.com%22%2C%22headers%22%3A%7B%22x-believe-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n```go\nimport (\n\t"github.com/cjavdev/believe-go" // imported as SDK_PackageName\n)\n```\n\n<!-- x-release-please-end -->\n\nOr to pin the version:\n\n<!-- x-release-please-start-version -->\n\n```sh\ngo get -u \'github.com/cjavdev/believe-go@v0.0.1\'\n```\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("BELIEVE_API_KEY")\n\t)\n\tpage, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Characters.List(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/cjavdev/believe-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Characters.ListAutoPaging(context.TODO(), believe.CharacterListParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\tcharacter := iter.Current()\n\tfmt.Printf("%+v\\n", character)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\nfor page != nil {\n\tfor _, character := range page.Data {\n\t\tfmt.Printf("%+v\\n", character)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\nif err != nil {\n\tvar apierr *believe.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/characters": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Characters.List(\n\tctx,\n\tbelieve.CharacterListParams{},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("/path/to/file")\nbelieve.TeamLogoUploadParams{\n\tFile: file,\n}\n\n// A file from a string\nbelieve.TeamLogoUploadParams{\n\tFile: strings.NewReader("my file contents"),\n}\n\n// With a custom filename and contentType\nbelieve.TeamLogoUploadParams{\n\tFile: believe.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := believe.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Characters.List(\n\tcontext.TODO(),\n\tbelieve.CharacterListParams{},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\npage, err := client.Characters.List(\n\tcontext.TODO(),\n\tbelieve.CharacterListParams{},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", page)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
4244
|
+
content: '# Believe Go API Library\n\n<a href="https://pkg.go.dev/github.com/cjavdev/believe-go"><img src="https://pkg.go.dev/badge/github.com/cjavdev/believe-go.svg" alt="Go Reference"></a>\n\nThe Believe Go library provides convenient access to the Believe REST API\nfrom applications written in Go.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjamF2ZGV2L2JlbGlldmUtbWNwIl0sImVudiI6eyJCRUxJRVZFX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cjavdev%2Fbelieve-mcp%22%5D%2C%22env%22%3A%7B%22BELIEVE_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n```go\nimport (\n\t"github.com/cjavdev/believe-go" // imported as SDK_PackageName\n)\n```\n\n<!-- x-release-please-end -->\n\nOr to pin the version:\n\n<!-- x-release-please-start-version -->\n\n```sh\ngo get -u \'github.com/cjavdev/believe-go@v0.0.1\'\n```\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Go 1.22+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```go\npackage main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/cjavdev/believe-go"\n\t"github.com/cjavdev/believe-go/option"\n)\n\nfunc main() {\n\tclient := believe.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("BELIEVE_API_KEY")\n\t)\n\tpage, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n\n```\n\n### Request fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `\'\'`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: SDK_PackageName.F("hello"),\n\n\t// Explicitly send `"description": null`\n\tDescription: SDK_PackageName.Null[string](),\n\n\tPoint: SDK_PackageName.F(SDK_PackageName.Point{\n\t\tX: SDK_PackageName.Int(0),\n\t\tY: SDK_PackageName.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: SDK_PackageName.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == "" {\n\t// true if `"name"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `"name"` key was not present in the response JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:"first"`\n\t\t\tLast string `json:"last"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), &legacyName)\n\t\tname = legacyName.First + " " + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields["my_unexpected_field"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`SDK_PackageOptionName` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\t// Adds a header to every request made by the client\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "custom_header_info"),\n)\n\nclient.Characters.List(context.TODO(), ...,\n\t// Override the header\n\tSDK_PackageOptionName.WithHeader("X-Some-Header", "some_other_custom_header_info"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\tSDK_PackageOptionName.WithJSONSet("some.json.path", map[string]string{"my": "object"}),\n)\n```\n\nSee the [full list of request options](https://pkg.go.dev/github.com/cjavdev/believe-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Characters.ListAutoPaging(context.TODO(), believe.CharacterListParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\tcharacter := iter.Current()\n\tfmt.Printf("%+v\\n", character)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\nfor page != nil {\n\tfor _, character := range page.Data {\n\t\tfmt.Printf("%+v\\n", character)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Characters.List(context.TODO(), believe.CharacterListParams{})\nif err != nil {\n\tvar apierr *believe.Error\n\tif errors.As(err, &apierr) {\n\t\tprintln(string(apierr.DumpRequest(true))) // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t}\n\tpanic(err.Error()) // GET "/characters": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `SDK_PackageOptionName.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Characters.List(\n\tctx,\n\tbelieve.CharacterListParams{},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads in multipart requests are typed as\n`param.Field[io.Reader]`. The contents of the `io.Reader` will by default be sent as a multipart form\npart with the file name of "anonymous_file" and content-type of "application/octet-stream".\n\nThe file name and content-type can be customized by implementing `Name() string` or `ContentType()\nstring` on the run-time type of `io.Reader`. Note that `os.File` implements `Name() string`, so a\nfile returned by `os.Open` will be sent with the file name on disk.\n\nWe also provide a helper `SDK_PackageName.FileParam(reader io.Reader, filename string, contentType string)`\nwhich can be used to wrap any `io.Reader` with the appropriate file name and content type.\n\n```go\n// A file from the file system\nfile, err := os.Open("/path/to/file")\nbelieve.TeamLogoUploadParams{\n\tFile: file,\n}\n\n// A file from a string\nbelieve.TeamLogoUploadParams{\n\tFile: strings.NewReader("my file contents"),\n}\n\n// With a custom filename and contentType\nbelieve.TeamLogoUploadParams{\n\tFile: believe.File(strings.NewReader(`{"hello": "foo"}`), "file.go", "application/json"),\n}\n```\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand >=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := believe.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Characters.List(\n\tcontext.TODO(),\n\tbelieve.CharacterListParams{},\n\toption.WithMaxRetries(5),\n)\n```\n\n\n### Accessing raw response data (e.g. response headers)\n\nYou can access the raw HTTP response data by using the `option.WithResponseInto()` request option. This is useful when\nyou need to examine response headers, status codes, or other details.\n\n```go\n// Create a variable to store the HTTP response\nvar response *http.Response\npage, err := client.Characters.List(\n\tcontext.TODO(),\n\tbelieve.CharacterListParams{},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", page)\n\nfmt.Printf("Status Code: %d\\n", response.StatusCode)\nfmt.Printf("Headers: %+#v\\n", response.Header)\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.Get`, `client.Post`, and other HTTP verbs.\n`RequestOptions` on the client, such as retries, will be respected when making these requests.\n\n```go\nvar (\n // params can be an io.Reader, a []byte, an encoding/json serializable object,\n // or a "…Params" struct defined in this library.\n params map[string]interface{}\n\n // result can be an []byte, *http.Response, a encoding/json deserializable object,\n // or a model defined in this library.\n result *http.Response\n)\nerr := client.Post(context.Background(), "/unspecified", params, &result)\nif err != nil {\n …\n}\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use either the `SDK_PackageOptionName.WithQuerySet()`\nor the `SDK_PackageOptionName.WithJSONSet()` methods.\n\n```go\nparams := FooNewParams{\n ID: SDK_PackageName.F("id_xxxx"),\n Data: SDK_PackageName.F(FooNewParamsData{\n FirstName: SDK_PackageName.F("John"),\n }),\n}\nclient.Foo.New(context.Background(), params, SDK_PackageOptionName.WithJSONSet("data.last_name", "Doe"))\n```\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may either access the raw JSON of the response as a string\nwith `result.JSON.RawJSON()`, or get the raw JSON of a particular field on the result with\n`result.JSON.Foo.Raw()`.\n\nAny fields that are not present on the response struct will be saved and can be accessed by `result.JSON.ExtraFields()` which returns the extra fields as a `map[string]Field`.\n\n### Middleware\n\nWe provide `SDK_PackageOptionName.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next SDK_PackageOptionName.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n return res, err\n}\n\nclient := SDK_PackageName.SDK_ClientInitializerName(\n\tSDK_PackageOptionName.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `SDK_PackageOptionName.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`SDK_PackageOptionName.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
3646
4245
|
},
|
|
3647
4246
|
{
|
|
3648
4247
|
language: 'terraform',
|
|
@@ -3650,24 +4249,32 @@ const EMBEDDED_READMES = [
|
|
|
3650
4249
|
},
|
|
3651
4250
|
{
|
|
3652
4251
|
language: 'typescript',
|
|
3653
|
-
content: "# Believe TypeScript API Library\n\n[)](https://npmjs.org/package/@cjavdev/believe) \n\nThis library provides convenient access to the Believe REST API from server-side TypeScript or JavaScript.\n\n\n\nThe full API of this library can be found in [api.md](api.md).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJuYW1lIjoiQGNqYXZkZXYvYmVsaWV2ZS1tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9iZWxpZXZlLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtYmVsaWV2ZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbelieve.stlmcp.com%22%2C%22headers%22%3A%7B%22x-believe-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @cjavdev/believe\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n<!-- prettier-ignore -->\n```js\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n apiKey: process.env['BELIEVE_API_KEY'], // This is the default and can be omitted\n});\n\nconst page = await client.characters.list();\nconst character = page.data[0];\n\nconsole.log(character.id);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n<!-- prettier-ignore -->\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n apiKey: process.env['BELIEVE_API_KEY'], // This is the default and can be omitted\n});\n\nconst [character]: [Believe.Character] = await client.characters.list();\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport Believe, { toFile } from '@cjavdev/believe';\n\nconst client = new Believe();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.teams.logo.upload('team_id', { file: fs.createReadStream('/path/to/file') });\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.teams.logo.upload('team_id', { file: new File(['my bytes'], 'file') });\n\n// You can also pass a `fetch` `Response`:\nawait client.teams.logo.upload('team_id', { file: await fetch('https://somesite/file') });\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.teams.logo.upload('team_id', { file: await toFile(Buffer.from('my bytes'), 'file') });\nawait client.teams.logo.upload('team_id', {\n file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n<!-- prettier-ignore -->\n```ts\nconst page = await client.characters.list().catch(async (err) => {\n if (err instanceof Believe.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n});\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n<!-- prettier-ignore -->\n```js\n// Configure the default for all requests:\nconst client = new Believe({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.characters.list({\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n<!-- prettier-ignore -->\n```ts\n// Configure the default for all requests:\nconst client = new Believe({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.characters.list({\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the Believe API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllCharacters(params) {\n const allCharacters = [];\n // Automatically fetches more pages as needed.\n for await (const character of client.characters.list()) {\n allCharacters.push(character);\n }\n return allCharacters;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.characters.list();\nfor (const character of page.data) {\n console.log(character);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### Tree shaking\n\nThis library supports tree shaking to reduce bundle size. Instead of importing the full client, you can create a client only including the API resources you need:\n\n~~~ts\nimport { createClient } from '@cjavdev/believe/tree-shakable';\nimport { Characters } from '@cjavdev/believe/resources/characters';\nimport { BaseLogo } from '@cjavdev/believe/resources/teams/logo';\n\nconst client = createClient({\n // Specify the resources you'd like to use ...\n resources: [Characters, BaseLogo],\n});\n\n// ... then make API calls as usual.\nconst page = await client.characters.list();\nconst character = page.data[0]\nconst fileUpload = await client.teams.logo.upload('team_id', { file: fs.createReadStream('path/to/file') });\n~~~\n\nEach API resource has two versions, the full resource (e.g., `Characters`) which includes all subresources, and the base resource (e.g., `BaseCharacters`) which does not.\n\nThe tree-shaken client is fully typed, so TypeScript will provide accurate autocomplete and prevent access to resources not included in your configuration.\nThe `createClient` function automatically infers the correct type, but you can also use the `PartialBelieve` type explicitly:\n\n~~~ts\nimport Believe from '@cjavdev/believe';\nimport { createClient, type PartialBelieve } from '@cjavdev/believe/tree-shakable';\nimport { BaseCharacters } from '@cjavdev/believe/resources/characters';\n\n// Explicit variable type\nconst client: PartialBelieve<{ characters: BaseCharacters }> = createClient({\n resources: [BaseCharacters],\n /* ... */\n});\n\n// Function parameter type\nasync function main(client: PartialBelieve<{ characters: BaseCharacters }>) {\n const page = await client.characters.list();\n const character = page.data[0]\n}\n\n// Works with any client that has the characters resource\nconst treeShakableClient = createClient({\n resources: [BaseCharacters],\n /* ... */\n});\nconst fullClient = new Believe(/* ... */);\n\nmain(treeShakableClient); // Works\nmain(fullClient); // Also works\n~~~\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n<!-- prettier-ignore -->\n```ts\nconst client = new Believe();\n\nconst response = await client.characters.list().asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: page, response: raw } = await client.characters.list().withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nfor await (const character of page) {\n console.log(character.id);\n}\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `BELIEVE_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport Believe from '@cjavdev/believe';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new Believe({\n logger: logger.child({ name: 'Believe' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.characters.list({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport Believe from '@cjavdev/believe';\nimport fetch from 'my-fetch';\n\nconst client = new Believe({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>\n\n```ts\nimport Believe from '@cjavdev/believe';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new Believe({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>\n\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>\n\n```ts\nimport Believe from 'npm:@cjavdev/believe';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new Believe({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-typescript/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n- Web browsers: disabled by default to avoid exposing your secret API credentials. Enable browser support by explicitly setting `dangerouslyAllowBrowser` to true'.\n<details>\n <summary>More explanation</summary>\n\n ### Why is this dangerous?\n Enabling the `dangerouslyAllowBrowser` option can be dangerous because it exposes your secret API credentials in the client-side code. Web browsers are inherently less secure than server environments,\n any user with access to the browser can potentially inspect, extract, and misuse these credentials. This could lead to unauthorized access using your credentials and potentially compromise sensitive data or functionality.\n ### When might this not be dangerous?\n In certain scenarios where enabling browser support might not pose significant risks:\n - Internal Tools: If the application is used solely within a controlled internal environment where the users are trusted, the risk of credential exposure can be mitigated.\n - Public APIs with Limited Scope: If your API has very limited scope and the exposed credentials do not grant access to sensitive data or critical operations, the potential impact of exposure is reduced.\n - Development or debugging purpose: Enabling this feature temporarily might be acceptable, provided the credentials are short-lived, aren't also used in production environments, or are frequently rotated.\n\n</details>\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n",
|
|
4252
|
+
content: "# Believe TypeScript API Library\n\n[)](https://npmjs.org/package/@cjavdev/believe) \n\nThis library provides convenient access to the Believe REST API from server-side TypeScript or JavaScript.\n\n\n\nThe full API of this library can be found in [api.md](api.md).\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjamF2ZGV2L2JlbGlldmUtbWNwIl0sImVudiI6eyJCRUxJRVZFX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cjavdev%2Fbelieve-mcp%22%5D%2C%22env%22%3A%7B%22BELIEVE_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Installation\n\n```sh\nnpm install @cjavdev/believe\n```\n\n\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n<!-- prettier-ignore -->\n```js\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n apiKey: process.env['BELIEVE_API_KEY'], // This is the default and can be omitted\n});\n\nconst page = await client.characters.list();\nconst character = page.data[0];\n\nconsole.log(character.id);\n```\n\n\n\n### Request & Response types\n\nThis library includes TypeScript definitions for all request params and response fields. You may import and use them like so:\n\n<!-- prettier-ignore -->\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n apiKey: process.env['BELIEVE_API_KEY'], // This is the default and can be omitted\n});\n\nconst [character]: [Believe.Character] = await client.characters.list();\n```\n\nDocumentation for each method, request param, and response field are available in docstrings and will appear on hover in most modern editors.\n\n## File uploads\n\nRequest parameters that correspond to file uploads can be passed in many different forms:\n- `File` (or an object with the same structure)\n- a `fetch` `Response` (or an object with the same structure)\n- an `fs.ReadStream`\n- the return value of our `toFile` helper\n\n```ts\nimport fs from 'fs';\nimport Believe, { toFile } from '@cjavdev/believe';\n\nconst client = new Believe();\n\n// If you have access to Node `fs` we recommend using `fs.createReadStream()`:\nawait client.teams.logo.upload('team_id', { file: fs.createReadStream('/path/to/file') });\n\n// Or if you have the web `File` API you can pass a `File` instance:\nawait client.teams.logo.upload('team_id', { file: new File(['my bytes'], 'file') });\n\n// You can also pass a `fetch` `Response`:\nawait client.teams.logo.upload('team_id', { file: await fetch('https://somesite/file') });\n\n// Finally, if none of the above are convenient, you can use our `toFile` helper:\nawait client.teams.logo.upload('team_id', { file: await toFile(Buffer.from('my bytes'), 'file') });\nawait client.teams.logo.upload('team_id', {\n file: await toFile(new Uint8Array([0, 1, 2]), 'file'),\n});\n```\n\n\n\n## Handling errors\n\nWhen the library is unable to connect to the API,\nor if the API returns a non-success status code (i.e., 4xx or 5xx response),\na subclass of `APIError` will be thrown:\n\n<!-- prettier-ignore -->\n```ts\nconst page = await client.characters.list().catch(async (err) => {\n if (err instanceof Believe.APIError) {\n console.log(err.status); // 400\n console.log(err.name); // BadRequestError\n console.log(err.headers); // {server: 'nginx', ...}\n } else {\n throw err;\n }\n});\n```\n\nError codes are as follows:\n\n| Status Code | Error Type |\n| ----------- | -------------------------- |\n| 400 | `BadRequestError` |\n| 401 | `AuthenticationError` |\n| 403 | `PermissionDeniedError` |\n| 404 | `NotFoundError` |\n| 422 | `UnprocessableEntityError` |\n| 429 | `RateLimitError` |\n| >=500 | `InternalServerError` |\n| N/A | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict,\n429 Rate Limit, and >=500 Internal errors will all be retried by default.\n\nYou can use the `maxRetries` option to configure or disable this:\n\n<!-- prettier-ignore -->\n```js\n// Configure the default for all requests:\nconst client = new Believe({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.characters.list({\n maxRetries: 5,\n});\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default. You can configure this with a `timeout` option:\n\n<!-- prettier-ignore -->\n```ts\n// Configure the default for all requests:\nconst client = new Believe({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.characters.list({\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the Believe API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllCharacters(params) {\n const allCharacters = [];\n // Automatically fetches more pages as needed.\n for await (const character of client.characters.list()) {\n allCharacters.push(character);\n }\n return allCharacters;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.characters.list();\nfor (const character of page.data) {\n console.log(character);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### Tree shaking\n\nThis library supports tree shaking to reduce bundle size. Instead of importing the full client, you can create a client only including the API resources you need:\n\n~~~ts\nimport { createClient } from '@cjavdev/believe/tree-shakable';\nimport { Characters } from '@cjavdev/believe/resources/characters';\nimport { BaseLogo } from '@cjavdev/believe/resources/teams/logo';\n\nconst client = createClient({\n // Specify the resources you'd like to use ...\n resources: [Characters, BaseLogo],\n});\n\n// ... then make API calls as usual.\nconst page = await client.characters.list();\nconst character = page.data[0]\nconst fileUpload = await client.teams.logo.upload('team_id', { file: fs.createReadStream('path/to/file') });\n~~~\n\nEach API resource has two versions, the full resource (e.g., `Characters`) which includes all subresources, and the base resource (e.g., `BaseCharacters`) which does not.\n\nThe tree-shaken client is fully typed, so TypeScript will provide accurate autocomplete and prevent access to resources not included in your configuration.\nThe `createClient` function automatically infers the correct type, but you can also use the `PartialBelieve` type explicitly:\n\n~~~ts\nimport Believe from '@cjavdev/believe';\nimport { createClient, type PartialBelieve } from '@cjavdev/believe/tree-shakable';\nimport { BaseCharacters } from '@cjavdev/believe/resources/characters';\n\n// Explicit variable type\nconst client: PartialBelieve<{ characters: BaseCharacters }> = createClient({\n resources: [BaseCharacters],\n /* ... */\n});\n\n// Function parameter type\nasync function main(client: PartialBelieve<{ characters: BaseCharacters }>) {\n const page = await client.characters.list();\n const character = page.data[0]\n}\n\n// Works with any client that has the characters resource\nconst treeShakableClient = createClient({\n resources: [BaseCharacters],\n /* ... */\n});\nconst fullClient = new Believe(/* ... */);\n\nmain(treeShakableClient); // Works\nmain(fullClient); // Also works\n~~~\n\n### Accessing raw Response data (e.g., headers)\n\nThe \"raw\" `Response` returned by `fetch()` can be accessed through the `.asResponse()` method on the `APIPromise` type that all methods return.\nThis method returns as soon as the headers for a successful response are received and does not consume the response body, so you are free to write custom parsing or streaming logic.\n\nYou can also use the `.withResponse()` method to get the raw `Response` along with the parsed data.\nUnlike `.asResponse()` this method consumes the body, returning once it is parsed.\n\n<!-- prettier-ignore -->\n```ts\nconst client = new Believe();\n\nconst response = await client.characters.list().asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: page, response: raw } = await client.characters.list().withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nfor await (const character of page) {\n console.log(character.id);\n}\n```\n\n### Logging\n\n> [!IMPORTANT]\n> All log messages are intended for debugging only. The format and content of log messages\n> may change between releases.\n\n#### Log levels\n\nThe log level can be configured in two ways:\n\n1. Via the `BELIEVE_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n logLevel: 'debug', // Show all log messages\n});\n```\n\nAvailable log levels, from most to least verbose:\n\n- `'debug'` - Show debug messages, info, warnings, and errors\n- `'info'` - Show info messages, warnings, and errors\n- `'warn'` - Show warnings and errors (default)\n- `'error'` - Show only errors\n- `'off'` - Disable all logging\n\nAt the `'debug'` level, all HTTP requests and responses are logged, including headers and bodies.\nSome authentication-related headers are redacted, but sensitive data in request and response bodies\nmay still be visible.\n\n#### Custom logger\n\nBy default, this library logs to `globalThis.console`. You can also provide a custom logger.\nMost logging libraries are supported, including [pino](https://www.npmjs.com/package/pino), [winston](https://www.npmjs.com/package/winston), [bunyan](https://www.npmjs.com/package/bunyan), [consola](https://www.npmjs.com/package/consola), [signale](https://www.npmjs.com/package/signale), and [@std/log](https://jsr.io/@std/log). If your logger doesn't work, please open an issue.\n\nWhen providing a custom logger, the `logLevel` option still controls which messages are emitted, messages\nbelow the configured level will not be sent to your logger.\n\n```ts\nimport Believe from '@cjavdev/believe';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new Believe({\n logger: logger.child({ name: 'Believe' }),\n logLevel: 'debug', // Send all messages to pino, allowing it to filter\n});\n```\n\n### Making custom/undocumented requests\n\nThis library is typed for convenient access to the documented API. If you need to access undocumented\nendpoints, params, or response properties, the library can still be used.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints, you can use `client.get`, `client.post`, and other HTTP verbs.\nOptions on the client, such as retries, will be respected when making these requests.\n\n```ts\nawait client.post('/some/path', {\n body: { some_prop: 'foo' },\n query: { some_query_arg: 'bar' },\n});\n```\n\n#### Undocumented request params\n\nTo make requests using undocumented parameters, you may use `// @ts-expect-error` on the undocumented\nparameter. This library doesn't validate at runtime that the request matches the type, so any extra values you\nsend will be sent as-is.\n\n```ts\nclient.characters.list({\n // ...\n // @ts-expect-error baz is not yet public\n baz: 'undocumented option',\n});\n```\n\nFor requests with the `GET` verb, any extra params will be in the query, all other requests will send the\nextra param in the body.\n\nIf you want to explicitly send an extra argument, you can do so with the `query`, `body`, and `headers` request\noptions.\n\n#### Undocumented response properties\n\nTo access undocumented response properties, you may access the response object with `// @ts-expect-error` on\nthe response object, or cast the response object to the requisite type. Like the request params, we do not\nvalidate or strip extra properties from the response from the API.\n\n### Customizing the fetch client\n\nBy default, this library expects a global `fetch` function is defined.\n\nIf you want to use a different `fetch` function, you can either polyfill the global:\n\n```ts\nimport fetch from 'my-fetch';\n\nglobalThis.fetch = fetch;\n```\n\nOr pass it to the client:\n\n```ts\nimport Believe from '@cjavdev/believe';\nimport fetch from 'my-fetch';\n\nconst client = new Believe({ fetch });\n```\n\n### Fetch options\n\nIf you want to set custom `fetch` options without overriding the `fetch` function, you can provide a `fetchOptions` object when instantiating the client or making a request. (Request-specific options override client options.)\n\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n fetchOptions: {\n // `RequestInit` options\n },\n});\n```\n\n#### Configuring proxies\n\nTo modify proxy behavior, you can provide custom `fetchOptions` that add runtime-specific proxy\noptions to requests:\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/node.svg\" align=\"top\" width=\"18\" height=\"21\"> **Node** <sup>[[docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md#example---proxyagent-with-fetch)]</sup>\n\n```ts\nimport Believe from '@cjavdev/believe';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new Believe({\n fetchOptions: {\n dispatcher: proxyAgent,\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/bun.svg\" align=\"top\" width=\"18\" height=\"21\"> **Bun** <sup>[[docs](https://bun.sh/guides/http/proxy)]</sup>\n\n```ts\nimport Believe from '@cjavdev/believe';\n\nconst client = new Believe({\n fetchOptions: {\n proxy: 'http://localhost:8888',\n },\n});\n```\n\n<img src=\"https://raw.githubusercontent.com/stainless-api/sdk-assets/refs/heads/main/deno.svg\" align=\"top\" width=\"18\" height=\"21\"> **Deno** <sup>[[docs](https://docs.deno.com/api/deno/~/Deno.createHttpClient)]</sup>\n\n```ts\nimport Believe from 'npm:@cjavdev/believe';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new Believe({\n fetchOptions: {\n client: httpClient,\n },\n});\n```\n\n## Frequently Asked Questions\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes that only affect static types, without breaking runtime behavior.\n2. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n3. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-typescript/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Node.js 20 LTS or later ([non-EOL](https://endoflife.date/nodejs)) versions.\n- Deno v1.28.0 or higher.\n- Bun 1.0 or later.\n- Cloudflare Workers.\n- Vercel Edge Runtime.\n- Jest 28 or greater with the `\"node\"` environment (`\"jsdom\"` is not supported at this time).\n- Nitro v2.6 or greater.\n- Web browsers: disabled by default to avoid exposing your secret API credentials. Enable browser support by explicitly setting `dangerouslyAllowBrowser` to true'.\n<details>\n <summary>More explanation</summary>\n\n ### Why is this dangerous?\n Enabling the `dangerouslyAllowBrowser` option can be dangerous because it exposes your secret API credentials in the client-side code. Web browsers are inherently less secure than server environments,\n any user with access to the browser can potentially inspect, extract, and misuse these credentials. This could lead to unauthorized access using your credentials and potentially compromise sensitive data or functionality.\n ### When might this not be dangerous?\n In certain scenarios where enabling browser support might not pose significant risks:\n - Internal Tools: If the application is used solely within a controlled internal environment where the users are trusted, the risk of credential exposure can be mitigated.\n - Public APIs with Limited Scope: If your API has very limited scope and the exposed credentials do not grant access to sensitive data or critical operations, the potential impact of exposure is reduced.\n - Development or debugging purpose: Enabling this feature temporarily might be acceptable, provided the credentials are short-lived, aren't also used in production environments, or are frequently rotated.\n\n</details>\n\nNote that React Native is not supported at this time.\n\nIf you are interested in other runtime environments, please open or upvote an issue on GitHub.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n",
|
|
3654
4253
|
},
|
|
3655
4254
|
{
|
|
3656
4255
|
language: 'ruby',
|
|
3657
|
-
content: '# Believe Ruby API library\n\nThe Believe Ruby library provides convenient access to the Believe REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/cjavdev/believe-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJuYW1lIjoiQGNqYXZkZXYvYmVsaWV2ZS1tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9iZWxpZXZlLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtYmVsaWV2ZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbelieve.stlmcp.com%22%2C%22headers%22%3A%7B%22x-believe-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/believe).\n\n\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n<!-- x-release-please-start-version -->\n\n```ruby\ngem "believe", "~> 0.0.1"\n```\n\n<!-- x-release-please-end -->\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "believe"\n\nbelieve = ::Believe::Client.new(\n api_key: ENV["BELIEVE_API_KEY"] # This is the default and can be omitted\n)\n\npage = believe.characters.list\n\nputs(page.id)\n```\n\n\n\n### Pagination\n\nList methods in the Believe API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```ruby\npage = believe.characters.list\n\n# Fetch single item from page.\ncharacter = page.data[0]\nputs(character.id)\n\n# Automatically fetches more pages as needed.\npage.auto_paging_each do |character|\n puts(character.id)\nend\n```\n\nAlternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.\n\n```ruby\nif page.next_page?\n new_page = page.next_page\n puts(new_page.data[0].id)\nend\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\nfile_upload = believe.teams.logo.upload(file: Pathname("/path/to/file"))\n\n# Alternatively, pass file contents or a `StringIO` directly:\nfile_upload = believe.teams.logo.upload(file: File.read("/path/to/file"))\n\n# Or, to control the filename and/or content type:\nfile = ::Believe::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")\nfile_upload = believe.teams.logo.upload(file: file)\n\nputs(file_upload.file_id)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `::Believe::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n character = believe.characters.list\nrescue ::Believe::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue ::Believe::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue ::Believe::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nbelieve = ::Believe::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\nbelieve.characters.list(request_options: {max_retries: 5})\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nbelieve = ::Believe::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\nbelieve.characters.list(request_options: {timeout: 5})\n```\n\nOn timeout, `::Believe::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `::Believe::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\npage =\n believe.characters.list(\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(page[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `::Believe::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `::Believe::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nbelieve.characters.list \n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nbelieve.characters.list\n\n# You can also splat a full Params class:\nparams = ::Believe::CharacterListParams.new\nbelieve.characters.list(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :coach\nputs(::Believe::CharacterRole::COACH)\n\n# Revealed type: `T.all(::Believe::CharacterRole, Symbol)`\nT.reveal_type(::Believe::CharacterRole::COACH)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nbelieve.characters.create(\n role: ::Believe::CharacterRole::COACH,\n # …\n)\n\n# Literal values are also permissible:\nbelieve.characters.create(\n role: :coach,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/cjavdev/believe-ruby/tree/main/CONTRIBUTING.md).\n',
|
|
4256
|
+
content: '# Believe Ruby API library\n\nThe Believe Ruby library provides convenient access to the Believe REST API from any Ruby 3.2.0+ application. It ships with comprehensive types & docstrings in Yard, RBS, and RBI – [see below](https://github.com/cjavdev/believe-ruby#Sorbet) for usage with Sorbet. The standard library\'s `net/http` is used as the HTTP transport, with connection pooling via the `connection_pool` gem.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjamF2ZGV2L2JlbGlldmUtbWNwIl0sImVudiI6eyJCRUxJRVZFX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cjavdev%2Fbelieve-mcp%22%5D%2C%22env%22%3A%7B%22BELIEVE_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n## Documentation\n\nDocumentation for releases of this gem can be found [on RubyDoc](https://gemdocs.org/gems/believe).\n\n\n\n## Installation\n\nTo use this gem, install via Bundler by adding the following to your application\'s `Gemfile`:\n\n<!-- x-release-please-start-version -->\n\n```ruby\ngem "believe", "~> 0.0.1"\n```\n\n<!-- x-release-please-end -->\n\n## Usage\n\n```ruby\nrequire "bundler/setup"\nrequire "believe"\n\nbelieve = ::Believe::Client.new(\n api_key: ENV["BELIEVE_API_KEY"] # This is the default and can be omitted\n)\n\npage = believe.characters.list\n\nputs(page.id)\n```\n\n\n\n### Pagination\n\nList methods in the Believe API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```ruby\npage = believe.characters.list\n\n# Fetch single item from page.\ncharacter = page.data[0]\nputs(character.id)\n\n# Automatically fetches more pages as needed.\npage.auto_paging_each do |character|\n puts(character.id)\nend\n```\n\nAlternatively, you can use the `#next_page?` and `#next_page` methods for more granular control working with pages.\n\n```ruby\nif page.next_page?\n new_page = page.next_page\n puts(new_page.data[0].id)\nend\n```\n\n### File uploads\n\nRequest parameters that correspond to file uploads can be passed as raw contents, a [`Pathname`](https://rubyapi.org/3.2/o/pathname) instance, [`StringIO`](https://rubyapi.org/3.2/o/stringio), or more.\n\n```ruby\nrequire "pathname"\n\n# Use `Pathname` to send the filename and/or avoid paging a large file into memory:\nfile_upload = believe.teams.logo.upload(file: Pathname("/path/to/file"))\n\n# Alternatively, pass file contents or a `StringIO` directly:\nfile_upload = believe.teams.logo.upload(file: File.read("/path/to/file"))\n\n# Or, to control the filename and/or content type:\nfile = ::Believe::FilePart.new(File.read("/path/to/file"), filename: "/path/to/file", content_type: "…")\nfile_upload = believe.teams.logo.upload(file: file)\n\nputs(file_upload.file_id)\n```\n\nNote that you can also pass a raw `IO` descriptor, but this disables retries, as the library can\'t be sure if the descriptor is a file or pipe (which cannot be rewound).\n\n### Handling errors\n\nWhen the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `::Believe::Errors::APIError` will be thrown:\n\n```ruby\nbegin\n character = believe.characters.list\nrescue ::Believe::Errors::APIConnectionError => e\n puts("The server could not be reached")\n puts(e.cause) # an underlying Exception, likely raised within `net/http`\nrescue ::Believe::Errors::RateLimitError => e\n puts("A 429 status code was received; we should back off a bit.")\nrescue ::Believe::Errors::APIStatusError => e\n puts("Another non-200-range status code was received")\n puts(e.status)\nend\n```\n\nError codes are as follows:\n\n| Cause | Error Type |\n| ---------------- | -------------------------- |\n| HTTP 400 | `BadRequestError` |\n| HTTP 401 | `AuthenticationError` |\n| HTTP 403 | `PermissionDeniedError` |\n| HTTP 404 | `NotFoundError` |\n| HTTP 409 | `ConflictError` |\n| HTTP 422 | `UnprocessableEntityError` |\n| HTTP 429 | `RateLimitError` |\n| HTTP >= 500 | `InternalServerError` |\n| Other HTTP error | `APIStatusError` |\n| Timeout | `APITimeoutError` |\n| Network error | `APIConnectionError` |\n\n### Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\n\nConnection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default.\n\nYou can use the `max_retries` option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nbelieve = ::Believe::Client.new(\n max_retries: 0 # default is 2\n)\n\n# Or, configure per-request:\nbelieve.characters.list(request_options: {max_retries: 5})\n```\n\n### Timeouts\n\nBy default, requests will time out after 60 seconds. You can use the timeout option to configure or disable this:\n\n```ruby\n# Configure the default for all requests:\nbelieve = ::Believe::Client.new(\n timeout: nil # default is 60\n)\n\n# Or, configure per-request:\nbelieve.characters.list(request_options: {timeout: 5})\n```\n\nOn timeout, `::Believe::Errors::APITimeoutError` is raised.\n\nNote that requests that time out are retried by default.\n\n## Advanced concepts\n\n### BaseModel\n\nAll parameter and response objects inherit from `::Believe::Internal::Type::BaseModel`, which provides several conveniences, including:\n\n1. All fields, including unknown ones, are accessible with `obj[:prop]` syntax, and can be destructured with `obj => {prop: prop}` or pattern-matching syntax.\n\n2. Structural equivalence for equality; if two API calls return the same values, comparing the responses with == will return true.\n\n3. Both instances and the classes themselves can be pretty-printed.\n\n4. Helpers such as `#to_h`, `#deep_to_h`, `#to_json`, and `#to_yaml`.\n\n### Making custom or undocumented requests\n\n#### Undocumented properties\n\nYou can send undocumented parameters to any endpoint, and read undocumented response properties, like so:\n\nNote: the `extra_` parameters of the same name overrides the documented parameters.\n\n```ruby\npage =\n believe.characters.list(\n request_options: {\n extra_query: {my_query_parameter: value},\n extra_body: {my_body_parameter: value},\n extra_headers: {"my-header": value}\n }\n )\n\nputs(page[:my_undocumented_property])\n```\n\n#### Undocumented request params\n\nIf you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.\n\n#### Undocumented endpoints\n\nTo make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so:\n\n```ruby\nresponse = client.request(\n method: :post,\n path: \'/undocumented/endpoint\',\n query: {"dog": "woof"},\n headers: {"useful-header": "interesting-value"},\n body: {"hello": "world"}\n)\n```\n\n### Concurrency & connection pooling\n\nThe `::Believe::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.\n\nEach instance of `::Believe::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.\n\nWhen all available connections from the pool are checked out, requests wait for a new connection to become available, with queue time counting towards the request timeout.\n\nUnless otherwise specified, other classes in the SDK do not have locks protecting their underlying data structure.\n\n## Sorbet\n\nThis library provides comprehensive [RBI](https://sorbet.org/docs/rbi) definitions, and has no dependency on sorbet-runtime.\n\nYou can provide typesafe request parameters like so:\n\n```ruby\nbelieve.characters.list \n```\n\nOr, equivalently:\n\n```ruby\n# Hashes work, but are not typesafe:\nbelieve.characters.list\n\n# You can also splat a full Params class:\nparams = ::Believe::CharacterListParams.new\nbelieve.characters.list(**params)\n```\n\n### Enums\n\nSince this library does not depend on `sorbet-runtime`, it cannot provide [`T::Enum`](https://sorbet.org/docs/tenum) instances. Instead, we provide "tagged symbols" instead, which is always a primitive at runtime:\n\n```ruby\n# :coach\nputs(::Believe::CharacterRole::COACH)\n\n# Revealed type: `T.all(::Believe::CharacterRole, Symbol)`\nT.reveal_type(::Believe::CharacterRole::COACH)\n```\n\nEnum parameters have a "relaxed" type, so you can either pass in enum constants or their literal value:\n\n```ruby\n# Using the enum constants preserves the tagged type information:\nbelieve.characters.create(\n role: ::Believe::CharacterRole::COACH,\n # …\n)\n\n# Literal values are also permissible:\nbelieve.characters.create(\n role: :coach,\n # …\n)\n```\n\n## Versioning\n\nThis package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time.\n\nThis package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` type definitions to be non-breaking changes.\n\n## Requirements\n\nRuby 3.2.0 or higher.\n\n## Contributing\n\nSee [the contributing documentation](https://github.com/cjavdev/believe-ruby/tree/main/CONTRIBUTING.md).\n',
|
|
3658
4257
|
},
|
|
3659
4258
|
{
|
|
3660
4259
|
language: 'java',
|
|
3661
|
-
content: '# Believe Java API Library\n\n<!-- x-release-please-start-version -->\n[](https://central.sonatype.com/artifact/com.believe.api/believe-java/0.0.1)\n[](https://javadoc.io/doc/com.believe.api/believe-java/0.0.1)\n<!-- x-release-please-end -->\n\nThe Believe Java SDK provides convenient access to the Believe REST API from applications written in Java.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJuYW1lIjoiQGNqYXZkZXYvYmVsaWV2ZS1tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9iZWxpZXZlLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtYmVsaWV2ZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbelieve.stlmcp.com%22%2C%22headers%22%3A%7B%22x-believe-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n<!-- x-release-please-start-version -->\n\nJavadocs are available on [javadoc.io](https://javadoc.io/doc/com.believe.api/believe-java/0.0.1).\n\n<!-- x-release-please-end -->\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n### Gradle\n\n~~~kotlin\nimplementation("com.believe.api:believe-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.believe.api</groupId>\n <artifactId>believe-java</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport com.believe.api.models.characters.CharacterListPage;\nimport com.believe.api.models.characters.CharacterListParams;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClient client = BelieveOkHttpClient.fromEnv();\n\nCharacterListPage page = client.characters().list();\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClient client = BelieveOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .apiKey("My API Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n // Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n // Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------- | ----------------- | -------------------- | -------- | ---------------------------- |\n| `apiKey` | `believe.apiKey` | `BELIEVE_API_KEY` | true | - |\n| `baseUrl` | `believe.baseUrl` | `BELIEVE_BASE_URL` | true | `"https://believe.cjav.dev"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.believe.api.client.BelieveClient;\n\nBelieveClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Believe API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.characters().list(...)` should be called with an instance of `CharacterListParams`, and it will return an instance of `CharacterListPage`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport com.believe.api.models.characters.CharacterListPageAsync;\nimport com.believe.api.models.characters.CharacterListParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClient client = BelieveOkHttpClient.fromEnv();\n\nCompletableFuture<CharacterListPageAsync> page = client.async().characters().list();\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.believe.api.client.BelieveClientAsync;\nimport com.believe.api.client.okhttp.BelieveOkHttpClientAsync;\nimport com.believe.api.models.characters.CharacterListPageAsync;\nimport com.believe.api.models.characters.CharacterListParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClientAsync client = BelieveOkHttpClientAsync.fromEnv();\n\nCompletableFuture<CharacterListPageAsync> page = client.characters().list();\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\nimport java.nio.file.Paths;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file(Paths.get("/path/to/file"))\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\nimport java.net.URL;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file("content".getBytes())\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```java\nimport com.believe.api.core.MultipartField;\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\nimport java.io.InputStream;\nimport java.net.URL;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file(MultipartField.<InputStream>builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.believe.api.core.http.Headers;\nimport com.believe.api.core.http.HttpResponseFor;\nimport com.believe.api.models.characters.CharacterListPage;\nimport com.believe.api.models.characters.CharacterListParams;\n\nHttpResponseFor<CharacterListPage> page = client.characters().withRawResponse().list();\n\nint statusCode = page.statusCode();\nHeaders headers = page.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage parsedPage = page.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`BelieveServiceException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](believe-java-core/src/main/kotlin/com/believe/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](believe-java-core/src/main/kotlin/com/believe/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](believe-java-core/src/main/kotlin/com/believe/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](believe-java-core/src/main/kotlin/com/believe/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](believe-java-core/src/main/kotlin/com/believe/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](believe-java-core/src/main/kotlin/com/believe/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](believe-java-core/src/main/kotlin/com/believe/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`BelieveIoException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveIoException.kt): I/O networking errors.\n\n- [`BelieveRetryableException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`BelieveInvalidDataException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`BelieveException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)\n\n```java\nimport com.believe.api.models.characters.Character;\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list();\n\n// Process as an Iterable\nfor (Character character : page.autoPager()) {\n System.out.println(character);\n}\n\n// Process as a Stream\npage.autoPager()\n .stream()\n .limit(50)\n .forEach(character -> System.out.println(character));\n```\n\nWhen using the asynchronous client, the method returns an [`AsyncStreamResponse`](believe-java-core/src/main/kotlin/com/believe/api/core/http/AsyncStreamResponse.kt):\n\n```java\nimport com.believe.api.core.http.AsyncStreamResponse;\nimport com.believe.api.models.characters.Character;\nimport com.believe.api.models.characters.CharacterListPageAsync;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\n\nCompletableFuture<CharacterListPageAsync> pageFuture = client.async().characters().list();\n\npageFuture.thenRun(page -> page.autoPager().subscribe(character -> {\n System.out.println(character);\n}));\n\n// If you need to handle errors or completion of the stream\npageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {\n @Override\n public void onNext(Character character) {\n System.out.println(character);\n }\n\n @Override\n public void onComplete(Optional<Throwable> error) {\n if (error.isPresent()) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error.get());\n } else {\n System.out.println("No more!");\n }\n }\n}));\n\n// Or use futures\npageFuture.thenRun(page -> page.autoPager()\n .subscribe(character -> {\n System.out.println(character);\n })\n .onCompleteFuture()\n .whenComplete((unused, error) -> {\n if (error != null) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error);\n } else {\n System.out.println("No more!");\n }\n }));\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```java\nimport com.believe.api.models.characters.Character;\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list();\nwhile (true) {\n for (Character character : page.items()) {\n System.out.println(character);\n }\n\n if (!page.hasNextPage()) {\n break;\n }\n\n page = page.nextPage();\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `BELIEVE_LOG` environment variable to `info`:\n\n```sh\nexport BELIEVE_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport BELIEVE_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `believe-java-core` is published with a [configuration file](believe-java-core/src/main/resources/META-INF/proguard/believe-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport java.time.Duration;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport java.time.Duration;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `believe-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveClient`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClient.kt), [`BelieveClientAsync`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsync.kt), [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt), and [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), all of which can work with any HTTP client\n- `believe-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) and [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), which provide a way to construct [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) and [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), respectively, using OkHttp\n- `believe-java`\n - Depends on and exposes the APIs of both `believe-java-core` and `believe-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`believe-java` dependency](#installation) with `believe-java-core`\n2. Copy `believe-java-client-okhttp`\'s [`OkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`believe-java` dependency](#installation) with `believe-java-core`\n2. Write a class that implements the [`HttpClient`](believe-java-core/src/main/kotlin/com/believe/api/core/http/HttpClient.kt) interface\n3. Construct [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport com.believe.api.models.characters.CharacterListParams;\n\nCharacterListParams params = CharacterListParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport com.believe.api.models.characters.CharacterCreateParams;\nimport com.believe.api.models.characters.EmotionalStats;\n\nCharacterCreateParams params = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt) object to its setter:\n\n```java\nimport com.believe.api.models.characters.CharacterListParams;\n\nCharacterListParams params = CharacterListParams.builder().build();\n```\n\nThe most straightforward way to create a [`JsonValue`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```java\nimport com.believe.api.core.JsonMissing;\nimport com.believe.api.models.characters.CharacterCreateParams;\nimport com.believe.api.models.characters.CharacterListParams;\nimport com.believe.api.models.characters.CharacterRole;\nimport com.believe.api.models.characters.EmotionalStats;\nimport java.util.List;\n\nCharacterListParams params = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .curiosity(40L)\n .empathy(85L)\n .optimism(45L)\n .resilience(95L)\n .vulnerability(60L)\n .build())\n .name("Roy Kent")\n .personalityTraits(List.of(\n "intense",\n "loyal",\n "secretly caring",\n "profane"\n ))\n .role(CharacterRole.COACH)\n .background(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport java.util.Map;\n\nMap<String, JsonValue> additionalProperties = client.characters().create(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.believe.api.core.JsonField;\nimport java.util.Optional;\n\nJsonField<String> background = client.characters().create(params)._background();\n\nif (background.isMissing()) {\n // The property is absent from the JSON response\n} else if (background.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional<String> jsonString = background.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = background.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`BelieveInvalidDataException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.believe.api.models.characters.Character;\n\nCharacter character = client.characters().create(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list(RequestOptions.builder().responseValidation(true).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-java/issues) with questions, bugs, or suggestions.\n',
|
|
4260
|
+
content: '# Believe Java API Library\n\n<!-- x-release-please-start-version -->\n[](https://central.sonatype.com/artifact/com.believe.api/believe-java/0.0.1)\n[](https://javadoc.io/doc/com.believe.api/believe-java/0.0.1)\n<!-- x-release-please-end -->\n\nThe Believe Java SDK provides convenient access to the Believe REST API from applications written in Java.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjamF2ZGV2L2JlbGlldmUtbWNwIl0sImVudiI6eyJCRUxJRVZFX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cjavdev%2Fbelieve-mcp%22%5D%2C%22env%22%3A%7B%22BELIEVE_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n<!-- x-release-please-start-version -->\n\nJavadocs are available on [javadoc.io](https://javadoc.io/doc/com.believe.api/believe-java/0.0.1).\n\n<!-- x-release-please-end -->\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n### Gradle\n\n~~~kotlin\nimplementation("com.believe.api:believe-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.believe.api</groupId>\n <artifactId>believe-java</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport com.believe.api.models.characters.CharacterListPage;\nimport com.believe.api.models.characters.CharacterListParams;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClient client = BelieveOkHttpClient.fromEnv();\n\nCharacterListPage page = client.characters().list();\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClient client = BelieveOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .apiKey("My API Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n // Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n // Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build();\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------- | ----------------- | -------------------- | -------- | ---------------------------- |\n| `apiKey` | `believe.apiKey` | `BELIEVE_API_KEY` | true | - |\n| `baseUrl` | `believe.baseUrl` | `BELIEVE_BASE_URL` | true | `"https://believe.cjav.dev"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```java\nimport com.believe.api.client.BelieveClient;\n\nBelieveClient clientWithOptions = client.withOptions(optionsBuilder -> {\n optionsBuilder.baseUrl("https://example.com");\n optionsBuilder.maxRetries(42);\n});\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Believe API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Java class.\n\nFor example, `client.characters().list(...)` should be called with an instance of `CharacterListParams`, and it will return an instance of `CharacterListPage`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport com.believe.api.models.characters.CharacterListPageAsync;\nimport com.believe.api.models.characters.CharacterListParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClient client = BelieveOkHttpClient.fromEnv();\n\nCompletableFuture<CharacterListPageAsync> page = client.async().characters().list();\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.believe.api.client.BelieveClientAsync;\nimport com.believe.api.client.okhttp.BelieveOkHttpClientAsync;\nimport com.believe.api.models.characters.CharacterListPageAsync;\nimport com.believe.api.models.characters.CharacterListParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nBelieveClientAsync client = BelieveOkHttpClientAsync.fromEnv();\n\nCompletableFuture<CharacterListPageAsync> page = client.characters().list();\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```java\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\nimport java.nio.file.Paths;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file(Paths.get("/path/to/file"))\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```java\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\nimport java.net.URL;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file(new URL("https://example.com//path/to/file").openStream())\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\nOr a `byte[]` array:\n\n```java\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file("content".getBytes())\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```java\nimport com.believe.api.core.MultipartField;\nimport com.believe.api.models.teams.logo.FileUpload;\nimport com.believe.api.models.teams.logo.LogoUploadParams;\nimport java.io.InputStream;\nimport java.net.URL;\n\nLogoUploadParams params = LogoUploadParams.builder()\n .teamId("team_id")\n .file(MultipartField.<InputStream>builder()\n .value(new URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build();\nFileUpload fileUpload = client.teams().logo().upload(params);\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Java classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```java\nimport com.believe.api.core.http.Headers;\nimport com.believe.api.core.http.HttpResponseFor;\nimport com.believe.api.models.characters.CharacterListPage;\nimport com.believe.api.models.characters.CharacterListParams;\n\nHttpResponseFor<CharacterListPage> page = client.characters().withRawResponse().list();\n\nint statusCode = page.statusCode();\nHeaders headers = page.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage parsedPage = page.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`BelieveServiceException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](believe-java-core/src/main/kotlin/com/believe/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](believe-java-core/src/main/kotlin/com/believe/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](believe-java-core/src/main/kotlin/com/believe/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](believe-java-core/src/main/kotlin/com/believe/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](believe-java-core/src/main/kotlin/com/believe/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](believe-java-core/src/main/kotlin/com/believe/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](believe-java-core/src/main/kotlin/com/believe/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`BelieveIoException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveIoException.kt): I/O networking errors.\n\n- [`BelieveRetryableException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`BelieveInvalidDataException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`BelieveException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns an [`Iterable`](https://docs.oracle.com/javase/8/docs/api/java/lang/Iterable.html)\n\n```java\nimport com.believe.api.models.characters.Character;\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list();\n\n// Process as an Iterable\nfor (Character character : page.autoPager()) {\n System.out.println(character);\n}\n\n// Process as a Stream\npage.autoPager()\n .stream()\n .limit(50)\n .forEach(character -> System.out.println(character));\n```\n\nWhen using the asynchronous client, the method returns an [`AsyncStreamResponse`](believe-java-core/src/main/kotlin/com/believe/api/core/http/AsyncStreamResponse.kt):\n\n```java\nimport com.believe.api.core.http.AsyncStreamResponse;\nimport com.believe.api.models.characters.Character;\nimport com.believe.api.models.characters.CharacterListPageAsync;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\n\nCompletableFuture<CharacterListPageAsync> pageFuture = client.async().characters().list();\n\npageFuture.thenRun(page -> page.autoPager().subscribe(character -> {\n System.out.println(character);\n}));\n\n// If you need to handle errors or completion of the stream\npageFuture.thenRun(page -> page.autoPager().subscribe(new AsyncStreamResponse.Handler<>() {\n @Override\n public void onNext(Character character) {\n System.out.println(character);\n }\n\n @Override\n public void onComplete(Optional<Throwable> error) {\n if (error.isPresent()) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error.get());\n } else {\n System.out.println("No more!");\n }\n }\n}));\n\n// Or use futures\npageFuture.thenRun(page -> page.autoPager()\n .subscribe(character -> {\n System.out.println(character);\n })\n .onCompleteFuture()\n .whenComplete((unused, error) -> {\n if (error != null) {\n System.out.println("Something went wrong!");\n throw new RuntimeException(error);\n } else {\n System.out.println("No more!");\n }\n }));\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```java\nimport com.believe.api.models.characters.Character;\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list();\nwhile (true) {\n for (Character character : page.items()) {\n System.out.println(character);\n }\n\n if (!page.hasNextPage()) {\n break;\n }\n\n page = page.nextPage();\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `BELIEVE_LOG` environment variable to `info`:\n\n```sh\nexport BELIEVE_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport BELIEVE_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `believe-java-core` is published with a [configuration file](believe-java-core/src/main/resources/META-INF/proguard/believe-java-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build();\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```java\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport java.time.Duration;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build();\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\nimport java.time.Duration;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build();\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build();\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `believe-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveClient`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClient.kt), [`BelieveClientAsync`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsync.kt), [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt), and [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), all of which can work with any HTTP client\n- `believe-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) and [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), which provide a way to construct [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) and [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), respectively, using OkHttp\n- `believe-java`\n - Depends on and exposes the APIs of both `believe-java-core` and `believe-java-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`believe-java` dependency](#installation) with `believe-java-core`\n2. Copy `believe-java-client-okhttp`\'s [`OkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`believe-java` dependency](#installation) with `believe-java-core`\n2. Write a class that implements the [`HttpClient`](believe-java-core/src/main/kotlin/com/believe/api/core/http/HttpClient.kt) interface\n3. Construct [`BelieveClientImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-java-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-java-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport com.believe.api.models.characters.CharacterListParams;\n\nCharacterListParams params = CharacterListParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build();\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport com.believe.api.models.characters.CharacterCreateParams;\nimport com.believe.api.models.characters.EmotionalStats;\n\nCharacterCreateParams params = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build();\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt) object to its setter:\n\n```java\nimport com.believe.api.models.characters.CharacterListParams;\n\nCharacterListParams params = CharacterListParams.builder().build();\n```\n\nThe most straightforward way to create a [`JsonValue`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport java.util.List;\nimport java.util.Map;\n\n// Create primitive JSON values\nJsonValue nullValue = JsonValue.from(null);\nJsonValue booleanValue = JsonValue.from(true);\nJsonValue numberValue = JsonValue.from(42);\nJsonValue stringValue = JsonValue.from("Hello World!");\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nJsonValue arrayValue = JsonValue.from(List.of(\n "Hello", "World"\n));\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nJsonValue objectValue = JsonValue.from(Map.of(\n "a", 1,\n "b", 2\n));\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nJsonValue complexValue = JsonValue.from(Map.of(\n "a", List.of(\n 1, 2\n ),\n "b", List.of(\n 3, 4\n )\n));\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](believe-java-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```java\nimport com.believe.api.core.JsonMissing;\nimport com.believe.api.models.characters.CharacterCreateParams;\nimport com.believe.api.models.characters.CharacterListParams;\nimport com.believe.api.models.characters.CharacterRole;\nimport com.believe.api.models.characters.EmotionalStats;\nimport java.util.List;\n\nCharacterListParams params = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .curiosity(40L)\n .empathy(85L)\n .optimism(45L)\n .resilience(95L)\n .vulnerability(60L)\n .build())\n .name("Roy Kent")\n .personalityTraits(List.of(\n "intense",\n "loyal",\n "secretly caring",\n "profane"\n ))\n .role(CharacterRole.COACH)\n .background(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.believe.api.core.JsonValue;\nimport java.util.Map;\n\nMap<String, JsonValue> additionalProperties = client.characters().create(params)._additionalProperties();\nJsonValue secretPropertyValue = additionalProperties.get("secretProperty");\n\nString result = secretPropertyValue.accept(new JsonValue.Visitor<>() {\n @Override\n public String visitNull() {\n return "It\'s null!";\n }\n\n @Override\n public String visitBoolean(boolean value) {\n return "It\'s a boolean!";\n }\n\n @Override\n public String visitNumber(Number value) {\n return "It\'s a number!";\n }\n\n // Other methods include `visitMissing`, `visitString`, `visitArray`, and `visitObject`\n // The default implementation of each unimplemented method delegates to `visitDefault`, which throws by default, but can also be overridden\n});\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```java\nimport com.believe.api.core.JsonField;\nimport java.util.Optional;\n\nJsonField<String> background = client.characters().create(params)._background();\n\nif (background.isMissing()) {\n // The property is absent from the JSON response\n} else if (background.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n Optional<String> jsonString = background.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = background.asUnknown().orElseThrow().convert(MyClass.class);\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`BelieveInvalidDataException`](believe-java-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.believe.api.models.characters.Character;\n\nCharacter character = client.characters().create(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.believe.api.models.characters.CharacterListPage;\n\nCharacterListPage page = client.characters().list(RequestOptions.builder().responseValidation(true).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.believe.api.client.BelieveClient;\nimport com.believe.api.client.okhttp.BelieveOkHttpClient;\n\nBelieveClient client = BelieveOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build();\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nJava `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-java/issues) with questions, bugs, or suggestions.\n',
|
|
3662
4261
|
},
|
|
3663
4262
|
{
|
|
3664
4263
|
language: 'kotlin',
|
|
3665
|
-
content: '# Believe Kotlin API Library\n\n<!-- x-release-please-start-version -->\n[](https://central.sonatype.com/artifact/com.believe.api/believe-kotlin/0.0.1)\n[](https://javadoc.io/doc/com.believe.api/believe-kotlin/0.0.1)\n<!-- x-release-please-end -->\n\nThe Believe Kotlin SDK provides convenient access to the Believe REST API from applications written in Kotlin.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJuYW1lIjoiQGNqYXZkZXYvYmVsaWV2ZS1tY3AiLCJ0cmFuc3BvcnQiOiJodHRwIiwidXJsIjoiaHR0cHM6Ly9iZWxpZXZlLnN0bG1jcC5jb20iLCJoZWFkZXJzIjp7IngtYmVsaWV2ZS1hcGkta2V5IjoiTXkgQVBJIEtleSJ9fQ)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fbelieve.stlmcp.com%22%2C%22headers%22%3A%7B%22x-believe-api-key%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n<!-- x-release-please-start-version -->\n\nKDocs are available on [javadoc.io](https://javadoc.io/doc/com.believe.api/believe-kotlin/0.0.1).\n\n<!-- x-release-please-end -->\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n### Gradle\n\n~~~kotlin\nimplementation("com.believe.api:believe-kotlin:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.believe.api</groupId>\n <artifactId>believe-kotlin</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterListPage\nimport com.believe.api.models.characters.CharacterListParams\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\nval page: CharacterListPage = client.characters().list()\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClient = BelieveOkHttpClient.fromEnv()\n```\n\nOr manually:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .apiKey("My API Key")\n .build()\n```\n\nOr using a combination of the two approaches:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n // Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n // Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build()\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------- | ----------------- | -------------------- | -------- | ---------------------------- |\n| `apiKey` | `believe.apiKey` | `BELIEVE_API_KEY` | true | - |\n| `baseUrl` | `believe.baseUrl` | `BELIEVE_BASE_URL` | true | `"https://believe.cjav.dev"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\n\nval clientWithOptions: BelieveClient = client.withOptions {\n it.baseUrl("https://example.com")\n it.maxRetries(42)\n}\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Believe API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Kotlin class.\n\nFor example, `client.characters().list(...)` should be called with an instance of `CharacterListParams`, and it will return an instance of `CharacterListPage`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterListPageAsync\nimport com.believe.api.models.characters.CharacterListParams\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\nval page: CharacterListPageAsync = client.async().characters().list()\n```\n\nOr create an asynchronous client from the beginning:\n\n```kotlin\nimport com.believe.api.client.BelieveClientAsync\nimport com.believe.api.client.okhttp.BelieveOkHttpClientAsync\nimport com.believe.api.models.characters.CharacterListPageAsync\nimport com.believe.api.models.characters.CharacterListParams\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClientAsync = BelieveOkHttpClientAsync.fromEnv()\n\nval page: CharacterListPageAsync = client.characters().list()\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods are [suspending](https://kotlinlang.org/docs/coroutines-guide.html).\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```kotlin\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.nio.file.Paths\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file(Paths.get("/path/to/file"))\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```kotlin\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.net.URL\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file(URL("https://example.com//path/to/file").openStream())\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\nOr a `ByteArray`:\n\n```kotlin\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file("content".toByteArray())\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```kotlin\nimport com.believe.api.core.MultipartField\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.io.InputStream\nimport java.net.URL\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file(MultipartField.builder<InputStream>()\n .value(URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Kotlin classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```kotlin\nimport com.believe.api.core.http.Headers\nimport com.believe.api.core.http.HttpResponseFor\nimport com.believe.api.models.characters.CharacterListPage\nimport com.believe.api.models.characters.CharacterListParams\n\nval page: HttpResponseFor<CharacterListPage> = client.characters().withRawResponse().list()\n\nval statusCode: Int = page.statusCode()\nval headers: Headers = page.headers()\n```\n\nYou can still deserialize the response into an instance of a Kotlin class if needed:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval parsedPage: CharacterListPage = page.parse()\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`BelieveServiceException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`BelieveIoException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveIoException.kt): I/O networking errors.\n\n- [`BelieveRetryableException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`BelieveInvalidDataException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`BelieveException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns a [`Sequence`](https://kotlinlang.org/docs/sequences.html)\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list()\npage.autoPager()\n .take(50)\n .forEach { character -> println(character) }\n```\n\nWhen using the asynchronous client, the method returns a [`Flow`](https://kotlinlang.org/docs/flow.html):\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPageAsync\n\nval page: CharacterListPageAsync = client.async().characters().list()\npage.autoPager()\n .take(50)\n .forEach { character -> println(character) }\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```kotlin\nimport com.believe.api.models.characters.Character\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list()\nwhile (true) {\n for (character in page.items()) {\n println(character)\n }\n\n if (!page.hasNextPage()) {\n break\n }\n\n page = page.nextPage()\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `BELIEVE_LOG` environment variable to `info`:\n\n```sh\nexport BELIEVE_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport BELIEVE_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `believe-kotlin-core` is published with a [configuration file](believe-kotlin-core/src/main/resources/META-INF/proguard/believe-kotlin-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build()\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build())\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport java.time.Duration\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build()\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport java.net.InetSocketAddress\nimport java.net.Proxy\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .proxy(Proxy(\n Proxy.Type.HTTP, InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build()\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport java.time.Duration\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build()\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build()\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `believe-kotlin-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveClient`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClient.kt), [`BelieveClientAsync`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsync.kt), [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt), and [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), all of which can work with any HTTP client\n- `believe-kotlin-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) and [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), which provide a way to construct [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) and [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), respectively, using OkHttp\n- `believe-kotlin`\n - Depends on and exposes the APIs of both `believe-kotlin-core` and `believe-kotlin-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`believe-kotlin` dependency](#installation) with `believe-kotlin-core`\n2. Copy `believe-kotlin-client-okhttp`\'s [`OkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`believe-kotlin` dependency](#installation) with `believe-kotlin-core`\n2. Write a class that implements the [`HttpClient`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/http/HttpClient.kt) interface\n3. Construct [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```kotlin\nimport com.believe.api.core.JsonValue\nimport com.believe.api.models.characters.CharacterListParams\n\nval params: CharacterListParams = CharacterListParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build()\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```kotlin\nimport com.believe.api.core.JsonValue\nimport com.believe.api.models.characters.CharacterCreateParams\nimport com.believe.api.models.characters.EmotionalStats\n\nval params: CharacterCreateParams = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build()\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt) object to its setter:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListParams\n\nval params: CharacterListParams = CharacterListParams.builder().build()\n```\n\nThe most straightforward way to create a [`JsonValue`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt) is using its `from(...)` method:\n\n```kotlin\nimport com.believe.api.core.JsonValue\n\n// Create primitive JSON values\nval nullValue: JsonValue = JsonValue.from(null)\nval booleanValue: JsonValue = JsonValue.from(true)\nval numberValue: JsonValue = JsonValue.from(42)\nval stringValue: JsonValue = JsonValue.from("Hello World!")\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nval arrayValue: JsonValue = JsonValue.from(listOf(\n "Hello", "World"\n))\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nval objectValue: JsonValue = JsonValue.from(mapOf(\n "a" to 1, "b" to 2\n))\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nval complexValue: JsonValue = JsonValue.from(mapOf(\n "a" to listOf(\n 1, 2\n ), "b" to listOf(\n 3, 4\n )\n))\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```kotlin\nimport com.believe.api.core.JsonMissing\nimport com.believe.api.models.characters.CharacterCreateParams\nimport com.believe.api.models.characters.CharacterListParams\nimport com.believe.api.models.characters.CharacterRole\nimport com.believe.api.models.characters.EmotionalStats\n\nval params: CharacterListParams = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .curiosity(40L)\n .empathy(85L)\n .optimism(45L)\n .resilience(95L)\n .vulnerability(60L)\n .build())\n .name("Roy Kent")\n .personalityTraits(listOf(\n "intense",\n "loyal",\n "secretly caring",\n "profane",\n ))\n .role(CharacterRole.COACH)\n .background(JsonMissing.of())\n .build()\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```kotlin\nimport com.believe.api.core.JsonBoolean\nimport com.believe.api.core.JsonNull\nimport com.believe.api.core.JsonNumber\nimport com.believe.api.core.JsonValue\n\nval additionalProperties: Map<String, JsonValue> = client.characters().create(params)._additionalProperties()\nval secretPropertyValue: JsonValue = additionalProperties.get("secretProperty")\n\nval result = when (secretPropertyValue) {\n is JsonNull -> "It\'s null!"\n is JsonBoolean -> "It\'s a boolean!"\n is JsonNumber -> "It\'s a number!"\n // Other types include `JsonMissing`, `JsonString`, `JsonArray`, and `JsonObject`\n else -> "It\'s something else!"\n}\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```kotlin\nimport com.believe.api.core.JsonField\n\nval background: JsonField<String> = client.characters().create(params)._background()\n\nif (background.isMissing()) {\n // The property is absent from the JSON response\n} else if (background.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n val jsonString: String? = background.asString();\n\n // Try to deserialize into a custom type\n val myObject: MyClass = background.asUnknown()!!.convert(MyClass::class.java)\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`BelieveInvalidDataException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```kotlin\nimport com.believe.api.models.characters.Character\n\nval character: Character = client.characters().create(params).validate()\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list(RequestOptions.builder().responseValidation(true).build())\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build()\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nKotlin `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-kotlin/issues) with questions, bugs, or suggestions.\n',
|
|
4264
|
+
content: '# Believe Kotlin API Library\n\n<!-- x-release-please-start-version -->\n[](https://central.sonatype.com/artifact/com.believe.api/believe-kotlin/0.0.1)\n[](https://javadoc.io/doc/com.believe.api/believe-kotlin/0.0.1)\n<!-- x-release-please-end -->\n\nThe Believe Kotlin SDK provides convenient access to the Believe REST API from applications written in Kotlin.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Believe MCP Server to enable AI assistants to interact with this API, allowing them to explore endpoints, make test requests, and use documentation to help integrate this SDK into your application.\n\n[](https://cursor.com/en-US/install-mcp?name=%40cjavdev%2Fbelieve-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjamF2ZGV2L2JlbGlldmUtbWNwIl0sImVudiI6eyJCRUxJRVZFX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40cjavdev%2Fbelieve-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cjavdev%2Fbelieve-mcp%22%5D%2C%22env%22%3A%7B%22BELIEVE_API_KEY%22%3A%22My%20API%20Key%22%7D%7D)\n\n> Note: You may need to set environment variables in your MCP client.\n\n<!-- x-release-please-start-version -->\n\nKDocs are available on [javadoc.io](https://javadoc.io/doc/com.believe.api/believe-kotlin/0.0.1).\n\n<!-- x-release-please-end -->\n\n## Installation\n\n<!-- x-release-please-start-version -->\n\n### Gradle\n\n~~~kotlin\nimplementation("com.believe.api:believe-kotlin:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.believe.api</groupId>\n <artifactId>believe-kotlin</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n<!-- x-release-please-end -->\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterListPage\nimport com.believe.api.models.characters.CharacterListParams\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\nval page: CharacterListPage = client.characters().list()\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClient = BelieveOkHttpClient.fromEnv()\n```\n\nOr manually:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .apiKey("My API Key")\n .build()\n```\n\nOr using a combination of the two approaches:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n // Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n // Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\n .fromEnv()\n .apiKey("My API Key")\n .build()\n```\n\nSee this table for the available options:\n\n| Setter | System property | Environment variable | Required | Default value |\n| --------- | ----------------- | -------------------- | -------- | ---------------------------- |\n| `apiKey` | `believe.apiKey` | `BELIEVE_API_KEY` | true | - |\n| `baseUrl` | `believe.baseUrl` | `BELIEVE_BASE_URL` | true | `"https://believe.cjav.dev"` |\n\nSystem properties take precedence over environment variables.\n\n> [!TIP]\n> Don\'t create more than one client in the same application. Each client has a connection pool and\n> thread pools, which are more efficient to share between requests.\n\n### Modifying configuration\n\nTo temporarily use a modified client configuration, while reusing the same connection and thread pools, call `withOptions()` on any client or service:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\n\nval clientWithOptions: BelieveClient = client.withOptions {\n it.baseUrl("https://example.com")\n it.maxRetries(42)\n}\n```\n\nThe `withOptions()` method does not affect the original client or service.\n\n## Requests and responses\n\nTo send a request to the Believe API, build an instance of some `Params` class and pass it to the corresponding client method. When the response is received, it will be deserialized into an instance of a Kotlin class.\n\nFor example, `client.characters().list(...)` should be called with an instance of `CharacterListParams`, and it will return an instance of `CharacterListPage`.\n\n## Immutability\n\nEach class in the SDK has an associated [builder](https://blogs.oracle.com/javamagazine/post/exploring-joshua-blochs-builder-design-pattern-in-java) or factory method for constructing it.\n\nEach class is [immutable](https://docs.oracle.com/javase/tutorial/essential/concurrency/immutable.html) once constructed. If the class has an associated builder, then it has a `toBuilder()` method, which can be used to convert it back to a builder for making a modified copy.\n\nBecause each class is immutable, builder modification will _never_ affect already built class instances.\n\n## Asynchronous execution\n\nThe default client is synchronous. To switch to asynchronous execution, call the `async()` method:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport com.believe.api.models.characters.CharacterListPageAsync\nimport com.believe.api.models.characters.CharacterListParams\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClient = BelieveOkHttpClient.fromEnv()\n\nval page: CharacterListPageAsync = client.async().characters().list()\n```\n\nOr create an asynchronous client from the beginning:\n\n```kotlin\nimport com.believe.api.client.BelieveClientAsync\nimport com.believe.api.client.okhttp.BelieveOkHttpClientAsync\nimport com.believe.api.models.characters.CharacterListPageAsync\nimport com.believe.api.models.characters.CharacterListParams\n\n// Configures using the `believe.apiKey` and `believe.baseUrl` system properties\n// Or configures using the `BELIEVE_API_KEY` and `BELIEVE_BASE_URL` environment variables\nval client: BelieveClientAsync = BelieveOkHttpClientAsync.fromEnv()\n\nval page: CharacterListPageAsync = client.characters().list()\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods are [suspending](https://kotlinlang.org/docs/coroutines-guide.html).\n\n\n\n## File uploads\n\nThe SDK defines methods that accept files.\n\nTo upload a file, pass a [`Path`](https://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html):\n\n```kotlin\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.nio.file.Paths\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file(Paths.get("/path/to/file"))\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\nOr an arbitrary [`InputStream`](https://docs.oracle.com/javase/8/docs/api/java/io/InputStream.html):\n\n```kotlin\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.net.URL\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file(URL("https://example.com//path/to/file").openStream())\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\nOr a `ByteArray`:\n\n```kotlin\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file("content".toByteArray())\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\nNote that when passing a non-`Path` its filename is unknown so it will not be included in the request. To manually set a filename, pass a [`MultipartField`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```kotlin\nimport com.believe.api.core.MultipartField\nimport com.believe.api.models.teams.logo.FileUpload\nimport com.believe.api.models.teams.logo.LogoUploadParams\nimport java.io.InputStream\nimport java.net.URL\n\nval params: LogoUploadParams = LogoUploadParams.builder()\n .teamId("team_id")\n .file(MultipartField.builder<InputStream>()\n .value(URL("https://example.com//path/to/file").openStream())\n .filename("/path/to/file")\n .build())\n .build()\nval fileUpload: FileUpload = client.teams().logo().upload(params)\n```\n\n\n\n## Raw responses\n\nThe SDK defines methods that deserialize responses into instances of Kotlin classes. However, these methods don\'t provide access to the response headers, status code, or the raw response body.\n\nTo access this data, prefix any HTTP method call on a client or service with `withRawResponse()`:\n\n```kotlin\nimport com.believe.api.core.http.Headers\nimport com.believe.api.core.http.HttpResponseFor\nimport com.believe.api.models.characters.CharacterListPage\nimport com.believe.api.models.characters.CharacterListParams\n\nval page: HttpResponseFor<CharacterListPage> = client.characters().withRawResponse().list()\n\nval statusCode: Int = page.statusCode()\nval headers: Headers = page.headers()\n```\n\nYou can still deserialize the response into an instance of a Kotlin class if needed:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval parsedPage: CharacterListPage = page.parse()\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`BelieveServiceException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveServiceException.kt): Base class for HTTP errors. See this table for which exception subclass is thrown for each HTTP status code:\n\n | Status | Exception |\n | ------ | -------------------------------------------------- |\n | 400 | [`BadRequestException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`BelieveIoException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveIoException.kt): I/O networking errors.\n\n- [`BelieveRetryableException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`BelieveInvalidDataException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt): Failure to interpret successfully parsed data. For example, when accessing a property that\'s supposed to be required, but the API unexpectedly omitted it from the response.\n\n- [`BelieveException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveException.kt): Base class for all exceptions. Most errors will result in one of the previously mentioned ones, but completely generic errors may be thrown using the base class.\n\n## Pagination\n\nThe SDK defines methods that return a paginated lists of results. It provides convenient ways to access the results either one page at a time or item-by-item across all pages.\n\n### Auto-pagination\n\nTo iterate through all results across all pages, use the `autoPager()` method, which automatically fetches more pages as needed.\n\nWhen using the synchronous client, the method returns a [`Sequence`](https://kotlinlang.org/docs/sequences.html)\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list()\npage.autoPager()\n .take(50)\n .forEach { character -> println(character) }\n```\n\nWhen using the asynchronous client, the method returns a [`Flow`](https://kotlinlang.org/docs/flow.html):\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPageAsync\n\nval page: CharacterListPageAsync = client.async().characters().list()\npage.autoPager()\n .take(50)\n .forEach { character -> println(character) }\n```\n\n### Manual pagination\n\nTo access individual page items and manually request the next page, use the `items()`,\n`hasNextPage()`, and `nextPage()` methods:\n\n```kotlin\nimport com.believe.api.models.characters.Character\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list()\nwhile (true) {\n for (character in page.items()) {\n println(character)\n }\n\n if (!page.hasNextPage()) {\n break\n }\n\n page = page.nextPage()\n}\n```\n\n## Logging\n\nThe SDK uses the standard [OkHttp logging interceptor](https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor).\n\nEnable logging by setting the `BELIEVE_LOG` environment variable to `info`:\n\n```sh\nexport BELIEVE_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport BELIEVE_LOG=debug\n```\n\n## ProGuard and R8\n\nAlthough the SDK uses reflection, it is still usable with [ProGuard](https://github.com/Guardsquare/proguard) and [R8](https://developer.android.com/topic/performance/app-optimization/enable-app-optimization) because `believe-kotlin-core` is published with a [configuration file](believe-kotlin-core/src/main/resources/META-INF/proguard/believe-kotlin-core.pro) containing [keep rules](https://www.guardsquare.com/manual/configuration/usage).\n\nProGuard and R8 should automatically detect and use the published rules, but you can also manually copy the keep rules if necessary.\n\n\n\n\n\n## Jackson\n\nThe SDK depends on [Jackson](https://github.com/FasterXML/jackson) for JSON serialization/deserialization. It is compatible with version 2.13.4 or higher, but depends on version 2.18.2 by default.\n\nThe SDK throws an exception if it detects an incompatible Jackson version at runtime (e.g. if the default version was overridden in your Maven or Gradle config).\n\nIf the SDK threw an exception, but you\'re _certain_ the version is compatible, then disable the version check using the `checkJacksonVersionCompatibility` on [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt).\n\n> [!CAUTION]\n> We make no guarantee that the SDK works correctly when the Jackson version check is disabled.\n\nAlso note that there are bugs in older Jackson versions that can affect the SDK. We don\'t work around all Jackson bugs ([example](https://github.com/FasterXML/jackson-databind/issues/3240)) and expect users to upgrade Jackson for those instead.\n\n## Network options\n\n### Retries\n\nThe SDK automatically retries 2 times by default, with a short exponential backoff between requests.\n\nOnly the following error types are retried:\n- Connection errors (for example, due to a network connectivity problem)\n- 408 Request Timeout\n- 409 Conflict\n- 429 Rate Limit\n- 5xx Internal\n\nThe API may also explicitly instruct the SDK to retry or not retry a request.\n\nTo set a custom number of retries, configure the client using the `maxRetries` method:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .maxRetries(4)\n .build()\n```\n\n### Timeouts\n\nRequests time out after 1 minute by default.\n\nTo set a custom timeout, configure the method call using the `timeout` method:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list(RequestOptions.builder().timeout(Duration.ofSeconds(30)).build())\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport java.time.Duration\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .timeout(Duration.ofSeconds(30))\n .build()\n```\n\n### Proxies\n\nTo route requests through a proxy, configure the client using the `proxy` method:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport java.net.InetSocketAddress\nimport java.net.Proxy\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .proxy(Proxy(\n Proxy.Type.HTTP, InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build()\n```\n\n### Connection pooling\n\nTo customize the underlying OkHttp connection pool, configure the client using the `maxIdleConnections` and `keepAliveDuration` methods:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\nimport java.time.Duration\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `maxIdleConnections` is set, then `keepAliveDuration` must be set, and vice versa.\n .maxIdleConnections(10)\n .keepAliveDuration(Duration.ofMinutes(2))\n .build()\n```\n\nIf both options are unset, OkHttp\'s default connection pool settings are used.\n\n### HTTPS\n\n> [!NOTE]\n> Most applications should not call these methods, and instead use the system defaults. The defaults include\n> special optimizations that can be lost if the implementations are modified.\n\nTo configure how HTTPS connections are secured, configure the client using the `sslSocketFactory`, `trustManager`, and `hostnameVerifier` methods:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n // If `sslSocketFactory` is set, then `trustManager` must be set, and vice versa.\n .sslSocketFactory(yourSSLSocketFactory)\n .trustManager(yourTrustManager)\n .hostnameVerifier(yourHostnameVerifier)\n .build()\n```\n\n\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `believe-kotlin-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveClient`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClient.kt), [`BelieveClientAsync`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsync.kt), [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt), and [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), all of which can work with any HTTP client\n- `believe-kotlin-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) and [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), which provide a way to construct [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) and [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), respectively, using OkHttp\n- `believe-kotlin`\n - Depends on and exposes the APIs of both `believe-kotlin-core` and `believe-kotlin-client-okhttp`\n - Does not have its own logic\n\nThis structure allows replacing the SDK\'s default HTTP client without pulling in unnecessary dependencies.\n\n#### Customized [`OkHttpClient`](https://square.github.io/okhttp/3.x/okhttp/okhttp3/OkHttpClient.html)\n\n> [!TIP]\n> Try the available [network options](#network-options) before replacing the default client.\n\nTo use a customized `OkHttpClient`:\n\n1. Replace your [`believe-kotlin` dependency](#installation) with `believe-kotlin-core`\n2. Copy `believe-kotlin-client-okhttp`\'s [`OkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`believe-kotlin` dependency](#installation) with `believe-kotlin-core`\n2. Write a class that implements the [`HttpClient`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/http/HttpClient.kt) interface\n3. Construct [`BelieveClientImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientImpl.kt) or [`BelieveClientAsyncImpl`](believe-kotlin-core/src/main/kotlin/com/believe/api/client/BelieveClientAsyncImpl.kt), similarly to [`BelieveOkHttpClient`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClient.kt) or [`BelieveOkHttpClientAsync`](believe-kotlin-client-okhttp/src/main/kotlin/com/believe/api/client/okhttp/BelieveOkHttpClientAsync.kt), using your new client class\n\n## Undocumented API functionality\n\nThe SDK is typed for convenient usage of the documented API. However, it also supports working with undocumented or not yet supported parts of the API.\n\n### Parameters\n\nTo set undocumented parameters, call the `putAdditionalHeader`, `putAdditionalQueryParam`, or `putAdditionalBodyProperty` methods on any `Params` class:\n\n```kotlin\nimport com.believe.api.core.JsonValue\nimport com.believe.api.models.characters.CharacterListParams\n\nval params: CharacterListParams = CharacterListParams.builder()\n .putAdditionalHeader("Secret-Header", "42")\n .putAdditionalQueryParam("secret_query_param", "42")\n .putAdditionalBodyProperty("secretProperty", JsonValue.from("42"))\n .build()\n```\n\nThese can be accessed on the built object later using the `_additionalHeaders()`, `_additionalQueryParams()`, and `_additionalBodyProperties()` methods.\n\nTo set undocumented parameters on _nested_ headers, query params, or body classes, call the `putAdditionalProperty` method on the nested class:\n\n```kotlin\nimport com.believe.api.core.JsonValue\nimport com.believe.api.models.characters.CharacterCreateParams\nimport com.believe.api.models.characters.EmotionalStats\n\nval params: CharacterCreateParams = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .putAdditionalProperty("secretProperty", JsonValue.from("42"))\n .build())\n .build()\n```\n\nThese properties can be accessed on the nested built object later using the `_additionalProperties()` method.\n\nTo set a documented parameter or property to an undocumented or not yet supported _value_, pass a [`JsonValue`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt) object to its setter:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListParams\n\nval params: CharacterListParams = CharacterListParams.builder().build()\n```\n\nThe most straightforward way to create a [`JsonValue`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt) is using its `from(...)` method:\n\n```kotlin\nimport com.believe.api.core.JsonValue\n\n// Create primitive JSON values\nval nullValue: JsonValue = JsonValue.from(null)\nval booleanValue: JsonValue = JsonValue.from(true)\nval numberValue: JsonValue = JsonValue.from(42)\nval stringValue: JsonValue = JsonValue.from("Hello World!")\n\n// Create a JSON array value equivalent to `["Hello", "World"]`\nval arrayValue: JsonValue = JsonValue.from(listOf(\n "Hello", "World"\n))\n\n// Create a JSON object value equivalent to `{ "a": 1, "b": 2 }`\nval objectValue: JsonValue = JsonValue.from(mapOf(\n "a" to 1, "b" to 2\n))\n\n// Create an arbitrarily nested JSON equivalent to:\n// {\n// "a": [1, 2],\n// "b": [3, 4]\n// }\nval complexValue: JsonValue = JsonValue.from(mapOf(\n "a" to listOf(\n 1, 2\n ), "b" to listOf(\n 3, 4\n )\n))\n```\n\nNormally a `Builder` class\'s `build` method will throw [`IllegalStateException`](https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalStateException.html) if any required parameter or property is unset.\n\nTo forcibly omit a required parameter or property, pass [`JsonMissing`](believe-kotlin-core/src/main/kotlin/com/believe/api/core/Values.kt):\n\n```kotlin\nimport com.believe.api.core.JsonMissing\nimport com.believe.api.models.characters.CharacterCreateParams\nimport com.believe.api.models.characters.CharacterListParams\nimport com.believe.api.models.characters.CharacterRole\nimport com.believe.api.models.characters.EmotionalStats\n\nval params: CharacterListParams = CharacterCreateParams.builder()\n .emotionalStats(EmotionalStats.builder()\n .curiosity(40L)\n .empathy(85L)\n .optimism(45L)\n .resilience(95L)\n .vulnerability(60L)\n .build())\n .name("Roy Kent")\n .personalityTraits(listOf(\n "intense",\n "loyal",\n "secretly caring",\n "profane",\n ))\n .role(CharacterRole.COACH)\n .background(JsonMissing.of())\n .build()\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```kotlin\nimport com.believe.api.core.JsonBoolean\nimport com.believe.api.core.JsonNull\nimport com.believe.api.core.JsonNumber\nimport com.believe.api.core.JsonValue\n\nval additionalProperties: Map<String, JsonValue> = client.characters().create(params)._additionalProperties()\nval secretPropertyValue: JsonValue = additionalProperties.get("secretProperty")\n\nval result = when (secretPropertyValue) {\n is JsonNull -> "It\'s null!"\n is JsonBoolean -> "It\'s a boolean!"\n is JsonNumber -> "It\'s a number!"\n // Other types include `JsonMissing`, `JsonString`, `JsonArray`, and `JsonObject`\n else -> "It\'s something else!"\n}\n```\n\nTo access a property\'s raw JSON value, which may be undocumented, call its `_` prefixed method:\n\n```kotlin\nimport com.believe.api.core.JsonField\n\nval background: JsonField<String> = client.characters().create(params)._background()\n\nif (background.isMissing()) {\n // The property is absent from the JSON response\n} else if (background.isNull()) {\n // The property was set to literal null\n} else {\n // Check if value was provided as a string\n // Other methods include `asNumber()`, `asBoolean()`, etc.\n val jsonString: String? = background.asString();\n\n // Try to deserialize into a custom type\n val myObject: MyClass = background.asUnknown()!!.convert(MyClass::class.java)\n}\n```\n\n### Response validation\n\nIn rare cases, the API may return a response that doesn\'t match the expected type. For example, the SDK may expect a property to contain a `String`, but the API could return something else.\n\nBy default, the SDK will not throw an exception in this case. It will throw [`BelieveInvalidDataException`](believe-kotlin-core/src/main/kotlin/com/believe/api/errors/BelieveInvalidDataException.kt) only if you directly access the property.\n\nIf you would prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```kotlin\nimport com.believe.api.models.characters.Character\n\nval character: Character = client.characters().create(params).validate()\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```kotlin\nimport com.believe.api.models.characters.CharacterListPage\n\nval page: CharacterListPage = client.characters().list(RequestOptions.builder().responseValidation(true).build())\n```\n\nOr configure the default for all method calls at the client level:\n\n```kotlin\nimport com.believe.api.client.BelieveClient\nimport com.believe.api.client.okhttp.BelieveOkHttpClient\n\nval client: BelieveClient = BelieveOkHttpClient.builder()\n .fromEnv()\n .responseValidation(true)\n .build()\n```\n\n## FAQ\n\n### Why don\'t you use plain `enum` classes?\n\nKotlin `enum` classes are not trivially [forwards compatible](https://www.stainless.com/blog/making-java-enums-forwards-compatible). Using them in the SDK could cause runtime exceptions if the API is updated to respond with a new enum value.\n\n### Why do you represent fields using `JsonField<T>` instead of just plain `T`?\n\nUsing `JsonField<T>` enables a few features:\n\n- Allowing usage of [undocumented API functionality](#undocumented-api-functionality)\n- Lazily [validating the API response against the expected shape](#response-validation)\n- Representing absent vs explicitly null values\n\n### Why don\'t you use [`data` classes](https://kotlinlang.org/docs/data-classes.html)?\n\nIt is not [backwards compatible to add new fields to a data class](https://kotlinlang.org/docs/api-guidelines-backward-compatibility.html#avoid-using-data-classes-in-your-api) and we don\'t want to introduce a breaking change every time we add a field to a class.\n\n### Why don\'t you use checked exceptions?\n\nChecked exceptions are widely considered a mistake in the Java programming language. In fact, they were omitted from Kotlin for this reason.\n\nChecked exceptions:\n\n- Are verbose to handle\n- Encourage error handling at the wrong level of abstraction, where nothing can be done about the error\n- Are tedious to propagate due to the [function coloring problem](https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function)\n- Don\'t play well with lambdas (also due to the function coloring problem)\n\n## Semantic versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals.)_\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/cjavdev/believe-kotlin/issues) with questions, bugs, or suggestions.\n',
|
|
4265
|
+
},
|
|
4266
|
+
{
|
|
4267
|
+
language: 'csharp',
|
|
4268
|
+
content: '# Believe C# API Library\n\nThe Believe C# SDK provides convenient access to the Believe REST API from applications written in C#.\n\n## Installation\n\n```bash\ngit clone git@github.com:cjavdev/believe-csharp.git\ndotnet add reference believe-csharp/src/Believe\n```\n\n## Requirements\n\nThis library requires .NET Standard 2.0 or later.\n\n## Usage\n\nSee the [`examples`](examples) directory for complete and runnable examples.\n\n```csharp\nBelieveClient client = new();\n\nCharacterListParams parameters = new();\n\nvar page = await client.Characters.List(parameters);\n\nConsole.WriteLine(page);\n```',
|
|
3666
4269
|
},
|
|
3667
4270
|
{
|
|
3668
4271
|
language: 'cli',
|
|
3669
4272
|
content: "# Believe CLI\n\nThe official CLI for the Believe REST API.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n<!-- x-release-please-start-version -->\n\n## Installation\n\n### Installing with Go\n\nTo test or install the CLI locally, you need [Go](https://go.dev/doc/install) version 1.22 or later installed.\n\n~~~sh\ngo install 'github.com/cjavdev/believe-cli/cmd/believe@latest'\n~~~\n\nOnce you have run `go install`, the binary is placed in your Go bin directory:\n\n- **Default location**: `$HOME/go/bin` (or `$GOPATH/bin` if GOPATH is set)\n- **Check your path**: Run `go env GOPATH` to see the base directory\n\nIf commands aren't found after installation, add the Go bin directory to your PATH:\n\n~~~sh\n# Add to your shell profile (.zshrc, .bashrc, etc.)\nexport PATH=\"$PATH:$(go env GOPATH)/bin\"\n~~~\n\n<!-- x-release-please-end -->\n\n### Running Locally\n\nAfter cloning the git repository for this project, you can use the\n`scripts/run` script to run the tool locally:\n\n~~~sh\n./scripts/run args...\n~~~\n\n## Usage\n\nThe CLI follows a resource-based command structure:\n\n~~~sh\nbelieve [resource] <command> [flags...]\n~~~\n\n~~~sh\nbelieve characters list \\\n --api-key 'My API Key'\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Required |\n| -------------------- | -------- |\n| `BELIEVE_API_KEY` | yes |\n\n### Global flags\n\n- `--api-key` (can also be set with `BELIEVE_API_KEY` env var)\n- `--help` - Show command line usage\n- `--debug` - Enable debug logging (includes HTTP request/response details)\n- `--version`, `-v` - Show the CLI version\n- `--base-url` - Use a custom API backend URL\n- `--format` - Change the output format (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--format-error` - Change the output format for errors (`auto`, `explore`, `json`, `jsonl`, `pretty`, `raw`, `yaml`)\n- `--transform` - Transform the data output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n- `--transform-error` - Transform the error output using [GJSON syntax](https://github.com/tidwall/gjson/blob/master/SYNTAX.md)\n\n### Passing files as arguments\n\nTo pass files to your API, you can use the `@myfile.ext` syntax:\n\n~~~bash\nbelieve <command> --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nbelieve <command> --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nbelieve <command> <<YAML\narg:\n image: \"@abe.jpg\"\nYAML\n~~~\n\nIf you need to pass a string literal that begins with an `@` sign, you can\nescape the `@` sign to avoid accidentally passing a file.\n\n~~~bash\nbelieve <command> --username '\\@abe'\n~~~\n\n#### Explicit encoding\n\nFor JSON endpoints, the CLI tool does filetype sniffing to determine whether the\nfile contents should be sent as a string literal (for plain text files) or as a\nbase64-encoded string literal (for binary files). If you need to explicitly send\nthe file as either plain text or base64-encoded data, you can use\n`@file://myfile.txt` (for string encoding) or `@data://myfile.dat` (for\nbase64-encoding). Note that absolute paths will begin with `@file://` or\n`@data://`, followed by a third `/` (for example, `@file:///tmp/file.txt`).\n\n~~~bash\nbelieve <command> --arg @data://file.txt\n~~~\n",
|
|
3670
4273
|
},
|
|
4274
|
+
{
|
|
4275
|
+
language: 'php',
|
|
4276
|
+
content: '# Believe PHP API Library\n\nThe Believe PHP library provides convenient access to the Believe REST API from any PHP 8.1.0+ application.\n\n## Installation\n\nTo use this package, install via Composer by adding the following to your application\'s `composer.json`:\n\n<!-- x-release-please-start-version -->\n```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:cjavdev/believe-php.git"\n }\n ],\n "require": {\n "org-placeholder/believe": "dev-main"\n }\n}\n```\n<!-- x-release-please-end -->\n\n## Usage\n\n```php\n<?php\n\n$client = new Client(apiKey: getenv(\'BELIEVE_API_KEY\') ?: \'My API Key\');\n\n$page = $client->characters->list();\n\nvar_dump($page->id);\n```',
|
|
4277
|
+
},
|
|
3671
4278
|
];
|
|
3672
4279
|
const INDEX_OPTIONS = {
|
|
3673
4280
|
fields: [
|