@blazeo.com/calendar-client 1.0.16 → 1.0.17

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.d.ts CHANGED
@@ -158,6 +158,15 @@ export const LeadModel: {
158
158
  referrerLink?: string;
159
159
  }): Promise<unknown>;
160
160
  deleteLead(leadId: string): Promise<{ status: string; data?: unknown; message?: string }>;
161
+ requestExport(
162
+ companyKey: string,
163
+ opts?: {
164
+ notifyPath?: string;
165
+ notify_path?: string;
166
+ consumer?: string;
167
+ Consumer?: string;
168
+ }
169
+ ): Promise<{ status: string; data?: unknown; message?: string }>;
161
170
  getByCompany(
162
171
  companyKey: string,
163
172
  opts?: {
package/dist/index.js CHANGED
@@ -147,7 +147,7 @@ async function request(baseUrl, fetchFn, path, options = {}) {
147
147
  }
148
148
  function mergeConsumerHeader(env, opts) {
149
149
  const headers = { ...opts.headers || {} };
150
- if (env == null ? void 0 : env.consumer) headers["Consumer"] = env.consumer;
150
+ if (!headers["Consumer"] && (env == null ? void 0 : env.consumer)) headers["Consumer"] = env.consumer;
151
151
  return { ...opts, headers };
152
152
  }
153
153
  function createRequestHelpers(self, getEnv9) {
@@ -2072,6 +2072,16 @@ var LeadModel = import_mobx_state_tree17.types.model("Lead", {
2072
2072
  return { status: "failure", message: "leadId required" };
2073
2073
  }
2074
2074
  return reqGet("/lead/delete", { lead_id: self.leadId });
2075
+ },
2076
+ /**
2077
+ * POST /lead/export/request – queue async full CSV export for self.companyKey (no list filters).
2078
+ * @param {object} [opts] – { notifyPath?, consumer? } consumer = Consumer header for completion webhook
2079
+ */
2080
+ async requestLeadExport(opts = {}) {
2081
+ if (!self.companyKey || String(self.companyKey).trim() === "") {
2082
+ return { status: "failure", message: "companyKey required on model" };
2083
+ }
2084
+ return LeadModel.requestExport(self.companyKey, opts);
2075
2085
  }
2076
2086
  };
2077
2087
  });
@@ -2146,6 +2156,22 @@ LeadModel.deleteLead = async (leadId) => {
2146
2156
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
2147
2157
  return reqGet("/lead/delete", { lead_id: leadId });
2148
2158
  };
2159
+ LeadModel.requestExport = async (companyKey, opts = {}) => {
2160
+ const ck = companyKey != null ? String(companyKey).trim() : "";
2161
+ if (!ck) return { status: "failure", message: "companyKey required" };
2162
+ const { reqPost } = createRequestHelpersFromEnv(getConfig());
2163
+ const body = { company_key: ck };
2164
+ const np = opts.notifyPath ?? opts.notify_path;
2165
+ if (np != null && String(np).trim() !== "") {
2166
+ body.notify_path = String(np).trim();
2167
+ }
2168
+ const headers = {};
2169
+ const consumer = opts.consumer ?? opts.Consumer;
2170
+ if (consumer != null && String(consumer).trim() !== "") {
2171
+ headers.Consumer = String(consumer).trim();
2172
+ }
2173
+ return reqPost("/lead/export/request", body, void 0, { headers });
2174
+ };
2149
2175
  LeadModel.getSources = async (companyKey) => {
2150
2176
  var _a;
2151
2177
  if (!companyKey || String(companyKey).trim() === "") return [];
package/dist/index.mjs CHANGED
@@ -94,7 +94,7 @@ async function request(baseUrl, fetchFn, path, options = {}) {
94
94
  }
95
95
  function mergeConsumerHeader(env, opts) {
96
96
  const headers = { ...opts.headers || {} };
97
- if (env == null ? void 0 : env.consumer) headers["Consumer"] = env.consumer;
97
+ if (!headers["Consumer"] && (env == null ? void 0 : env.consumer)) headers["Consumer"] = env.consumer;
98
98
  return { ...opts, headers };
99
99
  }
100
100
  function createRequestHelpers(self, getEnv9) {
@@ -2019,6 +2019,16 @@ var LeadModel = types17.model("Lead", {
2019
2019
  return { status: "failure", message: "leadId required" };
2020
2020
  }
2021
2021
  return reqGet("/lead/delete", { lead_id: self.leadId });
2022
+ },
2023
+ /**
2024
+ * POST /lead/export/request – queue async full CSV export for self.companyKey (no list filters).
2025
+ * @param {object} [opts] – { notifyPath?, consumer? } consumer = Consumer header for completion webhook
2026
+ */
2027
+ async requestLeadExport(opts = {}) {
2028
+ if (!self.companyKey || String(self.companyKey).trim() === "") {
2029
+ return { status: "failure", message: "companyKey required on model" };
2030
+ }
2031
+ return LeadModel.requestExport(self.companyKey, opts);
2022
2032
  }
2023
2033
  };
2024
2034
  });
@@ -2093,6 +2103,22 @@ LeadModel.deleteLead = async (leadId) => {
2093
2103
  const { reqGet } = createRequestHelpersFromEnv(getConfig());
2094
2104
  return reqGet("/lead/delete", { lead_id: leadId });
2095
2105
  };
2106
+ LeadModel.requestExport = async (companyKey, opts = {}) => {
2107
+ const ck = companyKey != null ? String(companyKey).trim() : "";
2108
+ if (!ck) return { status: "failure", message: "companyKey required" };
2109
+ const { reqPost } = createRequestHelpersFromEnv(getConfig());
2110
+ const body = { company_key: ck };
2111
+ const np = opts.notifyPath ?? opts.notify_path;
2112
+ if (np != null && String(np).trim() !== "") {
2113
+ body.notify_path = String(np).trim();
2114
+ }
2115
+ const headers = {};
2116
+ const consumer = opts.consumer ?? opts.Consumer;
2117
+ if (consumer != null && String(consumer).trim() !== "") {
2118
+ headers.Consumer = String(consumer).trim();
2119
+ }
2120
+ return reqPost("/lead/export/request", body, void 0, { headers });
2121
+ };
2096
2122
  LeadModel.getSources = async (companyKey) => {
2097
2123
  var _a;
2098
2124
  if (!companyKey || String(companyKey).trim() === "") return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blazeo.com/calendar-client",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Blazeo Calendar / Appointment API client with MobX State Tree models",
5
5
  "exports": {
6
6
  ".": {