@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/local-docs-search.js
CHANGED
|
@@ -53,6 +53,8 @@ const EMBEDDED_METHODS = [
|
|
|
53
53
|
qualified: 'client.v1.profiles.list',
|
|
54
54
|
params: [
|
|
55
55
|
'cursor?: string;',
|
|
56
|
+
"deliverySuppressionReasonFilter?: 'HardBounced' | 'Complained' | 'SoftBounceSuppressed'[];",
|
|
57
|
+
"deliverySuppressionStatus?: 'eligible' | 'suppressed';",
|
|
56
58
|
"direction?: 'before' | 'after';",
|
|
57
59
|
'limit?: number;',
|
|
58
60
|
'profileIds?: string[];',
|
|
@@ -61,8 +63,8 @@ const EMBEDDED_METHODS = [
|
|
|
61
63
|
'segmentFilter?: string[];',
|
|
62
64
|
"sourceFilter?: 'form_submission' | 'csv_import' | 'api_sync' | 'sdk' | 'manual_edit' | 'computed'[];",
|
|
63
65
|
],
|
|
64
|
-
response: '{ profileCount: number; profiles: { id: string; createdAt: string; email: string; phone: string; properties: object; segments: object[]; sources: string[]; updatedAt: string; }[]; nextCursor?: string; previousCursor?: string; }',
|
|
65
|
-
markdown: "## 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```",
|
|
66
|
+
response: '{ 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; }',
|
|
67
|
+
markdown: "## 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```",
|
|
66
68
|
perLanguage: {
|
|
67
69
|
typescript: {
|
|
68
70
|
method: 'client.v1.profiles.list',
|
|
@@ -78,7 +80,7 @@ const EMBEDDED_METHODS = [
|
|
|
78
80
|
},
|
|
79
81
|
go: {
|
|
80
82
|
method: 'client.V1.Profiles.List',
|
|
81
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
83
|
+
example: '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',
|
|
82
84
|
},
|
|
83
85
|
cli: {
|
|
84
86
|
method: 'profiles list',
|
|
@@ -86,7 +88,7 @@ const EMBEDDED_METHODS = [
|
|
|
86
88
|
},
|
|
87
89
|
php: {
|
|
88
90
|
method: 'v1->profiles->list',
|
|
89
|
-
example: "<?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);",
|
|
91
|
+
example: "<?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);",
|
|
90
92
|
},
|
|
91
93
|
http: {
|
|
92
94
|
example: 'curl https://api.segmentflow.ai/api/v1/profiles \\\n -X POST \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
@@ -102,8 +104,8 @@ const EMBEDDED_METHODS = [
|
|
|
102
104
|
stainlessPath: '(resource) v1.profiles > (method) retrieve',
|
|
103
105
|
qualified: 'client.v1.profiles.retrieve',
|
|
104
106
|
params: ['profileId: string;'],
|
|
105
|
-
response:
|
|
106
|
-
markdown: "## 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```",
|
|
107
|
+
response: "{ 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; }",
|
|
108
|
+
markdown: "## 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```",
|
|
107
109
|
perLanguage: {
|
|
108
110
|
typescript: {
|
|
109
111
|
method: 'client.v1.profiles.retrieve',
|
|
@@ -119,7 +121,7 @@ const EMBEDDED_METHODS = [
|
|
|
119
121
|
},
|
|
120
122
|
go: {
|
|
121
123
|
method: 'client.V1.Profiles.Get',
|
|
122
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
124
|
+
example: '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',
|
|
123
125
|
},
|
|
124
126
|
cli: {
|
|
125
127
|
method: 'profiles retrieve',
|
|
@@ -160,7 +162,7 @@ const EMBEDDED_METHODS = [
|
|
|
160
162
|
},
|
|
161
163
|
go: {
|
|
162
164
|
method: 'client.V1.Profiles.Delete',
|
|
163
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
165
|
+
example: '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',
|
|
164
166
|
},
|
|
165
167
|
cli: {
|
|
166
168
|
method: 'profiles delete',
|
|
@@ -201,7 +203,7 @@ const EMBEDDED_METHODS = [
|
|
|
201
203
|
},
|
|
202
204
|
go: {
|
|
203
205
|
method: 'client.V1.Profiles.BulkDelete',
|
|
204
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
206
|
+
example: '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',
|
|
205
207
|
},
|
|
206
208
|
cli: {
|
|
207
209
|
method: 'profiles bulk_delete',
|
|
@@ -242,7 +244,7 @@ const EMBEDDED_METHODS = [
|
|
|
242
244
|
},
|
|
243
245
|
go: {
|
|
244
246
|
method: 'client.V1.Profiles.GetSubscriptions',
|
|
245
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
247
|
+
example: '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',
|
|
246
248
|
},
|
|
247
249
|
cli: {
|
|
248
250
|
method: 'profiles get_subscriptions',
|
|
@@ -282,7 +284,7 @@ const EMBEDDED_METHODS = [
|
|
|
282
284
|
},
|
|
283
285
|
go: {
|
|
284
286
|
method: 'client.V1.Assets.List',
|
|
285
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
287
|
+
example: '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',
|
|
286
288
|
},
|
|
287
289
|
cli: {
|
|
288
290
|
method: 'assets list',
|
|
@@ -331,7 +333,7 @@ const EMBEDDED_METHODS = [
|
|
|
331
333
|
},
|
|
332
334
|
go: {
|
|
333
335
|
method: 'client.V1.Assets.New',
|
|
334
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
336
|
+
example: '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',
|
|
335
337
|
},
|
|
336
338
|
cli: {
|
|
337
339
|
method: 'assets create',
|
|
@@ -377,7 +379,7 @@ const EMBEDDED_METHODS = [
|
|
|
377
379
|
},
|
|
378
380
|
go: {
|
|
379
381
|
method: 'client.V1.Assets.RequestUpload',
|
|
380
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
382
|
+
example: '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',
|
|
381
383
|
},
|
|
382
384
|
cli: {
|
|
383
385
|
method: 'assets request_upload',
|
|
@@ -424,7 +426,7 @@ const EMBEDDED_METHODS = [
|
|
|
424
426
|
},
|
|
425
427
|
go: {
|
|
426
428
|
method: 'client.V1.Assets.GetUploadURL',
|
|
427
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
429
|
+
example: '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',
|
|
428
430
|
},
|
|
429
431
|
cli: {
|
|
430
432
|
method: 'assets get_upload_url',
|
|
@@ -470,7 +472,7 @@ const EMBEDDED_METHODS = [
|
|
|
470
472
|
},
|
|
471
473
|
go: {
|
|
472
474
|
method: 'client.V1.Assets.Finalize',
|
|
473
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
475
|
+
example: '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',
|
|
474
476
|
},
|
|
475
477
|
cli: {
|
|
476
478
|
method: 'assets finalize',
|
|
@@ -517,7 +519,7 @@ const EMBEDDED_METHODS = [
|
|
|
517
519
|
},
|
|
518
520
|
go: {
|
|
519
521
|
method: 'client.V1.Assets.UpdateMetadata',
|
|
520
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
522
|
+
example: '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',
|
|
521
523
|
},
|
|
522
524
|
cli: {
|
|
523
525
|
method: 'assets update_metadata',
|
|
@@ -558,7 +560,7 @@ const EMBEDDED_METHODS = [
|
|
|
558
560
|
},
|
|
559
561
|
go: {
|
|
560
562
|
method: 'client.V1.Assets.Delete',
|
|
561
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
563
|
+
example: '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',
|
|
562
564
|
},
|
|
563
565
|
cli: {
|
|
564
566
|
method: 'assets delete',
|
|
@@ -598,7 +600,7 @@ const EMBEDDED_METHODS = [
|
|
|
598
600
|
},
|
|
599
601
|
go: {
|
|
600
602
|
method: 'client.V1.BrandKit.List',
|
|
601
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
603
|
+
example: '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',
|
|
602
604
|
},
|
|
603
605
|
cli: {
|
|
604
606
|
method: 'brand_kit list',
|
|
@@ -644,7 +646,7 @@ const EMBEDDED_METHODS = [
|
|
|
644
646
|
},
|
|
645
647
|
go: {
|
|
646
648
|
method: 'client.V1.BrandKit.New',
|
|
647
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
649
|
+
example: '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',
|
|
648
650
|
},
|
|
649
651
|
cli: {
|
|
650
652
|
method: 'brand_kit create',
|
|
@@ -668,8 +670,8 @@ const EMBEDDED_METHODS = [
|
|
|
668
670
|
stainlessPath: '(resource) v1.brand_kit > (method) retrieve',
|
|
669
671
|
qualified: 'client.v1.brandKit.retrieve',
|
|
670
672
|
params: ['brandId: string;'],
|
|
671
|
-
response: "{ 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?:
|
|
672
|
-
markdown: "## 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?:
|
|
673
|
+
response: "{ 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; }",
|
|
674
|
+
markdown: "## 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```",
|
|
673
675
|
perLanguage: {
|
|
674
676
|
typescript: {
|
|
675
677
|
method: 'client.v1.brandKit.retrieve',
|
|
@@ -685,7 +687,7 @@ const EMBEDDED_METHODS = [
|
|
|
685
687
|
},
|
|
686
688
|
go: {
|
|
687
689
|
method: 'client.V1.BrandKit.Get',
|
|
688
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
690
|
+
example: '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',
|
|
689
691
|
},
|
|
690
692
|
cli: {
|
|
691
693
|
method: 'brand_kit retrieve',
|
|
@@ -729,7 +731,7 @@ const EMBEDDED_METHODS = [
|
|
|
729
731
|
},
|
|
730
732
|
go: {
|
|
731
733
|
method: 'client.V1.BrandKit.Update',
|
|
732
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
734
|
+
example: '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',
|
|
733
735
|
},
|
|
734
736
|
cli: {
|
|
735
737
|
method: 'brand_kit update',
|
|
@@ -770,7 +772,7 @@ const EMBEDDED_METHODS = [
|
|
|
770
772
|
},
|
|
771
773
|
go: {
|
|
772
774
|
method: 'client.V1.BrandKit.Rename',
|
|
773
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
775
|
+
example: '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',
|
|
774
776
|
},
|
|
775
777
|
cli: {
|
|
776
778
|
method: 'brand_kit rename',
|
|
@@ -811,7 +813,7 @@ const EMBEDDED_METHODS = [
|
|
|
811
813
|
},
|
|
812
814
|
go: {
|
|
813
815
|
method: 'client.V1.BrandKit.Delete',
|
|
814
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
816
|
+
example: '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',
|
|
815
817
|
},
|
|
816
818
|
cli: {
|
|
817
819
|
method: 'brand_kit delete',
|
|
@@ -852,7 +854,7 @@ const EMBEDDED_METHODS = [
|
|
|
852
854
|
},
|
|
853
855
|
go: {
|
|
854
856
|
method: 'client.V1.BrandKit.Extract',
|
|
855
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
857
|
+
example: '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',
|
|
856
858
|
},
|
|
857
859
|
cli: {
|
|
858
860
|
method: 'brand_kit extract',
|
|
@@ -893,7 +895,7 @@ const EMBEDDED_METHODS = [
|
|
|
893
895
|
},
|
|
894
896
|
go: {
|
|
895
897
|
method: 'client.V1.BrandKit.ExtractInto',
|
|
896
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
898
|
+
example: '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',
|
|
897
899
|
},
|
|
898
900
|
cli: {
|
|
899
901
|
method: 'brand_kit extract_into',
|
|
@@ -934,7 +936,7 @@ const EMBEDDED_METHODS = [
|
|
|
934
936
|
},
|
|
935
937
|
go: {
|
|
936
938
|
method: 'client.V1.BrandKit.Clear',
|
|
937
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
939
|
+
example: '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',
|
|
938
940
|
},
|
|
939
941
|
cli: {
|
|
940
942
|
method: 'brand_kit clear',
|
|
@@ -975,7 +977,7 @@ const EMBEDDED_METHODS = [
|
|
|
975
977
|
},
|
|
976
978
|
go: {
|
|
977
979
|
method: 'client.V1.BrandKit.SetDefault',
|
|
978
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
980
|
+
example: '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',
|
|
979
981
|
},
|
|
980
982
|
cli: {
|
|
981
983
|
method: 'brand_kit set_default',
|
|
@@ -1016,7 +1018,7 @@ const EMBEDDED_METHODS = [
|
|
|
1016
1018
|
},
|
|
1017
1019
|
go: {
|
|
1018
1020
|
method: 'client.V1.BrandKit.GetExtractionProgress',
|
|
1019
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1021
|
+
example: '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',
|
|
1020
1022
|
},
|
|
1021
1023
|
cli: {
|
|
1022
1024
|
method: 'brand_kit get_extraction_progress',
|
|
@@ -1041,10 +1043,10 @@ const EMBEDDED_METHODS = [
|
|
|
1041
1043
|
qualified: 'client.v1.templates.list',
|
|
1042
1044
|
params: [
|
|
1043
1045
|
"purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery';",
|
|
1044
|
-
"status?: 'Active' | 'Archived'
|
|
1046
|
+
"status?: 'Active' | 'Archived'[];",
|
|
1045
1047
|
],
|
|
1046
1048
|
response: "{ 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; }[]",
|
|
1047
|
-
markdown: "## list\n\n`client.v1.templates.list(purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery', status?: 'Active' | 'Archived'
|
|
1049
|
+
markdown: "## 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```",
|
|
1048
1050
|
perLanguage: {
|
|
1049
1051
|
typescript: {
|
|
1050
1052
|
method: 'client.v1.templates.list',
|
|
@@ -1060,7 +1062,7 @@ const EMBEDDED_METHODS = [
|
|
|
1060
1062
|
},
|
|
1061
1063
|
go: {
|
|
1062
1064
|
method: 'client.V1.Templates.List',
|
|
1063
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1065
|
+
example: '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',
|
|
1064
1066
|
},
|
|
1065
1067
|
cli: {
|
|
1066
1068
|
method: 'templates list',
|
|
@@ -1068,7 +1070,7 @@ const EMBEDDED_METHODS = [
|
|
|
1068
1070
|
},
|
|
1069
1071
|
php: {
|
|
1070
1072
|
method: 'v1->templates->list',
|
|
1071
|
-
example: "<?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);",
|
|
1073
|
+
example: "<?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);",
|
|
1072
1074
|
},
|
|
1073
1075
|
http: {
|
|
1074
1076
|
example: 'curl https://api.segmentflow.ai/api/v1/templates \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
@@ -1089,14 +1091,14 @@ const EMBEDDED_METHODS = [
|
|
|
1089
1091
|
'id?: string;',
|
|
1090
1092
|
'brandKitId?: string;',
|
|
1091
1093
|
'defaultSegmentId?: string;',
|
|
1092
|
-
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; };",
|
|
1094
|
+
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; };",
|
|
1093
1095
|
'language?: string;',
|
|
1094
1096
|
"purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery';",
|
|
1095
1097
|
'senderProfileId?: string;',
|
|
1096
1098
|
'subType?: string;',
|
|
1097
1099
|
],
|
|
1098
|
-
response: "{ 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; }; }",
|
|
1099
|
-
markdown: "## 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```",
|
|
1100
|
+
response: "{ 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[]; }; }",
|
|
1101
|
+
markdown: "## 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```",
|
|
1100
1102
|
perLanguage: {
|
|
1101
1103
|
typescript: {
|
|
1102
1104
|
method: 'client.v1.templates.create',
|
|
@@ -1112,7 +1114,7 @@ const EMBEDDED_METHODS = [
|
|
|
1112
1114
|
},
|
|
1113
1115
|
go: {
|
|
1114
1116
|
method: 'client.V1.Templates.New',
|
|
1115
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1117
|
+
example: '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',
|
|
1116
1118
|
},
|
|
1117
1119
|
cli: {
|
|
1118
1120
|
method: 'templates create',
|
|
@@ -1120,7 +1122,7 @@ const EMBEDDED_METHODS = [
|
|
|
1120
1122
|
},
|
|
1121
1123
|
php: {
|
|
1122
1124
|
method: 'v1->templates->create',
|
|
1123
|
-
example: "<?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);",
|
|
1125
|
+
example: "<?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);",
|
|
1124
1126
|
},
|
|
1125
1127
|
http: {
|
|
1126
1128
|
example: 'curl https://api.segmentflow.ai/api/v1/templates \\\n -H \'Content-Type: application/json\' \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY" \\\n -d \'{\n "name": "name",\n "type": "type"\n }\'',
|
|
@@ -1136,8 +1138,8 @@ const EMBEDDED_METHODS = [
|
|
|
1136
1138
|
stainlessPath: '(resource) v1.templates > (method) retrieve',
|
|
1137
1139
|
qualified: 'client.v1.templates.retrieve',
|
|
1138
1140
|
params: ['id: string;'],
|
|
1139
|
-
response: "{ 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; }; }",
|
|
1140
|
-
markdown: "## 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```",
|
|
1141
|
+
response: "{ 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[]; }; }",
|
|
1142
|
+
markdown: "## 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```",
|
|
1141
1143
|
perLanguage: {
|
|
1142
1144
|
typescript: {
|
|
1143
1145
|
method: 'client.v1.templates.retrieve',
|
|
@@ -1153,7 +1155,7 @@ const EMBEDDED_METHODS = [
|
|
|
1153
1155
|
},
|
|
1154
1156
|
go: {
|
|
1155
1157
|
method: 'client.V1.Templates.Get',
|
|
1156
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1158
|
+
example: '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',
|
|
1157
1159
|
},
|
|
1158
1160
|
cli: {
|
|
1159
1161
|
method: 'templates retrieve',
|
|
@@ -1180,15 +1182,15 @@ const EMBEDDED_METHODS = [
|
|
|
1180
1182
|
'id: string;',
|
|
1181
1183
|
'brandKitId?: string;',
|
|
1182
1184
|
'defaultSegmentId?: string;',
|
|
1183
|
-
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; subject?: string; };",
|
|
1185
|
+
"definition?: { body: { elements: object; root: string; }; codeFormat: 'json'; emailContentsType: 'Code'; type: 'Email'; from?: string; preheader?: string; renderVariables?: object; replyTo?: string; sensitiveTransactionalVariablePaths?: string[]; subject?: string; };",
|
|
1184
1186
|
'language?: string;',
|
|
1185
1187
|
'name?: string;',
|
|
1186
1188
|
"purpose?: 'General' | 'Newsletter' | 'Promotional' | 'Transactional' | 'LeadMagnetDelivery';",
|
|
1187
1189
|
'senderProfileId?: string;',
|
|
1188
1190
|
'subType?: string;',
|
|
1189
1191
|
],
|
|
1190
|
-
response: "{ 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; }; }",
|
|
1191
|
-
markdown: "## 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```",
|
|
1192
|
+
response: "{ 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[]; }; }",
|
|
1193
|
+
markdown: "## 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```",
|
|
1192
1194
|
perLanguage: {
|
|
1193
1195
|
typescript: {
|
|
1194
1196
|
method: 'client.v1.templates.update',
|
|
@@ -1204,7 +1206,7 @@ const EMBEDDED_METHODS = [
|
|
|
1204
1206
|
},
|
|
1205
1207
|
go: {
|
|
1206
1208
|
method: 'client.V1.Templates.Update',
|
|
1207
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1209
|
+
example: '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',
|
|
1208
1210
|
},
|
|
1209
1211
|
cli: {
|
|
1210
1212
|
method: 'templates update',
|
|
@@ -1212,7 +1214,7 @@ const EMBEDDED_METHODS = [
|
|
|
1212
1214
|
},
|
|
1213
1215
|
php: {
|
|
1214
1216
|
method: 'v1->templates->update',
|
|
1215
|
-
example: "<?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);",
|
|
1217
|
+
example: "<?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);",
|
|
1216
1218
|
},
|
|
1217
1219
|
http: {
|
|
1218
1220
|
example: 'curl https://api.segmentflow.ai/api/v1/templates/$ID \\\n -X PUT \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
@@ -1245,7 +1247,7 @@ const EMBEDDED_METHODS = [
|
|
|
1245
1247
|
},
|
|
1246
1248
|
go: {
|
|
1247
1249
|
method: 'client.V1.Templates.Delete',
|
|
1248
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1250
|
+
example: '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',
|
|
1249
1251
|
},
|
|
1250
1252
|
cli: {
|
|
1251
1253
|
method: 'templates delete',
|
|
@@ -1269,8 +1271,8 @@ const EMBEDDED_METHODS = [
|
|
|
1269
1271
|
stainlessPath: '(resource) v1.templates > (method) duplicate',
|
|
1270
1272
|
qualified: 'client.v1.templates.duplicate',
|
|
1271
1273
|
params: ['id: string;'],
|
|
1272
|
-
response: "{ 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; }; }",
|
|
1273
|
-
markdown: "## 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```",
|
|
1274
|
+
response: "{ 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[]; }; }",
|
|
1275
|
+
markdown: "## 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```",
|
|
1274
1276
|
perLanguage: {
|
|
1275
1277
|
typescript: {
|
|
1276
1278
|
method: 'client.v1.templates.duplicate',
|
|
@@ -1286,7 +1288,7 @@ const EMBEDDED_METHODS = [
|
|
|
1286
1288
|
},
|
|
1287
1289
|
go: {
|
|
1288
1290
|
method: 'client.V1.Templates.Duplicate',
|
|
1289
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1291
|
+
example: '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',
|
|
1290
1292
|
},
|
|
1291
1293
|
cli: {
|
|
1292
1294
|
method: 'templates duplicate',
|
|
@@ -1327,7 +1329,7 @@ const EMBEDDED_METHODS = [
|
|
|
1327
1329
|
},
|
|
1328
1330
|
go: {
|
|
1329
1331
|
method: 'client.V1.Templates.Archive',
|
|
1330
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1332
|
+
example: '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',
|
|
1331
1333
|
},
|
|
1332
1334
|
cli: {
|
|
1333
1335
|
method: 'templates archive',
|
|
@@ -1368,7 +1370,7 @@ const EMBEDDED_METHODS = [
|
|
|
1368
1370
|
},
|
|
1369
1371
|
go: {
|
|
1370
1372
|
method: 'client.V1.Templates.Unarchive',
|
|
1371
|
-
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/
|
|
1373
|
+
example: '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',
|
|
1372
1374
|
},
|
|
1373
1375
|
cli: {
|
|
1374
1376
|
method: 'templates unarchive',
|
|
@@ -1383,31 +1385,274 @@ const EMBEDDED_METHODS = [
|
|
|
1383
1385
|
},
|
|
1384
1386
|
},
|
|
1385
1387
|
},
|
|
1388
|
+
{
|
|
1389
|
+
name: 'create',
|
|
1390
|
+
endpoint: '/api/v1/broadcasts',
|
|
1391
|
+
httpMethod: 'post',
|
|
1392
|
+
summary: 'Create broadcast',
|
|
1393
|
+
description: '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.',
|
|
1394
|
+
stainlessPath: '(resource) v1.broadcasts > (method) create',
|
|
1395
|
+
qualified: 'client.v1.broadcasts.create',
|
|
1396
|
+
params: [
|
|
1397
|
+
'from?: string;',
|
|
1398
|
+
'html?: string;',
|
|
1399
|
+
'name?: string;',
|
|
1400
|
+
'replyTo?: string | string[];',
|
|
1401
|
+
'scheduledAt?: string;',
|
|
1402
|
+
'segmentId?: string;',
|
|
1403
|
+
'send?: boolean;',
|
|
1404
|
+
'subject?: string;',
|
|
1405
|
+
'subscriptionGroupId?: string;',
|
|
1406
|
+
'templateId?: string;',
|
|
1407
|
+
'text?: string;',
|
|
1408
|
+
'topicId?: string;',
|
|
1409
|
+
],
|
|
1410
|
+
response: '{ id: string; }',
|
|
1411
|
+
markdown: '## 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```',
|
|
1412
|
+
perLanguage: {
|
|
1413
|
+
typescript: {
|
|
1414
|
+
method: 'client.v1.broadcasts.create',
|
|
1415
|
+
example: "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);",
|
|
1416
|
+
},
|
|
1417
|
+
python: {
|
|
1418
|
+
method: 'v1.broadcasts.create',
|
|
1419
|
+
example: '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)',
|
|
1420
|
+
},
|
|
1421
|
+
java: {
|
|
1422
|
+
method: 'v1().broadcasts().create',
|
|
1423
|
+
example: '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}',
|
|
1424
|
+
},
|
|
1425
|
+
go: {
|
|
1426
|
+
method: 'client.V1.Broadcasts.New',
|
|
1427
|
+
example: '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',
|
|
1428
|
+
},
|
|
1429
|
+
cli: {
|
|
1430
|
+
method: 'broadcasts create',
|
|
1431
|
+
example: "segmentflow v1:broadcasts create \\\n --api-key 'My API Key'",
|
|
1432
|
+
},
|
|
1433
|
+
php: {
|
|
1434
|
+
method: 'v1->broadcasts->create',
|
|
1435
|
+
example: "<?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);",
|
|
1436
|
+
},
|
|
1437
|
+
http: {
|
|
1438
|
+
example: 'curl https://api.segmentflow.ai/api/v1/broadcasts \\\n -X POST \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
1439
|
+
},
|
|
1440
|
+
},
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
name: 'send',
|
|
1444
|
+
endpoint: '/api/v1/emails',
|
|
1445
|
+
httpMethod: 'post',
|
|
1446
|
+
summary: 'Send email',
|
|
1447
|
+
description: 'Create one EmailSend from a saved email template and enqueue delivery.',
|
|
1448
|
+
stainlessPath: '(resource) v1.emails > (method) send',
|
|
1449
|
+
qualified: 'client.v1.emails.send',
|
|
1450
|
+
params: [
|
|
1451
|
+
'templateId: string;',
|
|
1452
|
+
'idempotency-key: string;',
|
|
1453
|
+
'bcc?: string | string[];',
|
|
1454
|
+
'cc?: string | string[];',
|
|
1455
|
+
'data?: object;',
|
|
1456
|
+
'from?: string;',
|
|
1457
|
+
'profileId?: string;',
|
|
1458
|
+
'replyTo?: string;',
|
|
1459
|
+
'senderProfileId?: string;',
|
|
1460
|
+
'subject?: string;',
|
|
1461
|
+
'subscriptionGroupId?: string;',
|
|
1462
|
+
'to?: { email?: string; externalId?: string; };',
|
|
1463
|
+
'tracking?: { clicks?: boolean; };',
|
|
1464
|
+
],
|
|
1465
|
+
response: "{ 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; }",
|
|
1466
|
+
markdown: "## 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```",
|
|
1467
|
+
perLanguage: {
|
|
1468
|
+
typescript: {
|
|
1469
|
+
method: 'client.v1.emails.send',
|
|
1470
|
+
example: "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);",
|
|
1471
|
+
},
|
|
1472
|
+
python: {
|
|
1473
|
+
method: 'v1.emails.send',
|
|
1474
|
+
example: '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)',
|
|
1475
|
+
},
|
|
1476
|
+
java: {
|
|
1477
|
+
method: 'v1().emails().send',
|
|
1478
|
+
example: '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}',
|
|
1479
|
+
},
|
|
1480
|
+
go: {
|
|
1481
|
+
method: 'client.V1.Emails.Send',
|
|
1482
|
+
example: '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',
|
|
1483
|
+
},
|
|
1484
|
+
cli: {
|
|
1485
|
+
method: 'emails send',
|
|
1486
|
+
example: "segmentflow v1:emails send \\\n --api-key 'My API Key' \\\n --template-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \\\n --idempotency-key x",
|
|
1487
|
+
},
|
|
1488
|
+
php: {
|
|
1489
|
+
method: 'v1->emails->send',
|
|
1490
|
+
example: "<?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);",
|
|
1491
|
+
},
|
|
1492
|
+
http: {
|
|
1493
|
+
example: '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 }\'',
|
|
1494
|
+
},
|
|
1495
|
+
},
|
|
1496
|
+
},
|
|
1497
|
+
{
|
|
1498
|
+
name: 'batch_send',
|
|
1499
|
+
endpoint: '/api/v1/emails/batch',
|
|
1500
|
+
httpMethod: 'post',
|
|
1501
|
+
summary: 'Batch send emails',
|
|
1502
|
+
description: '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.',
|
|
1503
|
+
stainlessPath: '(resource) v1.emails > (method) batch_send',
|
|
1504
|
+
qualified: 'client.v1.emails.batchSend',
|
|
1505
|
+
params: [
|
|
1506
|
+
'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; }; }[];',
|
|
1507
|
+
'defaults?: { from?: string; replyTo?: string; senderProfileId?: string; subject?: string; subscriptionGroupId?: string; templateId?: string; tracking?: { clicks?: boolean; }; };',
|
|
1508
|
+
],
|
|
1509
|
+
response: "{ 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; }",
|
|
1510
|
+
markdown: "## 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```",
|
|
1511
|
+
perLanguage: {
|
|
1512
|
+
typescript: {
|
|
1513
|
+
method: 'client.v1.emails.batchSend',
|
|
1514
|
+
example: "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);",
|
|
1515
|
+
},
|
|
1516
|
+
python: {
|
|
1517
|
+
method: 'v1.emails.batch_send',
|
|
1518
|
+
example: '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)',
|
|
1519
|
+
},
|
|
1520
|
+
java: {
|
|
1521
|
+
method: 'v1().emails().batchSend',
|
|
1522
|
+
example: '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}',
|
|
1523
|
+
},
|
|
1524
|
+
go: {
|
|
1525
|
+
method: 'client.V1.Emails.BatchSend',
|
|
1526
|
+
example: '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',
|
|
1527
|
+
},
|
|
1528
|
+
cli: {
|
|
1529
|
+
method: 'emails batch_send',
|
|
1530
|
+
example: "segmentflow v1:emails batch-send \\\n --api-key 'My API Key' \\\n --item '{idempotencyKey: x}'",
|
|
1531
|
+
},
|
|
1532
|
+
php: {
|
|
1533
|
+
method: 'v1->emails->batchSend',
|
|
1534
|
+
example: "<?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);",
|
|
1535
|
+
},
|
|
1536
|
+
http: {
|
|
1537
|
+
example: '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 }\'',
|
|
1538
|
+
},
|
|
1539
|
+
},
|
|
1540
|
+
},
|
|
1541
|
+
{
|
|
1542
|
+
name: 'retrieve',
|
|
1543
|
+
endpoint: '/api/v1/emails/{id}',
|
|
1544
|
+
httpMethod: 'get',
|
|
1545
|
+
summary: 'Retrieve email send',
|
|
1546
|
+
description: 'Get the current status handle for an EmailSend.',
|
|
1547
|
+
stainlessPath: '(resource) v1.emails > (method) retrieve',
|
|
1548
|
+
qualified: 'client.v1.emails.retrieve',
|
|
1549
|
+
params: ['id: string;'],
|
|
1550
|
+
response: "{ 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; }",
|
|
1551
|
+
markdown: "## 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```",
|
|
1552
|
+
perLanguage: {
|
|
1553
|
+
typescript: {
|
|
1554
|
+
method: 'client.v1.emails.retrieve',
|
|
1555
|
+
example: "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);",
|
|
1556
|
+
},
|
|
1557
|
+
python: {
|
|
1558
|
+
method: 'v1.emails.retrieve',
|
|
1559
|
+
example: '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)',
|
|
1560
|
+
},
|
|
1561
|
+
java: {
|
|
1562
|
+
method: 'v1().emails().retrieve',
|
|
1563
|
+
example: '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}',
|
|
1564
|
+
},
|
|
1565
|
+
go: {
|
|
1566
|
+
method: 'client.V1.Emails.Get',
|
|
1567
|
+
example: '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',
|
|
1568
|
+
},
|
|
1569
|
+
cli: {
|
|
1570
|
+
method: 'emails retrieve',
|
|
1571
|
+
example: "segmentflow v1:emails retrieve \\\n --api-key 'My API Key' \\\n --id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
|
|
1572
|
+
},
|
|
1573
|
+
php: {
|
|
1574
|
+
method: 'v1->emails->retrieve',
|
|
1575
|
+
example: "<?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);",
|
|
1576
|
+
},
|
|
1577
|
+
http: {
|
|
1578
|
+
example: 'curl https://api.segmentflow.ai/api/v1/emails/$ID \\\n -H "x-api-key: $SEGMENTFLOW_API_KEY"',
|
|
1579
|
+
},
|
|
1580
|
+
},
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
name: 'track',
|
|
1584
|
+
endpoint: '/api/v1/events',
|
|
1585
|
+
httpMethod: 'post',
|
|
1586
|
+
summary: 'Track event',
|
|
1587
|
+
description: 'Accept one server-side identified business event, persist a UserEvent, and trigger matching active Journeys.',
|
|
1588
|
+
stainlessPath: '(resource) v1.events > (method) track',
|
|
1589
|
+
qualified: 'client.v1.events.track',
|
|
1590
|
+
params: [
|
|
1591
|
+
'event: string;',
|
|
1592
|
+
'profile: { email?: string; externalId?: string; properties?: object; };',
|
|
1593
|
+
'idempotency-key: string;',
|
|
1594
|
+
'data?: object;',
|
|
1595
|
+
'occurredAt?: string;',
|
|
1596
|
+
'redactedDataPaths?: string[];',
|
|
1597
|
+
'referenceId?: string;',
|
|
1598
|
+
],
|
|
1599
|
+
response: '{ enrolledJourneys: number; eventId: string; matchedJourneys: number; profileId: string; skippedJourneys: number; }',
|
|
1600
|
+
markdown: "## 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```",
|
|
1601
|
+
perLanguage: {
|
|
1602
|
+
typescript: {
|
|
1603
|
+
method: 'client.v1.events.track',
|
|
1604
|
+
example: "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);",
|
|
1605
|
+
},
|
|
1606
|
+
python: {
|
|
1607
|
+
method: 'v1.events.track',
|
|
1608
|
+
example: '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)',
|
|
1609
|
+
},
|
|
1610
|
+
java: {
|
|
1611
|
+
method: 'v1().events().track',
|
|
1612
|
+
example: '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}',
|
|
1613
|
+
},
|
|
1614
|
+
go: {
|
|
1615
|
+
method: 'client.V1.Events.Track',
|
|
1616
|
+
example: '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',
|
|
1617
|
+
},
|
|
1618
|
+
cli: {
|
|
1619
|
+
method: 'events track',
|
|
1620
|
+
example: "segmentflow v1:events track \\\n --api-key 'My API Key' \\\n --event x \\\n --profile '{}' \\\n --idempotency-key x",
|
|
1621
|
+
},
|
|
1622
|
+
php: {
|
|
1623
|
+
method: 'v1->events->track',
|
|
1624
|
+
example: "<?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);",
|
|
1625
|
+
},
|
|
1626
|
+
http: {
|
|
1627
|
+
example: '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 }\'',
|
|
1628
|
+
},
|
|
1629
|
+
},
|
|
1630
|
+
},
|
|
1386
1631
|
];
|
|
1387
1632
|
const EMBEDDED_READMES = [
|
|
1388
1633
|
{
|
|
1389
1634
|
language: 'cli',
|
|
1390
|
-
content: "# 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/
|
|
1635
|
+
content: "# 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",
|
|
1391
1636
|
},
|
|
1392
1637
|
{
|
|
1393
1638
|
language: 'go',
|
|
1394
|
-
content: '# 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',
|
|
1639
|
+
content: '# 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',
|
|
1395
1640
|
},
|
|
1396
1641
|
{
|
|
1397
1642
|
language: 'java',
|
|
1398
|
-
content: '# 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',
|
|
1643
|
+
content: '# 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',
|
|
1399
1644
|
},
|
|
1400
1645
|
{
|
|
1401
1646
|
language: 'php',
|
|
1402
|
-
content: '# 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:
|
|
1647
|
+
content: '# 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```',
|
|
1403
1648
|
},
|
|
1404
1649
|
{
|
|
1405
1650
|
language: 'python',
|
|
1406
|
-
content: '# 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',
|
|
1651
|
+
content: '# 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',
|
|
1407
1652
|
},
|
|
1408
1653
|
{
|
|
1409
1654
|
language: 'typescript',
|
|
1410
|
-
content: "# 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",
|
|
1655
|
+
content: "# 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",
|
|
1411
1656
|
},
|
|
1412
1657
|
];
|
|
1413
1658
|
const INDEX_OPTIONS = {
|