attio-ts-sdk 0.0.0 → 1.0.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.mjs CHANGED
@@ -1,5 +1,162 @@
1
1
  import { z } from "zod";
2
+ import process from "node:process";
2
3
 
4
+ //#region src/attio/batch.ts
5
+ const recordSuccess = (params) => {
6
+ const { state, currentIndex, value, label, isCancelled } = params;
7
+ if (isCancelled?.()) return;
8
+ state.results[currentIndex] = {
9
+ status: "fulfilled",
10
+ value,
11
+ label
12
+ };
13
+ };
14
+ const recordFailure = (params) => {
15
+ const { state, currentIndex, error, label, options, abortController, isCancelled, reject } = params;
16
+ if (options.stopOnError) {
17
+ if (!state.stopped) {
18
+ state.stopped = true;
19
+ if (abortController && !abortController.signal.aborted) abortController.abort();
20
+ reject(error);
21
+ }
22
+ return;
23
+ }
24
+ if (isCancelled()) return;
25
+ state.results[currentIndex] = {
26
+ status: "rejected",
27
+ reason: error,
28
+ label
29
+ };
30
+ };
31
+ const launchNextItem = (params) => {
32
+ const { items, state, abortController, options, isCancelled, reject, launchNext } = params;
33
+ const currentIndex = state.index;
34
+ const item = items[currentIndex];
35
+ state.index += 1;
36
+ state.active += 1;
37
+ item.run(abortController ? { signal: abortController.signal } : void 0).then((value) => {
38
+ recordSuccess({
39
+ state,
40
+ currentIndex,
41
+ value,
42
+ label: item.label,
43
+ isCancelled
44
+ });
45
+ }).catch((error) => {
46
+ recordFailure({
47
+ state,
48
+ currentIndex,
49
+ error,
50
+ label: item.label,
51
+ options,
52
+ abortController,
53
+ isCancelled,
54
+ reject
55
+ });
56
+ }).finally(() => {
57
+ state.active -= 1;
58
+ if (!isCancelled()) launchNext();
59
+ });
60
+ };
61
+ /**
62
+ * Returns an empty results array when called with no items.
63
+ */
64
+ const runBatch = (items, options = {}) => {
65
+ if (items.length === 0) return Promise.resolve([]);
66
+ const concurrency = Math.max(1, options.concurrency ?? 4);
67
+ const state = {
68
+ results: new Array(items.length),
69
+ index: 0,
70
+ active: 0,
71
+ stopped: false
72
+ };
73
+ const abortController = options.stopOnError ? new AbortController() : void 0;
74
+ const isCancelled = () => abortController?.signal.aborted ?? state.stopped;
75
+ return new Promise((resolve, reject) => {
76
+ const launchNext = () => {
77
+ if (isCancelled()) return;
78
+ if (state.index >= items.length && state.active === 0) {
79
+ resolve(state.results);
80
+ return;
81
+ }
82
+ while (state.active < concurrency && state.index < items.length) launchNextItem({
83
+ items,
84
+ state,
85
+ concurrency,
86
+ abortController,
87
+ options,
88
+ isCancelled,
89
+ resolve,
90
+ reject,
91
+ launchNext
92
+ });
93
+ };
94
+ launchNext();
95
+ });
96
+ };
97
+
98
+ //#endregion
99
+ //#region src/attio/cache.ts
100
+ var TtlCache = class {
101
+ ttlMs;
102
+ maxEntries;
103
+ store = /* @__PURE__ */ new Map();
104
+ constructor(options) {
105
+ this.ttlMs = options.ttlMs;
106
+ this.maxEntries = options.maxEntries;
107
+ }
108
+ get(key) {
109
+ const entry = this.store.get(key);
110
+ if (!entry) return;
111
+ if (Date.now() >= entry.expiresAt) {
112
+ this.store.delete(key);
113
+ return;
114
+ }
115
+ return entry.value;
116
+ }
117
+ set(key, value) {
118
+ if (this.maxEntries && this.store.size >= this.maxEntries && !this.store.has(key)) {
119
+ const oldestKey = this.store.keys().next().value;
120
+ if (oldestKey !== void 0) this.store.delete(oldestKey);
121
+ }
122
+ this.store.set(key, {
123
+ value,
124
+ expiresAt: Date.now() + this.ttlMs
125
+ });
126
+ }
127
+ delete(key) {
128
+ this.store.delete(key);
129
+ }
130
+ clear() {
131
+ this.store.clear();
132
+ }
133
+ };
134
+ const clientCache = /* @__PURE__ */ new Map();
135
+ const getCachedClient = (key, validator) => {
136
+ const cached = clientCache.get(key);
137
+ if (cached === void 0) return;
138
+ try {
139
+ const result = validator.safeParse(cached);
140
+ if (!result.success) return;
141
+ return result.data;
142
+ } catch {
143
+ return;
144
+ }
145
+ };
146
+ const setCachedClient = (key, client) => {
147
+ clientCache.set(key, client);
148
+ };
149
+ const clearClientCache = () => {
150
+ clientCache.clear();
151
+ };
152
+ const hashToken = (value) => {
153
+ let hash = 5381;
154
+ for (let i = 0; i < value.length; i += 1) hash = hash * 33 ^ value.charCodeAt(i);
155
+ return (hash >>> 0).toString(36);
156
+ };
157
+ const createTtlCache = (options) => new TtlCache(options);
158
+
159
+ //#endregion
3
160
  //#region src/generated/core/bodySerializer.gen.ts
4
161
  const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
5
162
 
@@ -610,109 +767,559 @@ const createClient = (config = {}) => {
610
767
  };
611
768
 
612
769
  //#endregion
613
- //#region src/generated/client.gen.ts
614
- const client = createClient(createConfig({ baseUrl: "https://api.attio.com" }));
770
+ //#region src/attio/error-enhancer.ts
771
+ const knownFieldValues = /* @__PURE__ */ new Map();
772
+ const VALUE_PATTERNS = [
773
+ /constraint:\s*([^,]+)/i,
774
+ /option name\s+'([^']+)'/i,
775
+ /option name\s+"([^"]+)"/i
776
+ ];
777
+ const getKnownFieldValues = (field) => knownFieldValues.get(field);
778
+ const updateKnownFieldValues = (field, values) => {
779
+ const unique = Array.from(new Set(values.map((value) => value.trim()))).filter(Boolean);
780
+ if (unique.length > 0) knownFieldValues.set(field, unique);
781
+ else knownFieldValues.delete(field);
782
+ };
783
+ const extractMismatchContext = (error) => {
784
+ const { message, data: rawData } = error;
785
+ const data = rawData;
786
+ const path = (Array.isArray(data?.path) ? data?.path[0] : data?.path) ?? data?.field ?? data?.attribute ?? void 0;
787
+ if (typeof message !== "string" || typeof path !== "string") return;
788
+ let value;
789
+ for (const pattern of VALUE_PATTERNS) {
790
+ const match = message.match(pattern);
791
+ if (match?.[1]) {
792
+ value = match[1].trim();
793
+ break;
794
+ }
795
+ }
796
+ return {
797
+ field: path,
798
+ value
799
+ };
800
+ };
801
+ const levenshtein = (a, b) => {
802
+ const matrix = [];
803
+ const aLen = a.length;
804
+ const bLen = b.length;
805
+ for (let i = 0; i <= bLen; i += 1) matrix[i] = [i];
806
+ for (let j = 0; j <= aLen; j += 1) matrix[0][j] = j;
807
+ for (let i = 1; i <= bLen; i += 1) for (let j = 1; j <= aLen; j += 1) if (b.charAt(i - 1) === a.charAt(j - 1)) matrix[i][j] = matrix[i - 1][j - 1];
808
+ else matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
809
+ return matrix[bLen][aLen];
810
+ };
811
+ const scoreCandidates = (value, candidates) => {
812
+ const normalized = value.toLowerCase();
813
+ return candidates.map((candidate) => ({
814
+ candidate,
815
+ score: levenshtein(normalized, candidate.toLowerCase())
816
+ })).sort((a, b) => a.score - b.score).map((entry) => entry.candidate);
817
+ };
818
+ const enhanceAttioError = (error) => {
819
+ if (!error?.isApiError) return error;
820
+ const context = extractMismatchContext(error);
821
+ if (!(context?.field && context?.value)) return error;
822
+ const candidates = knownFieldValues.get(context.field);
823
+ if (candidates === void 0 || candidates.length === 0) return error;
824
+ const matches = scoreCandidates(context.value, candidates).slice(0, 3);
825
+ error.suggestions = {
826
+ field: context.field,
827
+ attempted: context.value,
828
+ bestMatch: matches[0],
829
+ matches
830
+ };
831
+ return error;
832
+ };
615
833
 
616
834
  //#endregion
