@elmohq/sdk 0.0.0-claim → 0.1.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.
Files changed (129) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +325 -2
  3. package/dist/calls/index.d.mts +288 -0
  4. package/dist/calls/index.d.mts.map +1 -0
  5. package/dist/calls/index.mjs +390 -0
  6. package/dist/calls/index.mjs.map +1 -0
  7. package/dist/index.d.mts +2 -0
  8. package/dist/index.mjs +1029 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/request-options-DWYI_Ldj.d.mts +1550 -0
  11. package/dist/request-options-DWYI_Ldj.d.mts.map +1 -0
  12. package/dist/tools-7Hs5J2xb.d.mts +1945 -0
  13. package/dist/tools-7Hs5J2xb.d.mts.map +1 -0
  14. package/dist/tools-SwP0sK8H.mjs +2458 -0
  15. package/dist/tools-SwP0sK8H.mjs.map +1 -0
  16. package/dist/types/index.d.mts +2 -0
  17. package/dist/types/index.mjs +1 -0
  18. package/package.json +59 -2
  19. package/src/calls/brands-analytics-get.ts +33 -0
  20. package/src/calls/brands-citations-domains-list.ts +36 -0
  21. package/src/calls/brands-citations-urls-list.ts +32 -0
  22. package/src/calls/brands-create.ts +19 -0
  23. package/src/calls/brands-get.ts +19 -0
  24. package/src/calls/brands-list.ts +18 -0
  25. package/src/calls/brands-opportunities-get.ts +42 -0
  26. package/src/calls/brands-prompt-performance-list.ts +39 -0
  27. package/src/calls/brands-query-fanout-get.ts +30 -0
  28. package/src/calls/brands-tags-list.ts +28 -0
  29. package/src/calls/brands-update.ts +20 -0
  30. package/src/calls/competitors-create.ts +23 -0
  31. package/src/calls/competitors-delete.ts +19 -0
  32. package/src/calls/competitors-get.ts +19 -0
  33. package/src/calls/competitors-list.ts +23 -0
  34. package/src/calls/competitors-update.ts +24 -0
  35. package/src/calls/index.ts +33 -0
  36. package/src/calls/me-get.ts +18 -0
  37. package/src/calls/models-list.ts +20 -0
  38. package/src/calls/organizations-billing-get.ts +37 -0
  39. package/src/calls/organizations-get.ts +24 -0
  40. package/src/calls/organizations-list.ts +27 -0
  41. package/src/calls/prompts-create.ts +27 -0
  42. package/src/calls/prompts-delete.ts +28 -0
  43. package/src/calls/prompts-get.ts +23 -0
  44. package/src/calls/prompts-list.ts +28 -0
  45. package/src/calls/prompts-runs-get.ts +27 -0
  46. package/src/calls/prompts-runs-list.ts +30 -0
  47. package/src/calls/prompts-snapshot-get.ts +28 -0
  48. package/src/calls/prompts-update.ts +29 -0
  49. package/src/calls/reports-create.ts +31 -0
  50. package/src/calls/reports-get.ts +27 -0
  51. package/src/calls/reports-list.ts +28 -0
  52. package/src/calls/tools-analyze.ts +26 -0
  53. package/src/client.ts +662 -0
  54. package/src/index.ts +21 -0
  55. package/src/internal/binding/rest/binding.ts +127 -0
  56. package/src/internal/binding/rest/errors.ts +107 -0
  57. package/src/internal/binding/rest/path.ts +9 -0
  58. package/src/internal/binding/rest/url.ts +97 -0
  59. package/src/internal/codec/json.ts +66 -0
  60. package/src/internal/codec/registry.ts +55 -0
  61. package/src/internal/core/backoff.ts +170 -0
  62. package/src/internal/core/body.ts +54 -0
  63. package/src/internal/core/browser.ts +11 -0
  64. package/src/internal/core/call-promise.ts +145 -0
  65. package/src/internal/core/callable.ts +11 -0
  66. package/src/internal/core/client.ts +89 -0
  67. package/src/internal/core/config.ts +84 -0
  68. package/src/internal/core/credentials.ts +40 -0
  69. package/src/internal/core/dispatch.ts +227 -0
  70. package/src/internal/core/env.ts +68 -0
  71. package/src/internal/core/errors.ts +431 -0
  72. package/src/internal/core/features.ts +60 -0
  73. package/src/internal/core/lazy-promise.ts +39 -0
  74. package/src/internal/core/metadata.ts +79 -0
  75. package/src/internal/core/params.ts +98 -0
  76. package/src/internal/core/protocol.ts +17 -0
  77. package/src/internal/core/read-reply.ts +7 -0
  78. package/src/internal/core/text.ts +7 -0
  79. package/src/internal/core/types.ts +556 -0
  80. package/src/internal/feature/auth.ts +201 -0
  81. package/src/internal/feature/interceptors.ts +36 -0
  82. package/src/internal/feature/logger.ts +222 -0
  83. package/src/internal/feature/retry.ts +165 -0
  84. package/src/internal/feature/rules.ts +54 -0
  85. package/src/internal/feature/timeout.ts +146 -0
  86. package/src/internal/feature/validate.ts +74 -0
  87. package/src/internal/page/page.ts +402 -0
  88. package/src/internal/transport/fetch.ts +82 -0
  89. package/src/resources/analytics.ts +363 -0
  90. package/src/resources/brands.ts +285 -0
  91. package/src/resources/competitors.ts +212 -0
  92. package/src/resources/identity.ts +48 -0
  93. package/src/resources/models.ts +32 -0
  94. package/src/resources/opportunities.ts +79 -0
  95. package/src/resources/organizations.ts +181 -0
  96. package/src/resources/prompts.ts +292 -0
  97. package/src/resources/reports.ts +211 -0
  98. package/src/resources/runs.ts +123 -0
  99. package/src/resources/shared/auth.ts +13 -0
  100. package/src/resources/shared/request-options.ts +26 -0
  101. package/src/resources/shared/resource.ts +23 -0
  102. package/src/resources/shared/rule.ts +25 -0
  103. package/src/resources/snapshots.ts +54 -0
  104. package/src/resources/tags.ts +46 -0
  105. package/src/resources/tools.ts +68 -0
  106. package/src/types/analytics.ts +497 -0
  107. package/src/types/brands.ts +228 -0
  108. package/src/types/competitors.ts +196 -0
  109. package/src/types/identity.ts +55 -0
  110. package/src/types/index.ts +163 -0
  111. package/src/types/models.ts +40 -0
  112. package/src/types/opportunities.ts +84 -0
  113. package/src/types/organizations.ts +157 -0
  114. package/src/types/prompts.ts +231 -0
  115. package/src/types/reports.ts +266 -0
  116. package/src/types/runs.ts +131 -0
  117. package/src/types/shared/brand-id-path.ts +2 -0
  118. package/src/types/shared/conflict-error.ts +7 -0
  119. package/src/types/shared/error.ts +29 -0
  120. package/src/types/shared/limit.ts +8 -0
  121. package/src/types/shared/mention-entry.ts +21 -0
  122. package/src/types/shared/model-filter.ts +15 -0
  123. package/src/types/shared/not-found-error.ts +4 -0
  124. package/src/types/shared/page.ts +7 -0
  125. package/src/types/shared/pagination.ts +7 -0
  126. package/src/types/shared/validation-error.ts +4 -0
  127. package/src/types/snapshots.ts +88 -0
  128. package/src/types/tags.ts +47 -0
  129. package/src/types/tools.ts +78 -0
