@recovr/sdk 1.0.0 → 1.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.
@@ -77,30 +77,6 @@ class RecovrSdk extends HeyApiClient {
77
77
  ...options
78
78
  });
79
79
  }
80
- /**
81
- * List team members
82
- *
83
- * The team at the key's location, for assigning clients (POST /clients/{id}/assign) and filtering by `assigned_to`. Needs `clients:read`.
84
- */
85
- listTeamMembers(options) {
86
- return (options?.client ?? this.client).get({
87
- security: [
88
- {
89
- key: 'oauth2',
90
- scheme: 'bearer',
91
- type: 'http'
92
- },
93
- { name: 'x-api-key', type: 'apiKey' },
94
- {
95
- key: 'bearerAuth',
96
- scheme: 'bearer',
97
- type: 'http'
98
- }
99
- ],
100
- url: '/team-members',
101
- ...options
102
- });
103
- }
104
80
  /**
105
81
  * Get a client
106
82
  *
@@ -441,6 +417,34 @@ class RecovrSdk extends HeyApiClient {
441
417
  ...options
442
418
  });
443
419
  }
420
+ /**
421
+ * Create a label
422
+ *
423
+ * Adds a manual label to the location, as Settings → Labels does, ready for POST /clients/{id}/labels. If the location already has a label of that name (ignoring case), that label is returned instead with a 200, restored if it was archived, and its colour is left as it is. Needs `labels:manage`.
424
+ */
425
+ createClientLabel(options) {
426
+ return (options.client ?? this.client).post({
427
+ security: [
428
+ {
429
+ key: 'oauth2',
430
+ scheme: 'bearer',
431
+ type: 'http'
432
+ },
433
+ { name: 'x-api-key', type: 'apiKey' },
434
+ {
435
+ key: 'bearerAuth',
436
+ scheme: 'bearer',
437
+ type: 'http'
438
+ }
439
+ ],
440
+ url: '/client-labels',
441
+ ...options,
442
+ headers: {
443
+ 'Content-Type': 'application/json',
444
+ ...options.headers
445
+ }
446
+ });
447
+ }
444
448
  /**
445
449
  * List a client's notes
446
450
  *
@@ -596,7 +600,7 @@ class RecovrSdk extends HeyApiClient {
596
600
  /**
597
601
  * List a client's open reminders
598
602
  *
599
- * Reminders the team still has to tick off for this client. Newest first; pages don't repeat or skip items when new ones are added meanwhile. Closed reminders aren't listed. Answers 404 `reminders_unavailable` where the location doesn't have reminders turned on. Needs `notes:read`. Only for clients at the key's location: any other id is a 404.
603
+ * Reminders the team still has to tick off for this client. Newest first; pages don't repeat or skip items when new ones are added meanwhile. Closed reminders aren't listed. Needs `notes:read`. Only for clients at the key's location: any other id is a 404.
600
604
  */