617
- //#region src/generated/zod.gen.ts
618
- const zStatus = z.object({
619
- id: z.object({
620
- workspace_id: z.uuid(),
621
- object_id: z.uuid(),
622
- attribute_id: z.uuid(),
623
- status_id: z.uuid()
624
- }),
625
- title: z.string(),
626
- is_archived: z.boolean(),
627
- celebration_enabled: z.boolean(),
628
- target_time_in_status: z.union([z.string(), z.null()])
629
- });
630
- const zSelectOption = z.object({
631
- id: z.object({
632
- workspace_id: z.uuid(),
633
- object_id: z.uuid(),
634
- attribute_id: z.uuid(),
635
- option_id: z.uuid()
636
- }),
637
- title: z.string(),
638
- is_archived: z.boolean()
835
+ //#region src/attio/errors.ts
836
+ var AttioError = class extends Error {
837
+ status;
838
+ code;
839
+ type;
840
+ requestId;
841
+ data;
842
+ response;
843
+ request;
844
+ retryAfterMs;
845
+ isNetworkError;
846
+ isApiError;
847
+ suggestions;
848
+ constructor(message, details = {}) {
849
+ super(message, details.cause ? { cause: details.cause } : void 0);
850
+ this.name = "AttioError";
851
+ this.status = details.status;
852
+ this.code = details.code;
853
+ this.type = details.type;
854
+ this.data = details.data;
855
+ }
856
+ };
857
+ const applyDefaultCode = (details, code) => ({
858
+ ...details,
859
+ code: details.code ?? code
639
860
  });
640
- /**
641
- * A union of possible value types, as required in request bodies.
642
- */
643
- const zInputValue = z.union([
644
- z.object({
645
- referenced_actor_type: z.enum(["workspace-member"]),
646
- referenced_actor_id: z.uuid()
647
- }),
648
- z.object({ workspace_member_email_address: z.string() }),
649
- z.object({ value: z.boolean() }),
650
- z.object({ currency_value: z.number() }),
651
- z.object({ value: z.string() }),
652
- z.object({ domain: z.optional(z.string()) }),
653
- z.object({ email_address: z.optional(z.string()) }),
654
- z.object({
655
- target_object: z.string(),
656
- target_record_id: z.uuid()
657
- }),
658
- z.object({
659
- target_object: z.string(),
660
- "[slug_or_id_of_matching_attribute]": z.array(z.union([
661
- z.object({ domain: z.optional(z.string()) }),
662
- z.object({ email_address: z.optional(z.string()) }),
663
- z.object({ value: z.optional(z.number()) }),
664
- z.object({
665
- original_phone_number: z.optional(z.string()),
666
- country_code: z.optional(z.enum([
667
- "AF",
668
- "AX",
669
- "AL",
670
- "DZ",
671
- "AS",
672
- "AD",
673
- "AO",
674
- "AI",
675
- "AQ",
676
- "AG",
677
- "AR",
678
- "AM",
679
- "AW",
680
- "AU",
681
- "AT",
682
- "AZ",
683
- "BS",
684
- "BH",
685
- "BD",
686
- "BB",
687
- "BY",
688
- "BE",
689
- "BZ",
690
- "BJ",
691
- "BM",
692
- "BT",
693
- "BO",
694
- "BA",
695
- "BW",
696
- "BV",
697
- "BR",
698
- "IO",
699
- "BN",
700
- "BG",
701
- "BF",
702
- "BI",
703
- "KH",
704
- "CM",
705
- "CA",
706
- "CV",
707
- "KY",
708
- "CF",
709
- "TD",
710
- "CL",
711
- "CN",
712
- "CX",
713
- "CC",
714
- "CO",
715
- "KM",
861
+ var AttioBatchError = class extends AttioError {
862
+ constructor(message, details = {}) {
863
+ super(message, applyDefaultCode(details, "BATCH_ERROR"));
864
+ this.name = "AttioBatchError";
865
+ }
866
+ };
867
+ var AttioConfigError = class extends AttioError {
868
+ constructor(message, details = {}) {
869
+ super(message, applyDefaultCode(details, "CONFIG_ERROR"));
870
+ this.name = "AttioConfigError";
871
+ }
872
+ };
873
+ var AttioEnvironmentError = class extends AttioError {
874
+ constructor(message, details = {}) {
875
+ super(message, applyDefaultCode(details, "ENVIRONMENT_ERROR"));
876
+ this.name = "AttioEnvironmentError";
877
+ }
878
+ };
879
+ var AttioResponseError = class extends AttioError {
880
+ constructor(message, details = {}) {
881
+ super(message, applyDefaultCode(details, "RESPONSE_ERROR"));
882
+ this.name = "AttioResponseError";
883
+ }
884
+ };
885
+ var AttioRetryError = class extends AttioError {
886
+ constructor(message, details = {}) {
887
+ super(message, applyDefaultCode(details, "RETRY_ERROR"));
888
+ this.name = "AttioRetryError";
889
+ }
890
+ };
891
+ var AttioApiError = class extends AttioError {
892
+ constructor(message, details = {}) {
893
+ super(message, details);
894
+ this.name = "AttioApiError";
895
+ this.isApiError = true;
896
+ }
897
+ };
898
+ var AttioNetworkError = class extends AttioError {
899
+ constructor(message, details = {}) {
900
+ super(message, details);
901
+ this.name = "AttioNetworkError";
902
+ this.isNetworkError = true;
903
+ }
904
+ };
905
+ const getHeaderValue = (response, key) => {
906
+ if (!response) return;
907
+ return response.headers.get(key) ?? void 0;
908
+ };
909
+ const parseRetryAfter = (response) => {
910
+ if (!response) return;
911
+ const raw = response.headers.get("Retry-After");
912
+ if (!raw) return;
913
+ const seconds = Number(raw);
914
+ if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
915
+ const dateMs = Date.parse(raw);
916
+ if (!Number.isNaN(dateMs)) return Math.max(0, dateMs - Date.now());
917
+ };
918
+ const extractMessage = (error, fallback) => {
919
+ if (typeof error === "string") return error;
920
+ if (error && typeof error === "object") {
921
+ const maybe = error;
922
+ if (typeof maybe.message === "string") return maybe.message;
923
+ }
924
+ return fallback ?? "Request failed.";
925
+ };
926
+ const extractStatusCode = (payload) => {
927
+ if (typeof payload.status_code === "number") return payload.status_code;
928
+ if (typeof payload.status === "number") return payload.status;
929
+ };
930
+ const extractDetails = (error) => {
931
+ if (!error || typeof error !== "object") return {};
932
+ const payload = error;
933
+ return {
934
+ code: typeof payload.code === "string" ? payload.code : void 0,
935
+ type: typeof payload.type === "string" ? payload.type : void 0,
936
+ status: extractStatusCode(payload),
937
+ message: typeof payload.message === "string" ? payload.message : void 0,
938
+ data: payload
939
+ };
940
+ };
941
+ const normalizeAttioError = (error, context = {}) => {
942
+ const { response, request } = context;
943
+ const details = extractDetails(error);
944
+ const status = response?.status ?? details.status;
945
+ const message = extractMessage(error, response?.statusText ?? details.message);
946
+ const requestId = getHeaderValue(response, "x-request-id") ?? getHeaderValue(response, "x-attio-request-id");
947
+ if (response) {
948
+ const apiError = new AttioApiError(message, {
949
+ ...details,
950
+ status
951
+ });
952
+ apiError.requestId = requestId;
953
+ apiError.response = response;
954
+ apiError.request = request;
955
+ apiError.data = details.data ?? error;
956
+ apiError.retryAfterMs = parseRetryAfter(response);
957
+ return enhanceAttioError(apiError);
958
+ }
959
+ const networkError = new AttioNetworkError(message, details);
960
+ networkError.request = request;
961
+ return networkError;
962
+ };
963
+
964
+ //#endregion
965
+ //#region src/attio/config.ts
966
+ const TRAILING_SLASHES_REGEX = /\/+$/;
967
+ const WHITESPACE_REGEX = /\s/;
968
+ const DEFAULT_BASE_URL = "https://api.attio.com";
969
+ const getEnvValue = (key) => {
970
+ if (typeof process === "undefined") return;
971
+ return process.env?.[key];
972
+ };
973
+ const normalizeBaseUrl = (baseUrl) => baseUrl.replace(TRAILING_SLASHES_REGEX, "");
974
+ const resolveBaseUrl = (config) => {
975
+ return normalizeBaseUrl(config?.baseUrl ?? getEnvValue("ATTIO_BASE_URL") ?? DEFAULT_BASE_URL);
976
+ };
977
+ const resolveAuthToken = (config) => config?.apiKey ?? config?.accessToken ?? config?.authToken ?? getEnvValue("ATTIO_API_KEY") ?? getEnvValue("ATTIO_ACCESS_TOKEN");
978
+ const MISSING_API_KEY_ERROR = "Missing Attio API key. Set ATTIO_API_KEY or pass apiKey.";
979
+ const AuthTokenSchema = z.string().min(1, MISSING_API_KEY_ERROR).min(10, "Invalid Attio API key: too short.").refine((t) => !WHITESPACE_REGEX.test(t), "Invalid Attio API key: contains whitespace.");
980
+ const validateAuthToken = (token) => {
981
+ if (token === void 0 || token.length === 0) throw new AttioConfigError(MISSING_API_KEY_ERROR, { code: "MISSING_API_KEY" });
982
+ const result = AuthTokenSchema.safeParse(token);
983
+ if (!result.success) throw new AttioConfigError(result.error.issues[0].message, { code: "INVALID_API_KEY" });
984
+ return result.data;
985
+ };
986
+ const resolveResponseStyle = (config) => config?.responseStyle ?? "fields";
987
+ const resolveThrowOnError = (config) => config?.throwOnError ?? true;
988
+
989
+ //#endregion
990
+ //#region src/attio/retry.ts
991
+ const DEFAULT_RETRY_CONFIG = {
992
+ maxRetries: 3,
993
+ initialDelayMs: 500,
994
+ maxDelayMs: 5e3,
995
+ retryableStatusCodes: [
996
+ 408,
997
+ 429,
998
+ 500,
999
+ 502,
1000
+ 503,
1001
+ 504
1002
+ ],
1003
+ respectRetryAfter: true
1004
+ };
1005
+ const RetryErrorSchema = z.object({
1006
+ status: z.number().optional(),
1007
+ isNetworkError: z.boolean().optional(),
1008
+ retryAfterMs: z.number().optional()
1009
+ });
1010
+ const extractRetryErrorInfo = (error) => {
1011
+ if (error instanceof AttioError) return {
1012
+ status: error.status,
1013
+ isNetworkError: error.isNetworkError,
1014
+ retryAfterMs: error.retryAfterMs
1015
+ };
1016
+ const result = RetryErrorSchema.safeParse(error);
1017
+ if (!result.success) return;
1018
+ return result.data;
1019
+ };
1020
+ const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1021
+ const calculateRetryDelay = (attempt, config, retryAfterMs) => {
1022
+ if (config.respectRetryAfter && retryAfterMs && retryAfterMs > 0) return Math.min(retryAfterMs, config.maxDelayMs);
1023
+ const base = config.initialDelayMs * 2 ** attempt;
1024
+ const jitter = .75 + Math.random() * .5;
1025
+ return Math.min(base * jitter, config.maxDelayMs);
1026
+ };
1027
+ const isRetryableStatus = (status, config) => {
1028
+ if (status === void 0) return true;
1029
+ return config.retryableStatusCodes.includes(status);
1030
+ };
1031
+ const isRetryableError = (error, config) => {
1032
+ const info = extractRetryErrorInfo(error);
1033
+ if (info?.isNetworkError) return true;
1034
+ return isRetryableStatus(info?.status, config);
1035
+ };
1036
+ const getRetryAfterMs = (error) => extractRetryErrorInfo(error)?.retryAfterMs;
1037
+ const callWithRetry = async (fn, config) => {
1038
+ const retryConfig = {
1039
+ ...DEFAULT_RETRY_CONFIG,
1040
+ ...config
1041
+ };
1042
+ let attempt = 0;
1043
+ while (attempt <= retryConfig.maxRetries) try {
1044
+ return await fn();
1045
+ } catch (error) {
1046
+ if (!isRetryableError(error, retryConfig)) throw error;
1047
+ if (attempt >= retryConfig.maxRetries) throw new AttioRetryError("Retry attempts exhausted.", {
1048
+ code: "RETRY_EXHAUSTED",
1049
+ cause: error
1050
+ });
1051
+ await sleep(calculateRetryDelay(attempt, retryConfig, getRetryAfterMs(error)));
1052
+ attempt += 1;
1053
+ }
1054
+ throw new AttioRetryError("Retry attempts exhausted.", { code: "RETRY_EXHAUSTED" });
1055
+ };
1056
+
1057
+ //#endregion
1058
+ //#region src/attio/client.ts
1059
+ const interceptorUseSchema = z.object({ use: z.function() }).passthrough();
1060
+ const attioClientShapeSchema = z.object({
1061
+ request: z.function(),
1062
+ interceptors: z.object({
1063
+ error: interceptorUseSchema,
1064
+ request: interceptorUseSchema,
1065
+ response: interceptorUseSchema
1066
+ }).passthrough()
1067
+ }).passthrough();
1068
+ const AttioClientSchema = z.any().refine((value) => attioClientShapeSchema.safeParse(value).success, { message: "Invalid cached Attio client." });
1069
+ const combineSignalsWithAny = (initSignal, controllerSignal) => AbortSignal.any([initSignal, controllerSignal]);
1070
+ const combineSignalsWithFallback = (initSignal, controllerSignal) => {
1071
+ const combinedController = new AbortController();
1072
+ if (initSignal.aborted) {
1073
+ combinedController.abort();
1074
+ return { combinedSignal: combinedController.signal };
1075
+ }
1076
+ const abortCombined = () => combinedController.abort();
1077
+ initSignal.addEventListener("abort", abortCombined, { once: true });
1078
+ controllerSignal.addEventListener("abort", abortCombined, { once: true });
1079
+ return {
1080
+ combinedSignal: combinedController.signal,
1081
+ abortCombined
1082
+ };
1083
+ };
1084
+ const resolveFetch = (config) => {
1085
+ const baseFetch = config?.fetch ?? globalThis.fetch;
1086
+ if (!baseFetch) throw new AttioEnvironmentError("Fetch is not available in this environment.", { code: "FETCH_UNAVAILABLE" });
1087
+ if (!config?.timeoutMs) return baseFetch;
1088
+ return async (input, init) => {
1089
+ const controller = new AbortController();
1090
+ const timeoutId = setTimeout(() => controller.abort(), config.timeoutMs);
1091
+ let combinedSignal = controller.signal;
1092
+ let abortCombined;
1093
+ if (init?.signal) if (typeof AbortSignal !== "undefined" && "any" in AbortSignal) combinedSignal = combineSignalsWithAny(init.signal, controller.signal);
1094
+ else ({combinedSignal, abortCombined} = combineSignalsWithFallback(init.signal, controller.signal));
1095
+ try {
1096
+ return await baseFetch(input, {
1097
+ ...init,
1098
+ signal: combinedSignal
1099
+ });
1100
+ } finally {
1101
+ if (abortCombined) {
1102
+ init?.signal?.removeEventListener("abort", abortCombined);
1103
+ controller.signal.removeEventListener("abort", abortCombined);
1104
+ }
1105
+ clearTimeout(timeoutId);
1106
+ }
1107
+ };
1108
+ };
1109
+ const buildClientCacheKey = ({ config, authToken }) => {
1110
+ if (config.cache?.key) return `${config.cache.key}:${hashToken(authToken)}`;
1111
+ };
1112
+ const applyInterceptors = (client) => {
1113
+ client.interceptors.error.use((error, response, request, options) => normalizeAttioError(error, {
1114
+ response,
1115
+ request,
1116
+ options
1117
+ }));
1118
+ };
1119
+ const wrapClient = (base, retry) => {
1120
+ const requestWithRetry = (options) => {
1121
+ const { retry: retryOverride, ...rest } = options;
1122
+ return callWithRetry(() => base.request(rest), {
1123
+ ...retry,
1124
+ ...retryOverride
1125
+ });
1126
+ };
1127
+ const makeMethod = (method) => (options) => requestWithRetry({
1128
+ ...options,
1129
+ method
1130
+ });
1131
+ return {
1132
+ ...base,
1133
+ request: requestWithRetry,
1134
+ connect: makeMethod("CONNECT"),
1135
+ delete: makeMethod("DELETE"),
1136
+ get: makeMethod("GET"),
1137
+ head: makeMethod("HEAD"),
1138
+ options: makeMethod("OPTIONS"),
1139
+ patch: makeMethod("PATCH"),
1140
+ post: makeMethod("POST"),
1141
+ put: makeMethod("PUT"),
1142
+ trace: makeMethod("TRACE")
1143
+ };
1144
+ };
1145
+ const extractAndCleanConfig = (config) => {
1146
+ const { apiKey: _apiKey, accessToken: _accessToken, authToken: _authToken, cache: _cache, retry, timeoutMs, headers, ...cleanConfig } = config;
1147
+ return {
1148
+ cleanConfig,
1149
+ headers,
1150
+ retry,
1151
+ timeoutMs
1152
+ };
1153
+ };
1154
+ const createAttioClientWithAuthToken = ({ config = {}, authToken }) => {
1155
+ const baseUrl = resolveBaseUrl(config);
1156
+ const responseStyle = resolveResponseStyle(config);
1157
+ const throwOnError = resolveThrowOnError(config);
1158
+ const { cleanConfig, headers, retry, timeoutMs } = extractAndCleanConfig(config);
1159
+ const mergedHeaders = mergeHeaders({ Accept: "application/json" }, headers);
1160
+ const base = createClient({
1161
+ ...cleanConfig,
1162
+ baseUrl,
1163
+ auth: authToken,
1164
+ headers: mergedHeaders,
1165
+ fetch: resolveFetch({
1166
+ ...config,
1167
+ timeoutMs
1168
+ }),
1169
+ responseStyle,
1170
+ throwOnError
1171
+ });
1172
+ applyInterceptors(base);
1173
+ return wrapClient(base, retry);
1174
+ };
1175
+ const createAttioClient = (config = {}) => {
1176
+ return createAttioClientWithAuthToken({
1177
+ config,
1178
+ authToken: validateAuthToken(resolveAuthToken(config))
1179
+ });
1180
+ };
1181
+ const getAttioClient = (config = {}) => {
1182
+ const cacheEnabled = config.cache?.enabled ?? true;
1183
+ const authToken = validateAuthToken(resolveAuthToken(config));
1184
+ const cacheKey = buildClientCacheKey({
1185
+ config,
1186
+ authToken
1187
+ });
1188
+ if (cacheEnabled && cacheKey) {
1189
+ const cached = getCachedClient(cacheKey, AttioClientSchema);
1190
+ if (cached) return cached;
1191
+ const client = createAttioClientWithAuthToken({
1192
+ config,
1193
+ authToken
1194
+ });
1195
+ setCachedClient(cacheKey, client);
1196
+ return client;
1197
+ }
1198
+ return createAttioClientWithAuthToken({
1199
+ config,
1200
+ authToken
1201
+ });
1202
+ };
1203
+ const resolveAttioClient = (input = {}) => input.client ?? getAttioClient(input.config ?? {});
1204
+
1205
+ //#endregion
1206
+ //#region src/attio/filters.ts
1207
+ const operator = (field, op, value) => ({ [field]: { [op]: value } });
1208
+ const filters = {
1209
+ eq: (field, value) => operator(field, "$eq", value),
1210
+ contains: (field, value) => operator(field, "$contains", value),
1211
+ startsWith: (field, value) => operator(field, "$starts_with", value),
1212
+ endsWith: (field, value) => operator(field, "$ends_with", value),
1213
+ notEmpty: (field) => operator(field, "$not_empty", true),
1214
+ and: (...conditions) => ({ $and: conditions }),
1215
+ or: (...conditions) => ({ $or: conditions }),
1216
+ not: (condition) => ({ $not: condition })
1217
+ };
1218
+
1219
+ //#endregion
1220
+ //#region src/generated/client.gen.ts
1221
+ const client = createClient(createConfig({ baseUrl: "https://api.attio.com" }));
1222
+
1223
+ //#endregion
1224
+ //#region src/generated/zod.gen.ts
1225
+ const zStatus = z.object({
1226
+ id: z.object({
1227
+ workspace_id: z.uuid(),
1228
+ object_id: z.uuid(),
1229
+ attribute_id: z.uuid(),
1230
+ status_id: z.uuid()
1231
+ }),
1232
+ title: z.string(),
1233
+ is_archived: z.boolean(),
1234
+ celebration_enabled: z.boolean(),
1235
+ target_time_in_status: z.union([z.string(), z.null()])
1236
+ });
1237
+ const zSelectOption = z.object({
1238
+ id: z.object({
1239
+ workspace_id: z.uuid(),
1240
+ object_id: z.uuid(),
1241
+ attribute_id: z.uuid(),
1242
+ option_id: z.uuid()
1243
+ }),
1244
+ title: z.string(),
1245
+ is_archived: z.boolean()
1246
+ });
1247
+ /**
1248
+ * A union of possible value types, as required in request bodies.
1249
+ */
1250
+ const zInputValue = z.union([
1251
+ z.object({
1252
+ referenced_actor_type: z.enum(["workspace-member"]),
1253
+ referenced_actor_id: z.uuid()
1254
+ }),
1255
+ z.object({ workspace_member_email_address: z.string() }),
1256
+ z.object({ value: z.boolean() }),
1257
+ z.object({ currency_value: z.number() }),
1258
+ z.object({ value: z.string() }),
1259
+ z.object({ domain: z.optional(z.string()) }),
1260
+ z.object({ email_address: z.optional(z.string()) }),
1261
+ z.object({
1262
+ target_object: z.string(),
1263
+ target_record_id: z.uuid()
1264
+ }),
1265
+ z.object({
1266
+ target_object: z.string(),
1267
+ "[slug_or_id_of_matching_attribute]": z.array(z.union([
1268
+ z.object({ domain: z.optional(z.string()) }),
1269
+ z.object({ email_address: z.optional(z.string()) }),
1270
+ z.object({ value: z.optional(z.number()) }),
1271
+ z.object({
1272
+ original_phone_number: z.optional(z.string()),
1273
+ country_code: z.optional(z.enum([
1274
+ "AF",
1275
+ "AX",
1276
+ "AL",
1277
+ "DZ",
1278
+ "AS",
1279
+ "AD",
1280
+ "AO",
1281
+ "AI",
1282
+ "AQ",
1283
+ "AG",
1284
+ "AR",
1285
+ "AM",
1286
+ "AW",
1287
+ "AU",
1288
+ "AT",
1289
+ "AZ",
1290
+ "BS",
1291
+ "BH",
1292
+ "BD",
1293
+ "BB",
1294
+ "BY",
1295
+ "BE",
1296
+ "BZ",
1297
+ "BJ",
1298
+ "BM",
1299
+ "BT",
1300
+ "BO",
1301
+ "BA",
1302
+ "BW",
1303
+ "BV",
1304
+ "BR",
1305
+ "IO",
1306
+ "BN",
1307
+ "BG",
1308
+ "BF",
1309
+ "BI",
1310
+ "KH",
1311
+ "CM",
1312
+ "CA",
1313
+ "CV",
1314
+ "KY",
1315
+ "CF",
1316
+ "TD",
1317
+ "CL",
1318
+ "CN",
1319
+ "CX",
1320
+ "CC",
1321
+ "CO",
1322
+ "KM",
716
1323
  "CG",
717
1324
  "CD",
718
1325
  "CK",
@@ -1508,6 +2115,7 @@ const zOutputValue = z.union([
1508
2115
  "DKK",
1509
2116
  "EUR",
1510
2117
  "HKD",
2118
+ "HUF",
1511
2119
  "ISK",
1512
2120
  "INR",
1513
2121
  "ILS",
@@ -2218,6 +2826,7 @@ const zAttribute = z.object({
2218
2826
  "DKK",
2219
2827
  "EUR",
2220
2828
  "HKD",
2829
+ "HUF",
2221
2830
  "ISK",
2222
2831
  "INR",
2223
2832
  "ILS",
@@ -2579,6 +3188,7 @@ const zPostV2ByTargetByIdentifierAttributesData = z.object({
2579
3188
  "DKK",
2580
3189
  "EUR",
2581
3190
  "HKD",
3191
+ "HUF",
2582
3192
  "ISK",
2583
3193
  "INR",
2584
3194
  "ILS",
@@ -2673,6 +3283,7 @@ const zPatchV2ByTargetByIdentifierAttributesByAttributeData = z.object({
2673
3283
  "DKK",
2674
3284
  "EUR",
2675
3285
  "HKD",
3286
+ "HUF",
2676
3287
  "ISK",
2677
3288
  "INR",
2678
3289
  "ILS",
@@ -2907,6 +3518,7 @@ const zPostV2ObjectsByObjectRecordsQueryResponse = z.object({ data: z.array(z.ob
2907
3518
  "DKK",
2908
3519
  "EUR",
2909
3520
  "HKD",
3521
+ "HUF",
2910
3522
  "ISK",
2911
3523
  "INR",
2912
3524
  "ILS",
@@ -3770,6 +4382,7 @@ const zPostV2ObjectsByObjectRecordsResponse = z.object({ data: z.object({
3770
4382
  "DKK",
3771
4383
  "EUR",
3772
4384
  "HKD",
4385
+ "HUF",
3773
4386
  "ISK",
3774
4387
  "INR",
3775
4388
  "ILS",
@@ -4633,6 +5246,7 @@ const zPutV2ObjectsByObjectRecordsResponse = z.object({ data: z.object({
4633
5246
  "DKK",
4634
5247
  "EUR",
4635
5248
  "HKD",
5249
+ "HUF",
4636
5250
  "ISK",
4637
5251
  "INR",
4638
5252
  "ILS",
@@ -5511,6 +6125,7 @@ const zGetV2ObjectsByObjectRecordsByRecordIdResponse = z.object({ data: z.object
5511
6125
  "DKK",
5512
6126
  "EUR",
5513
6127
  "HKD",
6128
+ "HUF",
5514
6129
  "ISK",
5515
6130
  "INR",
5516
6131
  "ILS",
@@ -6377,6 +6992,7 @@ const zPatchV2ObjectsByObjectRecordsByRecordIdResponse = z.object({ data: z.obje
6377
6992
  "DKK",
6378
6993
  "EUR",
6379
6994
  "HKD",
6995
+ "HUF",
6380
6996
  "ISK",
6381
6997
  "INR",
6382
6998
  "ILS",
@@ -7243,6 +7859,7 @@ const zPutV2ObjectsByObjectRecordsByRecordIdResponse = z.object({ data: z.object
7243
7859
  "DKK",
7244
7860
  "EUR",
7245
7861
  "HKD",
7862
+ "HUF",
7246
7863
  "ISK",
7247
7864
  "INR",
7248
7865
  "ILS",
@@ -8106,6 +8723,7 @@ const zGetV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValuesResponse
8106
8723
  "DKK",
8107
8724
  "EUR",
8108
8725
  "HKD",
8726
+ "HUF",
8109
8727
  "ISK",
8110
8728
  "INR",
8111
8729
  "ILS",
@@ -9129,6 +9747,7 @@ const zPostV2ListsByListEntriesQueryResponse = z.object({ data: z.array(z.object
9129
9747
  "DKK",
9130
9748
  "EUR",
9131
9749
  "HKD",
9750
+ "HUF",
9132
9751
  "ISK",
9133
9752
  "INR",
9134
9753
  "ILS",
@@ -9997,6 +10616,7 @@ const zPostV2ListsByListEntriesResponse = z.object({ data: z.object({
9997
10616
  "DKK",
9998
10617
  "EUR",
9999
10618
  "HKD",
10619
+ "HUF",
10000
10620
  "ISK",
10001
10621
  "INR",
10002
10622
  "ILS",
@@ -10865,6 +11485,7 @@ const zPutV2ListsByListEntriesResponse = z.object({ data: z.object({
10865
11485
  "DKK",
10866
11486
  "EUR",
10867
11487
  "HKD",
11488
+ "HUF",
10868
11489
  "ISK",
10869
11490
  "INR",
10870
11491
  "ILS",
@@ -11744,6 +12365,7 @@ const zGetV2ListsByListEntriesByEntryIdResponse = z.object({ data: z.object({
11744
12365
  "DKK",
11745
12366
  "EUR",
11746
12367
  "HKD",
12368
+ "HUF",
11747
12369
  "ISK",
11748
12370
  "INR",
11749
12371
  "ILS",
@@ -12611,6 +13233,7 @@ const zPatchV2ListsByListEntriesByEntryIdResponse = z.object({ data: z.object({
12611
13233
  "DKK",
12612
13234
  "EUR",
12613
13235
  "HKD",
13236
+ "HUF",
12614
13237
  "ISK",
12615
13238
  "INR",
12616
13239
  "ILS",
@@ -13478,6 +14101,7 @@ const zPutV2ListsByListEntriesByEntryIdResponse = z.object({ data: z.object({
13478
14101
  "DKK",
13479
14102
  "EUR",
13480
14103
  "HKD",
14104
+ "HUF",
13481
14105
  "ISK",
13482
14106
  "INR",
13483
14107
  "ILS",
@@ -14341,6 +14965,7 @@ const zGetV2ListsByListEntriesByEntryIdAttributesByAttributeValuesResponse = z.o
14341
14965
  "DKK",
14342
14966
  "EUR",
14343
14967
  "HKD",
14968
+ "HUF",
14344
14969
  "ISK",
14345
14970
  "INR",
14346
14971
  "ILS",
@@ -16510,251 +17135,74 @@ const zPatchV2WebhooksByWebhookIdResponse = z.object({ data: z.object({
16510
17135
  })),
16511
17136
  id: z.object({
16512
17137
  workspace_id: z.uuid(),
16513
- webhook_id: z.uuid()
16514
- }),
16515
- status: z.enum([
16516
- "active",
16517
- "degraded",
16518
- "inactive"
16519
- ]),
16520
- created_at: z.string()
16521
- }) });
16522
- const zGetV2SelfData = z.object({
16523
- body: z.optional(z.never()),
16524
- path: z.optional(z.never()),
16525
- query: z.optional(z.never())
16526
- });
16527
- /**
16528
- * Success
16529
- */
16530
- const zGetV2SelfResponse = z.union([z.object({ active: z.literal(false) }), z.object({
16531
- active: z.boolean(),
16532
- scope: z.string(),
16533
- client_id: z.string(),
16534
- token_type: z.enum(["Bearer"]),
16535
- exp: z.union([z.number(), z.null()]),
16536
- iat: z.number(),
16537
- sub: z.uuid(),
16538
- aud: z.string(),
16539
- iss: z.enum(["attio.com"]),
16540
- authorized_by_workspace_member_id: z.uuid(),
16541
- workspace_id: z.uuid(),
16542
- workspace_name: z.string(),
16543
- workspace_slug: z.string(),
16544
- workspace_logo_url: z.union([z.url(), z.null()])
16545
- })]);
16546
-
16547
- //#endregion
16548
- //#region src/generated/sdk.gen.ts
16549
- /**
16550
- * List objects
16551
- *
16552
- * Lists all system-defined and user-defined objects in your workspace.
16553
- *
16554
- * Required scopes: `object_configuration:read`.
16555
- */
16556
- const getV2Objects = (options) => (options?.client ?? client).get({
16557
- requestValidator: async (data) => await zGetV2ObjectsData.parseAsync(data),
16558
- responseValidator: async (data) => await zGetV2ObjectsResponse.parseAsync(data),
16559
- security: [{
16560
- scheme: "bearer",
16561
- type: "http"
16562
- }],
16563
- url: "/v2/objects",
16564
- ...options
16565
- });
16566
- /**
16567
- * Create an object
16568
- *
16569
- * Creates a new custom object in your workspace.
16570
- *
16571
- * Required scopes: `object_configuration:read-write`.
16572
- */
16573
- const postV2Objects = (options) => (options.client ?? client).post({
16574
- requestValidator: async (data) => await zPostV2ObjectsData.parseAsync(data),
16575
- responseValidator: async (data) => await zPostV2ObjectsResponse.parseAsync(data),
16576
- security: [{
16577
- scheme: "bearer",
16578
- type: "http"
16579
- }],
16580
- url: "/v2/objects",
16581
- ...options,
16582
- headers: {
16583
- "Content-Type": "application/json",
16584
- ...options.headers
16585
- }
16586
- });
16587
- /**
16588
- * Get an object
16589
- *
16590
- * Gets a single object by its `object_id` or slug.
16591
- *
16592
- * Required scopes: `object_configuration:read`.
16593
- */
16594
- const getV2ObjectsByObject = (options) => (options.client ?? client).get({
16595
- requestValidator: async (data) => await zGetV2ObjectsByObjectData.parseAsync(data),
16596
- responseValidator: async (data) => await zGetV2ObjectsByObjectResponse.parseAsync(data),
16597
- security: [{
16598
- scheme: "bearer",
16599
- type: "http"
16600
- }],
16601
- url: "/v2/objects/{object}",
16602
- ...options
16603
- });
16604
- /**
16605
- * Update an object
16606
- *
16607
- * Updates a single object. The object to be updated is identified by its `object_id`.
16608
- *
16609
- * Required scopes: `object_configuration:read-write`.
16610
- */
16611
- const patchV2ObjectsByObject = (options) => (options.client ?? client).patch({
16612
- requestValidator: async (data) => await zPatchV2ObjectsByObjectData.parseAsync(data),
16613
- responseValidator: async (data) => await zPatchV2ObjectsByObjectResponse.parseAsync(data),
16614
- security: [{
16615
- scheme: "bearer",
16616
- type: "http"
16617
- }],
16618
- url: "/v2/objects/{object}",
16619
- ...options,
16620
- headers: {
16621
- "Content-Type": "application/json",
16622
- ...options.headers
16623
- }
16624
- });
16625
- /**
16626
- * List attributes
16627
- *
16628
- * Lists all attributes defined on a specific object or list. Attributes are returned in the order that they are sorted by in the UI.
16629
- *
16630
- * Required scopes: `object_configuration:read`.
16631
- */
16632
- const getV2ByTargetByIdentifierAttributes = (options) => (options.client ?? client).get({
16633
- requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesData.parseAsync(data),
16634
- responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesResponse.parseAsync(data),
16635
- security: [{
16636
- scheme: "bearer",
16637
- type: "http"
16638
- }],
16639
- url: "/v2/{target}/{identifier}/attributes",
16640
- ...options
16641
- });
16642
- /**
16643
- * Create an attribute
16644
- *
16645
- * Creates a new attribute on either an object or a list.
16646
- *
16647
- * For record-reference attributes, you can optionally create a bidirectional relationship by providing a `relationship` object. This will create two entangled attributes: one on the specified object and a reverse attribute on the related object.
16648
- *
16649
- * To create an attribute on an object, you must also have the `object_configuration:read-write` scope.
16650
- *
16651
- * To create an attribute on a list, you must also have the `list_configuration:read-write` scope.
16652
- */
16653
- const postV2ByTargetByIdentifierAttributes = (options) => (options.client ?? client).post({
16654
- requestValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesData.parseAsync(data),
16655
- responseValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesResponse.parseAsync(data),
16656
- security: [{
16657
- scheme: "bearer",
16658
- type: "http"
16659
- }],
16660
- url: "/v2/{target}/{identifier}/attributes",
16661
- ...options,
16662
- headers: {
16663
- "Content-Type": "application/json",
16664
- ...options.headers
16665
- }
16666
- });
16667
- /**
16668
- * Get an attribute
16669
- *
16670
- * Gets information about a single attribute on either an object or a list.
16671
- *
16672
- * Required scopes: `object_configuration:read`.
16673
- */
16674
- const getV2ByTargetByIdentifierAttributesByAttribute = (options) => (options.client ?? client).get({
16675
- requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeData.parseAsync(data),
16676
- responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeResponse.parseAsync(data),
16677
- security: [{
16678
- scheme: "bearer",
16679
- type: "http"
16680
- }],
16681
- url: "/v2/{target}/{identifier}/attributes/{attribute}",
16682
- ...options
16683
- });
16684
- /**
16685
- * Update an attribute
16686
- *
16687
- * Updates a single attribute on a given object or list.
16688
- *
16689
- * Required scopes: `object_configuration:read-write`.
16690
- */
16691
- const patchV2ByTargetByIdentifierAttributesByAttribute = (options) => (options.client ?? client).patch({
16692
- requestValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeData.parseAsync(data),
16693
- responseValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeResponse.parseAsync(data),
16694
- security: [{
16695
- scheme: "bearer",
16696
- type: "http"
16697
- }],
16698
- url: "/v2/{target}/{identifier}/attributes/{attribute}",
16699
- ...options,
16700
- headers: {
16701
- "Content-Type": "application/json",
16702
- ...options.headers
16703
- }
17138
+ webhook_id: z.uuid()
17139
+ }),
17140
+ status: z.enum([
17141
+ "active",
17142
+ "degraded",
17143
+ "inactive"
17144
+ ]),
17145
+ created_at: z.string()
17146
+ }) });
17147
+ const zGetV2SelfData = z.object({
17148
+ body: z.optional(z.never()),
17149
+ path: z.optional(z.never()),
17150
+ query: z.optional(z.never())
16704
17151
  });
16705
17152
  /**
16706
- * List select options
16707
- *
16708
- * Lists all select options for a particular attribute on either an object or a list.
16709
- *
16710
- * Required scopes: `object_configuration:read`.
17153
+ * Success
16711
17154
  */
16712
- const getV2ByTargetByIdentifierAttributesByAttributeOptions = (options) => (options.client ?? client).get({
16713
- requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeOptionsData.parseAsync(data),
16714
- responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeOptionsResponse.parseAsync(data),
16715
- security: [{
16716
- scheme: "bearer",
16717
- type: "http"
16718
- }],
16719
- url: "/v2/{target}/{identifier}/attributes/{attribute}/options",
16720
- ...options
16721
- });
17155
+ const zGetV2SelfResponse = z.union([z.object({ active: z.literal(false) }), z.object({
17156
+ active: z.boolean(),
17157
+ scope: z.string(),
17158
+ client_id: z.string(),
17159
+ token_type: z.enum(["Bearer"]),
17160
+ exp: z.union([z.number(), z.null()]),
17161
+ iat: z.number(),
17162
+ sub: z.uuid(),
17163
+ aud: z.string(),
17164
+ iss: z.enum(["attio.com"]),
17165
+ authorized_by_workspace_member_id: z.uuid(),
17166
+ workspace_id: z.uuid(),
17167
+ workspace_name: z.string(),
17168
+ workspace_slug: z.string(),
17169
+ workspace_logo_url: z.union([z.url(), z.null()])
17170
+ })]);
17171
+
17172
+ //#endregion
17173
+ //#region src/generated/sdk.gen.ts
16722
17174
  /**
16723
- * Create a select option
17175
+ * List objects
16724
17176
  *
16725
- * Adds a select option to a select attribute on an object or a list.
17177
+ * Lists all system-defined and user-defined objects in your workspace.
16726
17178
  *
16727
- * Required scopes: `object_configuration:read-write`.
17179
+ * Required scopes: `object_configuration:read`.
16728
17180
  */
16729
- const postV2ByTargetByIdentifierAttributesByAttributeOptions = (options) => (options.client ?? client).post({
16730
- requestValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeOptionsData.parseAsync(data),
16731
- responseValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeOptionsResponse.parseAsync(data),
17181
+ const getV2Objects = (options) => (options?.client ?? client).get({
17182
+ requestValidator: async (data) => await zGetV2ObjectsData.parseAsync(data),
17183
+ responseValidator: async (data) => await zGetV2ObjectsResponse.parseAsync(data),
16732
17184
  security: [{
16733
17185
  scheme: "bearer",
16734
17186
  type: "http"
16735
17187
  }],
16736
- url: "/v2/{target}/{identifier}/attributes/{attribute}/options",
16737
- ...options,
16738
- headers: {
16739
- "Content-Type": "application/json",
16740
- ...options.headers
16741
- }
17188
+ url: "/v2/objects",
17189
+ ...options
16742
17190
  });
16743
17191
  /**
16744
- * Update a select option
17192
+ * Create an object
16745
17193
  *
16746
- * Updates a select option on an attribute on either an object or a list.
17194
+ * Creates a new custom object in your workspace.
16747
17195
  *
16748
17196
  * Required scopes: `object_configuration:read-write`.
16749
17197
  */
16750
- const patchV2ByTargetByIdentifierAttributesByAttributeOptionsByOption = (options) => (options.client ?? client).patch({
16751
- requestValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeOptionsByOptionData.parseAsync(data),
16752
- responseValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeOptionsByOptionResponse.parseAsync(data),
17198
+ const postV2Objects = (options) => (options.client ?? client).post({
17199
+ requestValidator: async (data) => await zPostV2ObjectsData.parseAsync(data),
17200
+ responseValidator: async (data) => await zPostV2ObjectsResponse.parseAsync(data),
16753
17201
  security: [{
16754
17202
  scheme: "bearer",
16755
17203
  type: "http"
16756
17204
  }],
16757
- url: "/v2/{target}/{identifier}/attributes/{attribute}/options/{option}",
17205
+ url: "/v2/objects",
16758
17206
  ...options,
16759
17207
  headers: {
16760
17208
  "Content-Type": "application/json",
@@ -16762,123 +17210,37 @@ const patchV2ByTargetByIdentifierAttributesByAttributeOptionsByOption = (options
16762
17210
  }
16763
17211
  });
16764
17212
  /**
16765
- * List statuses
17213
+ * Get an object
16766
17214
  *
16767
- * Lists all statuses for a particular status attribute on either an object or a list.
17215
+ * Gets a single object by its `object_id` or slug.
16768
17216
  *
16769
17217
  * Required scopes: `object_configuration:read`.
16770
17218
  */
16771
- const getV2ByTargetByIdentifierAttributesByAttributeStatuses = (options) => (options.client ?? client).get({
16772
- requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeStatusesData.parseAsync(data),
16773
- responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeStatusesResponse.parseAsync(data),
17219
+ const getV2ObjectsByObject = (options) => (options.client ?? client).get({
17220
+ requestValidator: async (data) => await zGetV2ObjectsByObjectData.parseAsync(data),
17221
+ responseValidator: async (data) => await zGetV2ObjectsByObjectResponse.parseAsync(data),
16774
17222
  security: [{
16775
17223
  scheme: "bearer",
16776
17224
  type: "http"
16777
17225
  }],
16778
- url: "/v2/{target}/{identifier}/attributes/{attribute}/statuses",
17226
+ url: "/v2/objects/{object}",
16779
17227
  ...options
16780
17228
  });
16781
17229
  /**
16782
- * Create a status
16783
- *
16784
- * Add a new status to a status attribute on either an object or a list.
16785
- *
16786
- * Required scopes: `object_configuration:read-write`.
16787
- */
16788
- const postV2ByTargetByIdentifierAttributesByAttributeStatuses = (options) => (options.client ?? client).post({
16789
- requestValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeStatusesData.parseAsync(data),
16790
- responseValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeStatusesResponse.parseAsync(data),
16791
- security: [{
16792
- scheme: "bearer",
16793
- type: "http"
16794
- }],
16795
- url: "/v2/{target}/{identifier}/attributes/{attribute}/statuses",
16796
- ...options,
16797
- headers: {
16798
- "Content-Type": "application/json",
16799
- ...options.headers
16800
- }
16801
- });
16802
- /**
16803
- * Update a status
17230
+ * Update an object
16804
17231
  *
16805
- * Update a status on an status attribute on either an object or a list.
17232
+ * Updates a single object. The object to be updated is identified by its `object_id`.
16806
17233
  *
16807
17234
  * Required scopes: `object_configuration:read-write`.
16808
17235
  */
16809
- const patchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatus = (options) => (options.client ?? client).patch({
16810
- requestValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatusData.parseAsync(data),
16811
- responseValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatusResponse.parseAsync(data),
16812
- security: [{
16813
- scheme: "bearer",
16814
- type: "http"
16815
- }],
16816
- url: "/v2/{target}/{identifier}/attributes/{attribute}/statuses/{status}",
16817
- ...options,
16818
- headers: {
16819
- "Content-Type": "application/json",
16820
- ...options.headers
16821
- }
16822
- });
16823
- /**
16824
- * List records
16825
- *
16826
- * Lists people, company or other records, with the option to filter and sort results.
16827
- *
16828
- * Required scopes: `record_permission:read`, `object_configuration:read`.
16829
- */
16830
- const postV2ObjectsByObjectRecordsQuery = (options) => (options.client ?? client).post({
16831
- requestValidator: async (data) => await zPostV2ObjectsByObjectRecordsQueryData.parseAsync(data),
16832
- responseValidator: async (data) => await zPostV2ObjectsByObjectRecordsQueryResponse.parseAsync(data),
16833
- security: [{
16834
- scheme: "bearer",
16835
- type: "http"
16836
- }],
16837
- url: "/v2/objects/{object}/records/query",
16838
- ...options,
16839
- headers: {
16840
- "Content-Type": "application/json",
16841
- ...options.headers
16842
- }
16843
- });
16844
- /**
16845
- * Create a record
16846
- *
16847
- * Creates a new person, company or other record. This endpoint will throw on conflicts of unique attributes. If you would prefer to update records on conflicts, please use the [Assert record endpoint](/rest-api/endpoint-reference/records/assert-a-record) instead.
16848
- *
16849
- * Required scopes: `record_permission:read-write`, `object_configuration:read`.
16850
- */
16851
- const postV2ObjectsByObjectRecords = (options) => (options.client ?? client).post({
16852
- requestValidator: async (data) => await zPostV2ObjectsByObjectRecordsData.parseAsync(data),
16853
- responseValidator: async (data) => await zPostV2ObjectsByObjectRecordsResponse.parseAsync(data),
16854
- security: [{
16855
- scheme: "bearer",
16856
- type: "http"
16857
- }],
16858
- url: "/v2/objects/{object}/records",
16859
- ...options,
16860
- headers: {
16861
- "Content-Type": "application/json",
16862
- ...options.headers
16863
- }
16864
- });
16865
- /**
16866
- * Assert a record
16867
- *
16868
- * Use this endpoint to create or update people, companies and other records. A matching attribute is used to search for existing records. If a record is found with the same value for the matching attribute, that record will be updated. If no record with the same value for the matching attribute is found, a new record will be created instead. If you would like to avoid matching, please use the [Create record endpoint](/rest-api/endpoint-reference/records/create-a-record).
16869
- *
16870
- * If the matching attribute is a multiselect attribute, new values will be added and existing values will not be deleted. For any other multiselect attribute, all values will be either created or deleted as necessary to match the list of supplied values.
16871
- *
16872
- * Required scopes: `record_permission:read-write`, `object_configuration:read`.
16873
- */
16874
- const putV2ObjectsByObjectRecords = (options) => (options.client ?? client).put({
16875
- requestValidator: async (data) => await zPutV2ObjectsByObjectRecordsData.parseAsync(data),
16876
- responseValidator: async (data) => await zPutV2ObjectsByObjectRecordsResponse.parseAsync(data),
17236
+ const patchV2ObjectsByObject = (options) => (options.client ?? client).patch({
17237
+ requestValidator: async (data) => await zPatchV2ObjectsByObjectData.parseAsync(data),
17238
+ responseValidator: async (data) => await zPatchV2ObjectsByObjectResponse.parseAsync(data),
16877
17239
  security: [{
16878
17240
  scheme: "bearer",
16879
17241
  type: "http"
16880
17242
  }],
16881
- url: "/v2/objects/{object}/records",
17243
+ url: "/v2/objects/{object}",
16882
17244
  ...options,
16883
17245
  headers: {
16884
17246
  "Content-Type": "application/json",
@@ -16886,75 +17248,41 @@ const putV2ObjectsByObjectRecords = (options) => (options.client ?? client).put(
16886
17248
  }
16887
17249
  });
16888
17250
  /**
16889
- * Delete a record
16890
- *
16891
- * Deletes a single record (e.g. a company or person) by ID.
16892
- *
16893
- * Required scopes: `object_configuration:read`, `record_permission:read-write`.
16894
- */
16895
- const deleteV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).delete({
16896
- requestValidator: async (data) => await zDeleteV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
16897
- responseValidator: async (data) => await zDeleteV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
16898
- security: [{
16899
- scheme: "bearer",
16900
- type: "http"
16901
- }],
16902
- url: "/v2/objects/{object}/records/{record_id}",
16903
- ...options
16904
- });
16905
- /**
16906
- * Get a record
17251
+ * List attributes
16907
17252
  *
16908
- * Gets a single person, company or other record by its `record_id`.
17253
+ * Lists all attributes defined on a specific object or list. Attributes are returned in the order that they are sorted by in the UI.
16909
17254
  *
16910
- * Required scopes: `record_permission:read`, `object_configuration:read`.
17255
+ * Required scopes: `object_configuration:read`.
16911
17256
  */
16912
- const getV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).get({
16913
- requestValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
16914
- responseValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
17257
+ const getV2ByTargetByIdentifierAttributes = (options) => (options.client ?? client).get({
17258
+ requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesData.parseAsync(data),
17259
+ responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesResponse.parseAsync(data),
16915
17260
  security: [{
16916
17261
  scheme: "bearer",
16917
17262
  type: "http"
16918
17263
  }],
16919
- url: "/v2/objects/{object}/records/{record_id}",
17264
+ url: "/v2/{target}/{identifier}/attributes",
16920
17265
  ...options
16921
17266
  });
16922
17267
  /**
16923
- * Update a record (append multiselect values)
17268
+ * Create an attribute
16924
17269
  *
16925
- * Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will be created and prepended to the list of values that already exist (if any). Use the `PUT` endpoint to overwrite or remove multiselect attribute values.
17270
+ * Creates a new attribute on either an object or a list.
16926
17271
  *
16927
- * Required scopes: `record_permission:read-write`, `object_configuration:read`.
16928
- */
16929
- const patchV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).patch({
16930
- requestValidator: async (data) => await zPatchV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
16931
- responseValidator: async (data) => await zPatchV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
16932
- security: [{
16933
- scheme: "bearer",
16934
- type: "http"
16935
- }],
16936
- url: "/v2/objects/{object}/records/{record_id}",
16937
- ...options,
16938
- headers: {
16939
- "Content-Type": "application/json",
16940
- ...options.headers
16941
- }
16942
- });
16943
- /**
16944
- * Update a record (overwrite multiselect values)
17272
+ * For record-reference attributes, you can optionally create a bidirectional relationship by providing a `relationship` object. This will create two entangled attributes: one on the specified object and a reverse attribute on the related object.
16945
17273
  *
16946
- * Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the `PATCH` endpoint to append multiselect values without removing those that already exist.
17274
+ * To create an attribute on an object, you must also have the `object_configuration:read-write` scope.
16947
17275
  *
16948
- * Required scopes: `record_permission:read-write`, `object_configuration:read`.
17276
+ * To create an attribute on a list, you must also have the `list_configuration:read-write` scope.
16949
17277
  */
16950
- const putV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).put({
16951
- requestValidator: async (data) => await zPutV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
16952
- responseValidator: async (data) => await zPutV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
17278
+ const postV2ByTargetByIdentifierAttributes = (options) => (options.client ?? client).post({
17279
+ requestValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesData.parseAsync(data),
17280
+ responseValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesResponse.parseAsync(data),
16953
17281
  security: [{
16954
17282
  scheme: "bearer",
16955
17283
  type: "http"
16956
17284
  }],
16957
- url: "/v2/objects/{object}/records/{record_id}",
17285
+ url: "/v2/{target}/{identifier}/attributes",
16958
17286
  ...options,
16959
17287
  headers: {
16960
17288
  "Content-Type": "application/json",
@@ -16962,102 +17290,96 @@ const putV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? cl
16962
17290
  }
16963
17291
  });
16964
17292
  /**
16965
- * List record attribute values
17293
+ * Get an attribute
16966
17294
  *
16967
- * Gets all values for a given attribute on a record. Historic values can be queried using the `show_historic` query param. Historic values cannot be queried on COMINT (Communication Intelligence) or enriched attributes and the endpoint will return a 400 error if this is attempted. Historic values are sorted from oldest to newest (by `active_from`). Some attributes are subject to billing status and will return an empty array of values if theworkspace being queried does not have the required billing flag enabled.
17295
+ * Gets information about a single attribute on either an object or a list.
16968
17296
  *
16969
- * Required scopes: `record_permission:read`, `object_configuration:read`.
17297
+ * Required scopes: `object_configuration:read`.
16970
17298
  */
16971
- const getV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValues = (options) => (options.client ?? client).get({
16972
- requestValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValuesData.parseAsync(data),
16973
- responseValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValuesResponse.parseAsync(data),
17299
+ const getV2ByTargetByIdentifierAttributesByAttribute = (options) => (options.client ?? client).get({
17300
+ requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeData.parseAsync(data),
17301
+ responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeResponse.parseAsync(data),
16974
17302
  security: [{
16975
17303
  scheme: "bearer",
16976
17304
  type: "http"
16977
17305
  }],
16978
- url: "/v2/objects/{object}/records/{record_id}/attributes/{attribute}/values",
17306
+ url: "/v2/{target}/{identifier}/attributes/{attribute}",
16979
17307
  ...options
16980
17308
  });
16981
17309
  /**
16982
- * List record entries
17310
+ * Update an attribute
16983
17311
  *
16984
- * List all entries, across all lists, for which this record is the parent.
17312
+ * Updates a single attribute on a given object or list.
16985
17313
  *
16986
- * Required scopes: `record_permission:read`, `object_configuration:read`, `list_entry:read`.
17314
+ * Required scopes: `object_configuration:read-write`.
16987
17315
  */
16988
- const getV2ObjectsByObjectRecordsByRecordIdEntries = (options) => (options.client ?? client).get({
16989
- requestValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdEntriesData.parseAsync(data),
16990
- responseValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdEntriesResponse.parseAsync(data),
17316
+ const patchV2ByTargetByIdentifierAttributesByAttribute = (options) => (options.client ?? client).patch({
17317
+ requestValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeData.parseAsync(data),
17318
+ responseValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeResponse.parseAsync(data),
16991
17319
  security: [{
16992
17320
  scheme: "bearer",
16993
17321
  type: "http"
16994
17322
  }],
16995
- url: "/v2/objects/{object}/records/{record_id}/entries",
16996
- ...options
17323
+ url: "/v2/{target}/{identifier}/attributes/{attribute}",
17324
+ ...options,
17325
+ headers: {
17326
+ "Content-Type": "application/json",
17327
+ ...options.headers
17328
+ }
16997
17329
  });
16998
17330
  /**
16999
- * Search records
17000
- *
17001
- * The search records endpoint provides a convenient way to fuzzy search for records across one or more objects.
17002
- * The matching strategy employed in this endpoint follows the in-product strategy and will match names, domains, emails, phone numbers and social handles on people and companies, and labels on all other objects.
17003
- * Please note, results returned from this endpoint are eventually consistent. For results which are guaranteed to be up to date, please use the record query endpoint instead.
17331
+ * List select options
17004
17332
  *
17005
- * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
17333
+ * Lists all select options for a particular attribute on either an object or a list.
17006
17334
  *
17007
- * Required scopes: `record_permission:read`, `object_configuration:read`.
17335
+ * Required scopes: `object_configuration:read`.
17008
17336
  */
17009
- const postV2ObjectsRecordsSearch = (options) => (options.client ?? client).post({
17010
- requestValidator: async (data) => await zPostV2ObjectsRecordsSearchData.parseAsync(data),
17011
- responseValidator: async (data) => await zPostV2ObjectsRecordsSearchResponse.parseAsync(data),
17337
+ const getV2ByTargetByIdentifierAttributesByAttributeOptions = (options) => (options.client ?? client).get({
17338
+ requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeOptionsData.parseAsync(data),
17339
+ responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeOptionsResponse.parseAsync(data),
17012
17340
  security: [{
17013
17341
  scheme: "bearer",
17014
17342
  type: "http"
17015
17343
  }],
17016
- url: "/v2/objects/records/search",
17017
- ...options,
17018
- headers: {
17019
- "Content-Type": "application/json",
17020
- ...options.headers
17021
- }
17344
+ url: "/v2/{target}/{identifier}/attributes/{attribute}/options",
17345
+ ...options
17022
17346
  });
17023
17347
  /**
17024
- * List all lists
17348
+ * Create a select option
17025
17349
  *
17026
- * List all lists that your access token has access to. lists are returned in the order that they are sorted in the sidebar.
17350
+ * Adds a select option to a select attribute on an object or a list.
17027
17351
  *
17028
- * Required scopes: `list_configuration:read`.
17352
+ * Required scopes: `object_configuration:read-write`.
17029
17353
  */
17030
- const getV2Lists = (options) => (options?.client ?? client).get({
17031
- requestValidator: async (data) => await zGetV2ListsData.parseAsync(data),
17032
- responseValidator: async (data) => await zGetV2ListsResponse.parseAsync(data),
17354
+ const postV2ByTargetByIdentifierAttributesByAttributeOptions = (options) => (options.client ?? client).post({
17355
+ requestValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeOptionsData.parseAsync(data),
17356
+ responseValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeOptionsResponse.parseAsync(data),
17033
17357
  security: [{
17034
17358
  scheme: "bearer",
17035
17359
  type: "http"
17036
17360
  }],
17037
- url: "/v2/lists",
17038
- ...options
17361
+ url: "/v2/{target}/{identifier}/attributes/{attribute}/options",
17362
+ ...options,
17363
+ headers: {
17364
+ "Content-Type": "application/json",
17365
+ ...options.headers
17366
+ }
17039
17367
  });
17040
17368
  /**
17041
- * Create a list
17042
- *
17043
- * Creates a new list.
17044
- *
17045
- * Once you have your list, add attributes to it using the [Create attribute](/rest-api/endpoint-reference/attributes/create-an-attribute) API, and add records to it using the [Add records to list](/rest-api/endpoint-reference/entries/create-an-entry-add-record-to-list) API.
17046
- *
17047
- * New lists must specify which records can be added with the `parent_object` parameter which accepts either an object slug or an object ID. Permissions for the list are controlled with the `workspace_access` and `workspace_member_access` parameters.
17369
+ * Update a select option
17048
17370
  *
17049
- * Please note that new lists must have either `workspace_access` set to `"full-access"` or one or more element of `workspace_member_access` with a `"full-access"` level. It is also possible to receive a `403` billing error if your workspace is not on a plan that supports either advanced workspace or workspace member-level access for lists.
17371
+ * Updates a select option on an attribute on either an object or a list.
17050
17372
  *
17051
- * Required scopes: `list_configuration:read-write`.
17373
+ * Required scopes: `object_configuration:read-write`.
17052
17374
  */
17053
- const postV2Lists = (options) => (options.client ?? client).post({
17054
- requestValidator: async (data) => await zPostV2ListsData.parseAsync(data),
17055
- responseValidator: async (data) => await zPostV2ListsResponse.parseAsync(data),
17375
+ const patchV2ByTargetByIdentifierAttributesByAttributeOptionsByOption = (options) => (options.client ?? client).patch({
17376
+ requestValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeOptionsByOptionData.parseAsync(data),
17377
+ responseValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeOptionsByOptionResponse.parseAsync(data),
17056
17378
  security: [{
17057
17379
  scheme: "bearer",
17058
17380
  type: "http"
17059
17381
  }],
17060
- url: "/v2/lists",
17382
+ url: "/v2/{target}/{identifier}/attributes/{attribute}/options/{option}",
17061
17383
  ...options,
17062
17384
  headers: {
17063
17385
  "Content-Type": "application/json",
@@ -17065,37 +17387,37 @@ const postV2Lists = (options) => (options.client ?? client).post({
17065
17387
  }
17066
17388
  });
17067
17389
  /**
17068
- * Get a list
17390
+ * List statuses
17069
17391
  *
17070
- * Gets a single list in your workspace that your access token has access to.
17392
+ * Lists all statuses for a particular status attribute on either an object or a list.
17071
17393
  *
17072
- * Required scopes: `list_configuration:read`.
17394
+ * Required scopes: `object_configuration:read`.
17073
17395
  */
17074
- const getV2ListsByList = (options) => (options.client ?? client).get({
17075
- requestValidator: async (data) => await zGetV2ListsByListData.parseAsync(data),
17076
- responseValidator: async (data) => await zGetV2ListsByListResponse.parseAsync(data),
17396
+ const getV2ByTargetByIdentifierAttributesByAttributeStatuses = (options) => (options.client ?? client).get({
17397
+ requestValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeStatusesData.parseAsync(data),
17398
+ responseValidator: async (data) => await zGetV2ByTargetByIdentifierAttributesByAttributeStatusesResponse.parseAsync(data),
17077
17399
  security: [{
17078
17400
  scheme: "bearer",
17079
17401
  type: "http"
17080
17402
  }],
17081
- url: "/v2/lists/{list}",
17403
+ url: "/v2/{target}/{identifier}/attributes/{attribute}/statuses",
17082
17404
  ...options
17083
17405
  });
17084
17406
  /**
17085
- * Update a list
17407
+ * Create a status
17086
17408
  *
17087
- * Updates an existing list. Permissions for the list are controlled with the `workspace_access` and `workspace_member_access` parameters. Please note that lists must have either `workspace_access` set to `"full-access"` or one or more element of `workspace_member_access` with a `"full-access"` level. It is also possible to receive a `403` billing error if your workspace is not on a plan that supports either advanced workspace or workspace member level access for lists. Changing the parent object of a list is not possible through the API as it can have unintended side-effects that should be considered carefully. If you wish to carry out a parent object change you should do so through the UI.
17409
+ * Add a new status to a status attribute on either an object or a list.
17088
17410
  *
17089
- * Required scopes: `list_configuration:read-write`.
17411
+ * Required scopes: `object_configuration:read-write`.
17090
17412
  */
17091
- const patchV2ListsByList = (options) => (options.client ?? client).patch({
17092
- requestValidator: async (data) => await zPatchV2ListsByListData.parseAsync(data),
17093
- responseValidator: async (data) => await zPatchV2ListsByListResponse.parseAsync(data),
17413
+ const postV2ByTargetByIdentifierAttributesByAttributeStatuses = (options) => (options.client ?? client).post({
17414
+ requestValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeStatusesData.parseAsync(data),
17415
+ responseValidator: async (data) => await zPostV2ByTargetByIdentifierAttributesByAttributeStatusesResponse.parseAsync(data),
17094
17416
  security: [{
17095
17417
  scheme: "bearer",
17096
17418
  type: "http"
17097
17419
  }],
17098
- url: "/v2/lists/{list}",
17420
+ url: "/v2/{target}/{identifier}/attributes/{attribute}/statuses",
17099
17421
  ...options,
17100
17422
  headers: {
17101
17423
  "Content-Type": "application/json",
@@ -17103,20 +17425,20 @@ const patchV2ListsByList = (options) => (options.client ?? client).patch({
17103
17425
  }
17104
17426
  });
17105
17427
  /**
17106
- * List entries
17428
+ * Update a status
17107
17429
  *
17108
- * Lists entries in a given list, with the option to filter and sort results.
17430
+ * Update a status on an status attribute on either an object or a list.
17109
17431
  *
17110
- * Required scopes: `list_entry:read`, `list_configuration:read`.
17432
+ * Required scopes: `object_configuration:read-write`.
17111
17433
  */
17112
- const postV2ListsByListEntriesQuery = (options) => (options.client ?? client).post({
17113
- requestValidator: async (data) => await zPostV2ListsByListEntriesQueryData.parseAsync(data),
17114
- responseValidator: async (data) => await zPostV2ListsByListEntriesQueryResponse.parseAsync(data),
17434
+ const patchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatus = (options) => (options.client ?? client).patch({
17435
+ requestValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatusData.parseAsync(data),
17436
+ responseValidator: async (data) => await zPatchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatusResponse.parseAsync(data),
17115
17437
  security: [{
17116
17438
  scheme: "bearer",
17117
17439
  type: "http"
17118
17440
  }],
17119
- url: "/v2/lists/{list}/entries/query",
17441
+ url: "/v2/{target}/{identifier}/attributes/{attribute}/statuses/{status}",
17120
17442
  ...options,
17121
17443
  headers: {
17122
17444
  "Content-Type": "application/json",
@@ -17124,20 +17446,20 @@ const postV2ListsByListEntriesQuery = (options) => (options.client ?? client).po
17124
17446
  }
17125
17447
  });
17126
17448
  /**
17127
- * Create an entry (add record to list)
17449
+ * List records
17128
17450
  *
17129
- * Adds a record to a list as a new list entry. This endpoint will throw on conflicts of unique attributes. Multiple list entries are allowed for the same parent record
17451
+ * Lists people, company or other records, with the option to filter and sort results.
17130
17452
  *
17131
- * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17453
+ * Required scopes: `record_permission:read`, `object_configuration:read`.
17132
17454
  */
17133
- const postV2ListsByListEntries = (options) => (options.client ?? client).post({
17134
- requestValidator: async (data) => await zPostV2ListsByListEntriesData.parseAsync(data),
17135
- responseValidator: async (data) => await zPostV2ListsByListEntriesResponse.parseAsync(data),
17455
+ const postV2ObjectsByObjectRecordsQuery = (options) => (options.client ?? client).post({
17456
+ requestValidator: async (data) => await zPostV2ObjectsByObjectRecordsQueryData.parseAsync(data),
17457
+ responseValidator: async (data) => await zPostV2ObjectsByObjectRecordsQueryResponse.parseAsync(data),
17136
17458
  security: [{
17137
17459
  scheme: "bearer",
17138
17460
  type: "http"
17139
17461
  }],
17140
- url: "/v2/lists/{list}/entries",
17462
+ url: "/v2/objects/{object}/records/query",
17141
17463
  ...options,
17142
17464
  headers: {
17143
17465
  "Content-Type": "application/json",
@@ -17145,20 +17467,20 @@ const postV2ListsByListEntries = (options) => (options.client ?? client).post({
17145
17467
  }
17146
17468
  });
17147
17469
  /**
17148
- * Assert a list entry by parent
17470
+ * Create a record
17149
17471
  *
17150
- * Use this endpoint to create or update a list entry for a given parent record. If an entry with the specified parent record is found, that entry will be updated. If no such entry is found, a new entry will be created instead. If there are multiple entries with the same parent record, this endpoint with return the "MULTIPLE_MATCH_RESULTS" error. When writing to multi-select attributes, all values will be either created or deleted as necessary to match the list of values supplied in the request body.
17472
+ * Creates a new person, company or other record. This endpoint will throw on conflicts of unique attributes. If you would prefer to update records on conflicts, please use the [Assert record endpoint](/rest-api/endpoint-reference/records/assert-a-record) instead.
17151
17473
  *
17152
- * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17474
+ * Required scopes: `record_permission:read-write`, `object_configuration:read`.
17153
17475
  */
17154
- const putV2ListsByListEntries = (options) => (options.client ?? client).put({
17155
- requestValidator: async (data) => await zPutV2ListsByListEntriesData.parseAsync(data),
17156
- responseValidator: async (data) => await zPutV2ListsByListEntriesResponse.parseAsync(data),
17476
+ const postV2ObjectsByObjectRecords = (options) => (options.client ?? client).post({
17477
+ requestValidator: async (data) => await zPostV2ObjectsByObjectRecordsData.parseAsync(data),
17478
+ responseValidator: async (data) => await zPostV2ObjectsByObjectRecordsResponse.parseAsync(data),
17157
17479
  security: [{
17158
17480
  scheme: "bearer",
17159
17481
  type: "http"
17160
17482
  }],
17161
- url: "/v2/lists/{list}/entries",
17483
+ url: "/v2/objects/{object}/records",
17162
17484
  ...options,
17163
17485
  headers: {
17164
17486
  "Content-Type": "application/json",
@@ -17166,75 +17488,77 @@ const putV2ListsByListEntries = (options) => (options.client ?? client).put({
17166
17488
  }
17167
17489
  });
17168
17490
  /**
17169
- * Delete a list entry
17491
+ * Assert a record
17170
17492
  *
17171
- * Deletes a single list entry by its `entry_id`.
17493
+ * Use this endpoint to create or update people, companies and other records. A matching attribute is used to search for existing records. If a record is found with the same value for the matching attribute, that record will be updated. If no record with the same value for the matching attribute is found, a new record will be created instead. If you would like to avoid matching, please use the [Create record endpoint](/rest-api/endpoint-reference/records/create-a-record).
17172
17494
  *
17173
- * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17495
+ * If the matching attribute is a multiselect attribute, new values will be added and existing values will not be deleted. For any other multiselect attribute, all values will be either created or deleted as necessary to match the list of supplied values.
17496
+ *
17497
+ * Required scopes: `record_permission:read-write`, `object_configuration:read`.
17174
17498
  */
17175
- const deleteV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).delete({
17176
- requestValidator: async (data) => await zDeleteV2ListsByListEntriesByEntryIdData.parseAsync(data),
17177
- responseValidator: async (data) => await zDeleteV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17499
+ const putV2ObjectsByObjectRecords = (options) => (options.client ?? client).put({
17500
+ requestValidator: async (data) => await zPutV2ObjectsByObjectRecordsData.parseAsync(data),
17501
+ responseValidator: async (data) => await zPutV2ObjectsByObjectRecordsResponse.parseAsync(data),
17178
17502
  security: [{
17179
17503
  scheme: "bearer",
17180
17504
  type: "http"
17181
17505
  }],
17182
- url: "/v2/lists/{list}/entries/{entry_id}",
17183
- ...options
17506
+ url: "/v2/objects/{object}/records",
17507
+ ...options,
17508
+ headers: {
17509
+ "Content-Type": "application/json",
17510
+ ...options.headers
17511
+ }
17184
17512
  });
17185
17513
  /**
17186
- * Get a list entry
17514
+ * Delete a record
17187
17515
  *
17188
- * Gets a single list entry by its `entry_id`.
17516
+ * Deletes a single record (e.g. a company or person) by ID.
17189
17517
  *
17190
- * Required scopes: `list_entry:read`, `list_configuration:read`.
17518
+ * Required scopes: `object_configuration:read`, `record_permission:read-write`.
17191
17519
  */
17192
- const getV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).get({
17193
- requestValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdData.parseAsync(data),
17194
- responseValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17520
+ const deleteV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).delete({
17521
+ requestValidator: async (data) => await zDeleteV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
17522
+ responseValidator: async (data) => await zDeleteV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
17195
17523
  security: [{
17196
17524
  scheme: "bearer",
17197
17525
  type: "http"
17198
17526
  }],
17199
- url: "/v2/lists/{list}/entries/{entry_id}",
17527
+ url: "/v2/objects/{object}/records/{record_id}",
17200
17528
  ...options
17201
17529
  });
17202
17530
  /**
17203
- * Update a list entry (append multiselect values)
17531
+ * Get a record
17204
17532
  *
17205
- * Use this endpoint to update list entries by `entry_id`. If the update payload includes multiselect attributes, the values supplied will be created and prepended to the list of values that already exist (if any). Use the `PUT` endpoint to overwrite or remove multiselect attribute values.
17533
+ * Gets a single person, company or other record by its `record_id`.
17206
17534
  *
17207
- * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17535
+ * Required scopes: `record_permission:read`, `object_configuration:read`.
17208
17536
  */
17209
- const patchV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).patch({
17210
- requestValidator: async (data) => await zPatchV2ListsByListEntriesByEntryIdData.parseAsync(data),
17211
- responseValidator: async (data) => await zPatchV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17537
+ const getV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).get({
17538
+ requestValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
17539
+ responseValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
17212
17540
  security: [{
17213
17541
  scheme: "bearer",
17214
17542
  type: "http"
17215
17543
  }],
17216
- url: "/v2/lists/{list}/entries/{entry_id}",
17217
- ...options,
17218
- headers: {
17219
- "Content-Type": "application/json",
17220
- ...options.headers
17221
- }
17544
+ url: "/v2/objects/{object}/records/{record_id}",
17545
+ ...options
17222
17546
  });
17223
17547
  /**
17224
- * Update a list entry (overwrite multiselect values)
17548
+ * Update a record (append multiselect values)
17225
17549
  *
17226
- * Use this endpoint to update list entries by `entry_id`. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the `PATCH` endpoint to add multiselect attribute values without removing those value that already exist.
17550
+ * Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will be created and prepended to the list of values that already exist (if any). Use the `PUT` endpoint to overwrite or remove multiselect attribute values.
17227
17551
  *
17228
- * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17552
+ * Required scopes: `record_permission:read-write`, `object_configuration:read`.
17229
17553
  */
17230
- const putV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).put({
17231
- requestValidator: async (data) => await zPutV2ListsByListEntriesByEntryIdData.parseAsync(data),
17232
- responseValidator: async (data) => await zPutV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17554
+ const patchV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).patch({
17555
+ requestValidator: async (data) => await zPatchV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
17556
+ responseValidator: async (data) => await zPatchV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
17233
17557
  security: [{
17234
17558
  scheme: "bearer",
17235
17559
  type: "http"
17236
17560
  }],
17237
- url: "/v2/lists/{list}/entries/{entry_id}",
17561
+ url: "/v2/objects/{object}/records/{record_id}",
17238
17562
  ...options,
17239
17563
  headers: {
17240
17564
  "Content-Type": "application/json",
@@ -17242,88 +17566,79 @@ const putV2ListsByListEntriesByEntryId = (options) => (options.client ?? client)
17242
17566
  }
17243
17567
  });
17244
17568
  /**
17245
- * List attribute values for a list entry
17246
- *
17247
- * Gets all values for a given attribute on a list entry. This endpoint has the ability to return all historic values using the `show_historic` query param. Historic values are sorted from oldest to newest (by `active_from`).
17248
- *
17249
- * Required scopes: `list_entry:read`, `list_configuration:read`.
17250
- */
17251
- const getV2ListsByListEntriesByEntryIdAttributesByAttributeValues = (options) => (options.client ?? client).get({
17252
- requestValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdAttributesByAttributeValuesData.parseAsync(data),
17253
- responseValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdAttributesByAttributeValuesResponse.parseAsync(data),
17254
- security: [{
17255
- scheme: "bearer",
17256
- type: "http"
17257
- }],
17258
- url: "/v2/lists/{list}/entries/{entry_id}/attributes/{attribute}/values",
17259
- ...options
17260
- });
17261
- /**
17262
- * List workspace members
17569
+ * Update a record (overwrite multiselect values)
17263
17570
  *
17264
- * Lists all workspace members in the workspace.
17571
+ * Use this endpoint to update people, companies, and other records by `record_id`. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the `PATCH` endpoint to append multiselect values without removing those that already exist.
17265
17572
  *
17266
- * Required scopes: `user_management:read`.
17573
+ * Required scopes: `record_permission:read-write`, `object_configuration:read`.
17267
17574
  */
17268
- const getV2WorkspaceMembers = (options) => (options?.client ?? client).get({
17269
- requestValidator: async (data) => await zGetV2WorkspaceMembersData.parseAsync(data),
17270
- responseValidator: async (data) => await zGetV2WorkspaceMembersResponse.parseAsync(data),
17575
+ const putV2ObjectsByObjectRecordsByRecordId = (options) => (options.client ?? client).put({
17576
+ requestValidator: async (data) => await zPutV2ObjectsByObjectRecordsByRecordIdData.parseAsync(data),
17577
+ responseValidator: async (data) => await zPutV2ObjectsByObjectRecordsByRecordIdResponse.parseAsync(data),
17271
17578
  security: [{
17272
17579
  scheme: "bearer",
17273
17580
  type: "http"
17274
17581
  }],
17275
- url: "/v2/workspace_members",
17276
- ...options
17582
+ url: "/v2/objects/{object}/records/{record_id}",
17583
+ ...options,
17584
+ headers: {
17585
+ "Content-Type": "application/json",
17586
+ ...options.headers
17587
+ }
17277
17588
  });
17278
17589
  /**
17279
- * Get a workspace member
17590
+ * List record attribute values
17280
17591
  *
17281
- * Gets a single workspace member by ID.
17592
+ * Gets all values for a given attribute on a record. Historic values can be queried using the `show_historic` query param. Historic values cannot be queried on COMINT (Communication Intelligence) or enriched attributes and the endpoint will return a 400 error if this is attempted. Historic values are sorted from oldest to newest (by `active_from`). Some attributes are subject to billing status and will return an empty array of values if theworkspace being queried does not have the required billing flag enabled.
17282
17593
  *
17283
- * Required scopes: `user_management:read`.
17594
+ * Required scopes: `record_permission:read`, `object_configuration:read`.
17284
17595
  */
17285
- const getV2WorkspaceMembersByWorkspaceMemberId = (options) => (options.client ?? client).get({
17286
- requestValidator: async (data) => await zGetV2WorkspaceMembersByWorkspaceMemberIdData.parseAsync(data),
17287
- responseValidator: async (data) => await zGetV2WorkspaceMembersByWorkspaceMemberIdResponse.parseAsync(data),
17596
+ const getV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValues = (options) => (options.client ?? client).get({
17597
+ requestValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValuesData.parseAsync(data),
17598
+ responseValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValuesResponse.parseAsync(data),
17288
17599
  security: [{
17289
17600
  scheme: "bearer",
17290
17601
  type: "http"
17291
17602
  }],
17292
- url: "/v2/workspace_members/{workspace_member_id}",
17603
+ url: "/v2/objects/{object}/records/{record_id}/attributes/{attribute}/values",
17293
17604
  ...options
17294
17605
  });
17295
17606
  /**
17296
- * List notes
17607
+ * List record entries
17297
17608
  *
17298
- * List notes for all records or for a specific record.
17609
+ * List all entries, across all lists, for which this record is the parent.
17299
17610
  *
17300
- * Required scopes: `note:read`, `object_configuration:read`, `record_permission:read`.
17611
+ * Required scopes: `record_permission:read`, `object_configuration:read`, `list_entry:read`.
17301
17612
  */
17302
- const getV2Notes = (options) => (options?.client ?? client).get({
17303
- requestValidator: async (data) => await zGetV2NotesData.parseAsync(data),
17304
- responseValidator: async (data) => await zGetV2NotesResponse.parseAsync(data),
17613
+ const getV2ObjectsByObjectRecordsByRecordIdEntries = (options) => (options.client ?? client).get({
17614
+ requestValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdEntriesData.parseAsync(data),
17615
+ responseValidator: async (data) => await zGetV2ObjectsByObjectRecordsByRecordIdEntriesResponse.parseAsync(data),
17305
17616
  security: [{
17306
17617
  scheme: "bearer",
17307
17618
  type: "http"
17308
17619
  }],
17309
- url: "/v2/notes",
17620
+ url: "/v2/objects/{object}/records/{record_id}/entries",
17310
17621
  ...options
17311
17622
  });
17312
17623
  /**
17313
- * Create a note
17624
+ * Search records
17314
17625
  *
17315
- * Creates a new note for a given record.
17626
+ * The search records endpoint provides a convenient way to fuzzy search for records across one or more objects.
17627
+ * The matching strategy employed in this endpoint follows the in-product strategy and will match names, domains, emails, phone numbers and social handles on people and companies, and labels on all other objects.
17628
+ * Please note, results returned from this endpoint are eventually consistent. For results which are guaranteed to be up to date, please use the record query endpoint instead.
17316
17629
  *
17317
- * Required scopes: `note:read-write`, `object_configuration:read`, `record_permission:read`.
17630
+ * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
17631
+ *
17632
+ * Required scopes: `record_permission:read`, `object_configuration:read`.
17318
17633
  */
17319
- const postV2Notes = (options) => (options.client ?? client).post({
17320
- requestValidator: async (data) => await zPostV2NotesData.parseAsync(data),
17321
- responseValidator: async (data) => await zPostV2NotesResponse.parseAsync(data),
17634
+ const postV2ObjectsRecordsSearch = (options) => (options.client ?? client).post({
17635
+ requestValidator: async (data) => await zPostV2ObjectsRecordsSearchData.parseAsync(data),
17636
+ responseValidator: async (data) => await zPostV2ObjectsRecordsSearchResponse.parseAsync(data),
17322
17637
  security: [{
17323
17638
  scheme: "bearer",
17324
17639
  type: "http"
17325
17640
  }],
17326
- url: "/v2/notes",
17641
+ url: "/v2/objects/records/search",
17327
17642
  ...options,
17328
17643
  headers: {
17329
17644
  "Content-Type": "application/json",
@@ -17331,73 +17646,81 @@ const postV2Notes = (options) => (options.client ?? client).post({
17331
17646
  }
17332
17647
  });
17333
17648
  /**
17334
- * Delete a note
17649
+ * List all lists
17335
17650
  *
17336
- * Delete a single note by ID.
17651
+ * List all lists that your access token has access to. lists are returned in the order that they are sorted in the sidebar.
17337
17652
  *
17338
- * Required scopes: `note:read-write`.
17653
+ * Required scopes: `list_configuration:read`.
17339
17654
  */
17340
- const deleteV2NotesByNoteId = (options) => (options.client ?? client).delete({
17341
- requestValidator: async (data) => await zDeleteV2NotesByNoteIdData.parseAsync(data),
17342
- responseValidator: async (data) => await zDeleteV2NotesByNoteIdResponse.parseAsync(data),
17655
+ const getV2Lists = (options) => (options?.client ?? client).get({
17656
+ requestValidator: async (data) => await zGetV2ListsData.parseAsync(data),
17657
+ responseValidator: async (data) => await zGetV2ListsResponse.parseAsync(data),
17343
17658
  security: [{
17344
17659
  scheme: "bearer",
17345
17660
  type: "http"
17346
17661
  }],
17347
- url: "/v2/notes/{note_id}",
17662
+ url: "/v2/lists",
17348
17663
  ...options
17349
17664
  });
17350
17665
  /**
17351
- * Get a note
17666
+ * Create a list
17352
17667
  *
17353
- * Get a single note by ID.
17668
+ * Creates a new list.
17354
17669
  *
17355
- * Required scopes: `note:read`, `object_configuration:read`, `record_permission:read`.
17670
+ * Once you have your list, add attributes to it using the [Create attribute](/rest-api/endpoint-reference/attributes/create-an-attribute) API, and add records to it using the [Add records to list](/rest-api/endpoint-reference/entries/create-an-entry-add-record-to-list) API.
17671
+ *
17672
+ * New lists must specify which records can be added with the `parent_object` parameter which accepts either an object slug or an object ID. Permissions for the list are controlled with the `workspace_access` and `workspace_member_access` parameters.
17673
+ *
17674
+ * Please note that new lists must have either `workspace_access` set to `"full-access"` or one or more element of `workspace_member_access` with a `"full-access"` level. It is also possible to receive a `403` billing error if your workspace is not on a plan that supports either advanced workspace or workspace member-level access for lists.
17675
+ *
17676
+ * Required scopes: `list_configuration:read-write`.
17356
17677
  */
17357
- const getV2NotesByNoteId = (options) => (options.client ?? client).get({
17358
- requestValidator: async (data) => await zGetV2NotesByNoteIdData.parseAsync(data),
17359
- responseValidator: async (data) => await zGetV2NotesByNoteIdResponse.parseAsync(data),
17678
+ const postV2Lists = (options) => (options.client ?? client).post({
17679
+ requestValidator: async (data) => await zPostV2ListsData.parseAsync(data),
17680
+ responseValidator: async (data) => await zPostV2ListsResponse.parseAsync(data),
17360
17681
  security: [{
17361
17682
  scheme: "bearer",
17362
17683
  type: "http"
17363
17684
  }],
17364
- url: "/v2/notes/{note_id}",
17365
- ...options
17685
+ url: "/v2/lists",
17686
+ ...options,
17687
+ headers: {
17688
+ "Content-Type": "application/json",
17689
+ ...options.headers
17690
+ }
17366
17691
  });
17367
17692
  /**
17368
- * List tasks
17693
+ * Get a list
17369
17694
  *
17370
- * List all tasks. Results are sorted by creation date, from oldest to newest.
17695
+ * Gets a single list in your workspace that your access token has access to.
17371
17696
  *
17372
- * Required scopes: `task:read`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17697
+ * Required scopes: `list_configuration:read`.
17373
17698
  */
17374
- const getV2Tasks = (options) => (options?.client ?? client).get({
17375
- requestValidator: async (data) => await zGetV2TasksData.parseAsync(data),
17376
- responseValidator: async (data) => await zGetV2TasksResponse.parseAsync(data),
17699
+ const getV2ListsByList = (options) => (options.client ?? client).get({
17700
+ requestValidator: async (data) => await zGetV2ListsByListData.parseAsync(data),
17701
+ responseValidator: async (data) => await zGetV2ListsByListResponse.parseAsync(data),
17377
17702
  security: [{
17378
17703
  scheme: "bearer",
17379
17704
  type: "http"
17380
17705
  }],
17381
- url: "/v2/tasks",
17706
+ url: "/v2/lists/{list}",
17382
17707
  ...options
17383
17708
  });
17384
17709
  /**
17385
- * Create a task
17386
- *
17387
- * Creates a new task.
17710
+ * Update a list
17388
17711
  *
17389
- * At present, tasks can only be created from plaintext without record reference formatting.
17712
+ * Updates an existing list. Permissions for the list are controlled with the `workspace_access` and `workspace_member_access` parameters. Please note that lists must have either `workspace_access` set to `"full-access"` or one or more element of `workspace_member_access` with a `"full-access"` level. It is also possible to receive a `403` billing error if your workspace is not on a plan that supports either advanced workspace or workspace member level access for lists. Changing the parent object of a list is not possible through the API as it can have unintended side-effects that should be considered carefully. If you wish to carry out a parent object change you should do so through the UI.
17390
17713
  *
17391
- * Required scopes: `task:read-write`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17714
+ * Required scopes: `list_configuration:read-write`.
17392
17715
  */
17393
- const postV2Tasks = (options) => (options.client ?? client).post({
17394
- requestValidator: async (data) => await zPostV2TasksData.parseAsync(data),
17395
- responseValidator: async (data) => await zPostV2TasksResponse.parseAsync(data),
17716
+ const patchV2ListsByList = (options) => (options.client ?? client).patch({
17717
+ requestValidator: async (data) => await zPatchV2ListsByListData.parseAsync(data),
17718
+ responseValidator: async (data) => await zPatchV2ListsByListResponse.parseAsync(data),
17396
17719
  security: [{
17397
17720
  scheme: "bearer",
17398
17721
  type: "http"
17399
17722
  }],
17400
- url: "/v2/tasks",
17723
+ url: "/v2/lists/{list}",
17401
17724
  ...options,
17402
17725
  headers: {
17403
17726
  "Content-Type": "application/json",
@@ -17405,54 +17728,62 @@ const postV2Tasks = (options) => (options.client ?? client).post({
17405
17728
  }
17406
17729
  });
17407
17730
  /**
17408
- * Delete a task
17731
+ * List entries
17409
17732
  *
17410
- * Delete a task by ID.
17733
+ * Lists entries in a given list, with the option to filter and sort results.
17411
17734
  *
17412
- * Required scopes: `task:read-write`.
17735
+ * Required scopes: `list_entry:read`, `list_configuration:read`.
17413
17736
  */
17414
- const deleteV2TasksByTaskId = (options) => (options.client ?? client).delete({
17415
- requestValidator: async (data) => await zDeleteV2TasksByTaskIdData.parseAsync(data),
17416
- responseValidator: async (data) => await zDeleteV2TasksByTaskIdResponse.parseAsync(data),
17737
+ const postV2ListsByListEntriesQuery = (options) => (options.client ?? client).post({
17738
+ requestValidator: async (data) => await zPostV2ListsByListEntriesQueryData.parseAsync(data),
17739
+ responseValidator: async (data) => await zPostV2ListsByListEntriesQueryResponse.parseAsync(data),
17417
17740
  security: [{
17418
17741
  scheme: "bearer",
17419
17742
  type: "http"
17420
17743
  }],
17421
- url: "/v2/tasks/{task_id}",
17422
- ...options
17744
+ url: "/v2/lists/{list}/entries/query",
17745
+ ...options,
17746
+ headers: {
17747
+ "Content-Type": "application/json",
17748
+ ...options.headers
17749
+ }
17423
17750
  });
17424
17751
  /**
17425
- * Get a task
17752
+ * Create an entry (add record to list)
17426
17753
  *
17427
- * Get a single task by ID.
17754
+ * Adds a record to a list as a new list entry. This endpoint will throw on conflicts of unique attributes. Multiple list entries are allowed for the same parent record
17428
17755
  *
17429
- * Required scopes: `task:read`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17756
+ * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17430
17757
  */
17431
- const getV2TasksByTaskId = (options) => (options.client ?? client).get({
17432
- requestValidator: async (data) => await zGetV2TasksByTaskIdData.parseAsync(data),
17433
- responseValidator: async (data) => await zGetV2TasksByTaskIdResponse.parseAsync(data),
17758
+ const postV2ListsByListEntries = (options) => (options.client ?? client).post({
17759
+ requestValidator: async (data) => await zPostV2ListsByListEntriesData.parseAsync(data),
17760
+ responseValidator: async (data) => await zPostV2ListsByListEntriesResponse.parseAsync(data),
17434
17761
  security: [{
17435
17762
  scheme: "bearer",
17436
17763
  type: "http"
17437
17764
  }],
17438
- url: "/v2/tasks/{task_id}",
17439
- ...options
17765
+ url: "/v2/lists/{list}/entries",
17766
+ ...options,
17767
+ headers: {
17768
+ "Content-Type": "application/json",
17769
+ ...options.headers
17770
+ }
17440
17771
  });
17441
17772
  /**
17442
- * Update a task
17773
+ * Assert a list entry by parent
17443
17774
  *
17444
- * Updates an existing task by `task_id`. At present, only the `deadline_at`, `is_completed`, `linked_records`, and `assignees` fields can be updated.
17775
+ * Use this endpoint to create or update a list entry for a given parent record. If an entry with the specified parent record is found, that entry will be updated. If no such entry is found, a new entry will be created instead. If there are multiple entries with the same parent record, this endpoint with return the "MULTIPLE_MATCH_RESULTS" error. When writing to multi-select attributes, all values will be either created or deleted as necessary to match the list of values supplied in the request body.
17445
17776
  *
17446
- * Required scopes: `task:read-write`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17777
+ * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17447
17778
  */
17448
- const patchV2TasksByTaskId = (options) => (options.client ?? client).patch({
17449
- requestValidator: async (data) => await zPatchV2TasksByTaskIdData.parseAsync(data),
17450
- responseValidator: async (data) => await zPatchV2TasksByTaskIdResponse.parseAsync(data),
17779
+ const putV2ListsByListEntries = (options) => (options.client ?? client).put({
17780
+ requestValidator: async (data) => await zPutV2ListsByListEntriesData.parseAsync(data),
17781
+ responseValidator: async (data) => await zPutV2ListsByListEntriesResponse.parseAsync(data),
17451
17782
  security: [{
17452
17783
  scheme: "bearer",
17453
17784
  type: "http"
17454
17785
  }],
17455
- url: "/v2/tasks/{task_id}",
17786
+ url: "/v2/lists/{list}/entries",
17456
17787
  ...options,
17457
17788
  headers: {
17458
17789
  "Content-Type": "application/json",
@@ -17460,66 +17791,75 @@ const patchV2TasksByTaskId = (options) => (options.client ?? client).patch({
17460
17791
  }
17461
17792
  });
17462
17793
  /**
17463
- * List threads
17464
- *
17465
- * List threads of comments on a record or list entry.
17466
- *
17467
- * To view threads on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
17794
+ * Delete a list entry
17468
17795
  *
17469
- * To view threads on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
17796
+ * Deletes a single list entry by its `entry_id`.
17470
17797
  *
17471
- * Required scopes: `comment:read`.
17798
+ * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17472
17799
  */
17473
- const getV2Threads = (options) => (options?.client ?? client).get({
17474
- requestValidator: async (data) => await zGetV2ThreadsData.parseAsync(data),
17475
- responseValidator: async (data) => await zGetV2ThreadsResponse.parseAsync(data),
17800
+ const deleteV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).delete({
17801
+ requestValidator: async (data) => await zDeleteV2ListsByListEntriesByEntryIdData.parseAsync(data),
17802
+ responseValidator: async (data) => await zDeleteV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17476
17803
  security: [{
17477
17804
  scheme: "bearer",
17478
17805
  type: "http"
17479
17806
  }],
17480
- url: "/v2/threads",
17807
+ url: "/v2/lists/{list}/entries/{entry_id}",
17481
17808
  ...options
17482
17809
  });
17483
17810
  /**
17484
- * Get a thread
17485
- *
17486
- * Get all comments in a thread.
17487
- *
17488
- * To view threads on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
17811
+ * Get a list entry
17489
17812
  *
17490
- * To view threads on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
17813
+ * Gets a single list entry by its `entry_id`.
17491
17814
  *
17492
- * Required scopes: `comment:read`.
17815
+ * Required scopes: `list_entry:read`, `list_configuration:read`.
17493
17816
  */
17494
- const getV2ThreadsByThreadId = (options) => (options.client ?? client).get({
17495
- requestValidator: async (data) => await zGetV2ThreadsByThreadIdData.parseAsync(data),
17496
- responseValidator: async (data) => await zGetV2ThreadsByThreadIdResponse.parseAsync(data),
17817
+ const getV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).get({
17818
+ requestValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdData.parseAsync(data),
17819
+ responseValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17497
17820
  security: [{
17498
17821
  scheme: "bearer",
17499
17822
  type: "http"
17500
17823
  }],
17501
- url: "/v2/threads/{thread_id}",
17824
+ url: "/v2/lists/{list}/entries/{entry_id}",
17502
17825
  ...options
17503
17826
  });
17504
17827
  /**
17505
- * Create a comment
17828
+ * Update a list entry (append multiselect values)
17506
17829
  *
17507
- * Creates a new comment related to an existing thread, record or entry.
17830
+ * Use this endpoint to update list entries by `entry_id`. If the update payload includes multiselect attributes, the values supplied will be created and prepended to the list of values that already exist (if any). Use the `PUT` endpoint to overwrite or remove multiselect attribute values.
17508
17831
  *
17509
- * To create comments on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
17832
+ * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17833
+ */
17834
+ const patchV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).patch({
17835
+ requestValidator: async (data) => await zPatchV2ListsByListEntriesByEntryIdData.parseAsync(data),
17836
+ responseValidator: async (data) => await zPatchV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17837
+ security: [{
17838
+ scheme: "bearer",
17839
+ type: "http"
17840
+ }],
17841
+ url: "/v2/lists/{list}/entries/{entry_id}",
17842
+ ...options,
17843
+ headers: {
17844
+ "Content-Type": "application/json",
17845
+ ...options.headers
17846
+ }
17847
+ });
17848
+ /**
17849
+ * Update a list entry (overwrite multiselect values)
17510
17850
  *
17511
- * To create comments on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
17851
+ * Use this endpoint to update list entries by `entry_id`. If the update payload includes multiselect attributes, the values supplied will overwrite/remove the list of values that already exist (if any). Use the `PATCH` endpoint to add multiselect attribute values without removing those value that already exist.
17512
17852
  *
17513
- * Required scopes: `comment:read-write`.
17514
- */
17515
- const postV2Comments = (options) => (options.client ?? client).post({
17516
- requestValidator: async (data) => await zPostV2CommentsData.parseAsync(data),
17517
- responseValidator: async (data) => await zPostV2CommentsResponse.parseAsync(data),
17853
+ * Required scopes: `list_entry:read-write`, `list_configuration:read`.
17854
+ */
17855
+ const putV2ListsByListEntriesByEntryId = (options) => (options.client ?? client).put({
17856
+ requestValidator: async (data) => await zPutV2ListsByListEntriesByEntryIdData.parseAsync(data),
17857
+ responseValidator: async (data) => await zPutV2ListsByListEntriesByEntryIdResponse.parseAsync(data),
17518
17858
  security: [{
17519
17859
  scheme: "bearer",
17520
17860
  type: "http"
17521
17861
  }],
17522
- url: "/v2/comments",
17862
+ url: "/v2/lists/{list}/entries/{entry_id}",
17523
17863
  ...options,
17524
17864
  headers: {
17525
17865
  "Content-Type": "application/json",
@@ -17527,235 +17867,217 @@ const postV2Comments = (options) => (options.client ?? client).post({
17527
17867
  }
17528
17868
  });
17529
17869
  /**
17530
- * Delete a comment
17870
+ * List attribute values for a list entry
17531
17871
  *
17532
- * Deletes a comment by ID. If deleting a comment at the head of a thread, all messages in the thread are also deleted.
17872
+ * Gets all values for a given attribute on a list entry. This endpoint has the ability to return all historic values using the `show_historic` query param. Historic values are sorted from oldest to newest (by `active_from`).
17533
17873
  *
17534
- * Required scopes: `comment:read-write`.
17874
+ * Required scopes: `list_entry:read`, `list_configuration:read`.
17535
17875
  */
17536
- const deleteV2CommentsByCommentId = (options) => (options.client ?? client).delete({
17537
- requestValidator: async (data) => await zDeleteV2CommentsByCommentIdData.parseAsync(data),
17538
- responseValidator: async (data) => await zDeleteV2CommentsByCommentIdResponse.parseAsync(data),
17876
+ const getV2ListsByListEntriesByEntryIdAttributesByAttributeValues = (options) => (options.client ?? client).get({
17877
+ requestValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdAttributesByAttributeValuesData.parseAsync(data),
17878
+ responseValidator: async (data) => await zGetV2ListsByListEntriesByEntryIdAttributesByAttributeValuesResponse.parseAsync(data),
17539
17879
  security: [{
17540
17880
  scheme: "bearer",
17541
17881
  type: "http"
17542
17882
  }],
17543
- url: "/v2/comments/{comment_id}",
17883
+ url: "/v2/lists/{list}/entries/{entry_id}/attributes/{attribute}/values",
17544
17884
  ...options
17545
17885
  });
17546
17886
  /**
17547
- * Get a comment
17548
- *
17549
- * Get a single comment by ID.
17550
- *
17551
- * To view comments on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
17887
+ * List workspace members
17552
17888
  *
17553
- * To view comments on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
17889
+ * Lists all workspace members in the workspace.
17554
17890
  *
17555
- * Required scopes: `comment:read`.
17891
+ * Required scopes: `user_management:read`.
17556
17892
  */
17557
- const getV2CommentsByCommentId = (options) => (options.client ?? client).get({
17558
- requestValidator: async (data) => await zGetV2CommentsByCommentIdData.parseAsync(data),
17559
- responseValidator: async (data) => await zGetV2CommentsByCommentIdResponse.parseAsync(data),
17893
+ const getV2WorkspaceMembers = (options) => (options?.client ?? client).get({
17894
+ requestValidator: async (data) => await zGetV2WorkspaceMembersData.parseAsync(data),
17895
+ responseValidator: async (data) => await zGetV2WorkspaceMembersResponse.parseAsync(data),
17560
17896
  security: [{
17561
17897
  scheme: "bearer",
17562
17898
  type: "http"
17563
17899
  }],
17564
- url: "/v2/comments/{comment_id}",
17900
+ url: "/v2/workspace_members",
17565
17901
  ...options
17566
17902
  });
17567
17903
  /**
17568
- * List meetings
17569
- *
17570
- * Lists all meetings in the workspace using a deterministic sort order.
17904
+ * Get a workspace member
17571
17905
  *
17572
- * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
17906
+ * Gets a single workspace member by ID.
17573
17907
  *
17574
- * Required scopes: `meeting:read`, `record_permission:read`.
17908
+ * Required scopes: `user_management:read`.
17575
17909
  */
17576
- const getV2Meetings = (options) => (options?.client ?? client).get({
17577
- requestValidator: async (data) => await zGetV2MeetingsData.parseAsync(data),
17578
- responseValidator: async (data) => await zGetV2MeetingsResponse.parseAsync(data),
17910
+ const getV2WorkspaceMembersByWorkspaceMemberId = (options) => (options.client ?? client).get({
17911
+ requestValidator: async (data) => await zGetV2WorkspaceMembersByWorkspaceMemberIdData.parseAsync(data),
17912
+ responseValidator: async (data) => await zGetV2WorkspaceMembersByWorkspaceMemberIdResponse.parseAsync(data),
17579
17913
  security: [{
17580
17914
  scheme: "bearer",
17581
17915
  type: "http"
17582
17916
  }],
17583
- url: "/v2/meetings",
17917
+ url: "/v2/workspace_members/{workspace_member_id}",
17584
17918
  ...options
17585
17919
  });
17586
17920
  /**
17587
- * Find or create a meeting
17588
- *
17589
- * Finds an existing meeting or creates a new one if it doesn't yet exist. [Please see here](/rest-api/guides/syncing-meetings) for a full guide on syncing meetings to Attio.
17921
+ * List notes
17590
17922
  *
17591
- * This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
17923
+ * List notes for all records or for a specific record.
17592
17924
  *
17593
- * Required scopes: `meeting:read-write`, `record_permission:read`.
17925
+ * Required scopes: `note:read`, `object_configuration:read`, `record_permission:read`.
17594
17926
  */
17595
- const postV2Meetings = (options) => (options.client ?? client).post({
17596
- requestValidator: async (data) => await zPostV2MeetingsData.parseAsync(data),
17597
- responseValidator: async (data) => await zPostV2MeetingsResponse.parseAsync(data),
17927
+ const getV2Notes = (options) => (options?.client ?? client).get({
17928
+ requestValidator: async (data) => await zGetV2NotesData.parseAsync(data),
17929
+ responseValidator: async (data) => await zGetV2NotesResponse.parseAsync(data),
17598
17930
  security: [{
17599
17931
  scheme: "bearer",
17600
17932
  type: "http"
17601
17933
  }],
17602
- url: "/v2/meetings",
17603
- ...options,
17604
- headers: {
17605
- "Content-Type": "application/json",
17606
- ...options.headers
17607
- }
17934
+ url: "/v2/notes",
17935
+ ...options
17608
17936
  });
17609
17937
  /**
17610
- * Get a meeting
17611
- *
17612
- * Get a single meeting by ID.
17938
+ * Create a note
17613
17939
  *
17614
- * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
17940
+ * Creates a new note for a given record.
17615
17941
  *
17616
- * Required scopes: `meeting:read`, `record_permission:read`.
17942
+ * Required scopes: `note:read-write`, `object_configuration:read`, `record_permission:read`.
17617
17943
  */
17618
- const getV2MeetingsByMeetingId = (options) => (options.client ?? client).get({
17619
- requestValidator: async (data) => await zGetV2MeetingsByMeetingIdData.parseAsync(data),
17620
- responseValidator: async (data) => await zGetV2MeetingsByMeetingIdResponse.parseAsync(data),
17944
+ const postV2Notes = (options) => (options.client ?? client).post({
17945
+ requestValidator: async (data) => await zPostV2NotesData.parseAsync(data),
17946
+ responseValidator: async (data) => await zPostV2NotesResponse.parseAsync(data),
17621
17947
  security: [{
17622
17948
  scheme: "bearer",
17623
17949
  type: "http"
17624
17950
  }],
17625
- url: "/v2/meetings/{meeting_id}",
17626
- ...options
17951
+ url: "/v2/notes",
17952
+ ...options,
17953
+ headers: {
17954
+ "Content-Type": "application/json",
17955
+ ...options.headers
17956
+ }
17627
17957
  });
17628
17958
  /**
17629
- * List call recordings
17630
- *
17631
- * List all call recordings for a meeting.
17959
+ * Delete a note
17632
17960
  *
17633
- * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
17961
+ * Delete a single note by ID.
17634
17962
  *
17635
- * Required scopes: `meeting:read`, `call_recording:read`.
17963
+ * Required scopes: `note:read-write`.
17636
17964
  */
17637
- const getV2MeetingsByMeetingIdCallRecordings = (options) => (options.client ?? client).get({
17638
- requestValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsData.parseAsync(data),
17639
- responseValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsResponse.parseAsync(data),
17965
+ const deleteV2NotesByNoteId = (options) => (options.client ?? client).delete({
17966
+ requestValidator: async (data) => await zDeleteV2NotesByNoteIdData.parseAsync(data),
17967
+ responseValidator: async (data) => await zDeleteV2NotesByNoteIdResponse.parseAsync(data),
17640
17968
  security: [{
17641
17969
  scheme: "bearer",
17642
17970
  type: "http"
17643
17971
  }],
17644
- url: "/v2/meetings/{meeting_id}/call_recordings",
17972
+ url: "/v2/notes/{note_id}",
17645
17973
  ...options
17646
17974
  });
17647
17975
  /**
17648
- * Create call recording
17649
- *
17650
- * Create a call recording for a meeting. This endpoint is rate limited to 1 request per second.
17976
+ * Get a note
17651
17977
  *
17652
- * This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
17978
+ * Get a single note by ID.
17653
17979
  *
17654
- * Required scopes: `meeting:read`, `call_recording:read-write`.
17980
+ * Required scopes: `note:read`, `object_configuration:read`, `record_permission:read`.
17655
17981
  */
17656
- const postV2MeetingsByMeetingIdCallRecordings = (options) => (options.client ?? client).post({
17657
- requestValidator: async (data) => await zPostV2MeetingsByMeetingIdCallRecordingsData.parseAsync(data),
17658
- responseValidator: async (data) => await zPostV2MeetingsByMeetingIdCallRecordingsResponse.parseAsync(data),
17982
+ const getV2NotesByNoteId = (options) => (options.client ?? client).get({
17983
+ requestValidator: async (data) => await zGetV2NotesByNoteIdData.parseAsync(data),
17984
+ responseValidator: async (data) => await zGetV2NotesByNoteIdResponse.parseAsync(data),
17659
17985
  security: [{
17660
17986
  scheme: "bearer",
17661
17987
  type: "http"
17662
17988
  }],
17663
- url: "/v2/meetings/{meeting_id}/call_recordings",
17664
- ...options,
17665
- headers: {
17666
- "Content-Type": "application/json",
17667
- ...options.headers
17668
- }
17989
+ url: "/v2/notes/{note_id}",
17990
+ ...options
17669
17991
  });
17670
17992
  /**
17671
- * Delete call recording
17672
- *
17673
- * Deletes the specified call recording. This will remove the call recording and all associated data.
17993
+ * List tasks
17674
17994
  *
17675
- * This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
17995
+ * List all tasks. Results are sorted by creation date, from oldest to newest.
17676
17996
  *
17677
- * Required scopes: `meeting:read`, `call_recording:read-write`.
17997
+ * Required scopes: `task:read`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17678
17998
  */
17679
- const deleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingId = (options) => (options.client ?? client).delete({
17680
- requestValidator: async (data) => await zDeleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdData.parseAsync(data),
17681
- responseValidator: async (data) => await zDeleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdResponse.parseAsync(data),
17999
+ const getV2Tasks = (options) => (options?.client ?? client).get({
18000
+ requestValidator: async (data) => await zGetV2TasksData.parseAsync(data),
18001
+ responseValidator: async (data) => await zGetV2TasksResponse.parseAsync(data),
17682
18002
  security: [{
17683
18003
  scheme: "bearer",
17684
18004
  type: "http"
17685
18005
  }],
17686
- url: "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}",
18006
+ url: "/v2/tasks",
17687
18007
  ...options
17688
18008
  });
17689
18009
  /**
17690
- * Get call recording
18010
+ * Create a task
17691
18011
  *
17692
- * Get a single call recording by ID.
18012
+ * Creates a new task.
17693
18013
  *
17694
- * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18014
+ * At present, tasks can only be created from plaintext without record reference formatting.
17695
18015
  *
17696
- * Required scopes: `meeting:read`, `call_recording:read`.
18016
+ * Required scopes: `task:read-write`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17697
18017
  */
17698
- const getV2MeetingsByMeetingIdCallRecordingsByCallRecordingId = (options) => (options.client ?? client).get({
17699
- requestValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdData.parseAsync(data),
17700
- responseValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdResponse.parseAsync(data),
18018
+ const postV2Tasks = (options) => (options.client ?? client).post({
18019
+ requestValidator: async (data) => await zPostV2TasksData.parseAsync(data),
18020
+ responseValidator: async (data) => await zPostV2TasksResponse.parseAsync(data),
17701
18021
  security: [{
17702
18022
  scheme: "bearer",
17703
18023
  type: "http"
17704
18024
  }],
17705
- url: "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}",
17706
- ...options
18025
+ url: "/v2/tasks",
18026
+ ...options,
18027
+ headers: {
18028
+ "Content-Type": "application/json",
18029
+ ...options.headers
18030
+ }
17707
18031
  });
17708
18032
  /**
17709
- * Get call transcript
17710
- *
17711
- * Get the transcript for a call recording.
18033
+ * Delete a task
17712
18034
  *
17713
- * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18035
+ * Delete a task by ID.
17714
18036
  *
17715
- * Required scopes: `meeting:read`, `call_recording:read`.
18037
+ * Required scopes: `task:read-write`.
17716
18038
  */
17717
- const getV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscript = (options) => (options.client ?? client).get({
17718
- requestValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscriptData.parseAsync(data),
17719
- responseValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscriptResponse.parseAsync(data),
18039
+ const deleteV2TasksByTaskId = (options) => (options.client ?? client).delete({
18040
+ requestValidator: async (data) => await zDeleteV2TasksByTaskIdData.parseAsync(data),
18041
+ responseValidator: async (data) => await zDeleteV2TasksByTaskIdResponse.parseAsync(data),
17720
18042
  security: [{
17721
18043
  scheme: "bearer",
17722
18044
  type: "http"
17723
18045
  }],
17724
- url: "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}/transcript",
18046
+ url: "/v2/tasks/{task_id}",
17725
18047
  ...options
17726
18048
  });
17727
18049
  /**
17728
- * List webhooks
18050
+ * Get a task
17729
18051
  *
17730
- * Get all of the webhooks in your workspace.
18052
+ * Get a single task by ID.
17731
18053
  *
17732
- * Required scopes: `webhook:read`.
18054
+ * Required scopes: `task:read`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17733
18055
  */
17734
- const getV2Webhooks = (options) => (options?.client ?? client).get({
17735
- requestValidator: async (data) => await zGetV2WebhooksData.parseAsync(data),
17736
- responseValidator: async (data) => await zGetV2WebhooksResponse.parseAsync(data),
18056
+ const getV2TasksByTaskId = (options) => (options.client ?? client).get({
18057
+ requestValidator: async (data) => await zGetV2TasksByTaskIdData.parseAsync(data),
18058
+ responseValidator: async (data) => await zGetV2TasksByTaskIdResponse.parseAsync(data),
17737
18059
  security: [{
17738
18060
  scheme: "bearer",
17739
18061
  type: "http"
17740
18062
  }],
17741
- url: "/v2/webhooks",
18063
+ url: "/v2/tasks/{task_id}",
17742
18064
  ...options
17743
18065
  });
17744
18066
  /**
17745
- * Create a webhook
18067
+ * Update a task
17746
18068
  *
17747
- * Create a webhook and associated subscriptions.
18069
+ * Updates an existing task by `task_id`. At present, only the `deadline_at`, `is_completed`, `linked_records`, and `assignees` fields can be updated.
17748
18070
  *
17749
- * Required scopes: `webhook:read-write`.
18071
+ * Required scopes: `task:read-write`, `object_configuration:read`, `record_permission:read`, `user_management:read`.
17750
18072
  */
17751
- const postV2Webhooks = (options) => (options.client ?? client).post({
17752
- requestValidator: async (data) => await zPostV2WebhooksData.parseAsync(data),
17753
- responseValidator: async (data) => await zPostV2WebhooksResponse.parseAsync(data),
18073
+ const patchV2TasksByTaskId = (options) => (options.client ?? client).patch({
18074
+ requestValidator: async (data) => await zPatchV2TasksByTaskIdData.parseAsync(data),
18075
+ responseValidator: async (data) => await zPatchV2TasksByTaskIdResponse.parseAsync(data),
17754
18076
  security: [{
17755
18077
  scheme: "bearer",
17756
18078
  type: "http"
17757
18079
  }],
17758
- url: "/v2/webhooks",
18080
+ url: "/v2/tasks/{task_id}",
17759
18081
  ...options,
17760
18082
  headers: {
17761
18083
  "Content-Type": "application/json",
@@ -17763,54 +18085,66 @@ const postV2Webhooks = (options) => (options.client ?? client).post({
17763
18085
  }
17764
18086
  });
17765
18087
  /**
17766
- * Delete a webhook
18088
+ * List threads
17767
18089
  *
17768
- * Delete a webhook by ID.
18090
+ * List threads of comments on a record or list entry.
17769
18091
  *
17770
- * Required scopes: `webhook:read-write`.
18092
+ * To view threads on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
18093
+ *
18094
+ * To view threads on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
18095
+ *
18096
+ * Required scopes: `comment:read`.
17771
18097
  */
17772
- const deleteV2WebhooksByWebhookId = (options) => (options.client ?? client).delete({
17773
- requestValidator: async (data) => await zDeleteV2WebhooksByWebhookIdData.parseAsync(data),
17774
- responseValidator: async (data) => await zDeleteV2WebhooksByWebhookIdResponse.parseAsync(data),
18098
+ const getV2Threads = (options) => (options?.client ?? client).get({
18099
+ requestValidator: async (data) => await zGetV2ThreadsData.parseAsync(data),
18100
+ responseValidator: async (data) => await zGetV2ThreadsResponse.parseAsync(data),
17775
18101
  security: [{
17776
18102
  scheme: "bearer",
17777
18103
  type: "http"
17778
18104
  }],
17779
- url: "/v2/webhooks/{webhook_id}",
18105
+ url: "/v2/threads",
17780
18106
  ...options
17781
18107
  });
17782
18108
  /**
17783
- * Get a webhook
18109
+ * Get a thread
17784
18110
  *
17785
- * Get a single webhook.
18111
+ * Get all comments in a thread.
17786
18112
  *
17787
- * Required scopes: `webhook:read`.
18113
+ * To view threads on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
18114
+ *
18115
+ * To view threads on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
18116
+ *
18117
+ * Required scopes: `comment:read`.
17788
18118
  */
17789
- const getV2WebhooksByWebhookId = (options) => (options.client ?? client).get({
17790
- requestValidator: async (data) => await zGetV2WebhooksByWebhookIdData.parseAsync(data),
17791
- responseValidator: async (data) => await zGetV2WebhooksByWebhookIdResponse.parseAsync(data),
18119
+ const getV2ThreadsByThreadId = (options) => (options.client ?? client).get({
18120
+ requestValidator: async (data) => await zGetV2ThreadsByThreadIdData.parseAsync(data),
18121
+ responseValidator: async (data) => await zGetV2ThreadsByThreadIdResponse.parseAsync(data),
17792
18122
  security: [{
17793
18123
  scheme: "bearer",
17794
18124
  type: "http"
17795
18125
  }],
17796
- url: "/v2/webhooks/{webhook_id}",
18126
+ url: "/v2/threads/{thread_id}",
17797
18127
  ...options
17798
18128
  });
17799
18129
  /**
17800
- * Update a webhook
18130
+ * Create a comment
17801
18131
  *
17802
- * Update a webhook and associated subscriptions.
18132
+ * Creates a new comment related to an existing thread, record or entry.
17803
18133
  *
17804
- * Required scopes: `webhook:read-write`.
18134
+ * To create comments on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
18135
+ *
18136
+ * To create comments on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
18137
+ *
18138
+ * Required scopes: `comment:read-write`.
17805
18139
  */
17806
- const patchV2WebhooksByWebhookId = (options) => (options.client ?? client).patch({
17807
- requestValidator: async (data) => await zPatchV2WebhooksByWebhookIdData.parseAsync(data),
17808
- responseValidator: async (data) => await zPatchV2WebhooksByWebhookIdResponse.parseAsync(data),
18140
+ const postV2Comments = (options) => (options.client ?? client).post({
18141
+ requestValidator: async (data) => await zPostV2CommentsData.parseAsync(data),
18142
+ responseValidator: async (data) => await zPostV2CommentsResponse.parseAsync(data),
17809
18143
  security: [{
17810
18144
  scheme: "bearer",
17811
18145
  type: "http"
17812
18146
  }],
17813
- url: "/v2/webhooks/{webhook_id}",
18147
+ url: "/v2/comments",
17814
18148
  ...options,
17815
18149
  headers: {
17816
18150
  "Content-Type": "application/json",
@@ -17818,515 +18152,311 @@ const patchV2WebhooksByWebhookId = (options) => (options.client ?? client).patch
17818
18152
  }
17819
18153
  });
17820
18154
  /**
17821
- * Identify
18155
+ * Delete a comment
17822
18156
  *
17823
- * Identify the current access token, the workspace it is linked to, and any permissions it has.
17824
- */
17825
- const getV2Self = (options) => (options?.client ?? client).get({
17826
- requestValidator: async (data) => await zGetV2SelfData.parseAsync(data),
17827
- responseValidator: async (data) => await zGetV2SelfResponse.parseAsync(data),
17828
- security: [{
17829
- scheme: "bearer",
17830
- type: "http"
17831
- }],
17832
- url: "/v2/self",
17833
- ...options
17834
- });
17835
-
17836
- //#endregion
17837
- //#region src/attio/batch.ts
17838
- /**
17839
- * Returns an empty results array when called with no items.
18157
+ * Deletes a comment by ID. If deleting a comment at the head of a thread, all messages in the thread are also deleted.
18158
+ *
18159
+ * Required scopes: `comment:read-write`.
17840
18160
  */
17841
- const runBatch = async (items, options = {}) => {
17842
- if (items.length === 0) return [];
17843
- const concurrency = Math.max(1, options.concurrency ?? 4);
17844
- const results = [];
17845
- let index = 0;
17846
- let active = 0;
17847
- let stopped = false;
17848
- const abortController = options.stopOnError ? new AbortController() : void 0;
17849
- const isCancelled = () => abortController?.signal.aborted ?? stopped;
17850
- return new Promise((resolve, reject) => {
17851
- const launchNext = () => {
17852
- if (isCancelled()) return;
17853
- if (index >= items.length && active === 0) {
17854
- resolve(results);
17855
- return;
17856
- }
17857
- while (active < concurrency && index < items.length) {
17858
- const currentIndex = index;
17859
- const item = items[currentIndex];
17860
- index += 1;
17861
- active += 1;
17862
- item.run(abortController ? { signal: abortController.signal } : void 0).then((value) => {
17863
- if (isCancelled()) return;
17864
- results[currentIndex] = {
17865
- status: "fulfilled",
17866
- value,
17867
- label: item.label
17868
- };
17869
- }).catch((reason) => {
17870
- if (options.stopOnError) {
17871
- if (!stopped) {
17872
- stopped = true;
17873
- if (abortController && !abortController.signal.aborted) abortController.abort();
17874
- reject(reason);
17875
- }
17876
- return;
17877
- }
17878
- if (isCancelled()) return;
17879
- results[currentIndex] = {
17880
- status: "rejected",
17881
- reason,
17882
- label: item.label
17883
- };
17884
- }).finally(() => {
17885
- active -= 1;
17886
- if (isCancelled()) return;
17887
- launchNext();
17888
- });
17889
- }
17890
- };
17891
- launchNext();
17892
- });
17893
- };
17894
-
17895
- //#endregion
17896
- //#region src/attio/cache.ts
17897
- var TtlCache = class {
17898
- ttlMs;
17899
- maxEntries;
17900
- store = /* @__PURE__ */ new Map();
17901
- constructor(options) {
17902
- this.ttlMs = options.ttlMs;
17903
- this.maxEntries = options.maxEntries;
17904
- }
17905
- get(key) {
17906
- const entry = this.store.get(key);
17907
- if (!entry) return;
17908
- if (Date.now() >= entry.expiresAt) {
17909
- this.store.delete(key);
17910
- return;
17911
- }
17912
- return entry.value;
17913
- }
17914
- set(key, value) {
17915
- if (this.maxEntries && this.store.size >= this.maxEntries && !this.store.has(key)) {
17916
- const oldestKey = this.store.keys().next().value;
17917
- if (oldestKey !== void 0) this.store.delete(oldestKey);
17918
- }
17919
- this.store.set(key, {
17920
- value,
17921
- expiresAt: Date.now() + this.ttlMs
17922
- });
17923
- }
17924
- delete(key) {
17925
- this.store.delete(key);
17926
- }
17927
- clear() {
17928
- this.store.clear();
17929
- }
17930
- };
17931
- const createTtlCache = (options) => new TtlCache(options);
17932
- const clientCache = /* @__PURE__ */ new Map();
17933
- const getCachedClient = (key) => {
17934
- return clientCache.get(key);
17935
- };
17936
- const setCachedClient = (key, client) => {
17937
- clientCache.set(key, client);
17938
- };
17939
- const clearClientCache = () => {
17940
- clientCache.clear();
17941
- };
17942
- const hashToken = (value) => {
17943
- let hash = 5381;
17944
- for (let i = 0; i < value.length; i += 1) hash = hash * 33 ^ value.charCodeAt(i);
17945
- return (hash >>> 0).toString(36);
17946
- };
17947
-
17948
- //#endregion
17949
- //#region src/attio/config.ts
17950
- const DEFAULT_BASE_URL = "https://api.attio.com";
17951
- const getEnvValue = (key) => {
17952
- if (typeof process === "undefined") return void 0;
17953
- return process.env?.[key];
17954
- };
17955
- const normalizeBaseUrl = (baseUrl) => {
17956
- return baseUrl.replace(/\/+$/, "");
17957
- };
17958
- const resolveBaseUrl = (config) => {
17959
- return normalizeBaseUrl(config?.baseUrl ?? getEnvValue("ATTIO_BASE_URL") ?? DEFAULT_BASE_URL);
17960
- };
17961
- const resolveAuthToken = (config) => {
17962
- return config?.apiKey ?? config?.accessToken ?? config?.authToken ?? getEnvValue("ATTIO_API_KEY") ?? getEnvValue("ATTIO_ACCESS_TOKEN");
17963
- };
17964
- const validateAuthToken = (token) => {
17965
- if (!token || typeof token !== "string") throw new Error("Missing Attio API key. Set ATTIO_API_KEY or pass apiKey.");
17966
- if (/\s/.test(token)) throw new Error("Invalid Attio API key: contains whitespace.");
17967
- if (token.length < 10) throw new Error("Invalid Attio API key: too short.");
17968
- return token;
17969
- };
17970
- const resolveResponseStyle = (config) => config?.responseStyle ?? "fields";
17971
- const resolveThrowOnError = (config) => config?.throwOnError ?? true;
17972
-
17973
- //#endregion
17974
- //#region src/attio/retry.ts
17975
- const DEFAULT_RETRY_CONFIG = {
17976
- maxRetries: 3,
17977
- initialDelayMs: 500,
17978
- maxDelayMs: 5e3,
17979
- retryableStatusCodes: [
17980
- 408,
17981
- 429,
17982
- 500,
17983
- 502,
17984
- 503,
17985
- 504
17986
- ],
17987
- respectRetryAfter: true
17988
- };
17989
- const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
17990
- const calculateRetryDelay = (attempt, config, retryAfterMs) => {
17991
- if (config.respectRetryAfter && retryAfterMs && retryAfterMs > 0) return Math.min(retryAfterMs, config.maxDelayMs);
17992
- const base = config.initialDelayMs * 2 ** attempt;
17993
- const jitter = .75 + Math.random() * .5;
17994
- return Math.min(base * jitter, config.maxDelayMs);
17995
- };
17996
- const isRetryableStatus = (status, config) => {
17997
- if (status === void 0) return true;
17998
- return config.retryableStatusCodes.includes(status);
17999
- };
18000
- const isRetryableError = (error, config) => {
18001
- const typed = error;
18002
- if (typed?.isNetworkError) return true;
18003
- return isRetryableStatus(typed?.status, config);
18004
- };
18005
- const getRetryAfterMs = (error) => {
18006
- const typed = error;
18007
- if (typed?.retryAfterMs) return typed.retryAfterMs;
18008
- };
18009
- const callWithRetry = async (fn, config) => {
18010
- const retryConfig = {
18011
- ...DEFAULT_RETRY_CONFIG,
18012
- ...config
18013
- };
18014
- let attempt = 0;
18015
- while (attempt <= retryConfig.maxRetries) try {
18016
- return await fn();
18017
- } catch (error) {
18018
- if (!isRetryableError(error, retryConfig) || attempt >= retryConfig.maxRetries) throw error;
18019
- await sleep(calculateRetryDelay(attempt, retryConfig, getRetryAfterMs(error)));
18020
- attempt += 1;
18021
- }
18022
- throw new Error("Retry attempts exhausted.");
18023
- };
18024
-
18025
- //#endregion
18026
- //#region src/attio/error-enhancer.ts
18027
- const knownFieldValues = /* @__PURE__ */ new Map();
18028
- const getKnownFieldValues = (field) => knownFieldValues.get(field);
18029
- const updateKnownFieldValues = (field, values) => {
18030
- const unique = Array.from(new Set(values.map((value) => value.trim()))).filter(Boolean);
18031
- if (unique.length > 0) knownFieldValues.set(field, unique);
18032
- else knownFieldValues.delete(field);
18033
- };
18034
- const extractMismatchContext = (error) => {
18035
- const data = error.data;
18036
- const message = error.message;
18037
- const path = (Array.isArray(data?.path) ? data?.path[0] : data?.path) ?? data?.field ?? data?.attribute ?? void 0;
18038
- if (typeof message !== "string" || typeof path !== "string") return;
18039
- const patterns = [
18040
- /constraint:\s*([^,]+)/i,
18041
- /option name\s+'([^']+)'/i,
18042
- /option name\s+"([^"]+)"/i
18043
- ];
18044
- let value;
18045
- for (const pattern of patterns) {
18046
- const match = message.match(pattern);
18047
- if (match?.[1]) {
18048
- value = match[1].trim();
18049
- break;
18050
- }
18051
- }
18052
- return {
18053
- field: path,
18054
- value
18055
- };
18056
- };
18057
- const levenshtein = (a, b) => {
18058
- const matrix = [];
18059
- const aLen = a.length;
18060
- const bLen = b.length;
18061
- for (let i = 0; i <= bLen; i += 1) matrix[i] = [i];
18062
- for (let j = 0; j <= aLen; j += 1) matrix[0][j] = j;
18063
- for (let i = 1; i <= bLen; i += 1) for (let j = 1; j <= aLen; j += 1) if (b.charAt(i - 1) === a.charAt(j - 1)) matrix[i][j] = matrix[i - 1][j - 1];
18064
- else matrix[i][j] = Math.min(matrix[i - 1][j - 1] + 1, matrix[i][j - 1] + 1, matrix[i - 1][j] + 1);
18065
- return matrix[bLen][aLen];
18066
- };
18067
- const scoreCandidates = (value, candidates) => {
18068
- const normalized = value.toLowerCase();
18069
- return candidates.map((candidate) => ({
18070
- candidate,
18071
- score: levenshtein(normalized, candidate.toLowerCase())
18072
- })).sort((a, b) => a.score - b.score).map((entry) => entry.candidate);
18073
- };
18074
- const enhanceAttioError = (error) => {
18075
- if (!error?.isApiError) return error;
18076
- const context = extractMismatchContext(error);
18077
- if (!context?.field || !context?.value) return error;
18078
- const candidates = knownFieldValues.get(context.field);
18079
- if (!candidates?.length) return error;
18080
- const matches = scoreCandidates(context.value, candidates).slice(0, 3);
18081
- error.suggestions = {
18082
- field: context.field,
18083
- attempted: context.value,
18084
- bestMatch: matches[0],
18085
- matches
18086
- };
18087
- return error;
18088
- };
18089
-
18090
- //#endregion
18091
- //#region src/attio/errors.ts
18092
- var AttioError = class extends Error {
18093
- status;
18094
- code;
18095
- type;
18096
- requestId;
18097
- data;
18098
- response;
18099
- request;
18100
- retryAfterMs;
18101
- isNetworkError;
18102
- isApiError;
18103
- suggestions;
18104
- constructor(message, details = {}) {
18105
- super(message);
18106
- this.name = "AttioError";
18107
- this.status = details.status;
18108
- this.code = details.code;
18109
- this.type = details.type;
18110
- this.data = details.data;
18111
- }
18112
- };
18113
- var AttioApiError = class extends AttioError {
18114
- constructor(message, details = {}) {
18115
- super(message, details);
18116
- this.name = "AttioApiError";
18117
- this.isApiError = true;
18118
- }
18119
- };
18120
- var AttioNetworkError = class extends AttioError {
18121
- constructor(message, details = {}) {
18122
- super(message, details);
18123
- this.name = "AttioNetworkError";
18124
- this.isNetworkError = true;
18161
+ const deleteV2CommentsByCommentId = (options) => (options.client ?? client).delete({
18162
+ requestValidator: async (data) => await zDeleteV2CommentsByCommentIdData.parseAsync(data),
18163
+ responseValidator: async (data) => await zDeleteV2CommentsByCommentIdResponse.parseAsync(data),
18164
+ security: [{
18165
+ scheme: "bearer",
18166
+ type: "http"
18167
+ }],
18168
+ url: "/v2/comments/{comment_id}",
18169
+ ...options
18170
+ });
18171
+ /**
18172
+ * Get a comment
18173
+ *
18174
+ * Get a single comment by ID.
18175
+ *
18176
+ * To view comments on records, you will need the `object_configuration:read` and `record_permission:read` scopes.
18177
+ *
18178
+ * To view comments on list entries, you will need the `list_configuration:read` and `list_entry:read` scopes.
18179
+ *
18180
+ * Required scopes: `comment:read`.
18181
+ */
18182
+ const getV2CommentsByCommentId = (options) => (options.client ?? client).get({
18183
+ requestValidator: async (data) => await zGetV2CommentsByCommentIdData.parseAsync(data),
18184
+ responseValidator: async (data) => await zGetV2CommentsByCommentIdResponse.parseAsync(data),
18185
+ security: [{
18186
+ scheme: "bearer",
18187
+ type: "http"
18188
+ }],
18189
+ url: "/v2/comments/{comment_id}",
18190
+ ...options
18191
+ });
18192
+ /**
18193
+ * List meetings
18194
+ *
18195
+ * Lists all meetings in the workspace using a deterministic sort order.
18196
+ *
18197
+ * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18198
+ *
18199
+ * Required scopes: `meeting:read`, `record_permission:read`.
18200
+ */
18201
+ const getV2Meetings = (options) => (options?.client ?? client).get({
18202
+ requestValidator: async (data) => await zGetV2MeetingsData.parseAsync(data),
18203
+ responseValidator: async (data) => await zGetV2MeetingsResponse.parseAsync(data),
18204
+ security: [{
18205
+ scheme: "bearer",
18206
+ type: "http"
18207
+ }],
18208
+ url: "/v2/meetings",
18209
+ ...options
18210
+ });
18211
+ /**
18212
+ * Find or create a meeting
18213
+ *
18214
+ * Finds an existing meeting or creates a new one if it doesn't yet exist. [Please see here](/rest-api/guides/syncing-meetings) for a full guide on syncing meetings to Attio.
18215
+ *
18216
+ * This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
18217
+ *
18218
+ * Required scopes: `meeting:read-write`, `record_permission:read`.
18219
+ */
18220
+ const postV2Meetings = (options) => (options.client ?? client).post({
18221
+ requestValidator: async (data) => await zPostV2MeetingsData.parseAsync(data),
18222
+ responseValidator: async (data) => await zPostV2MeetingsResponse.parseAsync(data),
18223
+ security: [{
18224
+ scheme: "bearer",
18225
+ type: "http"
18226
+ }],
18227
+ url: "/v2/meetings",
18228
+ ...options,
18229
+ headers: {
18230
+ "Content-Type": "application/json",
18231
+ ...options.headers
18125
18232
  }
18126
- };
18127
- const getHeaderValue = (response, key) => {
18128
- if (!response) return;
18129
- return response.headers.get(key) ?? void 0;
18130
- };
18131
- const parseRetryAfter = (response) => {
18132
- if (!response) return;
18133
- const raw = response.headers.get("Retry-After");
18134
- if (!raw) return;
18135
- const seconds = Number(raw);
18136
- if (Number.isFinite(seconds)) return Math.max(0, seconds * 1e3);
18137
- const dateMs = Date.parse(raw);
18138
- if (!Number.isNaN(dateMs)) return Math.max(0, dateMs - Date.now());
18139
- };
18140
- const extractMessage = (error, fallback) => {
18141
- if (typeof error === "string") return error;
18142
- if (error && typeof error === "object") {
18143
- const maybe = error;
18144
- if (typeof maybe.message === "string") return maybe.message;
18233
+ });
18234
+ /**
18235
+ * Get a meeting
18236
+ *
18237
+ * Get a single meeting by ID.
18238
+ *
18239
+ * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18240
+ *
18241
+ * Required scopes: `meeting:read`, `record_permission:read`.
18242
+ */
18243
+ const getV2MeetingsByMeetingId = (options) => (options.client ?? client).get({
18244
+ requestValidator: async (data) => await zGetV2MeetingsByMeetingIdData.parseAsync(data),
18245
+ responseValidator: async (data) => await zGetV2MeetingsByMeetingIdResponse.parseAsync(data),
18246
+ security: [{
18247
+ scheme: "bearer",
18248
+ type: "http"
18249
+ }],
18250
+ url: "/v2/meetings/{meeting_id}",
18251
+ ...options
18252
+ });
18253
+ /**
18254
+ * List call recordings
18255
+ *
18256
+ * List all call recordings for a meeting.
18257
+ *
18258
+ * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18259
+ *
18260
+ * Required scopes: `meeting:read`, `call_recording:read`.
18261
+ */
18262
+ const getV2MeetingsByMeetingIdCallRecordings = (options) => (options.client ?? client).get({
18263
+ requestValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsData.parseAsync(data),
18264
+ responseValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsResponse.parseAsync(data),
18265
+ security: [{
18266
+ scheme: "bearer",
18267
+ type: "http"
18268
+ }],
18269
+ url: "/v2/meetings/{meeting_id}/call_recordings",
18270
+ ...options
18271
+ });
18272
+ /**
18273
+ * Create call recording
18274
+ *
18275
+ * Create a call recording for a meeting. This endpoint is rate limited to 1 request per second.
18276
+ *
18277
+ * This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
18278
+ *
18279
+ * Required scopes: `meeting:read`, `call_recording:read-write`.
18280
+ */
18281
+ const postV2MeetingsByMeetingIdCallRecordings = (options) => (options.client ?? client).post({
18282
+ requestValidator: async (data) => await zPostV2MeetingsByMeetingIdCallRecordingsData.parseAsync(data),
18283
+ responseValidator: async (data) => await zPostV2MeetingsByMeetingIdCallRecordingsResponse.parseAsync(data),
18284
+ security: [{
18285
+ scheme: "bearer",
18286
+ type: "http"
18287
+ }],
18288
+ url: "/v2/meetings/{meeting_id}/call_recordings",
18289
+ ...options,
18290
+ headers: {
18291
+ "Content-Type": "application/json",
18292
+ ...options.headers
18145
18293
  }
18146
- return fallback ?? "Request failed.";
18147
- };
18148
- const extractDetails = (error) => {
18149
- if (!error || typeof error !== "object") return {};
18150
- const payload = error;
18151
- return {
18152
- code: typeof payload.code === "string" ? payload.code : void 0,
18153
- type: typeof payload.type === "string" ? payload.type : void 0,
18154
- status: typeof payload.status_code === "number" ? payload.status_code : typeof payload.status === "number" ? payload.status : void 0,
18155
- message: typeof payload.message === "string" ? payload.message : void 0,
18156
- data: payload
18157
- };
18158
- };
18159
- const normalizeAttioError = (error, context = {}) => {
18160
- const { response, request } = context;
18161
- const details = extractDetails(error);
18162
- const status = response?.status ?? details.status;
18163
- const message = extractMessage(error, response?.statusText ?? details.message);
18164
- const requestId = getHeaderValue(response, "x-request-id") ?? getHeaderValue(response, "x-attio-request-id");
18165
- if (response) {
18166
- const apiError = new AttioApiError(message, {
18167
- ...details,
18168
- status
18169
- });
18170
- apiError.requestId = requestId;
18171
- apiError.response = response;
18172
- apiError.request = request;
18173
- apiError.data = details.data ?? error;
18174
- apiError.retryAfterMs = parseRetryAfter(response);
18175
- return enhanceAttioError(apiError);
18294
+ });
18295
+ /**
18296
+ * Delete call recording
18297
+ *
18298
+ * Deletes the specified call recording. This will remove the call recording and all associated data.
18299
+ *
18300
+ * This endpoint is in alpha and may be subject to breaking changes as we gather feedback.
18301
+ *
18302
+ * Required scopes: `meeting:read`, `call_recording:read-write`.
18303
+ */
18304
+ const deleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingId = (options) => (options.client ?? client).delete({
18305
+ requestValidator: async (data) => await zDeleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdData.parseAsync(data),
18306
+ responseValidator: async (data) => await zDeleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdResponse.parseAsync(data),
18307
+ security: [{
18308
+ scheme: "bearer",
18309
+ type: "http"
18310
+ }],
18311
+ url: "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}",
18312
+ ...options
18313
+ });
18314
+ /**
18315
+ * Get call recording
18316
+ *
18317
+ * Get a single call recording by ID.
18318
+ *
18319
+ * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18320
+ *
18321
+ * Required scopes: `meeting:read`, `call_recording:read`.
18322
+ */
18323
+ const getV2MeetingsByMeetingIdCallRecordingsByCallRecordingId = (options) => (options.client ?? client).get({
18324
+ requestValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdData.parseAsync(data),
18325
+ responseValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdResponse.parseAsync(data),
18326
+ security: [{
18327
+ scheme: "bearer",
18328
+ type: "http"
18329
+ }],
18330
+ url: "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}",
18331
+ ...options
18332
+ });
18333
+ /**
18334
+ * Get call transcript
18335
+ *
18336
+ * Get the transcript for a call recording.
18337
+ *
18338
+ * This endpoint is in beta. We will aim to avoid breaking changes, but small updates may be made as we roll out to more users.
18339
+ *
18340
+ * Required scopes: `meeting:read`, `call_recording:read`.
18341
+ */
18342
+ const getV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscript = (options) => (options.client ?? client).get({
18343
+ requestValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscriptData.parseAsync(data),
18344
+ responseValidator: async (data) => await zGetV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscriptResponse.parseAsync(data),
18345
+ security: [{
18346
+ scheme: "bearer",
18347
+ type: "http"
18348
+ }],
18349
+ url: "/v2/meetings/{meeting_id}/call_recordings/{call_recording_id}/transcript",
18350
+ ...options
18351
+ });
18352
+ /**
18353
+ * List webhooks
18354
+ *
18355
+ * Get all of the webhooks in your workspace.
18356
+ *
18357
+ * Required scopes: `webhook:read`.
18358
+ */
18359
+ const getV2Webhooks = (options) => (options?.client ?? client).get({
18360
+ requestValidator: async (data) => await zGetV2WebhooksData.parseAsync(data),
18361
+ responseValidator: async (data) => await zGetV2WebhooksResponse.parseAsync(data),
18362
+ security: [{
18363
+ scheme: "bearer",
18364
+ type: "http"
18365
+ }],
18366
+ url: "/v2/webhooks",
18367
+ ...options
18368
+ });
18369
+ /**
18370
+ * Create a webhook
18371
+ *
18372
+ * Create a webhook and associated subscriptions.
18373
+ *
18374
+ * Required scopes: `webhook:read-write`.
18375
+ */
18376
+ const postV2Webhooks = (options) => (options.client ?? client).post({
18377
+ requestValidator: async (data) => await zPostV2WebhooksData.parseAsync(data),
18378
+ responseValidator: async (data) => await zPostV2WebhooksResponse.parseAsync(data),
18379
+ security: [{
18380
+ scheme: "bearer",
18381
+ type: "http"
18382
+ }],
18383
+ url: "/v2/webhooks",
18384
+ ...options,
18385
+ headers: {
18386
+ "Content-Type": "application/json",
18387
+ ...options.headers
18176
18388
  }
18177
- const networkError = new AttioNetworkError(message, details);
18178
- networkError.request = request;
18179
- return networkError;
18180
- };
18181
-
18182
- //#endregion
18183
- //#region src/attio/client.ts
18184
- const resolveFetch = (config) => {
18185
- const baseFetch = config?.fetch ?? globalThis.fetch;
18186
- if (!baseFetch) throw new Error("Fetch is not available in this environment.");
18187
- if (!config?.timeoutMs) return baseFetch;
18188
- return async (input, init) => {
18189
- const controller = new AbortController();
18190
- const timeoutId = setTimeout(() => controller.abort(), config.timeoutMs);
18191
- let combinedSignal = controller.signal;
18192
- let abortCombined;
18193
- if (init?.signal) if (typeof AbortSignal !== "undefined" && "any" in AbortSignal) combinedSignal = AbortSignal.any([init.signal, controller.signal]);
18194
- else {
18195
- const combinedController = new AbortController();
18196
- combinedSignal = combinedController.signal;
18197
- if (init.signal.aborted) combinedController.abort();
18198
- else {
18199
- abortCombined = () => combinedController.abort();
18200
- init.signal.addEventListener("abort", abortCombined, { once: true });
18201
- controller.signal.addEventListener("abort", abortCombined, { once: true });
18202
- }
18203
- }
18204
- try {
18205
- return await baseFetch(input, {
18206
- ...init,
18207
- signal: combinedSignal
18208
- });
18209
- } finally {
18210
- if (abortCombined) {
18211
- init?.signal?.removeEventListener("abort", abortCombined);
18212
- controller.signal.removeEventListener("abort", abortCombined);
18213
- }
18214
- clearTimeout(timeoutId);
18215
- }
18216
- };
18217
- };
18218
- const buildClientCacheKey = ({ config, authToken }) => {
18219
- if (config.cache?.key) return `${config.cache.key}:${hashToken(authToken)}`;
18220
- };
18221
- const applyInterceptors = (client) => {
18222
- client.interceptors.error.use((error, response, request, options) => normalizeAttioError(error, {
18223
- response,
18224
- request,
18225
- options
18226
- }));
18227
- };
18228
- const wrapClient = (base, retry) => {
18229
- const requestWithRetry = async (options) => {
18230
- const { retry: retryOverride, ...rest } = options;
18231
- return callWithRetry(() => base.request(rest), {
18232
- ...retry,
18233
- ...retryOverride
18234
- });
18235
- };
18236
- const makeMethod = (method) => (options) => requestWithRetry({
18237
- ...options,
18238
- method
18239
- });
18240
- return {
18241
- ...base,
18242
- request: requestWithRetry,
18243
- connect: makeMethod("CONNECT"),
18244
- delete: makeMethod("DELETE"),
18245
- get: makeMethod("GET"),
18246
- head: makeMethod("HEAD"),
18247
- options: makeMethod("OPTIONS"),
18248
- patch: makeMethod("PATCH"),
18249
- post: makeMethod("POST"),
18250
- put: makeMethod("PUT"),
18251
- trace: makeMethod("TRACE")
18252
- };
18253
- };
18254
- const createAttioClientWithAuthToken = ({ config = {}, authToken }) => {
18255
- const baseUrl = resolveBaseUrl(config);
18256
- const responseStyle = resolveResponseStyle(config);
18257
- const throwOnError = resolveThrowOnError(config);
18258
- const headers = config.headers;
18259
- const retry = config.retry;
18260
- const timeoutMs = config.timeoutMs;
18261
- const cleanConfig = { ...config };
18262
- delete cleanConfig.apiKey;
18263
- delete cleanConfig.accessToken;
18264
- delete cleanConfig.authToken;
18265
- delete cleanConfig.cache;
18266
- delete cleanConfig.retry;
18267
- delete cleanConfig.timeoutMs;
18268
- delete cleanConfig.headers;
18269
- const mergedHeaders = mergeHeaders({ Accept: "application/json" }, headers);
18270
- const base = createClient({
18271
- ...cleanConfig,
18272
- baseUrl,
18273
- auth: authToken,
18274
- headers: mergedHeaders,
18275
- fetch: resolveFetch({
18276
- ...config,
18277
- timeoutMs
18278
- }),
18279
- responseStyle,
18280
- throwOnError
18281
- });
18282
- applyInterceptors(base);
18283
- return wrapClient(base, retry);
18284
- };
18285
- const createAttioClient = (config = {}) => {
18286
- return createAttioClientWithAuthToken({
18287
- config,
18288
- authToken: validateAuthToken(resolveAuthToken(config))
18289
- });
18290
- };
18291
- const getAttioClient = (config = {}) => {
18292
- const cacheEnabled = config.cache?.enabled ?? true;
18293
- const authToken = validateAuthToken(resolveAuthToken(config));
18294
- const cacheKey = buildClientCacheKey({
18295
- config,
18296
- authToken
18297
- });
18298
- if (cacheEnabled && cacheKey) {
18299
- const cached = getCachedClient(cacheKey);
18300
- if (cached) return cached;
18301
- const client = createAttioClientWithAuthToken({
18302
- config,
18303
- authToken
18304
- });
18305
- setCachedClient(cacheKey, client);
18306
- return client;
18389
+ });
18390
+ /**
18391
+ * Delete a webhook
18392
+ *
18393
+ * Delete a webhook by ID.
18394
+ *
18395
+ * Required scopes: `webhook:read-write`.
18396
+ */
18397
+ const deleteV2WebhooksByWebhookId = (options) => (options.client ?? client).delete({
18398
+ requestValidator: async (data) => await zDeleteV2WebhooksByWebhookIdData.parseAsync(data),
18399
+ responseValidator: async (data) => await zDeleteV2WebhooksByWebhookIdResponse.parseAsync(data),
18400
+ security: [{
18401
+ scheme: "bearer",
18402
+ type: "http"
18403
+ }],
18404
+ url: "/v2/webhooks/{webhook_id}",
18405
+ ...options
18406
+ });
18407
+ /**
18408
+ * Get a webhook
18409
+ *
18410
+ * Get a single webhook.
18411
+ *
18412
+ * Required scopes: `webhook:read`.
18413
+ */
18414
+ const getV2WebhooksByWebhookId = (options) => (options.client ?? client).get({
18415
+ requestValidator: async (data) => await zGetV2WebhooksByWebhookIdData.parseAsync(data),
18416
+ responseValidator: async (data) => await zGetV2WebhooksByWebhookIdResponse.parseAsync(data),
18417
+ security: [{
18418
+ scheme: "bearer",
18419
+ type: "http"
18420
+ }],
18421
+ url: "/v2/webhooks/{webhook_id}",
18422
+ ...options
18423
+ });
18424
+ /**
18425
+ * Update a webhook
18426
+ *
18427
+ * Update a webhook and associated subscriptions.
18428
+ *
18429
+ * Required scopes: `webhook:read-write`.
18430
+ */
18431
+ const patchV2WebhooksByWebhookId = (options) => (options.client ?? client).patch({
18432
+ requestValidator: async (data) => await zPatchV2WebhooksByWebhookIdData.parseAsync(data),
18433
+ responseValidator: async (data) => await zPatchV2WebhooksByWebhookIdResponse.parseAsync(data),
18434
+ security: [{
18435
+ scheme: "bearer",
18436
+ type: "http"
18437
+ }],
18438
+ url: "/v2/webhooks/{webhook_id}",
18439
+ ...options,
18440
+ headers: {
18441
+ "Content-Type": "application/json",
18442
+ ...options.headers
18307
18443
  }
18308
- return createAttioClientWithAuthToken({
18309
- config,
18310
- authToken
18311
- });
18312
- };
18313
- const resolveAttioClient = (input = {}) => {
18314
- return input.client ?? getAttioClient(input.config ?? {});
18315
- };
18316
-
18317
- //#endregion
18318
- //#region src/attio/filters.ts
18319
- const operator = (field, op, value) => ({ [field]: { [op]: value } });
18320
- const filters = {
18321
- eq: (field, value) => operator(field, "$eq", value),
18322
- contains: (field, value) => operator(field, "$contains", value),
18323
- startsWith: (field, value) => operator(field, "$starts_with", value),
18324
- endsWith: (field, value) => operator(field, "$ends_with", value),
18325
- notEmpty: (field) => operator(field, "$not_empty", true),
18326
- and: (...conditions) => ({ $and: conditions }),
18327
- or: (...conditions) => ({ $or: conditions }),
18328
- not: (condition) => ({ $not: condition })
18329
- };
18444
+ });
18445
+ /**
18446
+ * Identify
18447
+ *
18448
+ * Identify the current access token, the workspace it is linked to, and any permissions it has.
18449
+ */
18450
+ const getV2Self = (options) => (options?.client ?? client).get({
18451
+ requestValidator: async (data) => await zGetV2SelfData.parseAsync(data),
18452
+ responseValidator: async (data) => await zGetV2SelfResponse.parseAsync(data),
18453
+ security: [{
18454
+ scheme: "bearer",
18455
+ type: "http"
18456
+ }],
18457
+ url: "/v2/self",
18458
+ ...options
18459
+ });
18330
18460
 
18331
18461
  //#endregion
18332
18462
  //#region src/attio/response.ts
@@ -18444,28 +18574,25 @@ const extractTitles = (items) => items.reduce((titles, item) => {
18444
18574
  if (parsed.success) titles.push(parsed.data.title);
18445
18575
  return titles;
18446
18576
  }, []);
18447
- let AttributeMetadata;
18448
- (function(_AttributeMetadata) {
18449
- const buildPath = _AttributeMetadata.buildPath = (input) => ({
18450
- target: input.target,
18451
- identifier: input.identifier,
18452
- attribute: input.attribute
18453
- });
18454
- _AttributeMetadata.list = async ({ input, cache, fetcher }) => {
18455
- const cacheKey = buildKey(input.target, input.identifier, input.attribute);
18456
- const cached = cache.get(cacheKey);
18457
- if (cached) return cached;
18458
- const items = unwrapItems(await fetcher({
18459
- client: resolveAttioClient(input),
18460
- path: buildPath(input),
18461
- ...input.options
18462
- }));
18463
- const titles = extractTitles(items);
18464
- updateKnownFieldValues(input.attribute, titles);
18465
- cache.set(cacheKey, items);
18466
- return items;
18467
- };
18468
- })(AttributeMetadata || (AttributeMetadata = {}));
18577
+ const buildAttributeMetadataPath = (input) => ({
18578
+ target: input.target,
18579
+ identifier: input.identifier,
18580
+ attribute: input.attribute
18581
+ });
18582
+ const listAttributeMetadata = async ({ input, cache, fetcher }) => {
18583
+ const cacheKey = buildKey(input.target, input.identifier, input.attribute);
18584
+ const cached = cache.get(cacheKey);
18585
+ if (cached) return cached;
18586
+ const items = unwrapItems(await fetcher({
18587
+ client: resolveAttioClient(input),
18588
+ path: buildAttributeMetadataPath(input),
18589
+ ...input.options
18590
+ }));
18591
+ const titles = extractTitles(items);
18592
+ updateKnownFieldValues(input.attribute, titles);
18593
+ cache.set(cacheKey, items);
18594
+ return items;
18595
+ };
18469
18596
  const listAttributes = async (input) => {
18470
18597
  const cacheKey = buildKey(input.target, input.identifier);
18471
18598
  const cached = attributesCache.get(cacheKey);
@@ -18492,20 +18619,16 @@ const getAttribute = async (input) => {
18492
18619
  ...input.options
18493
18620
  }));
18494
18621
  };
18495
- const getAttributeOptions = async (input) => {
18496
- return AttributeMetadata.list({
18497
- input,
18498
- cache: optionsCache,
18499
- fetcher: getV2ByTargetByIdentifierAttributesByAttributeOptions
18500
- });
18501
- };
18502
- const getAttributeStatuses = async (input) => {
18503
- return AttributeMetadata.list({
18504
- input,
18505
- cache: statusesCache,
18506
- fetcher: getV2ByTargetByIdentifierAttributesByAttributeStatuses
18507
- });
18508
- };
18622
+ const getAttributeOptions = async (input) => listAttributeMetadata({
18623
+ input,
18624
+ cache: optionsCache,
18625
+ fetcher: getV2ByTargetByIdentifierAttributesByAttributeOptions
18626
+ });
18627
+ const getAttributeStatuses = async (input) => listAttributeMetadata({
18628
+ input,
18629
+ cache: statusesCache,
18630
+ fetcher: getV2ByTargetByIdentifierAttributesByAttributeStatuses
18631
+ });
18509
18632
 
18510
18633
  //#endregion
18511
18634
  //#region src/attio/notes.ts
@@ -18540,12 +18663,25 @@ const deleteNote = async (input) => {
18540
18663
 
18541
18664
  //#endregion
18542
18665
  //#region src/attio/pagination.ts
18666
+ const createPageResultSchema = (itemSchema) => z.object({
18667
+ items: z.array(itemSchema),
18668
+ nextCursor: z.string().nullish()
18669
+ });
18670
+ const basePageResultSchema = z.object({
18671
+ items: z.array(z.unknown()),
18672
+ nextCursor: z.string().nullish()
18673
+ });
18543
18674
  const toPageResult = (result) => {
18544
18675
  return {
18545
18676
  items: unwrapItems(result),
18546
18677
  nextCursor: unwrapPaginationCursor(result)
18547
18678
  };
18548
18679
  };
18680
+ const parsePageResult = (page, itemSchema) => {
18681
+ const result = (itemSchema ? createPageResultSchema(itemSchema) : basePageResultSchema).safeParse(page);
18682
+ if (!result.success) return;
18683
+ return result.data;
18684
+ };
18549
18685
  const paginate = async (fetchPage, options = {}) => {
18550
18686
  const items = [];
18551
18687
  let cursor = options.cursor ?? null;
@@ -18554,7 +18690,7 @@ const paginate = async (fetchPage, options = {}) => {
18554
18690
  const maxItems = options.maxItems ?? Number.POSITIVE_INFINITY;
18555
18691
  while (pages < maxPages && items.length < maxItems) {
18556
18692
  const page = await fetchPage(cursor);
18557
- const { items: pageItems, nextCursor } = page !== null && typeof page === "object" && Array.isArray(page.items) ? page : toPageResult(page);
18693
+ const { items: pageItems, nextCursor } = parsePageResult(page, options.itemSchema) ?? toPageResult(page);
18558
18694
  items.push(...pageItems);
18559
18695
  pages += 1;
18560
18696
  if (!nextCursor) break;
@@ -18565,44 +18701,126 @@ const paginate = async (fetchPage, options = {}) => {
18565
18701
 
18566
18702
  //#endregion
18567
18703
  //#region src/attio/record-utils.ts
18568
- const extractAnyId = (obj) => {
18569
- if (!obj || typeof obj !== "object") return;
18570
- const record = obj;
18571
- const idObj = record.id;
18572
- return idObj?.record_id ?? idObj?.company_id ?? idObj?.person_id ?? idObj?.list_id ?? idObj?.task_id ?? (typeof record.id === "string" ? record.id : void 0) ?? record.record_id ?? record.company_id ?? record.person_id ?? record.list_id ?? record.task_id;
18704
+ const attioRecordIdSchema = z.string().brand();
18705
+ const defaultNormalizeRecordOptions = { emptyBehavior: "reject" };
18706
+ const emptyObjectIssueCode = "EMPTY_OBJECT";
18707
+ const unknownObjectSchema = z.object({}).passthrough();
18708
+ const nonEmptyObjectSchema = unknownObjectSchema.superRefine((value, ctx) => {
18709
+ if (Object.keys(value).length === 0) ctx.addIssue({
18710
+ code: z.ZodIssueCode.custom,
18711
+ message: "Expected non-empty object",
18712
+ params: { code: emptyObjectIssueCode }
18713
+ });
18714
+ });
18715
+ const recordIdFieldsSchema = z.object({
18716
+ record_id: attioRecordIdSchema.optional(),
18717
+ company_id: attioRecordIdSchema.optional(),
18718
+ person_id: attioRecordIdSchema.optional(),
18719
+ list_id: attioRecordIdSchema.optional(),
18720
+ task_id: attioRecordIdSchema.optional()
18721
+ });
18722
+ const unknownArraySchema = z.array(z.unknown());
18723
+ const extractIdFromFields = (fields) => fields.record_id ?? fields.company_id ?? fields.person_id ?? fields.list_id ?? fields.task_id;
18724
+ function parseObject(value, options) {
18725
+ const parsed = ((options?.emptyBehavior ?? "allow") === "allow" ? unknownObjectSchema : nonEmptyObjectSchema).safeParse(value);
18726
+ if (parsed.success) return parsed.data;
18727
+ if (options) throw parsed.error;
18728
+ }
18729
+ const parseId = (value) => {
18730
+ const parsed = attioRecordIdSchema.safeParse(value);
18731
+ return parsed.success ? parsed.data : void 0;
18732
+ };
18733
+ const parseIdFields = (value) => {
18734
+ const parsed = recordIdFieldsSchema.safeParse(value);
18735
+ return parsed.success ? parsed.data : void 0;
18736
+ };
18737
+ const parseArray = (value) => {
18738
+ const parsed = unknownArraySchema.safeParse(value);
18739
+ return parsed.success ? parsed.data : void 0;
18740
+ };
18741
+ const extractIdFromRecord = (record) => {
18742
+ const idFields = parseIdFields(record.id);
18743
+ return (idFields ? extractIdFromFields(idFields) : void 0) ?? parseId(record.id) ?? parseId(record.record_id) ?? parseId(record.company_id) ?? parseId(record.person_id) ?? parseId(record.list_id) ?? parseId(record.task_id);
18744
+ };
18745
+ const extractValuesObject = (record) => parseObject(record.values);
18746
+ const extractIdFromUnknown = (value) => {
18747
+ const record = parseObject(value);
18748
+ if (!record) return;
18749
+ return extractIdFromRecord(record);
18573
18750
  };
18574
18751
  const extractValues = (obj) => {
18575
- if (!obj || typeof obj !== "object") return;
18576
- const values = obj.values;
18577
- if (!values || typeof values !== "object" || Array.isArray(values)) return;
18578
- return values;
18752
+ const record = parseObject(obj);
18753
+ if (!record) return;
18754
+ return extractValuesObject(record);
18755
+ };
18756
+ const collectNestedCandidates = (record) => {
18757
+ const candidates = [];
18758
+ if (record.data !== void 0) candidates.push(record.data);
18759
+ const dataRecord = parseObject(record.data);
18760
+ if (!dataRecord) return candidates;
18761
+ if (dataRecord.data !== void 0) candidates.push(dataRecord.data);
18762
+ if (dataRecord.record !== void 0) candidates.push(dataRecord.record);
18763
+ const items = parseArray(dataRecord.items);
18764
+ if (items && items.length > 0) candidates.push(items[0]);
18765
+ return candidates;
18766
+ };
18767
+ const findFirstId = (candidates) => {
18768
+ for (const candidate of candidates) {
18769
+ const nested = extractIdFromUnknown(candidate);
18770
+ if (nested) return nested;
18771
+ }
18579
18772
  };
18580
18773
  const extractRecordId = (obj) => {
18581
- if (!obj || typeof obj !== "object") return;
18582
- const record = obj;
18583
- return extractAnyId(record) ?? extractAnyId(record.data) ?? extractAnyId(record.data?.data) ?? extractAnyId(record.data?.record) ?? extractAnyId(record.data?.items?.[0]);
18774
+ const record = parseObject(obj);
18775
+ if (!record) return;
18776
+ const direct = extractIdFromRecord(record);
18777
+ if (direct) return direct;
18778
+ return findFirstId(collectNestedCandidates(record));
18779
+ };
18780
+ const hasValidRecordId = (raw) => {
18781
+ const idFields = parseIdFields(raw.id);
18782
+ return Boolean(idFields?.record_id);
18783
+ };
18784
+ const extractNestedValues = (result) => {
18785
+ const candidates = collectNestedCandidates(result);
18786
+ for (const candidate of candidates) {
18787
+ const values = extractValues(candidate);
18788
+ if (values) return values;
18789
+ }
18790
+ };
18791
+ const parseRecordInput = (raw, options) => {
18792
+ try {
18793
+ return parseObject(raw, { emptyBehavior: options.emptyBehavior ?? "reject" });
18794
+ } catch (error) {
18795
+ if (error instanceof z.ZodError) {
18796
+ if (error.issues.some((issue) => issue.code === z.ZodIssueCode.custom && issue.params?.code === emptyObjectIssueCode)) throw new AttioResponseError("Invalid API response: empty data object", { code: "EMPTY_RESPONSE" });
18797
+ throw new AttioResponseError("Invalid API response: no data found", { code: "INVALID_RESPONSE" });
18798
+ }
18799
+ throw error;
18800
+ }
18584
18801
  };
18585
- const normalizeRecord = (raw, options = {}) => {
18586
- if (!raw || typeof raw !== "object") throw new Error("Invalid API response: no data found");
18587
- if (!options.allowEmpty && Object.keys(raw).length === 0) throw new Error("Invalid API response: empty data object");
18588
- if (raw.id && raw.id.record_id && raw.values) return raw;
18589
- const result = { ...raw };
18590
- if (!result.id || !result.id.record_id) {
18802
+ function normalizeRecord(raw, options = defaultNormalizeRecordOptions) {
18803
+ const parsedRaw = parseRecordInput(raw, options);
18804
+ if (hasValidRecordId(parsedRaw) && extractValuesObject(parsedRaw)) return parsedRaw;
18805
+ const result = { ...parsedRaw };
18806
+ if (!hasValidRecordId(result)) {
18591
18807
  const extractedId = extractRecordId(result);
18592
18808
  if (extractedId) result.id = {
18593
- ...result.id,
18809
+ ...parseObject(result.id) ?? {},
18594
18810
  record_id: extractedId
18595
18811
  };
18596
18812
  }
18597
- if (!result.values) {
18598
- const dataRecord = result.data;
18599
- result.values = extractValues(result.data) ?? extractValues(dataRecord?.data) ?? extractValues(dataRecord?.record) ?? extractValues(dataRecord?.items?.[0]) ?? {};
18600
- }
18813
+ if (!extractValuesObject(result)) result.values = extractNestedValues(result) ?? {};
18601
18814
  return result;
18602
- };
18603
- const normalizeRecords = (items, options = {}) => {
18604
- return items.filter((item) => item && typeof item === "object").map((item) => normalizeRecord(item, options));
18605
- };
18815
+ }
18816
+ function normalizeRecords(items, options = defaultNormalizeRecordOptions) {
18817
+ const normalized = [];
18818
+ for (const item of items) {
18819
+ const record = parseObject(item);
18820
+ if (record) normalized.push(normalizeRecord(record, options));
18821
+ }
18822
+ return normalized;
18823
+ }
18606
18824
 
18607
18825
  //#endregion
18608
18826
  //#region src/attio/records.ts
@@ -18734,5 +18952,5 @@ const getWorkspaceMember = async (input) => {
18734
18952
  };
18735
18953
 
18736
18954
  //#endregion
18737
- export { AttioApiError, AttioError, AttioNetworkError, DEFAULT_BASE_URL, DEFAULT_RETRY_CONFIG, TtlCache, addListEntry, calculateRetryDelay, callWithRetry, clearClientCache, createAttioClient, createNote, createRecord, createTask, createTtlCache, deleteNote, deleteRecord, deleteTask, deleteV2CommentsByCommentId, deleteV2ListsByListEntriesByEntryId, deleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingId, deleteV2NotesByNoteId, deleteV2ObjectsByObjectRecordsByRecordId, deleteV2TasksByTaskId, deleteV2WebhooksByWebhookId, enhanceAttioError, extractRecordId, filters, getAttioClient, getAttribute, getAttributeOptions, getAttributeStatuses, getCachedClient, getEnvValue, getKnownFieldValues, getList, getNote, getRecord, getTask, getV2ByTargetByIdentifierAttributes, getV2ByTargetByIdentifierAttributesByAttribute, getV2ByTargetByIdentifierAttributesByAttributeOptions, getV2ByTargetByIdentifierAttributesByAttributeStatuses, getV2CommentsByCommentId, getV2Lists, getV2ListsByList, getV2ListsByListEntriesByEntryId, getV2ListsByListEntriesByEntryIdAttributesByAttributeValues, getV2Meetings, getV2MeetingsByMeetingId, getV2MeetingsByMeetingIdCallRecordings, getV2MeetingsByMeetingIdCallRecordingsByCallRecordingId, getV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscript, getV2Notes, getV2NotesByNoteId, getV2Objects, getV2ObjectsByObject, getV2ObjectsByObjectRecordsByRecordId, getV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValues, getV2ObjectsByObjectRecordsByRecordIdEntries, getV2Self, getV2Tasks, getV2TasksByTaskId, getV2Threads, getV2ThreadsByThreadId, getV2Webhooks, getV2WebhooksByWebhookId, getV2WorkspaceMembers, getV2WorkspaceMembersByWorkspaceMemberId, getWorkspaceMember, hashToken, isRetryableError, isRetryableStatus, listAttributes, listLists, listNotes, listTasks, listWorkspaceMembers, normalizeAttioError, normalizeBaseUrl, normalizeRecord, normalizeRecords, paginate, patchV2ByTargetByIdentifierAttributesByAttribute, patchV2ByTargetByIdentifierAttributesByAttributeOptionsByOption, patchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatus, patchV2ListsByList, patchV2ListsByListEntriesByEntryId, patchV2ObjectsByObject, patchV2ObjectsByObjectRecordsByRecordId, patchV2TasksByTaskId, patchV2WebhooksByWebhookId, postV2ByTargetByIdentifierAttributes, postV2ByTargetByIdentifierAttributesByAttributeOptions, postV2ByTargetByIdentifierAttributesByAttributeStatuses, postV2Comments, postV2Lists, postV2ListsByListEntries, postV2ListsByListEntriesQuery, postV2Meetings, postV2MeetingsByMeetingIdCallRecordings, postV2Notes, postV2Objects, postV2ObjectsByObjectRecords, postV2ObjectsByObjectRecordsQuery, postV2ObjectsRecordsSearch, postV2Tasks, postV2Webhooks, putV2ListsByListEntries, putV2ListsByListEntriesByEntryId, putV2ObjectsByObjectRecords, putV2ObjectsByObjectRecordsByRecordId, queryListEntries, queryRecords, removeListEntry, resolveAttioClient, resolveAuthToken, resolveBaseUrl, resolveResponseStyle, resolveThrowOnError, runBatch, searchRecords, setCachedClient, sleep, toPageResult, unwrapData, unwrapItems, unwrapPaginationCursor, updateKnownFieldValues, updateListEntry, updateRecord, updateTask, upsertRecord, validateAuthToken };
18955
+ export { AttioApiError, AttioBatchError, AttioConfigError, AttioEnvironmentError, AttioError, AttioNetworkError, AttioResponseError, AttioRetryError, DEFAULT_BASE_URL, DEFAULT_RETRY_CONFIG, TtlCache, addListEntry, buildAttributeMetadataPath, buildKey, calculateRetryDelay, callWithRetry, clearClientCache, createAttioClient, createNote, createPageResultSchema, createRecord, createTask, createTtlCache, deleteNote, deleteRecord, deleteTask, deleteV2CommentsByCommentId, deleteV2ListsByListEntriesByEntryId, deleteV2MeetingsByMeetingIdCallRecordingsByCallRecordingId, deleteV2NotesByNoteId, deleteV2ObjectsByObjectRecordsByRecordId, deleteV2TasksByTaskId, deleteV2WebhooksByWebhookId, enhanceAttioError, extractRecordId, extractTitles, filters, getAttioClient, getAttribute, getAttributeOptions, getAttributeStatuses, getCachedClient, getEnvValue, getKnownFieldValues, getList, getNote, getRecord, getTask, getV2ByTargetByIdentifierAttributes, getV2ByTargetByIdentifierAttributesByAttribute, getV2ByTargetByIdentifierAttributesByAttributeOptions, getV2ByTargetByIdentifierAttributesByAttributeStatuses, getV2CommentsByCommentId, getV2Lists, getV2ListsByList, getV2ListsByListEntriesByEntryId, getV2ListsByListEntriesByEntryIdAttributesByAttributeValues, getV2Meetings, getV2MeetingsByMeetingId, getV2MeetingsByMeetingIdCallRecordings, getV2MeetingsByMeetingIdCallRecordingsByCallRecordingId, getV2MeetingsByMeetingIdCallRecordingsByCallRecordingIdTranscript, getV2Notes, getV2NotesByNoteId, getV2Objects, getV2ObjectsByObject, getV2ObjectsByObjectRecordsByRecordId, getV2ObjectsByObjectRecordsByRecordIdAttributesByAttributeValues, getV2ObjectsByObjectRecordsByRecordIdEntries, getV2Self, getV2Tasks, getV2TasksByTaskId, getV2Threads, getV2ThreadsByThreadId, getV2Webhooks, getV2WebhooksByWebhookId, getV2WorkspaceMembers, getV2WorkspaceMembersByWorkspaceMemberId, getWorkspaceMember, hashToken, isRetryableError, isRetryableStatus, listAttributeMetadata, listAttributes, listLists, listNotes, listTasks, listWorkspaceMembers, normalizeAttioError, normalizeBaseUrl, normalizeRecord, normalizeRecords, paginate, parsePageResult, patchV2ByTargetByIdentifierAttributesByAttribute, patchV2ByTargetByIdentifierAttributesByAttributeOptionsByOption, patchV2ByTargetByIdentifierAttributesByAttributeStatusesByStatus, patchV2ListsByList, patchV2ListsByListEntriesByEntryId, patchV2ObjectsByObject, patchV2ObjectsByObjectRecordsByRecordId, patchV2TasksByTaskId, patchV2WebhooksByWebhookId, postV2ByTargetByIdentifierAttributes, postV2ByTargetByIdentifierAttributesByAttributeOptions, postV2ByTargetByIdentifierAttributesByAttributeStatuses, postV2Comments, postV2Lists, postV2ListsByListEntries, postV2ListsByListEntriesQuery, postV2Meetings, postV2MeetingsByMeetingIdCallRecordings, postV2Notes, postV2Objects, postV2ObjectsByObjectRecords, postV2ObjectsByObjectRecordsQuery, postV2ObjectsRecordsSearch, postV2Tasks, postV2Webhooks, putV2ListsByListEntries, putV2ListsByListEntriesByEntryId, putV2ObjectsByObjectRecords, putV2ObjectsByObjectRecordsByRecordId, queryListEntries, queryRecords, removeListEntry, resolveAttioClient, resolveAuthToken, resolveBaseUrl, resolveResponseStyle, resolveThrowOnError, runBatch, searchRecords, setCachedClient, sleep, toPageResult, unwrapData, unwrapItems, unwrapPaginationCursor, updateKnownFieldValues, updateListEntry, updateRecord, updateTask, upsertRecord, validateAuthToken };
18738
18956
  //# sourceMappingURL=index.mjs.map