@algolia/abtesting 1.21.1 → 1.22.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/README.md +4 -4
- package/dist/browser.d.ts +145 -3
- package/dist/builds/browser.js +312 -1
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +5 -5
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +7 -7
- package/dist/builds/fetch.js +312 -1
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +312 -1
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +312 -1
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +312 -1
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +145 -3
- package/dist/node.d.cts +145 -3
- package/dist/node.d.ts +145 -3
- package/dist/src/abtestingV3Client.cjs +312 -1
- package/dist/src/abtestingV3Client.cjs.map +1 -1
- package/dist/src/abtestingV3Client.js +312 -1
- package/dist/src/abtestingV3Client.js.map +1 -1
- package/dist/worker.d.ts +145 -3
- package/package.json +9 -9
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@algolia/abtesting"] = {}));
|
|
5
5
|
})(this, (function (exports) { 'use strict';
|
|
6
6
|
|
|
7
|
-
function
|
|
8
|
-
`&&(n=1));n<
|
|
9
|
-
`,n);if(
|
|
10
|
-
`?2:1:(
|
|
11
|
-
`),event:t,id:this.lastEventId,retry:this.retry};return this.data=[],e}};async function*he(t){let e=new fe;for await(let s of pe(t)){let r=e.decode(s);r!==null&&(yield r);}}var ge=750,J=120*1e3;function M(t,e="up"){let s=Date.now();function r(){return e==="up"||Date.now()-s>J}function a(){return e==="timed out"&&Date.now()-s<=J}return {...t,status:e,lastUpdate:s,isUp:r,isTimedOut:a}}var re=class extends Error{name="AlgoliaError";constructor(t,e){super(t),e&&(this.name=e);}};var se=class extends re{stackTrace;constructor(t,e,s){super(t,s),this.stackTrace=e;}},Q=class extends se{constructor(t){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",t,"RetryError");}},$=class extends se{status;constructor(t,e,s,r="ApiError"){super(t,s,r),this.status=e;}},ye=class extends re{response;constructor(t,e){super(t,"DeserializationError"),this.response=e;}},Pe=class extends ${error;constructor(t,e,s,r){super(t,e,r,"DetailedApiError"),this.error=s;}};function V(t,e,s){let r=Te(s),a=`${t.protocol}://${t.url}${t.port?`:${t.port}`:""}/${e.charAt(0)==="/"?e.substring(1):e}`;return r.length&&(a+=`?${r}`),a}function Te(t){return Object.keys(t).filter(e=>t[e]!==void 0).sort().map(e=>`${e}=${encodeURIComponent(Object.prototype.toString.call(t[e])==="[object Array]"?t[e].join(","):t[e]).replace(/\+/g,"%20")}`).join("&")}function X(t,e){if(t.method==="GET"||t.data===void 0&&e.data===void 0)return;let s=Array.isArray(t.data)?t.data:{...t.data,...e.data};return JSON.stringify(s)}function K(t,e,s){let r={Accept:"application/json",...t,...e,...s},a={};return Object.keys(r).forEach(d=>{let h=r[d];a[d.toLowerCase()]=h;}),a}function Ae(t){if(!(t.status===204||t.content.length===0))try{return JSON.parse(t.content)}catch(e){throw new ye(e.message,t)}}function Ee({content:t,status:e},s){try{let r=JSON.parse(t);return "error"in r?new Pe(r.message,e,r.error,s):new $(r.message,e,s)}catch{}return new $(t,e,s)}function Re({isTimedOut:t,status:e}){return !t&&~~e===0}function ve({isTimedOut:t,status:e}){return t||Re({isTimedOut:t,status:e})||~~(e/100)!==2&&~~(e/100)!==4}function xe({status:t}){return ~~(t/100)===2}function qe(t){return t.map(e=>oe(e))}function oe(t){let e=t.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...t,request:{...t.request,headers:{...t.request.headers,...e}}}}function ne({hosts:t,hostsCache:e,baseHeaders:s,logger:r,baseQueryParameters:a,algoliaAgent:d,timeouts:h,requester:c,requestsCache:o,responsesCache:n,compress:u,compression:p}){async function f(i){let l=await Promise.all(i.map(g=>e.get(g,()=>Promise.resolve(M(g))))),q=l.filter(g=>g.isUp()),R=l.filter(g=>g.isTimedOut()),x=[...q,...R];return {hosts:x.length>0?x:i,getTimeout(g,S){return (R.length===0&&g===0?1:R.length+3+g)*S}}}async function m(i,l,q){let R=[],x=X(i,l),A=K(s,i.headers,l.headers),g=p==="gzip"&&x!==void 0&&x.length>ge&&(i.method==="POST"||i.method==="PUT");g&&u===void 0&&r.info("Compression is disabled because no compress method is available.");let S=g&&u!==void 0,L=S?await u(x):x;S&&(A["content-encoding"]="gzip");let I=i.method==="GET"?{...i.data,...l.data}:{},b={...a,...i.queryParameters,...I};if(d.value&&(b["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let E of Object.keys(l.queryParameters))!l.queryParameters[E]||Object.prototype.toString.call(l.queryParameters[E])==="[object Object]"?b[E]=l.queryParameters[E]:b[E]=l.queryParameters[E].toString();let B=0,_=async(E,k)=>{let C=E.pop();if(C===void 0)throw new Q(qe(R));let U={...h,...l.timeouts},G={data:L,headers:A,method:i.method,url:V(C,i.path,b),connectTimeout:k(B,U.connect),responseTimeout:k(B,q?U.read:U.write)},W=H=>{let z={request:G,response:H,host:C,triesLeft:E.length};return R.push(z),z},w=await c.send(G);if(ve(w)){let H=W(w);return w.isTimedOut&&B++,r.info("Retryable failure",oe(H)),await e.set(C,M(C,w.isTimedOut?"timed out":"down")),_(E,k)}if(xe(w))return Ae(w);throw W(w),Ee(w,R)},v=t.filter(E=>E.accept==="readWrite"||(q?E.accept==="read":E.accept==="write")),F=await f(v);return _([...F.hosts].reverse(),F.getTimeout)}function T(i,l={}){let q=()=>m(i,l,R),R=i.useReadTransporter||i.method==="GET";if((l.cacheable||i.cacheable)!==true)return q();let A={request:i,requestOptions:l,transporter:{queryParameters:a,headers:s}};return n.get(A,()=>o.get(A,()=>o.set(A,q()).then(g=>Promise.all([o.delete(A),g]),g=>Promise.all([o.delete(A),Promise.reject(g)])).then(([g,S])=>S)),{miss:g=>n.set(A,g)})}async function*y(i,l={}){if(!c.sendStream)throw new Error("This requester does not support streaming");let q=X(i,l),R=K(s,i.headers,l.headers);R.accept="text/event-stream";let x=i.method==="GET"?{...i.data,...l.data}:{},A={...a,...i.queryParameters,...x};if(d.value&&(A["x-algolia-agent"]=d.value),l&&l.queryParameters)for(let v of Object.keys(l.queryParameters))!l.queryParameters[v]||Object.prototype.toString.call(l.queryParameters[v])==="[object Object]"?A[v]=l.queryParameters[v]:A[v]=l.queryParameters[v].toString();let g=i.useReadTransporter||i.method==="GET",S=t.filter(v=>v.accept==="readWrite"||(g?v.accept==="read":v.accept==="write")),I=(await f(S)).hosts[0];if(!I)throw new Q([]);let b={...h,...l.timeouts},B={data:q,headers:R,method:i.method,url:V(I,i.path,A),connectTimeout:b.connect,responseTimeout:g?b.read:b.write},_=await c.sendStream(B);yield*he(_);}return {hostsCache:e,requester:c,timeouts:h,logger:r,algoliaAgent:d,baseHeaders:s,baseQueryParameters:a,hosts:t,request:T,requestStream:y,requestsCache:o,responsesCache:n}}function P(t,e,s){if(s==null||typeof s=="string"&&s.length===0)throw new Error(`Parameter \`${t}\` is required when calling \`${e}\`.`)}function ae(){function t(e){return new Promise(s=>{let r=new XMLHttpRequest;r.open(e.method,e.url,true),Object.keys(e.headers).forEach(c=>r.setRequestHeader(c,e.headers[c]));let a=(c,o)=>setTimeout(()=>{r.abort(),s({status:0,content:o,isTimedOut:true});},c),d=a(e.connectTimeout,"Connection timeout"),h;r.onreadystatechange=()=>{r.readyState>r.OPENED&&h===void 0&&(clearTimeout(d),h=a(e.responseTimeout,"Socket timeout"));},r.onerror=()=>{r.status===0&&(clearTimeout(d),clearTimeout(h),s({content:r.responseText||"Network request failed",status:r.status,isTimedOut:false}));},r.onload=()=>{clearTimeout(d),clearTimeout(h),s({content:r.responseText,status:r.status,isTimedOut:false});},r.send(e.data);})}return {send:t}}var D="1.21.1",j=["de","us"];function Se(t){return [{url:t?"analytics.{region}.algolia.com".replace("{region}",t):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function ie({appId:t,apiKey:e,authMode:s,algoliaAgents:r,region:a,...d}){let h=Z(t,e,s),c=ne({hosts:Se(a),...d,algoliaAgent:ee({algoliaAgents:r,client:"AbtestingV3",version:D}),baseHeaders:{"content-type":"text/plain",...h.headers(),...d.baseHeaders},baseQueryParameters:{...h.queryParameters(),...d.baseQueryParameters}});return {transporter:c,appId:t,apiKey:e,clearCache(){return Promise.all([c.requestsCache.clear(),c.responsesCache.clear()]).then(()=>{})},get _ua(){return c.algoliaAgent.value},addAlgoliaAgent(o,n){c.algoliaAgent.add({segment:o,version:n});},setClientApiKey({apiKey:o}){!s||s==="WithinHeaders"?c.baseHeaders["x-algolia-api-key"]=o:c.baseQueryParameters["x-algolia-api-key"]=o;},addABTests(o,n){P("addABTestsRequest","addABTests",o),P("addABTestsRequest.name","addABTests",o.name),P("addABTestsRequest.variants","addABTests",o.variants),P("addABTestsRequest.metrics","addABTests",o.metrics),P("addABTestsRequest.endAt","addABTests",o.endAt);let m={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:o};return c.request(m,n)},customDelete({path:o,parameters:n},u){P("path","customDelete",o);let T={method:"DELETE",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return c.request(T,u)},customGet({path:o,parameters:n},u){P("path","customGet",o);let T={method:"GET",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{}};return c.request(T,u)},customPost({path:o,parameters:n,body:u},p){P("path","customPost",o);let y={method:"POST",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return c.request(y,p)},customPut({path:o,parameters:n,body:u},p){P("path","customPut",o);let y={method:"PUT",path:"/{path}".replace("{path}",o),queryParameters:n||{},headers:{},data:u||{}};return c.request(y,p)},deleteABTest({id:o},n){P("id","deleteABTest",o);let m={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(m,n)},estimateABTest(o,n){P("estimateABTestRequest","estimateABTest",o),P("estimateABTestRequest.configuration","estimateABTest",o.configuration),P("estimateABTestRequest.variants","estimateABTest",o.variants);let m={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:o};return c.request(m,n)},getABTest({id:o},n){P("id","getABTest",o);let m={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(m,n)},getTimeseries({id:o,startDate:n,endDate:u,metric:p},f){P("id","getTimeseries",o);let m="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(o)),T={},y={};n!==void 0&&(y.startDate=n.toString()),u!==void 0&&(y.endDate=u.toString()),p!==void 0&&(y.metric=p.toString());let i={method:"GET",path:m,queryParameters:y,headers:T};return c.request(i,f)},listABTests({offset:o,limit:n,indexPrefix:u,indexSuffix:p,direction:f}={},m=void 0){let T="/3/abtests",y={},i={};o!==void 0&&(i.offset=o.toString()),n!==void 0&&(i.limit=n.toString()),u!==void 0&&(i.indexPrefix=u.toString()),p!==void 0&&(i.indexSuffix=p.toString()),f!==void 0&&(i.direction=f.toString());let l={method:"GET",path:T,queryParameters:i,headers:y};return c.request(l,m)},stopABTest({id:o},n){P("id","stopABTest",o);let m={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(o)),queryParameters:{},headers:{}};return c.request(m,n)}}}function At(t,e,s,r){if(!t||typeof t!="string")throw new Error("`appId` is missing.");if(!e||typeof e!="string")throw new Error("`apiKey` is missing.");if(s&&(typeof s!="string"||!j.includes(s)))throw new Error(`\`region\` must be one of the following: ${j.join(", ")}`);let{compression:a,...d}=r||{};return ie({appId:t,apiKey:e,region:s,timeouts:{connect:1e3,read:2e3,write:3e4},logger:te(),requester:ae(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:N(),requestsCache:N({serializable:false}),hostsCache:O({caches:[Y({key:`${D}-${t}`}),N()]}),...d})}
|
|
7
|
+
function Z(e){let t,o=`algolia-client-js-${e.key}`;function s(){return t===void 0&&(t=e.localStorage||window.localStorage),t}function d(){return JSON.parse(s().getItem(o)||"{}")}function f(r){s().setItem(o,JSON.stringify(r));}function y(){return new Promise(r=>setTimeout(r,0))}function i(){let r=e.timeToLive?e.timeToLive*1e3:null,n=d(),a=new Date().getTime(),c=false;return {namespace:Object.fromEntries(Object.entries(n).filter(([,u])=>!u||u.timestamp===void 0||r&&u.timestamp+r<a?(c=true,false):true)),changed:c}}return {get(r,n,a={miss:()=>Promise.resolve()}){return y().then(()=>{let{namespace:c,changed:l}=i(),u=c[JSON.stringify(r)];return l&&f(c),u?u.value:n().then(T=>a.miss(T).then(()=>T))})},set(r,n){return y().then(()=>{let a=d();return a[JSON.stringify(r)]={timestamp:new Date().getTime(),value:n},s().setItem(o,JSON.stringify(a)),n})},delete(r){return y().then(()=>{let n=d();delete n[JSON.stringify(r)],s().setItem(o,JSON.stringify(n));})},clear(){return Promise.resolve().then(()=>{s().removeItem(o);})}}}function de(){return {get(e,t,o={miss:()=>Promise.resolve()}){return t().then(d=>Promise.all([d,o.miss(d)])).then(([d])=>d)},set(e,t){return Promise.resolve(t)},delete(e){return Promise.resolve()},clear(){return Promise.resolve()}}}function b(e){let t=[...e.caches],o=t.shift();return o===void 0?de():{get(s,d,f={miss:()=>Promise.resolve()}){return o.get(s,d,f).catch(()=>b({caches:t}).get(s,d,f))},set(s,d){return o.set(s,d).catch(()=>b({caches:t}).set(s,d))},delete(s){return o.delete(s).catch(()=>b({caches:t}).delete(s))},clear(){return o.clear().catch(()=>b({caches:t}).clear())}}}function D(e={serializable:true}){let t={};return {get(o,s,d={miss:()=>Promise.resolve()}){let f=JSON.stringify(o);if(f in t)return Promise.resolve(e.serializable?JSON.parse(t[f]):t[f]);let y=s();return y.then(i=>d.miss(i)).then(()=>y)},set(o,s){return t[JSON.stringify(o)]=e.serializable?JSON.stringify(s):s,Promise.resolve(s)},delete(o){return delete t[JSON.stringify(o)],Promise.resolve()},clear(){return t={},Promise.resolve()}}}function le(e){let t={value:`Algolia for JavaScript (${e})`,add(o){let s=`; ${o.segment}${o.version!==void 0?` (${o.version})`:""}`;return t.value.indexOf(s)===-1&&(t.value=`${t.value}${s}`),t}};return t}function ee(e,t,o="WithinHeaders"){let s={"x-algolia-api-key":t,"x-algolia-application-id":e};return {headers(){return o==="WithinHeaders"?s:{}},queryParameters(){return o==="WithinQueryParameters"?s:{}}}}function te({algoliaAgents:e,client:t,version:o}){let s=le(o).add({segment:t,version:o});return e.forEach(d=>s.add(d)),s}function re(){return {debug(e,t){return Promise.resolve()},info(e,t){return Promise.resolve()},error(e,t){return Promise.resolve()}}}var me=10*1024*1024;async function*pe(e){let t=e.getReader();try{for(;;){let{done:o,value:s}=await t.read();if(o)return;yield s;}}finally{t.releaseLock();}}function he(e){return Symbol.asyncIterator in e?e:pe(e)}async function*fe(e){let t=new TextDecoder("utf-8"),o=[],s=0,d=false,f=true;for await(let i of he(e)){let r=t.decode(i,{stream:true}),n=0;for(d&&(d=false,r.length>0&&r[0]===`
|
|
8
|
+
`&&(n=1));n<r.length;){let a=r.indexOf("\r",n),c=r.indexOf(`
|
|
9
|
+
`,n);if(a===-1&&c===-1){let q=r.slice(n);if(o.push(q),s+=q.length,s>me)throw new Error("SSE line buffer exceeded 10MB");break}let l,u;a!==-1&&(c===-1||a<c)?(l=a,a+1<r.length?u=r[a+1]===`
|
|
10
|
+
`?2:1:(d=true,u=1)):(l=c,u=1);let T=r.slice(n,l);o.push(T);let P=o.length===1?o[0]:o.join("");o.length=0,s=0,f&&(P.startsWith("\uFEFF")&&(P=P.slice(1)),f=false),yield P,n=l+u;}}let y=t.decode();if(y&&o.push(y),o.length>0){let i=o.join("");f&&i.startsWith("\uFEFF")&&(i=i.slice(1)),yield i;}}var Pe=class{data=[];eventType="";lastEventId=null;retry=null;decode(e){if(e==="")return this.dispatch();if(e[0]===":")return null;let t=e.indexOf(":"),o,s;switch(t===-1?(o=e,s=""):(o=e.slice(0,t),s=e.slice(t+1),s[0]===" "&&(s=s.slice(1))),o){case "data":this.data.push(s);break;case "event":this.eventType=s;break;case "id":s.includes("\0")||(this.lastEventId=s);break;case "retry":/^[0-9]+$/.test(s)&&(this.retry=parseInt(s,10));break}return null}dispatch(){let e=this.eventType;if(this.eventType="",this.data.length===0)return null;let t={data:this.data.join(`
|
|
11
|
+
`),event:e,id:this.lastEventId,retry:this.retry};return this.data=[],t}};async function*Te(e){let t=new Pe;for await(let o of fe(e)){let s=t.decode(o);s!==null&&(yield s);}}var ge=750,J=120*1e3;function M(e,t="up"){let o=Date.now();function s(){return t==="up"||Date.now()-o>J}function d(){return t==="timed out"&&Date.now()-o<=J}return {...e,status:t,lastUpdate:o,isUp:s,isTimedOut:d}}var se=class extends Error{name="AlgoliaError";constructor(e,t){super(e),t&&(this.name=t);}};var oe=class extends se{stackTrace;constructor(e,t,o){super(e,o),this.stackTrace=t;}},V=class extends oe{constructor(e){super("Unreachable hosts - your application id may be incorrect. If the error persists, please visit our help center https://alg.li/support-unreachable-hosts or reach out to the Algolia Support team: https://alg.li/support",e,"RetryError");}},G=class extends oe{status;constructor(e,t,o,s="ApiError"){super(e,o,s),this.status=t;}},ye=class extends se{response;constructor(e,t){super(e,"DeserializationError"),this.response=t;}},qe=class extends G{error;constructor(e,t,o,s){super(e,t,s,"DetailedApiError"),this.error=o;}};function X(e,t,o){let s=Ae(o),d=`${e.protocol}://${e.url}${e.port?`:${e.port}`:""}/${t.charAt(0)==="/"?t.substring(1):t}`;return s.length&&(d+=`?${s}`),d}function Ae(e){return Object.keys(e).filter(t=>e[t]!==void 0).sort().map(t=>`${t}=${encodeURIComponent(Object.prototype.toString.call(e[t])==="[object Array]"?e[t].join(","):e[t]).replace(/\+/g,"%20")}`).join("&")}function K(e,t){if(e.method==="GET"||e.data===void 0&&t.data===void 0)return;let o=Array.isArray(e.data)?e.data:{...e.data,...t.data};return JSON.stringify(o)}function Y(e,t,o){let s={Accept:"application/json",...e,...t,...o},d={};return Object.keys(s).forEach(f=>{let y=s[f];d[f.toLowerCase()]=y;}),d}function ne(e){if(!(e.status===204||e.content.length===0))try{return JSON.parse(e.content)}catch(t){throw new ye(t.message,e)}}function Re(e){return {status:e.status,headers:e.headers,content:e.content,data:ne(e)}}function Ee({content:e,status:t},o){try{let s=JSON.parse(e);return "error"in s?new qe(s.message,t,s.error,o):new G(s.message,t,o)}catch{}return new G(e,t,o)}function ve({isTimedOut:e,status:t}){return !e&&~~t===0}function Ie({isTimedOut:e,status:t}){return e||ve({isTimedOut:e,status:t})||~~(t/100)!==2&&~~(t/100)!==4}function He({status:e}){return ~~(e/100)===2}function Se(e){return e.map(t=>ae(t))}function ae(e){let t=e.request.headers["x-algolia-api-key"]?{"x-algolia-api-key":"*****"}:{};return {...e,request:{...e.request,headers:{...e.request.headers,...t}}}}function ie({hosts:e,hostsCache:t,baseHeaders:o,logger:s,baseQueryParameters:d,algoliaAgent:f,timeouts:y,requester:i,requestsCache:r,responsesCache:n,compress:a,compression:c}){async function l(m){let h=await Promise.all(m.map(g=>t.get(g,()=>Promise.resolve(M(g))))),I=h.filter(g=>g.isUp()),R=h.filter(g=>g.isTimedOut()),H=[...I,...R];return {hosts:H.length>0?H:m,getTimeout(g,S){return (R.length===0&&g===0?1:R.length+3+g)*S}}}async function u(m,h,I){let R=[],H=K(m,h),A=Y(o,m.headers,h.headers),g=c==="gzip"&&H!==void 0&&H.length>ge&&(m.method==="POST"||m.method==="PUT");g&&a===void 0&&s.info("Compression is disabled because no compress method is available.");let S=g&&a!==void 0,_=S?await a(H):H;S&&(A["content-encoding"]="gzip");let C=m.method==="GET"?{...m.data,...h.data}:{},x={...d,...m.queryParameters,...C};if(f.value&&(x["x-algolia-agent"]=f.value),h&&h.queryParameters)for(let E of Object.keys(h.queryParameters))!h.queryParameters[E]||Object.prototype.toString.call(h.queryParameters[E])==="[object Object]"?x[E]=h.queryParameters[E]:x[E]=h.queryParameters[E].toString();let w=0,W=async(E,N)=>{let O=E.pop();if(O===void 0)throw new V(Se(R));let k={...y,...h.timeouts},j={data:_,headers:A,method:m.method,url:X(O,m.path,x),connectTimeout:N(w,k.connect),responseTimeout:N(w,I?k.read:k.write)},F=U=>{let z={request:j,response:U,host:O,triesLeft:E.length};return R.push(z),z},B=await i.send(j);if(Ie(B)){let U=F(B);return B.isTimedOut&&w++,s.info("Retryable failure",ae(U)),await t.set(O,M(O,B.isTimedOut?"timed out":"down")),W(E,N)}if(He(B))return B;throw F(B),Ee(B,R)},v=e.filter(E=>E.accept==="readWrite"||(I?E.accept==="read":E.accept==="write")),$=await l(v);return W([...$.hosts].reverse(),$.getTimeout)}function T(m,h={}){let I=()=>u(m,h,R).then(g=>ne(g)),R=m.useReadTransporter||m.method==="GET";if((h.cacheable||m.cacheable)!==true)return I();let A={request:m,requestOptions:h,transporter:{queryParameters:d,headers:o}};return n.get(A,()=>r.get(A,()=>r.set(A,I()).then(g=>Promise.all([r.delete(A),g]),g=>Promise.all([r.delete(A),Promise.reject(g)])).then(([g,S])=>S)),{miss:g=>n.set(A,g)})}function P(m,h={}){let I=m.useReadTransporter||m.method==="GET";return u(m,h,I).then(R=>Re(R))}async function*q(m,h={}){if(!i.sendStream)throw new Error("This requester does not support streaming");let I=K(m,h),R=Y(o,m.headers,h.headers);R.accept="text/event-stream";let H=m.method==="GET"?{...m.data,...h.data}:{},A={...d,...m.queryParameters,...H};if(f.value&&(A["x-algolia-agent"]=f.value),h&&h.queryParameters)for(let v of Object.keys(h.queryParameters))!h.queryParameters[v]||Object.prototype.toString.call(h.queryParameters[v])==="[object Object]"?A[v]=h.queryParameters[v]:A[v]=h.queryParameters[v].toString();let g=m.useReadTransporter||m.method==="GET",S=e.filter(v=>v.accept==="readWrite"||(g?v.accept==="read":v.accept==="write")),C=(await l(S)).hosts[0];if(!C)throw new V([]);let x={...y,...h.timeouts},w={data:I,headers:R,method:m.method,url:X(C,m.path,A),connectTimeout:x.connect,responseTimeout:g?x.read:x.write},W=await i.sendStream(w);yield*Te(W);}return {hostsCache:t,requester:i,timeouts:y,logger:s,algoliaAgent:f,baseHeaders:o,baseQueryParameters:d,hosts:e,request:T,requestWithHttpInfo:P,requestStream:q,requestsCache:r,responsesCache:n}}function p(e,t,o){if(o==null||typeof o=="string"&&o.length===0)throw new Error(`Parameter \`${e}\` is required when calling \`${t}\`.`)}function xe(e){let t={};for(let o of e.trim().split(/[\r\n]+/)){let s=o.indexOf(": ");s>0&&(t[o.slice(0,s).toLowerCase()]=o.slice(s+2));}return t}function ue(){function e(t){return new Promise(o=>{let s=new XMLHttpRequest;s.open(t.method,t.url,true),Object.keys(t.headers).forEach(i=>s.setRequestHeader(i,t.headers[i]));let d=(i,r)=>setTimeout(()=>{s.abort(),o({status:0,content:r,isTimedOut:true});},i),f=d(t.connectTimeout,"Connection timeout"),y;s.onreadystatechange=()=>{s.readyState>s.OPENED&&y===void 0&&(clearTimeout(f),y=d(t.responseTimeout,"Socket timeout"));},s.onerror=()=>{s.status===0&&(clearTimeout(f),clearTimeout(y),o({content:s.responseText||"Network request failed",status:s.status,isTimedOut:false}));},s.onload=()=>{clearTimeout(f),clearTimeout(y),o({content:s.responseText,headers:xe(s.getAllResponseHeaders()),status:s.status,isTimedOut:false});},s.send(t.data);})}return {send:e}}var L="1.22.0",Q=["de","us"];function Be(e){return [{url:e?"analytics.{region}.algolia.com".replace("{region}",e):"analytics.algolia.com",accept:"readWrite",protocol:"https"}]}function ce({appId:e,apiKey:t,authMode:o,algoliaAgents:s,region:d,...f}){let y=ee(e,t,o),i=ie({hosts:Be(d),...f,algoliaAgent:te({algoliaAgents:s,client:"AbtestingV3",version:L}),baseHeaders:{"content-type":"text/plain",...y.headers(),...f.baseHeaders},baseQueryParameters:{...y.queryParameters(),...f.baseQueryParameters}});return {transporter:i,appId:e,apiKey:t,clearCache(){return Promise.all([i.requestsCache.clear(),i.responsesCache.clear()]).then(()=>{})},get _ua(){return i.algoliaAgent.value},addAlgoliaAgent(r,n){i.algoliaAgent.add({segment:r,version:n});},setClientApiKey({apiKey:r}){!o||o==="WithinHeaders"?i.baseHeaders["x-algolia-api-key"]=r:i.baseQueryParameters["x-algolia-api-key"]=r;},addABTests(r,n){p("addABTestsRequest","addABTests",r),p("addABTestsRequest.name","addABTests",r.name),p("addABTestsRequest.variants","addABTests",r.variants),p("addABTestsRequest.metrics","addABTests",r.metrics),p("addABTestsRequest.endAt","addABTests",r.endAt);let u={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:r};return i.request(u,n)},addABTestsWithHTTPInfo(r,n){p("addABTestsRequest","addABTestsWithHTTPInfo",r),p("addABTestsRequest.name","addABTestsWithHTTPInfo",r.name),p("addABTestsRequest.variants","addABTestsWithHTTPInfo",r.variants),p("addABTestsRequest.metrics","addABTestsWithHTTPInfo",r.metrics),p("addABTestsRequest.endAt","addABTestsWithHTTPInfo",r.endAt);let u={method:"POST",path:"/3/abtests",queryParameters:{},headers:{},data:r};return i.requestWithHttpInfo(u,n)},customDelete({path:r,parameters:n},a){p("path","customDelete",r);let T={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return i.request(T,a)},customDeleteWithHTTPInfo({path:r,parameters:n},a){p("path","customDeleteWithHTTPInfo",r);let T={method:"DELETE",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return i.requestWithHttpInfo(T,a)},customGet({path:r,parameters:n},a){p("path","customGet",r);let T={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return i.request(T,a)},customGetWithHTTPInfo({path:r,parameters:n},a){p("path","customGetWithHTTPInfo",r);let T={method:"GET",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{}};return i.requestWithHttpInfo(T,a)},customPost({path:r,parameters:n,body:a},c){p("path","customPost",r);let P={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return i.request(P,c)},customPostWithHTTPInfo({path:r,parameters:n,body:a},c){p("path","customPostWithHTTPInfo",r);let P={method:"POST",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return i.requestWithHttpInfo(P,c)},customPut({path:r,parameters:n,body:a},c){p("path","customPut",r);let P={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return i.request(P,c)},customPutWithHTTPInfo({path:r,parameters:n,body:a},c){p("path","customPutWithHTTPInfo",r);let P={method:"PUT",path:"/{path}".replace("{path}",r),queryParameters:n||{},headers:{},data:a||{}};return i.requestWithHttpInfo(P,c)},deleteABTest({id:r},n){p("id","deleteABTest",r);let u={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.request(u,n)},deleteABTestWithHTTPInfo({id:r},n){p("id","deleteABTestWithHTTPInfo",r);let u={method:"DELETE",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.requestWithHttpInfo(u,n)},estimateABTest(r,n){p("estimateABTestRequest","estimateABTest",r),p("estimateABTestRequest.configuration","estimateABTest",r.configuration),p("estimateABTestRequest.variants","estimateABTest",r.variants);let u={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:r};return i.request(u,n)},estimateABTestWithHTTPInfo(r,n){p("estimateABTestRequest","estimateABTestWithHTTPInfo",r),p("estimateABTestRequest.configuration","estimateABTestWithHTTPInfo",r.configuration),p("estimateABTestRequest.variants","estimateABTestWithHTTPInfo",r.variants);let u={method:"POST",path:"/3/abtests/estimate",queryParameters:{},headers:{},data:r};return i.requestWithHttpInfo(u,n)},getABTest({id:r},n){p("id","getABTest",r);let u={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.request(u,n)},getABTestWithHTTPInfo({id:r},n){p("id","getABTestWithHTTPInfo",r);let u={method:"GET",path:"/3/abtests/{id}".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.requestWithHttpInfo(u,n)},getTimeseries({id:r,startDate:n,endDate:a,metric:c},l){p("id","getTimeseries",r);let u="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(r)),T={},P={};n!==void 0&&(P.startDate=n.toString()),a!==void 0&&(P.endDate=a.toString()),c!==void 0&&(P.metric=c.toString());let q={method:"GET",path:u,queryParameters:P,headers:T};return i.request(q,l)},getTimeseriesWithHTTPInfo({id:r,startDate:n,endDate:a,metric:c},l){p("id","getTimeseriesWithHTTPInfo",r);let u="/3/abtests/{id}/timeseries".replace("{id}",encodeURIComponent(r)),T={},P={};n!==void 0&&(P.startDate=n.toString()),a!==void 0&&(P.endDate=a.toString()),c!==void 0&&(P.metric=c.toString());let q={method:"GET",path:u,queryParameters:P,headers:T};return i.requestWithHttpInfo(q,l)},listABTests({offset:r,limit:n,indexPrefix:a,indexSuffix:c,direction:l}={},u=void 0){let T="/3/abtests",P={},q={};r!==void 0&&(q.offset=r.toString()),n!==void 0&&(q.limit=n.toString()),a!==void 0&&(q.indexPrefix=a.toString()),c!==void 0&&(q.indexSuffix=c.toString()),l!==void 0&&(q.direction=l.toString());let m={method:"GET",path:T,queryParameters:q,headers:P};return i.request(m,u)},listABTestsWithHTTPInfo({offset:r,limit:n,indexPrefix:a,indexSuffix:c,direction:l}={},u=void 0){let T="/3/abtests",P={},q={};r!==void 0&&(q.offset=r.toString()),n!==void 0&&(q.limit=n.toString()),a!==void 0&&(q.indexPrefix=a.toString()),c!==void 0&&(q.indexSuffix=c.toString()),l!==void 0&&(q.direction=l.toString());let m={method:"GET",path:T,queryParameters:q,headers:P};return i.requestWithHttpInfo(m,u)},stopABTest({id:r},n){p("id","stopABTest",r);let u={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.request(u,n)},stopABTestWithHTTPInfo({id:r},n){p("id","stopABTestWithHTTPInfo",r);let u={method:"POST",path:"/3/abtests/{id}/stop".replace("{id}",encodeURIComponent(r)),queryParameters:{},headers:{}};return i.requestWithHttpInfo(u,n)}}}function Et(e,t,o,s){if(!e||typeof e!="string")throw new Error("`appId` is missing.");if(!t||typeof t!="string")throw new Error("`apiKey` is missing.");if(o&&(typeof o!="string"||!Q.includes(o)))throw new Error(`\`region\` must be one of the following: ${Q.join(", ")}`);let{compression:d,...f}=s||{};return ce({appId:e,apiKey:t,region:o,timeouts:{connect:1e3,read:2e3,write:3e4},logger:re(),requester:ue(),algoliaAgents:[{segment:"Browser"}],authMode:"WithinQueryParameters",responsesCache:D(),requestsCache:D({serializable:false}),hostsCache:b({caches:[Z({key:`${L}-${e}`}),D()]}),...f})}
|
|
12
12
|
|
|
13
|
-
exports.abtestingV3Client =
|
|
14
|
-
exports.apiClientVersion =
|
|
13
|
+
exports.abtestingV3Client = Et;
|
|
14
|
+
exports.apiClientVersion = L;
|
|
15
15
|
|
|
16
16
|
}));
|
package/dist/builds/fetch.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createFetchRequester } from "@algolia/requester-fetch";
|
|
|
5
5
|
|
|
6
6
|
// src/abtestingV3Client.ts
|
|
7
7
|
import { createAuth, createTransporter, getAlgoliaAgent, validateRequired } from "@algolia/client-common";
|
|
8
|
-
var apiClientVersion = "1.
|
|
8
|
+
var apiClientVersion = "1.22.0";
|
|
9
9
|
var REGIONS = ["de", "us"];
|
|
10
10
|
function getDefaultHosts(region) {
|
|
11
11
|
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
|
|
@@ -108,6 +108,35 @@ function createAbtestingV3Client({
|
|
|
108
108
|
};
|
|
109
109
|
return transporter.request(request, requestOptions);
|
|
110
110
|
},
|
|
111
|
+
/**
|
|
112
|
+
* Creates a new A/B test.
|
|
113
|
+
*
|
|
114
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
115
|
+
*
|
|
116
|
+
* Required API Key ACLs:
|
|
117
|
+
* - editSettings
|
|
118
|
+
* @param addABTestsRequest - The addABTestsRequest object.
|
|
119
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
120
|
+
* @see addABTests for the plain version.
|
|
121
|
+
*/
|
|
122
|
+
addABTestsWithHTTPInfo(addABTestsRequest, requestOptions) {
|
|
123
|
+
validateRequired("addABTestsRequest", "addABTestsWithHTTPInfo", addABTestsRequest);
|
|
124
|
+
validateRequired("addABTestsRequest.name", "addABTestsWithHTTPInfo", addABTestsRequest.name);
|
|
125
|
+
validateRequired("addABTestsRequest.variants", "addABTestsWithHTTPInfo", addABTestsRequest.variants);
|
|
126
|
+
validateRequired("addABTestsRequest.metrics", "addABTestsWithHTTPInfo", addABTestsRequest.metrics);
|
|
127
|
+
validateRequired("addABTestsRequest.endAt", "addABTestsWithHTTPInfo", addABTestsRequest.endAt);
|
|
128
|
+
const requestPath = "/3/abtests";
|
|
129
|
+
const headers = {};
|
|
130
|
+
const queryParameters = {};
|
|
131
|
+
const request = {
|
|
132
|
+
method: "POST",
|
|
133
|
+
path: requestPath,
|
|
134
|
+
queryParameters,
|
|
135
|
+
headers,
|
|
136
|
+
data: addABTestsRequest
|
|
137
|
+
};
|
|
138
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
139
|
+
},
|
|
111
140
|
/**
|
|
112
141
|
* This method lets you send requests to the Algolia REST API.
|
|
113
142
|
* @param customDelete - The customDelete object.
|
|
@@ -128,6 +157,29 @@ function createAbtestingV3Client({
|
|
|
128
157
|
};
|
|
129
158
|
return transporter.request(request, requestOptions);
|
|
130
159
|
},
|
|
160
|
+
/**
|
|
161
|
+
* This method lets you send requests to the Algolia REST API.
|
|
162
|
+
*
|
|
163
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
164
|
+
* @param customDelete - The customDelete object.
|
|
165
|
+
* @param customDelete.path - Path of the endpoint, for example `1/newFeature`.
|
|
166
|
+
* @param customDelete.parameters - Query parameters to apply to the current query.
|
|
167
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
168
|
+
* @see customDelete for the plain version.
|
|
169
|
+
*/
|
|
170
|
+
customDeleteWithHTTPInfo({ path, parameters }, requestOptions) {
|
|
171
|
+
validateRequired("path", "customDeleteWithHTTPInfo", path);
|
|
172
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
173
|
+
const headers = {};
|
|
174
|
+
const queryParameters = parameters ? parameters : {};
|
|
175
|
+
const request = {
|
|
176
|
+
method: "DELETE",
|
|
177
|
+
path: requestPath,
|
|
178
|
+
queryParameters,
|
|
179
|
+
headers
|
|
180
|
+
};
|
|
181
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
182
|
+
},
|
|
131
183
|
/**
|
|
132
184
|
* This method lets you send requests to the Algolia REST API.
|
|
133
185
|
* @param customGet - The customGet object.
|
|
@@ -148,6 +200,29 @@ function createAbtestingV3Client({
|
|
|
148
200
|
};
|
|
149
201
|
return transporter.request(request, requestOptions);
|
|
150
202
|
},
|
|
203
|
+
/**
|
|
204
|
+
* This method lets you send requests to the Algolia REST API.
|
|
205
|
+
*
|
|
206
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
207
|
+
* @param customGet - The customGet object.
|
|
208
|
+
* @param customGet.path - Path of the endpoint, for example `1/newFeature`.
|
|
209
|
+
* @param customGet.parameters - Query parameters to apply to the current query.
|
|
210
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
211
|
+
* @see customGet for the plain version.
|
|
212
|
+
*/
|
|
213
|
+
customGetWithHTTPInfo({ path, parameters }, requestOptions) {
|
|
214
|
+
validateRequired("path", "customGetWithHTTPInfo", path);
|
|
215
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
216
|
+
const headers = {};
|
|
217
|
+
const queryParameters = parameters ? parameters : {};
|
|
218
|
+
const request = {
|
|
219
|
+
method: "GET",
|
|
220
|
+
path: requestPath,
|
|
221
|
+
queryParameters,
|
|
222
|
+
headers
|
|
223
|
+
};
|
|
224
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
225
|
+
},
|
|
151
226
|
/**
|
|
152
227
|
* This method lets you send requests to the Algolia REST API.
|
|
153
228
|
* @param customPost - The customPost object.
|
|
@@ -170,6 +245,31 @@ function createAbtestingV3Client({
|
|
|
170
245
|
};
|
|
171
246
|
return transporter.request(request, requestOptions);
|
|
172
247
|
},
|
|
248
|
+
/**
|
|
249
|
+
* This method lets you send requests to the Algolia REST API.
|
|
250
|
+
*
|
|
251
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
252
|
+
* @param customPost - The customPost object.
|
|
253
|
+
* @param customPost.path - Path of the endpoint, for example `1/newFeature`.
|
|
254
|
+
* @param customPost.parameters - Query parameters to apply to the current query.
|
|
255
|
+
* @param customPost.body - Parameters to send with the custom request.
|
|
256
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
257
|
+
* @see customPost for the plain version.
|
|
258
|
+
*/
|
|
259
|
+
customPostWithHTTPInfo({ path, parameters, body }, requestOptions) {
|
|
260
|
+
validateRequired("path", "customPostWithHTTPInfo", path);
|
|
261
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
262
|
+
const headers = {};
|
|
263
|
+
const queryParameters = parameters ? parameters : {};
|
|
264
|
+
const request = {
|
|
265
|
+
method: "POST",
|
|
266
|
+
path: requestPath,
|
|
267
|
+
queryParameters,
|
|
268
|
+
headers,
|
|
269
|
+
data: body ? body : {}
|
|
270
|
+
};
|
|
271
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
272
|
+
},
|
|
173
273
|
/**
|
|
174
274
|
* This method lets you send requests to the Algolia REST API.
|
|
175
275
|
* @param customPut - The customPut object.
|
|
@@ -192,6 +292,31 @@ function createAbtestingV3Client({
|
|
|
192
292
|
};
|
|
193
293
|
return transporter.request(request, requestOptions);
|
|
194
294
|
},
|
|
295
|
+
/**
|
|
296
|
+
* This method lets you send requests to the Algolia REST API.
|
|
297
|
+
*
|
|
298
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
299
|
+
* @param customPut - The customPut object.
|
|
300
|
+
* @param customPut.path - Path of the endpoint, for example `1/newFeature`.
|
|
301
|
+
* @param customPut.parameters - Query parameters to apply to the current query.
|
|
302
|
+
* @param customPut.body - Parameters to send with the custom request.
|
|
303
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
304
|
+
* @see customPut for the plain version.
|
|
305
|
+
*/
|
|
306
|
+
customPutWithHTTPInfo({ path, parameters, body }, requestOptions) {
|
|
307
|
+
validateRequired("path", "customPutWithHTTPInfo", path);
|
|
308
|
+
const requestPath = "/{path}".replace("{path}", path);
|
|
309
|
+
const headers = {};
|
|
310
|
+
const queryParameters = parameters ? parameters : {};
|
|
311
|
+
const request = {
|
|
312
|
+
method: "PUT",
|
|
313
|
+
path: requestPath,
|
|
314
|
+
queryParameters,
|
|
315
|
+
headers,
|
|
316
|
+
data: body ? body : {}
|
|
317
|
+
};
|
|
318
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
319
|
+
},
|
|
195
320
|
/**
|
|
196
321
|
* Deletes an A/B test by its ID.
|
|
197
322
|
*
|
|
@@ -214,6 +339,31 @@ function createAbtestingV3Client({
|
|
|
214
339
|
};
|
|
215
340
|
return transporter.request(request, requestOptions);
|
|
216
341
|
},
|
|
342
|
+
/**
|
|
343
|
+
* Deletes an A/B test by its ID.
|
|
344
|
+
*
|
|
345
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
346
|
+
*
|
|
347
|
+
* Required API Key ACLs:
|
|
348
|
+
* - editSettings
|
|
349
|
+
* @param deleteABTest - The deleteABTest object.
|
|
350
|
+
* @param deleteABTest.id - Unique A/B test identifier.
|
|
351
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
352
|
+
* @see deleteABTest for the plain version.
|
|
353
|
+
*/
|
|
354
|
+
deleteABTestWithHTTPInfo({ id }, requestOptions) {
|
|
355
|
+
validateRequired("id", "deleteABTestWithHTTPInfo", id);
|
|
356
|
+
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
|
|
357
|
+
const headers = {};
|
|
358
|
+
const queryParameters = {};
|
|
359
|
+
const request = {
|
|
360
|
+
method: "DELETE",
|
|
361
|
+
path: requestPath,
|
|
362
|
+
queryParameters,
|
|
363
|
+
headers
|
|
364
|
+
};
|
|
365
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
366
|
+
},
|
|
217
367
|
/**
|
|
218
368
|
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
|
|
219
369
|
*
|
|
@@ -238,6 +388,37 @@ function createAbtestingV3Client({
|
|
|
238
388
|
};
|
|
239
389
|
return transporter.request(request, requestOptions);
|
|
240
390
|
},
|
|
391
|
+
/**
|
|
392
|
+
* Given the traffic percentage and the expected effect size, this endpoint estimates the sample size and duration of an A/B test based on historical traffic.
|
|
393
|
+
*
|
|
394
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
395
|
+
*
|
|
396
|
+
* Required API Key ACLs:
|
|
397
|
+
* - analytics
|
|
398
|
+
* @param estimateABTestRequest - The estimateABTestRequest object.
|
|
399
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
400
|
+
* @see estimateABTest for the plain version.
|
|
401
|
+
*/
|
|
402
|
+
estimateABTestWithHTTPInfo(estimateABTestRequest, requestOptions) {
|
|
403
|
+
validateRequired("estimateABTestRequest", "estimateABTestWithHTTPInfo", estimateABTestRequest);
|
|
404
|
+
validateRequired(
|
|
405
|
+
"estimateABTestRequest.configuration",
|
|
406
|
+
"estimateABTestWithHTTPInfo",
|
|
407
|
+
estimateABTestRequest.configuration
|
|
408
|
+
);
|
|
409
|
+
validateRequired("estimateABTestRequest.variants", "estimateABTestWithHTTPInfo", estimateABTestRequest.variants);
|
|
410
|
+
const requestPath = "/3/abtests/estimate";
|
|
411
|
+
const headers = {};
|
|
412
|
+
const queryParameters = {};
|
|
413
|
+
const request = {
|
|
414
|
+
method: "POST",
|
|
415
|
+
path: requestPath,
|
|
416
|
+
queryParameters,
|
|
417
|
+
headers,
|
|
418
|
+
data: estimateABTestRequest
|
|
419
|
+
};
|
|
420
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
421
|
+
},
|
|
241
422
|
/**
|
|
242
423
|
* Retrieves the details for an A/B test by its ID.
|
|
243
424
|
*
|
|
@@ -260,6 +441,31 @@ function createAbtestingV3Client({
|
|
|
260
441
|
};
|
|
261
442
|
return transporter.request(request, requestOptions);
|
|
262
443
|
},
|
|
444
|
+
/**
|
|
445
|
+
* Retrieves the details for an A/B test by its ID.
|
|
446
|
+
*
|
|
447
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
448
|
+
*
|
|
449
|
+
* Required API Key ACLs:
|
|
450
|
+
* - analytics
|
|
451
|
+
* @param getABTest - The getABTest object.
|
|
452
|
+
* @param getABTest.id - Unique A/B test identifier.
|
|
453
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
454
|
+
* @see getABTest for the plain version.
|
|
455
|
+
*/
|
|
456
|
+
getABTestWithHTTPInfo({ id }, requestOptions) {
|
|
457
|
+
validateRequired("id", "getABTestWithHTTPInfo", id);
|
|
458
|
+
const requestPath = "/3/abtests/{id}".replace("{id}", encodeURIComponent(id));
|
|
459
|
+
const headers = {};
|
|
460
|
+
const queryParameters = {};
|
|
461
|
+
const request = {
|
|
462
|
+
method: "GET",
|
|
463
|
+
path: requestPath,
|
|
464
|
+
queryParameters,
|
|
465
|
+
headers
|
|
466
|
+
};
|
|
467
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
468
|
+
},
|
|
263
469
|
/**
|
|
264
470
|
* Retrieves timeseries for an A/B test by its ID.
|
|
265
471
|
*
|
|
@@ -294,6 +500,43 @@ function createAbtestingV3Client({
|
|
|
294
500
|
};
|
|
295
501
|
return transporter.request(request, requestOptions);
|
|
296
502
|
},
|
|
503
|
+
/**
|
|
504
|
+
* Retrieves timeseries for an A/B test by its ID.
|
|
505
|
+
*
|
|
506
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
507
|
+
*
|
|
508
|
+
* Required API Key ACLs:
|
|
509
|
+
* - analytics
|
|
510
|
+
* @param getTimeseries - The getTimeseries object.
|
|
511
|
+
* @param getTimeseries.id - Unique A/B test identifier.
|
|
512
|
+
* @param getTimeseries.startDate - Start date of the period to analyze, in `YYYY-MM-DD` format.
|
|
513
|
+
* @param getTimeseries.endDate - End date of the period to analyze, in `YYYY-MM-DD` format.
|
|
514
|
+
* @param getTimeseries.metric - List of metrics to retrieve. If not specified, all metrics are returned.
|
|
515
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
516
|
+
* @see getTimeseries for the plain version.
|
|
517
|
+
*/
|
|
518
|
+
getTimeseriesWithHTTPInfo({ id, startDate, endDate, metric }, requestOptions) {
|
|
519
|
+
validateRequired("id", "getTimeseriesWithHTTPInfo", id);
|
|
520
|
+
const requestPath = "/3/abtests/{id}/timeseries".replace("{id}", encodeURIComponent(id));
|
|
521
|
+
const headers = {};
|
|
522
|
+
const queryParameters = {};
|
|
523
|
+
if (startDate !== void 0) {
|
|
524
|
+
queryParameters["startDate"] = startDate.toString();
|
|
525
|
+
}
|
|
526
|
+
if (endDate !== void 0) {
|
|
527
|
+
queryParameters["endDate"] = endDate.toString();
|
|
528
|
+
}
|
|
529
|
+
if (metric !== void 0) {
|
|
530
|
+
queryParameters["metric"] = metric.toString();
|
|
531
|
+
}
|
|
532
|
+
const request = {
|
|
533
|
+
method: "GET",
|
|
534
|
+
path: requestPath,
|
|
535
|
+
queryParameters,
|
|
536
|
+
headers
|
|
537
|
+
};
|
|
538
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
539
|
+
},
|
|
297
540
|
/**
|
|
298
541
|
* Lists all A/B tests you configured for this application.
|
|
299
542
|
*
|
|
@@ -334,6 +577,49 @@ function createAbtestingV3Client({
|
|
|
334
577
|
};
|
|
335
578
|
return transporter.request(request, requestOptions);
|
|
336
579
|
},
|
|
580
|
+
/**
|
|
581
|
+
* Lists all A/B tests you configured for this application.
|
|
582
|
+
*
|
|
583
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
584
|
+
*
|
|
585
|
+
* Required API Key ACLs:
|
|
586
|
+
* - analytics
|
|
587
|
+
* @param listABTests - The listABTests object.
|
|
588
|
+
* @param listABTests.offset - Position of the first item to return.
|
|
589
|
+
* @param listABTests.limit - Number of items to return.
|
|
590
|
+
* @param listABTests.indexPrefix - Index name prefix. Only A/B tests for indices starting with this string are included in the response.
|
|
591
|
+
* @param listABTests.indexSuffix - Index name suffix. Only A/B tests for indices ending with this string are included in the response.
|
|
592
|
+
* @param listABTests.direction - Sort order for A/B tests by start date. Use \'asc\' for ascending or \'desc\' for descending. Active A/B tests are always listed first.
|
|
593
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
594
|
+
* @see listABTests for the plain version.
|
|
595
|
+
*/
|
|
596
|
+
listABTestsWithHTTPInfo({ offset, limit, indexPrefix, indexSuffix, direction } = {}, requestOptions = void 0) {
|
|
597
|
+
const requestPath = "/3/abtests";
|
|
598
|
+
const headers = {};
|
|
599
|
+
const queryParameters = {};
|
|
600
|
+
if (offset !== void 0) {
|
|
601
|
+
queryParameters["offset"] = offset.toString();
|
|
602
|
+
}
|
|
603
|
+
if (limit !== void 0) {
|
|
604
|
+
queryParameters["limit"] = limit.toString();
|
|
605
|
+
}
|
|
606
|
+
if (indexPrefix !== void 0) {
|
|
607
|
+
queryParameters["indexPrefix"] = indexPrefix.toString();
|
|
608
|
+
}
|
|
609
|
+
if (indexSuffix !== void 0) {
|
|
610
|
+
queryParameters["indexSuffix"] = indexSuffix.toString();
|
|
611
|
+
}
|
|
612
|
+
if (direction !== void 0) {
|
|
613
|
+
queryParameters["direction"] = direction.toString();
|
|
614
|
+
}
|
|
615
|
+
const request = {
|
|
616
|
+
method: "GET",
|
|
617
|
+
path: requestPath,
|
|
618
|
+
queryParameters,
|
|
619
|
+
headers
|
|
620
|
+
};
|
|
621
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
622
|
+
},
|
|
337
623
|
/**
|
|
338
624
|
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
339
625
|
*
|
|
@@ -355,6 +641,31 @@ function createAbtestingV3Client({
|
|
|
355
641
|
headers
|
|
356
642
|
};
|
|
357
643
|
return transporter.request(request, requestOptions);
|
|
644
|
+
},
|
|
645
|
+
/**
|
|
646
|
+
* Stops an A/B test by its ID. You can\'t restart stopped A/B tests.
|
|
647
|
+
*
|
|
648
|
+
* Resolves with the full HTTP response information: status code, headers (when the requester captures them), raw body and deserialized data. Bypasses the requests and responses caches: always performs the API call.
|
|
649
|
+
*
|
|
650
|
+
* Required API Key ACLs:
|
|
651
|
+
* - editSettings
|
|
652
|
+
* @param stopABTest - The stopABTest object.
|
|
653
|
+
* @param stopABTest.id - Unique A/B test identifier.
|
|
654
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
655
|
+
* @see stopABTest for the plain version.
|
|
656
|
+
*/
|
|
657
|
+
stopABTestWithHTTPInfo({ id }, requestOptions) {
|
|
658
|
+
validateRequired("id", "stopABTestWithHTTPInfo", id);
|
|
659
|
+
const requestPath = "/3/abtests/{id}/stop".replace("{id}", encodeURIComponent(id));
|
|
660
|
+
const headers = {};
|
|
661
|
+
const queryParameters = {};
|
|
662
|
+
const request = {
|
|
663
|
+
method: "POST",
|
|
664
|
+
path: requestPath,
|
|
665
|
+
queryParameters,
|
|
666
|
+
headers
|
|
667
|
+
};
|
|
668
|
+
return transporter.requestWithHttpInfo(request, requestOptions);
|
|
358
669
|
}
|
|
359
670
|
};
|
|
360
671
|
}
|