@elmohq/sdk 0.0.0-stage → 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.
- package/LICENSE.md +21 -0
- package/README.md +325 -2
- package/dist/calls/index.d.mts +288 -0
- package/dist/calls/index.d.mts.map +1 -0
- package/dist/calls/index.mjs +390 -0
- package/dist/calls/index.mjs.map +1 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +1029 -0
- package/dist/index.mjs.map +1 -0
- package/dist/request-options-DWYI_Ldj.d.mts +1550 -0
- package/dist/request-options-DWYI_Ldj.d.mts.map +1 -0
- package/dist/tools-7Hs5J2xb.d.mts +1945 -0
- package/dist/tools-7Hs5J2xb.d.mts.map +1 -0
- package/dist/tools-SwP0sK8H.mjs +2458 -0
- package/dist/tools-SwP0sK8H.mjs.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +67 -4
- package/src/calls/brands-analytics-get.ts +33 -0
- package/src/calls/brands-citations-domains-list.ts +36 -0
- package/src/calls/brands-citations-urls-list.ts +32 -0
- package/src/calls/brands-create.ts +19 -0
- package/src/calls/brands-get.ts +19 -0
- package/src/calls/brands-list.ts +18 -0
- package/src/calls/brands-opportunities-get.ts +42 -0
- package/src/calls/brands-prompt-performance-list.ts +39 -0
- package/src/calls/brands-query-fanout-get.ts +30 -0
- package/src/calls/brands-tags-list.ts +28 -0
- package/src/calls/brands-update.ts +20 -0
- package/src/calls/competitors-create.ts +23 -0
- package/src/calls/competitors-delete.ts +19 -0
- package/src/calls/competitors-get.ts +19 -0
- package/src/calls/competitors-list.ts +23 -0
- package/src/calls/competitors-update.ts +24 -0
- package/src/calls/index.ts +33 -0
- package/src/calls/me-get.ts +18 -0
- package/src/calls/models-list.ts +20 -0
- package/src/calls/organizations-billing-get.ts +37 -0
- package/src/calls/organizations-get.ts +24 -0
- package/src/calls/organizations-list.ts +27 -0
- package/src/calls/prompts-create.ts +27 -0
- package/src/calls/prompts-delete.ts +28 -0
- package/src/calls/prompts-get.ts +23 -0
- package/src/calls/prompts-list.ts +28 -0
- package/src/calls/prompts-runs-get.ts +27 -0
- package/src/calls/prompts-runs-list.ts +30 -0
- package/src/calls/prompts-snapshot-get.ts +28 -0
- package/src/calls/prompts-update.ts +29 -0
- package/src/calls/reports-create.ts +31 -0
- package/src/calls/reports-get.ts +27 -0
- package/src/calls/reports-list.ts +28 -0
- package/src/calls/tools-analyze.ts +26 -0
- package/src/client.ts +662 -0
- package/src/index.ts +21 -0
- package/src/internal/binding/rest/binding.ts +127 -0
- package/src/internal/binding/rest/errors.ts +107 -0
- package/src/internal/binding/rest/path.ts +9 -0
- package/src/internal/binding/rest/url.ts +97 -0
- package/src/internal/codec/json.ts +66 -0
- package/src/internal/codec/registry.ts +55 -0
- package/src/internal/core/backoff.ts +170 -0
- package/src/internal/core/body.ts +54 -0
- package/src/internal/core/browser.ts +11 -0
- package/src/internal/core/call-promise.ts +145 -0
- package/src/internal/core/callable.ts +11 -0
- package/src/internal/core/client.ts +89 -0
- package/src/internal/core/config.ts +84 -0
- package/src/internal/core/credentials.ts +40 -0
- package/src/internal/core/dispatch.ts +227 -0
- package/src/internal/core/env.ts +68 -0
- package/src/internal/core/errors.ts +431 -0
- package/src/internal/core/features.ts +60 -0
- package/src/internal/core/lazy-promise.ts +39 -0
- package/src/internal/core/metadata.ts +79 -0
- package/src/internal/core/params.ts +98 -0
- package/src/internal/core/protocol.ts +17 -0
- package/src/internal/core/read-reply.ts +7 -0
- package/src/internal/core/text.ts +7 -0
- package/src/internal/core/types.ts +556 -0
- package/src/internal/feature/auth.ts +201 -0
- package/src/internal/feature/interceptors.ts +36 -0
- package/src/internal/feature/logger.ts +222 -0
- package/src/internal/feature/retry.ts +165 -0
- package/src/internal/feature/rules.ts +54 -0
- package/src/internal/feature/timeout.ts +146 -0
- package/src/internal/feature/validate.ts +74 -0
- package/src/internal/page/page.ts +402 -0
- package/src/internal/transport/fetch.ts +82 -0
- package/src/resources/analytics.ts +363 -0
- package/src/resources/brands.ts +285 -0
- package/src/resources/competitors.ts +212 -0
- package/src/resources/identity.ts +48 -0
- package/src/resources/models.ts +32 -0
- package/src/resources/opportunities.ts +79 -0
- package/src/resources/organizations.ts +181 -0
- package/src/resources/prompts.ts +292 -0
- package/src/resources/reports.ts +211 -0
- package/src/resources/runs.ts +123 -0
- package/src/resources/shared/auth.ts +13 -0
- package/src/resources/shared/request-options.ts +26 -0
- package/src/resources/shared/resource.ts +23 -0
- package/src/resources/shared/rule.ts +25 -0
- package/src/resources/snapshots.ts +54 -0
- package/src/resources/tags.ts +46 -0
- package/src/resources/tools.ts +68 -0
- package/src/types/analytics.ts +497 -0
- package/src/types/brands.ts +228 -0
- package/src/types/competitors.ts +196 -0
- package/src/types/identity.ts +55 -0
- package/src/types/index.ts +163 -0
- package/src/types/models.ts +40 -0
- package/src/types/opportunities.ts +84 -0
- package/src/types/organizations.ts +157 -0
- package/src/types/prompts.ts +231 -0
- package/src/types/reports.ts +266 -0
- package/src/types/runs.ts +131 -0
- package/src/types/shared/brand-id-path.ts +2 -0
- package/src/types/shared/conflict-error.ts +7 -0
- package/src/types/shared/error.ts +29 -0
- package/src/types/shared/limit.ts +8 -0
- package/src/types/shared/mention-entry.ts +21 -0
- package/src/types/shared/model-filter.ts +15 -0
- package/src/types/shared/not-found-error.ts +4 -0
- package/src/types/shared/page.ts +7 -0
- package/src/types/shared/pagination.ts +7 -0
- package/src/types/shared/validation-error.ts +4 -0
- package/src/types/snapshots.ts +88 -0
- package/src/types/tags.ts +47 -0
- package/src/types/tools.ts +78 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { updateCompetitorDescriptor, updateCompetitorFields } from '../resources/competitors';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
UpdateCompetitorErrors,
|
|
8
|
+
UpdateCompetitorParams,
|
|
9
|
+
UpdateCompetitorResponses,
|
|
10
|
+
} from '../types/competitors';
|
|
11
|
+
|
|
12
|
+
/** Update a competitor */
|
|
13
|
+
export function competitorsUpdate(
|
|
14
|
+
client: Client,
|
|
15
|
+
competitorId: string,
|
|
16
|
+
params: UpdateCompetitorParams,
|
|
17
|
+
options?: RequestOptions,
|
|
18
|
+
): RestCallPromise<UpdateCompetitorResponses, UpdateCompetitorErrors> {
|
|
19
|
+
return callPromise(
|
|
20
|
+
options?.client ?? client,
|
|
21
|
+
updateCompetitorDescriptor,
|
|
22
|
+
mergeParams(placeParams({ ...params, competitorId }, updateCompetitorFields, 'body'), options),
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { brandsAnalyticsGet } from './brands-analytics-get';
|
|
2
|
+
export { brandsCitationsDomainsList } from './brands-citations-domains-list';
|
|
3
|
+
export { brandsCitationsURLsList } from './brands-citations-urls-list';
|
|
4
|
+
export { brandsCreate } from './brands-create';
|
|
5
|
+
export { brandsGet } from './brands-get';
|
|
6
|
+
export { brandsList } from './brands-list';
|
|
7
|
+
export { brandsOpportunitiesGet } from './brands-opportunities-get';
|
|
8
|
+
export { brandsPromptPerformanceList } from './brands-prompt-performance-list';
|
|
9
|
+
export { brandsQueryFanoutGet } from './brands-query-fanout-get';
|
|
10
|
+
export { brandsTagsList } from './brands-tags-list';
|
|
11
|
+
export { brandsUpdate } from './brands-update';
|
|
12
|
+
export { competitorsCreate } from './competitors-create';
|
|
13
|
+
export { competitorsDelete } from './competitors-delete';
|
|
14
|
+
export { competitorsGet } from './competitors-get';
|
|
15
|
+
export { competitorsList } from './competitors-list';
|
|
16
|
+
export { competitorsUpdate } from './competitors-update';
|
|
17
|
+
export { meGet } from './me-get';
|
|
18
|
+
export { modelsList } from './models-list';
|
|
19
|
+
export { organizationsBillingGet } from './organizations-billing-get';
|
|
20
|
+
export { organizationsGet } from './organizations-get';
|
|
21
|
+
export { organizationsList } from './organizations-list';
|
|
22
|
+
export { promptsCreate } from './prompts-create';
|
|
23
|
+
export { promptsDelete } from './prompts-delete';
|
|
24
|
+
export { promptsGet } from './prompts-get';
|
|
25
|
+
export { promptsList } from './prompts-list';
|
|
26
|
+
export { promptsRunsGet } from './prompts-runs-get';
|
|
27
|
+
export { promptsRunsList } from './prompts-runs-list';
|
|
28
|
+
export { promptsSnapshotGet } from './prompts-snapshot-get';
|
|
29
|
+
export { promptsUpdate } from './prompts-update';
|
|
30
|
+
export { reportsCreate } from './reports-create';
|
|
31
|
+
export { reportsGet } from './reports-get';
|
|
32
|
+
export { reportsList } from './reports-list';
|
|
33
|
+
export { toolsAnalyze } from './tools-analyze';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { getMeDescriptor } from '../resources/identity';
|
|
4
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
5
|
+
import type { GetMeErrors, GetMeResponses } from '../types/identity';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Describe the calling key
|
|
9
|
+
*
|
|
10
|
+
* What this key is, which organization and brands it reaches, and which scopes it holds. Requires
|
|
11
|
+
* no scope, so it is always safe to call first when wiring up an integration.
|
|
12
|
+
*/
|
|
13
|
+
export function meGet(
|
|
14
|
+
client: Client,
|
|
15
|
+
options?: RequestOptions,
|
|
16
|
+
): RestCallPromise<GetMeResponses, GetMeErrors> {
|
|
17
|
+
return callPromise(options?.client ?? client, getMeDescriptor, options);
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { listModelsDescriptor } from '../resources/models';
|
|
4
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
5
|
+
import type { ListModelsErrors, ListModelsResponses } from '../types/models';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* List trackable models
|
|
9
|
+
*
|
|
10
|
+
* The answer engines this deployment can track, so a client can build a model filter without
|
|
11
|
+
* hardcoding ids that differ between deployments.
|
|
12
|
+
*
|
|
13
|
+
* Requires no scope.
|
|
14
|
+
*/
|
|
15
|
+
export function modelsList(
|
|
16
|
+
client: Client,
|
|
17
|
+
options?: RequestOptions,
|
|
18
|
+
): RestCallPromise<ListModelsResponses, ListModelsErrors> {
|
|
19
|
+
return callPromise(options?.client ?? client, listModelsDescriptor, options);
|
|
20
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import {
|
|
5
|
+
getOrganizationBillingDescriptor,
|
|
6
|
+
getOrganizationBillingFields,
|
|
7
|
+
} from '../resources/organizations';
|
|
8
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
9
|
+
import type {
|
|
10
|
+
GetOrganizationBillingErrors,
|
|
11
|
+
GetOrganizationBillingResponses,
|
|
12
|
+
} from '../types/organizations';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Get billing state
|
|
16
|
+
*
|
|
17
|
+
* The organization's plan, its limits, and how much of each limit is already spent — enough for an
|
|
18
|
+
* integration to know a write will be rejected before attempting it.
|
|
19
|
+
*
|
|
20
|
+
* This endpoint is read-only by construction. No API key of any kind can change a subscription, an
|
|
21
|
+
* add-on quantity, or a payment method; there is no billing write endpoint and no billing write
|
|
22
|
+
* scope. Stripe identifiers, invoices, and payment methods are never returned.
|
|
23
|
+
*
|
|
24
|
+
* Deployments without billing answer `200` with `billingEnabled: false`, a null plan, and null
|
|
25
|
+
* limits, so callers need no special case.
|
|
26
|
+
*/
|
|
27
|
+
export function organizationsBillingGet(
|
|
28
|
+
client: Client,
|
|
29
|
+
organizationId: string,
|
|
30
|
+
options?: RequestOptions,
|
|
31
|
+
): RestCallPromise<GetOrganizationBillingResponses, GetOrganizationBillingErrors> {
|
|
32
|
+
return callPromise(
|
|
33
|
+
options?.client ?? client,
|
|
34
|
+
getOrganizationBillingDescriptor,
|
|
35
|
+
mergeParams(placeParams({ organizationId }, getOrganizationBillingFields, 'query'), options),
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { getOrganizationDescriptor, getOrganizationFields } from '../resources/organizations';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type { GetOrganizationErrors, GetOrganizationResponses } from '../types/organizations';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get an organization
|
|
10
|
+
*
|
|
11
|
+
* No scope required. An organization outside the key's reach answers `404`, identically to one that
|
|
12
|
+
* does not exist.
|
|
13
|
+
*/
|
|
14
|
+
export function organizationsGet(
|
|
15
|
+
client: Client,
|
|
16
|
+
organizationId: string,
|
|
17
|
+
options?: RequestOptions,
|
|
18
|
+
): RestCallPromise<GetOrganizationResponses, GetOrganizationErrors> {
|
|
19
|
+
return callPromise(
|
|
20
|
+
options?.client ?? client,
|
|
21
|
+
getOrganizationDescriptor,
|
|
22
|
+
mergeParams(placeParams({ organizationId }, getOrganizationFields, 'query'), options),
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Client } from '../internal/core/client';
|
|
2
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
3
|
+
import { PagePromise, pages } from '../internal/page/page';
|
|
4
|
+
import { listOrganizationsDescriptor } from '../resources/organizations';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
ListOrganizationsErrors,
|
|
8
|
+
ListOrganizationsParams,
|
|
9
|
+
Organization,
|
|
10
|
+
OrganizationList,
|
|
11
|
+
} from '../types/organizations';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* One entry for an organization key — the one it acts inside. Every organization for an instance
|
|
15
|
+
* admin key. No scope required: a key can only ever see the organization it is already bound to.
|
|
16
|
+
*/
|
|
17
|
+
export function organizationsList(
|
|
18
|
+
client: Client,
|
|
19
|
+
params?: ListOrganizationsParams,
|
|
20
|
+
options?: RequestOptions,
|
|
21
|
+
): PagePromise<Organization, OrganizationList, ListOrganizationsErrors> {
|
|
22
|
+
return pages(
|
|
23
|
+
options?.client ?? client,
|
|
24
|
+
listOrganizationsDescriptor,
|
|
25
|
+
mergeParams(groupParams(params, 'query'), options),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
4
|
+
import { createPromptDescriptor } from '../resources/prompts';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
CreatePromptErrors,
|
|
8
|
+
CreatePromptParams,
|
|
9
|
+
CreatePromptResponses,
|
|
10
|
+
} from '../types/prompts';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a new prompt
|
|
14
|
+
*
|
|
15
|
+
* Create a new prompt for a brand. This will automatically schedule the prompt for execution.
|
|
16
|
+
*/
|
|
17
|
+
export function promptsCreate(
|
|
18
|
+
client: Client,
|
|
19
|
+
params: CreatePromptParams,
|
|
20
|
+
options?: RequestOptions,
|
|
21
|
+
): RestCallPromise<CreatePromptResponses, CreatePromptErrors> {
|
|
22
|
+
return callPromise(
|
|
23
|
+
options?.client ?? client,
|
|
24
|
+
createPromptDescriptor,
|
|
25
|
+
mergeParams(groupParams(params, 'body'), options),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { deletePromptDescriptor, deletePromptFields } from '../resources/prompts';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type { DeletePromptErrors, DeletePromptResponses } from '../types/prompts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Delete a prompt
|
|
10
|
+
*
|
|
11
|
+
* Permanently delete a prompt and cancel all related scheduled jobs. This will also cascade delete
|
|
12
|
+
* all associated prompt runs.
|
|
13
|
+
*
|
|
14
|
+
* Requires an instance admin key; organization keys receive `403`. The dashboard has no delete
|
|
15
|
+
* either — stop tracking a prompt with `promptsUpdate()` and `enabled: false`, which keeps its
|
|
16
|
+
* history and frees the plan slot.
|
|
17
|
+
*/
|
|
18
|
+
export function promptsDelete(
|
|
19
|
+
client: Client,
|
|
20
|
+
promptId: string,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): RestCallPromise<DeletePromptResponses, DeletePromptErrors> {
|
|
23
|
+
return callPromise(
|
|
24
|
+
options?.client ?? client,
|
|
25
|
+
deletePromptDescriptor,
|
|
26
|
+
mergeParams(placeParams({ promptId }, deletePromptFields, 'query'), options),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { getPromptDescriptor, getPromptFields } from '../resources/prompts';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type { GetPromptErrors, GetPromptResponses } from '../types/prompts';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get a prompt
|
|
10
|
+
*
|
|
11
|
+
* Retrieve a specific prompt by ID
|
|
12
|
+
*/
|
|
13
|
+
export function promptsGet(
|
|
14
|
+
client: Client,
|
|
15
|
+
promptId: string,
|
|
16
|
+
options?: RequestOptions,
|
|
17
|
+
): RestCallPromise<GetPromptResponses, GetPromptErrors> {
|
|
18
|
+
return callPromise(
|
|
19
|
+
options?.client ?? client,
|
|
20
|
+
getPromptDescriptor,
|
|
21
|
+
mergeParams(placeParams({ promptId }, getPromptFields, 'query'), options),
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Client } from '../internal/core/client';
|
|
2
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
3
|
+
import { PagePromise, pages } from '../internal/page/page';
|
|
4
|
+
import { listPromptsDescriptor } from '../resources/prompts';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
ListPromptsErrors,
|
|
8
|
+
ListPromptsParams,
|
|
9
|
+
ListPromptsResponse,
|
|
10
|
+
Prompt,
|
|
11
|
+
} from '../types/prompts';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* List all prompts
|
|
15
|
+
*
|
|
16
|
+
* Retrieve a paginated list of all prompts across all brands
|
|
17
|
+
*/
|
|
18
|
+
export function promptsList(
|
|
19
|
+
client: Client,
|
|
20
|
+
params?: ListPromptsParams,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): PagePromise<Prompt, ListPromptsResponse, ListPromptsErrors> {
|
|
23
|
+
return pages(
|
|
24
|
+
options?.client ?? client,
|
|
25
|
+
listPromptsDescriptor,
|
|
26
|
+
mergeParams(groupParams(params, 'query'), options),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { getRunDescriptor, getRunFields } from '../resources/runs';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type { GetRunErrors, GetRunResponses } from '../types/runs';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get a run
|
|
10
|
+
*
|
|
11
|
+
* One model answer, with its text normalized out of the provider’s response and its citations in
|
|
12
|
+
* the order the engine listed them. A run belonging to some other prompt answers `404`. The
|
|
13
|
+
* provider’s raw payload is deliberately not exposed — its shape belongs to the provider, not to
|
|
14
|
+
* this API.
|
|
15
|
+
*/
|
|
16
|
+
export function promptsRunsGet(
|
|
17
|
+
client: Client,
|
|
18
|
+
promptId: string,
|
|
19
|
+
runId: string,
|
|
20
|
+
options?: RequestOptions,
|
|
21
|
+
): RestCallPromise<GetRunResponses, GetRunErrors> {
|
|
22
|
+
return callPromise(
|
|
23
|
+
options?.client ?? client,
|
|
24
|
+
getRunDescriptor,
|
|
25
|
+
mergeParams(placeParams({ promptId, runId }, getRunFields, 'query'), options),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Client } from '../internal/core/client';
|
|
2
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
3
|
+
import { PagePromise, pages } from '../internal/page/page';
|
|
4
|
+
import { listPromptRunsDescriptor, listPromptRunsFields } from '../resources/runs';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
ListPromptRunsErrors,
|
|
8
|
+
ListPromptRunsParams,
|
|
9
|
+
RunList,
|
|
10
|
+
RunSummary,
|
|
11
|
+
} from '../types/runs';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* List runs for a prompt
|
|
15
|
+
*
|
|
16
|
+
* Individual model answers behind the aggregates, newest first, without their text — the list stays
|
|
17
|
+
* small enough to page through. Fetch `promptsRunsGet()` for the answer itself.
|
|
18
|
+
*/
|
|
19
|
+
export function promptsRunsList(
|
|
20
|
+
client: Client,
|
|
21
|
+
promptId: string,
|
|
22
|
+
params: ListPromptRunsParams,
|
|
23
|
+
options?: RequestOptions,
|
|
24
|
+
): PagePromise<RunSummary, RunList, ListPromptRunsErrors> {
|
|
25
|
+
return pages(
|
|
26
|
+
options?.client ?? client,
|
|
27
|
+
listPromptRunsDescriptor,
|
|
28
|
+
mergeParams(placeParams({ ...params, promptId }, listPromptRunsFields, 'query'), options),
|
|
29
|
+
);
|
|
30
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
5
|
+
import { getPromptSnapshotDescriptor, getPromptSnapshotFields } from '../resources/snapshots';
|
|
6
|
+
import type {
|
|
7
|
+
GetPromptSnapshotErrors,
|
|
8
|
+
GetPromptSnapshotParams,
|
|
9
|
+
GetPromptSnapshotResponses,
|
|
10
|
+
} from '../types/snapshots';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Get an aggregated snapshot of mention and citation analytics for a specific prompt over a date
|
|
14
|
+
* range. Use this to identify competitive gaps, track brand visibility trends, and discover top
|
|
15
|
+
* cited URLs.
|
|
16
|
+
*/
|
|
17
|
+
export function promptsSnapshotGet(
|
|
18
|
+
client: Client,
|
|
19
|
+
promptId: string,
|
|
20
|
+
params: GetPromptSnapshotParams,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): RestCallPromise<GetPromptSnapshotResponses, GetPromptSnapshotErrors> {
|
|
23
|
+
return callPromise(
|
|
24
|
+
options?.client ?? client,
|
|
25
|
+
getPromptSnapshotDescriptor,
|
|
26
|
+
mergeParams(placeParams({ ...params, promptId }, getPromptSnapshotFields, 'query'), options),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { updatePromptDescriptor, updatePromptFields } from '../resources/prompts';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
UpdatePromptErrors,
|
|
8
|
+
UpdatePromptParams,
|
|
9
|
+
UpdatePromptResponses,
|
|
10
|
+
} from '../types/prompts';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Update a prompt
|
|
14
|
+
*
|
|
15
|
+
* Update a prompt's properties. Only provided fields will be updated. Toggling `enabled` schedules
|
|
16
|
+
* or unschedules the recurring run job.
|
|
17
|
+
*/
|
|
18
|
+
export function promptsUpdate(
|
|
19
|
+
client: Client,
|
|
20
|
+
promptId: string,
|
|
21
|
+
params: UpdatePromptParams,
|
|
22
|
+
options?: RequestOptions,
|
|
23
|
+
): RestCallPromise<UpdatePromptResponses, UpdatePromptErrors> {
|
|
24
|
+
return callPromise(
|
|
25
|
+
options?.client ?? client,
|
|
26
|
+
updatePromptDescriptor,
|
|
27
|
+
mergeParams(placeParams({ ...params, promptId }, updatePromptFields, 'body'), options),
|
|
28
|
+
);
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
4
|
+
import { createReportDescriptor } from '../resources/reports';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
CreateReportErrors,
|
|
8
|
+
CreateReportParams,
|
|
9
|
+
CreateReportResponses,
|
|
10
|
+
} from '../types/reports';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Create a report
|
|
14
|
+
*
|
|
15
|
+
* Create a new AI Share of Voice report and queue it for generation. The report will evaluate the
|
|
16
|
+
* brand across multiple AI engines (ChatGPT, Claude, Google AI) using generated and optional custom
|
|
17
|
+
* prompts.
|
|
18
|
+
*
|
|
19
|
+
* Requires an instance admin key; organization keys receive `403`.
|
|
20
|
+
*/
|
|
21
|
+
export function reportsCreate(
|
|
22
|
+
client: Client,
|
|
23
|
+
params: CreateReportParams,
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): RestCallPromise<CreateReportResponses, CreateReportErrors> {
|
|
26
|
+
return callPromise(
|
|
27
|
+
options?.client ?? client,
|
|
28
|
+
createReportDescriptor,
|
|
29
|
+
mergeParams(groupParams(params, 'body'), options),
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
4
|
+
import { getReportDescriptor, getReportFields } from '../resources/reports';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type { GetReportErrors, GetReportParams, GetReportResponses } from '../types/reports';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Get report status and data
|
|
10
|
+
*
|
|
11
|
+
* Poll a report's status. When completed, returns per-prompt snapshot data with raw mention counts.
|
|
12
|
+
* Consumers are responsible for computing SoV and other derived metrics from the raw data.
|
|
13
|
+
*
|
|
14
|
+
* Requires an instance admin key; organization keys receive `403`.
|
|
15
|
+
*/
|
|
16
|
+
export function reportsGet(
|
|
17
|
+
client: Client,
|
|
18
|
+
reportId: string,
|
|
19
|
+
params?: GetReportParams,
|
|
20
|
+
options?: RequestOptions,
|
|
21
|
+
): RestCallPromise<GetReportResponses, GetReportErrors> {
|
|
22
|
+
return callPromise(
|
|
23
|
+
options?.client ?? client,
|
|
24
|
+
getReportDescriptor,
|
|
25
|
+
mergeParams(placeParams({ ...params, reportId }, getReportFields, 'query'), options),
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Client } from '../internal/core/client';
|
|
2
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
3
|
+
import { PagePromise, pages } from '../internal/page/page';
|
|
4
|
+
import { listReportsDescriptor } from '../resources/reports';
|
|
5
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
6
|
+
import type {
|
|
7
|
+
ListReportsErrors,
|
|
8
|
+
ListReportsParams,
|
|
9
|
+
ListReportsResponse,
|
|
10
|
+
ReportSummary,
|
|
11
|
+
} from '../types/reports';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Retrieve a paginated list of all reports, ordered by creation date (newest first).
|
|
15
|
+
*
|
|
16
|
+
* Requires an instance admin key; organization keys receive `403`.
|
|
17
|
+
*/
|
|
18
|
+
export function reportsList(
|
|
19
|
+
client: Client,
|
|
20
|
+
params?: ListReportsParams,
|
|
21
|
+
options?: RequestOptions,
|
|
22
|
+
): PagePromise<ReportSummary, ListReportsResponse, ListReportsErrors> {
|
|
23
|
+
return pages(
|
|
24
|
+
options?.client ?? client,
|
|
25
|
+
listReportsDescriptor,
|
|
26
|
+
mergeParams(groupParams(params, 'query'), options),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
2
|
+
import type { Client } from '../internal/core/client';
|
|
3
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
4
|
+
import type { RequestOptions } from '../resources/shared/request-options';
|
|
5
|
+
import { analyzeBrandDescriptor } from '../resources/tools';
|
|
6
|
+
import type { AnalyzeBrandErrors, AnalyzeBrandParams, AnalyzeBrandResponses } from '../types/tools';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Analyze a website
|
|
10
|
+
*
|
|
11
|
+
* Run brand analysis without persisting anything. Returns suggested additional domains, aliases,
|
|
12
|
+
* competitors, and prompts.
|
|
13
|
+
*
|
|
14
|
+
* Requires an instance admin key; organization keys receive `403`.
|
|
15
|
+
*/
|
|
16
|
+
export function toolsAnalyze(
|
|
17
|
+
client: Client,
|
|
18
|
+
params: AnalyzeBrandParams,
|
|
19
|
+
options?: RequestOptions,
|
|
20
|
+
): RestCallPromise<AnalyzeBrandResponses, AnalyzeBrandErrors> {
|
|
21
|
+
return callPromise(
|
|
22
|
+
options?.client ?? client,
|
|
23
|
+
analyzeBrandDescriptor,
|
|
24
|
+
mergeParams(groupParams(params, 'body'), options),
|
|
25
|
+
);
|
|
26
|
+
}
|