601
605
  listClientReminders(options) {
602
606
  return (options.client ?? this.client).get({
@@ -620,7 +624,7 @@ class RecovrSdk extends HeyApiClient {
620
624
  /**
621
625
  * Set a reminder
622
626
  *
623
- * A reminder for the team about this client, set as the key's owner: due at a time (`due_kind: "date"`, it comes up in Next Up) or at their next class (`due_kind: "next_class"`, it's shown on the class list). Answers 404 `reminders_unavailable` where the location doesn't have reminders turned on. Needs `notes:write`. Only for clients at the key's location: any other id is a 404.
627
+ * A reminder for the team about this client, set as the key's owner: due at a time (`due_kind: "date"`, it comes up in Next Up), at their next class (`due_kind: "next_class"`, it's shown on the class list), or now with no particular time (`due_kind: "now"`). Name a team member in `assigned_to` to give it to them, as the app's Assign picker does. Needs `notes:write`. Only for clients at the key's location: any other id is a 404.
624
628
  */
625
629
  createClientReminder(options) {
626
630
  return (options.client ?? this.client).post({
@@ -645,10 +649,34 @@ class RecovrSdk extends HeyApiClient {
645
649
  }
646
650
  });
647
651
  }
652
+ /**
653
+ * Get a reminder
654
+ *
655
+ * One reminder, open or ticked off. Needs `notes:read`. Only for reminders at the key's location: any other id is a 404.
656
+ */
657
+ getReminder(options) {
658
+ return (options.client ?? this.client).get({
659
+ security: [
660
+ {
661
+ key: 'oauth2',
662
+ scheme: 'bearer',
663
+ type: 'http'
664
+ },
665
+ { name: 'x-api-key', type: 'apiKey' },
666
+ {
667
+ key: 'bearerAuth',
668
+ scheme: 'bearer',
669
+ type: 'http'
670
+ }
671
+ ],
672
+ url: '/reminders/{id}',
673
+ ...options
674
+ });
675
+ }
648
676
  /**
649
677
  * Change a reminder
650
678
  *
651
- * Changes the due time, the note, or both, on an open dated reminder; what you leave out stays. Moving the time re-arms it. A next-class reminder has no time to change (400). Answers 404 `reminders_unavailable` where the location doesn't have reminders turned on. Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
679
+ * Changes the due time, the note, or both, on an open dated reminder; what you leave out stays. Moving the time re-arms it. A next-class reminder has no time to change (400). Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
652
680
  */
653
681
  updateReminder(options) {
654
682
  return (options.client ?? this.client).patch({
@@ -676,7 +704,7 @@ class RecovrSdk extends HeyApiClient {
676
704
  /**
677
705
  * Close a reminder
678
706
  *
679
- * Ticks it off as the key's owner. It doesn't snooze the client. The body is optional. Answers 404 `reminders_unavailable` where the location doesn't have reminders turned on. Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
707
+ * Ticks it off as the key's owner. It doesn't snooze the client. The body is optional. Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
680
708
  */
681
709
  closeReminder(options) {
682
710
  return (options.client ?? this.client).post({
@@ -701,10 +729,62 @@ class RecovrSdk extends HeyApiClient {
701
729
  }
702
730
  });
703
731
  }
732
+ /**
733
+ * Reassign a reminder
734
+ *
735
+ * Gives an open reminder to another team member, or to the whole team with `assigned_to: null`, as the key's owner. The new person is told it was given to them, as when a reminder is set for them, unless they're the key's owner. Giving it to whoever has it already changes nothing. A ticked-off reminder can't be reassigned (409). Needs `notes:write`. Only for reminders at the key's location: any other id is a 404.
736
+ */
737
+ assignReminder(options) {
738
+ return (options.client ?? this.client).post({
739
+ security: [
740
+ {
741
+ key: 'oauth2',
742
+ scheme: 'bearer',
743
+ type: 'http'
744
+ },
745
+ { name: 'x-api-key', type: 'apiKey' },
746
+ {
747
+ key: 'bearerAuth',
748
+ scheme: 'bearer',
749
+ type: 'http'
750
+ }
751
+ ],
752
+ url: '/reminders/{id}/assign',
753
+ ...options,
754
+ headers: {
755
+ 'Content-Type': 'application/json',
756
+ ...options.headers
757
+ }
758
+ });
759
+ }
760
+ /**
761
+ * List the location's reminders
762
+ *
763
+ * Every reminder at the key's location, for any client still on the books: the team's task list. Filter by who it's for, the client, how and when it's due, and whether it's done. Pages don't repeat or skip items when new ones are added meanwhile. Today's due reminders, ranked with the rest of the day's work, are in GET /next-up. Needs `notes:read`.
764
+ */
765
+ listReminders(options) {
766
+ return (options?.client ?? this.client).get({
767
+ security: [
768
+ {
769
+ key: 'oauth2',
770
+ scheme: 'bearer',
771
+ type: 'http'
772
+ },
773
+ { name: 'x-api-key', type: 'apiKey' },
774
+ {
775
+ key: 'bearerAuth',
776
+ scheme: 'bearer',
777
+ type: 'http'
778
+ }
779
+ ],
780
+ url: '/reminders',
781
+ ...options
782
+ });
783
+ }
704
784
  /**
705
785
  * List forms
706
786
  *
707
- * The location's published forms, newest first. Use a form's id to list its submissions.
787
+ * The location's published forms, newest first. Use a form's id to list its submissions. Needs `forms:read`.
708
788
  */
709
789
  listForms(options) {
710
790
  return (options?.client ?? this.client).get({
@@ -728,7 +808,7 @@ class RecovrSdk extends HeyApiClient {
728
808
  /**
729
809
  * Get a form
730
810
  *
731
- * One form with the questions it asks. Works for forms that are no longer published, so older submissions can still be read.
811
+ * One form with the questions it asks. Works for forms that are no longer published, so older submissions can still be read. Needs `forms:read`.
732
812
  */
733
813
  getForm(options) {
734
814
  return (options.client ?? this.client).get({
@@ -752,7 +832,7 @@ class RecovrSdk extends HeyApiClient {
752
832
  /**
753
833
  * List a form's submissions
754
834
  *
755
- * Newest first, or with `after_id` oldest first from that id, which is how to fetch new submissions. Includes anonymous answers (for example to the Feedback form), which have a null `client_id`. Answers can contain contact and health details. Pages hold steady while new submissions arrive: none is repeated or skipped.
835
+ * Newest first, or with `after_id` oldest first from that id, which is how to fetch new submissions. Includes anonymous answers (for example to the Feedback form), which have a null `client_id`. Answers can contain contact and health details. Pages hold steady while new submissions arrive: none is repeated or skipped. Needs `forms:read`.
756
836
  */
757
837
  listFormSubmissions(options) {
758
838
  return (options.client ?? this.client).get({
@@ -776,7 +856,7 @@ class RecovrSdk extends HeyApiClient {
776
856
  /**
777
857
  * List a client's form submissions
778
858
  *
779
- * Every form this client has submitted, newest first (or with `after_id`, oldest first from that id), with their answers. Anonymous answers are never attached to a client. Answers can contain contact and health details.
859
+ * Every form this client has submitted, newest first (or with `after_id`, oldest first from that id), with their answers. Anonymous answers are never attached to a client. Answers can contain contact and health details. Needs `forms:read`.
780
860
  */
781
861
  listClientFormSubmissions(options) {
782
862
  return (options.client ?? this.client).get({
@@ -800,7 +880,7 @@ class RecovrSdk extends HeyApiClient {
800
880
  /**
801
881
  * Get a form submission
802
882
  *
803
- * One submission with its answers. Answers can contain contact and health details.
883
+ * One submission with its answers. Answers can contain contact and health details. Needs `forms:read`.
804
884
  */
805
885
  getFormSubmission(options) {
806
886
  return (options.client ?? this.client).get({
@@ -821,5 +901,1415 @@ class RecovrSdk extends HeyApiClient {
821
901
  ...options
822
902
  });
823
903
  }
904
+ /**
905
+ * Member and risk counts
906
+ *
907
+ * The location's counts as of now: active members (the gym's member count), trials and holds beside it, and how many clients are in each risk band, non-attenders, conversions and renewals. These are the numbers Recovr's own reports, Recovr AI and its MCP retention summary give. Needs `clients:read`.
908
+ *
909
+ * The risk, non-attender, conversion and renewal counts hold only clients the gym shows in reports, as the Clients page's counts do, so they don't add up to `active_members`. GET /clients with the matching `risk_level` lists the same people: its `total` is the count.
910
+ */
911
+ getSummary(options) {
912
+ return (options?.client ?? this.client).get({
913
+ security: [
914
+ {
915
+ key: 'oauth2',
916
+ scheme: 'bearer',
917
+ type: 'http'
918
+ },
919
+ { name: 'x-api-key', type: 'apiKey' },
920
+ {
921
+ key: 'bearerAuth',
922
+ scheme: 'bearer',
923
+ type: 'http'
924
+ }
925
+ ],
926
+ url: '/summary',
927
+ ...options
928
+ });
929
+ }
930
+ /**
931
+ * List the team's activity
932
+ *
933
+ * Everything the team did with clients at the key's location, newest first: messages sent through Recovr, calls, visits and messages logged, notes, snoozes, assignments, flags and Next Up cards ticked off, each with the team member who did it. For team dashboards and KPIs; GET /reports/actions has the Actions Report's totals. Needs `notes:read`.
934
+ *
935
+ * Messages sent through Recovr: every SMS, and emails, WhatsApp, Instagram and Messenger messages a team member or Recovr AI sent. A workflow's email and other non-SMS messages aren't listed. Messages a client sends aren't activity. Label changes aren't listed yet.
936
+ *
937
+ * Pages don't repeat or skip items when new ones are added meanwhile.
938
+ */
939
+ listActivity(options) {
940
+ return (options?.client ?? this.client).get({
941
+ security: [
942
+ {
943
+ key: 'oauth2',
944
+ scheme: 'bearer',
945
+ type: 'http'
946
+ },
947
+ { name: 'x-api-key', type: 'apiKey' },
948
+ {
949
+ key: 'bearerAuth',
950
+ scheme: 'bearer',
951
+ type: 'http'
952
+ }
953
+ ],
954
+ url: '/activity',
955
+ ...options
956
+ });
957
+ }
958
+ /**
959
+ * Actions Report
960
+ *
961
+ * The app's Actions Report for a date range: texts, calls and notes, per team member and per day, week or month, counted exactly as the report in Recovr counts them. Dates are the location's. For each action itself, use GET /activity. Needs `notes:read`.
962
+ */
963
+ getActionsReport(options) {
964
+ return (options.client ?? this.client).get({
965
+ security: [
966
+ {
967
+ key: 'oauth2',
968
+ scheme: 'bearer',
969
+ type: 'http'
970
+ },
971
+ { name: 'x-api-key', type: 'apiKey' },
972
+ {
973
+ key: 'bearerAuth',
974
+ scheme: 'bearer',
975
+ type: 'http'
976
+ }
977
+ ],
978
+ url: '/reports/actions',
979
+ ...options
980
+ });
981
+ }
982
+ /**
983
+ * List leads
984
+ *
985
+ * Leads at the credential's location, newest enquiry first, filtered the way the Leads page filters them. Every filter you send must match (AND). Needs `leads:read`; `answers` and searching by email or phone also need `contact_details:read`.
986
+ *
987
+ * One lead is one enquiry, so a person who enquired twice appears twice; the Leads page groups them by person. Filter by `client_id` for one person's enquiries.
988
+ */
989
+ listLeads(options) {
990
+ return (options?.client ?? this.client).get({
991
+ security: [
992
+ {
993
+ key: 'oauth2',
994
+ scheme: 'bearer',
995
+ type: 'http'
996
+ },
997
+ { name: 'x-api-key', type: 'apiKey' },
998
+ {
999
+ key: 'bearerAuth',
1000
+ scheme: 'bearer',
1001
+ type: 'http'
1002
+ }
1003
+ ],
1004
+ url: '/leads',
1005
+ ...options
1006
+ });
1007
+ }
1008
+ /**
1009
+ * Add a lead
1010
+ *
1011
+ * Adds a lead from another system, such as a quiz or a website form. Recovr matches it to an existing client at the location by email (or by phone, when the first name matches too); otherwise it makes a new client, who appears on the Leads board. A new lead starts the location's Lead received workflows once, with the source "Recovr API". Sending the same `external_id` again is safe: it adds nothing and starts nothing. Send an email or a phone number. Needs `clients:write` and `contact_details:read`. At most 60 leads a minute per location (`rate_limited`). Refusals: `invalid_phone` (a phone-only lead whose number can't be read).
1012
+ */
1013
+ createLead(options) {
1014
+ return (options.client ?? this.client).post({
1015
+ security: [
1016
+ {
1017
+ key: 'oauth2',
1018
+ scheme: 'bearer',
1019
+ type: 'http'
1020
+ },
1021
+ { name: 'x-api-key', type: 'apiKey' },
1022
+ {
1023
+ key: 'bearerAuth',
1024
+ scheme: 'bearer',
1025
+ type: 'http'
1026
+ }
1027
+ ],
1028
+ url: '/leads',
1029
+ ...options,
1030
+ headers: {
1031
+ 'Content-Type': 'application/json',
1032
+ ...options.headers
1033
+ }
1034
+ });
1035
+ }
1036
+ /**
1037
+ * Get a lead
1038
+ *
1039
+ * One lead at the credential's location. Needs `leads:read`; `answers` is included only with `contact_details:read`. A lead at another location is a 404.
1040
+ */
1041
+ getLead(options) {
1042
+ return (options.client ?? this.client).get({
1043
+ security: [
1044
+ {
1045
+ key: 'oauth2',
1046
+ scheme: 'bearer',
1047
+ type: 'http'
1048
+ },
1049
+ { name: 'x-api-key', type: 'apiKey' },
1050
+ {
1051
+ key: 'bearerAuth',
1052
+ scheme: 'bearer',
1053
+ type: 'http'
1054
+ }
1055
+ ],
1056
+ url: '/leads/{id}',
1057
+ ...options
1058
+ });
1059
+ }
1060
+ /**
1061
+ * List lead sources
1062
+ *
1063
+ * Where this location's leads have come from: the sources, forms, campaigns, ad sets and ads the Leads page offers as filters, each usable as a GET /leads filter. Lead statuses aren't configured per location: they are `new`, `visited` and `member` everywhere (see `status` on a Lead). Needs `leads:read`.
1064
+ */
1065
+ listLeadSources(options) {
1066
+ return (options?.client ?? this.client).get({
1067
+ security: [
1068
+ {
1069
+ key: 'oauth2',
1070
+ scheme: 'bearer',
1071
+ type: 'http'
1072
+ },
1073
+ { name: 'x-api-key', type: 'apiKey' },
1074
+ {
1075
+ key: 'bearerAuth',
1076
+ scheme: 'bearer',
1077
+ type: 'http'
1078
+ }
1079
+ ],
1080
+ url: '/lead-sources',
1081
+ ...options
1082
+ });
1083
+ }
1084
+ /**
1085
+ * Archive a lead
1086
+ *
1087
+ * Archives one enquiry, as the Leads page's archive does for a junk or dealt-with lead: it leaves the list (unless asked for) and is never deleted. Archiving an archived lead changes nothing. The client, their other enquiries and their workflows aren't touched. Needs `leads:write`. A lead at another location is a 404.
1088
+ */
1089
+ archiveLead(options) {
1090
+ return (options.client ?? this.client).post({
1091
+ security: [
1092
+ {
1093
+ key: 'oauth2',
1094
+ scheme: 'bearer',
1095
+ type: 'http'
1096
+ },
1097
+ { name: 'x-api-key', type: 'apiKey' },
1098
+ {
1099
+ key: 'bearerAuth',
1100
+ scheme: 'bearer',
1101
+ type: 'http'
1102
+ }
1103
+ ],
1104
+ url: '/leads/{id}/archive',
1105
+ ...options
1106
+ });
1107
+ }
1108
+ /**
1109
+ * Restore a lead
1110
+ *
1111
+ * Restores an archived enquiry to the Leads list. Restoring a lead that isn't archived changes nothing. Needs `leads:write`. A lead at another location is a 404.
1112
+ */
1113
+ unarchiveLead(options) {
1114
+ return (options.client ?? this.client).post({
1115
+ security: [
1116
+ {
1117
+ key: 'oauth2',
1118
+ scheme: 'bearer',
1119
+ type: 'http'
1120
+ },
1121
+ { name: 'x-api-key', type: 'apiKey' },
1122
+ {
1123
+ key: 'bearerAuth',
1124
+ scheme: 'bearer',
1125
+ type: 'http'
1126
+ }
1127
+ ],
1128
+ url: '/leads/{id}/unarchive',
1129
+ ...options
1130
+ });
1131
+ }
1132
+ /**
1133
+ * Archive a client's leads
1134
+ *
1135
+ * Archives every enquiry this client has at the location, as archiving a person's row on the Leads page does, whatever filters you used to find them. Needs `leads:write`. A client at another location, or with no leads here, is a 404.
1136
+ */
1137
+ archiveClientLeads(options) {
1138
+ return (options.client ?? this.client).post({
1139
+ security: [
1140
+ {
1141
+ key: 'oauth2',
1142
+ scheme: 'bearer',
1143
+ type: 'http'
1144
+ },
1145
+ { name: 'x-api-key', type: 'apiKey' },
1146
+ {
1147
+ key: 'bearerAuth',
1148
+ scheme: 'bearer',
1149
+ type: 'http'
1150
+ }
1151
+ ],
1152
+ url: '/clients/{id}/leads/archive',
1153
+ ...options
1154
+ });
1155
+ }
1156
+ /**
1157
+ * Restore a client's leads
1158
+ *
1159
+ * Restores every archived enquiry this client has at the location. Needs `leads:write`. A client at another location, or with no leads here, is a 404.
1160
+ */
1161
+ unarchiveClientLeads(options) {
1162
+ return (options.client ?? this.client).post({
1163
+ security: [
1164
+ {
1165
+ key: 'oauth2',
1166
+ scheme: 'bearer',
1167
+ type: 'http'
1168
+ },
1169
+ { name: 'x-api-key', type: 'apiKey' },
1170
+ {
1171
+ key: 'bearerAuth',
1172
+ scheme: 'bearer',
1173
+ type: 'http'
1174
+ }
1175
+ ],
1176
+ url: '/clients/{id}/leads/unarchive',
1177
+ ...options
1178
+ });
1179
+ }
1180
+ /**
1181
+ * List a client's possible duplicates
1182
+ *
1183
+ * Other clients at the location who share this client's email or phone (at most 5): who a lead's Needs merge flag is about. Merging happens in the booking platform; if they aren't the same person, POST /clients/{id}/not-duplicate clears the flag. Needs `leads:read`. A client at another location is a 404.
1184
+ */
1185
+ listPossibleDuplicates(options) {
1186
+ return (options.client ?? this.client).get({
1187
+ security: [
1188
+ {
1189
+ key: 'oauth2',
1190
+ scheme: 'bearer',
1191
+ type: 'http'
1192
+ },
1193
+ { name: 'x-api-key', type: 'apiKey' },
1194
+ {
1195
+ key: 'bearerAuth',
1196
+ scheme: 'bearer',
1197
+ type: 'http'
1198
+ }
1199
+ ],
1200
+ url: '/clients/{id}/possible-duplicates',
1201
+ ...options
1202
+ });
1203
+ }
1204
+ /**
1205
+ * Clear Needs merge
1206
+ *
1207
+ * Records that this client isn't the same person as the clients sharing their email or phone, as "Not the same person" on the Leads page does: Needs merge is cleared on all of the client's leads. Clearing it when nothing is flagged changes nothing. Needs `leads:write`. A client at another location is a 404.
1208
+ */
1209
+ markNotDuplicate(options) {
1210
+ return (options.client ?? this.client).post({
1211
+ security: [
1212
+ {
1213
+ key: 'oauth2',
1214
+ scheme: 'bearer',
1215
+ type: 'http'
1216
+ },
1217
+ { name: 'x-api-key', type: 'apiKey' },
1218
+ {
1219
+ key: 'bearerAuth',
1220
+ scheme: 'bearer',
1221
+ type: 'http'
1222
+ }
1223
+ ],
1224
+ url: '/clients/{id}/not-duplicate',
1225
+ ...options
1226
+ });
1227
+ }
1228
+ /**
1229
+ * List conversations (the inbox)
1230
+ *
1231
+ * The location's inbox, newest activity first: one conversation per client per channel (SMS, email, WhatsApp, Instagram, Messenger and the rest), with the newest message and whether it's unread or awaiting a reply. Only conversations with at least one message are listed. Needs `conversations:read`; `contact_address` also needs `contact_details:read`.
1232
+ *
1233
+ * Pages don't repeat or skip conversations when new messages arrive meanwhile: a conversation that gets a new message moves to the top, ahead of the page you are on.
1234
+ *
1235
+ * Filter by `status`, `unread`, `awaiting_reply`, `needs_reply`, `client_id`, the kind of `channel` (`sms`, `email`…) or one `channel_id` from GET /channels. Filters combine with AND.
1236
+ */
1237
+ listConversations(options) {
1238
+ return (options?.client ?? this.client).get({
1239
+ security: [
1240
+ {
1241
+ key: 'oauth2',
1242
+ scheme: 'bearer',
1243
+ type: 'http'
1244
+ },
1245
+ { name: 'x-api-key', type: 'apiKey' },
1246
+ {
1247
+ key: 'bearerAuth',
1248
+ scheme: 'bearer',
1249
+ type: 'http'
1250
+ }
1251
+ ],
1252
+ url: '/conversations',
1253
+ ...options
1254
+ });
1255
+ }
1256
+ /**
1257
+ * Get a conversation
1258
+ *
1259
+ * One conversation at the credential's location. Needs `conversations:read`. A conversation at another location is a 404.
1260
+ */
1261
+ getConversation(options) {
1262
+ return (options.client ?? this.client).get({
1263
+ security: [
1264
+ {
1265
+ key: 'oauth2',
1266
+ scheme: 'bearer',
1267
+ type: 'http'
1268
+ },
1269
+ { name: 'x-api-key', type: 'apiKey' },
1270
+ {
1271
+ key: 'bearerAuth',
1272
+ scheme: 'bearer',
1273
+ type: 'http'
1274
+ }
1275
+ ],
1276
+ url: '/conversations/{id}',
1277
+ ...options
1278
+ });
1279
+ }
1280
+ /**
1281
+ * List a conversation's messages
1282
+ *
1283
+ * Every message in one conversation, newest first: what the client sent in (`inbound`) and what the location sent (`outbound`, by staff, Recovr AI, a workflow, or from outside Recovr). Drafts not yet sent aren't listed. Needs `conversations:read`; `from_address` and `to_address` also need `contact_details:read`. A conversation at another location is a 404.
1284
+ *
1285
+ * Filter by `direction`, delivery `status` (`failed` finds sends that didn't arrive) or `channel_id` (one number of several in an SMS conversation). A client's conversations on other channels are listed by GET /conversations?client_id=…. Reading messages here doesn't mark them read in Recovr; POST /conversations/{id}/read does.
1286
+ */
1287
+ listConversationMessages(options) {
1288
+ return (options.client ?? this.client).get({
1289
+ security: [
1290
+ {
1291
+ key: 'oauth2',
1292
+ scheme: 'bearer',
1293
+ type: 'http'
1294
+ },
1295
+ { name: 'x-api-key', type: 'apiKey' },
1296
+ {
1297
+ key: 'bearerAuth',
1298
+ scheme: 'bearer',
1299
+ type: 'http'
1300
+ }
1301
+ ],
1302
+ url: '/conversations/{id}/messages',
1303
+ ...options
1304
+ });
1305
+ }
1306
+ /**
1307
+ * Reply to a conversation
1308
+ *
1309
+ * Sends a message to the client in this conversation, on its own channel (SMS, email, WhatsApp, Instagram, Messenger…), from the channel it last used unless you name one. It reaches a real person and can't be undone, and it appears in the inbox and the client's timeline as sent by you through this app or token. Needs `messages:send`. A conversation at another location is a 404.
1310
+ *
1311
+ * The send is checked as one from Recovr AI is: a client with do-not-contact on for the channel is refused (`do_not_contact`); a client on a bulk send that is waiting, going or paused is refused (`in_bulk_send`); and, unless the client messaged the location in the last day, the same text can't go to more than 3 other people a day (`same_text_limit`) and only a limited number of messages can go out in any ten minutes (`outreach_limited`, with `Retry-After`). The location's own sending rules then apply: a channel with sending turned off, an opted-out client, Meta's reply window for Instagram, Messenger and WhatsApp, credits. Those refusals are a 422 with the reason (`send_refused` or a more specific code).
1312
+ *
1313
+ * Send an `Idempotency-Key` and never retry a send without one: after a timeout or a 5xx, read the conversation's messages to see whether it went before sending again.
1314
+ */
1315
+ replyToConversation(options) {
1316
+ return (options.client ?? this.client).post({
1317
+ security: [
1318
+ {
1319
+ key: 'oauth2',
1320
+ scheme: 'bearer',
1321
+ type: 'http'
1322
+ },
1323
+ { name: 'x-api-key', type: 'apiKey' },
1324
+ {
1325
+ key: 'bearerAuth',
1326
+ scheme: 'bearer',
1327
+ type: 'http'
1328
+ }
1329
+ ],
1330
+ url: '/conversations/{id}/messages',
1331
+ ...options,
1332
+ headers: {
1333
+ 'Content-Type': 'application/json',
1334
+ ...options.headers
1335
+ }
1336
+ });
1337
+ }
1338
+ /**
1339
+ * Send a message to a client
1340
+ *
1341
+ * Sends one text or email to a client, as the message box on a client's profile does, whether or not you've messaged them before. Name the channel by `channel_id` (GET /channels) or by kind with `channel`. A new message goes by SMS or email only, the channels the outreach checks cover; on WhatsApp, Instagram or Messenger, reply in the client's conversation instead. It goes to the client's phone number or email, lands in their conversation for it (a new one if there is none), reaches a real person and can't be undone. It appears in the inbox and the client's timeline as sent by you through this app or token. Needs `messages:send`. A client at another location is a 404.
1342
+ *
1343
+ * The same checks apply as to a reply: do-not-contact for the channel (`do_not_contact`), an open bulk send (`in_bulk_send`), the same text to many people (`same_text_limit`), the outreach cap (`outreach_limited`, with `Retry-After`), then the location's own sending rules (sending turned off, an opted-out client, Meta's messaging window, credits), refused as a 422 with the reason. A message to someone who hasn't written in the last day counts toward the outreach cap.
1344
+ *
1345
+ * Send an `Idempotency-Key` and never retry a send without one: after a timeout or a 5xx, check the client's conversations before sending again.
1346
+ */
1347
+ sendClientMessage(options) {
1348
+ return (options.client ?? this.client).post({
1349
+ security: [
1350
+ {
1351
+ key: 'oauth2',
1352
+ scheme: 'bearer',
1353
+ type: 'http'
1354
+ },
1355
+ { name: 'x-api-key', type: 'apiKey' },
1356
+ {
1357
+ key: 'bearerAuth',
1358
+ scheme: 'bearer',
1359
+ type: 'http'
1360
+ }
1361
+ ],
1362
+ url: '/clients/{id}/messages',
1363
+ ...options,
1364
+ headers: {
1365
+ 'Content-Type': 'application/json',
1366
+ ...options.headers
1367
+ }
1368
+ });
1369
+ }
1370
+ /**
1371
+ * Mark a conversation read
1372
+ *
1373
+ * Marks the conversation's messages read, as opening it in the inbox does, and clears its unread badge for the team. For an Instagram or Messenger conversation the change is passed on to the platform where the connection supports it. Marking a read conversation read changes nothing. Needs `conversations:write`. A conversation at another location is a 404.
1374
+ */
1375
+ markConversationRead(options) {
1376
+ return (options.client ?? this.client).post({
1377
+ security: [
1378
+ {
1379
+ key: 'oauth2',
1380
+ scheme: 'bearer',
1381
+ type: 'http'
1382
+ },
1383
+ { name: 'x-api-key', type: 'apiKey' },
1384
+ {
1385
+ key: 'bearerAuth',
1386
+ scheme: 'bearer',
1387
+ type: 'http'
1388
+ }
1389
+ ],
1390
+ url: '/conversations/{id}/read',
1391
+ ...options
1392
+ });
1393
+ }
1394
+ /**
1395
+ * Mark a conversation unread
1396
+ *
1397
+ * Marks the client's newest message unread, as Mark as unread in the inbox does, so the conversation shows as unread for the team. A conversation with no message from the client is left as it is. Needs `conversations:write`. A conversation at another location is a 404.
1398
+ */
1399
+ markConversationUnread(options) {
1400
+ return (options.client ?? this.client).post({
1401
+ security: [
1402
+ {
1403
+ key: 'oauth2',
1404
+ scheme: 'bearer',
1405
+ type: 'http'
1406
+ },
1407
+ { name: 'x-api-key', type: 'apiKey' },
1408
+ {
1409
+ key: 'bearerAuth',
1410
+ scheme: 'bearer',
1411
+ type: 'http'
1412
+ }
1413
+ ],
1414
+ url: '/conversations/{id}/unread',
1415
+ ...options
1416
+ });
1417
+ }
1418
+ /**
1419
+ * Archive a conversation
1420
+ *
1421
+ * Moves the conversation out of the inbox into Archived, as Archive in the inbox does. It no longer awaits a reply, and it keeps its read or unread state. It comes back to the inbox by itself when the client writes again. For an Instagram or Messenger conversation the change is passed on to the platform where the connection supports it. Needs `conversations:write`. A conversation at another location is a 404.
1422
+ */
1423
+ archiveConversation(options) {
1424
+ return (options.client ?? this.client).post({
1425
+ security: [
1426
+ {
1427
+ key: 'oauth2',
1428
+ scheme: 'bearer',
1429
+ type: 'http'
1430
+ },
1431
+ { name: 'x-api-key', type: 'apiKey' },
1432
+ {
1433
+ key: 'bearerAuth',
1434
+ scheme: 'bearer',
1435
+ type: 'http'
1436
+ }
1437
+ ],
1438
+ url: '/conversations/{id}/archive',
1439
+ ...options
1440
+ });
1441
+ }
1442
+ /**
1443
+ * Unarchive a conversation
1444
+ *
1445
+ * Brings the conversation back to the inbox, as Unarchive does. When the client's message is still the newest it awaits a reply again, unless it was marked as needing no reply. Needs `conversations:write`. A conversation at another location is a 404.
1446
+ */
1447
+ unarchiveConversation(options) {
1448
+ return (options.client ?? this.client).post({
1449
+ security: [
1450
+ {
1451
+ key: 'oauth2',
1452
+ scheme: 'bearer',
1453
+ type: 'http'
1454
+ },
1455
+ { name: 'x-api-key', type: 'apiKey' },
1456
+ {
1457
+ key: 'bearerAuth',
1458
+ scheme: 'bearer',
1459
+ type: 'http'
1460
+ }
1461
+ ],
1462
+ url: '/conversations/{id}/unarchive',
1463
+ ...options
1464
+ });
1465
+ }
1466
+ /**
1467
+ * Undo no reply needed
1468
+ *
1469
+ * Clears the mark. When the client's message is still the newest and the conversation isn't archived, it awaits a reply again. A conversation with no mark is left as it is. Needs `conversations:write`. A conversation at another location is a 404.
1470
+ */
1471
+ undoConversationNoReplyNeeded(options) {
1472
+ return (options.client ?? this.client).delete({
1473
+ security: [
1474
+ {
1475
+ key: 'oauth2',
1476
+ scheme: 'bearer',
1477
+ type: 'http'
1478
+ },
1479
+ { name: 'x-api-key', type: 'apiKey' },
1480
+ {
1481
+ key: 'bearerAuth',
1482
+ scheme: 'bearer',
1483
+ type: 'http'
1484
+ }
1485
+ ],
1486
+ url: '/conversations/{id}/no-reply-needed',
1487
+ ...options
1488
+ });
1489
+ }
1490
+ /**
1491
+ * Mark a conversation as needing no reply
1492
+ *
1493
+ * Marks the client's waiting message as needing no answer, as Mark done does in the inbox: the conversation stops awaiting a reply until the client writes again, so it leaves Awaiting Reply and the client's "Owed a reply" Next Up moment, and Recovr AI's unsent reply draft for it is discarded.
1494
+ *
1495
+ * A conversation whose newest message isn't the client's is a 409 `not_awaiting_reply`. DELETE on the same path undoes it. Needs `conversations:write`. A conversation at another location is a 404.
1496
+ */
1497
+ markConversationNoReplyNeeded(options) {
1498
+ return (options.client ?? this.client).post({
1499
+ security: [
1500
+ {
1501
+ key: 'oauth2',
1502
+ scheme: 'bearer',
1503
+ type: 'http'
1504
+ },
1505
+ { name: 'x-api-key', type: 'apiKey' },
1506
+ {
1507
+ key: 'bearerAuth',
1508
+ scheme: 'bearer',
1509
+ type: 'http'
1510
+ }
1511
+ ],
1512
+ url: '/conversations/{id}/no-reply-needed',
1513
+ ...options,
1514
+ headers: {
1515
+ 'Content-Type': 'application/json',
1516
+ ...options.headers
1517
+ }
1518
+ });
1519
+ }
1520
+ /**
1521
+ * Link a conversation to a client
1522
+ *
1523
+ * Files the conversation and its messages under a client, as Assign to client in the inbox does: use it for a message from a number or account Recovr didn't match. Recovr remembers the match for later conversations: the phone number for SMS, WhatsApp and calls, the account for Instagram and Messenger. Linking to another client moves it; `null` unlinks it and forgets the match.
1524
+ *
1525
+ * A group conversation has many people in it, so it can't be linked (422 `group_conversation`). A `client_id` that isn't a client at the location is a 400. Needs `conversations:write`. A conversation at another location is a 404.
1526
+ */
1527
+ linkConversationToClient(options) {
1528
+ return (options.client ?? this.client).post({
1529
+ security: [
1530
+ {
1531
+ key: 'oauth2',
1532
+ scheme: 'bearer',
1533
+ type: 'http'
1534
+ },
1535
+ { name: 'x-api-key', type: 'apiKey' },
1536
+ {
1537
+ key: 'bearerAuth',
1538
+ scheme: 'bearer',
1539
+ type: 'http'
1540
+ }
1541
+ ],
1542
+ url: '/conversations/{id}/link-client',
1543
+ ...options,
1544
+ headers: {
1545
+ 'Content-Type': 'application/json',
1546
+ ...options.headers
1547
+ }
1548
+ });
1549
+ }
1550
+ /**
1551
+ * List communication channels
1552
+ *
1553
+ * The location's communication channels: SMS numbers, email addresses, WhatsApp, Instagram and Messenger accounts and the rest, with whether each is connected and can send. Default channels first. Every conversation and message names its channel as `channel_id`. Needs `channels:read`.
1554
+ */
1555
+ listChannels(options) {
1556
+ return (options?.client ?? this.client).get({
1557
+ security: [
1558
+ {
1559
+ key: 'oauth2',
1560
+ scheme: 'bearer',
1561
+ type: 'http'
1562
+ },
1563
+ { name: 'x-api-key', type: 'apiKey' },
1564
+ {
1565
+ key: 'bearerAuth',
1566
+ scheme: 'bearer',
1567
+ type: 'http'
1568
+ }
1569
+ ],
1570
+ url: '/channels',
1571
+ ...options
1572
+ });
1573
+ }
1574
+ /**
1575
+ * Get a communication channel
1576
+ *
1577
+ * One of the location's channels, connected or not, for resolving the `channel_id` on a conversation or message. Needs `channels:read`. A channel at another location, or one removed in Settings → Communication Channels, is a 404.
1578
+ */
1579
+ getChannel(options) {
1580
+ return (options.client ?? this.client).get({
1581
+ security: [
1582
+ {
1583
+ key: 'oauth2',
1584
+ scheme: 'bearer',
1585
+ type: 'http'
1586
+ },
1587
+ { name: 'x-api-key', type: 'apiKey' },
1588
+ {
1589
+ key: 'bearerAuth',
1590
+ scheme: 'bearer',
1591
+ type: 'http'
1592
+ }
1593
+ ],
1594
+ url: '/channels/{id}',
1595
+ ...options
1596
+ });
1597
+ }
1598
+ /**
1599
+ * Get today's Next Up list
1600
+ *
1601
+ * Who to contact today and what is waiting for a person, in the order the app's Next Up page shows them: moments, approvals and due reminders together, ranked. The whole list comes back in one response. Items you skipped are left out for you only. Reading it never uses AI credits. Needs `next_up:read`; `why`, `callout` and an approval's message text also need `conversations:read`, and a reminder's `note` needs `notes:read`.
1602
+ */
1603
+ listNextUp(options) {
1604
+ return (options?.client ?? this.client).get({
1605
+ security: [
1606
+ {
1607
+ key: 'oauth2',
1608
+ scheme: 'bearer',
1609
+ type: 'http'
1610
+ },
1611
+ { name: 'x-api-key', type: 'apiKey' },
1612
+ {
1613
+ key: 'bearerAuth',
1614
+ scheme: 'bearer',
1615
+ type: 'http'
1616
+ }
1617
+ ],
1618
+ url: '/next-up',
1619
+ ...options
1620
+ });
1621
+ }
1622
+ /**
1623
+ * Open the next batch of moments
1624
+ *
1625
+ * Moments come in batches from today's committed order (`batch` on GET /next-up). Once you've worked through one, this opens the next lot, as Keep going does in the app, and returns the list. A batch belongs to the list, so it opens for the whole team. Never uses AI credits. Needs `next_up:write`.
1626
+ */
1627
+ openNextUpBatch(options) {
1628
+ return (options.client ?? this.client).post({
1629
+ security: [
1630
+ {
1631
+ key: 'oauth2',
1632
+ scheme: 'bearer',
1633
+ type: 'http'
1634
+ },
1635
+ { name: 'x-api-key', type: 'apiKey' },
1636
+ {
1637
+ key: 'bearerAuth',
1638
+ scheme: 'bearer',
1639
+ type: 'http'
1640
+ }
1641
+ ],
1642
+ url: '/next-up/next-batch',
1643
+ ...options,
1644
+ headers: {
1645
+ 'Content-Type': 'application/json',
1646
+ ...options.headers
1647
+ }
1648
+ });
1649
+ }
1650
+ /**
1651
+ * Get a client's open Next Up items
1652
+ *
1653
+ * The client's items on today's list that nobody has dealt with yet: their moment, if today's order includes them, their approvals and their due reminders. For a sidebar or a check-in screen. Moments appear once today's list is built, which Recovr does early each morning. Never uses AI credits. Needs `next_up:read`, with the same extra permissions as GET /next-up for `why`, `callout`, message text and `note`. A client at another location is a 404.
1654
+ */
1655
+ getClientNextUp(options) {
1656
+ return (options.client ?? this.client).get({
1657
+ security: [
1658
+ {
1659
+ key: 'oauth2',
1660
+ scheme: 'bearer',
1661
+ type: 'http'
1662
+ },
1663
+ { name: 'x-api-key', type: 'apiKey' },
1664
+ {
1665
+ key: 'bearerAuth',
1666
+ scheme: 'bearer',
1667
+ type: 'http'
1668
+ }
1669
+ ],
1670
+ url: '/clients/{id}/next-up',
1671
+ ...options
1672
+ });
1673
+ }
1674
+ /**
1675
+ * Mark a Next Up item done
1676
+ *
1677
+ * Ticks the item off as the credential's owner, as Done does in the app. A moment leaves the list and stays off it until something new happens for the client, and "Marked done in Next Up" goes on their timeline. Done on an "Owed a reply" moment also marks the conversation as needing no reply. An alert closes its reminder. An `agent_could_not_reply` or `human_handoff` approval is marked answered, with an optional `reason`. Done never snoozes the client. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1678
+ */
1679
+ markNextUpItemDone(options) {
1680
+ return (options.client ?? this.client).post({
1681
+ security: [
1682
+ {
1683
+ key: 'oauth2',
1684
+ scheme: 'bearer',
1685
+ type: 'http'
1686
+ },
1687
+ { name: 'x-api-key', type: 'apiKey' },
1688
+ {
1689
+ key: 'bearerAuth',
1690
+ scheme: 'bearer',
1691
+ type: 'http'
1692
+ }
1693
+ ],
1694
+ url: '/next-up/{item_id}/done',
1695
+ ...options,
1696
+ headers: {
1697
+ 'Content-Type': 'application/json',
1698
+ ...options.headers
1699
+ }
1700
+ });
1701
+ }
1702
+ /**
1703
+ * Skip a Next Up item for today
1704
+ *
1705
+ * Hides the item from the credential owner's list for the rest of today, as Skip does in the app. It stays on everyone else's list, and nothing changes for the client. Moments and held drafts. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1706
+ */
1707
+ skipNextUpItem(options) {
1708
+ return (options.client ?? this.client).post({
1709
+ security: [
1710
+ {
1711
+ key: 'oauth2',
1712
+ scheme: 'bearer',
1713
+ type: 'http'
1714
+ },
1715
+ { name: 'x-api-key', type: 'apiKey' },
1716
+ {
1717
+ key: 'bearerAuth',
1718
+ scheme: 'bearer',
1719
+ type: 'http'
1720
+ }
1721
+ ],
1722
+ url: '/next-up/{item_id}/skip',
1723
+ ...options
1724
+ });
1725
+ }
1726
+ /**
1727
+ * Snooze a Next Up item's client
1728
+ *
1729
+ * Snoozes the client, as Snooze does on a Next Up card: they leave the list until the snooze ends, and the snooze goes on their timeline. Send `days` or `until`, or neither for the location's default snooze for the client's risk level (Settings → Snooze; 7 days when it's never been set). Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1730
+ */
1731
+ snoozeNextUpItem(options) {
1732
+ return (options.client ?? this.client).post({
1733
+ security: [
1734
+ {
1735
+ key: 'oauth2',
1736
+ scheme: 'bearer',
1737
+ type: 'http'
1738
+ },
1739
+ { name: 'x-api-key', type: 'apiKey' },
1740
+ {
1741
+ key: 'bearerAuth',
1742
+ scheme: 'bearer',
1743
+ type: 'http'
1744
+ }
1745
+ ],
1746
+ url: '/next-up/{item_id}/snooze',
1747
+ ...options,
1748
+ headers: {
1749
+ 'Content-Type': 'application/json',
1750
+ ...options.headers
1751
+ }
1752
+ });
1753
+ }
1754
+ /**
1755
+ * Approve a Next Up approval
1756
+ *
1757
+ * Approves an approval, as Approve does in the app. A held draft is sent to the client, with your own `text` if you send one (edit and send); that also needs `messages:send`, and the send is checked as POST /conversations/{id}/messages is (`do_not_contact`, `in_bulk_send`, `same_text_limit`, `outreach_limited`, then the location's own sending rules). A booking, platform action or task is approved and starts: it writes to the booking platform as the credential's owner. A sent message reaches a real person and a platform change can't be undone from here. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1758
+ */
1759
+ approveNextUpItem(options) {
1760
+ return (options.client ?? this.client).post({
1761
+ security: [
1762
+ {
1763
+ key: 'oauth2',
1764
+ scheme: 'bearer',
1765
+ type: 'http'
1766
+ },
1767
+ { name: 'x-api-key', type: 'apiKey' },
1768
+ {
1769
+ key: 'bearerAuth',
1770
+ scheme: 'bearer',
1771
+ type: 'http'
1772
+ }
1773
+ ],
1774
+ url: '/next-up/{item_id}/approve',
1775
+ ...options,
1776
+ headers: {
1777
+ 'Content-Type': 'application/json',
1778
+ ...options.headers
1779
+ }
1780
+ });
1781
+ }
1782
+ /**
1783
+ * Reject a Next Up approval
1784
+ *
1785
+ * Rejects an approval, as Reject does in the app. A held draft is discarded and never sent, with an optional `reason`. A booking, platform action or task is not done. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1786
+ */
1787
+ rejectNextUpItem(options) {
1788
+ return (options.client ?? this.client).post({
1789
+ security: [
1790
+ {
1791
+ key: 'oauth2',
1792
+ scheme: 'bearer',
1793
+ type: 'http'
1794
+ },
1795
+ { name: 'x-api-key', type: 'apiKey' },
1796
+ {
1797
+ key: 'bearerAuth',
1798
+ scheme: 'bearer',
1799
+ type: 'http'
1800
+ }
1801
+ ],
1802
+ url: '/next-up/{item_id}/reject',
1803
+ ...options,
1804
+ headers: {
1805
+ 'Content-Type': 'application/json',
1806
+ ...options.headers
1807
+ }
1808
+ });
1809
+ }
1810
+ /**
1811
+ * Recheck an uncertain booking
1812
+ *
1813
+ * For a booking Recovr couldn't confirm (`action.status` `uncertain`): reads the booking platform again and settles it to what the platform shows. Writes nothing to the platform. `settled` is false when the platform couldn't be read. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1814
+ */
1815
+ recheckNextUpItem(options) {
1816
+ return (options.client ?? this.client).post({
1817
+ security: [
1818
+ {
1819
+ key: 'oauth2',
1820
+ scheme: 'bearer',
1821
+ type: 'http'
1822
+ },
1823
+ { name: 'x-api-key', type: 'apiKey' },
1824
+ {
1825
+ key: 'bearerAuth',
1826
+ scheme: 'bearer',
1827
+ type: 'http'
1828
+ }
1829
+ ],
1830
+ url: '/next-up/{item_id}/recheck',
1831
+ ...options
1832
+ });
1833
+ }
1834
+ /**
1835
+ * Settle an uncertain booking
1836
+ *
1837
+ * For a change Recovr couldn't confirm (`action.status` `uncertain`): records what the booking platform shows, as the card's answer does in the app. Needs the credential to act as a team member. Needs `next_up:write`. Works only on items at the credential's location: any other id is a 404. An item's `operations` say which actions it takes.
1838
+ */
1839
+ settleNextUpItem(options) {
1840
+ return (options.client ?? this.client).post({
1841
+ security: [
1842
+ {
1843
+ key: 'oauth2',
1844
+ scheme: 'bearer',
1845
+ type: 'http'
1846
+ },
1847
+ { name: 'x-api-key', type: 'apiKey' },
1848
+ {
1849
+ key: 'bearerAuth',
1850
+ scheme: 'bearer',
1851
+ type: 'http'
1852
+ }
1853
+ ],
1854
+ url: '/next-up/{item_id}/settle',
1855
+ ...options,
1856
+ headers: {
1857
+ 'Content-Type': 'application/json',
1858
+ ...options.headers
1859
+ }
1860
+ });
1861
+ }
1862
+ /**
1863
+ * List a client's sessions
1864
+ *
1865
+ * The client's bookings on the location's days from `from` to `to`, every status, newest first: what the attendance calendar on their profile shows. Read-only, because the booking platform owns bookings. Needs `clients:read`. A client at another location is a 404.
1866
+ */
1867
+ listClientSessions(options) {
1868
+ return (options.client ?? this.client).get({
1869
+ security: [
1870
+ {
1871
+ key: 'oauth2',
1872
+ scheme: 'bearer',
1873
+ type: 'http'
1874
+ },
1875
+ { name: 'x-api-key', type: 'apiKey' },
1876
+ {
1877
+ key: 'bearerAuth',
1878
+ scheme: 'bearer',
1879
+ type: 'http'
1880
+ }
1881
+ ],
1882
+ url: '/clients/{id}/sessions',
1883
+ ...options
1884
+ });
1885
+ }
1886
+ /**
1887
+ * Get a client's attendance summary
1888
+ *
1889
+ * How many sessions the client booked, attended, cancelled and missed on the location's days from `from` to `to` (the 30 days to today when you send neither), with the figures their profile shows: lifetime sessions attended, last visit, next booking and attendance trend. Needs `clients:read`. A client at another location is a 404.
1890
+ */
1891
+ getClientAttendance(options) {
1892
+ return (options.client ?? this.client).get({
1893
+ security: [
1894
+ {
1895
+ key: 'oauth2',
1896
+ scheme: 'bearer',
1897
+ type: 'http'
1898
+ },
1899
+ { name: 'x-api-key', type: 'apiKey' },
1900
+ {
1901
+ key: 'bearerAuth',
1902
+ scheme: 'bearer',
1903
+ type: 'http'
1904
+ }
1905
+ ],
1906
+ url: '/clients/{id}/attendance',
1907
+ ...options
1908
+ });
1909
+ }
1910
+ /**
1911
+ * Get a client's session milestones
1912
+ *
1913
+ * The client's lifetime milestone count, the gym's milestones they've reached and when, and how far they are from the next: the Milestones section of their profile, counted as the Milestones report counts. The gym sets its milestones and exclusions in Settings → Milestones. Needs `clients:read`. A client at another location is a 404.
1914
+ */
1915
+ getClientMilestones(options) {
1916
+ return (options.client ?? this.client).get({
1917
+ security: [
1918
+ {
1919
+ key: 'oauth2',
1920
+ scheme: 'bearer',
1921
+ type: 'http'
1922
+ },
1923
+ { name: 'x-api-key', type: 'apiKey' },
1924
+ {
1925
+ key: 'bearerAuth',
1926
+ scheme: 'bearer',
1927
+ type: 'http'
1928
+ }
1929
+ ],
1930
+ url: '/clients/{id}/milestones',
1931
+ ...options
1932
+ });
1933
+ }
1934
+ /**
1935
+ * List the location's classes and their bookings
1936
+ *
1937
+ * The location's classes on its days from `from` to `to`, each with its bookings by status: the app's Session Report. Door check-ins and visits to other sites are left out, as they are there. Up to 14 days in one request. Needs `sessions:read`; who booked (`attendees`) also needs `clients:read`. For classes nobody has booked, use GET /class-timetable.
1938
+ */
1939
+ listSessions(options) {
1940
+ return (options?.client ?? this.client).get({
1941
+ security: [
1942
+ {
1943
+ key: 'oauth2',
1944
+ scheme: 'bearer',
1945
+ type: 'http'
1946
+ },
1947
+ { name: 'x-api-key', type: 'apiKey' },
1948
+ {
1949
+ key: 'bearerAuth',
1950
+ scheme: 'bearer',
1951
+ type: 'http'
1952
+ }
1953
+ ],
1954
+ url: '/sessions',
1955
+ ...options
1956
+ });
1957
+ }
1958
+ /**
1959
+ * Get the class timetable
1960
+ *
1961
+ * The classes the studio's booking platform publishes on the location's days from `from` to `to`, booked or not, with capacity and the platform's booked count. Recovr reads the timetable from the platform (daily for most, weekly for Mindbody API sites), so check `trusted` before treating a missing class as not running. Not every booking platform sends a timetable: without one, `classes` is empty and `last_read_at` is null. Up to 42 days in one request. Needs `sessions:read`.
1962
+ */
1963
+ getClassTimetable(options) {
1964
+ return (options?.client ?? this.client).get({
1965
+ security: [
1966
+ {
1967
+ key: 'oauth2',
1968
+ scheme: 'bearer',
1969
+ type: 'http'
1970
+ },
1971
+ { name: 'x-api-key', type: 'apiKey' },
1972
+ {
1973
+ key: 'bearerAuth',
1974
+ scheme: 'bearer',
1975
+ type: 'http'
1976
+ }
1977
+ ],
1978
+ url: '/class-timetable',
1979
+ ...options
1980
+ });
1981
+ }
1982
+ /**
1983
+ * List custom fields
1984
+ *
1985
+ * The location's custom fields, in the order profiles show them. Archived fields only with `include_archived=true`. Fields are set up in the app (Settings → Custom Fields). Needs `clients:read`.
1986
+ */
1987
+ listCustomFields(options) {
1988
+ return (options?.client ?? this.client).get({
1989
+ security: [
1990
+ {
1991
+ key: 'oauth2',
1992
+ scheme: 'bearer',
1993
+ type: 'http'
1994
+ },
1995
+ { name: 'x-api-key', type: 'apiKey' },
1996
+ {
1997
+ key: 'bearerAuth',
1998
+ scheme: 'bearer',
1999
+ type: 'http'
2000
+ }
2001
+ ],
2002
+ url: '/custom-fields',
2003
+ ...options
2004
+ });
2005
+ }
2006
+ /**
2007
+ * Get a client's custom field values
2008
+ *
2009
+ * Every live custom field with this client's value, null where it isn't set, in the order the profile shows them. Archived fields are left out. Needs `clients:read`. Works only on clients at the credential's location: any other id is a 404.
2010
+ */
2011
+ getClientCustomFields(options) {
2012
+ return (options.client ?? this.client).get({
2013
+ security: [
2014
+ {
2015
+ key: 'oauth2',
2016
+ scheme: 'bearer',
2017
+ type: 'http'
2018
+ },
2019
+ { name: 'x-api-key', type: 'apiKey' },
2020
+ {
2021
+ key: 'bearerAuth',
2022
+ scheme: 'bearer',
2023
+ type: 'http'
2024
+ }
2025
+ ],
2026
+ url: '/clients/{id}/custom-fields',
2027
+ ...options
2028
+ });
2029
+ }
2030
+ /**
2031
+ * Set or clear a client's custom field value
2032
+ *
2033
+ * Sets one field's value for one client, as editing it on their profile does, or clears it with `value: null`. Setting the value a field already holds changes nothing. A value the field can't hold (text in a `number` field, a `select` value that isn't one of its `options`) is a 400. An archived field, or a field or client at another location, is a 404. Needs `clients:write`.
2034
+ */
2035
+ setClientCustomField(options) {
2036
+ return (options.client ?? this.client).patch({
2037
+ security: [
2038
+ {
2039
+ key: 'oauth2',
2040
+ scheme: 'bearer',
2041
+ type: 'http'
2042
+ },
2043
+ { name: 'x-api-key', type: 'apiKey' },
2044
+ {
2045
+ key: 'bearerAuth',
2046
+ scheme: 'bearer',
2047
+ type: 'http'
2048
+ }
2049
+ ],
2050
+ url: '/clients/{id}/custom-fields/{field_id}',
2051
+ ...options,
2052
+ headers: {
2053
+ 'Content-Type': 'application/json',
2054
+ ...options.headers
2055
+ }
2056
+ });
2057
+ }
2058
+ /**
2059
+ * Rename or recolour a label
2060
+ *
2061
+ * Renames a label or changes its colour, as Settings → Labels does. Every client with the label keeps it, and workflows that use it follow the new name. A name another label at the location already has (ignoring case) is a 409 `label_name_exists`. Works on manual and smart labels. Needs `labels:manage`.
2062
+ */
2063
+ updateClientLabel(options) {
2064
+ return (options.client ?? this.client).patch({
2065
+ security: [
2066
+ {
2067
+ key: 'oauth2',
2068
+ scheme: 'bearer',
2069
+ type: 'http'
2070
+ },
2071
+ { name: 'x-api-key', type: 'apiKey' },
2072
+ {
2073
+ key: 'bearerAuth',
2074
+ scheme: 'bearer',
2075
+ type: 'http'
2076
+ }
2077
+ ],
2078
+ url: '/client-labels/{label_id}',
2079
+ ...options,
2080
+ headers: {
2081
+ 'Content-Type': 'application/json',
2082
+ ...options.headers
2083
+ }
2084
+ });
2085
+ }
2086
+ /**
2087
+ * Archive a label
2088
+ *
2089
+ * Archives a label, as Settings → Labels does: it leaves the label pickers and **comes off every client who has it**. Their timelines keep the history. The app lists the workflows that use a label before you archive it there, so check those first. Restore it with POST /client-labels/{label_id}/restore (clients don't get it back). Archiving an archived label changes nothing. Needs `labels:manage`.
2090
+ */
2091
+ archiveClientLabel(options) {
2092
+ return (options.client ?? this.client).post({
2093
+ security: [
2094
+ {
2095
+ key: 'oauth2',
2096
+ scheme: 'bearer',
2097
+ type: 'http'
2098
+ },
2099
+ { name: 'x-api-key', type: 'apiKey' },
2100
+ {
2101
+ key: 'bearerAuth',
2102
+ scheme: 'bearer',
2103
+ type: 'http'
2104
+ }
2105
+ ],
2106
+ url: '/client-labels/{label_id}/archive',
2107
+ ...options
2108
+ });
2109
+ }
2110
+ /**
2111
+ * Restore an archived label
2112
+ *
2113
+ * Brings an archived label back to the pickers, as Settings → Labels does. A manual label comes back on nobody; a smart label goes back on the clients its rule matches, without starting workflows. Restoring a label that isn't archived changes nothing. Needs `labels:manage`.
2114
+ */
2115
+ restoreClientLabel(options) {
2116
+ return (options.client ?? this.client).post({
2117
+ security: [
2118
+ {
2119
+ key: 'oauth2',
2120
+ scheme: 'bearer',
2121
+ type: 'http'
2122
+ },
2123
+ { name: 'x-api-key', type: 'apiKey' },
2124
+ {
2125
+ key: 'bearerAuth',
2126
+ scheme: 'bearer',
2127
+ type: 'http'
2128
+ }
2129
+ ],
2130
+ url: '/client-labels/{label_id}/restore',
2131
+ ...options
2132
+ });
2133
+ }
2134
+ /**
2135
+ * Get a client's timeline
2136
+ *
2137
+ * Everything that happened with a client, newest first, as their profile's timeline shows it: messages, calls, notes, logged contact, reminders, sessions, labels, suspensions, forms and more. Each message in a bulk send is listed on its own rather than folded into a group, and drafts aren't listed.
2138
+ *
2139
+ * Needs `clients:read`. An entry's text needs the permission that guards it elsewhere: `conversations:read` for messages, `notes:read` for notes, calls, logged contact and reminders, `forms:read` for form submissions. Without it the entry is still listed, without `content`. Only for clients at the key's location: any other id is a 404.
2140
+ *
2141
+ * Pages don't repeat or skip entries when new ones are added meanwhile.
2142
+ */
2143
+ getClientTimeline(options) {
2144
+ return (options.client ?? this.client).get({
2145
+ security: [
2146
+ {
2147
+ key: 'oauth2',
2148
+ scheme: 'bearer',
2149
+ type: 'http'
2150
+ },
2151
+ { name: 'x-api-key', type: 'apiKey' },
2152
+ {
2153
+ key: 'bearerAuth',
2154
+ scheme: 'bearer',
2155
+ type: 'http'
2156
+ }
2157
+ ],
2158
+ url: '/clients/{id}/timeline',
2159
+ ...options
2160
+ });
2161
+ }
2162
+ /**
2163
+ * List team members
2164
+ *
2165
+ * The team at the credential's location, oldest first: the `id` every endpoint uses for a team member (`assigned_to`, an author's or activity's `team_member`, GET /activity `team_member_id`), each person's role, and whether they're still an open invite. Someone removed from the team isn't listed, though their past activity keeps their id and name. Needs `clients:read`.
2166
+ */
2167
+ listTeamMembers(options) {
2168
+ return (options?.client ?? this.client).get({
2169
+ security: [
2170
+ {
2171
+ key: 'oauth2',
2172
+ scheme: 'bearer',
2173
+ type: 'http'
2174
+ },
2175
+ { name: 'x-api-key', type: 'apiKey' },
2176
+ {
2177
+ key: 'bearerAuth',
2178
+ scheme: 'bearer',
2179
+ type: 'http'
2180
+ }
2181
+ ],
2182
+ url: '/team-members',
2183
+ ...options
2184
+ });
2185
+ }
2186
+ /**
2187
+ * Invite a team member
2188
+ *
2189
+ * Invites one person to the location's team with a role, as the app's Team page does: Recovr emails them an invite with a link to set their password, and they're listed with `status: invited` until they sign in. Refusals: `already_on_team` (that email is already on the team; resend their invite instead), `team_not_supported` (the location's team is still managed outside Recovr). Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2190
+ */
2191
+ inviteTeamMember(options) {
2192
+ return (options.client ?? this.client).post({
2193
+ security: [
2194
+ {
2195
+ key: 'oauth2',
2196
+ scheme: 'bearer',
2197
+ type: 'http'
2198
+ },
2199
+ { name: 'x-api-key', type: 'apiKey' },
2200
+ {
2201
+ key: 'bearerAuth',
2202
+ scheme: 'bearer',
2203
+ type: 'http'
2204
+ }
2205
+ ],
2206
+ url: '/team-members',
2207
+ ...options,
2208
+ headers: {
2209
+ 'Content-Type': 'application/json',
2210
+ ...options.headers
2211
+ }
2212
+ });
2213
+ }
2214
+ /**
2215
+ * Remove a team member
2216
+ *
2217
+ * Removes someone from the location's team, as the Team page's Remove does: they lose access to the location at once, including every personal access token and app connection they hold for it, and leave Team Chat. Their past activity keeps their id and name. Recovr has no separate deactivate; inviting them again later gives them a new id. Removing someone already removed is a 404. Refusals: `last_owner`. Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2218
+ */
2219
+ removeTeamMember(options) {
2220
+ return (options.client ?? this.client).delete({
2221
+ security: [
2222
+ {
2223
+ key: 'oauth2',
2224
+ scheme: 'bearer',
2225
+ type: 'http'
2226
+ },
2227
+ { name: 'x-api-key', type: 'apiKey' },
2228
+ {
2229
+ key: 'bearerAuth',
2230
+ scheme: 'bearer',
2231
+ type: 'http'
2232
+ }
2233
+ ],
2234
+ url: '/team-members/{id}',
2235
+ ...options
2236
+ });
2237
+ }
2238
+ /**
2239
+ * Change a team member's role
2240
+ *
2241
+ * Makes a team member a Manager or a Team member. Their new role applies from their next request, in the app and through any token they hold. Setting the role they already have changes nothing. Refusals: `no_membership` (they have no Recovr login at this location to give a role to), `last_owner`. Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2242
+ */
2243
+ updateTeamMember(options) {
2244
+ return (options.client ?? this.client).patch({
2245
+ security: [
2246
+ {
2247
+ key: 'oauth2',
2248
+ scheme: 'bearer',
2249
+ type: 'http'
2250
+ },
2251
+ { name: 'x-api-key', type: 'apiKey' },
2252
+ {
2253
+ key: 'bearerAuth',
2254
+ scheme: 'bearer',
2255
+ type: 'http'
2256
+ }
2257
+ ],
2258
+ url: '/team-members/{id}',
2259
+ ...options,
2260
+ headers: {
2261
+ 'Content-Type': 'application/json',
2262
+ ...options.headers
2263
+ }
2264
+ });
2265
+ }
2266
+ /**
2267
+ * Resend an invite
2268
+ *
2269
+ * Emails an invited team member their invite again, with a new link to set their password, as the Team page's Resend does. Refusals: `not_an_invite` (they've already signed in), `no_login` (they have no Recovr login to invite; remove and invite them again). Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2270
+ */
2271
+ resendTeamMemberInvite(options) {
2272
+ return (options.client ?? this.client).post({
2273
+ security: [
2274
+ {
2275
+ key: 'oauth2',
2276
+ scheme: 'bearer',
2277
+ type: 'http'
2278
+ },
2279
+ { name: 'x-api-key', type: 'apiKey' },
2280
+ {
2281
+ key: 'bearerAuth',
2282
+ scheme: 'bearer',
2283
+ type: 'http'
2284
+ }
2285
+ ],
2286
+ url: '/team-members/{id}/resend-invite',
2287
+ ...options
2288
+ });
2289
+ }
2290
+ /**
2291
+ * Cancel an invite
2292
+ *
2293
+ * Takes back an invite someone hasn't accepted: they leave the team list and their invite link stops giving them access to the location. Someone who has already signed in is refused with `not_an_invite`; remove them with DELETE /team-members/{id} instead. Needs `team:manage`, which works only for a credential acting for an owner or Manager. It never acts on that person's own membership (`own_membership`), gives a role above theirs or acts on someone ranked above them (`above_own_role`), or changes an owner's role (`owner_role`): ownership is handed over in the app.
2294
+ */
2295
+ cancelTeamMemberInvite(options) {
2296
+ return (options.client ?? this.client).post({
2297
+ security: [
2298
+ {
2299
+ key: 'oauth2',
2300
+ scheme: 'bearer',
2301
+ type: 'http'
2302
+ },
2303
+ { name: 'x-api-key', type: 'apiKey' },
2304
+ {
2305
+ key: 'bearerAuth',
2306
+ scheme: 'bearer',
2307
+ type: 'http'
2308
+ }
2309
+ ],
2310
+ url: '/team-members/{id}/cancel-invite',
2311
+ ...options
2312
+ });
2313
+ }
824
2314
  }
825
2315
  exports.RecovrSdk = RecovrSdk;