@elmohq/sdk 0.0.0-stage → 0.1.1
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 +326 -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 +1031 -0
- package/dist/index.mjs.map +1 -0
- package/dist/request-options-B9S9d24M.d.mts +1549 -0
- package/dist/request-options-B9S9d24M.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-B1lVtYAr.mjs +2459 -0
- package/dist/tools-B1lVtYAr.mjs.map +1 -0
- package/dist/types/index.d.mts +2 -0
- package/dist/types/index.mjs +1 -0
- package/package.json +68 -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 +649 -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 +225 -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/page.ts +402 -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 +554 -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 +168 -0
- package/src/internal/feature/rules.ts +54 -0
- package/src/internal/feature/timeout.ts +146 -0
- package/src/internal/feature/validate.ts +82 -0
- package/src/internal/transport/fetch.ts +82 -0
- package/src/resources/analytics.ts +364 -0
- package/src/resources/brands.ts +288 -0
- package/src/resources/competitors.ts +213 -0
- package/src/resources/identity.ts +49 -0
- package/src/resources/models.ts +32 -0
- package/src/resources/opportunities.ts +81 -0
- package/src/resources/organizations.ts +182 -0
- package/src/resources/prompts.ts +293 -0
- package/src/resources/reports.ts +212 -0
- package/src/resources/runs.ts +124 -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 +69 -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,124 @@
|
|
|
1
|
+
import { apiKeyRequirements } from './shared/auth';
|
|
2
|
+
import type { RequestOptions } from './shared/request-options';
|
|
3
|
+
import { ElmoResource } from './shared/resource';
|
|
4
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
5
|
+
import { callable } from '../internal/core/callable';
|
|
6
|
+
import { PagePromise, pages } from '../internal/core/page';
|
|
7
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
8
|
+
import type { Mutable } from '../internal/feature/validate';
|
|
9
|
+
import { decoded, reviving } from '../internal/feature/validate';
|
|
10
|
+
import type {
|
|
11
|
+
GetRunErrors,
|
|
12
|
+
GetRunResponses,
|
|
13
|
+
ListPromptRunsErrors,
|
|
14
|
+
ListPromptRunsParams,
|
|
15
|
+
ListPromptRunsResponses,
|
|
16
|
+
Run,
|
|
17
|
+
RunCitation,
|
|
18
|
+
RunList,
|
|
19
|
+
RunSummary,
|
|
20
|
+
} from '../types/runs';
|
|
21
|
+
|
|
22
|
+
export const listPromptRunsFields = { path: ['promptId'] };
|
|
23
|
+
|
|
24
|
+
function reviveRunSummary(value: Mutable<RunSummary>): void {
|
|
25
|
+
if (value.createdAt != null) {
|
|
26
|
+
value.createdAt = decoded('RunSummary.createdAt', value.createdAt, (raw) => new Date(raw));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function reviveRunList(value: Mutable<RunList>): void {
|
|
31
|
+
if (value.data != null) {
|
|
32
|
+
value.data.forEach((item) => {
|
|
33
|
+
reviveRunSummary(item);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export const listPromptRunsDescriptor = /* @__PURE__ */ callable({
|
|
39
|
+
address: '/prompts/{promptId}/runs',
|
|
40
|
+
auth: apiKeyRequirements,
|
|
41
|
+
method: 'get',
|
|
42
|
+
pagination: {
|
|
43
|
+
items: 'data',
|
|
44
|
+
limitParam: 'limit',
|
|
45
|
+
pages: 'pagination.totalPages',
|
|
46
|
+
param: 'page',
|
|
47
|
+
size: 'pagination.limit',
|
|
48
|
+
style: 'page',
|
|
49
|
+
total: 'pagination.total',
|
|
50
|
+
},
|
|
51
|
+
returns: 'json',
|
|
52
|
+
validators: { response: /* @__PURE__ */ reviving(reviveRunList) },
|
|
53
|
+
} as const);
|
|
54
|
+
|
|
55
|
+
export const getRunFields = { path: ['promptId', 'runId'] };
|
|
56
|
+
|
|
57
|
+
function reviveRun(value: Mutable<Run>): void {
|
|
58
|
+
if (value.createdAt != null) {
|
|
59
|
+
value.createdAt = decoded('Run.createdAt', value.createdAt, (raw) => new Date(raw));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export const getRunDescriptor = /* @__PURE__ */ callable({
|
|
64
|
+
address: '/prompts/{promptId}/runs/{runId}',
|
|
65
|
+
auth: apiKeyRequirements,
|
|
66
|
+
method: 'get',
|
|
67
|
+
returns: 'json',
|
|
68
|
+
validators: { response: /* @__PURE__ */ reviving(reviveRun) },
|
|
69
|
+
} as const);
|
|
70
|
+
|
|
71
|
+
/** Individual model answers behind the aggregates */
|
|
72
|
+
export class Runs extends ElmoResource {
|
|
73
|
+
/**
|
|
74
|
+
* Get a run
|
|
75
|
+
*
|
|
76
|
+
* One model answer, with its text normalized out of the provider’s response and its citations in
|
|
77
|
+
* the order the engine listed them. A run belonging to some other prompt answers `404`. The
|
|
78
|
+
* provider’s raw payload is deliberately not exposed — its shape belongs to the provider, not to
|
|
79
|
+
* this API.
|
|
80
|
+
*/
|
|
81
|
+
public get(
|
|
82
|
+
promptId: string,
|
|
83
|
+
runId: string,
|
|
84
|
+
options?: RequestOptions,
|
|
85
|
+
): RestCallPromise<GetRunResponses, GetRunErrors> {
|
|
86
|
+
return callPromise(
|
|
87
|
+
options?.client ?? this.client,
|
|
88
|
+
getRunDescriptor,
|
|
89
|
+
mergeParams(placeParams({ promptId, runId }, getRunFields, 'query'), options),
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* List runs for a prompt
|
|
95
|
+
*
|
|
96
|
+
* Individual model answers behind the aggregates, newest first, without their text — the list
|
|
97
|
+
* stays small enough to page through. Fetch `prompts.runs.get()` for the answer itself.
|
|
98
|
+
*/
|
|
99
|
+
public list(
|
|
100
|
+
promptId: string,
|
|
101
|
+
params: ListPromptRunsParams,
|
|
102
|
+
options?: RequestOptions,
|
|
103
|
+
): PagePromise<RunSummary, RunList, ListPromptRunsErrors> {
|
|
104
|
+
return pages(
|
|
105
|
+
options?.client ?? this.client,
|
|
106
|
+
listPromptRunsDescriptor,
|
|
107
|
+
mergeParams(placeParams({ ...params, promptId }, listPromptRunsFields, 'query'), options),
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare namespace Runs {
|
|
113
|
+
export type {
|
|
114
|
+
GetRunErrors,
|
|
115
|
+
GetRunResponses,
|
|
116
|
+
ListPromptRunsErrors,
|
|
117
|
+
ListPromptRunsParams,
|
|
118
|
+
ListPromptRunsResponses,
|
|
119
|
+
Run,
|
|
120
|
+
RunCitation,
|
|
121
|
+
RunList,
|
|
122
|
+
RunSummary,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AuthScheme } from '../../internal/core/types';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An instance admin key from `ADMIN_API_KEYS`, or an organization key (`elmo_…`) issued from the
|
|
5
|
+
* dashboard.
|
|
6
|
+
*/
|
|
7
|
+
export const apiKeyRequirements = [
|
|
8
|
+
{
|
|
9
|
+
key: 'apiKey',
|
|
10
|
+
scheme: 'bearer',
|
|
11
|
+
type: 'http',
|
|
12
|
+
},
|
|
13
|
+
] as const satisfies ReadonlyArray<AuthScheme>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { BaseURL, BehaviorOptions, ClientCredentials } from '../../client';
|
|
2
|
+
import type { Client } from '../../internal/core/client';
|
|
3
|
+
import type {
|
|
4
|
+
AuthValue,
|
|
5
|
+
BodySerializerOptions,
|
|
6
|
+
ConnectionOptions,
|
|
7
|
+
MetadataOptions,
|
|
8
|
+
PageOptions,
|
|
9
|
+
SignalOptions,
|
|
10
|
+
} from '../../internal/core/types';
|
|
11
|
+
|
|
12
|
+
/** What one call may set for itself, overriding the client it goes through. */
|
|
13
|
+
export type RequestOptions = BehaviorOptions &
|
|
14
|
+
BodySerializerOptions &
|
|
15
|
+
ClientCredentials &
|
|
16
|
+
ConnectionOptions<BaseURL, AuthValue, never> &
|
|
17
|
+
MetadataOptions &
|
|
18
|
+
PageOptions &
|
|
19
|
+
SignalOptions & {
|
|
20
|
+
/**
|
|
21
|
+
* The client that sends this call, in place of the one this SDK uses.
|
|
22
|
+
*
|
|
23
|
+
* Build one with `createElmoClient`.
|
|
24
|
+
*/
|
|
25
|
+
client?: Client;
|
|
26
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ClientOptions } from '../../client';
|
|
2
|
+
import type { Client } from '../../internal/core/client';
|
|
3
|
+
import { clientFor, withClient } from '../../internal/core/client';
|
|
4
|
+
|
|
5
|
+
export class ElmoResource {
|
|
6
|
+
/** The client every call on this SDK dispatches through. */
|
|
7
|
+
readonly client: Client;
|
|
8
|
+
|
|
9
|
+
constructor(client: Client) {
|
|
10
|
+
this.client = client;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The same calls, with different options.
|
|
15
|
+
*
|
|
16
|
+
* Options given here layer over the ones already in force. Headers, path
|
|
17
|
+
* parameters and query parameters merge per name. Everything else replaces.
|
|
18
|
+
* What this was called on does not change.
|
|
19
|
+
*/
|
|
20
|
+
public withOptions(options: ClientOptions): this {
|
|
21
|
+
return withClient(this, clientFor(options, this.client));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { InputRule } from '../../internal/core/types';
|
|
2
|
+
|
|
3
|
+
export const nameRule: InputRule = {
|
|
4
|
+
min: 1,
|
|
5
|
+
name: 'name',
|
|
6
|
+
of: 'characters',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const domainsRule: InputRule = {
|
|
10
|
+
min: 1,
|
|
11
|
+
name: 'domains',
|
|
12
|
+
of: 'items',
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const brandNameRule: InputRule = {
|
|
16
|
+
min: 1,
|
|
17
|
+
name: 'brandName',
|
|
18
|
+
of: 'characters',
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const valueRule: InputRule = {
|
|
22
|
+
min: 1,
|
|
23
|
+
name: 'value',
|
|
24
|
+
of: 'characters',
|
|
25
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { apiKeyRequirements } from './shared/auth';
|
|
2
|
+
import type { RequestOptions } from './shared/request-options';
|
|
3
|
+
import { ElmoResource } from './shared/resource';
|
|
4
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
5
|
+
import { callable } from '../internal/core/callable';
|
|
6
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
7
|
+
import type {
|
|
8
|
+
CitedURLEntry,
|
|
9
|
+
GetPromptSnapshotErrors,
|
|
10
|
+
GetPromptSnapshotParams,
|
|
11
|
+
GetPromptSnapshotResponses,
|
|
12
|
+
PromptSnapshot,
|
|
13
|
+
} from '../types/snapshots';
|
|
14
|
+
|
|
15
|
+
export const getPromptSnapshotFields = { path: ['promptId'] };
|
|
16
|
+
|
|
17
|
+
export const getPromptSnapshotDescriptor = /* @__PURE__ */ callable({
|
|
18
|
+
address: '/prompts/{promptId}/snapshot',
|
|
19
|
+
auth: apiKeyRequirements,
|
|
20
|
+
method: 'get',
|
|
21
|
+
returns: 'json',
|
|
22
|
+
} as const);
|
|
23
|
+
|
|
24
|
+
/** Aggregated analytics snapshots for prompts */
|
|
25
|
+
export class Snapshot extends ElmoResource {
|
|
26
|
+
/**
|
|
27
|
+
* Get an aggregated snapshot of mention and citation analytics for a specific prompt over a date
|
|
28
|
+
* range. Use this to identify competitive gaps, track brand visibility trends, and discover top
|
|
29
|
+
* cited URLs.
|
|
30
|
+
*
|
|
31
|
+
* @param promptId The ID of the prompt
|
|
32
|
+
*/
|
|
33
|
+
public get(
|
|
34
|
+
promptId: string,
|
|
35
|
+
params: GetPromptSnapshotParams,
|
|
36
|
+
options?: RequestOptions,
|
|
37
|
+
): RestCallPromise<GetPromptSnapshotResponses, GetPromptSnapshotErrors> {
|
|
38
|
+
return callPromise(
|
|
39
|
+
options?.client ?? this.client,
|
|
40
|
+
getPromptSnapshotDescriptor,
|
|
41
|
+
mergeParams(placeParams({ ...params, promptId }, getPromptSnapshotFields, 'query'), options),
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export declare namespace Snapshot {
|
|
47
|
+
export type {
|
|
48
|
+
CitedURLEntry,
|
|
49
|
+
GetPromptSnapshotErrors,
|
|
50
|
+
GetPromptSnapshotParams,
|
|
51
|
+
GetPromptSnapshotResponses,
|
|
52
|
+
PromptSnapshot,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { apiKeyRequirements } from './shared/auth';
|
|
2
|
+
import type { RequestOptions } from './shared/request-options';
|
|
3
|
+
import { ElmoResource } from './shared/resource';
|
|
4
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
5
|
+
import { callable } from '../internal/core/callable';
|
|
6
|
+
import { mergeParams, placeParams } from '../internal/core/params';
|
|
7
|
+
import type { BrandIdPath } from '../types/shared/brand-id-path';
|
|
8
|
+
import type { ListBrandTagsErrors, ListBrandTagsResponses, Tag, TagList } from '../types/tags';
|
|
9
|
+
|
|
10
|
+
export const listBrandTagsFields = { path: ['brandId'] };
|
|
11
|
+
|
|
12
|
+
export const listBrandTagsDescriptor = /* @__PURE__ */ callable({
|
|
13
|
+
address: '/brands/{brandId}/tags',
|
|
14
|
+
auth: apiKeyRequirements,
|
|
15
|
+
method: 'get',
|
|
16
|
+
returns: 'json',
|
|
17
|
+
} as const);
|
|
18
|
+
|
|
19
|
+
/** The tags in use on a brand's prompts */
|
|
20
|
+
export class Tags extends ElmoResource {
|
|
21
|
+
/**
|
|
22
|
+
* List a brand's tags
|
|
23
|
+
*
|
|
24
|
+
* Every tag in use on the brand's prompts, with how many carry each — enough to build the same
|
|
25
|
+
* filter the dashboard shows without paging the whole prompt list to derive it.
|
|
26
|
+
*
|
|
27
|
+
* Tags are not a resource of their own: a tag exists exactly as long as some prompt carries it.
|
|
28
|
+
* `branded` and `unbranded` are computed by Elmo and always listed.
|
|
29
|
+
*
|
|
30
|
+
* @param brandId Brand identifier.
|
|
31
|
+
*/
|
|
32
|
+
public list(
|
|
33
|
+
brandId: BrandIdPath,
|
|
34
|
+
options?: RequestOptions,
|
|
35
|
+
): RestCallPromise<ListBrandTagsResponses, ListBrandTagsErrors> {
|
|
36
|
+
return callPromise(
|
|
37
|
+
options?.client ?? this.client,
|
|
38
|
+
listBrandTagsDescriptor,
|
|
39
|
+
mergeParams(placeParams({ brandId }, listBrandTagsFields, 'query'), options),
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export declare namespace Tags {
|
|
45
|
+
export type { ListBrandTagsErrors, ListBrandTagsResponses, Tag, TagList };
|
|
46
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { apiKeyRequirements } from './shared/auth';
|
|
2
|
+
import type { RequestOptions } from './shared/request-options';
|
|
3
|
+
import { ElmoResource } from './shared/resource';
|
|
4
|
+
import { callPromise, RestCallPromise } from '../internal/core/call-promise';
|
|
5
|
+
import { callable } from '../internal/core/callable';
|
|
6
|
+
import { groupParams, mergeParams } from '../internal/core/params';
|
|
7
|
+
import type {
|
|
8
|
+
AnalyzeBrandErrors,
|
|
9
|
+
AnalyzeBrandParams,
|
|
10
|
+
AnalyzeBrandResponses,
|
|
11
|
+
OnboardingSuggestion,
|
|
12
|
+
} from '../types/tools';
|
|
13
|
+
|
|
14
|
+
export const analyzeBrandDescriptor = /* @__PURE__ */ callable({
|
|
15
|
+
address: '/tools/analyze',
|
|
16
|
+
auth: apiKeyRequirements,
|
|
17
|
+
mediaType: 'application/json',
|
|
18
|
+
method: 'post',
|
|
19
|
+
returns: 'json',
|
|
20
|
+
rules: [
|
|
21
|
+
{
|
|
22
|
+
min: 1,
|
|
23
|
+
name: 'website',
|
|
24
|
+
of: 'characters',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
max: 100,
|
|
28
|
+
min: 0,
|
|
29
|
+
name: 'maxCompetitors',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
max: 100,
|
|
33
|
+
min: 0,
|
|
34
|
+
name: 'maxPrompts',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
timeout: 600000,
|
|
38
|
+
} as const);
|
|
39
|
+
|
|
40
|
+
/** One-shot helpers (e.g. brand analysis) that don't persist anything */
|
|
41
|
+
export class Tools extends ElmoResource {
|
|
42
|
+
/**
|
|
43
|
+
* Analyze a website
|
|
44
|
+
*
|
|
45
|
+
* Run brand analysis without persisting anything. Returns suggested additional domains, aliases,
|
|
46
|
+
* competitors, and prompts.
|
|
47
|
+
*
|
|
48
|
+
* Requires an instance admin key; organization keys receive `403`.
|
|
49
|
+
*/
|
|
50
|
+
public analyze(
|
|
51
|
+
params: AnalyzeBrandParams,
|
|
52
|
+
options?: RequestOptions,
|
|
53
|
+
): RestCallPromise<AnalyzeBrandResponses, AnalyzeBrandErrors> {
|
|
54
|
+
return callPromise(
|
|
55
|
+
options?.client ?? this.client,
|
|
56
|
+
analyzeBrandDescriptor,
|
|
57
|
+
mergeParams(groupParams(params, 'body'), options),
|
|
58
|
+
);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export declare namespace Tools {
|
|
63
|
+
export type {
|
|
64
|
+
AnalyzeBrandErrors,
|
|
65
|
+
AnalyzeBrandParams,
|
|
66
|
+
AnalyzeBrandResponses,
|
|
67
|
+
OnboardingSuggestion,
|
|
68
|
+
};
|
|
69
|
+
}
|