@proteos/sdk 0.90.0 → 0.92.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/dist/index.cjs +214 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +671 -24
- package/dist/index.d.ts +671 -24
- package/dist/index.js +214 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent/index.ts +3 -0
- package/src/agent/model-types.ts +2 -0
- package/src/agent/session-types.ts +88 -8
- package/src/agent/sessions.ts +51 -0
- package/src/agent/types.ts +14 -0
- package/src/auth/platform-entities.ts +8 -0
- package/src/connector/index.ts +2 -0
- package/src/conversation/index.ts +86 -0
- package/src/conversation/types.ts +194 -0
- package/src/discovery/index.ts +183 -0
- package/src/discovery/types.ts +264 -0
- package/src/functions/actions.ts +5 -1
- package/src/index.ts +51 -1
- package/src/knowledge/index.ts +13 -1
- package/src/knowledge/types.ts +47 -3
- package/src/knowledge/whiteboard-templates.ts +85 -0
- package/src/types/options.ts +11 -0
|
@@ -560,6 +560,20 @@ export interface Message {
|
|
|
560
560
|
* a send would add now. Never part of `content`.
|
|
561
561
|
*/
|
|
562
562
|
signature?: MessageSignature
|
|
563
|
+
/**
|
|
564
|
+
* This email is sent with an unsubscribe link of its own. The link exists
|
|
565
|
+
* only in what the recipient gets; `content` keeps `UNSUBSCRIBE_URL_PLACEHOLDER`
|
|
566
|
+
* or nothing.
|
|
567
|
+
*/
|
|
568
|
+
has_unsubscribe_link?: boolean
|
|
569
|
+
/** The layout chosen for this email (a message template of kind `layout`). Absent means none. May no longer resolve, which fails the send. */
|
|
570
|
+
layout_id?: string
|
|
571
|
+
/**
|
|
572
|
+
* The frame the email carries around its body. On a sent message, the
|
|
573
|
+
* snapshot of what went out. On a single draft read, what a send would use
|
|
574
|
+
* now. Never part of `content`.
|
|
575
|
+
*/
|
|
576
|
+
layout?: MessageLayout
|
|
563
577
|
/** The platform wrote this message (a send or a draft): its content is what the person wrote, without the quote the email carried. Absent on mail imported from the mailbox. */
|
|
564
578
|
is_sent_from_platform?: boolean
|
|
565
579
|
/** The newest entry in this draft's history; absent until its first change. */
|
|
@@ -760,6 +774,30 @@ export interface SendMessageRequest {
|
|
|
760
774
|
* never part of `content`. Ignored on every channel but email.
|
|
761
775
|
*/
|
|
762
776
|
signature?: SignatureChoice
|
|
777
|
+
/**
|
|
778
|
+
* Sends a stored message template instead of `content`: its id or key. It is
|
|
779
|
+
* rendered with `variables` at this moment and stored on the message like any
|
|
780
|
+
* content. `subject`, when omitted, is the template's.
|
|
781
|
+
*/
|
|
782
|
+
template?: string
|
|
783
|
+
/** The names the template's Liquid reads. Ignored without `template`. */
|
|
784
|
+
variables?: Record<string, unknown>
|
|
785
|
+
/**
|
|
786
|
+
* `link` gives the email an unsubscribe link of its own that records an
|
|
787
|
+
* opt-out in the contact's permission ledger; `none` (or omitted) gives it
|
|
788
|
+
* none. The link replaces every `UNSUBSCRIBE_URL_PLACEHOLDER` in the body
|
|
789
|
+
* (what `{{ unsubscribe_url }}` renders to) and goes into a footer line when
|
|
790
|
+
* the body has none. Email only, to exactly one recipient: anything else is
|
|
791
|
+
* refused with 400 `unsubscribe_not_possible`.
|
|
792
|
+
*/
|
|
793
|
+
unsubscribe?: UnsubscribeChoice
|
|
794
|
+
/**
|
|
795
|
+
* Wraps the body in a stored layout when the email is sent: the id or key
|
|
796
|
+
* of a message template of kind `layout`, `none` (or omitted) for no layout.
|
|
797
|
+
* `content` stays as written; the message keeps a snapshot of the layout
|
|
798
|
+
* that went out. Ignored on every channel but email.
|
|
799
|
+
*/
|
|
800
|
+
layout?: string
|
|
763
801
|
/** Reply mode: send into this existing conversation. */
|
|
764
802
|
conversation_id?: string
|
|
765
803
|
/**
|
|
@@ -881,6 +919,10 @@ export interface UpdateDraftRequest {
|
|
|
881
919
|
* carries the `signature` the draft now resolves to.
|
|
882
920
|
*/
|
|
883
921
|
signature?: SignatureChoice
|
|
922
|
+
/** Replaces the draft's unsubscribe choice. Omit to keep it. */
|
|
923
|
+
unsubscribe?: UnsubscribeChoice
|
|
924
|
+
/** Replaces the draft's layout: `none`, or a layout's id or key. Omit to keep it. */
|
|
925
|
+
layout?: string
|
|
884
926
|
/** What this edit is in the draft's history. Defaults to `edited`. */
|
|
885
927
|
version_kind?: Exclude<MessageDraftVersionKind, 'drafted'>
|
|
886
928
|
/** The reviewer's prompt behind a redraft. */
|
|
@@ -2768,6 +2810,13 @@ export interface MergeContactsRequest {
|
|
|
2768
2810
|
|
|
2769
2811
|
export interface RecordPermissionEventRequest {
|
|
2770
2812
|
contact_address_id?: string
|
|
2813
|
+
/**
|
|
2814
|
+
* Scopes the event to the contact's address with this value (an email
|
|
2815
|
+
* address, a phone number) when the caller does not know its id. Refused
|
|
2816
|
+
* with 400 when the contact has no such address. Ignored when
|
|
2817
|
+
* `contact_address_id` is set.
|
|
2818
|
+
*/
|
|
2819
|
+
address?: string
|
|
2771
2820
|
event: PermissionEventType
|
|
2772
2821
|
basis?: string
|
|
2773
2822
|
source?: PermissionEventSource
|
|
@@ -3309,6 +3358,28 @@ export interface MessageSignature {
|
|
|
3309
3358
|
text: string
|
|
3310
3359
|
}
|
|
3311
3360
|
|
|
3361
|
+
/** A send's, draft's or draft edit's pick of an unsubscribe link: none, or a link of the email's own. */
|
|
3362
|
+
export type UnsubscribeChoice = 'none' | 'link'
|
|
3363
|
+
|
|
3364
|
+
/**
|
|
3365
|
+
* What `{{ unsubscribe_url }}` renders to before a message exists. A send with
|
|
3366
|
+
* `unsubscribe: 'link'` swaps every occurrence for the recipient's own link;
|
|
3367
|
+
* an email sent without one (a test send, a preview) gets the address of a
|
|
3368
|
+
* page that says so.
|
|
3369
|
+
*/
|
|
3370
|
+
export const UNSUBSCRIBE_URL_PLACEHOLDER = 'https://unsubscribe.invalid/link'
|
|
3371
|
+
|
|
3372
|
+
/** The layout an email went out in, as stored on the message: a snapshot, since the layout itself may change or go. */
|
|
3373
|
+
export interface MessageLayout {
|
|
3374
|
+
id: string
|
|
3375
|
+
key?: string
|
|
3376
|
+
name: string
|
|
3377
|
+
/** The frame, with `{{ content }}` where the body goes. */
|
|
3378
|
+
html: string
|
|
3379
|
+
/** The frame of the plain part; absent leaves the text as written. */
|
|
3380
|
+
text?: string
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3312
3383
|
export interface CreateEmailSignatureRequest {
|
|
3313
3384
|
name: string
|
|
3314
3385
|
/** `html` or `text` is required. */
|
|
@@ -3343,6 +3414,129 @@ export interface ResolveEmailSignatureQuery {
|
|
|
3343
3414
|
is_reply?: boolean
|
|
3344
3415
|
}
|
|
3345
3416
|
|
|
3417
|
+
/**
|
|
3418
|
+
* What a message template holds: a whole message, a piece of a body, or a
|
|
3419
|
+
* layout. A layout is the frame of a designed email: html (and optionally
|
|
3420
|
+
* text) with `{{ content }}` where the body goes. A send names it with
|
|
3421
|
+
* `layout`; it is never sent on its own.
|
|
3422
|
+
*/
|
|
3423
|
+
export type MessageTemplateKind = 'message' | 'snippet' | 'layout'
|
|
3424
|
+
|
|
3425
|
+
/**
|
|
3426
|
+
* A reusable message, or a reusable piece of one. `subject`, `html` and `text`
|
|
3427
|
+
* are Liquid templates: `{{ contact.first_name }}` is filled in from the
|
|
3428
|
+
* variables a render or a send passes.
|
|
3429
|
+
*
|
|
3430
|
+
* A template is copied into what uses it (a sequence step, a reply), never
|
|
3431
|
+
* referenced from it. A send that names one renders it at that moment.
|
|
3432
|
+
*/
|
|
3433
|
+
export interface MessageTemplate {
|
|
3434
|
+
id: string
|
|
3435
|
+
org_id: string
|
|
3436
|
+
/** The name modules and workflows use; absent for a template nothing refers to. */
|
|
3437
|
+
key?: string
|
|
3438
|
+
name: string
|
|
3439
|
+
description?: string
|
|
3440
|
+
kind: MessageTemplateKind
|
|
3441
|
+
/** The one channel it is written for; absent for any. */
|
|
3442
|
+
channel?: Channel
|
|
3443
|
+
/** The language it is written in, such as `de` or `en-GB`. */
|
|
3444
|
+
language?: string
|
|
3445
|
+
tags: string[]
|
|
3446
|
+
/** A snippet has none. */
|
|
3447
|
+
subject?: string
|
|
3448
|
+
/** Sanitized like every stored email html, its Liquid kept as written. Empty for a text-only template. */
|
|
3449
|
+
html: string
|
|
3450
|
+
/** The plain body; derived from `html` unless `is_text_custom`. */
|
|
3451
|
+
text: string
|
|
3452
|
+
is_text_custom: boolean
|
|
3453
|
+
/** The person it belongs to; absent for the organisation. */
|
|
3454
|
+
owned_by?: UserRef
|
|
3455
|
+
/** The module that deployed it; absent for one made by hand. */
|
|
3456
|
+
module_slug?: string
|
|
3457
|
+
is_archived: boolean
|
|
3458
|
+
created_at: string
|
|
3459
|
+
created_by: UserRef
|
|
3460
|
+
updated_at: string
|
|
3461
|
+
updated_by: UserRef
|
|
3462
|
+
}
|
|
3463
|
+
|
|
3464
|
+
export interface CreateMessageTemplateRequest {
|
|
3465
|
+
key?: string
|
|
3466
|
+
name: string
|
|
3467
|
+
description?: string
|
|
3468
|
+
/** Defaults to `message`. */
|
|
3469
|
+
kind?: MessageTemplateKind
|
|
3470
|
+
/** Empty or omitted writes it for any channel. */
|
|
3471
|
+
channel?: Channel | ''
|
|
3472
|
+
language?: string
|
|
3473
|
+
tags?: string[]
|
|
3474
|
+
subject?: string
|
|
3475
|
+
/** `html` or `text` is required. */
|
|
3476
|
+
html?: string
|
|
3477
|
+
/** Left empty, it is derived from `html`. */
|
|
3478
|
+
text?: string
|
|
3479
|
+
/** Empty or omitted makes it the organisation's. */
|
|
3480
|
+
owned_by_id?: string
|
|
3481
|
+
module_slug?: string
|
|
3482
|
+
is_archived?: boolean
|
|
3483
|
+
}
|
|
3484
|
+
|
|
3485
|
+
/**
|
|
3486
|
+
* Omitted fields keep what is stored. `text` sent empty goes back to being
|
|
3487
|
+
* derived; `key` sent empty takes the name away.
|
|
3488
|
+
*/
|
|
3489
|
+
export type UpdateMessageTemplateRequest = Partial<
|
|
3490
|
+
Omit<CreateMessageTemplateRequest, 'module_slug'>
|
|
3491
|
+
>
|
|
3492
|
+
|
|
3493
|
+
export interface ListMessageTemplatesQuery extends PaginationQuery {
|
|
3494
|
+
kind?: MessageTemplateKind
|
|
3495
|
+
/** Also finds templates written for any channel. */
|
|
3496
|
+
channel?: Channel
|
|
3497
|
+
language?: string
|
|
3498
|
+
module_slug?: string
|
|
3499
|
+
tag?: string
|
|
3500
|
+
/** Matches the name, the key and the description. */
|
|
3501
|
+
search?: string
|
|
3502
|
+
owned_by_id?: string
|
|
3503
|
+
/** true: the organisation's own; false: everyone's personal ones. */
|
|
3504
|
+
is_organisation?: boolean
|
|
3505
|
+
/** Archived templates are left out unless this is true. */
|
|
3506
|
+
is_archived?: boolean
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
/**
|
|
3510
|
+
* Fills in a template's variables. `template` names a stored template by id
|
|
3511
|
+
* or key; without it `subject`, `html` and `text` are the template itself.
|
|
3512
|
+
*/
|
|
3513
|
+
export interface RenderMessageTemplateRequest {
|
|
3514
|
+
template?: string
|
|
3515
|
+
subject?: string
|
|
3516
|
+
html?: string
|
|
3517
|
+
text?: string
|
|
3518
|
+
/** The names the Liquid reads: `{{ contact.first_name }}` reads `variables.contact.first_name`. */
|
|
3519
|
+
variables?: Record<string, unknown>
|
|
3520
|
+
/** Picked as a send picks it, for `connection_id`, `owned_by_id` and `is_reply`. */
|
|
3521
|
+
signature?: SignatureChoice
|
|
3522
|
+
connection_id?: string
|
|
3523
|
+
owned_by_id?: string
|
|
3524
|
+
is_reply?: boolean
|
|
3525
|
+
/** The layout the email would be sent in: its id or key, `none` or omitted for none. The answer carries it beside the body, which comes back without it. */
|
|
3526
|
+
layout?: string
|
|
3527
|
+
}
|
|
3528
|
+
|
|
3529
|
+
/** What a send of the template would store, and the signature that would go below it. */
|
|
3530
|
+
export interface RenderedMessageTemplate {
|
|
3531
|
+
subject: string
|
|
3532
|
+
/** Sanitized, with the editor's look. Empty for a text-only template. */
|
|
3533
|
+
html: string
|
|
3534
|
+
text: string
|
|
3535
|
+
signature: MessageSignature | null
|
|
3536
|
+
/** The frame the email would go out in, `{{ content }}` marking where the body and the signature go. Null or absent without one. */
|
|
3537
|
+
layout?: MessageLayout | null
|
|
3538
|
+
}
|
|
3539
|
+
|
|
3346
3540
|
export interface SendingRule {
|
|
3347
3541
|
id: string
|
|
3348
3542
|
org_id: string
|
package/src/discovery/index.ts
CHANGED
|
@@ -2,15 +2,24 @@ import type { ProteosClient } from '../client.js'
|
|
|
2
2
|
import type {
|
|
3
3
|
CreateDiscoveryEvidenceNarrationRequest,
|
|
4
4
|
CreateDiscoveryEvidenceRequest,
|
|
5
|
+
CreateDiscoveryInterviewDefinitionRequest,
|
|
5
6
|
DiscoveryEvidence,
|
|
6
7
|
DiscoveryEvidenceDownloadUrl,
|
|
7
8
|
DiscoveryEvidenceNarration,
|
|
8
9
|
DiscoveryEvidenceOrgSummary,
|
|
10
|
+
DiscoveryInterview,
|
|
11
|
+
DiscoveryInterviewDefinition,
|
|
12
|
+
DiscoveryInterviewParticipation,
|
|
13
|
+
InviteDiscoveryInterviewParticipantsRequest,
|
|
9
14
|
ListDiscoveryEvidenceQuery,
|
|
15
|
+
ListDiscoveryInterviewDefinitionsQuery,
|
|
16
|
+
ListDiscoveryInterviewsQuery,
|
|
10
17
|
ListPlatformDiscoveryEvidenceQuery,
|
|
11
18
|
ListResponse,
|
|
19
|
+
StartDiscoveryInterviewParticipationRequest,
|
|
12
20
|
UpdateDiscoveryEvidenceRequest,
|
|
13
21
|
UpdateDiscoveryEvidenceStatusRequest,
|
|
22
|
+
UpdateDiscoveryInterviewDefinitionRequest,
|
|
14
23
|
} from './types.js'
|
|
15
24
|
|
|
16
25
|
export * from './types.js'
|
|
@@ -28,6 +37,11 @@ const encode = encodeURIComponent
|
|
|
28
37
|
* from what was said in a recording. `platform` is the Proteos-side view
|
|
29
38
|
* across every org; it answers only to platform admins.
|
|
30
39
|
*
|
|
40
|
+
* `interviewDefinitions` are the interview guides an admin writes and
|
|
41
|
+
* `interviews` what each participant's interview came to. Both also carry the
|
|
42
|
+
* participant's own calls (`getParticipation`, `startParticipation`,
|
|
43
|
+
* `complete`), which answer to the person interviewed, not to a grant.
|
|
44
|
+
*
|
|
31
45
|
* ```ts
|
|
32
46
|
* const discovery = new DiscoveryClient(client)
|
|
33
47
|
* const sent = await discovery.evidence.create({ kind: 'feedback', source: 'web', notes, context })
|
|
@@ -39,11 +53,15 @@ export class DiscoveryClient {
|
|
|
39
53
|
readonly evidence: DiscoveryEvidenceService
|
|
40
54
|
readonly narrations: DiscoveryEvidenceNarrationService
|
|
41
55
|
readonly platform: PlatformDiscoveryEvidenceService
|
|
56
|
+
readonly interviewDefinitions: DiscoveryInterviewDefinitionService
|
|
57
|
+
readonly interviews: DiscoveryInterviewService
|
|
42
58
|
|
|
43
59
|
constructor(client: ProteosClient) {
|
|
44
60
|
this.evidence = new DiscoveryEvidenceServiceImpl(client)
|
|
45
61
|
this.narrations = new DiscoveryEvidenceNarrationServiceImpl(client)
|
|
46
62
|
this.platform = new PlatformDiscoveryEvidenceServiceImpl(client)
|
|
63
|
+
this.interviewDefinitions = new DiscoveryInterviewDefinitionServiceImpl(client)
|
|
64
|
+
this.interviews = new DiscoveryInterviewServiceImpl(client)
|
|
47
65
|
}
|
|
48
66
|
}
|
|
49
67
|
|
|
@@ -84,6 +102,60 @@ export interface PlatformDiscoveryEvidenceService {
|
|
|
84
102
|
createDownloadUrl(id: string, fileId: string): Promise<DiscoveryEvidenceDownloadUrl>
|
|
85
103
|
}
|
|
86
104
|
|
|
105
|
+
/**
|
|
106
|
+
* Interview definitions: the guide (objective, questions, agent) and who it is
|
|
107
|
+
* for. The last two methods are the participant's: what their page shows
|
|
108
|
+
* before the interview, and starting or resuming their own interview.
|
|
109
|
+
*/
|
|
110
|
+
export interface DiscoveryInterviewDefinitionService {
|
|
111
|
+
create(request: CreateDiscoveryInterviewDefinitionRequest): Promise<DiscoveryInterviewDefinition>
|
|
112
|
+
list(
|
|
113
|
+
query?: ListDiscoveryInterviewDefinitionsQuery,
|
|
114
|
+
): Promise<ListResponse<DiscoveryInterviewDefinition>>
|
|
115
|
+
/** The detail read; carries `guide_findings`. */
|
|
116
|
+
get(id: string): Promise<DiscoveryInterviewDefinition>
|
|
117
|
+
update(
|
|
118
|
+
id: string,
|
|
119
|
+
request: UpdateDiscoveryInterviewDefinitionRequest,
|
|
120
|
+
): Promise<DiscoveryInterviewDefinition>
|
|
121
|
+
/** Deletes the definition with its interviews and their recordings. */
|
|
122
|
+
delete(id: string): Promise<void>
|
|
123
|
+
publish(id: string): Promise<DiscoveryInterviewDefinition>
|
|
124
|
+
/** Nobody can start or continue; results stay readable. */
|
|
125
|
+
close(id: string): Promise<DiscoveryInterviewDefinition>
|
|
126
|
+
reopen(id: string): Promise<DiscoveryInterviewDefinition>
|
|
127
|
+
/** Assigns users; people already assigned are returned unchanged. */
|
|
128
|
+
invite(
|
|
129
|
+
id: string,
|
|
130
|
+
request: InviteDiscoveryInterviewParticipantsRequest,
|
|
131
|
+
): Promise<DiscoveryInterview[]>
|
|
132
|
+
getParticipation(id: string): Promise<DiscoveryInterviewParticipation>
|
|
133
|
+
startParticipation(
|
|
134
|
+
id: string,
|
|
135
|
+
request: StartDiscoveryInterviewParticipationRequest,
|
|
136
|
+
): Promise<DiscoveryInterviewParticipation>
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Interviews of a definition, for whoever can read it. `complete` and
|
|
141
|
+
* `getParticipation` are the participant's.
|
|
142
|
+
*/
|
|
143
|
+
export interface DiscoveryInterviewService {
|
|
144
|
+
list(query: ListDiscoveryInterviewsQuery): Promise<ListResponse<DiscoveryInterview>>
|
|
145
|
+
/** The detail read; carries the guide snapshot and the transcript. */
|
|
146
|
+
get(id: string): Promise<DiscoveryInterview>
|
|
147
|
+
/** Sends the invitation again. */
|
|
148
|
+
remind(id: string): Promise<void>
|
|
149
|
+
/** Reruns a synthesis that failed. */
|
|
150
|
+
synthesize(id: string): Promise<DiscoveryInterview>
|
|
151
|
+
/** Withdraws an invitation or deletes a result with its recordings. */
|
|
152
|
+
delete(id: string): Promise<void>
|
|
153
|
+
createDownloadUrl(id: string, fileId: string): Promise<DiscoveryEvidenceDownloadUrl>
|
|
154
|
+
/** Ends the caller's interview and starts the synthesis. Safe to repeat. */
|
|
155
|
+
complete(id: string): Promise<DiscoveryInterviewParticipation>
|
|
156
|
+
getParticipation(id: string): Promise<DiscoveryInterviewParticipation>
|
|
157
|
+
}
|
|
158
|
+
|
|
87
159
|
class DiscoveryEvidenceServiceImpl implements DiscoveryEvidenceService {
|
|
88
160
|
constructor(private readonly client: ProteosClient) {}
|
|
89
161
|
|
|
@@ -168,3 +240,114 @@ class PlatformDiscoveryEvidenceServiceImpl implements PlatformDiscoveryEvidenceS
|
|
|
168
240
|
)
|
|
169
241
|
}
|
|
170
242
|
}
|
|
243
|
+
|
|
244
|
+
class DiscoveryInterviewDefinitionServiceImpl implements DiscoveryInterviewDefinitionService {
|
|
245
|
+
constructor(private readonly client: ProteosClient) {}
|
|
246
|
+
|
|
247
|
+
private path(id?: string, suffix = ''): string {
|
|
248
|
+
const base = `${DISCOVERY_BASE_PATH}/interview-definitions`
|
|
249
|
+
return id === undefined ? base : `${base}/${encode(id)}${suffix}`
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
create(
|
|
253
|
+
request: CreateDiscoveryInterviewDefinitionRequest,
|
|
254
|
+
): Promise<DiscoveryInterviewDefinition> {
|
|
255
|
+
return this.client.request('POST', this.path(), request)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
list(
|
|
259
|
+
query: ListDiscoveryInterviewDefinitionsQuery = {},
|
|
260
|
+
): Promise<ListResponse<DiscoveryInterviewDefinition>> {
|
|
261
|
+
return this.client.requestWithQuery('GET', this.path(), query)
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
get(id: string): Promise<DiscoveryInterviewDefinition> {
|
|
265
|
+
return this.client.request('GET', this.path(id))
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
update(
|
|
269
|
+
id: string,
|
|
270
|
+
request: UpdateDiscoveryInterviewDefinitionRequest,
|
|
271
|
+
): Promise<DiscoveryInterviewDefinition> {
|
|
272
|
+
return this.client.request('PATCH', this.path(id), request)
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
async delete(id: string): Promise<void> {
|
|
276
|
+
await this.client.request('DELETE', this.path(id))
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
publish(id: string): Promise<DiscoveryInterviewDefinition> {
|
|
280
|
+
return this.client.request('POST', this.path(id, '/publish'))
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
close(id: string): Promise<DiscoveryInterviewDefinition> {
|
|
284
|
+
return this.client.request('POST', this.path(id, '/close'))
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
reopen(id: string): Promise<DiscoveryInterviewDefinition> {
|
|
288
|
+
return this.client.request('POST', this.path(id, '/reopen'))
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
async invite(
|
|
292
|
+
id: string,
|
|
293
|
+
request: InviteDiscoveryInterviewParticipantsRequest,
|
|
294
|
+
): Promise<DiscoveryInterview[]> {
|
|
295
|
+
const response = await this.client.request<{ data: DiscoveryInterview[] }>(
|
|
296
|
+
'POST',
|
|
297
|
+
this.path(id, '/interviews'),
|
|
298
|
+
request,
|
|
299
|
+
)
|
|
300
|
+
return response.data
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
getParticipation(id: string): Promise<DiscoveryInterviewParticipation> {
|
|
304
|
+
return this.client.request('GET', this.path(id, '/participation'))
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
startParticipation(
|
|
308
|
+
id: string,
|
|
309
|
+
request: StartDiscoveryInterviewParticipationRequest,
|
|
310
|
+
): Promise<DiscoveryInterviewParticipation> {
|
|
311
|
+
return this.client.request('POST', this.path(id, '/participation/start'), request)
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
class DiscoveryInterviewServiceImpl implements DiscoveryInterviewService {
|
|
316
|
+
constructor(private readonly client: ProteosClient) {}
|
|
317
|
+
|
|
318
|
+
private path(id: string, suffix = ''): string {
|
|
319
|
+
return `${DISCOVERY_BASE_PATH}/interviews/${encode(id)}${suffix}`
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
list(query: ListDiscoveryInterviewsQuery): Promise<ListResponse<DiscoveryInterview>> {
|
|
323
|
+
return this.client.requestWithQuery('GET', `${DISCOVERY_BASE_PATH}/interviews`, query)
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
get(id: string): Promise<DiscoveryInterview> {
|
|
327
|
+
return this.client.request('GET', this.path(id))
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
async remind(id: string): Promise<void> {
|
|
331
|
+
await this.client.request('POST', this.path(id, '/remind'))
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
synthesize(id: string): Promise<DiscoveryInterview> {
|
|
335
|
+
return this.client.request('POST', this.path(id, '/synthesize'))
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
async delete(id: string): Promise<void> {
|
|
339
|
+
await this.client.request('DELETE', this.path(id))
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
createDownloadUrl(id: string, fileId: string): Promise<DiscoveryEvidenceDownloadUrl> {
|
|
343
|
+
return this.client.request('POST', this.path(id, `/files/${encode(fileId)}/download-url`))
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
complete(id: string): Promise<DiscoveryInterviewParticipation> {
|
|
347
|
+
return this.client.request('POST', this.path(id, '/complete'), {})
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
getParticipation(id: string): Promise<DiscoveryInterviewParticipation> {
|
|
351
|
+
return this.client.request('GET', this.path(id, '/participation'))
|
|
352
|
+
}
|
|
353
|
+
}
|