@@ -0,0 +1,266 @@
1
+ import type { ConflictError, PaymentRequiredError } from './shared/conflict-error';
2
+ import type {
3
+ ForbiddenError,
4
+ InternalServerError,
5
+ RateLimitError,
6
+ UnauthorizedError,
7
+ } from './shared/error';
8
+ import type { Limit } from './shared/limit';
9
+ import type { MentionsSummary } from './shared/mention-entry';
10
+ import type { NotFoundError } from './shared/not-found-error';
11
+ import type { Page } from './shared/page';
12
+ import type { ValidationError } from './shared/validation-error';
13
+
14
+ export type ReportSummary = {
15
+ /** Other names counted as brand mentions */
16
+ brandAliases: Array<string>;
17
+ /** Brand name analyzed */
18
+ brandName: string;
19
+ /** Brand website URL */
20
+ brandWebsite: string;
21
+ /** Timestamp when the report completed */
22
+ completedAt: Date | null;
23
+ /** Timestamp when the report was created */
24
+ createdAt: Date;
25
+ /** Unique identifier for the report */
26
+ id: string;
27
+ /** Current report status */
28
+ status: 'pending' | 'processing' | 'completed' | 'failed';
29
+ };
30
+
31
+ /**
32
+ * Per-prompt snapshot of raw mention data from a report. Consumers compute SoV and other derived
33
+ * metrics.
34
+ */
35
+ export type ReportPromptSnapshot = {
36
+ mentions: MentionsSummary;
37
+ /** The prompt text that was evaluated */
38
+ promptValue: string;
39
+ /** Number of evaluation runs for this prompt */
40
+ totalRuns: number;
41
+ };
42
+
43
+ export type ListReportsErrors = {
44
+ /** Authentication required */
45
+ 401: UnauthorizedError;
46
+ /**
47
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
48
+ * read-only (demo) mode.
49
+ */
50
+ 403: ForbiddenError;
51
+ /** Per-key rate limit exceeded. */
52
+ 429: RateLimitError;
53
+ /** Internal server error */
54
+ 500: InternalServerError;
55
+ };
56
+
57
+ export type ListReportsResponses = {
58
+ /** Paginated list of reports */
59
+ 200: {
60
+ /** The items on this page. Read this rather than the named key below. */
61
+ data: Array<ReportSummary>;
62
+ pagination: {
63
+ limit: number;
64
+ page: number;
65
+ total: number;
66
+ totalPages: number;
67
+ };
68
+ /**
69
+ * Deprecated: read `data` instead. Kept while the one known consumer migrates, and removed in a
70
+ * future release.
71
+ *
72
+ * @deprecated
73
+ */
74
+ reports: Array<ReportSummary>;
75
+ };
76
+ };
77
+
78
+ export type ListReportsResponse = ListReportsResponses[keyof ListReportsResponses];
79
+
80
+ export type CreateReportErrors = {
81
+ /** Invalid request data */
82
+ 400: ValidationError;
83
+ /** Authentication required */
84
+ 401: UnauthorizedError;
85
+ /** The organization has no active subscription. Cloud deployments only. */
86
+ 402: PaymentRequiredError;
87
+ /**
88
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
89
+ * read-only (demo) mode.
90
+ */
91
+ 403: ForbiddenError;
92
+ /** Resource already exists */
93
+ 409: ConflictError;
94
+ /** Per-key rate limit exceeded. */
95
+ 429: RateLimitError;
96
+ /** Internal server error */
97
+ 500: InternalServerError;
98
+ };
99
+
100
+ export type CreateReportResponses = {
101
+ /** Report created and queued for generation */
102
+ 201: {
103
+ brandAliases: Array<string>;
104
+ brandName: string;
105
+ brandWebsite: string;
106
+ createdAt: Date;
107
+ /** Unique identifier for the created report */
108
+ reportId: string;
109
+ /** Initial report status */
110
+ status: 'pending';
111
+ };
112
+ };
113
+
114
+ export type CreateReportResponse = CreateReportResponses[keyof CreateReportResponses];
115
+
116
+ export type GetReportErrors = {
117
+ /** Invalid request data */
118
+ 400: ValidationError;
119
+ /** Authentication required */
120
+ 401: UnauthorizedError;
121
+ /**
122
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
123
+ * read-only (demo) mode.
124
+ */
125
+ 403: ForbiddenError;
126
+ /** Resource not found */
127
+ 404: NotFoundError;
128
+ /** Per-key rate limit exceeded. */
129
+ 429: RateLimitError;
130
+ /** Internal server error */
131
+ 500: InternalServerError;
132
+ };
133
+
134
+ export type GetReportResponses = {
135
+ /**
136
+ * Report status and data. When status is 'completed', includes per-prompt snapshot data with raw
137
+ * mention counts.
138
+ */
139
+ 200: {
140
+ brandAliases: Array<string>;
141
+ brandName: string;
142
+ brandWebsite: string;
143
+ completedAt: Date | null;
144
+ createdAt: Date;
145
+ /** Generation progress percentage (0-100). Available while processing. */
146
+ progress?: number;
147
+ /** Per-prompt snapshot data. Only present when status is 'completed'. */
148
+ prompts?: Array<ReportPromptSnapshot>;
149
+ reportId: string;
150
+ status: 'pending' | 'processing' | 'completed' | 'failed';
151
+ /**
152
+ * Derived stats (SoV, visibility, etc.). Format may change between versions. Only present when
153
+ * status is 'completed'.
154
+ */
155
+ unstable?: {
156
+ /** Per-competitor SoV breakdown, sorted by SoV descending */
157
+ competitors?: Array<{
158
+ /** Competitor name */
159
+ name: string;
160
+ /** Number of individual prompt runs where this competitor was mentioned */
161
+ promptRunsWithMentions: number;
162
+ /** Number of prompts where this competitor was mentioned in at least one run */
163
+ promptsWithMentions: number;
164
+ /**
165
+ * Share of voice (0-1): this competitor's mentions / total mentions (brand + all
166
+ * competitors)
167
+ *
168
+ * @minimum 0
169
+ * @maximum 1
170
+ */
171
+ sov: number;
172
+ /**
173
+ * Visibility (0-1): prompt runs mentioning this competitor / total prompt runs
174
+ *
175
+ * @minimum 0
176
+ * @maximum 1
177
+ */
178
+ visibility: number;
179
+ }>;
180
+ /** Number of individual prompt runs where the brand was mentioned */
181
+ promptRunsWithBrandMentions?: number;
182
+ /** Number of prompts where the brand was mentioned in at least one prompt run */
183
+ promptsWithBrandMentions?: number;
184
+ /**
185
+ * Overall share of voice (0-1): brand_mentions / (brand_mentions + competitor_mentions). Null
186
+ * when no mentions at all.
187
+ *
188
+ * @minimum 0
189
+ * @maximum 1
190
+ */
191
+ sov?: number | null;
192
+ /**
193
+ * Total number of prompt runs across all prompts (each prompt is executed multiple times
194
+ * across different AI engines)
195
+ */
196
+ totalPromptRuns?: number;
197
+ /** Total number of prompts evaluated */
198
+ totalPrompts?: number;
199
+ /**
200
+ * Brand visibility (0-1): brand_mentions / total_prompt_runs (how often the brand appears at
201
+ * all across all prompt runs)
202
+ *
203
+ * @minimum 0
204
+ * @maximum 1
205
+ */
206
+ visibility?: number;
207
+ };
208
+ };
209
+ };
210
+
211
+ export type GetReportResponse = GetReportResponses[keyof GetReportResponses];
212
+
213
+ export type ListReportsParams = {
214
+ /**
215
+ * Page number, 1-based.
216
+ *
217
+ * @default 1
218
+ * @minimum 1
219
+ */
220
+ page?: Page;
221
+ /**
222
+ * Items per page. Values above the maximum are clamped, not rejected.
223
+ *
224
+ * @default 20
225
+ * @minimum 1
226
+ * @maximum 100
227
+ */
228
+ limit?: Limit;
229
+ };
230
+
231
+ export type CreateReportParams = {
232
+ /**
233
+ * The brand name to analyze
234
+ *
235
+ * @minLength 1
236
+ */
237
+ brandName: string;
238
+ /**
239
+ * Other names the brand goes by (spellings, abbreviations, product names). A mention of any of
240
+ * them counts as a brand mention.
241
+ *
242
+ * @maxItems 10
243
+ */
244
+ brandAliases?: Array<string>;
245
+ /**
246
+ * The brand's website — a domain (nike.com) or a full URL. A URL with a path (e.g.
247
+ * https://www.nike.com/golf) scopes the analysis to that page; mentions are tracked against its
248
+ * domain either way.
249
+ *
250
+ * @minLength 1
251
+ */
252
+ brandWebsite: string;
253
+ /** Optional list of custom prompts to include in the report */
254
+ manualPrompts?: Array<string>;
255
+ };
256
+
257
+ export type GetReportParams = {
258
+ /**
259
+ * Number of top competitor entities to return in each prompt's mentionsTopK
260
+ *
261
+ * @default 5
262
+ * @minimum 1
263
+ * @maximum 50
264
+ */
265
+ kMentions?: number;
266
+ };
@@ -0,0 +1,131 @@
1
+ import type {
2
+ ForbiddenError,
3
+ InternalServerError,
4
+ RateLimitError,
5
+ UnauthorizedError,
6
+ } from './shared/error';
7
+ import type { Limit } from './shared/limit';
8
+ import type { ModelFilter, WindowEnd, WindowStart } from './shared/model-filter';
9
+ import type { NotFoundError } from './shared/not-found-error';
10
+ import type { Page } from './shared/page';
11
+ import type { Pagination } from './shared/pagination';
12
+ import type { ValidationError } from './shared/validation-error';
13
+
14
+ /** A single model answer, without its text. Fetch `prompts.runs.get()` for the answer itself. */
15
+ export type RunSummary = {
16
+ brandId: string;
17
+ brandMentioned: boolean;
18
+ citationCount: number;
19
+ competitorsMentioned: Array<string>;
20
+ createdAt: Date;
21
+ id: string;
22
+ model: string;
23
+ promptId: string;
24
+ /** How the answer was obtained. Informational; not a stable enum. */
25
+ provider: string | null;
26
+ /** Searches the engine ran, where it exposes them. */
27
+ webQueries: Array<string>;
28
+ /** Whether the engine answered with its own web search on. */
29
+ webSearchEnabled: boolean;
30
+ };
31
+
32
+ export type RunCitation = {
33
+ /** Position within the answer's citation list. */
34
+ citationIndex: number;
35
+ domain: string;
36
+ title: string | null;
37
+ url: string;
38
+ };
39
+
40
+ /** One model answer with its normalized text and citations. */
41
+ export type Run = RunSummary & {
42
+ answer: {
43
+ /**
44
+ * The answer, normalized out of the provider's response. Null when nothing could be extracted.
45
+ */
46
+ text: string | null;
47
+ };
48
+ citations: Array<RunCitation>;
49
+ };
50
+
51
+ export type RunList = {
52
+ data: Array<RunSummary>;
53
+ pagination: Pagination;
54
+ };
55
+
56
+ export type ListPromptRunsErrors = {
57
+ /** Invalid request data */
58
+ 400: ValidationError;
59
+ /** Authentication required */
60
+ 401: UnauthorizedError;
61
+ /**
62
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
63
+ * read-only (demo) mode.
64
+ */
65
+ 403: ForbiddenError;
66
+ /** Resource not found */
67
+ 404: NotFoundError;
68
+ /** Per-key rate limit exceeded. */
69
+ 429: RateLimitError;
70
+ /** Internal server error */
71
+ 500: InternalServerError;
72
+ };
73
+
74
+ export type ListPromptRunsResponses = {
75
+ /** List runs for a prompt */
76
+ 200: RunList;
77
+ };
78
+
79
+ export type GetRunErrors = {
80
+ /** Invalid request data */
81
+ 400: ValidationError;
82
+ /** Authentication required */
83
+ 401: UnauthorizedError;
84
+ /**
85
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
86
+ * read-only (demo) mode.
87
+ */
88
+ 403: ForbiddenError;
89
+ /** Resource not found */
90
+ 404: NotFoundError;
91
+ /** Per-key rate limit exceeded. */
92
+ 429: RateLimitError;
93
+ /** Internal server error */
94
+ 500: InternalServerError;
95
+ };
96
+
97
+ export type GetRunResponses = {
98
+ /** Get a run */
99
+ 200: Run;
100
+ };
101
+
102
+ export type ListPromptRunsParams = {
103
+ /**
104
+ * Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A
105
+ * bare `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a
106
+ * local calendar day there.
107
+ */
108
+ start: WindowStart;
109
+ /**
110
+ * Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
111
+ * exactly `end` is outside it.
112
+ */
113
+ end: WindowEnd;
114
+ /** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
115
+ model?: ModelFilter;
116
+ /**
117
+ * Page number, 1-based.
118
+ *
119
+ * @default 1
120
+ * @minimum 1
121
+ */
122
+ page?: Page;
123
+ /**
124
+ * Items per page. Values above the maximum are clamped, not rejected.
125
+ *
126
+ * @default 20
127
+ * @minimum 1
128
+ * @maximum 100
129
+ */
130
+ limit?: Limit;
131
+ };
@@ -0,0 +1,2 @@
1
+ /** Brand identifier. */
2
+ export type BrandIdPath = string;
@@ -0,0 +1,7 @@
1
+ import type { Error } from './error';
2
+
3
+ /** Resource already exists */
4
+ export type ConflictError = Error;
5
+
6
+ /** The organization has no active subscription. Cloud deployments only. */
7
+ export type PaymentRequiredError = Error;
@@ -0,0 +1,29 @@
1
+ export type Error = {
2
+ /**
3
+ * Stable machine-readable code. Deliberately not an enum: new values are added without a version
4
+ * bump, so treat an unrecognized one as its HTTP status implies. Currently: `unauthorized`,
5
+ * `insufficient_scope`, `forbidden`, `not_found`, `validation_error`, `conflict`, `rate_limited`,
6
+ * `method_not_allowed`, `read_only`, `no_active_plan`, `brand_limit`, `prompt_limit`,
7
+ * `model_not_in_plan`, `model_picks_exceeded`, `premium_not_in_plan`, `premium_pool_exhausted`,
8
+ * `cadence_faster_than_plan`, `internal_error`.
9
+ */
10
+ code?: string;
11
+ /** Error type */
12
+ error: string;
13
+ /** Detailed error message */
14
+ message?: string;
15
+ };
16
+
17
+ /** Authentication required */
18
+ export type UnauthorizedError = Error;
19
+
20
+ export type InternalServerError = Error;
21
+
22
+ /**
23
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
24
+ * read-only (demo) mode.
25
+ */
26
+ export type ForbiddenError = Error;
27
+
28
+ /** Per-key rate limit exceeded. */
29
+ export type RateLimitError = Error;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Items per page. Values above the maximum are clamped, not rejected.
3
+ *
4
+ * @default 20
5
+ * @minimum 1
6
+ * @maximum 100
7
+ */
8
+ export type Limit = number;
@@ -0,0 +1,21 @@
1
+ /** Aggregated mention counts for a prompt across its evaluation runs. */
2
+ export type MentionsSummary = {
3
+ /** Number of runs where the brand was mentioned */
4
+ brandMentionsTotal: number;
5
+ /**
6
+ * Total count of individual competitor mentions across all runs (a single run mentioning 3
7
+ * competitors counts as 3)
8
+ */
9
+ competitorMentionsTotal: number;
10
+ /** Top-K competitor entities ranked by mention count */
11
+ mentionsTopK: Array<MentionEntry>;
12
+ /** Total brand + competitor mentions across all runs */
13
+ mentionsTotal: number;
14
+ };
15
+
16
+ export type MentionEntry = {
17
+ /** Number of runs where this entity was mentioned */
18
+ count: number;
19
+ /** Competitor entity name */
20
+ entity: string;
21
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Inclusive lower bound of the window, an ISO 8601 timestamp such as `2026-01-01T00:00:00Z`. A bare
3
+ * `YYYY-MM-DD` is rejected: that is `/prompts/{promptId}/snapshot`'s spelling and means a local
4
+ * calendar day there.
5
+ */
6
+ export type WindowStart = Date;
7
+
8
+ /**
9
+ * Exclusive upper bound of the window, an ISO 8601 timestamp. The window is half-open: a run at
10
+ * exactly `end` is outside it.
11
+ */
12
+ export type WindowEnd = Date;
13
+
14
+ /** Restrict to one model, e.g. `chatgpt`. See `models.list()`. */
15
+ export type ModelFilter = string;
@@ -0,0 +1,4 @@
1
+ import type { Error } from './error';
2
+
3
+ /** Resource not found */
4
+ export type NotFoundError = Error;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Page number, 1-based.
3
+ *
4
+ * @default 1
5
+ * @minimum 1
6
+ */
7
+ export type Page = number;
@@ -0,0 +1,7 @@
1
+ export type Pagination = {
2
+ limit: number;
3
+ page: number;
4
+ /** Total items matching the request. */
5
+ total: number;
6
+ totalPages: number;
7
+ };
@@ -0,0 +1,4 @@
1
+ import type { Error } from './error';
2
+
3
+ /** Invalid request data */
4
+ export type ValidationError = Error;
@@ -0,0 +1,88 @@
1
+ import type {
2
+ ForbiddenError,
3
+ InternalServerError,
4
+ RateLimitError,
5
+ UnauthorizedError,
6
+ } from './shared/error';
7
+ import type { MentionsSummary } from './shared/mention-entry';
8
+ import type { NotFoundError } from './shared/not-found-error';
9
+ import type { ValidationError } from './shared/validation-error';
10
+
11
+ export type CitedURLEntry = {
12
+ /** Number of times this URL was cited */
13
+ count: number;
14
+ /** Page title if available */
15
+ title: string | null;
16
+ /** The cited URL */
17
+ url: string;
18
+ };
19
+
20
+ export type PromptSnapshot = {
21
+ /** Brand identifier this prompt belongs to */
22
+ brandId: string;
23
+ citations: {
24
+ /** Number of citations to brand-owned domains */
25
+ brandCitationsTotal: number;
26
+ /** Total number of citations across all runs */
27
+ citationsTotal: number;
28
+ /** Top-K cited URLs ranked by frequency */
29
+ citedUrlsTopK: Array<CitedURLEntry>;
30
+ /** Number of citations to competitor-owned domains */
31
+ competitorCitationsTotal: number;
32
+ };
33
+ /** End of the queried date range (YYYY-MM-DD) */
34
+ endDate: string;
35
+ mentions: MentionsSummary;
36
+ /** Unique identifier for the prompt */
37
+ promptId: string;
38
+ /** The prompt text */
39
+ promptValue: string;
40
+ /** Start of the queried date range (YYYY-MM-DD) */
41
+ startDate: string;
42
+ };
43
+
44
+ export type GetPromptSnapshotErrors = {
45
+ /** Invalid request data */
46
+ 400: ValidationError;
47
+ /** Authentication required */
48
+ 401: UnauthorizedError;
49
+ /**
50
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
51
+ * read-only (demo) mode.
52
+ */
53
+ 403: ForbiddenError;
54
+ /** Resource not found */
55
+ 404: NotFoundError;
56
+ /** Per-key rate limit exceeded. */
57
+ 429: RateLimitError;
58
+ /** Internal server error */
59
+ 500: InternalServerError;
60
+ };
61
+
62
+ export type GetPromptSnapshotResponses = {
63
+ /** Prompt snapshot with mention and citation analytics */
64
+ 200: PromptSnapshot;
65
+ };
66
+
67
+ export type GetPromptSnapshotParams = {
68
+ /** Start of date range (YYYY-MM-DD) */
69
+ startDate: string;
70
+ /** End of date range (YYYY-MM-DD) */
71
+ endDate: string;
72
+ /**
73
+ * Number of top competitor entities to return in mentionsTopK
74
+ *
75
+ * @default 5
76
+ * @minimum 1
77
+ * @maximum 50
78
+ */
79
+ kMentions?: number;
80
+ /**
81
+ * Number of top cited URLs to return in citedUrlsTopK
82
+ *
83
+ * @default 10
84
+ * @minimum 1
85
+ * @maximum 50
86
+ */
87
+ kCitations?: number;
88
+ };
@@ -0,0 +1,47 @@
1
+ import type {
2
+ ForbiddenError,
3
+ InternalServerError,
4
+ RateLimitError,
5
+ UnauthorizedError,
6
+ } from './shared/error';
7
+ import type { NotFoundError } from './shared/not-found-error';
8
+
9
+ export type Tag = {
10
+ /** The tag, normalized to lower case. */
11
+ name: string;
12
+ /** Prompts in this brand carrying the tag. */
13
+ promptCount: number;
14
+ /**
15
+ * True for `branded` and `unbranded`, which Elmo computes from the prompt text. A system tag
16
+ * always appears here; applying it to a prompt as a user tag overrides the computed
17
+ * classification rather than creating a new tag.
18
+ */
19
+ system: boolean;
20
+ };
21
+
22
+ export type TagList = {
23
+ brandId: string;
24
+ /** System tags first, then user tags alphabetically — the order the dashboard's filter shows. */
25
+ data: Array<Tag>;
26
+ };
27
+
28
+ export type ListBrandTagsErrors = {
29
+ /** Authentication required */
30
+ 401: UnauthorizedError;
31
+ /**
32
+ * The key is valid but not permitted: a missing scope, an admin-only endpoint, or a write in
33
+ * read-only (demo) mode.
34
+ */
35
+ 403: ForbiddenError;
36
+ /** Resource not found */
37
+ 404: NotFoundError;
38
+ /** Per-key rate limit exceeded. */
39
+ 429: RateLimitError;
40
+ /** Internal server error */
41
+ 500: InternalServerError;
42
+ };
43
+
44
+ export type ListBrandTagsResponses = {
45
+ /** List a brand's tags */
46
+ 200: TagList;
47
+ };