@linqapp/sdk-mcp 0.19.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/LICENSE +201 -0
- package/README.md +101 -0
- package/auth.d.mts +6 -0
- package/auth.d.mts.map +1 -0
- package/auth.d.ts +6 -0
- package/auth.d.ts.map +1 -0
- package/auth.js +37 -0
- package/auth.js.map +1 -0
- package/auth.mjs +32 -0
- package/auth.mjs.map +1 -0
- package/code-tool-paths.cjs +8 -0
- package/code-tool-paths.cjs.map +1 -0
- package/code-tool-paths.d.cts +2 -0
- package/code-tool-paths.d.cts.map +1 -0
- package/code-tool-types.d.mts +14 -0
- package/code-tool-types.d.mts.map +1 -0
- package/code-tool-types.d.ts +14 -0
- package/code-tool-types.d.ts.map +1 -0
- package/code-tool-types.js +4 -0
- package/code-tool-types.js.map +1 -0
- package/code-tool-types.mjs +3 -0
- package/code-tool-types.mjs.map +1 -0
- package/code-tool-worker.d.mts +5 -0
- package/code-tool-worker.d.mts.map +1 -0
- package/code-tool-worker.d.ts +5 -0
- package/code-tool-worker.d.ts.map +1 -0
- package/code-tool-worker.js +301 -0
- package/code-tool-worker.js.map +1 -0
- package/code-tool-worker.mjs +263 -0
- package/code-tool-worker.mjs.map +1 -0
- package/code-tool.d.mts +21 -0
- package/code-tool.d.mts.map +1 -0
- package/code-tool.d.ts +21 -0
- package/code-tool.d.ts.map +1 -0
- package/code-tool.js +341 -0
- package/code-tool.js.map +1 -0
- package/code-tool.mjs +305 -0
- package/code-tool.mjs.map +1 -0
- package/docs-search-tool.d.mts +59 -0
- package/docs-search-tool.d.mts.map +1 -0
- package/docs-search-tool.d.ts +59 -0
- package/docs-search-tool.d.ts.map +1 -0
- package/docs-search-tool.js +104 -0
- package/docs-search-tool.js.map +1 -0
- package/docs-search-tool.mjs +99 -0
- package/docs-search-tool.mjs.map +1 -0
- package/http.d.mts +12 -0
- package/http.d.mts.map +1 -0
- package/http.d.ts +12 -0
- package/http.d.ts.map +1 -0
- package/http.js +190 -0
- package/http.js.map +1 -0
- package/http.mjs +182 -0
- package/http.mjs.map +1 -0
- package/index.d.mts +3 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +3 -0
- package/index.d.ts.map +1 -0
- package/index.js +60 -0
- package/index.js.map +1 -0
- package/index.mjs +58 -0
- package/index.mjs.map +1 -0
- package/instructions.d.mts +5 -0
- package/instructions.d.mts.map +1 -0
- package/instructions.d.ts +5 -0
- package/instructions.d.ts.map +1 -0
- package/instructions.js +61 -0
- package/instructions.js.map +1 -0
- package/instructions.mjs +55 -0
- package/instructions.mjs.map +1 -0
- package/local-docs-search.d.mts +28 -0
- package/local-docs-search.d.mts.map +1 -0
- package/local-docs-search.d.ts +28 -0
- package/local-docs-search.d.ts.map +1 -0
- package/local-docs-search.js +1339 -0
- package/local-docs-search.js.map +1 -0
- package/local-docs-search.mjs +1299 -0
- package/local-docs-search.mjs.map +1 -0
- package/logger.d.mts +7 -0
- package/logger.d.mts.map +1 -0
- package/logger.d.ts +7 -0
- package/logger.d.ts.map +1 -0
- package/logger.js +29 -0
- package/logger.js.map +1 -0
- package/logger.mjs +22 -0
- package/logger.mjs.map +1 -0
- package/methods.d.mts +10 -0
- package/methods.d.mts.map +1 -0
- package/methods.d.ts +10 -0
- package/methods.d.ts.map +1 -0
- package/methods.js +270 -0
- package/methods.js.map +1 -0
- package/methods.mjs +266 -0
- package/methods.mjs.map +1 -0
- package/options.d.mts +23 -0
- package/options.d.mts.map +1 -0
- package/options.d.ts +23 -0
- package/options.d.ts.map +1 -0
- package/options.js +141 -0
- package/options.js.map +1 -0
- package/options.mjs +134 -0
- package/options.mjs.map +1 -0
- package/package.json +236 -0
- package/server.d.mts +38 -0
- package/server.d.mts.map +1 -0
- package/server.d.ts +38 -0
- package/server.d.ts.map +1 -0
- package/server.js +168 -0
- package/server.js.map +1 -0
- package/server.mjs +158 -0
- package/server.mjs.map +1 -0
- package/src/auth.ts +42 -0
- package/src/code-tool-paths.cts +5 -0
- package/src/code-tool-types.ts +17 -0
- package/src/code-tool-worker.ts +314 -0
- package/src/code-tool.ts +398 -0
- package/src/docs-search-tool.ts +138 -0
- package/src/http.ts +227 -0
- package/src/index.ts +67 -0
- package/src/instructions.ts +83 -0
- package/src/local-docs-search.ts +1583 -0
- package/src/logger.ts +28 -0
- package/src/methods.ts +291 -0
- package/src/options.ts +185 -0
- package/src/server.ts +208 -0
- package/src/stdio.ts +17 -0
- package/src/tsconfig.json +11 -0
- package/src/types.ts +126 -0
- package/src/util.ts +25 -0
- package/stdio.d.mts +3 -0
- package/stdio.d.mts.map +1 -0
- package/stdio.d.ts +3 -0
- package/stdio.d.ts.map +1 -0
- package/stdio.js +18 -0
- package/stdio.js.map +1 -0
- package/stdio.mjs +14 -0
- package/stdio.mjs.map +1 -0
- package/types.d.mts +65 -0
- package/types.d.mts.map +1 -0
- package/types.d.ts +65 -0
- package/types.d.ts.map +1 -0
- package/types.js +58 -0
- package/types.js.map +1 -0
- package/types.mjs +53 -0
- package/types.mjs.map +1 -0
- package/util.d.mts +4 -0
- package/util.d.mts.map +1 -0
- package/util.d.ts +4 -0
- package/util.d.ts.map +1 -0
- package/util.js +30 -0
- package/util.js.map +1 -0
- package/util.mjs +24 -0
- package/util.mjs.map +1 -0
|
@@ -0,0 +1,1339 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
|
+
};
|
|
39
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
|
+
exports.LocalDocsSearch = void 0;
|
|
41
|
+
const minisearch_1 = __importDefault(require("minisearch"));
|
|
42
|
+
const fs = __importStar(require("node:fs/promises"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const logger_1 = require("./logger.js");
|
|
45
|
+
const EMBEDDED_METHODS = [
|
|
46
|
+
{
|
|
47
|
+
name: 'create',
|
|
48
|
+
endpoint: '/v3/chats',
|
|
49
|
+
httpMethod: 'post',
|
|
50
|
+
summary: 'Create a new chat',
|
|
51
|
+
description: 'Create a new chat with specified participants and send an initial message.\nThe initial message is required when creating a chat.\n\n## Message Effects\n\nYou can add iMessage effects to make your messages more expressive. Effects are\noptional and can be either screen effects (full-screen animations) or bubble effects\n(message bubble animations).\n\n**Screen Effects:** `confetti`, `fireworks`, `lasers`, `sparkles`, `celebration`,\n`hearts`, `love`, `balloons`, `happy_birthday`, `echo`, `spotlight`\n\n**Bubble Effects:** `slam`, `loud`, `gentle`, `invisible`\n\nOnly one effect type can be applied per message.\n\n## Inline Text Decorations (iMessage only)\n\nUse the `text_decorations` array on a text part to apply styling and animations to character ranges.\n\nEach decoration specifies a `range: [start, end)` and exactly one of `style` or `animation`.\n\n**Styles:** `bold`, `italic`, `strikethrough`, `underline`\n**Animations:** `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`\n\n```json\n{\n "type": "text",\n "value": "Hello world",\n "text_decorations": [\n { "range": [0, 5], "style": "bold" },\n { "range": [6, 11], "animation": "shake" }\n ]\n}\n```\n\n**Note:** Style ranges (bold, italic, etc.) may overlap, but animation ranges must not overlap with other animations or styles. Text decorations only render for iMessage recipients.\nFor SMS/RCS, text decorations are not applied.\n\n## First-Message Link Restriction\n\nTo protect sender deliverability, the **first outbound message** of a new chat cannot be a link.\nThe request is rejected with `400` (error code `1005`) when:\n\n- The message contains a `link` part (explicit rich-preview link), or\n- Any `text` part contains a URL.\n\nThis rule applies only to `POST /v3/chats`. Follow-up messages on an existing chat\n(`POST /v3/chats/{chatId}/messages`) are not subject to this restriction.\n',
|
|
52
|
+
stainlessPath: '(resource) chats > (method) create',
|
|
53
|
+
qualified: 'client.chats.create',
|
|
54
|
+
params: [
|
|
55
|
+
'from: string;',
|
|
56
|
+
"message: { parts: { type: 'text'; value: string; text_decorations?: text_decoration[]; } | { type: 'media'; attachment_id?: string; url?: string; } | { type: 'link'; value: string; }[]; effect?: { name?: string; type?: 'screen' | 'bubble'; }; idempotency_key?: string; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; reply_to?: { message_id: string; part_index?: number; }; };",
|
|
57
|
+
'to: string[];',
|
|
58
|
+
],
|
|
59
|
+
response: "{ chat: { id: string; display_name: string; handles: object[]; is_group: boolean; message: object; service: 'iMessage' | 'SMS' | 'RCS'; health_score?: { reason: string; score: number; }; }; }",
|
|
60
|
+
markdown: "## create\n\n`client.chats.create(from: string, message: { parts: text_part | media_part | link_part[]; effect?: message_effect; idempotency_key?: string; preferred_service?: service_type; reply_to?: reply_to; }, to: string[]): { chat: object; }`\n\n**post** `/v3/chats`\n\nCreate a new chat with specified participants and send an initial message.\nThe initial message is required when creating a chat.\n\n## Message Effects\n\nYou can add iMessage effects to make your messages more expressive. Effects are\noptional and can be either screen effects (full-screen animations) or bubble effects\n(message bubble animations).\n\n**Screen Effects:** `confetti`, `fireworks`, `lasers`, `sparkles`, `celebration`,\n`hearts`, `love`, `balloons`, `happy_birthday`, `echo`, `spotlight`\n\n**Bubble Effects:** `slam`, `loud`, `gentle`, `invisible`\n\nOnly one effect type can be applied per message.\n\n## Inline Text Decorations (iMessage only)\n\nUse the `text_decorations` array on a text part to apply styling and animations to character ranges.\n\nEach decoration specifies a `range: [start, end)` and exactly one of `style` or `animation`.\n\n**Styles:** `bold`, `italic`, `strikethrough`, `underline`\n**Animations:** `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`\n\n```json\n{\n \"type\": \"text\",\n \"value\": \"Hello world\",\n \"text_decorations\": [\n { \"range\": [0, 5], \"style\": \"bold\" },\n { \"range\": [6, 11], \"animation\": \"shake\" }\n ]\n}\n```\n\n**Note:** Style ranges (bold, italic, etc.) may overlap, but animation ranges must not overlap with other animations or styles. Text decorations only render for iMessage recipients.\nFor SMS/RCS, text decorations are not applied.\n\n## First-Message Link Restriction\n\nTo protect sender deliverability, the **first outbound message** of a new chat cannot be a link.\nThe request is rejected with `400` (error code `1005`) when:\n\n- The message contains a `link` part (explicit rich-preview link), or\n- Any `text` part contains a URL.\n\nThis rule applies only to `POST /v3/chats`. Follow-up messages on an existing chat\n(`POST /v3/chats/{chatId}/messages`) are not subject to this restriction.\n\n\n### Parameters\n\n- `from: string`\n Sender phone number in E.164 format. Must be a phone number that the\nauthenticated partner has permission to send from.\n\n\n- `message: { parts: { type: 'text'; value: string; text_decorations?: text_decoration[]; } | { type: 'media'; attachment_id?: string; url?: string; } | { type: 'link'; value: string; }[]; effect?: { name?: string; type?: 'screen' | 'bubble'; }; idempotency_key?: string; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; reply_to?: { message_id: string; part_index?: number; }; }`\n Message content container. Groups all message-related fields together,\nseparating the \"what\" (message content) from the \"where\" (routing fields like from/to).\n\n - `parts: { type: 'text'; value: string; text_decorations?: { range: number[]; animation?: 'big' | 'small' | 'shake' | 'nod' | 'explode' | 'ripple' | 'bloom' | 'jitter'; style?: 'bold' | 'italic' | 'strikethrough' | 'underline'; }[]; } | { type: 'media'; attachment_id?: string; url?: string; } | { type: 'link'; value: string; }[]`\n Array of message parts. Each part can be text, media, or link.\nParts are displayed in order. Text and media can be mixed freely,\nbut a `link` part must be the only part in the message.\n\n**Rich Link Previews:**\n- Use a `link` part to send a URL with a rich preview card\n- A `link` part must be the **only** part in the message\n- To send a URL as plain text (no preview), use a `text` part instead\n\n**Supported Media:**\n- Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp\n- Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp\n- Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr\n- Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pages, .numbers, .key, .epub, .zip, .html, .htm\n- Contact & Calendar: .vcf, .ics\n\n**Audio:**\n- Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as media parts\n- To send audio as an **iMessage voice memo bubble** (inline playback UI), use the dedicated\n `/v3/chats/{chatId}/voicememo` endpoint instead\n\n**Validation Rules:**\n- A `link` part must be the **only** part in the message. It cannot be combined\n with text or media parts.\n- Consecutive text parts are not allowed. Text parts must be separated by\n media parts. For example, [text, text] is invalid, but [text, media, text] is valid.\n- Maximum of **100 parts** total.\n- Media parts using a public `url` (downloaded by the server on send) are\n capped at **40**. Parts using `attachment_id` or presigned URLs\n are exempt from this sub-limit. For bulk media sends exceeding 40 files,\n pre-upload via `POST /v3/attachments` and reference by `attachment_id` or `download_url`.\n\n - `effect?: { name?: string; type?: 'screen' | 'bubble'; }`\n iMessage effect to apply to this message (screen or bubble effect)\n - `idempotency_key?: string`\n Optional idempotency key for this message.\nUse this to prevent duplicate sends of the same message.\n\n - `preferred_service?: 'iMessage' | 'SMS' | 'RCS'`\n Messaging service type\n - `reply_to?: { message_id: string; part_index?: number; }`\n Reply to another message to create a threaded conversation\n\n- `to: string[]`\n Array of recipient handles (phone numbers in E.164 format or email addresses).\nFor individual chats, provide one recipient. For group chats, provide multiple.\n\n\n### Returns\n\n- `{ chat: { id: string; display_name: string; handles: object[]; is_group: boolean; message: object; service: 'iMessage' | 'SMS' | 'RCS'; health_score?: { reason: string; score: number; }; }; }`\n Response for creating a new chat with an initial message\n\n - `chat: { id: string; display_name: string; handles: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]; is_group: boolean; message: { id: string; created_at: string; delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed'; is_read: boolean; parts: object | object | object[]; sent_at: string; delivered_at?: string; effect?: object; from_handle?: object; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; reply_to?: object; service?: 'iMessage' | 'SMS' | 'RCS'; }; service: 'iMessage' | 'SMS' | 'RCS'; health_score?: { reason: string; score: number; }; }`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst chat = await client.chats.create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n});\n\nconsole.log(chat);\n```",
|
|
61
|
+
perLanguage: {
|
|
62
|
+
go: {
|
|
63
|
+
method: 'client.Chats.New',
|
|
64
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tchat, err := client.Chats.New(context.TODO(), linqgo.ChatNewParams{\n\t\tFrom: "+12052535597",\n\t\tMessage: linqgo.MessageContentParam{\n\t\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\t\tValue: "Hello! How can I help you today?",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t\tTo: []string{"+12052532136"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", chat.Chat)\n}\n',
|
|
65
|
+
},
|
|
66
|
+
http: {
|
|
67
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "from": "+12052535597",\n "message": {\n "parts": [\n {\n "type": "text",\n "value": "Hello! How can I help you today?"\n }\n ]\n },\n "to": [\n "+12052532136"\n ]\n }\'',
|
|
68
|
+
},
|
|
69
|
+
python: {
|
|
70
|
+
method: 'chats.create',
|
|
71
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nchat = client.chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n)\nprint(chat.chat)',
|
|
72
|
+
},
|
|
73
|
+
typescript: {
|
|
74
|
+
method: 'client.chats.create',
|
|
75
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst chat = await client.chats.create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n});\n\nconsole.log(chat.chat);",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'list_chats',
|
|
81
|
+
endpoint: '/v3/chats',
|
|
82
|
+
httpMethod: 'get',
|
|
83
|
+
summary: 'List all chats',
|
|
84
|
+
description: 'Retrieves a paginated list of chats for the authenticated partner.\n\n**Filtering:**\n- If `from` is provided, returns chats for that specific phone number\n- If `from` is omitted, returns chats across all phone numbers owned by the partner\n- If `to` is provided, only returns chats where the specified handle is a participant\n\n**Pagination:**\n- Use `limit` to control page size (default: 20, max: 100)\n- The response includes `next_cursor` for fetching the next page\n- When `next_cursor` is `null`, there are no more results to fetch\n- Pass the `next_cursor` value as the `cursor` parameter for the next request\n\n**Example pagination flow:**\n1. First request: `GET /v3/chats?from=%2B12223334444&limit=20`\n2. Response includes `next_cursor: "20"` (more results exist)\n3. Next request: `GET /v3/chats?from=%2B12223334444&limit=20&cursor=20`\n4. Response includes `next_cursor: null` (no more results)\n',
|
|
85
|
+
stainlessPath: '(resource) chats > (method) list_chats',
|
|
86
|
+
qualified: 'client.chats.listChats',
|
|
87
|
+
params: ['cursor?: string;', 'from?: string;', 'limit?: number;', 'to?: string;'],
|
|
88
|
+
response: "{ id: string; created_at: string; display_name: string; handles: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]; is_archived: boolean; is_group: boolean; updated_at: string; health_score?: { reason: string; score: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }",
|
|
89
|
+
markdown: "## list_chats\n\n`client.chats.listChats(cursor?: string, from?: string, limit?: number, to?: string): { id: string; created_at: string; display_name: string; handles: chat_handle[]; is_archived: boolean; is_group: boolean; updated_at: string; health_score?: object; service?: service_type; }`\n\n**get** `/v3/chats`\n\nRetrieves a paginated list of chats for the authenticated partner.\n\n**Filtering:**\n- If `from` is provided, returns chats for that specific phone number\n- If `from` is omitted, returns chats across all phone numbers owned by the partner\n- If `to` is provided, only returns chats where the specified handle is a participant\n\n**Pagination:**\n- Use `limit` to control page size (default: 20, max: 100)\n- The response includes `next_cursor` for fetching the next page\n- When `next_cursor` is `null`, there are no more results to fetch\n- Pass the `next_cursor` value as the `cursor` parameter for the next request\n\n**Example pagination flow:**\n1. First request: `GET /v3/chats?from=%2B12223334444&limit=20`\n2. Response includes `next_cursor: \"20\"` (more results exist)\n3. Next request: `GET /v3/chats?from=%2B12223334444&limit=20&cursor=20`\n4. Response includes `next_cursor: null` (no more results)\n\n\n### Parameters\n\n- `cursor?: string`\n Pagination cursor from the previous response's `next_cursor` field.\nOmit this parameter for the first page of results.\n\n\n- `from?: string`\n Phone number to filter chats by. Returns chats made from this phone number.\nMust be in E.164 format (e.g., `+13343284472`). The `+` is automatically URL-encoded by HTTP clients.\nIf omitted, returns chats across all phone numbers owned by the partner.\n\n\n- `limit?: number`\n Maximum number of chats to return per page\n\n- `to?: string`\n Filter chats by a participant handle. Only returns chats where this handle is a participant.\nCan be an E.164 phone number (e.g., `+13343284472`) or an email address (e.g., `user@example.com`).\nFor phone numbers, the `+` is automatically URL-encoded by HTTP clients.\n\n\n### Returns\n\n- `{ id: string; created_at: string; display_name: string; handles: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]; is_archived: boolean; is_group: boolean; updated_at: string; health_score?: { reason: string; score: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n - `id: string`\n - `created_at: string`\n - `display_name: string`\n - `handles: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]`\n - `is_archived: boolean`\n - `is_group: boolean`\n - `updated_at: string`\n - `health_score?: { reason: string; score: number; }`\n - `service?: 'iMessage' | 'SMS' | 'RCS'`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\n// Automatically fetches more pages as needed.\nfor await (const chat of client.chats.listChats()) {\n console.log(chat);\n}\n```",
|
|
90
|
+
perLanguage: {
|
|
91
|
+
go: {
|
|
92
|
+
method: 'client.Chats.ListChats',
|
|
93
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Chats.ListChats(context.TODO(), linqgo.ChatListChatsParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
94
|
+
},
|
|
95
|
+
http: {
|
|
96
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
97
|
+
},
|
|
98
|
+
python: {
|
|
99
|
+
method: 'chats.list_chats',
|
|
100
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\npage = client.chats.list_chats()\npage = page.chats[0]\nprint(page.id)',
|
|
101
|
+
},
|
|
102
|
+
typescript: {
|
|
103
|
+
method: 'client.chats.listChats',
|
|
104
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const chat of client.chats.listChats()) {\n console.log(chat.id);\n}",
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: 'retrieve',
|
|
110
|
+
endpoint: '/v3/chats/{chatId}',
|
|
111
|
+
httpMethod: 'get',
|
|
112
|
+
summary: 'Get a chat by ID',
|
|
113
|
+
description: 'Retrieve a chat by its unique identifier.',
|
|
114
|
+
stainlessPath: '(resource) chats > (method) retrieve',
|
|
115
|
+
qualified: 'client.chats.retrieve',
|
|
116
|
+
params: ['chatId: string;'],
|
|
117
|
+
response: "{ id: string; created_at: string; display_name: string; handles: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]; is_archived: boolean; is_group: boolean; updated_at: string; health_score?: { reason: string; score: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }",
|
|
118
|
+
markdown: "## retrieve\n\n`client.chats.retrieve(chatId: string): { id: string; created_at: string; display_name: string; handles: chat_handle[]; is_archived: boolean; is_group: boolean; updated_at: string; health_score?: object; service?: service_type; }`\n\n**get** `/v3/chats/{chatId}`\n\nRetrieve a chat by its unique identifier.\n\n### Parameters\n\n- `chatId: string`\n\n### Returns\n\n- `{ id: string; created_at: string; display_name: string; handles: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]; is_archived: boolean; is_group: boolean; updated_at: string; health_score?: { reason: string; score: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n - `id: string`\n - `created_at: string`\n - `display_name: string`\n - `handles: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]`\n - `is_archived: boolean`\n - `is_group: boolean`\n - `updated_at: string`\n - `health_score?: { reason: string; score: number; }`\n - `service?: 'iMessage' | 'SMS' | 'RCS'`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst chat = await client.chats.retrieve('550e8400-e29b-41d4-a716-446655440000');\n\nconsole.log(chat);\n```",
|
|
119
|
+
perLanguage: {
|
|
120
|
+
go: {
|
|
121
|
+
method: 'client.Chats.Get',
|
|
122
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tchat, err := client.Chats.Get(context.TODO(), "550e8400-e29b-41d4-a716-446655440000")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", chat.ID)\n}\n',
|
|
123
|
+
},
|
|
124
|
+
http: {
|
|
125
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
126
|
+
},
|
|
127
|
+
python: {
|
|
128
|
+
method: 'chats.retrieve',
|
|
129
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nchat = client.chats.retrieve(\n "550e8400-e29b-41d4-a716-446655440000",\n)\nprint(chat.id)',
|
|
130
|
+
},
|
|
131
|
+
typescript: {
|
|
132
|
+
method: 'client.chats.retrieve',
|
|
133
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst chat = await client.chats.retrieve('550e8400-e29b-41d4-a716-446655440000');\n\nconsole.log(chat.id);",
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: 'update',
|
|
139
|
+
endpoint: '/v3/chats/{chatId}',
|
|
140
|
+
httpMethod: 'put',
|
|
141
|
+
summary: 'Update a chat',
|
|
142
|
+
description: 'Update chat properties such as display name and group chat icon.\n\nListen for `chat.group_name_updated`, `chat.group_icon_updated`,\n`chat.group_name_update_failed`, or `chat.group_icon_update_failed`\nwebhook events to confirm the outcome.\n',
|
|
143
|
+
stainlessPath: '(resource) chats > (method) update',
|
|
144
|
+
qualified: 'client.chats.update',
|
|
145
|
+
params: ['chatId: string;', 'display_name?: string;', 'group_chat_icon?: string;'],
|
|
146
|
+
response: '{ chat_id?: string; status?: string; }',
|
|
147
|
+
markdown: "## update\n\n`client.chats.update(chatId: string, display_name?: string, group_chat_icon?: string): { chat_id?: string; status?: string; }`\n\n**put** `/v3/chats/{chatId}`\n\nUpdate chat properties such as display name and group chat icon.\n\nListen for `chat.group_name_updated`, `chat.group_icon_updated`,\n`chat.group_name_update_failed`, or `chat.group_icon_update_failed`\nwebhook events to confirm the outcome.\n\n\n### Parameters\n\n- `chatId: string`\n\n- `display_name?: string`\n New display name for the chat (group chats only)\n\n- `group_chat_icon?: string`\n URL of an image to set as the group chat icon (group chats only)\n\n### Returns\n\n- `{ chat_id?: string; status?: string; }`\n\n - `chat_id?: string`\n - `status?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst chat = await client.chats.update('550e8400-e29b-41d4-a716-446655440000');\n\nconsole.log(chat);\n```",
|
|
148
|
+
perLanguage: {
|
|
149
|
+
go: {
|
|
150
|
+
method: 'client.Chats.Update',
|
|
151
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tchat, err := client.Chats.Update(\n\t\tcontext.TODO(),\n\t\t"550e8400-e29b-41d4-a716-446655440000",\n\t\tlinqgo.ChatUpdateParams{\n\t\t\tDisplayName: linqgo.String("Team Discussion"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", chat.ChatID)\n}\n',
|
|
152
|
+
},
|
|
153
|
+
http: {
|
|
154
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "display_name": "Team Discussion",\n "group_chat_icon": "https://example.com/icon.png"\n }\'',
|
|
155
|
+
},
|
|
156
|
+
python: {
|
|
157
|
+
method: 'chats.update',
|
|
158
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nchat = client.chats.update(\n chat_id="550e8400-e29b-41d4-a716-446655440000",\n display_name="Team Discussion",\n)\nprint(chat.chat_id)',
|
|
159
|
+
},
|
|
160
|
+
typescript: {
|
|
161
|
+
method: 'client.chats.update',
|
|
162
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst chat = await client.chats.update('550e8400-e29b-41d4-a716-446655440000', {\n display_name: 'Team Discussion',\n});\n\nconsole.log(chat.chat_id);",
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: 'mark_as_read',
|
|
168
|
+
endpoint: '/v3/chats/{chatId}/read',
|
|
169
|
+
httpMethod: 'post',
|
|
170
|
+
summary: 'Mark chat as read',
|
|
171
|
+
description: 'Mark all messages in a chat as read.\n',
|
|
172
|
+
stainlessPath: '(resource) chats > (method) mark_as_read',
|
|
173
|
+
qualified: 'client.chats.markAsRead',
|
|
174
|
+
params: ['chatId: string;'],
|
|
175
|
+
markdown: "## mark_as_read\n\n`client.chats.markAsRead(chatId: string): void`\n\n**post** `/v3/chats/{chatId}/read`\n\nMark all messages in a chat as read.\n\n\n### Parameters\n\n- `chatId: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nawait client.chats.markAsRead('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e')\n```",
|
|
176
|
+
perLanguage: {
|
|
177
|
+
go: {
|
|
178
|
+
method: 'client.Chats.MarkAsRead',
|
|
179
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Chats.MarkAsRead(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
180
|
+
},
|
|
181
|
+
http: {
|
|
182
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/read \\\n -X POST \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
183
|
+
},
|
|
184
|
+
python: {
|
|
185
|
+
method: 'chats.mark_as_read',
|
|
186
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.chats.mark_as_read(\n "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n)',
|
|
187
|
+
},
|
|
188
|
+
typescript: {
|
|
189
|
+
method: 'client.chats.markAsRead',
|
|
190
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.chats.markAsRead('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');",
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: 'leave_chat',
|
|
196
|
+
endpoint: '/v3/chats/{chatId}/leave',
|
|
197
|
+
httpMethod: 'post',
|
|
198
|
+
summary: 'Leave a group chat',
|
|
199
|
+
description: 'Removes your phone number from a group chat. Once you leave, you will no longer receive messages from the group and all interaction endpoints (send message, typing, mark read, etc.) will return 409.\n\nA `participant.removed` webhook will fire once the leave has been processed.\n\n**Supported**\n- iMessage group chats with 4 or more active participants (including yourself)\n\n**Not supported**\n- DM (1-on-1) chats — use the chat directly to continue the conversation\n',
|
|
200
|
+
stainlessPath: '(resource) chats > (method) leave_chat',
|
|
201
|
+
qualified: 'client.chats.leaveChat',
|
|
202
|
+
params: ['chatId: string;'],
|
|
203
|
+
response: '{ message?: string; status?: string; trace_id?: string; }',
|
|
204
|
+
markdown: "## leave_chat\n\n`client.chats.leaveChat(chatId: string): { message?: string; status?: string; trace_id?: string; }`\n\n**post** `/v3/chats/{chatId}/leave`\n\nRemoves your phone number from a group chat. Once you leave, you will no longer receive messages from the group and all interaction endpoints (send message, typing, mark read, etc.) will return 409.\n\nA `participant.removed` webhook will fire once the leave has been processed.\n\n**Supported**\n- iMessage group chats with 4 or more active participants (including yourself)\n\n**Not supported**\n- DM (1-on-1) chats — use the chat directly to continue the conversation\n\n\n### Parameters\n\n- `chatId: string`\n\n### Returns\n\n- `{ message?: string; status?: string; trace_id?: string; }`\n\n - `message?: string`\n - `status?: string`\n - `trace_id?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst response = await client.chats.leaveChat('550e8400-e29b-41d4-a716-446655440000');\n\nconsole.log(response);\n```",
|
|
205
|
+
perLanguage: {
|
|
206
|
+
go: {
|
|
207
|
+
method: 'client.Chats.LeaveChat',
|
|
208
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Chats.LeaveChat(context.TODO(), "550e8400-e29b-41d4-a716-446655440000")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.TraceID)\n}\n',
|
|
209
|
+
},
|
|
210
|
+
http: {
|
|
211
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/leave \\\n -X POST \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
212
|
+
},
|
|
213
|
+
python: {
|
|
214
|
+
method: 'chats.leave_chat',
|
|
215
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.chats.leave_chat(\n "550e8400-e29b-41d4-a716-446655440000",\n)\nprint(response.trace_id)',
|
|
216
|
+
},
|
|
217
|
+
typescript: {
|
|
218
|
+
method: 'client.chats.leaveChat',
|
|
219
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.chats.leaveChat('550e8400-e29b-41d4-a716-446655440000');\n\nconsole.log(response.trace_id);",
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'share_contact_card',
|
|
225
|
+
endpoint: '/v3/chats/{chatId}/share_contact_card',
|
|
226
|
+
httpMethod: 'post',
|
|
227
|
+
summary: 'Share your contact card with a chat',
|
|
228
|
+
description: 'Share your contact information (Name and Photo Sharing) with a chat.\n\n**Note:** A contact card must be configured before sharing. You can set up your contact card via the [Contact Card API](#tag/Contact-Card) or on the [Linq dashboard](https://dashboard.linqapp.com/contact-cards).\n',
|
|
229
|
+
stainlessPath: '(resource) chats > (method) share_contact_card',
|
|
230
|
+
qualified: 'client.chats.shareContactCard',
|
|
231
|
+
params: ['chatId: string;'],
|
|
232
|
+
markdown: "## share_contact_card\n\n`client.chats.shareContactCard(chatId: string): void`\n\n**post** `/v3/chats/{chatId}/share_contact_card`\n\nShare your contact information (Name and Photo Sharing) with a chat.\n\n**Note:** A contact card must be configured before sharing. You can set up your contact card via the [Contact Card API](#tag/Contact-Card) or on the [Linq dashboard](https://dashboard.linqapp.com/contact-cards).\n\n\n### Parameters\n\n- `chatId: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nawait client.chats.shareContactCard('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e')\n```",
|
|
233
|
+
perLanguage: {
|
|
234
|
+
go: {
|
|
235
|
+
method: 'client.Chats.ShareContactCard',
|
|
236
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Chats.ShareContactCard(context.TODO(), "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
237
|
+
},
|
|
238
|
+
http: {
|
|
239
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/share_contact_card \\\n -X POST \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
240
|
+
},
|
|
241
|
+
python: {
|
|
242
|
+
method: 'chats.share_contact_card',
|
|
243
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.chats.share_contact_card(\n "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",\n)',
|
|
244
|
+
},
|
|
245
|
+
typescript: {
|
|
246
|
+
method: 'client.chats.shareContactCard',
|
|
247
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.chats.shareContactCard('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');",
|
|
248
|
+
},
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
name: 'send_voicememo',
|
|
253
|
+
endpoint: '/v3/chats/{chatId}/voicememo',
|
|
254
|
+
httpMethod: 'post',
|
|
255
|
+
summary: 'Send a voice memo to a chat',
|
|
256
|
+
description: "Send an audio file as an **iMessage voice memo bubble** to all participants in a chat.\nVoice memos appear with iMessage's native inline playback UI, unlike regular audio\nattachments sent via media parts which appear as downloadable files.\n\n**Supported audio formats:**\n- MP3 (audio/mpeg)\n- M4A (audio/x-m4a, audio/mp4)\n- AAC (audio/aac)\n- CAF (audio/x-caf) - Core Audio Format\n- WAV (audio/wav)\n- AIFF (audio/aiff, audio/x-aiff)\n- AMR (audio/amr)\n",
|
|
257
|
+
stainlessPath: '(resource) chats > (method) send_voicememo',
|
|
258
|
+
qualified: 'client.chats.sendVoicememo',
|
|
259
|
+
params: ['chatId: string;', 'attachment_id?: string;', 'voice_memo_url?: string;'],
|
|
260
|
+
response: "{ voice_memo: { id: string; chat: { id: string; handles: chat_handle[]; is_active: boolean; is_group: boolean; service: service_type; }; created_at: string; from: string; status: string; to: string[]; voice_memo: { id: string; filename: string; mime_type: string; size_bytes: number; url: string; duration_ms?: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }; }",
|
|
261
|
+
markdown: "## send_voicememo\n\n`client.chats.sendVoicememo(chatId: string, attachment_id?: string, voice_memo_url?: string): { voice_memo: object; }`\n\n**post** `/v3/chats/{chatId}/voicememo`\n\nSend an audio file as an **iMessage voice memo bubble** to all participants in a chat.\nVoice memos appear with iMessage's native inline playback UI, unlike regular audio\nattachments sent via media parts which appear as downloadable files.\n\n**Supported audio formats:**\n- MP3 (audio/mpeg)\n- M4A (audio/x-m4a, audio/mp4)\n- AAC (audio/aac)\n- CAF (audio/x-caf) - Core Audio Format\n- WAV (audio/wav)\n- AIFF (audio/aiff, audio/x-aiff)\n- AMR (audio/amr)\n\n\n### Parameters\n\n- `chatId: string`\n\n- `attachment_id?: string`\n Reference to a voice memo file pre-uploaded via `POST /v3/attachments`.\nThe file is already stored, so sends using this ID skip the download step.\n\nEither `voice_memo_url` or `attachment_id` must be provided, but not both.\n\n\n- `voice_memo_url?: string`\n URL of the voice memo audio file. Must be a publicly accessible HTTPS URL.\n\nEither `voice_memo_url` or `attachment_id` must be provided, but not both.\n\n\n### Returns\n\n- `{ voice_memo: { id: string; chat: { id: string; handles: chat_handle[]; is_active: boolean; is_group: boolean; service: service_type; }; created_at: string; from: string; status: string; to: string[]; voice_memo: { id: string; filename: string; mime_type: string; size_bytes: number; url: string; duration_ms?: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }; }`\n Response for sending a voice memo to a chat\n\n - `voice_memo: { id: string; chat: { id: string; handles: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }[]; is_active: boolean; is_group: boolean; service: 'iMessage' | 'SMS' | 'RCS'; }; created_at: string; from: string; status: string; to: string[]; voice_memo: { id: string; filename: string; mime_type: string; size_bytes: number; url: string; duration_ms?: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst response = await client.chats.sendVoicememo('f19ee7b8-8533-4c5c-83ec-4ef8d6d1ddbd');\n\nconsole.log(response);\n```",
|
|
262
|
+
perLanguage: {
|
|
263
|
+
go: {
|
|
264
|
+
method: 'client.Chats.SendVoicememo',
|
|
265
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Chats.SendVoicememo(\n\t\tcontext.TODO(),\n\t\t"f19ee7b8-8533-4c5c-83ec-4ef8d6d1ddbd",\n\t\tlinqgo.ChatSendVoicememoParams{\n\t\t\tVoiceMemoURL: linqgo.String("https://example.com/voice-memo.m4a"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.VoiceMemo)\n}\n',
|
|
266
|
+
},
|
|
267
|
+
http: {
|
|
268
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/voicememo \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "attachment_id": "550e8400-e29b-41d4-a716-446655440000",\n "voice_memo_url": "https://example.com/voice-memo.m4a"\n }\'',
|
|
269
|
+
},
|
|
270
|
+
python: {
|
|
271
|
+
method: 'chats.send_voicememo',
|
|
272
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.chats.send_voicememo(\n chat_id="f19ee7b8-8533-4c5c-83ec-4ef8d6d1ddbd",\n voice_memo_url="https://example.com/voice-memo.m4a",\n)\nprint(response.voice_memo)',
|
|
273
|
+
},
|
|
274
|
+
typescript: {
|
|
275
|
+
method: 'client.chats.sendVoicememo',
|
|
276
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.chats.sendVoicememo('f19ee7b8-8533-4c5c-83ec-4ef8d6d1ddbd', {\n voice_memo_url: 'https://example.com/voice-memo.m4a',\n});\n\nconsole.log(response.voice_memo);",
|
|
277
|
+
},
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: 'add',
|
|
282
|
+
endpoint: '/v3/chats/{chatId}/participants',
|
|
283
|
+
httpMethod: 'post',
|
|
284
|
+
summary: 'Add a participant to a chat',
|
|
285
|
+
description: "Add a new participant to an existing group chat.\n\n**Requirements:**\n- Group chats only (3+ existing participants)\n- New participant must support the same messaging service as the group\n- Cross-service additions not allowed (e.g., can't add RCS-only user to iMessage group)\n- For cross-service scenarios, create a new chat instead\n",
|
|
286
|
+
stainlessPath: '(resource) chats.participants > (method) add',
|
|
287
|
+
qualified: 'client.chats.participants.add',
|
|
288
|
+
params: ['chatId: string;', 'handle: string;'],
|
|
289
|
+
response: '{ message?: string; status?: string; trace_id?: string; }',
|
|
290
|
+
markdown: "## add\n\n`client.chats.participants.add(chatId: string, handle: string): { message?: string; status?: string; trace_id?: string; }`\n\n**post** `/v3/chats/{chatId}/participants`\n\nAdd a new participant to an existing group chat.\n\n**Requirements:**\n- Group chats only (3+ existing participants)\n- New participant must support the same messaging service as the group\n- Cross-service additions not allowed (e.g., can't add RCS-only user to iMessage group)\n- For cross-service scenarios, create a new chat instead\n\n\n### Parameters\n\n- `chatId: string`\n\n- `handle: string`\n Phone number (E.164 format) or email address of the participant to add\n\n### Returns\n\n- `{ message?: string; status?: string; trace_id?: string; }`\n\n - `message?: string`\n - `status?: string`\n - `trace_id?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst response = await client.chats.participants.add('550e8400-e29b-41d4-a716-446655440000', { handle: '+12052499136' });\n\nconsole.log(response);\n```",
|
|
291
|
+
perLanguage: {
|
|
292
|
+
go: {
|
|
293
|
+
method: 'client.Chats.Participants.Add',
|
|
294
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Chats.Participants.Add(\n\t\tcontext.TODO(),\n\t\t"550e8400-e29b-41d4-a716-446655440000",\n\t\tlinqgo.ChatParticipantAddParams{\n\t\t\tHandle: "+12052499136",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.TraceID)\n}\n',
|
|
295
|
+
},
|
|
296
|
+
http: {
|
|
297
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/participants \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "handle": "+12052499136"\n }\'',
|
|
298
|
+
},
|
|
299
|
+
python: {
|
|
300
|
+
method: 'chats.participants.add',
|
|
301
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.chats.participants.add(\n chat_id="550e8400-e29b-41d4-a716-446655440000",\n handle="+12052499136",\n)\nprint(response.trace_id)',
|
|
302
|
+
},
|
|
303
|
+
typescript: {
|
|
304
|
+
method: 'client.chats.participants.add',
|
|
305
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.chats.participants.add('550e8400-e29b-41d4-a716-446655440000', {\n handle: '+12052499136',\n});\n\nconsole.log(response.trace_id);",
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: 'remove',
|
|
311
|
+
endpoint: '/v3/chats/{chatId}/participants',
|
|
312
|
+
httpMethod: 'delete',
|
|
313
|
+
summary: 'Remove a participant from a chat',
|
|
314
|
+
description: 'Remove a participant from an existing group chat.\n\n**Requirements:**\n- Group chats only\n- Must have 3+ participants after removal\n',
|
|
315
|
+
stainlessPath: '(resource) chats.participants > (method) remove',
|
|
316
|
+
qualified: 'client.chats.participants.remove',
|
|
317
|
+
params: ['chatId: string;', 'handle: string;'],
|
|
318
|
+
response: '{ message?: string; status?: string; trace_id?: string; }',
|
|
319
|
+
markdown: "## remove\n\n`client.chats.participants.remove(chatId: string, handle: string): { message?: string; status?: string; trace_id?: string; }`\n\n**delete** `/v3/chats/{chatId}/participants`\n\nRemove a participant from an existing group chat.\n\n**Requirements:**\n- Group chats only\n- Must have 3+ participants after removal\n\n\n### Parameters\n\n- `chatId: string`\n\n- `handle: string`\n Phone number (E.164 format) or email address of the participant to remove\n\n### Returns\n\n- `{ message?: string; status?: string; trace_id?: string; }`\n\n - `message?: string`\n - `status?: string`\n - `trace_id?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst participant = await client.chats.participants.remove('550e8400-e29b-41d4-a716-446655440000', { handle: '+12052499136' });\n\nconsole.log(participant);\n```",
|
|
320
|
+
perLanguage: {
|
|
321
|
+
go: {
|
|
322
|
+
method: 'client.Chats.Participants.Remove',
|
|
323
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tparticipant, err := client.Chats.Participants.Remove(\n\t\tcontext.TODO(),\n\t\t"550e8400-e29b-41d4-a716-446655440000",\n\t\tlinqgo.ChatParticipantRemoveParams{\n\t\t\tHandle: "+12052499136",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", participant.TraceID)\n}\n',
|
|
324
|
+
},
|
|
325
|
+
http: {
|
|
326
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/participants \\\n -X DELETE \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
327
|
+
},
|
|
328
|
+
python: {
|
|
329
|
+
method: 'chats.participants.remove',
|
|
330
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nparticipant = client.chats.participants.remove(\n chat_id="550e8400-e29b-41d4-a716-446655440000",\n handle="+12052499136",\n)\nprint(participant.trace_id)',
|
|
331
|
+
},
|
|
332
|
+
typescript: {
|
|
333
|
+
method: 'client.chats.participants.remove',
|
|
334
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst participant = await client.chats.participants.remove('550e8400-e29b-41d4-a716-446655440000', {\n handle: '+12052499136',\n});\n\nconsole.log(participant.trace_id);",
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
name: 'start',
|
|
340
|
+
endpoint: '/v3/chats/{chatId}/typing',
|
|
341
|
+
httpMethod: 'post',
|
|
342
|
+
summary: 'Start typing indicator',
|
|
343
|
+
description: "Send a typing indicator to show that someone is typing in the chat.\n\n## Behavior & Limitations\n\nTyping indicators are best-effort signals with the following limitations:\n\n- **Active conversations only:** The recipient must have sent or received a message\n in this chat within the **last 5 minutes**. If the chat is inactive, the request is\n still accepted (`204`) but the indicator will not reach the recipient's device.\n\n- **No delivery guarantee:** Even for active chats, a `204` response only indicates\n the request was accepted for processing.\n\n- **Group chats not supported:** Attempting to start a typing indicator in a group chat\n will return a `403` error.\n",
|
|
344
|
+
stainlessPath: '(resource) chats.typing > (method) start',
|
|
345
|
+
qualified: 'client.chats.typing.start',
|
|
346
|
+
params: ['chatId: string;'],
|
|
347
|
+
markdown: "## start\n\n`client.chats.typing.start(chatId: string): void`\n\n**post** `/v3/chats/{chatId}/typing`\n\nSend a typing indicator to show that someone is typing in the chat.\n\n## Behavior & Limitations\n\nTyping indicators are best-effort signals with the following limitations:\n\n- **Active conversations only:** The recipient must have sent or received a message\n in this chat within the **last 5 minutes**. If the chat is inactive, the request is\n still accepted (`204`) but the indicator will not reach the recipient's device.\n\n- **No delivery guarantee:** Even for active chats, a `204` response only indicates\n the request was accepted for processing.\n\n- **Group chats not supported:** Attempting to start a typing indicator in a group chat\n will return a `403` error.\n\n\n### Parameters\n\n- `chatId: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nawait client.chats.typing.start('550e8400-e29b-41d4-a716-446655440000')\n```",
|
|
348
|
+
perLanguage: {
|
|
349
|
+
go: {
|
|
350
|
+
method: 'client.Chats.Typing.Start',
|
|
351
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Chats.Typing.Start(context.TODO(), "550e8400-e29b-41d4-a716-446655440000")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
352
|
+
},
|
|
353
|
+
http: {
|
|
354
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/typing \\\n -X POST \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
355
|
+
},
|
|
356
|
+
python: {
|
|
357
|
+
method: 'chats.typing.start',
|
|
358
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.chats.typing.start(\n "550e8400-e29b-41d4-a716-446655440000",\n)',
|
|
359
|
+
},
|
|
360
|
+
typescript: {
|
|
361
|
+
method: 'client.chats.typing.start',
|
|
362
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.chats.typing.start('550e8400-e29b-41d4-a716-446655440000');",
|
|
363
|
+
},
|
|
364
|
+
},
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
name: 'stop',
|
|
368
|
+
endpoint: '/v3/chats/{chatId}/typing',
|
|
369
|
+
httpMethod: 'delete',
|
|
370
|
+
summary: 'Stop typing indicator',
|
|
371
|
+
description: 'Stop the typing indicator for the chat.\n\nTyping indicators are automatically stopped when a message is sent, so calling\nthis endpoint after sending a message is unnecessary.\n\nSee the `POST` endpoint above for behavior details and limitations.\n\n**Note:** Group chats are not supported and will return a `403` error.\n',
|
|
372
|
+
stainlessPath: '(resource) chats.typing > (method) stop',
|
|
373
|
+
qualified: 'client.chats.typing.stop',
|
|
374
|
+
params: ['chatId: string;'],
|
|
375
|
+
markdown: "## stop\n\n`client.chats.typing.stop(chatId: string): void`\n\n**delete** `/v3/chats/{chatId}/typing`\n\nStop the typing indicator for the chat.\n\nTyping indicators are automatically stopped when a message is sent, so calling\nthis endpoint after sending a message is unnecessary.\n\nSee the `POST` endpoint above for behavior details and limitations.\n\n**Note:** Group chats are not supported and will return a `403` error.\n\n\n### Parameters\n\n- `chatId: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nawait client.chats.typing.stop('550e8400-e29b-41d4-a716-446655440000')\n```",
|
|
376
|
+
perLanguage: {
|
|
377
|
+
go: {
|
|
378
|
+
method: 'client.Chats.Typing.Stop',
|
|
379
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Chats.Typing.Stop(context.TODO(), "550e8400-e29b-41d4-a716-446655440000")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
380
|
+
},
|
|
381
|
+
http: {
|
|
382
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/typing \\\n -X DELETE \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
383
|
+
},
|
|
384
|
+
python: {
|
|
385
|
+
method: 'chats.typing.stop',
|
|
386
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.chats.typing.stop(\n "550e8400-e29b-41d4-a716-446655440000",\n)',
|
|
387
|
+
},
|
|
388
|
+
typescript: {
|
|
389
|
+
method: 'client.chats.typing.stop',
|
|
390
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.chats.typing.stop('550e8400-e29b-41d4-a716-446655440000');",
|
|
391
|
+
},
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
name: 'send',
|
|
396
|
+
endpoint: '/v3/chats/{chatId}/messages',
|
|
397
|
+
httpMethod: 'post',
|
|
398
|
+
summary: 'Send a message to an existing chat',
|
|
399
|
+
description: 'Send a message to an existing chat. Use this endpoint when you already have\na chat ID and want to send additional messages to it.\n\n## Message Effects\n\nYou can add iMessage effects to make your messages more expressive. Effects are\noptional and can be either screen effects (full-screen animations) or bubble effects\n(message bubble animations).\n\n**Screen Effects:** `confetti`, `fireworks`, `lasers`, `sparkles`, `celebration`,\n`hearts`, `love`, `balloons`, `happy_birthday`, `echo`, `spotlight`\n\n**Bubble Effects:** `slam`, `loud`, `gentle`, `invisible`\n\nOnly one effect type can be applied per message.\n\n## Inline Text Decorations (iMessage only)\n\nUse the `text_decorations` array on a text part to apply styling and animations to character ranges.\n\nEach decoration specifies a `range: [start, end)` and exactly one of `style` or `animation`.\n\n**Styles:** `bold`, `italic`, `strikethrough`, `underline`\n**Animations:** `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`\n\n```json\n{\n "type": "text",\n "value": "Hello world",\n "text_decorations": [\n { "range": [0, 5], "style": "bold" },\n { "range": [6, 11], "animation": "shake" }\n ]\n}\n```\n\n**Note:** Style ranges (bold, italic, etc.) may overlap, but animation ranges must not overlap with other animations or styles. Text decorations only render for iMessage recipients.\nFor SMS/RCS, text decorations are not applied.\n',
|
|
400
|
+
stainlessPath: '(resource) chats.messages > (method) send',
|
|
401
|
+
qualified: 'client.chats.messages.send',
|
|
402
|
+
params: [
|
|
403
|
+
'chatId: string;',
|
|
404
|
+
"message: { parts: { type: 'text'; value: string; text_decorations?: text_decoration[]; } | { type: 'media'; attachment_id?: string; url?: string; } | { type: 'link'; value: string; }[]; effect?: { name?: string; type?: 'screen' | 'bubble'; }; idempotency_key?: string; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; reply_to?: { message_id: string; part_index?: number; }; };",
|
|
405
|
+
],
|
|
406
|
+
response: "{ chat_id: string; message: { id: string; created_at: string; delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed'; is_read: boolean; parts: text_part_response | media_part_response | link_part_response[]; sent_at: string; delivered_at?: string; effect?: message_effect; from_handle?: chat_handle; preferred_service?: service_type; reply_to?: reply_to; service?: service_type; }; }",
|
|
407
|
+
markdown: "## send\n\n`client.chats.messages.send(chatId: string, message: { parts: text_part | media_part | link_part[]; effect?: message_effect; idempotency_key?: string; preferred_service?: service_type; reply_to?: reply_to; }): { chat_id: string; message: sent_message; }`\n\n**post** `/v3/chats/{chatId}/messages`\n\nSend a message to an existing chat. Use this endpoint when you already have\na chat ID and want to send additional messages to it.\n\n## Message Effects\n\nYou can add iMessage effects to make your messages more expressive. Effects are\noptional and can be either screen effects (full-screen animations) or bubble effects\n(message bubble animations).\n\n**Screen Effects:** `confetti`, `fireworks`, `lasers`, `sparkles`, `celebration`,\n`hearts`, `love`, `balloons`, `happy_birthday`, `echo`, `spotlight`\n\n**Bubble Effects:** `slam`, `loud`, `gentle`, `invisible`\n\nOnly one effect type can be applied per message.\n\n## Inline Text Decorations (iMessage only)\n\nUse the `text_decorations` array on a text part to apply styling and animations to character ranges.\n\nEach decoration specifies a `range: [start, end)` and exactly one of `style` or `animation`.\n\n**Styles:** `bold`, `italic`, `strikethrough`, `underline`\n**Animations:** `big`, `small`, `shake`, `nod`, `explode`, `ripple`, `bloom`, `jitter`\n\n```json\n{\n \"type\": \"text\",\n \"value\": \"Hello world\",\n \"text_decorations\": [\n { \"range\": [0, 5], \"style\": \"bold\" },\n { \"range\": [6, 11], \"animation\": \"shake\" }\n ]\n}\n```\n\n**Note:** Style ranges (bold, italic, etc.) may overlap, but animation ranges must not overlap with other animations or styles. Text decorations only render for iMessage recipients.\nFor SMS/RCS, text decorations are not applied.\n\n\n### Parameters\n\n- `chatId: string`\n\n- `message: { parts: { type: 'text'; value: string; text_decorations?: text_decoration[]; } | { type: 'media'; attachment_id?: string; url?: string; } | { type: 'link'; value: string; }[]; effect?: { name?: string; type?: 'screen' | 'bubble'; }; idempotency_key?: string; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; reply_to?: { message_id: string; part_index?: number; }; }`\n Message content container. Groups all message-related fields together,\nseparating the \"what\" (message content) from the \"where\" (routing fields like from/to).\n\n - `parts: { type: 'text'; value: string; text_decorations?: { range: number[]; animation?: 'big' | 'small' | 'shake' | 'nod' | 'explode' | 'ripple' | 'bloom' | 'jitter'; style?: 'bold' | 'italic' | 'strikethrough' | 'underline'; }[]; } | { type: 'media'; attachment_id?: string; url?: string; } | { type: 'link'; value: string; }[]`\n Array of message parts. Each part can be text, media, or link.\nParts are displayed in order. Text and media can be mixed freely,\nbut a `link` part must be the only part in the message.\n\n**Rich Link Previews:**\n- Use a `link` part to send a URL with a rich preview card\n- A `link` part must be the **only** part in the message\n- To send a URL as plain text (no preview), use a `text` part instead\n\n**Supported Media:**\n- Images: .jpg, .jpeg, .png, .gif, .heic, .heif, .tif, .tiff, .bmp\n- Videos: .mp4, .mov, .m4v, .mpeg, .mpg, .3gp\n- Audio: .m4a, .mp3, .aac, .caf, .wav, .aiff, .amr\n- Documents: .pdf, .txt, .rtf, .csv, .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pages, .numbers, .key, .epub, .zip, .html, .htm\n- Contact & Calendar: .vcf, .ics\n\n**Audio:**\n- Audio files (.m4a, .mp3, .aac, .caf, .wav, .aiff, .amr) are fully supported as media parts\n- To send audio as an **iMessage voice memo bubble** (inline playback UI), use the dedicated\n `/v3/chats/{chatId}/voicememo` endpoint instead\n\n**Validation Rules:**\n- A `link` part must be the **only** part in the message. It cannot be combined\n with text or media parts.\n- Consecutive text parts are not allowed. Text parts must be separated by\n media parts. For example, [text, text] is invalid, but [text, media, text] is valid.\n- Maximum of **100 parts** total.\n- Media parts using a public `url` (downloaded by the server on send) are\n capped at **40**. Parts using `attachment_id` or presigned URLs\n are exempt from this sub-limit. For bulk media sends exceeding 40 files,\n pre-upload via `POST /v3/attachments` and reference by `attachment_id` or `download_url`.\n\n - `effect?: { name?: string; type?: 'screen' | 'bubble'; }`\n iMessage effect to apply to this message (screen or bubble effect)\n - `idempotency_key?: string`\n Optional idempotency key for this message.\nUse this to prevent duplicate sends of the same message.\n\n - `preferred_service?: 'iMessage' | 'SMS' | 'RCS'`\n Messaging service type\n - `reply_to?: { message_id: string; part_index?: number; }`\n Reply to another message to create a threaded conversation\n\n### Returns\n\n- `{ chat_id: string; message: { id: string; created_at: string; delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed'; is_read: boolean; parts: text_part_response | media_part_response | link_part_response[]; sent_at: string; delivered_at?: string; effect?: message_effect; from_handle?: chat_handle; preferred_service?: service_type; reply_to?: reply_to; service?: service_type; }; }`\n Response for sending a message to a chat\n\n - `chat_id: string`\n - `message: { id: string; created_at: string; delivery_status: 'pending' | 'queued' | 'sent' | 'delivered' | 'failed'; is_read: boolean; parts: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; sent_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; reply_to?: { message_id: string; part_index?: number; }; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst response = await client.chats.messages.send('550e8400-e29b-41d4-a716-446655440000', { message: { parts: [{ type: 'text', value: 'Hello, world!' }] } });\n\nconsole.log(response);\n```",
|
|
408
|
+
perLanguage: {
|
|
409
|
+
go: {
|
|
410
|
+
method: 'client.Chats.Messages.Send',
|
|
411
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Chats.Messages.Send(\n\t\tcontext.TODO(),\n\t\t"550e8400-e29b-41d4-a716-446655440000",\n\t\tlinqgo.ChatMessageSendParams{\n\t\t\tMessage: linqgo.MessageContentParam{\n\t\t\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\t\t\tValue: "Hello, world!",\n\t\t\t\t\t},\n\t\t\t\t}},\n\t\t\t},\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.ChatID)\n}\n',
|
|
412
|
+
},
|
|
413
|
+
http: {
|
|
414
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/messages \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "message": {\n "parts": [\n {\n "type": "text",\n "value": "Hello, world!"\n }\n ]\n }\n }\'',
|
|
415
|
+
},
|
|
416
|
+
python: {
|
|
417
|
+
method: 'chats.messages.send',
|
|
418
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.chats.messages.send(\n chat_id="550e8400-e29b-41d4-a716-446655440000",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello, world!",\n }]\n },\n)\nprint(response.chat_id)',
|
|
419
|
+
},
|
|
420
|
+
typescript: {
|
|
421
|
+
method: 'client.chats.messages.send',
|
|
422
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.chats.messages.send('550e8400-e29b-41d4-a716-446655440000', {\n message: { parts: [{ type: 'text', value: 'Hello, world!' }] },\n});\n\nconsole.log(response.chat_id);",
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
name: 'list',
|
|
428
|
+
endpoint: '/v3/chats/{chatId}/messages',
|
|
429
|
+
httpMethod: 'get',
|
|
430
|
+
summary: 'Get messages from a chat',
|
|
431
|
+
description: 'Retrieve messages from a specific chat with pagination support.\n',
|
|
432
|
+
stainlessPath: '(resource) chats.messages > (method) list',
|
|
433
|
+
qualified: 'client.chats.messages.list',
|
|
434
|
+
params: ['chatId: string;', 'cursor?: string;', 'limit?: number;'],
|
|
435
|
+
response: "{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }",
|
|
436
|
+
markdown: "## list\n\n`client.chats.messages.list(chatId: string, cursor?: string, limit?: number): { id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: message_effect; from?: string; from_handle?: chat_handle; parts?: text_part_response | media_part_response | link_part_response[]; preferred_service?: service_type; read_at?: string; reply_to?: reply_to; sent_at?: string; service?: service_type; }`\n\n**get** `/v3/chats/{chatId}/messages`\n\nRetrieve messages from a specific chat with pagination support.\n\n\n### Parameters\n\n- `chatId: string`\n\n- `cursor?: string`\n Pagination cursor from previous next_cursor response\n\n- `limit?: number`\n Maximum number of messages to return\n\n### Returns\n\n- `{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n - `id: string`\n - `chat_id: string`\n - `created_at: string`\n - `is_delivered: boolean`\n - `is_from_me: boolean`\n - `is_read: boolean`\n - `updated_at: string`\n - `delivered_at?: string`\n - `effect?: { name?: string; type?: 'screen' | 'bubble'; }`\n - `from?: string`\n - `from_handle?: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }`\n - `parts?: { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'text'; value: string; text_decorations?: { range: number[]; animation?: 'big' | 'small' | 'shake' | 'nod' | 'explode' | 'ripple' | 'bloom' | 'jitter'; style?: 'bold' | 'italic' | 'strikethrough' | 'underline'; }[]; } | { id: string; filename: string; mime_type: string; reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; size_bytes: number; type: 'media'; url: string; } | { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'link'; value: string; }[]`\n - `preferred_service?: 'iMessage' | 'SMS' | 'RCS'`\n - `read_at?: string`\n - `reply_to?: { message_id: string; part_index?: number; }`\n - `sent_at?: string`\n - `service?: 'iMessage' | 'SMS' | 'RCS'`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\n// Automatically fetches more pages as needed.\nfor await (const message of client.chats.messages.list('550e8400-e29b-41d4-a716-446655440000')) {\n console.log(message);\n}\n```",
|
|
437
|
+
perLanguage: {
|
|
438
|
+
go: {
|
|
439
|
+
method: 'client.Chats.Messages.List',
|
|
440
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Chats.Messages.List(\n\t\tcontext.TODO(),\n\t\t"550e8400-e29b-41d4-a716-446655440000",\n\t\tlinqgo.ChatMessageListParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
441
|
+
},
|
|
442
|
+
http: {
|
|
443
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/chats/$CHAT_ID/messages \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
444
|
+
},
|
|
445
|
+
python: {
|
|
446
|
+
method: 'chats.messages.list',
|
|
447
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\npage = client.chats.messages.list(\n chat_id="550e8400-e29b-41d4-a716-446655440000",\n)\npage = page.messages[0]\nprint(page.id)',
|
|
448
|
+
},
|
|
449
|
+
typescript: {
|
|
450
|
+
method: 'client.chats.messages.list',
|
|
451
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const message of client.chats.messages.list('550e8400-e29b-41d4-a716-446655440000')) {\n console.log(message.id);\n}",
|
|
452
|
+
},
|
|
453
|
+
},
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
name: 'list_messages_thread',
|
|
457
|
+
endpoint: '/v3/messages/{messageId}/thread',
|
|
458
|
+
httpMethod: 'get',
|
|
459
|
+
summary: 'Get all messages in a thread',
|
|
460
|
+
description: 'Retrieve all messages in a conversation thread. Given any message ID in the thread,\nreturns the originator message and all replies in chronological order.\n\nIf the message is not part of a thread, returns just that single message.\n\nSupports pagination and configurable ordering.\n',
|
|
461
|
+
stainlessPath: '(resource) messages > (method) list_messages_thread',
|
|
462
|
+
qualified: 'client.messages.listMessagesThread',
|
|
463
|
+
params: ['messageId: string;', 'cursor?: string;', 'limit?: number;', "order?: 'asc' | 'desc';"],
|
|
464
|
+
response: "{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }",
|
|
465
|
+
markdown: "## list_messages_thread\n\n`client.messages.listMessagesThread(messageId: string, cursor?: string, limit?: number, order?: 'asc' | 'desc'): { id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: message_effect; from?: string; from_handle?: chat_handle; parts?: text_part_response | media_part_response | link_part_response[]; preferred_service?: service_type; read_at?: string; reply_to?: reply_to; sent_at?: string; service?: service_type; }`\n\n**get** `/v3/messages/{messageId}/thread`\n\nRetrieve all messages in a conversation thread. Given any message ID in the thread,\nreturns the originator message and all replies in chronological order.\n\nIf the message is not part of a thread, returns just that single message.\n\nSupports pagination and configurable ordering.\n\n\n### Parameters\n\n- `messageId: string`\n\n- `cursor?: string`\n Pagination cursor from previous next_cursor response\n\n- `limit?: number`\n Maximum number of messages to return\n\n- `order?: 'asc' | 'desc'`\n Sort order for messages (asc = oldest first, desc = newest first)\n\n### Returns\n\n- `{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n - `id: string`\n - `chat_id: string`\n - `created_at: string`\n - `is_delivered: boolean`\n - `is_from_me: boolean`\n - `is_read: boolean`\n - `updated_at: string`\n - `delivered_at?: string`\n - `effect?: { name?: string; type?: 'screen' | 'bubble'; }`\n - `from?: string`\n - `from_handle?: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }`\n - `parts?: { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'text'; value: string; text_decorations?: { range: number[]; animation?: 'big' | 'small' | 'shake' | 'nod' | 'explode' | 'ripple' | 'bloom' | 'jitter'; style?: 'bold' | 'italic' | 'strikethrough' | 'underline'; }[]; } | { id: string; filename: string; mime_type: string; reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; size_bytes: number; type: 'media'; url: string; } | { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'link'; value: string; }[]`\n - `preferred_service?: 'iMessage' | 'SMS' | 'RCS'`\n - `read_at?: string`\n - `reply_to?: { message_id: string; part_index?: number; }`\n - `sent_at?: string`\n - `service?: 'iMessage' | 'SMS' | 'RCS'`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\n// Automatically fetches more pages as needed.\nfor await (const message of client.messages.listMessagesThread('69a37c7d-af4f-4b5e-af42-e28e98ce873a')) {\n console.log(message);\n}\n```",
|
|
466
|
+
perLanguage: {
|
|
467
|
+
go: {
|
|
468
|
+
method: 'client.Messages.ListMessagesThread',
|
|
469
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tpage, err := client.Messages.ListMessagesThread(\n\t\tcontext.TODO(),\n\t\t"69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n\t\tlinqgo.MessageListMessagesThreadParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", page)\n}\n',
|
|
470
|
+
},
|
|
471
|
+
http: {
|
|
472
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/messages/$MESSAGE_ID/thread \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
473
|
+
},
|
|
474
|
+
python: {
|
|
475
|
+
method: 'messages.list_messages_thread',
|
|
476
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\npage = client.messages.list_messages_thread(\n message_id="69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n)\npage = page.messages[0]\nprint(page.id)',
|
|
477
|
+
},
|
|
478
|
+
typescript: {
|
|
479
|
+
method: 'client.messages.listMessagesThread',
|
|
480
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\n// Automatically fetches more pages as needed.\nfor await (const message of client.messages.listMessagesThread(\n '69a37c7d-af4f-4b5e-af42-e28e98ce873a',\n)) {\n console.log(message.id);\n}",
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: 'retrieve',
|
|
486
|
+
endpoint: '/v3/messages/{messageId}',
|
|
487
|
+
httpMethod: 'get',
|
|
488
|
+
summary: 'Get a message by ID',
|
|
489
|
+
description: 'Retrieve a specific message by its ID. This endpoint returns the full message\ndetails including text, attachments, reactions, and metadata.\n',
|
|
490
|
+
stainlessPath: '(resource) messages > (method) retrieve',
|
|
491
|
+
qualified: 'client.messages.retrieve',
|
|
492
|
+
params: ['messageId: string;'],
|
|
493
|
+
response: "{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }",
|
|
494
|
+
markdown: "## retrieve\n\n`client.messages.retrieve(messageId: string): { id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: message_effect; from?: string; from_handle?: chat_handle; parts?: text_part_response | media_part_response | link_part_response[]; preferred_service?: service_type; read_at?: string; reply_to?: reply_to; sent_at?: string; service?: service_type; }`\n\n**get** `/v3/messages/{messageId}`\n\nRetrieve a specific message by its ID. This endpoint returns the full message\ndetails including text, attachments, reactions, and metadata.\n\n\n### Parameters\n\n- `messageId: string`\n\n### Returns\n\n- `{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n - `id: string`\n - `chat_id: string`\n - `created_at: string`\n - `is_delivered: boolean`\n - `is_from_me: boolean`\n - `is_read: boolean`\n - `updated_at: string`\n - `delivered_at?: string`\n - `effect?: { name?: string; type?: 'screen' | 'bubble'; }`\n - `from?: string`\n - `from_handle?: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }`\n - `parts?: { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'text'; value: string; text_decorations?: { range: number[]; animation?: 'big' | 'small' | 'shake' | 'nod' | 'explode' | 'ripple' | 'bloom' | 'jitter'; style?: 'bold' | 'italic' | 'strikethrough' | 'underline'; }[]; } | { id: string; filename: string; mime_type: string; reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; size_bytes: number; type: 'media'; url: string; } | { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'link'; value: string; }[]`\n - `preferred_service?: 'iMessage' | 'SMS' | 'RCS'`\n - `read_at?: string`\n - `reply_to?: { message_id: string; part_index?: number; }`\n - `sent_at?: string`\n - `service?: 'iMessage' | 'SMS' | 'RCS'`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst message = await client.messages.retrieve('69a37c7d-af4f-4b5e-af42-e28e98ce873a');\n\nconsole.log(message);\n```",
|
|
495
|
+
perLanguage: {
|
|
496
|
+
go: {
|
|
497
|
+
method: 'client.Messages.Get',
|
|
498
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tmessage, err := client.Messages.Get(context.TODO(), "69a37c7d-af4f-4b5e-af42-e28e98ce873a")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", message.ID)\n}\n',
|
|
499
|
+
},
|
|
500
|
+
http: {
|
|
501
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/messages/$MESSAGE_ID \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
502
|
+
},
|
|
503
|
+
python: {
|
|
504
|
+
method: 'messages.retrieve',
|
|
505
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nmessage = client.messages.retrieve(\n "69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n)\nprint(message.id)',
|
|
506
|
+
},
|
|
507
|
+
typescript: {
|
|
508
|
+
method: 'client.messages.retrieve',
|
|
509
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst message = await client.messages.retrieve('69a37c7d-af4f-4b5e-af42-e28e98ce873a');\n\nconsole.log(message.id);",
|
|
510
|
+
},
|
|
511
|
+
},
|
|
512
|
+
},
|
|
513
|
+
{
|
|
514
|
+
name: 'delete',
|
|
515
|
+
endpoint: '/v3/messages/{messageId}',
|
|
516
|
+
httpMethod: 'delete',
|
|
517
|
+
summary: 'Delete a message from system',
|
|
518
|
+
description: 'Deletes a message from the Linq API only. This does NOT unsend or remove the message\nfrom the actual chat — recipients will still see the message.\n',
|
|
519
|
+
stainlessPath: '(resource) messages > (method) delete',
|
|
520
|
+
qualified: 'client.messages.delete',
|
|
521
|
+
params: ['messageId: string;'],
|
|
522
|
+
markdown: "## delete\n\n`client.messages.delete(messageId: string): void`\n\n**delete** `/v3/messages/{messageId}`\n\nDeletes a message from the Linq API only. This does NOT unsend or remove the message\nfrom the actual chat — recipients will still see the message.\n\n\n### Parameters\n\n- `messageId: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nawait client.messages.delete('69a37c7d-af4f-4b5e-af42-e28e98ce873a')\n```",
|
|
523
|
+
perLanguage: {
|
|
524
|
+
go: {
|
|
525
|
+
method: 'client.Messages.Delete',
|
|
526
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Messages.Delete(context.TODO(), "69a37c7d-af4f-4b5e-af42-e28e98ce873a")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
527
|
+
},
|
|
528
|
+
http: {
|
|
529
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/messages/$MESSAGE_ID \\\n -X DELETE \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
530
|
+
},
|
|
531
|
+
python: {
|
|
532
|
+
method: 'messages.delete',
|
|
533
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.messages.delete(\n "69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n)',
|
|
534
|
+
},
|
|
535
|
+
typescript: {
|
|
536
|
+
method: 'client.messages.delete',
|
|
537
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.messages.delete('69a37c7d-af4f-4b5e-af42-e28e98ce873a');",
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
name: 'add_reaction',
|
|
543
|
+
endpoint: '/v3/messages/{messageId}/reactions',
|
|
544
|
+
httpMethod: 'post',
|
|
545
|
+
summary: 'Add or remove a reaction to a message',
|
|
546
|
+
description: 'Add or remove emoji reactions to messages. Reactions let users express\ntheir response to a message without sending a new message.\n\n**Supported Reactions:**\n- love ❤️\n- like 👍\n- dislike 👎\n- laugh 😂\n- emphasize ‼️\n- question ❓\n- custom - any emoji (use `custom_emoji` field to specify)\n',
|
|
547
|
+
stainlessPath: '(resource) messages > (method) add_reaction',
|
|
548
|
+
qualified: 'client.messages.addReaction',
|
|
549
|
+
params: [
|
|
550
|
+
'messageId: string;',
|
|
551
|
+
"operation: 'add' | 'remove';",
|
|
552
|
+
"type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom' | 'sticker';",
|
|
553
|
+
'custom_emoji?: string;',
|
|
554
|
+
'part_index?: number;',
|
|
555
|
+
],
|
|
556
|
+
response: '{ message?: string; status?: string; trace_id?: string; }',
|
|
557
|
+
markdown: "## add_reaction\n\n`client.messages.addReaction(messageId: string, operation: 'add' | 'remove', type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom' | 'sticker', custom_emoji?: string, part_index?: number): { message?: string; status?: string; trace_id?: string; }`\n\n**post** `/v3/messages/{messageId}/reactions`\n\nAdd or remove emoji reactions to messages. Reactions let users express\ntheir response to a message without sending a new message.\n\n**Supported Reactions:**\n- love ❤️\n- like 👍\n- dislike 👎\n- laugh 😂\n- emphasize ‼️\n- question ❓\n- custom - any emoji (use `custom_emoji` field to specify)\n\n\n### Parameters\n\n- `messageId: string`\n\n- `operation: 'add' | 'remove'`\n Whether to add or remove the reaction\n\n- `type: 'love' | 'like' | 'dislike' | 'laugh' | 'emphasize' | 'question' | 'custom' | 'sticker'`\n Type of reaction. Standard iMessage tapbacks are love, like, dislike, laugh, emphasize, question.\nCustom emoji reactions have type \"custom\" with the actual emoji in the custom_emoji field.\nSticker reactions have type \"sticker\" with sticker attachment details in the sticker field.\n\n\n- `custom_emoji?: string`\n Custom emoji string. Required when type is \"custom\".\n\n\n- `part_index?: number`\n Optional index of the message part to react to.\nIf not provided, reacts to the entire message (part 0).\n\n\n### Returns\n\n- `{ message?: string; status?: string; trace_id?: string; }`\n\n - `message?: string`\n - `status?: string`\n - `trace_id?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst response = await client.messages.addReaction('69a37c7d-af4f-4b5e-af42-e28e98ce873a', { operation: 'add', type: 'love' });\n\nconsole.log(response);\n```",
|
|
558
|
+
perLanguage: {
|
|
559
|
+
go: {
|
|
560
|
+
method: 'client.Messages.AddReaction',
|
|
561
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n\t"github.com/linq-team/linq-go/shared"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tresponse, err := client.Messages.AddReaction(\n\t\tcontext.TODO(),\n\t\t"69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n\t\tlinqgo.MessageAddReactionParams{\n\t\t\tOperation: linqgo.MessageAddReactionParamsOperationAdd,\n\t\t\tType: shared.ReactionTypeLove,\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", response.TraceID)\n}\n',
|
|
562
|
+
},
|
|
563
|
+
http: {
|
|
564
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/messages/$MESSAGE_ID/reactions \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "operation": "add",\n "type": "love",\n "custom_emoji": "😍",\n "part_index": 1\n }\'',
|
|
565
|
+
},
|
|
566
|
+
python: {
|
|
567
|
+
method: 'messages.add_reaction',
|
|
568
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nresponse = client.messages.add_reaction(\n message_id="69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n operation="add",\n type="love",\n)\nprint(response.trace_id)',
|
|
569
|
+
},
|
|
570
|
+
typescript: {
|
|
571
|
+
method: 'client.messages.addReaction',
|
|
572
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst response = await client.messages.addReaction('69a37c7d-af4f-4b5e-af42-e28e98ce873a', {\n operation: 'add',\n type: 'love',\n});\n\nconsole.log(response.trace_id);",
|
|
573
|
+
},
|
|
574
|
+
},
|
|
575
|
+
},
|
|
576
|
+
{
|
|
577
|
+
name: 'update',
|
|
578
|
+
endpoint: '/v3/messages/{messageId}',
|
|
579
|
+
httpMethod: 'patch',
|
|
580
|
+
summary: 'Edit the content of a message part',
|
|
581
|
+
description: 'Edit the text content of a specific part of a previously sent message.\n\n**Note:** A message can be edited up to 5 times, and only within 15 minutes of when it was originally sent.\n',
|
|
582
|
+
stainlessPath: '(resource) messages > (method) update',
|
|
583
|
+
qualified: 'client.messages.update',
|
|
584
|
+
params: ['messageId: string;', 'text: string;', 'part_index?: number;'],
|
|
585
|
+
response: "{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }",
|
|
586
|
+
markdown: "## update\n\n`client.messages.update(messageId: string, text: string, part_index?: number): { id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: message_effect; from?: string; from_handle?: chat_handle; parts?: text_part_response | media_part_response | link_part_response[]; preferred_service?: service_type; read_at?: string; reply_to?: reply_to; sent_at?: string; service?: service_type; }`\n\n**patch** `/v3/messages/{messageId}`\n\nEdit the text content of a specific part of a previously sent message.\n\n**Note:** A message can be edited up to 5 times, and only within 15 minutes of when it was originally sent.\n\n\n### Parameters\n\n- `messageId: string`\n\n- `text: string`\n New text content for the message part\n\n- `part_index?: number`\n Index of the message part to edit. Defaults to 0.\n\n### Returns\n\n- `{ id: string; chat_id: string; created_at: string; is_delivered: boolean; is_from_me: boolean; is_read: boolean; updated_at: string; delivered_at?: string; effect?: { name?: string; type?: 'screen' | 'bubble'; }; from?: string; from_handle?: { id: string; handle: string; joined_at: string; service: service_type; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }; parts?: { reactions: reaction[]; type: 'text'; value: string; text_decorations?: text_decoration[]; } | { id: string; filename: string; mime_type: string; reactions: reaction[]; size_bytes: number; type: 'media'; url: string; } | { reactions: reaction[]; type: 'link'; value: string; }[]; preferred_service?: 'iMessage' | 'SMS' | 'RCS'; read_at?: string; reply_to?: { message_id: string; part_index?: number; }; sent_at?: string; service?: 'iMessage' | 'SMS' | 'RCS'; }`\n\n - `id: string`\n - `chat_id: string`\n - `created_at: string`\n - `is_delivered: boolean`\n - `is_from_me: boolean`\n - `is_read: boolean`\n - `updated_at: string`\n - `delivered_at?: string`\n - `effect?: { name?: string; type?: 'screen' | 'bubble'; }`\n - `from?: string`\n - `from_handle?: { id: string; handle: string; joined_at: string; service: 'iMessage' | 'SMS' | 'RCS'; is_me?: boolean; left_at?: string; status?: 'active' | 'left' | 'removed'; }`\n - `parts?: { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'text'; value: string; text_decorations?: { range: number[]; animation?: 'big' | 'small' | 'shake' | 'nod' | 'explode' | 'ripple' | 'bloom' | 'jitter'; style?: 'bold' | 'italic' | 'strikethrough' | 'underline'; }[]; } | { id: string; filename: string; mime_type: string; reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; size_bytes: number; type: 'media'; url: string; } | { reactions: { handle: chat_handle; is_me: boolean; type: reaction_type; custom_emoji?: string; sticker?: object; }[]; type: 'link'; value: string; }[]`\n - `preferred_service?: 'iMessage' | 'SMS' | 'RCS'`\n - `read_at?: string`\n - `reply_to?: { message_id: string; part_index?: number; }`\n - `sent_at?: string`\n - `service?: 'iMessage' | 'SMS' | 'RCS'`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst message = await client.messages.update('69a37c7d-af4f-4b5e-af42-e28e98ce873a', { text: 'This is the edited message content' });\n\nconsole.log(message);\n```",
|
|
587
|
+
perLanguage: {
|
|
588
|
+
go: {
|
|
589
|
+
method: 'client.Messages.Update',
|
|
590
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tmessage, err := client.Messages.Update(\n\t\tcontext.TODO(),\n\t\t"69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n\t\tlinqgo.MessageUpdateParams{\n\t\t\tText: "This is the edited message content",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", message.ID)\n}\n',
|
|
591
|
+
},
|
|
592
|
+
http: {
|
|
593
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/messages/$MESSAGE_ID \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "text": "This is the edited message content"\n }\'',
|
|
594
|
+
},
|
|
595
|
+
python: {
|
|
596
|
+
method: 'messages.update',
|
|
597
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nmessage = client.messages.update(\n message_id="69a37c7d-af4f-4b5e-af42-e28e98ce873a",\n text="This is the edited message content",\n part_index=0,\n)\nprint(message.id)',
|
|
598
|
+
},
|
|
599
|
+
typescript: {
|
|
600
|
+
method: 'client.messages.update',
|
|
601
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst message = await client.messages.update('69a37c7d-af4f-4b5e-af42-e28e98ce873a', {\n text: 'This is the edited message content',\n});\n\nconsole.log(message.id);",
|
|
602
|
+
},
|
|
603
|
+
},
|
|
604
|
+
},
|
|
605
|
+
{
|
|
606
|
+
name: 'create',
|
|
607
|
+
endpoint: '/v3/attachments',
|
|
608
|
+
httpMethod: 'post',
|
|
609
|
+
summary: 'Pre-upload a file',
|
|
610
|
+
description: '**This endpoint is optional.** You can send media by simply providing a URL in your\nmessage\'s media part — no pre-upload required. Use this endpoint only when you want\nto upload a file ahead of time for reuse or latency optimization.\n\nReturns a presigned upload URL and a permanent `attachment_id` you can reference\nin future messages.\n\n## Step 1: Request an upload URL\n\nCall this endpoint with file metadata:\n\n```json\nPOST /v3/attachments\n{\n "filename": "photo.jpg",\n "content_type": "image/jpeg",\n "size_bytes": 1024000\n}\n```\n\nThe response includes an `upload_url` (valid for 15 minutes) and a permanent `attachment_id`.\n\n## Step 2: Upload the file\n\nMake a PUT request to the `upload_url` with the raw file bytes as the request body.\nYou **must** include all headers from `required_headers` exactly as returned — the presigned URL\nis signed with these values and S3 will reject the upload if they don\'t match.\n\nThe request body is the binary file content — **not** JSON, **not** multipart form data.\nThe file must equal `size_bytes` bytes (the value you declared in step 1).\n\n```bash\ncurl -X PUT "<upload_url from step 1>" \\\n -H "Content-Type: image/jpeg" \\\n -H "Content-Length: 1024000" \\\n --data-binary @photo.jpg\n```\n\n## Step 3: Send a message with the attachment\n\nReference the `attachment_id` in a media part. The ID never expires — use it in as many messages as you want.\n\n```json\nPOST /v3/chats\n{\n "from": "+15559876543",\n "to": ["+15551234567"],\n "message": {\n "parts": [\n { "type": "media", "attachment_id": "<attachment_id from step 1>" }\n ]\n }\n}\n```\n\n## When to use this instead of a URL in the media part\n\n- Sending the same file to multiple recipients (avoids re-downloading each time)\n- Large files where you want to separate upload from message send\n- Latency-sensitive sends where the file should already be stored\n\nIf you just need to send a file once, skip all of this and pass a `url` directly in the media part instead.\n\n**File Size Limit:** 100MB\n\n**Unsupported Types:** WebP, SVG, FLAC, OGG, and executable files are explicitly rejected.\n',
|
|
611
|
+
stainlessPath: '(resource) attachments > (method) create',
|
|
612
|
+
qualified: 'client.attachments.create',
|
|
613
|
+
params: ['content_type: string;', 'filename: string;', 'size_bytes: number;'],
|
|
614
|
+
response: "{ attachment_id: string; download_url: string; expires_at: string; http_method: 'PUT'; required_headers: object; upload_url: string; }",
|
|
615
|
+
markdown: '## create\n\n`client.attachments.create(content_type: string, filename: string, size_bytes: number): { attachment_id: string; download_url: string; expires_at: string; http_method: \'PUT\'; required_headers: object; upload_url: string; }`\n\n**post** `/v3/attachments`\n\n**This endpoint is optional.** You can send media by simply providing a URL in your\nmessage\'s media part — no pre-upload required. Use this endpoint only when you want\nto upload a file ahead of time for reuse or latency optimization.\n\nReturns a presigned upload URL and a permanent `attachment_id` you can reference\nin future messages.\n\n## Step 1: Request an upload URL\n\nCall this endpoint with file metadata:\n\n```json\nPOST /v3/attachments\n{\n "filename": "photo.jpg",\n "content_type": "image/jpeg",\n "size_bytes": 1024000\n}\n```\n\nThe response includes an `upload_url` (valid for 15 minutes) and a permanent `attachment_id`.\n\n## Step 2: Upload the file\n\nMake a PUT request to the `upload_url` with the raw file bytes as the request body.\nYou **must** include all headers from `required_headers` exactly as returned — the presigned URL\nis signed with these values and S3 will reject the upload if they don\'t match.\n\nThe request body is the binary file content — **not** JSON, **not** multipart form data.\nThe file must equal `size_bytes` bytes (the value you declared in step 1).\n\n```bash\ncurl -X PUT "<upload_url from step 1>" \\\n -H "Content-Type: image/jpeg" \\\n -H "Content-Length: 1024000" \\\n --data-binary @photo.jpg\n```\n\n## Step 3: Send a message with the attachment\n\nReference the `attachment_id` in a media part. The ID never expires — use it in as many messages as you want.\n\n```json\nPOST /v3/chats\n{\n "from": "+15559876543",\n "to": ["+15551234567"],\n "message": {\n "parts": [\n { "type": "media", "attachment_id": "<attachment_id from step 1>" }\n ]\n }\n}\n```\n\n## When to use this instead of a URL in the media part\n\n- Sending the same file to multiple recipients (avoids re-downloading each time)\n- Large files where you want to separate upload from message send\n- Latency-sensitive sends where the file should already be stored\n\nIf you just need to send a file once, skip all of this and pass a `url` directly in the media part instead.\n\n**File Size Limit:** 100MB\n\n**Unsupported Types:** WebP, SVG, FLAC, OGG, and executable files are explicitly rejected.\n\n\n### Parameters\n\n- `content_type: string`\n Supported MIME types for file attachments and media URLs.\n\n**Images:** image/jpeg, image/png, image/gif, image/heic, image/heif, image/tiff, image/bmp, image/svg+xml, image/webp, image/x-icon\n\n**Videos:** video/mp4, video/quicktime, video/mpeg, video/mpeg2, video/x-msvideo, video/3gpp\n\n**Audio:** audio/mpeg, audio/x-m4a, audio/x-caf, audio/x-wav, audio/x-aiff, audio/aac, audio/midi, audio/amr\n\n**Documents:** application/pdf, text/plain, text/markdown, text/vcard, text/rtf, text/csv, text/html, text/calendar, text/xml, application/json, application/msword, application/vnd.openxmlformats-officedocument.wordprocessingml.document, application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-powerpoint, application/vnd.openxmlformats-officedocument.presentationml.presentation, application/x-iwork-pages-sffpages, application/x-iwork-numbers-sffnumbers, application/x-iwork-keynote-sffkey, application/epub+zip, application/zip, application/x-gzip\n\n**Transcoded on delivery:**\n- `audio/x-caf` — CAF files are transcoded to `audio/mp4` for delivery.\n\n**Deprecated (accepted but transcoded):**\n- `audio/mp3` — Deprecated. Use `audio/mpeg` instead. Files sent as audio/mp3 will be delivered as audio/mpeg.\n- `audio/mp4` — Deprecated. Use `audio/x-m4a` instead. Files sent as audio/mp4 will be delivered as audio/x-m4a.\n- `audio/aiff` — Deprecated. Use `audio/x-aiff` instead. Files sent as audio/aiff will be delivered as audio/x-aiff.\n- `image/tiff` — Accepted, but TIFF images are transcoded to JPEG for delivery.\n\n**Unsupported:** FLAC, OGG, and executable files are explicitly rejected.\n\n\n- `filename: string`\n Name of the file to upload\n\n- `size_bytes: number`\n Size of the file in bytes (max 100MB)\n\n### Returns\n\n- `{ attachment_id: string; download_url: string; expires_at: string; http_method: \'PUT\'; required_headers: object; upload_url: string; }`\n\n - `attachment_id: string`\n - `download_url: string`\n - `expires_at: string`\n - `http_method: \'PUT\'`\n - `required_headers: object`\n - `upload_url: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from \'@linqapp/sdk\';\n\nconst client = new LinqAPIV3();\n\nconst attachment = await client.attachments.create({\n content_type: \'image/jpeg\',\n filename: \'photo.jpg\',\n size_bytes: 1024000,\n});\n\nconsole.log(attachment);\n```',
|
|
616
|
+
perLanguage: {
|
|
617
|
+
go: {
|
|
618
|
+
method: 'client.Attachments.New',
|
|
619
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tattachment, err := client.Attachments.New(context.TODO(), linqgo.AttachmentNewParams{\n\t\tContentType: linqgo.SupportedContentTypeImageJpeg,\n\t\tFilename: "photo.jpg",\n\t\tSizeBytes: 1024000,\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", attachment.AttachmentID)\n}\n',
|
|
620
|
+
},
|
|
621
|
+
http: {
|
|
622
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/attachments \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "content_type": "image/jpeg",\n "filename": "photo.jpg",\n "size_bytes": 1024000\n }\'',
|
|
623
|
+
},
|
|
624
|
+
python: {
|
|
625
|
+
method: 'attachments.create',
|
|
626
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nattachment = client.attachments.create(\n content_type="image/jpeg",\n filename="photo.jpg",\n size_bytes=1024000,\n)\nprint(attachment.attachment_id)',
|
|
627
|
+
},
|
|
628
|
+
typescript: {
|
|
629
|
+
method: 'client.attachments.create',
|
|
630
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst attachment = await client.attachments.create({\n content_type: 'image/jpeg',\n filename: 'photo.jpg',\n size_bytes: 1024000,\n});\n\nconsole.log(attachment.attachment_id);",
|
|
631
|
+
},
|
|
632
|
+
},
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
name: 'retrieve',
|
|
636
|
+
endpoint: '/v3/attachments/{attachmentId}',
|
|
637
|
+
httpMethod: 'get',
|
|
638
|
+
summary: 'Get attachment metadata',
|
|
639
|
+
description: 'Retrieve metadata for a specific attachment including its status,\nfile information, and URLs for downloading.\n',
|
|
640
|
+
stainlessPath: '(resource) attachments > (method) retrieve',
|
|
641
|
+
qualified: 'client.attachments.retrieve',
|
|
642
|
+
params: ['attachmentId: string;'],
|
|
643
|
+
response: "{ id: string; content_type: string; created_at: string; filename: string; size_bytes: number; status: 'pending' | 'complete' | 'failed'; download_url?: string; }",
|
|
644
|
+
markdown: "## retrieve\n\n`client.attachments.retrieve(attachmentId: string): { id: string; content_type: supported_content_type; created_at: string; filename: string; size_bytes: number; status: 'pending' | 'complete' | 'failed'; download_url?: string; }`\n\n**get** `/v3/attachments/{attachmentId}`\n\nRetrieve metadata for a specific attachment including its status,\nfile information, and URLs for downloading.\n\n\n### Parameters\n\n- `attachmentId: string`\n\n### Returns\n\n- `{ id: string; content_type: string; created_at: string; filename: string; size_bytes: number; status: 'pending' | 'complete' | 'failed'; download_url?: string; }`\n\n - `id: string`\n - `content_type: string`\n - `created_at: string`\n - `filename: string`\n - `size_bytes: number`\n - `status: 'pending' | 'complete' | 'failed'`\n - `download_url?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst attachment = await client.attachments.retrieve('abc12345-1234-5678-9abc-def012345678');\n\nconsole.log(attachment);\n```",
|
|
645
|
+
perLanguage: {
|
|
646
|
+
go: {
|
|
647
|
+
method: 'client.Attachments.Get',
|
|
648
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tattachment, err := client.Attachments.Get(context.TODO(), "abc12345-1234-5678-9abc-def012345678")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", attachment.ID)\n}\n',
|
|
649
|
+
},
|
|
650
|
+
http: {
|
|
651
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/attachments/$ATTACHMENT_ID \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
652
|
+
},
|
|
653
|
+
python: {
|
|
654
|
+
method: 'attachments.retrieve',
|
|
655
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nattachment = client.attachments.retrieve(\n "abc12345-1234-5678-9abc-def012345678",\n)\nprint(attachment.id)',
|
|
656
|
+
},
|
|
657
|
+
typescript: {
|
|
658
|
+
method: 'client.attachments.retrieve',
|
|
659
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst attachment = await client.attachments.retrieve('abc12345-1234-5678-9abc-def012345678');\n\nconsole.log(attachment.id);",
|
|
660
|
+
},
|
|
661
|
+
},
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
name: 'list',
|
|
665
|
+
endpoint: '/v3/phonenumbers',
|
|
666
|
+
httpMethod: 'get',
|
|
667
|
+
summary: 'List phone numbers (deprecated)',
|
|
668
|
+
description: '**Deprecated.** Use `GET /v3/phone_numbers` instead.\n',
|
|
669
|
+
stainlessPath: '(resource) phonenumbers > (method) list',
|
|
670
|
+
qualified: 'client.phonenumbers.list',
|
|
671
|
+
response: '{ phone_numbers: { id: string; phone_number: string; capabilities?: { mms: boolean; sms: boolean; voice: boolean; }; country_code?: string; type?: string; }[]; }',
|
|
672
|
+
markdown: "## list\n\n`client.phonenumbers.list(): { phone_numbers: object[]; }`\n\n**get** `/v3/phonenumbers`\n\n**Deprecated.** Use `GET /v3/phone_numbers` instead.\n\n\n### Returns\n\n- `{ phone_numbers: { id: string; phone_number: string; capabilities?: { mms: boolean; sms: boolean; voice: boolean; }; country_code?: string; type?: string; }[]; }`\n\n - `phone_numbers: { id: string; phone_number: string; capabilities?: { mms: boolean; sms: boolean; voice: boolean; }; country_code?: string; type?: string; }[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst phonenumbers = await client.phonenumbers.list();\n\nconsole.log(phonenumbers);\n```",
|
|
673
|
+
perLanguage: {
|
|
674
|
+
go: {
|
|
675
|
+
method: 'client.Phonenumbers.List',
|
|
676
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tphonenumbers, err := client.Phonenumbers.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", phonenumbers.PhoneNumbers)\n}\n',
|
|
677
|
+
},
|
|
678
|
+
http: {
|
|
679
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/phonenumbers \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
680
|
+
},
|
|
681
|
+
python: {
|
|
682
|
+
method: 'phonenumbers.list',
|
|
683
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nphonenumbers = client.phonenumbers.list()\nprint(phonenumbers.phone_numbers)',
|
|
684
|
+
},
|
|
685
|
+
typescript: {
|
|
686
|
+
method: 'client.phonenumbers.list',
|
|
687
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst phonenumbers = await client.phonenumbers.list();\n\nconsole.log(phonenumbers.phone_numbers);",
|
|
688
|
+
},
|
|
689
|
+
},
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
name: 'list',
|
|
693
|
+
endpoint: '/v3/phone_numbers',
|
|
694
|
+
httpMethod: 'get',
|
|
695
|
+
summary: 'List phone numbers',
|
|
696
|
+
description: 'Returns all phone numbers assigned to the authenticated partner.\nUse this endpoint to discover which phone numbers are available for\nuse as the `from` field when creating a chat, listing chats, or sending a voice memo.\n',
|
|
697
|
+
stainlessPath: '(resource) phone_numbers > (method) list',
|
|
698
|
+
qualified: 'client.phoneNumbers.list',
|
|
699
|
+
response: '{ phone_numbers: { id: string; phone_number: string; }[]; }',
|
|
700
|
+
markdown: "## list\n\n`client.phoneNumbers.list(): { phone_numbers: object[]; }`\n\n**get** `/v3/phone_numbers`\n\nReturns all phone numbers assigned to the authenticated partner.\nUse this endpoint to discover which phone numbers are available for\nuse as the `from` field when creating a chat, listing chats, or sending a voice memo.\n\n\n### Returns\n\n- `{ phone_numbers: { id: string; phone_number: string; }[]; }`\n\n - `phone_numbers: { id: string; phone_number: string; }[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst phoneNumbers = await client.phoneNumbers.list();\n\nconsole.log(phoneNumbers);\n```",
|
|
701
|
+
perLanguage: {
|
|
702
|
+
go: {
|
|
703
|
+
method: 'client.PhoneNumbers.List',
|
|
704
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tphoneNumbers, err := client.PhoneNumbers.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", phoneNumbers.PhoneNumbers)\n}\n',
|
|
705
|
+
},
|
|
706
|
+
http: {
|
|
707
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/phone_numbers \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
708
|
+
},
|
|
709
|
+
python: {
|
|
710
|
+
method: 'phone_numbers.list',
|
|
711
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nphone_numbers = client.phone_numbers.list()\nprint(phone_numbers.phone_numbers)',
|
|
712
|
+
},
|
|
713
|
+
typescript: {
|
|
714
|
+
method: 'client.phoneNumbers.list',
|
|
715
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst phoneNumbers = await client.phoneNumbers.list();\n\nconsole.log(phoneNumbers.phone_numbers);",
|
|
716
|
+
},
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
name: 'list',
|
|
721
|
+
endpoint: '/v3/webhook-events',
|
|
722
|
+
httpMethod: 'get',
|
|
723
|
+
summary: 'List available webhook event types',
|
|
724
|
+
description: 'Returns all available webhook event types that can be subscribed to.\nUse this endpoint to discover valid values for the `subscribed_events`\nfield when creating or updating webhook subscriptions.\n',
|
|
725
|
+
stainlessPath: '(resource) webhook_events > (method) list',
|
|
726
|
+
qualified: 'client.webhookEvents.list',
|
|
727
|
+
response: "{ doc_url: 'https://apidocs.linqapp.com/documentation/webhook-events'; events: string[]; }",
|
|
728
|
+
markdown: "## list\n\n`client.webhookEvents.list(): { doc_url: 'https://apidocs.linqapp.com/documentation/webhook-events'; events: webhook_event_type[]; }`\n\n**get** `/v3/webhook-events`\n\nReturns all available webhook event types that can be subscribed to.\nUse this endpoint to discover valid values for the `subscribed_events`\nfield when creating or updating webhook subscriptions.\n\n\n### Returns\n\n- `{ doc_url: 'https://apidocs.linqapp.com/documentation/webhook-events'; events: string[]; }`\n\n - `doc_url: 'https://apidocs.linqapp.com/documentation/webhook-events'`\n - `events: string[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst webhookEvents = await client.webhookEvents.list();\n\nconsole.log(webhookEvents);\n```",
|
|
729
|
+
perLanguage: {
|
|
730
|
+
go: {
|
|
731
|
+
method: 'client.WebhookEvents.List',
|
|
732
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhookEvents, err := client.WebhookEvents.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhookEvents.DocURL)\n}\n',
|
|
733
|
+
},
|
|
734
|
+
http: {
|
|
735
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/webhook-events \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
736
|
+
},
|
|
737
|
+
python: {
|
|
738
|
+
method: 'webhook_events.list',
|
|
739
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nwebhook_events = client.webhook_events.list()\nprint(webhook_events.doc_url)',
|
|
740
|
+
},
|
|
741
|
+
typescript: {
|
|
742
|
+
method: 'client.webhookEvents.list',
|
|
743
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst webhookEvents = await client.webhookEvents.list();\n\nconsole.log(webhookEvents.doc_url);",
|
|
744
|
+
},
|
|
745
|
+
},
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
name: 'create',
|
|
749
|
+
endpoint: '/v3/webhook-subscriptions',
|
|
750
|
+
httpMethod: 'post',
|
|
751
|
+
summary: 'Create a new webhook subscription',
|
|
752
|
+
description: 'Create a new webhook subscription to receive events at a target URL.\nUpon creation, a signing secret is generated for verifying webhook\nauthenticity. **Store this secret securely — it cannot be retrieved later.**\n\n**Phone Number Filtering:**\n- Optionally specify `phone_numbers` to only receive events for specific lines\n- If omitted, events from all phone numbers are delivered (default behavior)\n- Use multiple subscriptions with different `phone_numbers` to route different lines to different endpoints\n- Each `target_url` can only be used once per account. To route different\n lines to different destinations, use a unique URL per subscription\n (e.g., append a query parameter: `https://example.com/webhook?line=1`)\n\n**Webhook Delivery:**\n- Events are sent via HTTP POST to the target URL\n- Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers\n- Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see [Webhook Events](/docs/webhook-events) for verification details\n- Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25 minutes with exponential backoff\n- Client errors (4xx except 429) are not retried\n',
|
|
753
|
+
stainlessPath: '(resource) webhook_subscriptions > (method) create',
|
|
754
|
+
qualified: 'client.webhookSubscriptions.create',
|
|
755
|
+
params: ['subscribed_events: string[];', 'target_url: string;', 'phone_numbers?: string[];'],
|
|
756
|
+
response: '{ id: string; created_at: string; is_active: boolean; signing_secret: string; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }',
|
|
757
|
+
markdown: "## create\n\n`client.webhookSubscriptions.create(subscribed_events: string[], target_url: string, phone_numbers?: string[]): { id: string; created_at: string; is_active: boolean; signing_secret: string; subscribed_events: webhook_event_type[]; target_url: string; updated_at: string; phone_numbers?: string[]; }`\n\n**post** `/v3/webhook-subscriptions`\n\nCreate a new webhook subscription to receive events at a target URL.\nUpon creation, a signing secret is generated for verifying webhook\nauthenticity. **Store this secret securely — it cannot be retrieved later.**\n\n**Phone Number Filtering:**\n- Optionally specify `phone_numbers` to only receive events for specific lines\n- If omitted, events from all phone numbers are delivered (default behavior)\n- Use multiple subscriptions with different `phone_numbers` to route different lines to different endpoints\n- Each `target_url` can only be used once per account. To route different\n lines to different destinations, use a unique URL per subscription\n (e.g., append a query parameter: `https://example.com/webhook?line=1`)\n\n**Webhook Delivery:**\n- Events are sent via HTTP POST to the target URL\n- Each request includes `X-Webhook-Signature` and `X-Webhook-Timestamp` headers\n- Signature is HMAC-SHA256 over `{timestamp}.{payload}` — see [Webhook Events](/docs/webhook-events) for verification details\n- Failed deliveries (5xx, 429, network errors) are retried up to 10 times over ~25 minutes with exponential backoff\n- Client errors (4xx except 429) are not retried\n\n\n### Parameters\n\n- `subscribed_events: string[]`\n List of event types to subscribe to\n\n- `target_url: string`\n URL where webhook events will be sent. Must be HTTPS.\n\n- `phone_numbers?: string[]`\n Optional list of phone numbers to filter events for. Only events originating from these phone numbers will be delivered to this subscription. If omitted or empty, events from all phone numbers are delivered. Phone numbers must be in E.164 format.\n\n### Returns\n\n- `{ id: string; created_at: string; is_active: boolean; signing_secret: string; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }`\n Response returned when creating a webhook subscription. Includes the signing secret which is only shown once.\n\n - `id: string`\n - `created_at: string`\n - `is_active: boolean`\n - `signing_secret: string`\n - `subscribed_events: string[]`\n - `target_url: string`\n - `updated_at: string`\n - `phone_numbers?: string[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst webhookSubscription = await client.webhookSubscriptions.create({ subscribed_events: ['message.sent', 'message.delivered', 'message.read'], target_url: 'https://webhooks.example.com/linq/events' });\n\nconsole.log(webhookSubscription);\n```",
|
|
758
|
+
perLanguage: {
|
|
759
|
+
go: {
|
|
760
|
+
method: 'client.WebhookSubscriptions.New',
|
|
761
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhookSubscription, err := client.WebhookSubscriptions.New(context.TODO(), linqgo.WebhookSubscriptionNewParams{\n\t\tSubscribedEvents: []linqgo.WebhookEventType{linqgo.WebhookEventTypeMessageSent, linqgo.WebhookEventTypeMessageDelivered, linqgo.WebhookEventTypeMessageRead},\n\t\tTargetURL: "https://webhooks.example.com/linq/events",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhookSubscription.ID)\n}\n',
|
|
762
|
+
},
|
|
763
|
+
http: {
|
|
764
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/webhook-subscriptions \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "subscribed_events": [\n "message.sent",\n "message.delivered",\n "message.read"\n ],\n "target_url": "https://webhooks.example.com/linq/events",\n "phone_numbers": [\n "+12025551234",\n "+12025559876"\n ]\n }\'',
|
|
765
|
+
},
|
|
766
|
+
python: {
|
|
767
|
+
method: 'webhook_subscriptions.create',
|
|
768
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nwebhook_subscription = client.webhook_subscriptions.create(\n subscribed_events=["message.sent", "message.delivered", "message.read"],\n target_url="https://webhooks.example.com/linq/events",\n)\nprint(webhook_subscription.id)',
|
|
769
|
+
},
|
|
770
|
+
typescript: {
|
|
771
|
+
method: 'client.webhookSubscriptions.create',
|
|
772
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst webhookSubscription = await client.webhookSubscriptions.create({\n subscribed_events: ['message.sent', 'message.delivered', 'message.read'],\n target_url: 'https://webhooks.example.com/linq/events',\n});\n\nconsole.log(webhookSubscription.id);",
|
|
773
|
+
},
|
|
774
|
+
},
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
name: 'list',
|
|
778
|
+
endpoint: '/v3/webhook-subscriptions',
|
|
779
|
+
httpMethod: 'get',
|
|
780
|
+
summary: 'List all webhook subscriptions',
|
|
781
|
+
description: 'Retrieve all webhook subscriptions for the authenticated partner.\nReturns a list of active and inactive subscriptions with their\nconfiguration and status.\n',
|
|
782
|
+
stainlessPath: '(resource) webhook_subscriptions > (method) list',
|
|
783
|
+
qualified: 'client.webhookSubscriptions.list',
|
|
784
|
+
response: '{ subscriptions: { id: string; created_at: string; is_active: boolean; subscribed_events: webhook_event_type[]; target_url: string; updated_at: string; phone_numbers?: string[]; }[]; }',
|
|
785
|
+
markdown: "## list\n\n`client.webhookSubscriptions.list(): { subscriptions: webhook_subscription[]; }`\n\n**get** `/v3/webhook-subscriptions`\n\nRetrieve all webhook subscriptions for the authenticated partner.\nReturns a list of active and inactive subscriptions with their\nconfiguration and status.\n\n\n### Returns\n\n- `{ subscriptions: { id: string; created_at: string; is_active: boolean; subscribed_events: webhook_event_type[]; target_url: string; updated_at: string; phone_numbers?: string[]; }[]; }`\n\n - `subscriptions: { id: string; created_at: string; is_active: boolean; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst webhookSubscriptions = await client.webhookSubscriptions.list();\n\nconsole.log(webhookSubscriptions);\n```",
|
|
786
|
+
perLanguage: {
|
|
787
|
+
go: {
|
|
788
|
+
method: 'client.WebhookSubscriptions.List',
|
|
789
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhookSubscriptions, err := client.WebhookSubscriptions.List(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhookSubscriptions.Subscriptions)\n}\n',
|
|
790
|
+
},
|
|
791
|
+
http: {
|
|
792
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/webhook-subscriptions \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
793
|
+
},
|
|
794
|
+
python: {
|
|
795
|
+
method: 'webhook_subscriptions.list',
|
|
796
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nwebhook_subscriptions = client.webhook_subscriptions.list()\nprint(webhook_subscriptions.subscriptions)',
|
|
797
|
+
},
|
|
798
|
+
typescript: {
|
|
799
|
+
method: 'client.webhookSubscriptions.list',
|
|
800
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst webhookSubscriptions = await client.webhookSubscriptions.list();\n\nconsole.log(webhookSubscriptions.subscriptions);",
|
|
801
|
+
},
|
|
802
|
+
},
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
name: 'retrieve',
|
|
806
|
+
endpoint: '/v3/webhook-subscriptions/{subscriptionId}',
|
|
807
|
+
httpMethod: 'get',
|
|
808
|
+
summary: 'Get a webhook subscription by ID',
|
|
809
|
+
description: 'Retrieve details for a specific webhook subscription including its\ntarget URL, subscribed events, and current status.\n',
|
|
810
|
+
stainlessPath: '(resource) webhook_subscriptions > (method) retrieve',
|
|
811
|
+
qualified: 'client.webhookSubscriptions.retrieve',
|
|
812
|
+
params: ['subscriptionId: string;'],
|
|
813
|
+
response: '{ id: string; created_at: string; is_active: boolean; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }',
|
|
814
|
+
markdown: "## retrieve\n\n`client.webhookSubscriptions.retrieve(subscriptionId: string): { id: string; created_at: string; is_active: boolean; subscribed_events: webhook_event_type[]; target_url: string; updated_at: string; phone_numbers?: string[]; }`\n\n**get** `/v3/webhook-subscriptions/{subscriptionId}`\n\nRetrieve details for a specific webhook subscription including its\ntarget URL, subscribed events, and current status.\n\n\n### Parameters\n\n- `subscriptionId: string`\n\n### Returns\n\n- `{ id: string; created_at: string; is_active: boolean; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }`\n\n - `id: string`\n - `created_at: string`\n - `is_active: boolean`\n - `subscribed_events: string[]`\n - `target_url: string`\n - `updated_at: string`\n - `phone_numbers?: string[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst webhookSubscription = await client.webhookSubscriptions.retrieve('b2c3d4e5-f6a7-8901-bcde-f23456789012');\n\nconsole.log(webhookSubscription);\n```",
|
|
815
|
+
perLanguage: {
|
|
816
|
+
go: {
|
|
817
|
+
method: 'client.WebhookSubscriptions.Get',
|
|
818
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhookSubscription, err := client.WebhookSubscriptions.Get(context.TODO(), "b2c3d4e5-f6a7-8901-bcde-f23456789012")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhookSubscription.ID)\n}\n',
|
|
819
|
+
},
|
|
820
|
+
http: {
|
|
821
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/webhook-subscriptions/$SUBSCRIPTION_ID \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
822
|
+
},
|
|
823
|
+
python: {
|
|
824
|
+
method: 'webhook_subscriptions.retrieve',
|
|
825
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nwebhook_subscription = client.webhook_subscriptions.retrieve(\n "b2c3d4e5-f6a7-8901-bcde-f23456789012",\n)\nprint(webhook_subscription.id)',
|
|
826
|
+
},
|
|
827
|
+
typescript: {
|
|
828
|
+
method: 'client.webhookSubscriptions.retrieve',
|
|
829
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst webhookSubscription = await client.webhookSubscriptions.retrieve(\n 'b2c3d4e5-f6a7-8901-bcde-f23456789012',\n);\n\nconsole.log(webhookSubscription.id);",
|
|
830
|
+
},
|
|
831
|
+
},
|
|
832
|
+
},
|
|
833
|
+
{
|
|
834
|
+
name: 'update',
|
|
835
|
+
endpoint: '/v3/webhook-subscriptions/{subscriptionId}',
|
|
836
|
+
httpMethod: 'put',
|
|
837
|
+
summary: 'Update a webhook subscription',
|
|
838
|
+
description: 'Update an existing webhook subscription. You can modify the target URL,\nsubscribed events, or activate/deactivate the subscription.\n\n**Note:** The signing secret cannot be changed via this endpoint.\n',
|
|
839
|
+
stainlessPath: '(resource) webhook_subscriptions > (method) update',
|
|
840
|
+
qualified: 'client.webhookSubscriptions.update',
|
|
841
|
+
params: [
|
|
842
|
+
'subscriptionId: string;',
|
|
843
|
+
'is_active?: boolean;',
|
|
844
|
+
'phone_numbers?: string[];',
|
|
845
|
+
'subscribed_events?: string[];',
|
|
846
|
+
'target_url?: string;',
|
|
847
|
+
],
|
|
848
|
+
response: '{ id: string; created_at: string; is_active: boolean; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }',
|
|
849
|
+
markdown: "## update\n\n`client.webhookSubscriptions.update(subscriptionId: string, is_active?: boolean, phone_numbers?: string[], subscribed_events?: string[], target_url?: string): { id: string; created_at: string; is_active: boolean; subscribed_events: webhook_event_type[]; target_url: string; updated_at: string; phone_numbers?: string[]; }`\n\n**put** `/v3/webhook-subscriptions/{subscriptionId}`\n\nUpdate an existing webhook subscription. You can modify the target URL,\nsubscribed events, or activate/deactivate the subscription.\n\n**Note:** The signing secret cannot be changed via this endpoint.\n\n\n### Parameters\n\n- `subscriptionId: string`\n\n- `is_active?: boolean`\n Activate or deactivate the subscription\n\n- `phone_numbers?: string[]`\n Updated list of phone numbers to filter events for. Set to a non-empty array to filter events to specific phone numbers. Set to an empty array or null to remove the filter and receive events from all phone numbers. Phone numbers must be in E.164 format.\n\n- `subscribed_events?: string[]`\n Updated list of event types to subscribe to\n\n- `target_url?: string`\n New target URL for webhook events\n\n### Returns\n\n- `{ id: string; created_at: string; is_active: boolean; subscribed_events: string[]; target_url: string; updated_at: string; phone_numbers?: string[]; }`\n\n - `id: string`\n - `created_at: string`\n - `is_active: boolean`\n - `subscribed_events: string[]`\n - `target_url: string`\n - `updated_at: string`\n - `phone_numbers?: string[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst webhookSubscription = await client.webhookSubscriptions.update('b2c3d4e5-f6a7-8901-bcde-f23456789012');\n\nconsole.log(webhookSubscription);\n```",
|
|
850
|
+
perLanguage: {
|
|
851
|
+
go: {
|
|
852
|
+
method: 'client.WebhookSubscriptions.Update',
|
|
853
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\twebhookSubscription, err := client.WebhookSubscriptions.Update(\n\t\tcontext.TODO(),\n\t\t"b2c3d4e5-f6a7-8901-bcde-f23456789012",\n\t\tlinqgo.WebhookSubscriptionUpdateParams{\n\t\t\tTargetURL: linqgo.String("https://webhooks.example.com/linq/events"),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", webhookSubscription.ID)\n}\n',
|
|
854
|
+
},
|
|
855
|
+
http: {
|
|
856
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/webhook-subscriptions/$SUBSCRIPTION_ID \\\n -X PUT \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "is_active": true,\n "phone_numbers": [\n "+12025551234"\n ],\n "subscribed_events": [\n "message.sent",\n "message.delivered"\n ],\n "target_url": "https://webhooks.example.com/linq/events"\n }\'',
|
|
857
|
+
},
|
|
858
|
+
python: {
|
|
859
|
+
method: 'webhook_subscriptions.update',
|
|
860
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nwebhook_subscription = client.webhook_subscriptions.update(\n subscription_id="b2c3d4e5-f6a7-8901-bcde-f23456789012",\n target_url="https://webhooks.example.com/linq/events",\n)\nprint(webhook_subscription.id)',
|
|
861
|
+
},
|
|
862
|
+
typescript: {
|
|
863
|
+
method: 'client.webhookSubscriptions.update',
|
|
864
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst webhookSubscription = await client.webhookSubscriptions.update(\n 'b2c3d4e5-f6a7-8901-bcde-f23456789012',\n { target_url: 'https://webhooks.example.com/linq/events' },\n);\n\nconsole.log(webhookSubscription.id);",
|
|
865
|
+
},
|
|
866
|
+
},
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
name: 'delete',
|
|
870
|
+
endpoint: '/v3/webhook-subscriptions/{subscriptionId}',
|
|
871
|
+
httpMethod: 'delete',
|
|
872
|
+
summary: 'Delete a webhook subscription',
|
|
873
|
+
description: 'Delete a webhook subscription.',
|
|
874
|
+
stainlessPath: '(resource) webhook_subscriptions > (method) delete',
|
|
875
|
+
qualified: 'client.webhookSubscriptions.delete',
|
|
876
|
+
params: ['subscriptionId: string;'],
|
|
877
|
+
markdown: "## delete\n\n`client.webhookSubscriptions.delete(subscriptionId: string): void`\n\n**delete** `/v3/webhook-subscriptions/{subscriptionId}`\n\nDelete a webhook subscription.\n\n### Parameters\n\n- `subscriptionId: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nawait client.webhookSubscriptions.delete('b2c3d4e5-f6a7-8901-bcde-f23456789012')\n```",
|
|
878
|
+
perLanguage: {
|
|
879
|
+
go: {
|
|
880
|
+
method: 'client.WebhookSubscriptions.Delete',
|
|
881
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.WebhookSubscriptions.Delete(context.TODO(), "b2c3d4e5-f6a7-8901-bcde-f23456789012")\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
882
|
+
},
|
|
883
|
+
http: {
|
|
884
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/webhook-subscriptions/$SUBSCRIPTION_ID \\\n -X DELETE \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
885
|
+
},
|
|
886
|
+
python: {
|
|
887
|
+
method: 'webhook_subscriptions.delete',
|
|
888
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.webhook_subscriptions.delete(\n "b2c3d4e5-f6a7-8901-bcde-f23456789012",\n)',
|
|
889
|
+
},
|
|
890
|
+
typescript: {
|
|
891
|
+
method: 'client.webhookSubscriptions.delete',
|
|
892
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.webhookSubscriptions.delete('b2c3d4e5-f6a7-8901-bcde-f23456789012');",
|
|
893
|
+
},
|
|
894
|
+
},
|
|
895
|
+
},
|
|
896
|
+
{
|
|
897
|
+
name: 'check_imessage',
|
|
898
|
+
endpoint: '/v3/capability/check_imessage',
|
|
899
|
+
httpMethod: 'post',
|
|
900
|
+
summary: 'Check iMessage capability',
|
|
901
|
+
description: 'Check whether a recipient address (phone number or email) is reachable via iMessage.\n',
|
|
902
|
+
stainlessPath: '(resource) capability > (method) check_imessage',
|
|
903
|
+
qualified: 'client.capability.checkiMessage',
|
|
904
|
+
params: ['address: string;', 'from?: string;'],
|
|
905
|
+
response: '{ address: string; available: boolean; }',
|
|
906
|
+
markdown: "## check_imessage\n\n`client.capability.checkiMessage(address: string, from?: string): { address: string; available: boolean; }`\n\n**post** `/v3/capability/check_imessage`\n\nCheck whether a recipient address (phone number or email) is reachable via iMessage.\n\n\n### Parameters\n\n- `address: string`\n The recipient phone number or email address to check\n\n- `from?: string`\n Optional sender phone number. If omitted, an available phone from your pool is used automatically.\n\n### Returns\n\n- `{ address: string; available: boolean; }`\n\n - `address: string`\n - `available: boolean`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst handleCheckResponse = await client.capability.checkiMessage({ address: '+15551234567' });\n\nconsole.log(handleCheckResponse);\n```",
|
|
907
|
+
perLanguage: {
|
|
908
|
+
go: {
|
|
909
|
+
method: 'client.Capability.CheckiMessage',
|
|
910
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\thandleCheckResponse, err := client.Capability.CheckiMessage(context.TODO(), linqgo.CapabilityCheckiMessageParams{\n\t\tHandleCheck: linqgo.HandleCheckParam{\n\t\t\tAddress: "+15551234567",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", handleCheckResponse.Address)\n}\n',
|
|
911
|
+
},
|
|
912
|
+
http: {
|
|
913
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/capability/check_imessage \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "address": "+15551234567",\n "from": "+15559876543"\n }\'',
|
|
914
|
+
},
|
|
915
|
+
python: {
|
|
916
|
+
method: 'capability.check_i_message',
|
|
917
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nhandle_check_response = client.capability.check_i_message(\n address="+15551234567",\n)\nprint(handle_check_response.address)',
|
|
918
|
+
},
|
|
919
|
+
typescript: {
|
|
920
|
+
method: 'client.capability.checkiMessage',
|
|
921
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst handleCheckResponse = await client.capability.checkiMessage({ address: '+15551234567' });\n\nconsole.log(handleCheckResponse.address);",
|
|
922
|
+
},
|
|
923
|
+
},
|
|
924
|
+
},
|
|
925
|
+
{
|
|
926
|
+
name: 'check_rcs',
|
|
927
|
+
endpoint: '/v3/capability/check_rcs',
|
|
928
|
+
httpMethod: 'post',
|
|
929
|
+
summary: 'Check RCS capability',
|
|
930
|
+
description: 'Check whether a recipient address (phone number) supports RCS messaging.\n',
|
|
931
|
+
stainlessPath: '(resource) capability > (method) check_rcs',
|
|
932
|
+
qualified: 'client.capability.checkRCS',
|
|
933
|
+
params: ['address: string;', 'from?: string;'],
|
|
934
|
+
response: '{ address: string; available: boolean; }',
|
|
935
|
+
markdown: "## check_rcs\n\n`client.capability.checkRCS(address: string, from?: string): { address: string; available: boolean; }`\n\n**post** `/v3/capability/check_rcs`\n\nCheck whether a recipient address (phone number) supports RCS messaging.\n\n\n### Parameters\n\n- `address: string`\n The recipient phone number or email address to check\n\n- `from?: string`\n Optional sender phone number. If omitted, an available phone from your pool is used automatically.\n\n### Returns\n\n- `{ address: string; available: boolean; }`\n\n - `address: string`\n - `available: boolean`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst handleCheckResponse = await client.capability.checkRCS({ address: '+15551234567' });\n\nconsole.log(handleCheckResponse);\n```",
|
|
936
|
+
perLanguage: {
|
|
937
|
+
go: {
|
|
938
|
+
method: 'client.Capability.CheckRCS',
|
|
939
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\thandleCheckResponse, err := client.Capability.CheckRCS(context.TODO(), linqgo.CapabilityCheckRCSParams{\n\t\tHandleCheck: linqgo.HandleCheckParam{\n\t\t\tAddress: "+15551234567",\n\t\t},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", handleCheckResponse.Address)\n}\n',
|
|
940
|
+
},
|
|
941
|
+
http: {
|
|
942
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/capability/check_rcs \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "address": "+15551234567",\n "from": "+15559876543"\n }\'',
|
|
943
|
+
},
|
|
944
|
+
python: {
|
|
945
|
+
method: 'capability.check_RCS',
|
|
946
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nhandle_check_response = client.capability.check_RCS(\n address="+15551234567",\n)\nprint(handle_check_response.address)',
|
|
947
|
+
},
|
|
948
|
+
typescript: {
|
|
949
|
+
method: 'client.capability.checkRCS',
|
|
950
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst handleCheckResponse = await client.capability.checkRCS({ address: '+15551234567' });\n\nconsole.log(handleCheckResponse.address);",
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
},
|
|
954
|
+
{
|
|
955
|
+
name: 'events',
|
|
956
|
+
endpoint: '',
|
|
957
|
+
httpMethod: '',
|
|
958
|
+
summary: '',
|
|
959
|
+
description: '',
|
|
960
|
+
stainlessPath: '(resource) webhooks > (method) events',
|
|
961
|
+
qualified: 'client.webhooks.events',
|
|
962
|
+
perLanguage: {
|
|
963
|
+
go: {
|
|
964
|
+
method: 'client.Webhooks.Events',
|
|
965
|
+
example: 'package main\n\nimport (\n\t"context"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\terr := client.Webhooks.Events(context.TODO())\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n',
|
|
966
|
+
},
|
|
967
|
+
python: {
|
|
968
|
+
method: 'webhooks.events',
|
|
969
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nclient.webhooks.events()',
|
|
970
|
+
},
|
|
971
|
+
typescript: {
|
|
972
|
+
method: 'client.webhooks.events',
|
|
973
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nawait client.webhooks.events();",
|
|
974
|
+
},
|
|
975
|
+
},
|
|
976
|
+
},
|
|
977
|
+
{
|
|
978
|
+
name: 'retrieve',
|
|
979
|
+
endpoint: '/v3/contact_card',
|
|
980
|
+
httpMethod: 'get',
|
|
981
|
+
summary: 'Get contact cards',
|
|
982
|
+
description: 'Returns the contact card for a specific phone number, or all contact cards for the\nauthenticated partner if no `phone_number` is provided.\n',
|
|
983
|
+
stainlessPath: '(resource) contact_card > (method) retrieve',
|
|
984
|
+
qualified: 'client.contactCard.retrieve',
|
|
985
|
+
params: ['phone_number?: string;'],
|
|
986
|
+
response: '{ contact_cards: { first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }[]; }',
|
|
987
|
+
markdown: "## retrieve\n\n`client.contactCard.retrieve(phone_number?: string): { contact_cards: object[]; }`\n\n**get** `/v3/contact_card`\n\nReturns the contact card for a specific phone number, or all contact cards for the\nauthenticated partner if no `phone_number` is provided.\n\n\n### Parameters\n\n- `phone_number?: string`\n E.164 phone number to filter by. If omitted, all my cards for the partner are returned.\n\n### Returns\n\n- `{ contact_cards: { first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }[]; }`\n\n - `contact_cards: { first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }[]`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst contactCard = await client.contactCard.retrieve();\n\nconsole.log(contactCard);\n```",
|
|
988
|
+
perLanguage: {
|
|
989
|
+
go: {
|
|
990
|
+
method: 'client.ContactCard.Get',
|
|
991
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tcontactCard, err := client.ContactCard.Get(context.TODO(), linqgo.ContactCardGetParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", contactCard.ContactCards)\n}\n',
|
|
992
|
+
},
|
|
993
|
+
http: {
|
|
994
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/contact_card \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY"',
|
|
995
|
+
},
|
|
996
|
+
python: {
|
|
997
|
+
method: 'contact_card.retrieve',
|
|
998
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\ncontact_card = client.contact_card.retrieve()\nprint(contact_card.contact_cards)',
|
|
999
|
+
},
|
|
1000
|
+
typescript: {
|
|
1001
|
+
method: 'client.contactCard.retrieve',
|
|
1002
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst contactCard = await client.contactCard.retrieve();\n\nconsole.log(contactCard.contact_cards);",
|
|
1003
|
+
},
|
|
1004
|
+
},
|
|
1005
|
+
},
|
|
1006
|
+
{
|
|
1007
|
+
name: 'create',
|
|
1008
|
+
endpoint: '/v3/contact_card',
|
|
1009
|
+
httpMethod: 'post',
|
|
1010
|
+
summary: 'Setup contact card',
|
|
1011
|
+
description: "Creates a contact card for a phone number. This endpoint is intended for initial, one-time setup only.\n\nThe contact card is stored in an inactive state first. Once it's applied successfully,\nit is activated and `is_active` is returned as `true`. On failure, `is_active` is `false`.\n\n**Note:** To update an existing contact card after setup, use `PATCH /v3/contact_card` instead.\n",
|
|
1012
|
+
stainlessPath: '(resource) contact_card > (method) create',
|
|
1013
|
+
qualified: 'client.contactCard.create',
|
|
1014
|
+
params: ['first_name: string;', 'phone_number: string;', 'image_url?: string;', 'last_name?: string;'],
|
|
1015
|
+
response: '{ first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }',
|
|
1016
|
+
markdown: "## create\n\n`client.contactCard.create(first_name: string, phone_number: string, image_url?: string, last_name?: string): { first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }`\n\n**post** `/v3/contact_card`\n\nCreates a contact card for a phone number. This endpoint is intended for initial, one-time setup only.\n\nThe contact card is stored in an inactive state first. Once it's applied successfully,\nit is activated and `is_active` is returned as `true`. On failure, `is_active` is `false`.\n\n**Note:** To update an existing contact card after setup, use `PATCH /v3/contact_card` instead.\n\n\n### Parameters\n\n- `first_name: string`\n First name for the contact card. Required.\n\n- `phone_number: string`\n E.164 phone number to associate the contact card with\n\n- `image_url?: string`\n URL of the profile image to rehost on the CDN. Only re-uploaded when a new value is provided.\n\n- `last_name?: string`\n Last name for the contact card. Optional.\n\n### Returns\n\n- `{ first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }`\n\n - `first_name: string`\n - `is_active: boolean`\n - `phone_number: string`\n - `image_url?: string`\n - `last_name?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst setContactCard = await client.contactCard.create({ first_name: 'John', phone_number: '+15551234567' });\n\nconsole.log(setContactCard);\n```",
|
|
1017
|
+
perLanguage: {
|
|
1018
|
+
go: {
|
|
1019
|
+
method: 'client.ContactCard.New',
|
|
1020
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tsetContactCard, err := client.ContactCard.New(context.TODO(), linqgo.ContactCardNewParams{\n\t\tFirstName: "John",\n\t\tPhoneNumber: "+15551234567",\n\t\tImageURL: linqgo.String("https://cdn.linqapp.com/contact-card/example.jpg"),\n\t\tLastName: linqgo.String("Doe"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", setContactCard.FirstName)\n}\n',
|
|
1021
|
+
},
|
|
1022
|
+
http: {
|
|
1023
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/contact_card \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "first_name": "John",\n "phone_number": "+15551234567",\n "image_url": "https://cdn.linqapp.com/contact-card/example.jpg",\n "last_name": "Doe"\n }\'',
|
|
1024
|
+
},
|
|
1025
|
+
python: {
|
|
1026
|
+
method: 'contact_card.create',
|
|
1027
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nset_contact_card = client.contact_card.create(\n first_name="John",\n phone_number="+15551234567",\n image_url="https://cdn.linqapp.com/contact-card/example.jpg",\n last_name="Doe",\n)\nprint(set_contact_card.first_name)',
|
|
1028
|
+
},
|
|
1029
|
+
typescript: {
|
|
1030
|
+
method: 'client.contactCard.create',
|
|
1031
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst setContactCard = await client.contactCard.create({\n first_name: 'John',\n phone_number: '+15551234567',\n image_url: 'https://cdn.linqapp.com/contact-card/example.jpg',\n last_name: 'Doe',\n});\n\nconsole.log(setContactCard.first_name);",
|
|
1032
|
+
},
|
|
1033
|
+
},
|
|
1034
|
+
},
|
|
1035
|
+
{
|
|
1036
|
+
name: 'update',
|
|
1037
|
+
endpoint: '/v3/contact_card',
|
|
1038
|
+
httpMethod: 'patch',
|
|
1039
|
+
summary: 'Update contact card',
|
|
1040
|
+
description: 'Partially updates an existing active contact card for a phone number.\n\nFetches the current active contact card and merges the provided fields.\nOnly fields present in the request body are updated; omitted fields retain their existing values.\n\nRequires an active contact card to exist for the phone number.\n',
|
|
1041
|
+
stainlessPath: '(resource) contact_card > (method) update',
|
|
1042
|
+
qualified: 'client.contactCard.update',
|
|
1043
|
+
params: ['phone_number: string;', 'first_name?: string;', 'image_url?: string;', 'last_name?: string;'],
|
|
1044
|
+
response: '{ first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }',
|
|
1045
|
+
markdown: "## update\n\n`client.contactCard.update(phone_number: string, first_name?: string, image_url?: string, last_name?: string): { first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }`\n\n**patch** `/v3/contact_card`\n\nPartially updates an existing active contact card for a phone number.\n\nFetches the current active contact card and merges the provided fields.\nOnly fields present in the request body are updated; omitted fields retain their existing values.\n\nRequires an active contact card to exist for the phone number.\n\n\n### Parameters\n\n- `phone_number: string`\n E.164 phone number of the contact card to update\n\n- `first_name?: string`\n Updated first name. If omitted, the existing value is kept.\n\n- `image_url?: string`\n Updated profile image URL. If omitted, the existing image is kept.\n\n- `last_name?: string`\n Updated last name. If omitted, the existing value is kept.\n\n### Returns\n\n- `{ first_name: string; is_active: boolean; phone_number: string; image_url?: string; last_name?: string; }`\n\n - `first_name: string`\n - `is_active: boolean`\n - `phone_number: string`\n - `image_url?: string`\n - `last_name?: string`\n\n### Example\n\n```typescript\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3();\n\nconst setContactCard = await client.contactCard.update({ phone_number: '+15551234567' });\n\nconsole.log(setContactCard);\n```",
|
|
1046
|
+
perLanguage: {
|
|
1047
|
+
go: {
|
|
1048
|
+
method: 'client.ContactCard.Update',
|
|
1049
|
+
example: 'package main\n\nimport (\n\t"context"\n\t"fmt"\n\n\t"github.com/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"),\n\t)\n\tsetContactCard, err := client.ContactCard.Update(context.TODO(), linqgo.ContactCardUpdateParams{\n\t\tPhoneNumber: "+15551234567",\n\t\tFirstName: linqgo.String("John"),\n\t\tImageURL: linqgo.String("https://cdn.linqapp.com/contact-card/example.jpg"),\n\t\tLastName: linqgo.String("Doe"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", setContactCard.FirstName)\n}\n',
|
|
1050
|
+
},
|
|
1051
|
+
http: {
|
|
1052
|
+
example: 'curl https://api.linqapp.com/api/partner/v3/contact_card \\\n -X PATCH \\\n -H \'Content-Type: application/json\' \\\n -H "Authorization: Bearer $LINQ_API_V3_API_KEY" \\\n -d \'{\n "first_name": "John",\n "image_url": "https://cdn.linqapp.com/contact-card/example.jpg",\n "last_name": "Doe"\n }\'',
|
|
1053
|
+
},
|
|
1054
|
+
python: {
|
|
1055
|
+
method: 'contact_card.update',
|
|
1056
|
+
example: 'import os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\nset_contact_card = client.contact_card.update(\n phone_number="+15551234567",\n first_name="John",\n image_url="https://cdn.linqapp.com/contact-card/example.jpg",\n last_name="Doe",\n)\nprint(set_contact_card.first_name)',
|
|
1057
|
+
},
|
|
1058
|
+
typescript: {
|
|
1059
|
+
method: 'client.contactCard.update',
|
|
1060
|
+
example: "import LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst setContactCard = await client.contactCard.update({\n phone_number: '+15551234567',\n first_name: 'John',\n image_url: 'https://cdn.linqapp.com/contact-card/example.jpg',\n last_name: 'Doe',\n});\n\nconsole.log(setContactCard.first_name);",
|
|
1061
|
+
},
|
|
1062
|
+
},
|
|
1063
|
+
},
|
|
1064
|
+
];
|
|
1065
|
+
const EMBEDDED_READMES = [
|
|
1066
|
+
{
|
|
1067
|
+
language: 'go',
|
|
1068
|
+
content: '# Linq API V3 Go API Library\n\n<a href="https://pkg.go.dev/github.com/linq-team/linq-go"><img src="https://pkg.go.dev/badge/github.com/linq-team/linq-go.svg" alt="Go Reference"></a>\n\nThe Linq API V3 Go library provides convenient access to the [Linq API V3 REST API](https://docs.linqapp.com)\nfrom applications written in Go.\n\nIt is generated with [Stainless](https://www.stainless.com/).\n\n## MCP Server\n\nUse the Linq API V3 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=%40linqapp%2Fsdk-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBsaW5xYXBwL3Nkay1tY3AiXSwiZW52Ijp7IkxJTlFfQVBJX1YzX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40linqapp%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40linqapp%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22LINQ_API_V3_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/linq-team/linq-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/linq-team/linq-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/linq-team/linq-go"\n\t"github.com/linq-team/linq-go/option"\n)\n\nfunc main() {\n\tclient := linqgo.NewClient(\n\t\toption.WithAPIKey("My API Key"), // defaults to os.LookupEnv("LINQ_API_V3_API_KEY")\n\t)\n\tchat, err := client.Chats.New(context.TODO(), linqgo.ChatNewParams{\n\t\tFrom: "+12052535597",\n\t\tMessage: linqgo.MessageContentParam{\n\t\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\t\tValue: "Hello! How can I help you today?",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t\tTo: []string{"+12052532136"},\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf("%+v\\n", chat.Chat)\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.Chats.New(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/linq-team/linq-go/SDK_PackageOptionName).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Chats.ListChatsAutoPaging(context.TODO(), linqgo.ChatListChatsParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\tchat := iter.Current()\n\tfmt.Printf("%+v\\n", chat)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Chats.ListChats(context.TODO(), linqgo.ChatListChatsParams{})\nfor page != nil {\n\tfor _, chat := range page.Chats {\n\t\tfmt.Printf("%+v\\n", chat)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*SDK_PackageName.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Chats.New(context.TODO(), linqgo.ChatNewParams{\n\tFrom: "+12052535597",\n\tMessage: linqgo.MessageContentParam{\n\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\tValue: "Hello! How can I help you today?",\n\t\t\t},\n\t\t}},\n\t},\n\tTo: []string{"+12052532136"},\n})\nif err != nil {\n\tvar apierr *linqgo.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 "/v3/chats": 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.Chats.New(\n\tctx,\n\tlinqgo.ChatNewParams{\n\t\tFrom: "+12052535597",\n\t\tMessage: linqgo.MessageContentParam{\n\t\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\t\tValue: "Hello! How can I help you today?",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t\tTo: []string{"+12052532136"},\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 := linqgo.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Chats.New(\n\tcontext.TODO(),\n\tlinqgo.ChatNewParams{\n\t\tFrom: "+12052535597",\n\t\tMessage: linqgo.MessageContentParam{\n\t\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\t\tValue: "Hello! How can I help you today?",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t\tTo: []string{"+12052532136"},\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\nchat, err := client.Chats.New(\n\tcontext.TODO(),\n\tlinqgo.ChatNewParams{\n\t\tFrom: "+12052535597",\n\t\tMessage: linqgo.MessageContentParam{\n\t\t\tParts: []linqgo.MessageContentPartUnionParam{{\n\t\t\t\tOfText: &linqgo.TextPartParam{\n\t\t\t\t\tType: linqgo.TextPartTypeText,\n\t\t\t\t\tValue: "Hello! How can I help you today?",\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t\tTo: []string{"+12052532136"},\n\t},\n\toption.WithResponseInto(&response),\n)\nif err != nil {\n\t// handle error\n}\nfmt.Printf("%+v\\n", chat)\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/linq-team/linq-go/issues) with questions, bugs, or suggestions.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
1069
|
+
},
|
|
1070
|
+
{
|
|
1071
|
+
language: 'python',
|
|
1072
|
+
content: '# Linq API V3 Python API library\n\n<!-- prettier-ignore -->\n[)](https://pypi.org/project/linq-python/)\n\nThe Linq API V3 Python library provides convenient access to the Linq API V3 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 Linq API V3 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=%40linqapp%2Fsdk-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBsaW5xYXBwL3Nkay1tY3AiXSwiZW52Ijp7IkxJTlFfQVBJX1YzX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40linqapp%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40linqapp%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22LINQ_API_V3_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 [docs.linqapp.com](https://docs.linqapp.com). The full API of this library can be found in [api.md](api.md).\n\n## Installation\n\n```sh\n# install from PyPI\npip install linq-python\n```\n\n## Usage\n\nThe full API of this library can be found in [api.md](api.md).\n\n```python\nimport os\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\n\nchat = client.chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n)\nprint(chat.chat)\n```\n\nWhile you can provide an `api_key` keyword argument,\nwe recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)\nto add `LINQ_API_V3_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 `AsyncLinqAPIV3` instead of `LinqAPIV3` and use `await` with each API call:\n\n```python\nimport os\nimport asyncio\nfrom linq import AsyncLinqAPIV3\n\nclient = AsyncLinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n)\n\nasync def main() -> None:\n chat = await client.chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n )\n print(chat.chat)\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 PyPI\npip install linq-python[aiohttp]\n```\n\nThen you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`:\n\n```python\nimport os\nimport asyncio\nfrom linq import DefaultAioHttpClient\nfrom linq import AsyncLinqAPIV3\n\nasync def main() -> None:\n async with AsyncLinqAPIV3(\n api_key=os.environ.get("LINQ_API_V3_API_KEY"), # This is the default and can be omitted\n http_client=DefaultAioHttpClient(),\n) as client:\n chat = await client.chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n )\n print(chat.chat)\n\nasyncio.run(main())\n```\n\n\n\n## Using types\n\nNested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like:\n\n- Serializing back into JSON, `model.to_json()`\n- Converting to a dictionary, `model.to_dict()`\n\nTyped requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`.\n\n## Pagination\n\nList methods in the Linq API V3 API are paginated.\n\nThis library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually:\n\n```python\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3()\n\nall_chats = []\n# Automatically fetches more pages as needed.\nfor chat in client.chats.list_chats():\n # Do something with chat here\n all_chats.append(chat)\nprint(all_chats)\n```\n\nOr, asynchronously:\n\n```python\nimport asyncio\nfrom linq import AsyncLinqAPIV3\n\nclient = AsyncLinqAPIV3()\n\nasync def main() -> None:\n all_chats = []\n # Iterate through items across all pages, issuing requests as needed.\n async for chat in client.chats.list_chats():\n all_chats.append(chat)\n print(all_chats)\n\nasyncio.run(main())\n```\n\nAlternatively, you can use the `.has_next_page()`, `.next_page_info()`, or `.get_next_page()` methods for more granular control working with pages:\n\n```python\nfirst_page = await client.chats.list_chats()\nif first_page.has_next_page():\n print(f"will fetch next page using these details: {first_page.next_page_info()}")\n next_page = await first_page.get_next_page()\n print(f"number of items we just fetched: {len(next_page.chats)}")\n\n# Remove `await` for non-async usage.\n```\n\nOr just work directly with the returned data:\n\n```python\nfirst_page = await client.chats.list_chats()\n\nprint(f"next page cursor: {first_page.next_cursor}") # => "next page cursor: ..."\nfor chat in first_page.chats:\n print(chat.id)\n\n# Remove `await` for non-async usage.\n```\n\n## Nested params\n\nNested parameters are dictionaries, typed using `TypedDict`, for example:\n\n```python\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3()\n\nchat = client.chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n)\nprint(chat.message)\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 `linq.APIConnectionError` is raised.\n\nWhen the API returns a non-success status code (that is, 4xx or 5xx\nresponse), a subclass of `linq.APIStatusError` is raised, containing `status_code` and `response` properties.\n\nAll errors inherit from `linq.APIError`.\n\n```python\nimport linq\nfrom linq import LinqAPIV3\n\nclient = LinqAPIV3()\n\ntry:\n client.chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n )\nexcept linq.APIConnectionError as e:\n print("The server could not be reached")\n print(e.__cause__) # an underlying Exception, likely raised within httpx.\nexcept linq.RateLimitError as e:\n print("A 429 status code was received; we should back off a bit.")\nexcept linq.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 linq import LinqAPIV3\n\n# Configure the default for all requests:\nclient = LinqAPIV3(\n # default is 2\n max_retries=0,\n)\n\n# Or, configure per-request:\nclient.with_options(max_retries = 5).chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\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 linq import LinqAPIV3\n\n# Configure the default for all requests:\nclient = LinqAPIV3(\n # 20 seconds (default is 1 minute)\n timeout=20.0,\n)\n\n# More granular control:\nclient = LinqAPIV3(\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).chats.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\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 `LINQ_API_V3_LOG` to `info`.\n\n```shell\n$ export LINQ_API_V3_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 linq import LinqAPIV3\n\nclient = LinqAPIV3()\nresponse = client.chats.with_raw_response.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\n)\nprint(response.headers.get(\'X-My-Header\'))\n\nchat = response.parse() # get the object that `chats.create()` would have returned\nprint(chat.chat)\n```\n\nThese methods return an [`APIResponse`](https://github.com/linq-team/linq-python/tree/main/src/linq/_response.py) object.\n\nThe async client returns an [`AsyncAPIResponse`](https://github.com/linq-team/linq-python/tree/main/src/linq/_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.chats.with_streaming_response.create(\n from_="+12052535597",\n message={\n "parts": [{\n "type": "text",\n "value": "Hello! How can I help you today?",\n }]\n },\n to=["+12052532136"],\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 linq import LinqAPIV3, DefaultHttpxClient\n\nclient = LinqAPIV3(\n # Or use the `LINQ_API_V3_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 linq import LinqAPIV3\n\nwith LinqAPIV3() 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/linq-team/linq-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 linq\nprint(linq.__version__)\n```\n\n## Requirements\n\nPython 3.9 or higher.\n\n## Contributing\n\nSee [the contributing documentation](./CONTRIBUTING.md).\n',
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
language: 'typescript',
|
|
1076
|
+
content: "# Linq API V3 TypeScript API Library\n\n[)](https://npmjs.org/package/@linqapp/sdk) \n\nThis library provides convenient access to the Linq API V3 REST API from server-side TypeScript or JavaScript.\n\n\n\nThe REST API documentation can be found on [docs.linqapp.com](https://docs.linqapp.com). 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 Linq API V3 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=%40linqapp%2Fsdk-mcp&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBsaW5xYXBwL3Nkay1tY3AiXSwiZW52Ijp7IkxJTlFfQVBJX1YzX0FQSV9LRVkiOiJNeSBBUEkgS2V5In19)\n[](https://vscode.stainless.com/mcp/%7B%22name%22%3A%22%40linqapp%2Fsdk-mcp%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40linqapp%2Fsdk-mcp%22%5D%2C%22env%22%3A%7B%22LINQ_API_V3_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 @linqapp/sdk\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 LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst chat = await client.chats.create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n});\n\nconsole.log(chat.chat);\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 LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\n apiKey: process.env['LINQ_API_V3_API_KEY'], // This is the default and can be omitted\n});\n\nconst params: LinqAPIV3.ChatCreateParams = {\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n};\nconst chat: LinqAPIV3.ChatCreateResponse = await client.chats.create(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 chat = await client.chats\n .create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n })\n .catch(async (err) => {\n if (err instanceof LinqAPIV3.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 LinqAPIV3({\n maxRetries: 0, // default is 2\n});\n\n// Or, configure per-request:\nawait client.chats.create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n}, {\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 LinqAPIV3({\n timeout: 20 * 1000, // 20 seconds (default is 1 minute)\n});\n\n// Override per-request:\nawait client.chats.create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n}, {\n timeout: 5 * 1000,\n});\n```\n\nOn timeout, an `APIConnectionTimeoutError` is thrown.\n\nNote that requests which time out will be [retried twice by default](#retries).\n\n## Auto-pagination\n\nList methods in the LinqAPIV3 API are paginated.\nYou can use the `for await … of` syntax to iterate through items across all pages:\n\n```ts\nasync function fetchAllChats(params) {\n const allChats = [];\n // Automatically fetches more pages as needed.\n for await (const chat of client.chats.listChats()) {\n allChats.push(chat);\n }\n return allChats;\n}\n```\n\nAlternatively, you can request a single page at a time:\n\n```ts\nlet page = await client.chats.listChats();\nfor (const chat of page.chats) {\n console.log(chat);\n}\n\n// Convenience methods are provided for manually paginating:\nwhile (page.hasNextPage()) {\n page = await page.getNextPage();\n // ...\n}\n```\n\n\n\n## Advanced Usage\n\n### 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 LinqAPIV3();\n\nconst response = await client.chats\n .create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n })\n .asResponse();\nconsole.log(response.headers.get('X-My-Header'));\nconsole.log(response.statusText); // access the underlying Response object\n\nconst { data: chat, response: raw } = await client.chats\n .create({\n from: '+12052535597',\n message: { parts: [{ type: 'text', value: 'Hello! How can I help you today?' }] },\n to: ['+12052532136'],\n })\n .withResponse();\nconsole.log(raw.headers.get('X-My-Header'));\nconsole.log(chat.chat);\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 `LINQ_API_V3_LOG` environment variable\n2. Using the `logLevel` client option (overrides the environment variable if set)\n\n```ts\nimport LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\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 LinqAPIV3 from '@linqapp/sdk';\nimport pino from 'pino';\n\nconst logger = pino();\n\nconst client = new LinqAPIV3({\n logger: logger.child({ name: 'LinqAPIV3' }),\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.chats.create({\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 LinqAPIV3 from '@linqapp/sdk';\nimport fetch from 'my-fetch';\n\nconst client = new LinqAPIV3({ 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 LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\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 LinqAPIV3 from '@linqapp/sdk';\nimport * as undici from 'undici';\n\nconst proxyAgent = new undici.ProxyAgent('http://localhost:8888');\nconst client = new LinqAPIV3({\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 LinqAPIV3 from '@linqapp/sdk';\n\nconst client = new LinqAPIV3({\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 LinqAPIV3 from 'npm:@linqapp/sdk';\n\nconst httpClient = Deno.createHttpClient({ proxy: { url: 'http://localhost:8888' } });\nconst client = new LinqAPIV3({\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/linq-team/linq-node/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",
|
|
1077
|
+
},
|
|
1078
|
+
];
|
|
1079
|
+
const INDEX_OPTIONS = {
|
|
1080
|
+
fields: [
|
|
1081
|
+
'name',
|
|
1082
|
+
'endpoint',
|
|
1083
|
+
'summary',
|
|
1084
|
+
'description',
|
|
1085
|
+
'qualified',
|
|
1086
|
+
'stainlessPath',
|
|
1087
|
+
'content',
|
|
1088
|
+
'sectionContext',
|
|
1089
|
+
],
|
|
1090
|
+
storeFields: ['kind', '_original'],
|
|
1091
|
+
searchOptions: {
|
|
1092
|
+
prefix: true,
|
|
1093
|
+
fuzzy: 0.1,
|
|
1094
|
+
boost: {
|
|
1095
|
+
name: 5,
|
|
1096
|
+
stainlessPath: 3,
|
|
1097
|
+
endpoint: 3,
|
|
1098
|
+
qualified: 3,
|
|
1099
|
+
summary: 2,
|
|
1100
|
+
content: 1,
|
|
1101
|
+
description: 1,
|
|
1102
|
+
},
|
|
1103
|
+
},
|
|
1104
|
+
};
|
|
1105
|
+
/**
|
|
1106
|
+
* Self-contained local search engine backed by MiniSearch.
|
|
1107
|
+
* Method data is embedded at SDK build time; prose documents
|
|
1108
|
+
* can be loaded from an optional docs directory at runtime.
|
|
1109
|
+
*/
|
|
1110
|
+
class LocalDocsSearch {
|
|
1111
|
+
methodIndex;
|
|
1112
|
+
proseIndex;
|
|
1113
|
+
constructor() {
|
|
1114
|
+
this.methodIndex = new minisearch_1.default(INDEX_OPTIONS);
|
|
1115
|
+
this.proseIndex = new minisearch_1.default(INDEX_OPTIONS);
|
|
1116
|
+
}
|
|
1117
|
+
static async create(opts) {
|
|
1118
|
+
const instance = new LocalDocsSearch();
|
|
1119
|
+
instance.indexMethods(EMBEDDED_METHODS);
|
|
1120
|
+
for (const readme of EMBEDDED_READMES) {
|
|
1121
|
+
instance.indexProse(readme.content, `readme:${readme.language}`);
|
|
1122
|
+
}
|
|
1123
|
+
if (opts?.docsDir) {
|
|
1124
|
+
await instance.loadDocsDirectory(opts.docsDir);
|
|
1125
|
+
}
|
|
1126
|
+
return instance;
|
|
1127
|
+
}
|
|
1128
|
+
search(props) {
|
|
1129
|
+
const { query, language = 'typescript', detail = 'default', maxResults = 5, maxLength = 100_000 } = props;
|
|
1130
|
+
const useMarkdown = detail === 'verbose' || detail === 'high';
|
|
1131
|
+
// Search both indices and merge results by score.
|
|
1132
|
+
// Filter prose hits so language-tagged content (READMEs and docs with
|
|
1133
|
+
// frontmatter) only matches the requested language.
|
|
1134
|
+
const methodHits = this.methodIndex
|
|
1135
|
+
.search(query)
|
|
1136
|
+
.map((hit) => ({ ...hit, _kind: 'http_method' }));
|
|
1137
|
+
const proseHits = this.proseIndex
|
|
1138
|
+
.search(query)
|
|
1139
|
+
.filter((hit) => {
|
|
1140
|
+
const source = hit['_original']?.source;
|
|
1141
|
+
if (!source)
|
|
1142
|
+
return true;
|
|
1143
|
+
// Check for language-tagged sources: "readme:<lang>" or "lang:<lang>:<filename>"
|
|
1144
|
+
let taggedLang;
|
|
1145
|
+
if (source.startsWith('readme:'))
|
|
1146
|
+
taggedLang = source.slice('readme:'.length);
|
|
1147
|
+
else if (source.startsWith('lang:'))
|
|
1148
|
+
taggedLang = source.split(':')[1];
|
|
1149
|
+
if (!taggedLang)
|
|
1150
|
+
return true;
|
|
1151
|
+
return taggedLang === language || (language === 'javascript' && taggedLang === 'typescript');
|
|
1152
|
+
})
|
|
1153
|
+
.map((hit) => ({ ...hit, _kind: 'prose' }));
|
|
1154
|
+
const merged = [...methodHits, ...proseHits].sort((a, b) => b.score - a.score);
|
|
1155
|
+
const top = merged.slice(0, maxResults);
|
|
1156
|
+
const fullResults = [];
|
|
1157
|
+
for (const hit of top) {
|
|
1158
|
+
const original = hit['_original'];
|
|
1159
|
+
if (hit._kind === 'http_method') {
|
|
1160
|
+
const m = original;
|
|
1161
|
+
if (useMarkdown && m.markdown) {
|
|
1162
|
+
fullResults.push(m.markdown);
|
|
1163
|
+
}
|
|
1164
|
+
else {
|
|
1165
|
+
// Use per-language data when available, falling back to the
|
|
1166
|
+
// top-level fields (which are TypeScript-specific in the
|
|
1167
|
+
// legacy codepath).
|
|
1168
|
+
const langData = m.perLanguage?.[language];
|
|
1169
|
+
fullResults.push({
|
|
1170
|
+
method: langData?.method ?? m.qualified,
|
|
1171
|
+
summary: m.summary,
|
|
1172
|
+
description: m.description,
|
|
1173
|
+
endpoint: `${m.httpMethod.toUpperCase()} ${m.endpoint}`,
|
|
1174
|
+
...(langData?.example ? { example: langData.example } : {}),
|
|
1175
|
+
...(m.params ? { params: m.params } : {}),
|
|
1176
|
+
...(m.response ? { response: m.response } : {}),
|
|
1177
|
+
});
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
else {
|
|
1181
|
+
const c = original;
|
|
1182
|
+
fullResults.push({
|
|
1183
|
+
content: c.content,
|
|
1184
|
+
...(c.source ? { source: c.source } : {}),
|
|
1185
|
+
});
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
let totalLength = 0;
|
|
1189
|
+
const results = [];
|
|
1190
|
+
for (const result of fullResults) {
|
|
1191
|
+
const len = typeof result === 'string' ? result.length : JSON.stringify(result).length;
|
|
1192
|
+
totalLength += len;
|
|
1193
|
+
if (totalLength > maxLength)
|
|
1194
|
+
break;
|
|
1195
|
+
results.push(result);
|
|
1196
|
+
}
|
|
1197
|
+
if (results.length < fullResults.length) {
|
|
1198
|
+
results.unshift(`Truncated; showing ${results.length} of ${fullResults.length} results.`);
|
|
1199
|
+
}
|
|
1200
|
+
return { results };
|
|
1201
|
+
}
|
|
1202
|
+
indexMethods(methods) {
|
|
1203
|
+
const docs = methods.map((m, i) => ({
|
|
1204
|
+
id: `method-${i}`,
|
|
1205
|
+
kind: 'http_method',
|
|
1206
|
+
name: m.name,
|
|
1207
|
+
endpoint: m.endpoint,
|
|
1208
|
+
summary: m.summary,
|
|
1209
|
+
description: m.description,
|
|
1210
|
+
qualified: m.qualified,
|
|
1211
|
+
stainlessPath: m.stainlessPath,
|
|
1212
|
+
_original: m,
|
|
1213
|
+
}));
|
|
1214
|
+
if (docs.length > 0) {
|
|
1215
|
+
this.methodIndex.addAll(docs);
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
async loadDocsDirectory(docsDir) {
|
|
1219
|
+
let entries;
|
|
1220
|
+
try {
|
|
1221
|
+
entries = await fs.readdir(docsDir, { withFileTypes: true });
|
|
1222
|
+
}
|
|
1223
|
+
catch (err) {
|
|
1224
|
+
(0, logger_1.getLogger)().warn({ err, docsDir }, 'Could not read docs directory');
|
|
1225
|
+
return;
|
|
1226
|
+
}
|
|
1227
|
+
const files = entries
|
|
1228
|
+
.filter((e) => e.isFile())
|
|
1229
|
+
.filter((e) => e.name.endsWith('.md') || e.name.endsWith('.markdown') || e.name.endsWith('.json'));
|
|
1230
|
+
for (const file of files) {
|
|
1231
|
+
try {
|
|
1232
|
+
const filePath = path.join(docsDir, file.name);
|
|
1233
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
1234
|
+
if (file.name.endsWith('.json')) {
|
|
1235
|
+
const texts = extractTexts(JSON.parse(content));
|
|
1236
|
+
if (texts.length > 0) {
|
|
1237
|
+
this.indexProse(texts.join('\n\n'), file.name);
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
else {
|
|
1241
|
+
// Parse optional YAML frontmatter for language tagging.
|
|
1242
|
+
// Files with a "language" field in frontmatter will only
|
|
1243
|
+
// surface in searches for that language.
|
|
1244
|
+
//
|
|
1245
|
+
// Example:
|
|
1246
|
+
// ---
|
|
1247
|
+
// language: python
|
|
1248
|
+
// ---
|
|
1249
|
+
// # Error handling in Python
|
|
1250
|
+
// ...
|
|
1251
|
+
const frontmatter = parseFrontmatter(content);
|
|
1252
|
+
const source = frontmatter.language ? `lang:${frontmatter.language}:${file.name}` : file.name;
|
|
1253
|
+
this.indexProse(content, source);
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
catch (err) {
|
|
1257
|
+
(0, logger_1.getLogger)().warn({ err, file: file.name }, 'Failed to index docs file');
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1261
|
+
indexProse(markdown, source) {
|
|
1262
|
+
const chunks = chunkMarkdown(markdown);
|
|
1263
|
+
const baseId = this.proseIndex.documentCount;
|
|
1264
|
+
const docs = chunks.map((chunk, i) => ({
|
|
1265
|
+
id: `prose-${baseId + i}`,
|
|
1266
|
+
kind: 'prose',
|
|
1267
|
+
content: chunk.content,
|
|
1268
|
+
...(chunk.sectionContext != null ? { sectionContext: chunk.sectionContext } : {}),
|
|
1269
|
+
_original: { ...chunk, source },
|
|
1270
|
+
}));
|
|
1271
|
+
if (docs.length > 0) {
|
|
1272
|
+
this.proseIndex.addAll(docs);
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
exports.LocalDocsSearch = LocalDocsSearch;
|
|
1277
|
+
/** Lightweight markdown chunker — splits on headers, chunks by word count. */
|
|
1278
|
+
function chunkMarkdown(markdown) {
|
|
1279
|
+
// Strip YAML frontmatter
|
|
1280
|
+
const stripped = markdown.replace(/^---\n[\s\S]*?\n---\n?/, '');
|
|
1281
|
+
const lines = stripped.split('\n');
|
|
1282
|
+
const chunks = [];
|
|
1283
|
+
const headers = [];
|
|
1284
|
+
let current = [];
|
|
1285
|
+
const flush = () => {
|
|
1286
|
+
const text = current.join('\n').trim();
|
|
1287
|
+
if (!text)
|
|
1288
|
+
return;
|
|
1289
|
+
const sectionContext = headers.length > 0 ? headers.join(' > ') : undefined;
|
|
1290
|
+
// Split into ~200-word chunks
|
|
1291
|
+
const words = text.split(/\s+/);
|
|
1292
|
+
for (let i = 0; i < words.length; i += 200) {
|
|
1293
|
+
const slice = words.slice(i, i + 200).join(' ');
|
|
1294
|
+
if (slice) {
|
|
1295
|
+
chunks.push({ content: slice, tag: 'p', ...(sectionContext != null ? { sectionContext } : {}) });
|
|
1296
|
+
}
|
|
1297
|
+
}
|
|
1298
|
+
current = [];
|
|
1299
|
+
};
|
|
1300
|
+
for (const line of lines) {
|
|
1301
|
+
const headerMatch = line.match(/^(#{1,6})\s+(.+)/);
|
|
1302
|
+
if (headerMatch) {
|
|
1303
|
+
flush();
|
|
1304
|
+
const level = headerMatch[1].length;
|
|
1305
|
+
const text = headerMatch[2].trim();
|
|
1306
|
+
while (headers.length >= level)
|
|
1307
|
+
headers.pop();
|
|
1308
|
+
headers.push(text);
|
|
1309
|
+
}
|
|
1310
|
+
else {
|
|
1311
|
+
current.push(line);
|
|
1312
|
+
}
|
|
1313
|
+
}
|
|
1314
|
+
flush();
|
|
1315
|
+
return chunks;
|
|
1316
|
+
}
|
|
1317
|
+
/** Recursively extracts string values from a JSON structure. */
|
|
1318
|
+
function extractTexts(data, depth = 0) {
|
|
1319
|
+
if (depth > 10)
|
|
1320
|
+
return [];
|
|
1321
|
+
if (typeof data === 'string')
|
|
1322
|
+
return data.trim() ? [data] : [];
|
|
1323
|
+
if (Array.isArray(data))
|
|
1324
|
+
return data.flatMap((item) => extractTexts(item, depth + 1));
|
|
1325
|
+
if (typeof data === 'object' && data !== null) {
|
|
1326
|
+
return Object.values(data).flatMap((v) => extractTexts(v, depth + 1));
|
|
1327
|
+
}
|
|
1328
|
+
return [];
|
|
1329
|
+
}
|
|
1330
|
+
/** Parses YAML frontmatter from a markdown string, extracting the language field if present. */
|
|
1331
|
+
function parseFrontmatter(markdown) {
|
|
1332
|
+
const match = markdown.match(/^---\n([\s\S]*?)\n---/);
|
|
1333
|
+
if (!match)
|
|
1334
|
+
return {};
|
|
1335
|
+
const body = match[1] ?? '';
|
|
1336
|
+
const langMatch = body.match(/^language:\s*(.+)$/m);
|
|
1337
|
+
return langMatch ? { language: langMatch[1].trim() } : {};
|
|
1338
|
+
}
|
|
1339
|
+
//# sourceMappingURL=local-docs-search.js.map
|