@segmentflow/segmentflow-mcp 0.8.0 → 0.9.0
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/code-tool-worker.d.mts.map +1 -1
- package/code-tool-worker.d.ts.map +1 -1
- package/code-tool-worker.js +5 -0
- package/code-tool-worker.js.map +1 -1
- package/code-tool-worker.mjs +5 -0
- package/code-tool-worker.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 +304 -59
- package/local-docs-search.js.map +1 -1
- package/local-docs-search.mjs +304 -59
- package/local-docs-search.mjs.map +1 -1
- package/methods.d.mts.map +1 -1
- package/methods.d.ts.map +1 -1
- package/methods.js +30 -0
- package/methods.js.map +1 -1
- package/methods.mjs +30 -0
- package/methods.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 +5 -0
- package/src/local-docs-search.ts +350 -59
- package/src/methods.ts +30 -0
- package/src/server.ts +1 -1
package/src/local-docs-search.ts
CHANGED
|
@@ -60,6 +60,8 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
60
60
|
qualified: 'client.v1.profiles.list',
|
|
61
61
|
params: [
|
|
62
62
|
'cursor?: string;',
|
|
63
|
+
"deliverySuppressionReasonFilter?: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'[];",
|
|
64
|
+
"deliverySuppressionStatus?: 'eligible' | 'suppressed';",
|
|
63
65
|
"direction?: 'before' | 'after';",
|
|
64
66
|
'limit?: number;',
|
|
65
67
|
'profileIds?: string[];',
|
|
@@ -69,9 +71,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
69
71
|
"sourceFilter?: 'form_submission' | 'csv_import' | 'api_sync' | 'sdk' | 'manual_edit' | 'computed'[];",
|
|
70
72
|
],
|
|
71
73
|
response:
|
|
72
|
-
'{ profileCount: number; profiles: { id: string; createdAt: string; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }[]; nextCursor?: string; previousCursor?: string; }',
|
|
74
|
+
'{ profileCount: number; profiles: { id: string; createdAt: string; deliverySuppression: object; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }[]; nextCursor?: string; previousCursor?: string; }',
|
|
73
75
|
markdown:
|
|
74
|
-
"## list\n\n`client.v1.profiles.list(cursor?: string, direction?: 'before' | 'after', limit?: number, profileIds?: string[], profilePropertyFilter?: { id: string; values: string[]; }[], search?: string, segmentFilter?: string[], sourceFilter?: 'form_submission' | 'csv_import' | 'api_sync' | 'sdk' | 'manual_edit' | 'computed'[]): { profileCount: number; profiles: profile[]; nextCursor?: string; previousCursor?: string; }`\n\n**post** `/api/v1/profiles`\n\nGet paginated list of Profiles with optional filtering\n\n### Parameters\n\n- `cursor?: string`\n Pagination cursor from previous response\n\n- `direction?: 'before' | 'after'`\n Pagination direction (defaults to \"after\")\n\n- `limit?: number`\n Number of Profiles to return (defaults to 10)\n\n- `profileIds?: string[]`\n Filter by specific Profile IDs\n\n- `profilePropertyFilter?: { id: string; values: string[]; }[]`\n Filter by profile properties\n\n- `search?: string`\n Search Profiles by email, phone, or external ID (case-insensitive partial match)\n\n- `segmentFilter?: string[]`\n Filter by Segment IDs\n\n- `sourceFilter?: 'form_submission' | 'csv_import' | 'api_sync' | 'sdk' | 'manual_edit' | 'computed'[]`\n Filter by ingestion source. Values are the same as the dashboard's Source column.\n\n### Returns\n\n- `{ profileCount: number; profiles: { id: string; createdAt: string; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }[]; nextCursor?: string; previousCursor?: string; }`\n POST /api/v1/profiles response — paginated Profiles\n\n - `profileCount: number`\n - `profiles: { id: string; createdAt: string; email: string; phone: string; properties: object; segments: { id: string; name: string; type: string; }[]; sources: string[]; updatedAt: string; }[]`\n - `nextCursor?: string`\n - `previousCursor?: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst profileList = await client.v1.profiles.list();\n\nconsole.log(profileList);\n```",
|
|
76
|
+
"## list\n\n`client.v1.profiles.list(cursor?: string, deliverySuppressionReasonFilter?: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'[], deliverySuppressionStatus?: 'eligible' | 'suppressed', direction?: 'before' | 'after', limit?: number, profileIds?: string[], profilePropertyFilter?: { id: string; values: string[]; }[], search?: string, segmentFilter?: string[], sourceFilter?: 'form_submission' | 'csv_import' | 'api_sync' | 'sdk' | 'manual_edit' | 'computed'[]): { profileCount: number; profiles: profile[]; nextCursor?: string; previousCursor?: string; }`\n\n**post** `/api/v1/profiles`\n\nGet paginated list of Profiles with optional filtering\n\n### Parameters\n\n- `cursor?: string`\n Pagination cursor from previous response\n\n- `deliverySuppressionReasonFilter?: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'[]`\n Filter by current Delivery Suppression reason. Any reason filter implies suppressed Profiles.\n\n- `deliverySuppressionStatus?: 'eligible' | 'suppressed'`\n Filter by current Delivery Suppression status.\n\n- `direction?: 'before' | 'after'`\n Pagination direction (defaults to \"after\")\n\n- `limit?: number`\n Number of Profiles to return (defaults to 10)\n\n- `profileIds?: string[]`\n Filter by specific Profile IDs\n\n- `profilePropertyFilter?: { id: string; values: string[]; }[]`\n Filter by profile properties\n\n- `search?: string`\n Search Profiles by email, phone, or external ID (case-insensitive partial match)\n\n- `segmentFilter?: string[]`\n Filter by Segment IDs\n\n- `sourceFilter?: 'form_submission' | 'csv_import' | 'api_sync' | 'sdk' | 'manual_edit' | 'computed'[]`\n Filter by ingestion source. Values are the same as the dashboard's Source column.\n\n### Returns\n\n- `{ profileCount: number; profiles: { id: string; createdAt: string; deliverySuppression: object; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }[]; nextCursor?: string; previousCursor?: string; }`\n POST /api/v1/profiles response — paginated Profiles\n\n - `profileCount: number`\n - `profiles: { id: string; createdAt: string; deliverySuppression: { email: string; reason: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'; suppressed: boolean; suppressedAt: string; }; email: string; phone: string; properties: object; segments: { id: string; name: string; type: string; }[]; sources: string[]; updatedAt: string; }[]`\n - `nextCursor?: string`\n - `previousCursor?: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst profileList = await client.v1.profiles.list();\n\nconsole.log(profileList);\n```",
|
|
75
77
|
perLanguage: {
|
|
76
78
|
typescript: {
|
|
77
79
|
method: 'client.v1.profiles.list',
|
|
@@ -91,7 +93,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
91
93
|
go: {
|
|
92
94
|
method: 'client.V1.Profiles.List',
|
|
93
95
|
example:
|
|
94
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
96
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tprofileList, err := client.V1.Profiles.List(context.TODO(), segmentflow.V1ProfileListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", profileList.ProfileCount)\n}\n',
|
|
95
97
|
},
|
|
96
98
|
cli: {
|
|
97
99
|
method: 'profiles list',
|
|
@@ -100,7 +102,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
100
102
|
php: {
|
|
101
103
|
method: 'v1->profiles->list',
|
|
102
104
|
example:
|
|
103
|
-
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$profileList = $client->v1->profiles->list(\n cursor: 'cursor',\n direction: 'before',\n limit: 1,\n profileIDs: ['string'],\n profilePropertyFilter: [['id' => 'id', 'values' => ['string']]],\n search: 'search',\n segmentFilter: ['string'],\n sourceFilter: ['form_submission'],\n);\n\nvar_dump($profileList);",
|
|
105
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$profileList = $client->v1->profiles->list(\n cursor: 'cursor',\n deliverySuppressionReasonFilter: ['HardBounced'],\n deliverySuppressionStatus: 'eligible',\n direction: 'before',\n limit: 1,\n profileIDs: ['string'],\n profilePropertyFilter: [['id' => 'id', 'values' => ['string']]],\n search: 'search',\n segmentFilter: ['string'],\n sourceFilter: ['form_submission'],\n);\n\nvar_dump($profileList);",
|
|
104
106
|
},
|
|
105
107
|
http: {
|
|
106
108
|
example:
|
|
@@ -118,9 +120,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
118
120
|
qualified: 'client.v1.profiles.retrieve',
|
|
119
121
|
params: ['profileId: string;'],
|
|
120
122
|
response:
|
|
121
|
-
|
|
123
|
+
"{ id: string; createdAt: string; deliverySuppression: { email: string; reason: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'; suppressed: boolean; suppressedAt: string; }; email: string; phone: string; properties: object; segments: { id: string; name: string; type: string; }[]; sources: string[]; updatedAt: string; }",
|
|
122
124
|
markdown:
|
|
123
|
-
"## retrieve\n\n`client.v1.profiles.retrieve(profileId: string): { id: string; createdAt: string; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }`\n\n**get** `/api/v1/profiles/{profileId}`\n\nGet a single Profile by ID\n\n### Parameters\n\n- `profileId: string`\n\n### Returns\n\n- `{ id: string; createdAt: string; email: string; phone: string; properties: object; segments: { id: string; name: string; type: string; }[]; sources: string[]; updatedAt: string; }`\n Unified API view of a Profile row, with property data-lineage envelope and segment memberships.\n\n - `id: string`\n - `createdAt: string`\n - `email: string`\n - `phone: string`\n - `properties: object`\n - `segments: { id: string; name: string; type: string; }[]`\n - `sources: string[]`\n - `updatedAt: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst profile = await client.v1.profiles.retrieve('x');\n\nconsole.log(profile);\n```",
|
|
125
|
+
"## retrieve\n\n`client.v1.profiles.retrieve(profileId: string): { id: string; createdAt: string; deliverySuppression: object; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }`\n\n**get** `/api/v1/profiles/{profileId}`\n\nGet a single Profile by ID\n\n### Parameters\n\n- `profileId: string`\n\n### Returns\n\n- `{ id: string; createdAt: string; deliverySuppression: { email: string; reason: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'; suppressed: boolean; suppressedAt: string; }; email: string; phone: string; properties: object; segments: { id: string; name: string; type: string; }[]; sources: string[]; updatedAt: string; }`\n Unified API view of a Profile row, with property data-lineage envelope and segment memberships.\n\n - `id: string`\n - `createdAt: string`\n - `deliverySuppression: { email: string; reason: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'; suppressed: boolean; suppressedAt: string; }`\n - `email: string`\n - `phone: string`\n - `properties: object`\n - `segments: { id: string; name: string; type: string; }[]`\n - `sources: string[]`\n - `updatedAt: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst profile = await client.v1.profiles.retrieve('x');\n\nconsole.log(profile);\n```",
|
|
124
126
|
perLanguage: {
|
|
125
127
|
typescript: {
|
|
126
128
|
method: 'client.v1.profiles.retrieve',
|
|
@@ -140,7 +142,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
140
142
|
go: {
|
|
141
143
|
method: 'client.V1.Profiles.Get',
|
|
142
144
|
example:
|
|
143
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
145
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tprofile, err := client.V1.Profiles.Get(context.TODO(), "x")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", profile.ID)\n}\n',
|
|
144
146
|
},
|
|
145
147
|
cli: {
|
|
146
148
|
method: 'profiles retrieve',
|
|
@@ -188,7 +190,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
188
190
|
go: {
|
|
189
191
|
method: 'client.V1.Profiles.Delete',
|
|
190
192
|
example:
|
|
191
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
193
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tprofile, err := client.V1.Profiles.Delete(context.TODO(), "x")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", profile)\n}\n',
|
|
192
194
|
},
|
|
193
195
|
cli: {
|
|
194
196
|
method: 'profiles delete',
|
|
@@ -236,7 +238,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
236
238
|
go: {
|
|
237
239
|
method: 'client.V1.Profiles.BulkDelete',
|
|
238
240
|
example:
|
|
239
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
241
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Profiles.BulkDelete(context.TODO(), segmentflow.V1ProfileBulkDeleteParams{\n\t\tIDs: []string{"x"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.DeletedCount)\n}\n',
|
|
240
242
|
},
|
|
241
243
|
cli: {
|
|
242
244
|
method: 'profiles bulk_delete',
|
|
@@ -285,7 +287,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
285
287
|
go: {
|
|
286
288
|
method: 'client.V1.Profiles.GetSubscriptions',
|
|
287
289
|
example:
|
|
288
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
290
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tprofileSubscriptions, err := client.V1.Profiles.GetSubscriptions(context.TODO(), "x")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", profileSubscriptions.ProfileID)\n}\n',
|
|
289
291
|
},
|
|
290
292
|
cli: {
|
|
291
293
|
method: 'profiles get_subscriptions',
|
|
@@ -334,7 +336,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
334
336
|
go: {
|
|
335
337
|
method: 'client.V1.Assets.List',
|
|
336
338
|
example:
|
|
337
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
339
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tassets, err := client.V1.Assets.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", assets.Assets)\n}\n',
|
|
338
340
|
},
|
|
339
341
|
cli: {
|
|
340
342
|
method: 'assets list',
|
|
@@ -390,7 +392,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
390
392
|
go: {
|
|
391
393
|
method: 'client.V1.Assets.New',
|
|
392
394
|
example:
|
|
393
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
395
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tasset, err := client.V1.Assets.New(context.TODO(), segmentflow.V1AssetNewParams{\n\t\tContentType: "x",\n\t\tFilename: "x",\n\t\tS3Key: "x",\n\t\tSize: 0,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", asset.Asset)\n}\n',
|
|
394
396
|
},
|
|
395
397
|
cli: {
|
|
396
398
|
method: 'assets create',
|
|
@@ -444,7 +446,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
444
446
|
go: {
|
|
445
447
|
method: 'client.V1.Assets.RequestUpload',
|
|
446
448
|
example:
|
|
447
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
449
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Assets.RequestUpload(context.TODO(), segmentflow.V1AssetRequestUploadParams{\n\t\tContentType: "x",\n\t\tFilename: "x",\n\t\tSize: 9007199254740991,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.AssetID)\n}\n',
|
|
448
450
|
},
|
|
449
451
|
cli: {
|
|
450
452
|
method: 'assets request_upload',
|
|
@@ -499,7 +501,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
499
501
|
go: {
|
|
500
502
|
method: 'client.V1.Assets.GetUploadURL',
|
|
501
503
|
example:
|
|
502
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
504
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Assets.GetUploadURL(context.TODO(), segmentflow.V1AssetGetUploadURLParams{\n\t\tContentType: segmentflow.V1AssetGetUploadURLParamsContentTypeImageJpeg,\n\t\tFilename: "x",\n\t\tSize: 20971520,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ExpiresIn)\n}\n',
|
|
503
505
|
},
|
|
504
506
|
cli: {
|
|
505
507
|
method: 'assets get_upload_url',
|
|
@@ -554,7 +556,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
554
556
|
go: {
|
|
555
557
|
method: 'client.V1.Assets.Finalize',
|
|
556
558
|
example:
|
|
557
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
559
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Assets.Finalize(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tsegmentflow.V1AssetFinalizeParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Asset)\n}\n',
|
|
558
560
|
},
|
|
559
561
|
cli: {
|
|
560
562
|
method: 'assets finalize',
|
|
@@ -610,7 +612,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
610
612
|
go: {
|
|
611
613
|
method: 'client.V1.Assets.UpdateMetadata',
|
|
612
614
|
example:
|
|
613
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
615
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Assets.UpdateMetadata(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tsegmentflow.V1AssetUpdateMetadataParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Asset)\n}\n',
|
|
614
616
|
},
|
|
615
617
|
cli: {
|
|
616
618
|
method: 'assets update_metadata',
|
|
@@ -659,7 +661,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
659
661
|
go: {
|
|
660
662
|
method: 'client.V1.Assets.Delete',
|
|
661
663
|
example:
|
|
662
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
664
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tasset, err := client.V1.Assets.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", asset.Message)\n}\n',
|
|
663
665
|
},
|
|
664
666
|
cli: {
|
|
665
667
|
method: 'assets delete',
|
|
@@ -708,7 +710,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
708
710
|
go: {
|
|
709
711
|
method: 'client.V1.BrandKit.List',
|
|
710
712
|
example:
|
|
711
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
713
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbrandKits, err := client.V1.BrandKit.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", brandKits.BrandKits)\n}\n',
|
|
712
714
|
},
|
|
713
715
|
cli: {
|
|
714
716
|
method: 'brand_kit list',
|
|
@@ -761,7 +763,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
761
763
|
go: {
|
|
762
764
|
method: 'client.V1.BrandKit.New',
|
|
763
765
|
example:
|
|
764
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
766
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbrandKit, err := client.V1.BrandKit.New(context.TODO(), segmentflow.V1BrandKitNewParams{\n\t\tName: "name",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", brandKit.BrandID)\n}\n',
|
|
765
767
|
},
|
|
766
768
|
cli: {
|
|
767
769
|
method: 'brand_kit create',
|
|
@@ -788,9 +790,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
788
790
|
qualified: 'client.v1.brandKit.retrieve',
|
|
789
791
|
params: ['brandId: string;'],
|
|
790
792
|
response:
|
|
791
|
-
"{ brandKit: { _metadata?: object; address?: string; authors?: object[]; blogUrl?: string; brandMessage?: string; brandSummary?: string; colorArray?: string[]; colors?: string[]; colorsPalette?: object; companyDescription?: string; companyName?: string; components?: object; contactEmail?: string; copyright?: string; disclaimers?: string; emailFonts?: object; extractedAt?: string; extractedBy?: string; fontArray?: string[]; fonts?: string[]; footer?: string; footerFeatures?: string; icons?: object; imageGuidelines?: object; images?: object; industry?: string; keyMessages?: string[]; kitName?: string; landingPagePurpose?: string; languages?:
|
|
793
|
+
"{ brandKit: { _metadata?: object; address?: string; authors?: object[]; blogUrl?: string; brandMessage?: string; brandSummary?: string; colorArray?: string[]; colors?: string[]; colorsPalette?: object; companyDescription?: string; companyName?: string; components?: object; contactEmail?: string; copyright?: string; disclaimers?: string; emailFonts?: object; extractedAt?: string; extractedBy?: string; fontArray?: string[]; fonts?: string[]; footer?: string; footerFeatures?: string; icons?: object; imageGuidelines?: object; images?: object; industry?: string; keyMessages?: string[]; kitName?: string; landingPagePurpose?: string; languages?: object; logos?: string[]; name?: string; personality?: object; phone?: string; salutationFallback?: string; socials?: object; socialSize?: 'sm' | 'md' | 'lg'; socialStyle?: 'brand-circle' | 'mono-light' | 'mono-dark' | 'outline-mono' | 'brand-glyph'; tagline?: string; themeMode?: 'light' | 'dark' | 'auto'; toneOfVoice?: string; typography?: object; website?: string; }; brandMeta: { id: string; isPrimary: boolean; name: string; slug: string; }; message: string; success: boolean; }",
|
|
792
794
|
markdown:
|
|
793
|
-
"## retrieve\n\n`client.v1.brandKit.retrieve(brandId: string): { brandKit: brand_kit; brandMeta: object; message: string; success: boolean; }`\n\n**get** `/api/v1/brand-kit/{brandId}`\n\n### Parameters\n\n- `brandId: string`\n\n### Returns\n\n- `{ brandKit: { _metadata?: object; address?: string; authors?: object[]; blogUrl?: string; brandMessage?: string; brandSummary?: string; colorArray?: string[]; colors?: string[]; colorsPalette?: object; companyDescription?: string; companyName?: string; components?: object; contactEmail?: string; copyright?: string; disclaimers?: string; emailFonts?: object; extractedAt?: string; extractedBy?: string; fontArray?: string[]; fonts?: string[]; footer?: string; footerFeatures?: string; icons?: object; imageGuidelines?: object; images?: object; industry?: string; keyMessages?: string[]; kitName?: string; landingPagePurpose?: string; languages?:
|
|
795
|
+
"## retrieve\n\n`client.v1.brandKit.retrieve(brandId: string): { brandKit: brand_kit; brandMeta: object; message: string; success: boolean; }`\n\n**get** `/api/v1/brand-kit/{brandId}`\n\n### Parameters\n\n- `brandId: string`\n\n### Returns\n\n- `{ brandKit: { _metadata?: object; address?: string; authors?: object[]; blogUrl?: string; brandMessage?: string; brandSummary?: string; colorArray?: string[]; colors?: string[]; colorsPalette?: object; companyDescription?: string; companyName?: string; components?: object; contactEmail?: string; copyright?: string; disclaimers?: string; emailFonts?: object; extractedAt?: string; extractedBy?: string; fontArray?: string[]; fonts?: string[]; footer?: string; footerFeatures?: string; icons?: object; imageGuidelines?: object; images?: object; industry?: string; keyMessages?: string[]; kitName?: string; landingPagePurpose?: string; languages?: object; logos?: string[]; name?: string; personality?: object; phone?: string; salutationFallback?: string; socials?: object; socialSize?: 'sm' | 'md' | 'lg'; socialStyle?: 'brand-circle' | 'mono-light' | 'mono-dark' | 'outline-mono' | 'brand-glyph'; tagline?: string; themeMode?: 'light' | 'dark' | 'auto'; toneOfVoice?: string; typography?: object; website?: string; }; brandMeta: { id: string; isPrimary: boolean; name: string; slug: string; }; message: string; success: boolean; }`\n\n - `brandKit: { _metadata?: { lastUpdated: string; source: 'firecrawl' | 'manual'; }; address?: string; authors?: { id: string; bio: string; name: string; avatarS3Key?: string; avatarUrl?: string; badges?: { id?: string; alt?: string; height?: number; imageS3Key?: string; imageUrl?: string; label?: string; width?: number; }[]; email?: string; homepage?: string; phone?: string; role?: string; tags?: string[]; }[]; blogUrl?: string; brandMessage?: string; brandSummary?: string; colorArray?: string[]; colors?: string[]; colorsPalette?: { accent?: string[]; background?: string[]; border?: string[]; error?: string[]; link?: string[]; primary?: string[]; secondary?: string[]; success?: string[]; text?: string[]; warning?: string[]; }; companyDescription?: string; companyName?: string; components?: { buttonPrimary?: { background?: string; borderColor?: string; borderRadius?: string; focusBorderColor?: string; fontWeight?: string; padding?: string; textColor?: string; }; buttonSecondary?: { background?: string; borderColor?: string; borderRadius?: string; focusBorderColor?: string; fontWeight?: string; padding?: string; textColor?: string; }; input?: { background?: string; borderColor?: string; borderRadius?: string; focusBorderColor?: string; fontWeight?: string; padding?: string; textColor?: string; }; link?: { background?: string; borderColor?: string; borderRadius?: string; focusBorderColor?: string; fontWeight?: string; padding?: string; textColor?: string; }; }; contactEmail?: string; copyright?: string; disclaimers?: string; emailFonts?: { code?: { family: string; original: string; classification?: 'sans-serif' | 'serif' | 'slab-serif' | 'monospace'; fontStack?: string; googleFontsUrl?: string; isSystem?: boolean; weights?: number[]; }; heading?: { family: string; original: string; classification?: 'sans-serif' | 'serif' | 'slab-serif' | 'monospace'; fontStack?: string; googleFontsUrl?: string; isSystem?: boolean; weights?: number[]; }; primary?: { family: string; original: string; classification?: 'sans-serif' | 'serif' | 'slab-serif' | 'monospace'; fontStack?: string; googleFontsUrl?: string; isSystem?: boolean; weights?: number[]; }; }; extractedAt?: string; extractedBy?: string; fontArray?: string[]; fonts?: string[]; footer?: string; footerFeatures?: string; icons?: { primaryColor?: string; style?: string; }; imageGuidelines?: { heroHeight?: number; heroWidth?: number; logoAlignment?: 'left' | 'center' | 'right'; logoHeight?: number; logoWidth?: number; maxContentWidth?: number; thumbnailSize?: number; }; images?: { additional?: string[]; favicon?: string; faviconRejection?: { measured: object; reason: 'too_small' | 'too_large' | 'bad_aspect_ratio'; required: object; }; faviconS3Key?: string; faviconSourceUrl?: string; logo?: string; logoDimensions?: { height: number; width: number; }; logoRejection?: { measured: object; reason: 'too_small' | 'too_large' | 'bad_aspect_ratio'; required: object; }; logoS3Key?: string; logoSourceUrl?: string; ogImage?: string; ogImageRejection?: { measured: object; reason: 'too_small' | 'too_large' | 'bad_aspect_ratio'; required: object; }; ogImageS3Key?: string; ogImageSourceUrl?: string; socialLogos?: object; }; industry?: string; keyMessages?: string[]; kitName?: string; landingPagePurpose?: string; languages?: object; logos?: string[]; name?: string; personality?: { tone?: string; traits?: string[]; }; phone?: string; salutationFallback?: string; socials?: { discord?: string; facebook?: string; github?: string; instagram?: string; linkedin?: string; pinterest?: string; tiktok?: string; twitter?: string; youtube?: string; }; socialSize?: 'sm' | 'md' | 'lg'; socialStyle?: 'brand-circle' | 'mono-light' | 'mono-dark' | 'outline-mono' | 'brand-glyph'; tagline?: string; themeMode?: 'light' | 'dark' | 'auto'; toneOfVoice?: string; typography?: { baseUnit?: number; borderRadius?: string; fontSizes?: object; fontStacks?: object; fontWeights?: object; lineHeights?: object; spacing?: { gridGutter?: number; margins?: object; padding?: object; }; }; website?: string; }`\n - `brandMeta: { id: string; isPrimary: boolean; name: string; slug: string; }`\n - `message: string`\n - `success: boolean`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst brandKit = await client.v1.brandKit.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(brandKit);\n```",
|
|
794
796
|
perLanguage: {
|
|
795
797
|
typescript: {
|
|
796
798
|
method: 'client.v1.brandKit.retrieve',
|
|
@@ -810,7 +812,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
810
812
|
go: {
|
|
811
813
|
method: 'client.V1.BrandKit.Get',
|
|
812
814
|
example:
|
|
813
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
815
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbrandKit, err := client.V1.BrandKit.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", brandKit.BrandKit)\n}\n',
|
|
814
816
|
},
|
|
815
817
|
cli: {
|
|
816
818
|
method: 'brand_kit retrieve',
|
|
@@ -863,7 +865,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
863
865
|
go: {
|
|
864
866
|
method: 'client.V1.BrandKit.Update',
|
|
865
867
|
example:
|
|
866
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
868
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbrandKit, err := client.V1.BrandKit.Update(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tsegmentflow.V1BrandKitUpdateParams{\n\t\t\tBrandKit: segmentflow.V1BrandKitUpdateParamsBrandKit{},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", brandKit.Message)\n}\n',
|
|
867
869
|
},
|
|
868
870
|
cli: {
|
|
869
871
|
method: 'brand_kit update',
|
|
@@ -912,7 +914,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
912
914
|
go: {
|
|
913
915
|
method: 'client.V1.BrandKit.Rename',
|
|
914
916
|
example:
|
|
915
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
917
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.BrandKit.Rename(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tsegmentflow.V1BrandKitRenameParams{\n\t\t\tName: "name",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Message)\n}\n',
|
|
916
918
|
},
|
|
917
919
|
cli: {
|
|
918
920
|
method: 'brand_kit rename',
|
|
@@ -961,7 +963,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
961
963
|
go: {
|
|
962
964
|
method: 'client.V1.BrandKit.Delete',
|
|
963
965
|
example:
|
|
964
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
966
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbrandKit, err := client.V1.BrandKit.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", brandKit.Message)\n}\n',
|
|
965
967
|
},
|
|
966
968
|
cli: {
|
|
967
969
|
method: 'brand_kit delete',
|
|
@@ -1010,7 +1012,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1010
1012
|
go: {
|
|
1011
1013
|
method: 'client.V1.BrandKit.Extract',
|
|
1012
1014
|
example:
|
|
1013
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1015
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.BrandKit.Extract(context.TODO(), segmentflow.V1BrandKitExtractParams{\n\t\tWebsiteURL: "https://example.com",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Message)\n}\n',
|
|
1014
1016
|
},
|
|
1015
1017
|
cli: {
|
|
1016
1018
|
method: 'brand_kit extract',
|
|
@@ -1059,7 +1061,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1059
1061
|
go: {
|
|
1060
1062
|
method: 'client.V1.BrandKit.ExtractInto',
|
|
1061
1063
|
example:
|
|
1062
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1064
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.BrandKit.ExtractInto(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tsegmentflow.V1BrandKitExtractIntoParams{\n\t\t\tWebsiteURL: "https://example.com",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Message)\n}\n',
|
|
1063
1065
|
},
|
|
1064
1066
|
cli: {
|
|
1065
1067
|
method: 'brand_kit extract_into',
|
|
@@ -1108,7 +1110,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1108
1110
|
go: {
|
|
1109
1111
|
method: 'client.V1.BrandKit.Clear',
|
|
1110
1112
|
example:
|
|
1111
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1113
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.BrandKit.Clear(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Message)\n}\n',
|
|
1112
1114
|
},
|
|
1113
1115
|
cli: {
|
|
1114
1116
|
method: 'brand_kit clear',
|
|
@@ -1157,7 +1159,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1157
1159
|
go: {
|
|
1158
1160
|
method: 'client.V1.BrandKit.SetDefault',
|
|
1159
1161
|
example:
|
|
1160
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1162
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.BrandKit.SetDefault(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Message)\n}\n',
|
|
1161
1163
|
},
|
|
1162
1164
|
cli: {
|
|
1163
1165
|
method: 'brand_kit set_default',
|
|
@@ -1208,7 +1210,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1208
1210
|
go: {
|
|
1209
1211
|
method: 'client.V1.BrandKit.GetExtractionProgress',
|
|
1210
1212
|
example:
|
|
1211
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1213
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.BrandKit.GetExtractionProgress(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.CompletedSteps)\n}\n',
|
|
1212
1214
|
},
|
|
1213
1215
|
cli: {
|
|
1214
1216
|
method: 'brand_kit get_extraction_progress',
|
|
@@ -1236,12 +1238,12 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1236
1238
|
qualified: 'client.v1.templates.list',
|
|
1237
1239
|
params: [
|
|
1238
1240
|
"purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery';",
|
|
1239
|
-
"status?: 'Active' | 'Archived'
|
|
1241
|
+
"status?: 'Active' | 'Archived'[];",
|
|
1240
1242
|
],
|
|
1241
1243
|
response:
|
|
1242
1244
|
"{ id: string; createdAt: string; generationStatus: 'Idle' | 'Generating' | 'Failed'; isComplete: boolean; language: string; lastGeneratedAt: string; lastGenerationError: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; status: 'Active' | 'Archived'; type: string; updatedAt: string; defaultSegmentId?: string; emailContentsType?: 'Code'; source?: string; statusBeforeArchive?: 'Active' | 'Archived'; website?: { id: string; name: string; }; websiteId?: string; }[]",
|
|
1243
1245
|
markdown:
|
|
1244
|
-
"## list\n\n`client.v1.templates.list(purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', status?: 'Active' | 'Archived'
|
|
1246
|
+
"## list\n\n`client.v1.templates.list(purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', status?: 'Active' | 'Archived'[]): { id: string; createdAt: string; generationStatus: 'Idle' | 'Generating' | 'Failed'; isComplete: boolean; language: string; lastGeneratedAt: string; lastGenerationError: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; status: 'Active' | 'Archived'; type: string; updatedAt: string; defaultSegmentId?: string; emailContentsType?: 'Code'; source?: string; statusBeforeArchive?: 'Active' | 'Archived'; website?: object; websiteId?: string; }[]`\n\n**get** `/api/v1/templates`\n\nGet all templates for the organization\n\n### Parameters\n\n- `purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n\n- `status?: 'Active' | 'Archived'[]`\n\n### Returns\n\n- `{ id: string; createdAt: string; generationStatus: 'Idle' | 'Generating' | 'Failed'; isComplete: boolean; language: string; lastGeneratedAt: string; lastGenerationError: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; status: 'Active' | 'Archived'; type: string; updatedAt: string; defaultSegmentId?: string; emailContentsType?: 'Code'; source?: string; statusBeforeArchive?: 'Active' | 'Archived'; website?: { id: string; name: string; }; websiteId?: string; }[]`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst templates = await client.v1.templates.list();\n\nconsole.log(templates);\n```",
|
|
1245
1247
|
perLanguage: {
|
|
1246
1248
|
typescript: {
|
|
1247
1249
|
method: 'client.v1.templates.list',
|
|
@@ -1261,7 +1263,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1261
1263
|
go: {
|
|
1262
1264
|
method: 'client.V1.Templates.List',
|
|
1263
1265
|
example:
|
|
1264
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1266
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\ttemplates, err := client.V1.Templates.List(context.TODO(), segmentflow.V1TemplateListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", templates)\n}\n',
|
|
1265
1267
|
},
|
|
1266
1268
|
cli: {
|
|
1267
1269
|
method: 'templates list',
|
|
@@ -1270,7 +1272,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1270
1272
|
php: {
|
|
1271
1273
|
method: 'v1->templates->list',
|
|
1272
1274
|
example:
|
|
1273
|
-
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$templates = $client->v1->templates->list(purpose: 'General', status: 'Active');\n\nvar_dump($templates);",
|
|
1275
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$templates = $client->v1->templates->list(\n purpose: 'General', status: ['Active']\n);\n\nvar_dump($templates);",
|
|
1274
1276
|
},
|
|
1275
1277
|
http: {
|
|
1276
1278
|
example:
|
|
@@ -1292,16 +1294,16 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1292
1294
|
'id?: string;',
|
|
1293
1295
|
'brandKitId?: string;',
|
|
1294
1296
|
'defaultSegmentId?: string;',
|
|
1295
|
-
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; };",
|
|
1297
|
+
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; };",
|
|
1296
1298
|
'language?: string;',
|
|
1297
1299
|
"purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery';",
|
|
1298
1300
|
'senderProfileId?: string;',
|
|
1299
1301
|
'subType?: string;',
|
|
1300
1302
|
],
|
|
1301
1303
|
response:
|
|
1302
|
-
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }",
|
|
1304
|
+
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }",
|
|
1303
1305
|
markdown:
|
|
1304
|
-
"## create\n\n`client.v1.templates.create(name: string, type: string, id?: string, brandKitId?: string, defaultSegmentId?: string, definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; }, language?: string, purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', senderProfileId?: string, subType?: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**post** `/api/v1/templates`\n\nCreate template\n\n### Parameters\n\n- `name: string`\n\n- `type: string`\n\n- `id?: string`\n\n- `brandKitId?: string`\n\n- `defaultSegmentId?: string`\n\n- `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; }`\n - `body: { elements: object; root: string; }`\n - `codeFormat: 'json'`\n - `emailContentsType: 'Code'`\n - `type: 'Email'`\n - `from?: string`\n - `preheader?: string`\n - `renderVariables?: object`\n - `replyTo?: string`\n - `subject?: string`\n\n- `language?: string`\n\n- `purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n\n- `senderProfileId?: string`\n\n- `subType?: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst template = await client.v1.templates.create({ name: 'name', type: 'type' });\n\nconsole.log(template);\n```",
|
|
1306
|
+
"## create\n\n`client.v1.templates.create(name: string, type: string, id?: string, brandKitId?: string, defaultSegmentId?: string, definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; }, language?: string, purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', senderProfileId?: string, subType?: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**post** `/api/v1/templates`\n\nCreate template\n\n### Parameters\n\n- `name: string`\n\n- `type: string`\n\n- `id?: string`\n\n- `brandKitId?: string`\n\n- `defaultSegmentId?: string`\n\n- `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; }`\n - `body: { elements: object; root: string; }`\n - `codeFormat: 'json'`\n - `emailContentsType: 'Code'`\n - `type: 'Email'`\n - `from?: string`\n - `preheader?: string`\n - `renderVariables?: object`\n - `replyTo?: string`\n - `sensitiveTransactionalVariablePaths?: string[]`\n - `subject?: string`\n\n- `language?: string`\n\n- `purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n\n- `senderProfileId?: string`\n\n- `subType?: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst template = await client.v1.templates.create({ name: 'name', type: 'type' });\n\nconsole.log(template);\n```",
|
|
1305
1307
|
perLanguage: {
|
|
1306
1308
|
typescript: {
|
|
1307
1309
|
method: 'client.v1.templates.create',
|
|
@@ -1321,7 +1323,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1321
1323
|
go: {
|
|
1322
1324
|
method: 'client.V1.Templates.New',
|
|
1323
1325
|
example:
|
|
1324
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1326
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\ttemplate, err := client.V1.Templates.New(context.TODO(), segmentflow.V1TemplateNewParams{\n\t\tName: "name",\n\t\tType: "type",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", template.ID)\n}\n',
|
|
1325
1327
|
},
|
|
1326
1328
|
cli: {
|
|
1327
1329
|
method: 'templates create',
|
|
@@ -1331,7 +1333,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1331
1333
|
php: {
|
|
1332
1334
|
method: 'v1->templates->create',
|
|
1333
1335
|
example:
|
|
1334
|
-
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$template = $client->v1->templates->create(\n name: 'name',\n type: 'type',\n id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n brandKitID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n defaultSegmentID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n definition: [\n 'body' => [\n 'elements' => [\n 'foo' => [\n 'type' => 'x', 'children' => ['string'], 'props' => ['foo' => 'bar']\n ],\n ],\n 'root' => 'x',\n ],\n 'codeFormat' => 'json',\n 'emailContentsType' => 'Code',\n 'type' => 'Email',\n 'from' => 'from',\n 'preheader' => 'preheader',\n 'renderVariables' => ['foo' => 'bar'],\n 'replyTo' => 'replyTo',\n 'subject' => 'subject',\n ],\n language: 'xx',\n purpose: 'General',\n senderProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n subType: 'subType',\n);\n\nvar_dump($template);",
|
|
1336
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$template = $client->v1->templates->create(\n name: 'name',\n type: 'type',\n id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n brandKitID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n defaultSegmentID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n definition: [\n 'body' => [\n 'elements' => [\n 'foo' => [\n 'type' => 'x', 'children' => ['string'], 'props' => ['foo' => 'bar']\n ],\n ],\n 'root' => 'x',\n ],\n 'codeFormat' => 'json',\n 'emailContentsType' => 'Code',\n 'type' => 'Email',\n 'from' => 'from',\n 'preheader' => 'preheader',\n 'renderVariables' => ['foo' => 'bar'],\n 'replyTo' => 'replyTo',\n 'sensitiveTransactionalVariablePaths' => ['x'],\n 'subject' => 'subject',\n ],\n language: 'xx',\n purpose: 'General',\n senderProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n subType: 'subType',\n);\n\nvar_dump($template);",
|
|
1335
1337
|
},
|
|
1336
1338
|
http: {
|
|
1337
1339
|
example:
|
|
@@ -1349,9 +1351,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1349
1351
|
qualified: 'client.v1.templates.retrieve',
|
|
1350
1352
|
params: ['id: string;'],
|
|
1351
1353
|
response:
|
|
1352
|
-
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }",
|
|
1354
|
+
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }",
|
|
1353
1355
|
markdown:
|
|
1354
|
-
"## retrieve\n\n`client.v1.templates.retrieve(id: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**get** `/api/v1/templates/{id}`\n\nGet template\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst template = await client.v1.templates.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(template);\n```",
|
|
1356
|
+
"## retrieve\n\n`client.v1.templates.retrieve(id: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**get** `/api/v1/templates/{id}`\n\nGet template\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst template = await client.v1.templates.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(template);\n```",
|
|
1355
1357
|
perLanguage: {
|
|
1356
1358
|
typescript: {
|
|
1357
1359
|
method: 'client.v1.templates.retrieve',
|
|
@@ -1371,7 +1373,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1371
1373
|
go: {
|
|
1372
1374
|
method: 'client.V1.Templates.Get',
|
|
1373
1375
|
example:
|
|
1374
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1376
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\ttemplate, err := client.V1.Templates.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", template.ID)\n}\n',
|
|
1375
1377
|
},
|
|
1376
1378
|
cli: {
|
|
1377
1379
|
method: 'templates retrieve',
|
|
@@ -1401,7 +1403,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1401
1403
|
'id: string;',
|
|
1402
1404
|
'brandKitId?: string;',
|
|
1403
1405
|
'defaultSegmentId?: string;',
|
|
1404
|
-
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; };",
|
|
1406
|
+
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; };",
|
|
1405
1407
|
'language?: string;',
|
|
1406
1408
|
'name?: string;',
|
|
1407
1409
|
"purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery';",
|
|
@@ -1409,9 +1411,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1409
1411
|
'subType?: string;',
|
|
1410
1412
|
],
|
|
1411
1413
|
response:
|
|
1412
|
-
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }",
|
|
1414
|
+
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }",
|
|
1413
1415
|
markdown:
|
|
1414
|
-
"## update\n\n`client.v1.templates.update(id: string, brandKitId?: string, defaultSegmentId?: string, definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; }, language?: string, name?: string, purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', senderProfileId?: string, subType?: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**put** `/api/v1/templates/{id}`\n\nUpdate template\n\n### Parameters\n\n- `id: string`\n\n- `brandKitId?: string`\n\n- `defaultSegmentId?: string`\n\n- `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; }`\n - `body: { elements: object; root: string; }`\n - `codeFormat: 'json'`\n - `emailContentsType: 'Code'`\n - `type: 'Email'`\n - `from?: string`\n - `preheader?: string`\n - `renderVariables?: object`\n - `replyTo?: string`\n - `subject?: string`\n\n- `language?: string`\n\n- `name?: string`\n\n- `purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n\n- `senderProfileId?: string`\n\n- `subType?: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst template = await client.v1.templates.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(template);\n```",
|
|
1416
|
+
"## update\n\n`client.v1.templates.update(id: string, brandKitId?: string, defaultSegmentId?: string, definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; }, language?: string, name?: string, purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', senderProfileId?: string, subType?: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**put** `/api/v1/templates/{id}`\n\nUpdate template\n\n### Parameters\n\n- `id: string`\n\n- `brandKitId?: string`\n\n- `defaultSegmentId?: string`\n\n- `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; }`\n - `body: { elements: object; root: string; }`\n - `codeFormat: 'json'`\n - `emailContentsType: 'Code'`\n - `type: 'Email'`\n - `from?: string`\n - `preheader?: string`\n - `renderVariables?: object`\n - `replyTo?: string`\n - `sensitiveTransactionalVariablePaths?: string[]`\n - `subject?: string`\n\n- `language?: string`\n\n- `name?: string`\n\n- `purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n\n- `senderProfileId?: string`\n\n- `subType?: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst template = await client.v1.templates.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(template);\n```",
|
|
1415
1417
|
perLanguage: {
|
|
1416
1418
|
typescript: {
|
|
1417
1419
|
method: 'client.v1.templates.update',
|
|
@@ -1431,7 +1433,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1431
1433
|
go: {
|
|
1432
1434
|
method: 'client.V1.Templates.Update',
|
|
1433
1435
|
example:
|
|
1434
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1436
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\ttemplate, err := client.V1.Templates.Update(\n\t\tcontext.TODO(),\n\t\t"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tsegmentflow.V1TemplateUpdateParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", template.ID)\n}\n',
|
|
1435
1437
|
},
|
|
1436
1438
|
cli: {
|
|
1437
1439
|
method: 'templates update',
|
|
@@ -1441,7 +1443,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1441
1443
|
php: {
|
|
1442
1444
|
method: 'v1->templates->update',
|
|
1443
1445
|
example:
|
|
1444
|
-
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$template = $client->v1->templates->update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n brandKitID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n defaultSegmentID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n definition: [\n 'body' => [\n 'elements' => [\n 'foo' => [\n 'type' => 'x', 'children' => ['string'], 'props' => ['foo' => 'bar']\n ],\n ],\n 'root' => 'x',\n ],\n 'codeFormat' => 'json',\n 'emailContentsType' => 'Code',\n 'type' => 'Email',\n 'from' => 'from',\n 'preheader' => 'preheader',\n 'renderVariables' => ['foo' => 'bar'],\n 'replyTo' => 'replyTo',\n 'subject' => 'subject',\n ],\n language: 'xx',\n name: 'name',\n purpose: 'General',\n senderProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n subType: 'subType',\n);\n\nvar_dump($template);",
|
|
1446
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$template = $client->v1->templates->update(\n '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n brandKitID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n defaultSegmentID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n definition: [\n 'body' => [\n 'elements' => [\n 'foo' => [\n 'type' => 'x', 'children' => ['string'], 'props' => ['foo' => 'bar']\n ],\n ],\n 'root' => 'x',\n ],\n 'codeFormat' => 'json',\n 'emailContentsType' => 'Code',\n 'type' => 'Email',\n 'from' => 'from',\n 'preheader' => 'preheader',\n 'renderVariables' => ['foo' => 'bar'],\n 'replyTo' => 'replyTo',\n 'sensitiveTransactionalVariablePaths' => ['x'],\n 'subject' => 'subject',\n ],\n language: 'xx',\n name: 'name',\n purpose: 'General',\n senderProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n subType: 'subType',\n);\n\nvar_dump($template);",
|
|
1445
1447
|
},
|
|
1446
1448
|
http: {
|
|
1447
1449
|
example:
|
|
@@ -1480,7 +1482,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1480
1482
|
go: {
|
|
1481
1483
|
method: 'client.V1.Templates.Delete',
|
|
1482
1484
|
example:
|
|
1483
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1485
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\ttemplate, err := client.V1.Templates.Delete(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", template)\n}\n',
|
|
1484
1486
|
},
|
|
1485
1487
|
cli: {
|
|
1486
1488
|
method: 'templates delete',
|
|
@@ -1508,9 +1510,9 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1508
1510
|
qualified: 'client.v1.templates.duplicate',
|
|
1509
1511
|
params: ['id: string;'],
|
|
1510
1512
|
response:
|
|
1511
|
-
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }",
|
|
1513
|
+
"{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }",
|
|
1512
1514
|
markdown:
|
|
1513
|
-
"## duplicate\n\n`client.v1.templates.duplicate(id: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**post** `/api/v1/templates/{id}/duplicate`\n\nCreate an editable copy of an existing template in the current organization\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst response = await client.v1.templates.duplicate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(response);\n```",
|
|
1515
|
+
"## duplicate\n\n`client.v1.templates.duplicate(id: string): { id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: object; }`\n\n**post** `/api/v1/templates/{id}/duplicate`\n\nCreate an editable copy of an existing template in the current organization\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; brandKitId: string; createdAt: string; defaultSegmentId: string; language: string; name: string; organizationId: string; purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'; senderProfileId: string; source: string; type: string; updatedAt: string; currentSnapshotId?: string; definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }; }`\n\n - `id: string`\n - `brandKitId: string`\n - `createdAt: string`\n - `defaultSegmentId: string`\n - `language: string`\n - `name: string`\n - `organizationId: string`\n - `purpose: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery'`\n - `senderProfileId: string`\n - `source: string`\n - `type: string`\n - `updatedAt: string`\n - `currentSnapshotId?: string`\n - `definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; from: string; subject: string; type: 'Email'; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; }`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst response = await client.v1.templates.duplicate('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(response);\n```",
|
|
1514
1516
|
perLanguage: {
|
|
1515
1517
|
typescript: {
|
|
1516
1518
|
method: 'client.v1.templates.duplicate',
|
|
@@ -1530,7 +1532,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1530
1532
|
go: {
|
|
1531
1533
|
method: 'client.V1.Templates.Duplicate',
|
|
1532
1534
|
example:
|
|
1533
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1535
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Templates.Duplicate(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ID)\n}\n',
|
|
1534
1536
|
},
|
|
1535
1537
|
cli: {
|
|
1536
1538
|
method: 'templates duplicate',
|
|
@@ -1580,7 +1582,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1580
1582
|
go: {
|
|
1581
1583
|
method: 'client.V1.Templates.Archive',
|
|
1582
1584
|
example:
|
|
1583
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1585
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Templates.Archive(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ID)\n}\n',
|
|
1584
1586
|
},
|
|
1585
1587
|
cli: {
|
|
1586
1588
|
method: 'templates archive',
|
|
@@ -1630,7 +1632,7 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1630
1632
|
go: {
|
|
1631
1633
|
method: 'client.V1.Templates.Unarchive',
|
|
1632
1634
|
example:
|
|
1633
|
-
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1635
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Templates.Unarchive(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ID)\n}\n',
|
|
1634
1636
|
},
|
|
1635
1637
|
cli: {
|
|
1636
1638
|
method: 'templates unarchive',
|
|
@@ -1648,38 +1650,327 @@ const EMBEDDED_METHODS: MethodEntry[] = [
|
|
|
1648
1650
|
},
|
|
1649
1651
|
},
|
|
1650
1652
|
},
|
|
1653
|
+
{
|
|
1654
|
+
name: 'create',
|
|
1655
|
+
endpoint: '/api/v1/broadcasts',
|
|
1656
|
+
httpMethod: 'post',
|
|
1657
|
+
summary: 'Create broadcast',
|
|
1658
|
+
description:
|
|
1659
|
+
'Create a Broadcast for a Segment. Inline content creates a saved Email Template first; templateId reuses an existing Template. Set send=true to send immediately, or combine send=true with scheduledAt to schedule.',
|
|
1660
|
+
stainlessPath: '(resource) v1.broadcasts > (method) create',
|
|
1661
|
+
qualified: 'client.v1.broadcasts.create',
|
|
1662
|
+
params: [
|
|
1663
|
+
'from?: string;',
|
|
1664
|
+
'html?: string;',
|
|
1665
|
+
'name?: string;',
|
|
1666
|
+
'replyTo?: string | string[];',
|
|
1667
|
+
'scheduledAt?: string;',
|
|
1668
|
+
'segmentId?: string;',
|
|
1669
|
+
'send?: boolean;',
|
|
1670
|
+
'subject?: string;',
|
|
1671
|
+
'subscriptionGroupId?: string;',
|
|
1672
|
+
'templateId?: string;',
|
|
1673
|
+
'text?: string;',
|
|
1674
|
+
'topicId?: string;',
|
|
1675
|
+
],
|
|
1676
|
+
response: '{ id: string; }',
|
|
1677
|
+
markdown:
|
|
1678
|
+
'## create\n\n`client.v1.broadcasts.create(from?: string, html?: string, name?: string, replyTo?: string | string[], scheduledAt?: string, segmentId?: string, send?: boolean, subject?: string, subscriptionGroupId?: string, templateId?: string, text?: string, topicId?: string): { id: string; }`\n\n**post** `/api/v1/broadcasts`\n\nCreate a Broadcast for a Segment. Inline content creates a saved Email Template first; templateId reuses an existing Template. Set send=true to send immediately, or combine send=true with scheduledAt to schedule.\n\n### Parameters\n\n- `from?: string`\n Sender email address. Friendly names may use "Name <sender@example.com>".\n\n- `html?: string`\n\n- `name?: string`\n\n- `replyTo?: string | string[]`\n\n- `scheduledAt?: string`\n\n- `segmentId?: string`\n\n- `send?: boolean`\n\n- `subject?: string`\n\n- `subscriptionGroupId?: string`\n\n- `templateId?: string`\n\n- `text?: string`\n\n- `topicId?: string`\n\n### Returns\n\n- `{ id: string; }`\n\n - `id: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from \'@segmentflow/segmentflow-typescript\';\n\nconst client = new SegmentflowAI();\n\nconst broadcast = await client.v1.broadcasts.create();\n\nconsole.log(broadcast);\n```',
|
|
1679
|
+
perLanguage: {
|
|
1680
|
+
typescript: {
|
|
1681
|
+
method: 'client.v1.broadcasts.create',
|
|
1682
|
+
example:
|
|
1683
|
+
"import SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n});\n\nconst broadcast = await client.v1.broadcasts.create();\n\nconsole.log(broadcast.id);",
|
|
1684
|
+
},
|
|
1685
|
+
python: {
|
|
1686
|
+
method: 'v1.broadcasts.create',
|
|
1687
|
+
example:
|
|
1688
|
+
'import os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n)\nbroadcast = client.v1.broadcasts.create()\nprint(broadcast.id)',
|
|
1689
|
+
},
|
|
1690
|
+
java: {
|
|
1691
|
+
method: 'v1().broadcasts().create',
|
|
1692
|
+
example:
|
|
1693
|
+
'package com.segmentflow.api.example;\n\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.broadcasts.BroadcastCreateParams;\nimport com.segmentflow.api.models.v1.broadcasts.BroadcastCreateResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n SegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\n BroadcastCreateResponse broadcast = client.v1().broadcasts().create();\n }\n}',
|
|
1694
|
+
},
|
|
1695
|
+
go: {
|
|
1696
|
+
method: 'client.V1.Broadcasts.New',
|
|
1697
|
+
example:
|
|
1698
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tbroadcast, err := client.V1.Broadcasts.New(context.TODO(), segmentflow.V1BroadcastNewParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", broadcast.ID)\n}\n',
|
|
1699
|
+
},
|
|
1700
|
+
cli: {
|
|
1701
|
+
method: 'broadcasts create',
|
|
1702
|
+
example: "segmentflow v1:broadcasts create \\\n --api-key 'My API Key'",
|
|
1703
|
+
},
|
|
1704
|
+
php: {
|
|
1705
|
+
method: 'v1->broadcasts->create',
|
|
1706
|
+
example:
|
|
1707
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$broadcast = $client->v1->broadcasts->create(\n from: 'x',\n html: 'x',\n name: 'x',\n replyTo: 'dev@stainless.com',\n scheduledAt: 'x',\n segmentID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n send: true,\n subject: 'x',\n subscriptionGroupID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n templateID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n text: 'text',\n topicID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n);\n\nvar_dump($broadcast);",
|
|
1708
|
+
},
|
|
1709
|
+
http: {
|
|
1710
|
+
example:
|
|
1711
|
+
'curl https://api.segmentflow.ai/api/v1/broadcasts \\\n -X POST \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
1712
|
+
},
|
|
1713
|
+
},
|
|
1714
|
+
},
|
|
1715
|
+
{
|
|
1716
|
+
name: 'send',
|
|
1717
|
+
endpoint: '/api/v1/emails',
|
|
1718
|
+
httpMethod: 'post',
|
|
1719
|
+
summary: 'Send email',
|
|
1720
|
+
description: 'Create one EmailSend from a saved email template and enqueue delivery.',
|
|
1721
|
+
stainlessPath: '(resource) v1.emails > (method) send',
|
|
1722
|
+
qualified: 'client.v1.emails.send',
|
|
1723
|
+
params: [
|
|
1724
|
+
'templateId: string;',
|
|
1725
|
+
'idempotency-key: string;',
|
|
1726
|
+
'bcc?: string | string[];',
|
|
1727
|
+
'cc?: string | string[];',
|
|
1728
|
+
'data?: object;',
|
|
1729
|
+
'from?: string;',
|
|
1730
|
+
'profileId?: string;',
|
|
1731
|
+
'replyTo?: string;',
|
|
1732
|
+
'senderProfileId?: string;',
|
|
1733
|
+
'subject?: string;',
|
|
1734
|
+
'subscriptionGroupId?: string;',
|
|
1735
|
+
'to?: { email?: string; externalId?: string; };',
|
|
1736
|
+
'tracking?: { clicks?: boolean; };',
|
|
1737
|
+
],
|
|
1738
|
+
response:
|
|
1739
|
+
"{ id: string; cc: { email: string; name: string; }[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: { email: string; name: string; }; messageId: string; profileId: string; replyTo: { email: string; name: string; }; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: { email: string; }; updatedAt: string; }",
|
|
1740
|
+
markdown:
|
|
1741
|
+
"## send\n\n`client.v1.emails.send(templateId: string, idempotency-key: string, bcc?: string | string[], cc?: string | string[], data?: object, from?: string, profileId?: string, replyTo?: string, senderProfileId?: string, subject?: string, subscriptionGroupId?: string, to?: { email?: string; externalId?: string; }, tracking?: { clicks?: boolean; }): { id: string; cc: object[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: object; messageId: string; profileId: string; replyTo: object; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: object; updatedAt: string; }`\n\n**post** `/api/v1/emails`\n\nCreate one EmailSend from a saved email template and enqueue delivery.\n\n### Parameters\n\n- `templateId: string`\n Exact saved Email Template id to snapshot and render.\n\n- `idempotency-key: string`\n\n- `bcc?: string | string[]`\n Hidden copied recipients. Persisted for retry/provider handoff but never returned by public responses.\n\n- `cc?: string | string[]`\n Visible copied recipients. Persisted and handed to the email provider.\n\n- `data?: object`\n One-send email payload exposed to templates under /data/*.\n\n- `from?: string`\n Optional sender override. Accepts a bare email or \"Name <email@example.com>\" and must match a verified SenderProfile email.\n\n- `profileId?: string`\n Optional primary recipient Profile id. When to.email is absent, the Profile canonical email is used for delivery.\n\n- `replyTo?: string`\n Optional reply-to override. Accepts a single bare email or \"Name <email@example.com>\" and must use a verified sender domain owned by the organization.\n\n- `senderProfileId?: string`\n Optional transactional SenderProfile override. Defaults to the template SenderProfile.\n\n- `subject?: string`\n Optional final subject override. When omitted, the Template subject is frozen onto the EmailSend.\n\n- `subscriptionGroupId?: string`\n Optional SubscriptionGroup gate. If supplied, the send is skipped when the recipient is not subscribed according to the group's OptIn/OptOut policy.\n\n- `to?: { email?: string; externalId?: string; }`\n Recipient identity. This identifies or creates a Profile but does not update durable Profile Properties.\n - `email?: string`\n Recipient email address. Stored normalized in the send record.\n - `externalId?: string`\n Safe caller-owned recipient identifier used to link or create the Profile.\n\n- `tracking?: { clicks?: boolean; }`\n Per-send tracking preferences.\n - `clicks?: boolean`\n Enable or disable click tracking for this send.\n\n### Returns\n\n- `{ id: string; cc: { email: string; name: string; }[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: { email: string; name: string; }; messageId: string; profileId: string; replyTo: { email: string; name: string; }; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: { email: string; }; updatedAt: string; }`\n\n - `id: string`\n - `cc: { email: string; name: string; }[]`\n - `createdAt: string`\n - `failureMessage: string`\n - `failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'`\n - `from: { email: string; name: string; }`\n - `messageId: string`\n - `profileId: string`\n - `replyTo: { email: string; name: string; }`\n - `senderProfileId: string`\n - `skippedReason: string`\n - `status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'`\n - `subject: string`\n - `subscriptionGroupId: string`\n - `templateId: string`\n - `templateSnapshotId: string`\n - `to: { email: string; }`\n - `updatedAt: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst response = await client.v1.emails.send({ templateId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', 'idempotency-key': 'x' });\n\nconsole.log(response);\n```",
|
|
1742
|
+
perLanguage: {
|
|
1743
|
+
typescript: {
|
|
1744
|
+
method: 'client.v1.emails.send',
|
|
1745
|
+
example:
|
|
1746
|
+
"import SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.v1.emails.send({\n templateId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'idempotency-key': 'x',\n});\n\nconsole.log(response.id);",
|
|
1747
|
+
},
|
|
1748
|
+
python: {
|
|
1749
|
+
method: 'v1.emails.send',
|
|
1750
|
+
example:
|
|
1751
|
+
'import os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.v1.emails.send(\n template_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n idempotency_key="x",\n)\nprint(response.id)',
|
|
1752
|
+
},
|
|
1753
|
+
java: {
|
|
1754
|
+
method: 'v1().emails().send',
|
|
1755
|
+
example:
|
|
1756
|
+
'package com.segmentflow.api.example;\n\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.emails.EmailSendParams;\nimport com.segmentflow.api.models.v1.emails.EmailSendResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n SegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\n EmailSendParams params = EmailSendParams.builder()\n .idempotencyKey("x")\n .templateId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n .build();\n EmailSendResponse response = client.v1().emails().send(params);\n }\n}',
|
|
1757
|
+
},
|
|
1758
|
+
go: {
|
|
1759
|
+
method: 'client.V1.Emails.Send',
|
|
1760
|
+
example:
|
|
1761
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Emails.Send(context.TODO(), segmentflow.V1EmailSendParams{\n\t\tTemplateID: "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n\t\tIdempotencyKey: "x",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ID)\n}\n',
|
|
1762
|
+
},
|
|
1763
|
+
cli: {
|
|
1764
|
+
method: 'emails send',
|
|
1765
|
+
example:
|
|
1766
|
+
"segmentflow v1:emails send \\\n --api-key 'My API Key' \\\n --template-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \\\n --idempotency-key x",
|
|
1767
|
+
},
|
|
1768
|
+
php: {
|
|
1769
|
+
method: 'v1->emails->send',
|
|
1770
|
+
example:
|
|
1771
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$response = $client->v1->emails->send(\n templateID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n idempotencyKey: 'x',\n bcc: 'x',\n cc: 'x',\n data: ['foo' => 'bar'],\n from: 'x',\n profileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n replyTo: 'x',\n senderProfileID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n subject: 'x',\n subscriptionGroupID: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n to: ['email' => 'dev@stainless.com', 'externalID' => 'x'],\n tracking: ['clicks' => true],\n);\n\nvar_dump($response);",
|
|
1772
|
+
},
|
|
1773
|
+
http: {
|
|
1774
|
+
example:
|
|
1775
|
+
'curl https://api.segmentflow.ai/api/v1/emails \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY" \\\n -d \'{\n "templateId": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"\n }\'',
|
|
1776
|
+
},
|
|
1777
|
+
},
|
|
1778
|
+
},
|
|
1779
|
+
{
|
|
1780
|
+
name: 'batch_send',
|
|
1781
|
+
endpoint: '/api/v1/emails/batch',
|
|
1782
|
+
httpMethod: 'post',
|
|
1783
|
+
summary: 'Batch send emails',
|
|
1784
|
+
description:
|
|
1785
|
+
'Create or replay many independent EmailSend records. Each item has its own recipient identity, one-send data, idempotency key, and result; this is not a Broadcast, Bulk Operation, Carrier, or NewsletterIssue.',
|
|
1786
|
+
stainlessPath: '(resource) v1.emails > (method) batch_send',
|
|
1787
|
+
qualified: 'client.v1.emails.batchSend',
|
|
1788
|
+
params: [
|
|
1789
|
+
'items: { idempotencyKey: string; bcc?: string | string[]; cc?: string | string[]; data?: object; from?: string; profileId?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; to?: { email?: string; externalId?: string; }; tracking?: { clicks?: boolean; }; }[];',
|
|
1790
|
+
'defaults?: { from?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; tracking?: { clicks?: boolean; }; };',
|
|
1791
|
+
],
|
|
1792
|
+
response:
|
|
1793
|
+
"{ accepted: number; items: { idempotencyKey: string; index: number; send: { id: string; cc: object[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: object; messageId: string; profileId: string; replyTo: object; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: object; updatedAt: string; }; status: 'Accepted'; } | { error: { errorCode: string; message: string; statusCode: number; details?: object; }; idempotencyKey: string; index: number; status: 'Rejected'; }[]; rejected: number; total: number; }",
|
|
1794
|
+
markdown:
|
|
1795
|
+
"## batch_send\n\n`client.v1.emails.batchSend(items: { idempotencyKey: string; bcc?: string | string[]; cc?: string | string[]; data?: object; from?: string; profileId?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; to?: { email?: string; externalId?: string; }; tracking?: { clicks?: boolean; }; }[], defaults?: { from?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; tracking?: { clicks?: boolean; }; }): { accepted: number; items: object | object[]; rejected: number; total: number; }`\n\n**post** `/api/v1/emails/batch`\n\nCreate or replay many independent EmailSend records. Each item has its own recipient identity, one-send data, idempotency key, and result; this is not a Broadcast, Bulk Operation, Carrier, or NewsletterIssue.\n\n### Parameters\n\n- `items: { idempotencyKey: string; bcc?: string | string[]; cc?: string | string[]; data?: object; from?: string; profileId?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; to?: { email?: string; externalId?: string; }; tracking?: { clicks?: boolean; }; }[]`\n Independent email sends. Items are processed in order and each item has its own idempotency key and result.\n\n- `defaults?: { from?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; tracking?: { clicks?: boolean; }; }`\n Shared batch defaults applied to each item before item validation. Recipient, data, cc, and bcc fields are not allowed here.\n - `from?: string`\n Optional sender override. Accepts a bare email or \"Name <email@example.com>\" and must match a verified SenderProfile email.\n - `replyTo?: string`\n Optional reply-to override. Accepts a single bare email or \"Name <email@example.com>\" and must use a verified sender domain owned by the organization.\n - `senderProfileId?: string`\n Optional transactional SenderProfile override. Defaults to the template SenderProfile.\n - `subject?: string`\n Optional final subject override. When omitted, the Template subject is frozen onto the EmailSend.\n - `subscriptionGroupId?: string`\n Optional SubscriptionGroup gate. If supplied, the send is skipped when the recipient is not subscribed according to the group's OptIn/OptOut policy.\n - `templateId?: string`\n Exact saved Email Template id to snapshot and render.\n - `tracking?: { clicks?: boolean; }`\n Per-send tracking preferences.\n\n### Returns\n\n- `{ accepted: number; items: { idempotencyKey: string; index: number; send: { id: string; cc: object[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: object; messageId: string; profileId: string; replyTo: object; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: object; updatedAt: string; }; status: 'Accepted'; } | { error: { errorCode: string; message: string; statusCode: number; details?: object; }; idempotencyKey: string; index: number; status: 'Rejected'; }[]; rejected: number; total: number; }`\n\n - `accepted: number`\n - `items: { idempotencyKey: string; index: number; send: { id: string; cc: { email: string; name: string; }[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: { email: string; name: string; }; messageId: string; profileId: string; replyTo: { email: string; name: string; }; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: { email: string; }; updatedAt: string; }; status: 'Accepted'; } | { error: { errorCode: string; message: string; statusCode: number; details?: object; }; idempotencyKey: string; index: number; status: 'Rejected'; }[]`\n - `rejected: number`\n - `total: number`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst response = await client.v1.emails.batchSend({ items: [{ idempotencyKey: 'x' }] });\n\nconsole.log(response);\n```",
|
|
1796
|
+
perLanguage: {
|
|
1797
|
+
typescript: {
|
|
1798
|
+
method: 'client.v1.emails.batchSend',
|
|
1799
|
+
example:
|
|
1800
|
+
"import SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.v1.emails.batchSend({ items: [{ idempotencyKey: 'x' }] });\n\nconsole.log(response.accepted);",
|
|
1801
|
+
},
|
|
1802
|
+
python: {
|
|
1803
|
+
method: 'v1.emails.batch_send',
|
|
1804
|
+
example:
|
|
1805
|
+
'import os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.v1.emails.batch_send(\n items=[{\n "idempotency_key": "x"\n }],\n)\nprint(response.accepted)',
|
|
1806
|
+
},
|
|
1807
|
+
java: {
|
|
1808
|
+
method: 'v1().emails().batchSend',
|
|
1809
|
+
example:
|
|
1810
|
+
'package com.segmentflow.api.example;\n\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.emails.EmailBatchSendParams;\nimport com.segmentflow.api.models.v1.emails.EmailBatchSendResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n SegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\n EmailBatchSendParams params = EmailBatchSendParams.builder()\n .addItem(EmailBatchSendParams.Item.builder()\n .idempotencyKey("x")\n .build())\n .build();\n EmailBatchSendResponse response = client.v1().emails().batchSend(params);\n }\n}',
|
|
1811
|
+
},
|
|
1812
|
+
go: {
|
|
1813
|
+
method: 'client.V1.Emails.BatchSend',
|
|
1814
|
+
example:
|
|
1815
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Emails.BatchSend(context.TODO(), segmentflow.V1EmailBatchSendParams{\n\t\tItems: []segmentflow.V1EmailBatchSendParamsItem{{\n\t\t\tIdempotencyKey: "x",\n\t\t}},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.Accepted)\n}\n',
|
|
1816
|
+
},
|
|
1817
|
+
cli: {
|
|
1818
|
+
method: 'emails batch_send',
|
|
1819
|
+
example:
|
|
1820
|
+
"segmentflow v1:emails batch-send \\\n --api-key 'My API Key' \\\n --item '{idempotencyKey: x}'",
|
|
1821
|
+
},
|
|
1822
|
+
php: {
|
|
1823
|
+
method: 'v1->emails->batchSend',
|
|
1824
|
+
example:
|
|
1825
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$response = $client->v1->emails->batchSend(\n items: [\n [\n 'idempotencyKey' => 'x',\n 'bcc' => 'x',\n 'cc' => 'x',\n 'data' => ['foo' => 'bar'],\n 'from' => 'x',\n 'profileID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'replyTo' => 'x',\n 'senderProfileID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'subject' => 'x',\n 'subscriptionGroupID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'templateID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'to' => ['email' => 'dev@stainless.com', 'externalID' => 'x'],\n 'tracking' => ['clicks' => true],\n ],\n ],\n defaults: [\n 'from' => 'x',\n 'replyTo' => 'x',\n 'senderProfileID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'subject' => 'x',\n 'subscriptionGroupID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'templateID' => '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',\n 'tracking' => ['clicks' => true],\n ],\n);\n\nvar_dump($response);",
|
|
1826
|
+
},
|
|
1827
|
+
http: {
|
|
1828
|
+
example:
|
|
1829
|
+
'curl https://api.segmentflow.ai/api/v1/emails/batch \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY" \\\n -d \'{\n "items": [\n {\n "idempotencyKey": "x"\n }\n ]\n }\'',
|
|
1830
|
+
},
|
|
1831
|
+
},
|
|
1832
|
+
},
|
|
1833
|
+
{
|
|
1834
|
+
name: 'retrieve',
|
|
1835
|
+
endpoint: '/api/v1/emails/{id}',
|
|
1836
|
+
httpMethod: 'get',
|
|
1837
|
+
summary: 'Retrieve email send',
|
|
1838
|
+
description: 'Get the current status handle for an EmailSend.',
|
|
1839
|
+
stainlessPath: '(resource) v1.emails > (method) retrieve',
|
|
1840
|
+
qualified: 'client.v1.emails.retrieve',
|
|
1841
|
+
params: ['id: string;'],
|
|
1842
|
+
response:
|
|
1843
|
+
"{ id: string; cc: { email: string; name: string; }[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: { email: string; name: string; }; messageId: string; profileId: string; replyTo: { email: string; name: string; }; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: { email: string; }; updatedAt: string; }",
|
|
1844
|
+
markdown:
|
|
1845
|
+
"## retrieve\n\n`client.v1.emails.retrieve(id: string): { id: string; cc: object[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: object; messageId: string; profileId: string; replyTo: object; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: object; updatedAt: string; }`\n\n**get** `/api/v1/emails/{id}`\n\nGet the current status handle for an EmailSend.\n\n### Parameters\n\n- `id: string`\n\n### Returns\n\n- `{ id: string; cc: { email: string; name: string; }[]; createdAt: string; failureMessage: string; failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'; from: { email: string; name: string; }; messageId: string; profileId: string; replyTo: { email: string; name: string; }; senderProfileId: string; skippedReason: string; status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'; subject: string; subscriptionGroupId: string; templateId: string; templateSnapshotId: string; to: { email: string; }; updatedAt: string; }`\n\n - `id: string`\n - `cc: { email: string; name: string; }[]`\n - `createdAt: string`\n - `failureMessage: string`\n - `failureReason: 'WorkerFailed' | 'ProviderRejected' | 'RenderFailed' | 'Unknown'`\n - `from: { email: string; name: string; }`\n - `messageId: string`\n - `profileId: string`\n - `replyTo: { email: string; name: string; }`\n - `senderProfileId: string`\n - `skippedReason: string`\n - `status: 'Queued' | 'Processing' | 'Sent' | 'Failed' | 'Skipped'`\n - `subject: string`\n - `subscriptionGroupId: string`\n - `templateId: string`\n - `templateSnapshotId: string`\n - `to: { email: string; }`\n - `updatedAt: string`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst email = await client.v1.emails.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(email);\n```",
|
|
1846
|
+
perLanguage: {
|
|
1847
|
+
typescript: {
|
|
1848
|
+
method: 'client.v1.emails.retrieve',
|
|
1849
|
+
example:
|
|
1850
|
+
"import SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n});\n\nconst email = await client.v1.emails.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nconsole.log(email.id);",
|
|
1851
|
+
},
|
|
1852
|
+
python: {
|
|
1853
|
+
method: 'v1.emails.retrieve',
|
|
1854
|
+
example:
|
|
1855
|
+
'import os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n)\nemail = client.v1.emails.retrieve(\n "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n)\nprint(email.id)',
|
|
1856
|
+
},
|
|
1857
|
+
java: {
|
|
1858
|
+
method: 'v1().emails().retrieve',
|
|
1859
|
+
example:
|
|
1860
|
+
'package com.segmentflow.api.example;\n\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.emails.EmailRetrieveParams;\nimport com.segmentflow.api.models.v1.emails.EmailRetrieveResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n SegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\n EmailRetrieveResponse email = client.v1().emails().retrieve("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");\n }\n}',
|
|
1861
|
+
},
|
|
1862
|
+
go: {
|
|
1863
|
+
method: 'client.V1.Emails.Get',
|
|
1864
|
+
example:
|
|
1865
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\temail, err := client.V1.Emails.Get(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", email.ID)\n}\n',
|
|
1866
|
+
},
|
|
1867
|
+
cli: {
|
|
1868
|
+
method: 'emails retrieve',
|
|
1869
|
+
example:
|
|
1870
|
+
"segmentflow v1:emails retrieve \\\n --api-key 'My API Key' \\\n --id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
1871
|
+
},
|
|
1872
|
+
php: {
|
|
1873
|
+
method: 'v1->emails->retrieve',
|
|
1874
|
+
example:
|
|
1875
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$email = $client->v1->emails->retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');\n\nvar_dump($email);",
|
|
1876
|
+
},
|
|
1877
|
+
http: {
|
|
1878
|
+
example:
|
|
1879
|
+
'curl https://api.segmentflow.ai/api/v1/emails/$ID \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
1880
|
+
},
|
|
1881
|
+
},
|
|
1882
|
+
},
|
|
1883
|
+
{
|
|
1884
|
+
name: 'track',
|
|
1885
|
+
endpoint: '/api/v1/events',
|
|
1886
|
+
httpMethod: 'post',
|
|
1887
|
+
summary: 'Track event',
|
|
1888
|
+
description:
|
|
1889
|
+
'Accept one server-side identified business event, persist a UserEvent, and trigger matching active Journeys.',
|
|
1890
|
+
stainlessPath: '(resource) v1.events > (method) track',
|
|
1891
|
+
qualified: 'client.v1.events.track',
|
|
1892
|
+
params: [
|
|
1893
|
+
'event: string;',
|
|
1894
|
+
'profile: { email?: string; externalId?: string; properties?: object; };',
|
|
1895
|
+
'idempotency-key: string;',
|
|
1896
|
+
'data?: object;',
|
|
1897
|
+
'occurredAt?: string;',
|
|
1898
|
+
'redactedDataPaths?: string[];',
|
|
1899
|
+
'referenceId?: string;',
|
|
1900
|
+
],
|
|
1901
|
+
response:
|
|
1902
|
+
'{ enrolledJourneys: number; eventId: string; matchedJourneys: number; profileId: string; skippedJourneys: number; }',
|
|
1903
|
+
markdown:
|
|
1904
|
+
"## track\n\n`client.v1.events.track(event: string, profile: { email?: string; externalId?: string; properties?: object; }, idempotency-key: string, data?: object, occurredAt?: string, redactedDataPaths?: string[], referenceId?: string): { enrolledJourneys: number; eventId: string; matchedJourneys: number; profileId: string; skippedJourneys: number; }`\n\n**post** `/api/v1/events`\n\nAccept one server-side identified business event, persist a UserEvent, and trigger matching active Journeys.\n\n### Parameters\n\n- `event: string`\n Free-form business event name, for example order.created.\n\n- `profile: { email?: string; externalId?: string; properties?: object; }`\n Profile identity and optional durable Profile Property input.\n - `email?: string`\n Profile email address used to resolve or create a Profile.\n - `externalId?: string`\n Caller-owned Profile identifier.\n - `properties?: object`\n Optional durable Profile Property updates keyed by existing Profile Property names.\n\n- `idempotency-key: string`\n\n- `data?: object`\n One-event payload for this event. This is not copied into Profile Properties.\n\n- `occurredAt?: string`\n Event time. If omitted, Segmentflow uses receipt time.\n\n- `redactedDataPaths?: string[]`\n Event state paths to redact before durable retention. Paths must live under /event/.\n\n- `referenceId?: string`\n Safe caller correlation id. It is not used for idempotency; use the Idempotency-Key header for that.\n\n### Returns\n\n- `{ enrolledJourneys: number; eventId: string; matchedJourneys: number; profileId: string; skippedJourneys: number; }`\n\n - `enrolledJourneys: number`\n - `eventId: string`\n - `matchedJourneys: number`\n - `profileId: string`\n - `skippedJourneys: number`\n\n### Example\n\n```typescript\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI();\n\nconst response = await client.v1.events.track({\n event: 'x',\n profile: {},\n 'idempotency-key': 'x',\n});\n\nconsole.log(response);\n```",
|
|
1905
|
+
perLanguage: {
|
|
1906
|
+
typescript: {
|
|
1907
|
+
method: 'client.v1.events.track',
|
|
1908
|
+
example:
|
|
1909
|
+
"import SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.v1.events.track({\n event: 'x',\n profile: {},\n 'idempotency-key': 'x',\n});\n\nconsole.log(response.enrolledJourneys);",
|
|
1910
|
+
},
|
|
1911
|
+
python: {
|
|
1912
|
+
method: 'v1.events.track',
|
|
1913
|
+
example:
|
|
1914
|
+
'import os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.v1.events.track(\n event="x",\n profile={},\n idempotency_key="x",\n)\nprint(response.enrolled_journeys)',
|
|
1915
|
+
},
|
|
1916
|
+
java: {
|
|
1917
|
+
method: 'v1().events().track',
|
|
1918
|
+
example:
|
|
1919
|
+
'package com.segmentflow.api.example;\n\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.events.EventTrackParams;\nimport com.segmentflow.api.models.v1.events.EventTrackResponse;\n\npublic final class Main {\n private Main() {}\n\n public static void main(String[] args) {\n SegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\n EventTrackParams params = EventTrackParams.builder()\n .idempotencyKey("x")\n .event("x")\n .profile(EventTrackParams.Profile.builder().build())\n .build();\n EventTrackResponse response = client.v1().events().track(params);\n }\n}',
|
|
1920
|
+
},
|
|
1921
|
+
go: {
|
|
1922
|
+
method: 'client.V1.Events.Track',
|
|
1923
|
+
example:
|
|
1924
|
+
'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.V1.Events.Track(context.TODO(), segmentflow.V1EventTrackParams{\n\t\tEvent: "x",\n\t\tProfile: segmentflow.V1EventTrackParamsProfile{},\n\t\tIdempotencyKey: "x",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.EnrolledJourneys)\n}\n',
|
|
1925
|
+
},
|
|
1926
|
+
cli: {
|
|
1927
|
+
method: 'events track',
|
|
1928
|
+
example:
|
|
1929
|
+
"segmentflow v1:events track \\\n --api-key 'My API Key' \\\n --event x \\\n --profile '{}' \\\n --idempotency-key x",
|
|
1930
|
+
},
|
|
1931
|
+
php: {
|
|
1932
|
+
method: 'v1->events->track',
|
|
1933
|
+
example:
|
|
1934
|
+
"<?php\n\nrequire_once dirname(__DIR__) . '/vendor/autoload.php';\n\n$client = new Client(apiKey: 'My API Key', environment: 'development');\n\n$response = $client->v1->events->track(\n event: 'x',\n profile: [\n 'email' => 'dev@stainless.com',\n 'externalID' => 'x',\n 'properties' => ['foo' => 'bar'],\n ],\n idempotencyKey: 'x',\n data: ['foo' => 'bar'],\n occurredAt: new \\DateTimeImmutable('2019-12-27T18:11:19.117Z'),\n redactedDataPaths: ['/event/'],\n referenceID: 'x',\n);\n\nvar_dump($response);",
|
|
1935
|
+
},
|
|
1936
|
+
http: {
|
|
1937
|
+
example:
|
|
1938
|
+
'curl https://api.segmentflow.ai/api/v1/events \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY" \\\n -d \'{\n "event": "x",\n "profile": {}\n }\'',
|
|
1939
|
+
},
|
|
1940
|
+
},
|
|
1941
|
+
},
|
|
1651
1942
|
];
|
|
1652
1943
|
|
|
1653
1944
|
const EMBEDDED_READMES: { language: string; content: string }[] = [
|
|
1654
1945
|
{
|
|
1655
1946
|
language: 'cli',
|
|
1656
1947
|
content:
|
|
1657
|
-
"# Segmentflow AI CLI\n\nThe official CLI for the [Segmentflow AI REST API](https://segmentflow.ai/docs).\n\nIt is generated with [Stainless](https://www.stainless.com/).\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/
|
|
1948
|
+
"# Segmentflow AI CLI\n\nThe official CLI for the [Segmentflow AI REST API](https://segmentflow.ai/docs).\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/segmentflow/segmentflow-cli/cmd/segmentflow@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\nsegmentflow [resource] <command> [flags...]\n~~~\n\n~~~sh\nsegmentflow v1:profiles retrieve \\\n --api-key 'My API Key' \\\n --profile-id REPLACE_ME\n~~~\n\nFor details about specific commands, use the `--help` flag.\n\n### Environment variables\n\n| Environment variable | Description | Required |\n| --------------------- | ------------------------------- | -------- |\n| `SEGMENTFLOW_API_KEY` | API key for the Segmentflow API | yes |\n\n### Global flags\n\n- `--api-key` - API key for the Segmentflow API (can also be set with `SEGMENTFLOW_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\nsegmentflow <command> --arg @abe.jpg\n~~~\n\nFiles can also be passed inside JSON or YAML blobs:\n\n~~~bash\nsegmentflow <command> --arg '{image: \"@abe.jpg\"}'\n# Equivalent:\nsegmentflow <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\nsegmentflow <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\nsegmentflow <command> --arg @data://file.txt\n~~~\n\n## Linking different Go SDK versions\n\nYou can link the CLI against a different version of the Segmentflow AI Go SDK\nfor development purposes using the `./scripts/link` script.\n\nTo link to a specific version from a repository (version can be a branch,\ngit tag, or commit hash):\n\n~~~bash\n./scripts/link github.com/org/repo@version\n~~~\n\nTo link to a local copy of the SDK:\n\n~~~bash\n./scripts/link ../path/to/segmentflow-go\n~~~\n\nIf you run the link script without any arguments, it will default to `../segmentflow-go`.\n",
|
|
1658
1949
|
},
|
|
1659
1950
|
{
|
|
1660
1951
|
language: 'go',
|
|
1661
1952
|
content:
|
|
1662
|
-
'# Segmentflow AI Go API Library\n\n<a href="https://pkg.go.dev/github.com/stainless-sdks/segmentflow-go"><img src="https://pkg.go.dev/badge/github.com/stainless-sdks/segmentflow-go.svg" alt="Go Reference"></a>\n\nThe Segmentflow AI Go library provides convenient access to the [Segmentflow AI REST API](https://segmentflow.ai/docs)\nfrom applications written in Go.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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\n\n```go\nimport (\n\t"github.com/stainless-sdks/segmentflow-go" // imported as SDK_PackageName\n)\n```\n\n\n\nOr to pin the version:\n\n\n\n```sh\ngo get -u \'github.com/stainless-sdks/segmentflow-go@v0.0.1\'\n```\n\n\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/stainless-sdks/segmentflow-go"\n\t"github.com/stainless-sdks/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("SEGMENTFLOW_API_KEY")\n\t\toption.WithEnvironmentDevelopment(), // defaults to option.WithEnvironmentProduction()\n\t)\n\tprofile, err := client.V1.Profiles.Get(context.TODO(), "REPLACE_ME")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", profile.ID)\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.V1.Profiles.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/stainless-sdks/segmentflow-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\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\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.V1.Profiles.List(context.TODO(), segmentflow.V1ProfileListParams{})\nif err != nil {\n\tvar apierr *segmentflow.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 "/api/v1/profiles": 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.V1.Profiles.List(\n\tctx,\n\tsegmentflow.V1ProfileListParams{},\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\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 := segmentflow.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.V1.Profiles.List(\n\tcontext.TODO(),\n\tsegmentflow.V1ProfileListParams{},\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\nprofileList, err := client.V1.Profiles.List(\n\tcontext.TODO(),\n\tsegmentflow.V1ProfileListParams{},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", profileList)\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/stainless-sdks/segmentflow-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
1953
|
+
'# Segmentflow AI Go API Library\n\n<a href="https://pkg.go.dev/github.com/segmentflow/segmentflow-go"><img src="https://pkg.go.dev/badge/github.com/segmentflow/segmentflow-go.svg" alt="Go Reference"></a>\n\nThe Segmentflow AI Go library provides convenient access to the [Segmentflow AI REST API](https://segmentflow.ai/docs)\nfrom applications written in Go.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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/segmentflow/segmentflow-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/segmentflow/segmentflow-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/segmentflow/segmentflow-go"\n\t"github.com/segmentflow/segmentflow-go/option"\n)\n\nfunc main() {\n\tclient := segmentflow.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("SEGMENTFLOW_API_KEY")\n\t\toption.WithEnvironmentDevelopment(), // defaults to option.WithEnvironmentProduction()\n\t)\n\tprofile, err := client.V1.Profiles.Get(context.TODO(), "REPLACE_ME")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", profile.ID)\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.V1.Profiles.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/segmentflow/segmentflow-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\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\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.V1.Profiles.List(context.TODO(), segmentflow.V1ProfileListParams{\n\tLimit: segmentflow.Int(10),\n\tSearch: segmentflow.String("user@example.com"),\n})\nif err != nil {\n\tvar apierr *segmentflow.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 "/api/v1/profiles": 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.V1.Profiles.List(\n\tctx,\n\tsegmentflow.V1ProfileListParams{\n\t\tLimit: segmentflow.Int(10),\n\t\tSearch: segmentflow.String("user@example.com"),\n\t},\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\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 := segmentflow.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.V1.Profiles.List(\n\tcontext.TODO(),\n\tsegmentflow.V1ProfileListParams{\n\t\tLimit: segmentflow.Int(10),\n\t\tSearch: segmentflow.String("user@example.com"),\n\t},\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\nprofileList, err := client.V1.Profiles.List(\n\tcontext.TODO(),\n\tsegmentflow.V1ProfileListParams{\n\t\tLimit: segmentflow.Int(10),\n\t\tSearch: segmentflow.String("user@example.com"),\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", profileList)\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/segmentflow/segmentflow-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
1663
1954
|
},
|
|
1664
1955
|
{
|
|
1665
1956
|
language: 'java',
|
|
1666
1957
|
content:
|
|
1667
|
-
'# Segmentflow AI Java API Library\n\n\n[](https://central.sonatype.com/artifact/com.segmentflow.api/segmentflow-ai-java/0.0.1)\n[](https://javadoc.io/doc/com.segmentflow.api/segmentflow-ai-java/0.0.1)\n\n\nThe Segmentflow AI Java SDK provides convenient access to the [Segmentflow AI REST API](https://segmentflow.ai/docs) from applications written in Java.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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\nThe REST API documentation can be found on [segmentflow.ai](https://segmentflow.ai/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.segmentflow.api/segmentflow-ai-java/0.0.1).\n\n## Installation\n\n### Gradle\n\n~~~kotlin\nimplementation("com.segmentflow.api:segmentflow-ai-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.segmentflow.api</groupId>\n <artifactId>segmentflow-ai-java</artifactId>\n <version>0.0.1</version>\n</dependency>\n~~~\n\n## Requirements\n\nThis library requires Java 8 or later.\n\n## Usage\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.profiles.Profile;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\nProfile profile = client.v1().profiles().retrieve("REPLACE_ME");\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .apiKey("My API Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n // Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n // Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_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` | `segmentflowai.segmentflowApiKey` | `SEGMENTFLOW_API_KEY` | true | - |\n| `baseUrl` | `segmentflowai.baseUrl` | `SEGMENTFLOW_AI_BASE_URL` | true | `"https://api.segmentflow.ai"` |\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.segmentflow.api.client.SegmentflowAiClient;\n\nSegmentflowAiClient 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 Segmentflow AI 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.v1().profiles().retrieve(...)` should be called with an instance of `ProfileRetrieveParams`, and it will return an instance of `Profile`.\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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.profiles.Profile;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\nCompletableFuture<Profile> profile = client.async().v1().profiles().retrieve("REPLACE_ME");\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClientAsync;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClientAsync;\nimport com.segmentflow.api.models.v1.profiles.Profile;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClientAsync client = SegmentflowAiOkHttpClientAsync.fromEnv();\n\nCompletableFuture<Profile> profile = client.v1().profiles().retrieve("REPLACE_ME");\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\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.segmentflow.api.core.http.Headers;\nimport com.segmentflow.api.core.http.HttpResponseFor;\nimport com.segmentflow.api.models.v1.profiles.ProfileList;\nimport com.segmentflow.api.models.v1.profiles.ProfileListParams;\n\nHttpResponseFor<ProfileList> profileList = client.v1().profiles().withRawResponse().list();\n\nint statusCode = profileList.statusCode();\nHeaders headers = profileList.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.ProfileList;\n\nProfileList parsedProfileList = profileList.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`SegmentflowAiServiceException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiServiceException.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`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`SegmentflowAiIoException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiIoException.kt): I/O networking errors.\n\n- [`SegmentflowAiRetryableException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`SegmentflowAiInvalidDataException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiInvalidDataException.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- [`SegmentflowAiException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiException.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\n\n## Logging\n\nEnable logging by setting the `SEGMENTFLOW_AI_LOG` environment variable to `info`:\n\n```sh\nexport SEGMENTFLOW_AI_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport SEGMENTFLOW_AI_LOG=debug\n```\n\nOr configure the client manually using the `logLevel` method:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.core.LogLevel;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .logLevel(LogLevel.INFO)\n .build();\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 `segmentflow-ai-java-core` is published with a [configuration file](segmentflow-ai-java-core/src/main/resources/META-INF/proguard/segmentflow-ai-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 [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) or [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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.segmentflow.api.models.v1.profiles.ProfileList;\n\nProfileList profileList = client.v1().profiles().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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport java.time.Duration;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\nIf the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.core.http.ProxyAuthenticator;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .proxy(...)\n // Or a custom implementation of `ProxyAuthenticator`.\n .proxyAuthenticator(ProxyAuthenticator.basic("username", "password"))\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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport java.time.Duration;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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### Environments\n\nThe SDK sends requests to the production by default. To send requests to a different environment, configure the client like so:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .development()\n .build();\n```\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `segmentflow-ai-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`SegmentflowAiClient`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClient.kt), [`SegmentflowAiClientAsync`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsync.kt), [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt), and [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), all of which can work with any HTTP client\n- `segmentflow-ai-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) and [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.kt), which provide a way to construct [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt) and [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), respectively, using OkHttp\n- `segmentflow-ai-java`\n - Depends on and exposes the APIs of both `segmentflow-ai-java-core` and `segmentflow-ai-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 [`segmentflow-ai-java` dependency](#installation) with `segmentflow-ai-java-core`\n2. Copy `segmentflow-ai-java-client-okhttp`\'s [`OkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt) or [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), similarly to [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) or [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`segmentflow-ai-java` dependency](#installation) with `segmentflow-ai-java-core`\n2. Write a class that implements the [`HttpClient`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/http/HttpClient.kt) interface\n3. Construct [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt) or [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), similarly to [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) or [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.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.segmentflow.api.core.JsonValue;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\nProfileRetrieveParams params = ProfileRetrieveParams.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.segmentflow.api.core.JsonValue;\nimport com.segmentflow.api.models.v1.brandkit.BrandKitCreateParams;\n\nBrandKitCreateParams params = BrandKitCreateParams.builder()\n .brandKit(BrandKitCreateParams.BrandKit.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`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/Values.kt) object to its setter:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\nProfileRetrieveParams params = ProfileRetrieveParams.builder().build();\n```\n\nThe most straightforward way to create a [`JsonValue`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.segmentflow.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`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/Values.kt):\n\n```java\nimport com.segmentflow.api.core.JsonMissing;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\nProfileRetrieveParams params = ProfileRetrieveParams.builder()\n .profileId(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.segmentflow.api.core.JsonValue;\nimport java.util.Map;\n\nMap<String, JsonValue> additionalProperties = client.v1().profiles().retrieve(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.segmentflow.api.core.JsonField;\nimport java.util.Optional;\n\nJsonField<Object> field = client.v1().profiles().retrieve(params)._field();\n\nif (field.isMissing()) {\n // The property is absent from the JSON response\n} else if (field.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 = field.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = field.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 [`SegmentflowAiInvalidDataException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiInvalidDataException.kt) only if you directly access the property.\n\nValidating the response is _not_ forwards compatible with new types from the API for existing fields.\n\nIf you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.Profile;\n\nProfile profile = client.v1().profiles().retrieve(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.Profile;\n\nProfile profile = client.v1().profiles().retrieve(RequestOptions.builder().responseValidation(true).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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/stainless-sdks/segmentflow-java/issues) with questions, bugs, or suggestions.\n',
|
|
1958
|
+
'# Segmentflow AI Java API Library\n\n<!-- x-release-please-start-version -->\n[](https://central.sonatype.com/artifact/com.segmentflow.api/segmentflow-ai-java/0.0.1)\n[](https://javadoc.io/doc/com.segmentflow.api/segmentflow-ai-java/0.0.1)\n<!-- x-release-please-end -->\n\nThe Segmentflow AI Java SDK provides convenient access to the [Segmentflow AI REST API](https://segmentflow.ai/docs) from applications written in Java.\n\n\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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\nThe REST API documentation can be found on [segmentflow.ai](https://segmentflow.ai/docs). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.segmentflow.api/segmentflow-ai-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.segmentflow.api:segmentflow-ai-java:0.0.1")\n~~~\n\n### Maven\n\n~~~xml\n<dependency>\n <groupId>com.segmentflow.api</groupId>\n <artifactId>segmentflow-ai-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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.profiles.Profile;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\nProfile profile = client.v1().profiles().retrieve("REPLACE_ME");\n```\n\n## Client configuration\n\nConfigure the client using system properties or environment variables:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n```\n\nOr manually:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .apiKey("My API Key")\n .build();\n```\n\nOr using a combination of the two approaches:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n // Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n // Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_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` | `segmentflowai.segmentflowApiKey` | `SEGMENTFLOW_API_KEY` | true | - |\n| `baseUrl` | `segmentflowai.baseUrl` | `SEGMENTFLOW_AI_BASE_URL` | true | `"https://api.segmentflow.ai"` |\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.segmentflow.api.client.SegmentflowAiClient;\n\nSegmentflowAiClient 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 Segmentflow AI 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.v1().profiles().retrieve(...)` should be called with an instance of `ProfileRetrieveParams`, and it will return an instance of `Profile`.\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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.models.v1.profiles.Profile;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.fromEnv();\n\nCompletableFuture<Profile> profile = client.async().v1().profiles().retrieve("REPLACE_ME");\n```\n\nOr create an asynchronous client from the beginning:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClientAsync;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClientAsync;\nimport com.segmentflow.api.models.v1.profiles.Profile;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\nimport java.util.concurrent.CompletableFuture;\n\n// Configures using the `segmentflowai.segmentflowApiKey` and `segmentflowai.baseUrl` system properties\n// Or configures using the `SEGMENTFLOW_API_KEY` and `SEGMENTFLOW_AI_BASE_URL` environment variables\nSegmentflowAiClientAsync client = SegmentflowAiOkHttpClientAsync.fromEnv();\n\nCompletableFuture<Profile> profile = client.v1().profiles().retrieve("REPLACE_ME");\n```\n\nThe asynchronous client supports the same options as the synchronous one, except most methods return `CompletableFuture`s.\n\n\n\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.segmentflow.api.core.http.Headers;\nimport com.segmentflow.api.core.http.HttpResponseFor;\nimport com.segmentflow.api.models.v1.profiles.ProfileList;\nimport com.segmentflow.api.models.v1.profiles.ProfileListParams;\n\nProfileListParams params = ProfileListParams.builder()\n .limit(10L)\n .search("user@example.com")\n .build();\nHttpResponseFor<ProfileList> profileList = client.v1().profiles().withRawResponse().list(params);\n\nint statusCode = profileList.statusCode();\nHeaders headers = profileList.headers();\n```\n\nYou can still deserialize the response into an instance of a Java class if needed:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.ProfileList;\n\nProfileList parsedProfileList = profileList.parse();\n```\n\n## Error handling\n\nThe SDK throws custom unchecked exception types:\n\n- [`SegmentflowAiServiceException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiServiceException.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`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/BadRequestException.kt) |\n | 401 | [`UnauthorizedException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/UnauthorizedException.kt) |\n | 403 | [`PermissionDeniedException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/PermissionDeniedException.kt) |\n | 404 | [`NotFoundException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/NotFoundException.kt) |\n | 422 | [`UnprocessableEntityException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/UnprocessableEntityException.kt) |\n | 429 | [`RateLimitException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/RateLimitException.kt) |\n | 5xx | [`InternalServerException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/InternalServerException.kt) |\n | others | [`UnexpectedStatusCodeException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/UnexpectedStatusCodeException.kt) |\n\n- [`SegmentflowAiIoException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiIoException.kt): I/O networking errors.\n\n- [`SegmentflowAiRetryableException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiRetryableException.kt): Generic error indicating a failure that could be retried by the client.\n\n- [`SegmentflowAiInvalidDataException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiInvalidDataException.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- [`SegmentflowAiException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiException.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\n\n## Logging\n\nEnable logging by setting the `SEGMENTFLOW_AI_LOG` environment variable to `info`:\n\n```sh\nexport SEGMENTFLOW_AI_LOG=info\n```\n\nOr to `debug` for more verbose logging:\n\n```sh\nexport SEGMENTFLOW_AI_LOG=debug\n```\n\nOr configure the client manually using the `logLevel` method:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.core.LogLevel;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .logLevel(LogLevel.INFO)\n .build();\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 `segmentflow-ai-java-core` is published with a [configuration file](segmentflow-ai-java-core/src/main/resources/META-INF/proguard/segmentflow-ai-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 [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) or [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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.segmentflow.api.models.v1.profiles.ProfileList;\n\nProfileList profileList = client.v1().profiles().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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport java.time.Duration;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport java.net.InetSocketAddress;\nimport java.net.Proxy;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .proxy(new Proxy(\n Proxy.Type.HTTP, new InetSocketAddress(\n "https://example.com", 8080\n )\n ))\n .build();\n```\n\nIf the proxy responds with `407 Proxy Authentication Required`, supply credentials by also configuring `proxyAuthenticator`:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport com.segmentflow.api.core.http.ProxyAuthenticator;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .proxy(...)\n // Or a custom implementation of `ProxyAuthenticator`.\n .proxyAuthenticator(ProxyAuthenticator.basic("username", "password"))\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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\nimport java.time.Duration;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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### Environments\n\nThe SDK sends requests to the production by default. To send requests to a different environment, configure the client like so:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.builder()\n .fromEnv()\n .development()\n .build();\n```\n\n### Custom HTTP client\n\nThe SDK consists of three artifacts:\n- `segmentflow-ai-java-core`\n - Contains core SDK logic\n - Does not depend on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`SegmentflowAiClient`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClient.kt), [`SegmentflowAiClientAsync`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsync.kt), [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt), and [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), all of which can work with any HTTP client\n- `segmentflow-ai-java-client-okhttp`\n - Depends on [OkHttp](https://square.github.io/okhttp)\n - Exposes [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) and [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.kt), which provide a way to construct [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt) and [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), respectively, using OkHttp\n- `segmentflow-ai-java`\n - Depends on and exposes the APIs of both `segmentflow-ai-java-core` and `segmentflow-ai-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 [`segmentflow-ai-java` dependency](#installation) with `segmentflow-ai-java-core`\n2. Copy `segmentflow-ai-java-client-okhttp`\'s [`OkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/OkHttpClient.kt) class into your code and customize it\n3. Construct [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt) or [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), similarly to [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) or [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.kt), using your customized client\n\n### Completely custom HTTP client\n\nTo use a completely custom HTTP client:\n\n1. Replace your [`segmentflow-ai-java` dependency](#installation) with `segmentflow-ai-java-core`\n2. Write a class that implements the [`HttpClient`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/http/HttpClient.kt) interface\n3. Construct [`SegmentflowAiClientImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientImpl.kt) or [`SegmentflowAiClientAsyncImpl`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/client/SegmentflowAiClientAsyncImpl.kt), similarly to [`SegmentflowAiOkHttpClient`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClient.kt) or [`SegmentflowAiOkHttpClientAsync`](segmentflow-ai-java-client-okhttp/src/main/kotlin/com/segmentflow/api/client/okhttp/SegmentflowAiOkHttpClientAsync.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.segmentflow.api.core.JsonValue;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\nProfileRetrieveParams params = ProfileRetrieveParams.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.segmentflow.api.core.JsonValue;\nimport com.segmentflow.api.models.v1.brandkit.BrandKitCreateParams;\n\nBrandKitCreateParams params = BrandKitCreateParams.builder()\n .brandKit(BrandKitCreateParams.BrandKit.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`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/Values.kt) object to its setter:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\nProfileRetrieveParams params = ProfileRetrieveParams.builder().build();\n```\n\nThe most straightforward way to create a [`JsonValue`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/Values.kt) is using its `from(...)` method:\n\n```java\nimport com.segmentflow.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`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/core/Values.kt):\n\n```java\nimport com.segmentflow.api.core.JsonMissing;\nimport com.segmentflow.api.models.v1.profiles.ProfileRetrieveParams;\n\nProfileRetrieveParams params = ProfileRetrieveParams.builder()\n .profileId(JsonMissing.of())\n .build();\n```\n\n### Response properties\n\nTo access undocumented response properties, call the `_additionalProperties()` method:\n\n```java\nimport com.segmentflow.api.core.JsonValue;\nimport java.util.Map;\n\nMap<String, JsonValue> additionalProperties = client.v1().profiles().retrieve(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.segmentflow.api.core.JsonField;\nimport java.util.Optional;\n\nJsonField<Object> field = client.v1().profiles().retrieve(params)._field();\n\nif (field.isMissing()) {\n // The property is absent from the JSON response\n} else if (field.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 = field.asString();\n\n // Try to deserialize into a custom type\n MyClass myObject = field.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 [`SegmentflowAiInvalidDataException`](segmentflow-ai-java-core/src/main/kotlin/com/segmentflow/api/errors/SegmentflowAiInvalidDataException.kt) only if you directly access the property.\n\nValidating the response is _not_ forwards compatible with new types from the API for existing fields.\n\nIf you would still prefer to check that the response is completely well-typed upfront, then either call `validate()`:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.Profile;\n\nProfile profile = client.v1().profiles().retrieve(params).validate();\n```\n\nOr configure the method call to validate the response using the `responseValidation` method:\n\n```java\nimport com.segmentflow.api.models.v1.profiles.Profile;\n\nProfile profile = client.v1().profiles().retrieve(RequestOptions.builder().responseValidation(true).build());\n```\n\nOr configure the default for all method calls at the client level:\n\n```java\nimport com.segmentflow.api.client.SegmentflowAiClient;\nimport com.segmentflow.api.client.okhttp.SegmentflowAiOkHttpClient;\n\nSegmentflowAiClient client = SegmentflowAiOkHttpClient.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/segmentflow/segmentflow-java/issues) with questions, bugs, or suggestions.\n',
|
|
1668
1959
|
},
|
|
1669
1960
|
{
|
|
1670
1961
|
language: 'php',
|
|
1671
1962
|
content:
|
|
1672
|
-
'# Segmentflow AI PHP API Library\n\nThe Segmentflow AI PHP library provides convenient access to the Segmentflow AI 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```json\n{\n "repositories": [\n {\n "type": "vcs",\n "url": "git@github.com:
|
|
1963
|
+
'# Segmentflow AI PHP API Library\n\nThe Segmentflow AI PHP library provides convenient access to the Segmentflow AI 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:segmentflow/segmentflow-php.git"\n }\n ],\n "require": {\n "segmentflow/segmentflow": "dev-main"\n }\n}\n```\n<!-- x-release-please-end -->\n\n## Usage\n\n```php\n<?php\n\n$client = new Client(\n apiKey: getenv(\'SEGMENTFLOW_API_KEY\') ?: \'My API Key\',\n environment: \'development\',\n);\n\n$profile = $client->v1->profiles->retrieve(\'REPLACE_ME\');\n\nvar_dump($profile->id);\n```',
|
|
1673
1964
|
},
|
|
1674
1965
|
{
|
|
1675
1966
|
language: 'python',
|
|
1676
1967
|
content:
|
|
1677
|
-
'# Segmentflow AI Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/segmentflow/)\n\nThe Segmentflow AI Python library provides convenient access to the Segmentflow AI 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 Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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\nThe REST API documentation can be found on [segmentflow.ai](https://segmentflow.ai/docs). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from this staging repo\npip install git+ssh://git@github.com/stainless-sdks/segmentflow-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 segmentflow`\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n # defaults to "production".\n environment="development",\n)\n\nprofile = client.v1.profiles.retrieve(\n "REPLACE_ME",\n)\nprint(profile.id)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `SEGMENTFLOW_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 `AsyncSegmentflowAI` instead of `SegmentflowAI` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom segmentflow import AsyncSegmentflowAI\n\nclient = AsyncSegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n # defaults to "production".\n environment="development",\n)\n\nasync def main() -> None:\n profile = await client.v1.profiles.retrieve(\n "REPLACE_ME",\n )\n print(profile.id)\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 this staging repo\npip install \'segmentflow[aiohttp] @ git+ssh://git@github.com/stainless-sdks/segmentflow-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 segmentflow import DefaultAioHttpClient\nfrom segmentflow import AsyncSegmentflowAI\n\nasync def main() -> None:\n async with AsyncSegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n profile = await client.v1.profiles.retrieve(\n "REPLACE_ME",\n )\n print(profile.id)\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\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI()\n\nbrand_kit = client.v1.brand_kit.create(\n name="name",\n brand_kit={},\n)\nprint(brand_kit.brand_kit)\n```\n\n\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 `segmentflow.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `segmentflow.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `segmentflow.APIError`.\n\n```python\nimport segmentflow\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI()\n\ntry:\n client.v1.profiles.list()\nexcept segmentflow.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept segmentflow.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept segmentflow.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 segmentflow import SegmentflowAI\n\n# Configure the default for all requests:\nclient = SegmentflowAI(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).v1.profiles.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 segmentflow import SegmentflowAI\n\n# Configure the default for all requests:\nclient = SegmentflowAI(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = SegmentflowAI(\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).v1.profiles.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 `SEGMENTFLOW_AI_LOG` to `info`.\n\n```shell\n$ export SEGMENTFLOW_AI_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 segmentflow import SegmentflowAI\n\nclient = SegmentflowAI()\nresponse = client.v1.profiles.with_raw_response.list()\nprint(response.headers.get(\'X-My-Header\'))\n\nprofile = response.parse() # get the object that `v1.profiles.list()` would have returned\nprint(profile.profile_count)\n```\n\nThese methods return an [`APIResponse`](https://github.com/stainless-sdks/segmentflow-python/tree/main/src/segmentflow/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/stainless-sdks/segmentflow-python/tree/main/src/segmentflow/_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.v1.profiles.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 segmentflow import SegmentflowAI, DefaultHttpxClient\n\nclient = SegmentflowAI(\n # Or use the `SEGMENTFLOW_AI_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 segmentflow import SegmentflowAI\n\nwith SegmentflowAI() 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/stainless-sdks/segmentflow-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 segmentflow\nprint(segmentflow.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
1968
|
+
'# Segmentflow AI Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/segmentflow/)\n\nThe Segmentflow AI Python library provides convenient access to the Segmentflow AI 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 Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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\nThe REST API documentation can be found on [segmentflow.ai](https://segmentflow.ai/docs). 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/segmentflow/segmentflow-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 segmentflow`\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n # defaults to "production".\n environment="development",\n)\n\nprofile = client.v1.profiles.retrieve(\n "REPLACE_ME",\n)\nprint(profile.id)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `SEGMENTFLOW_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 `AsyncSegmentflowAI` instead of `SegmentflowAI` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom segmentflow import AsyncSegmentflowAI\n\nclient = AsyncSegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n # defaults to "production".\n environment="development",\n)\n\nasync def main() -> None:\n profile = await client.v1.profiles.retrieve(\n "REPLACE_ME",\n )\n print(profile.id)\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 \'segmentflow[aiohttp] @ git+ssh://git@github.com/segmentflow/segmentflow-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 segmentflow import DefaultAioHttpClient\nfrom segmentflow import AsyncSegmentflowAI\n\nasync def main() -> None:\n async with AsyncSegmentflowAI(\n api_key=os.environ.get("SEGMENTFLOW_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n profile = await client.v1.profiles.retrieve(\n "REPLACE_ME",\n )\n print(profile.id)\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\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI()\n\nbrand_kit = client.v1.brand_kit.create(\n name="name",\n brand_kit={},\n)\nprint(brand_kit.brand_kit)\n```\n\n\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 `segmentflow.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `segmentflow.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `segmentflow.APIError`.\n\n```python\nimport segmentflow\nfrom segmentflow import SegmentflowAI\n\nclient = SegmentflowAI()\n\ntry:\n client.v1.profiles.list(\n limit=10,\n search="user@example.com",\n )\nexcept segmentflow.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept segmentflow.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept segmentflow.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 segmentflow import SegmentflowAI\n\n# Configure the default for all requests:\nclient = SegmentflowAI(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).v1.profiles.list(\n limit=10,\n search="user@example.com",\n)\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 segmentflow import SegmentflowAI\n\n# Configure the default for all requests:\nclient = SegmentflowAI(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = SegmentflowAI(\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).v1.profiles.list(\n limit=10,\n search="user@example.com",\n)\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 `SEGMENTFLOW_AI_LOG` to `info`.\n\n```shell\n$ export SEGMENTFLOW_AI_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 segmentflow import SegmentflowAI\n\nclient = SegmentflowAI()\nresponse = client.v1.profiles.with_raw_response.list(\n limit=10,\n search="user@example.com",\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nprofile = response.parse() # get the object that `v1.profiles.list()` would have returned\nprint(profile.profile_count)\n```\n\nThese methods return an [`APIResponse`](https://github.com/segmentflow/segmentflow-python/tree/main/src/segmentflow/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/segmentflow/segmentflow-python/tree/main/src/segmentflow/_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.v1.profiles.with_streaming_response.list(\n limit=10,\n search="user@example.com",\n) 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 segmentflow import SegmentflowAI, DefaultHttpxClient\n\nclient = SegmentflowAI(\n # Or use the `SEGMENTFLOW_AI_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 segmentflow import SegmentflowAI\n\nwith SegmentflowAI() 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/segmentflow/segmentflow-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 segmentflow\nprint(segmentflow.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
1678
1969
|
},
|
|
1679
1970
|
{
|
|
1680
1971
|
language: 'typescript',
|
|
1681
1972
|
content:
|
|
1682
|
-
"# Segmentflow AI TypeScript API Library\n\n[)](https://npmjs.org/package/@segmentflow/segmentflow-typescript) \n\nThis library provides convenient access to the Segmentflow AI REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [segmentflow.ai](https://segmentflow.ai/docs). The 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 Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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 @segmentflow/segmentflow-typescript\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n environment: 'development', // defaults to 'production'\n});\n\nconst profile = await client.v1.profiles.retrieve('REPLACE_ME');\n\nconsole.log(profile.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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n environment: 'development', // defaults to 'production'\n});\n\nconst profileList: SegmentflowAI.V1.ProfileList = await client.v1.profiles.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\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 profileList = await client.v1.profiles.list().catch(async (err) => {\n if (err instanceof SegmentflowAI.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 SegmentflowAI({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.v1.profiles.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 SegmentflowAI({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.v1.profiles.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\n\n\n\n## Advanced Usage\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 SegmentflowAI();\n\nconst response = await client.v1.profiles.list().asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: profileList, response: raw } = await client.v1.profiles.list().withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(profileList.profileCount);\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 `SEGMENTFLOW_AI_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new SegmentflowAI({\n logger: logger.child({ name: 'SegmentflowAI' }),\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.v1.profiles.retrieve({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\nimport fetch from 'my-fetch';\n\nconst client = new SegmentflowAI({ 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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new SegmentflowAI({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\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 SegmentflowAI from 'npm:@segmentflow/segmentflow-typescript';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new SegmentflowAI({\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/segmentflow/segmentflow-typescript/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\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\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",
|
|
1973
|
+
"# Segmentflow AI TypeScript API Library\n\n[)](https://npmjs.org/package/@segmentflow/segmentflow-typescript) \n\nThis library provides convenient access to the Segmentflow AI REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [segmentflow.ai](https://segmentflow.ai/docs). The 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 Segmentflow AI 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=%40segmentflow%2Fsegmentflow-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBzZWdtZW50Zmxvdy9zZWdtZW50Zmxvdy1tY3AiXSwiZW52Ijp7IlNFR01FTlRGTE9XX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40segmentflow%2Fsegmentflow-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40segmentflow%2Fsegmentflow-mcp%22%5D%2C%22env%22%3A%7B%22SEGMENTFLOW_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 @segmentflow/segmentflow-typescript\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n environment: 'development', // defaults to 'production'\n});\n\nconst profile = await client.v1.profiles.retrieve('REPLACE_ME');\n\nconsole.log(profile.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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\n apiKey: process.env['SEGMENTFLOW_API_KEY'], // This is the default and can be omitted\n environment: 'development', // defaults to 'production'\n});\n\nconst params: SegmentflowAI.V1.ProfileListParams = { limit: 10, search: 'user@example.com' };\nconst profileList: SegmentflowAI.V1.ProfileList = await client.v1.profiles.list(params);\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\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 profileList = await client.v1.profiles\n .list({ limit: 10, search: 'user@example.com' })\n .catch(async (err) => {\n if (err instanceof SegmentflowAI.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 SegmentflowAI({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.v1.profiles.list({ limit: 10, search: 'user@example.com' }, {\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 SegmentflowAI({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.v1.profiles.list({ limit: 10, search: 'user@example.com' }, {\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\n\n\n\n## Advanced Usage\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 SegmentflowAI();\n\nconst response = await client.v1.profiles\n .list({ limit: 10, search: 'user@example.com' })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: profileList, response: raw } = await client.v1.profiles\n .list({ limit: 10, search: 'user@example.com' })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(profileList.profileCount);\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 `SEGMENTFLOW_AI_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new SegmentflowAI({\n logger: logger.child({ name: 'SegmentflowAI' }),\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.v1.profiles.retrieve({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\nimport fetch from 'my-fetch';\n\nconst client = new SegmentflowAI({ 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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new SegmentflowAI({\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 SegmentflowAI from '@segmentflow/segmentflow-typescript';\n\nconst client = new SegmentflowAI({\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 SegmentflowAI from 'npm:@segmentflow/segmentflow-typescript';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new SegmentflowAI({\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/segmentflow/segmentflow-typescript/issues) with questions, bugs, or suggestions.\n\n## Requirements\n\nTypeScript >= 4.9 is supported.\n\nThe following runtimes are supported:\n\n- Web browsers (Up-to-date Chrome, Firefox, Safari, Edge, and more)\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\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",
|
|
1683
1974
|
},
|
|
1684
1975
|
];
|
|
1685
1976
|
|