@bitbar/cloud-api-client 0.56.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/API.d.ts +55 -29
- package/dist/ApiConfig.d.ts +3 -3
- package/dist/CloudAPIClient.d.ts +3 -3
- package/dist/Filter.d.ts +3 -3
- package/dist/FilterBuilder.d.ts +19 -20
- package/dist/api/APIAdminListDevices.d.ts +8 -8
- package/dist/api/APIAdminListNotificationPlans.d.ts +9 -5
- package/dist/api/APIAdminListRuns.d.ts +12 -5
- package/dist/api/APIAdminListServices.d.ts +9 -10
- package/dist/api/APIAdminListStatistics.d.ts +8 -5
- package/dist/api/APIAdminResource.d.ts +97 -67
- package/dist/api/APIAdminResourceAccount.d.ts +6 -3
- package/dist/api/APIAdminResourceAccountService.d.ts +8 -5
- package/dist/api/APIAdminResourceCluster.d.ts +9 -5
- package/dist/api/APIAdminResourceDevice.d.ts +14 -9
- package/dist/api/APIAdminResourceDeviceModel.d.ts +9 -5
- package/dist/api/APIAdminResourceDeviceSession.d.ts +3 -3
- package/dist/api/APIAdminResourceDeviceSessionStandalone.d.ts +4 -10
- package/dist/api/APIAdminResourceDeviceTime.d.ts +10 -6
- package/dist/api/APIAdminResourceFramework.d.ts +11 -6
- package/dist/api/APIAdminResourceLicense.d.ts +10 -7
- package/dist/api/APIAdminResourceNotificationPlan.d.ts +11 -7
- package/dist/api/APIAdminResourceProject.d.ts +5 -4
- package/dist/api/APIAdminResourceRun.d.ts +5 -4
- package/dist/api/APIAdminResourceRunStandalone.d.ts +10 -11
- package/dist/api/APIAdminResourceService.d.ts +7 -7
- package/dist/api/APIAdminResourceUser.d.ts +15 -9
- package/dist/api/APIAdminResourceUserAccount.d.ts +13 -8
- package/dist/api/APIEntity.d.ts +21 -18
- package/dist/api/APIList.d.ts +9 -11
- package/dist/api/APIListCleanupConfigurations.d.ts +9 -5
- package/dist/api/APIListDeviceTime.d.ts +9 -5
- package/dist/api/APIListDevices.d.ts +11 -10
- package/dist/api/APIListFiles.d.ts +8 -7
- package/dist/api/APIListNotifications.d.ts +11 -5
- package/dist/api/APIListProperties.d.ts +8 -4
- package/dist/api/APIListRuns.d.ts +8 -5
- package/dist/api/APIListServices.d.ts +14 -7
- package/dist/api/APIListSmartbearTunnels.d.ts +8 -3
- package/dist/api/APIListUsers.d.ts +15 -9
- package/dist/api/APIResource.d.ts +3 -2
- package/dist/api/APIResourceAccessGroup.d.ts +14 -8
- package/dist/api/APIResourceAccount.d.ts +10 -5
- package/dist/api/APIResourceAccountService.d.ts +9 -4
- package/dist/api/APIResourceAdditionalUser.d.ts +7 -4
- package/dist/api/APIResourceBillingPeriod.d.ts +7 -4
- package/dist/api/APIResourceBroker.d.ts +8 -5
- package/dist/api/APIResourceChannel.d.ts +8 -0
- package/dist/api/APIResourceCleanupConfiguration.d.ts +7 -5
- package/dist/api/APIResourceDevice.d.ts +10 -5
- package/dist/api/APIResourceDeviceGroup.d.ts +16 -9
- package/dist/api/APIResourceDeviceSession.d.ts +7 -6
- package/dist/api/APIResourceDeviceSessionCommon.d.ts +22 -14
- package/dist/api/APIResourceDeviceSessionStandalone.d.ts +15 -10
- package/dist/api/APIResourceFile.d.ts +15 -7
- package/dist/api/APIResourceLabelGroup.d.ts +10 -6
- package/dist/api/APIResourceNotification.d.ts +8 -4
- package/dist/api/APIResourceProject.d.ts +12 -12
- package/dist/api/APIResourceRun.d.ts +3 -3
- package/dist/api/APIResourceRunCommon.d.ts +27 -17
- package/dist/api/APIResourceUser.d.ts +53 -40
- package/dist/api/APIResourceUserSession.d.ts +10 -7
- package/dist/api/APIUserResourceAccount.d.ts +13 -7
- package/dist/api/class/FilesQueryParams.d.ts +4 -0
- package/dist/api/class/Images.filter.d.ts +2 -0
- package/dist/api/class/InputFileset.d.ts +11 -6
- package/dist/api/class/NonMedia.filter.d.ts +2 -0
- package/dist/api/class/OutputFileset.d.ts +19 -12
- package/dist/api/decorators/NonRequestable.d.ts +8 -0
- package/dist/api/factory/postAdminDeviceSessionChangeBillable.d.ts +4 -3
- package/dist/api/factory/postDeviceRunIds.d.ts +4 -3
- package/dist/api/interface/DeviceSession.d.ts +6 -5
- package/dist/api/interface/DeviceSessionBase.d.ts +4 -4
- package/dist/api/interface/DeviceSessionCommon.d.ts +15 -11
- package/dist/api/interface/DeviceSessionStandalone.d.ts +9 -7
- package/dist/api/models/AccessGroup.d.ts +14 -0
- package/dist/api/models/Account.d.ts +7 -0
- package/dist/api/models/AccountConcurrencyStatusMap.d.ts +4 -0
- package/dist/api/models/AccountPreference.d.ts +4 -0
- package/dist/api/models/AccountService.d.ts +66 -0
- package/dist/api/models/AccountServicePayment.d.ts +11 -0
- package/dist/api/models/Activity.d.ts +13 -0
- package/dist/api/models/AdminDevice.d.ts +50 -0
- package/dist/api/models/AdminDeviceSession.d.ts +36 -0
- package/dist/api/models/AdminDeviceSessionStatistics.d.ts +22 -0
- package/dist/api/models/AdminDeviceType.d.ts +12 -0
- package/dist/api/models/AdminEmail.d.ts +9 -0
- package/dist/api/models/AdminError.d.ts +39 -0
- package/dist/api/models/AdminFrameworkStatistics.d.ts +24 -0
- package/dist/api/models/AdminOverview.d.ts +10 -0
- package/dist/api/models/AdminTestRun.d.ts +31 -0
- package/dist/api/models/BillingPeriod.d.ts +40 -0
- package/dist/api/models/Broker.d.ts +10 -0
- package/dist/api/models/Browser.d.ts +15 -0
- package/dist/api/models/CleanupConfiguration.d.ts +5 -0
- package/dist/api/models/Cluster.d.ts +32 -0
- package/dist/api/models/Connection.d.ts +15 -0
- package/dist/api/models/CountryVatRate.d.ts +7 -0
- package/dist/api/models/DesktopBrowserCapabilities.d.ts +19 -0
- package/dist/api/models/Device.d.ts +108 -0
- package/dist/api/models/DeviceFilter.d.ts +17 -0
- package/dist/api/models/DeviceGroup.d.ts +30 -0
- package/dist/api/models/DeviceModel.d.ts +23 -0
- package/dist/api/models/DeviceModelCriterion.d.ts +19 -0
- package/dist/api/models/DeviceModelPool.d.ts +19 -0
- package/dist/api/models/DeviceProblem.d.ts +23 -0
- package/dist/api/models/DeviceSession.d.ts +137 -0
- package/dist/api/models/DeviceSessionDataAvailability.d.ts +9 -0
- package/dist/api/models/DeviceStatistics.d.ts +15 -0
- package/dist/api/models/DeviceStatus.d.ts +30 -0
- package/dist/api/models/DeviceTimeCountSessionReportEntry.d.ts +12 -0
- package/dist/api/models/DeviceTimeStepTimeReportEntry.d.ts +12 -0
- package/dist/api/models/DeviceUsage.d.ts +7 -0
- package/dist/api/models/Enum.d.ts +10 -0
- package/dist/api/models/Framework.d.ts +37 -0
- package/dist/api/models/HTTP.d.ts +33 -0
- package/dist/api/models/LabelGroup.d.ts +7 -0
- package/dist/api/models/License.d.ts +74 -0
- package/dist/api/models/Maintenance.d.ts +13 -0
- package/dist/api/models/Message.d.ts +3 -0
- package/dist/api/models/Notification.d.ts +34 -0
- package/dist/api/models/NotificationPlan.d.ts +20 -0
- package/dist/api/models/Project.d.ts +31 -0
- package/dist/api/models/ProjectJobConfig.d.ts +9 -0
- package/dist/api/models/Property.d.ts +17 -0
- package/dist/api/models/Role.d.ts +15 -0
- package/dist/api/models/Screenshot.d.ts +22 -0
- package/dist/api/models/Service.d.ts +61 -0
- package/dist/api/models/Settings.d.ts +6 -0
- package/dist/api/models/SharedResource.d.ts +11 -0
- package/dist/api/models/SmartbearTunnel.d.ts +20 -0
- package/dist/api/models/Tag.d.ts +16 -0
- package/dist/api/models/TestCaseRun.d.ts +40 -0
- package/dist/api/models/TestRun.d.ts +132 -0
- package/dist/api/models/TestRunDataAvailability.d.ts +10 -0
- package/dist/api/models/User.d.ts +75 -0
- package/dist/api/models/UserDeviceTime.d.ts +21 -0
- package/dist/api/models/UserDeviceTimeSummary.d.ts +14 -0
- package/dist/api/models/UserFile.d.ts +65 -0
- package/dist/api/models/UserPreference.d.ts +11 -0
- package/dist/api/models/UserStatistics.d.ts +14 -0
- package/dist/api/models/VatRate.d.ts +4 -0
- package/dist/bitbar-cloud-api-client.js +1047 -1007
- package/dist/bitbar-cloud-api-client.js.map +1 -1
- package/dist/bitbar-cloud-api-client.min.js +17 -2
- package/dist/bitbar-cloud-api-client.min.js.map +1 -1
- package/package.json +30 -26
- package/.nycrc +0 -14
- package/Jenkinsfile.sonar +0 -53
- package/dist/api/APIListPurchased.d.ts +0 -5
- package/dist/api/APIListStatistics.d.ts +0 -6
- package/dist/api/APIResourceBuild.d.ts +0 -8
- package/dist/api/APIResourceJob.d.ts +0 -9
- package/sonar-project.properties +0 -17
- package/tsconfig.test.json +0 -20
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
/* @bitbar/cloud-api-client
|
|
2
|
-
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("@bitbar/finka"),require("axios"),require("qs")):"function"==typeof define&&define.amd?define(["@bitbar/finka","axios","qs"],s):(e="undefined"!=typeof globalThis?globalThis:e||self)["bitbar-cloud-api-client"]=s(e["@bitbar/finka"],e.axios,e.qs)}(this,(function(e,s,t){"use strict";function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(e),i=r(s),u=r(t);n.default();var o;!function(e){e.GET="GET",e.POST="POST",e.DELETE="DELETE"}(o||(o={}));class h{constructor(e){this.stack=[],this.requestConfig={},e instanceof h?(this.root=e.root,Array.isArray(e.stack)&&this.push(...e.stack),null!=e.requestConfig&&this.setRequestConfig(e.requestConfig)):this.root=e}push(...e){for(const s of e)this.stack.push(s);return this}pop(){return this.stack.pop(),this}shift(){return this.stack.shift(),this}unshift(...e){for(const s of e)this.stack.unshift(s);return this}restack(...e){return this.stack=e,this}get first(){return this.stack[0]}set first(e){this.stack[0]=e}get last(){return this.stack[this.stack.length-1]}set last(e){this.stack[this.stack.length-1]=e}toUrl(e=!1){let s=`/${this.stack.join("/")}`;return e&&(s=this.root.axiosConfig.baseURL+s),s}setRequestConfig(e){return Object.deepAssign(this.requestConfig,e),this}removeRequestConfig(e){return delete this.requestConfig[e],this}headers(e){const s={};for(const t in e){s[t.replace(/(?:^|-)([a-z])/g,(e=>e.toUpperCase()))]=e[t]}return this.setRequestConfig({headers:s})}method(e){const s=e.toLocaleUpperCase();if(!o[s])throw new Error(`Method '${s}' is not allowed! You can use: ${Object.keys(o).join(", ")}`);return this.setRequestConfig({method:s})}get(){return this.method("GET")}post(){return this.method("POST")}params(e){return Object.deepAssign(this.requestConfig,{params:e}),this}getParams(){return null==this.requestConfig.params?{}:this.requestConfig.params}removeParam(e){return delete this.requestConfig.params[e],this}data(e){return Object.deepAssign(this.requestConfig,{data:e}),this}jsonData(e){return this.headers({"Content-Type":"application/json"}).data(e),this}formData(e){return this.headers({"Content-Type":"multipart/form-data"}).data(e),this}paramsSerializer(e){return u.default.stringify(e,{arrayFormat:"brackets"})}send(){const e=Object.deepAssign({},this.requestConfig,{url:`/${this.stack.join("/")}`});return null==e.headers&&(e.headers={}),null==e.headers["Content-Type"]&&(e.headers["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"),"POST"===e.method&&e.headers["Content-Type"].startsWith("application/x-www-form-urlencoded")&&null!=e.data&&(e.data=u.default.stringify(e.data,{arrayFormat:"brackets"})),e.params&&(e.paramsSerializer=this.paramsSerializer),this.root.axios.request(e)}}class a{constructor(e,s,t){this.name=e,this.value=s,this.operand=t}}class c{constructor(){this.filters=[]}add(e,s,t,r=!1){if(0===(s=Array.wrap(s)).length)return this;for(let e=0;e<s.length;e++){const t=s[e];"object"==typeof t&&t instanceof Date&&(s[e]=t.getTime())}if(r)for(const e of s);return t.endsWith("ornull")&&0===s.length&&(t="isnull"),this.filters.push(new a(e,s,t)),this}gt(e,s){return this.add(e,s,"gt")}lt(e,s){return this.add(e,s,"lt")}after(e,s){return this.add(e,s,"after",!0)}afterorequal(e,s){return this.add(e,s,"afterorequal",!0)}before(e,s){return this.add(e,s,"before",!0)}beforeorequal(e,s){return this.add(e,s,"beforeorequal",!0)}on(e,s){return this.add(e,s,"on")}eq(e,s){return this.add(e,s,"eq")}contains(e,s){return this.add(e,s,"contains")}like(e,s){return this.add(e,s,"like")}notlike(e,s){return this.add(e,s,"notlike")}isnull(e){return this.add(e,void 0,"isnull")}in(e,s){return this.add(e,s,"in",!0)}notin(e,s){return this.add(e,s,"notin",!0)}raw(e){const s=Array.wrap(e);for(const e of s){if(!this.isFilterPart(e))throw new SyntaxError(`Filter ${e} has invalid syntax`);this.filters.push(e)}}isFilterPart(e){return/^[a-zA-Z0-9.]{2,12}_(?:isnull$|(?:gt|lt|(?:after|before)(?:orequal)?|on|eq|contains|like|(?:not)?in)_)/.test(e)}toString(){const e=[];let s,t;for(const r of this.filters)"string"==typeof r?s=r:(t="",(r.value.length>1||void 0!==r.value[0])&&(t=`_${r.value.join("|")}`),s=`${r.name}_${r.operand}${t}`),e.push(s);return e.join(";")}}var l;!function(e){e.asc="a",e.desc="d"}(l||(l={}));class p extends h{create(e){return this.post().data(e).send()}sort(e,s=l.asc){return this.params({sort:`${e}_${s}`})}limit(e=20){if(!Number.isNatural(e))throw new Error(`Limit '${e}' is invalid!`);return this.params({limit:e})}getLimit(){const e=this.getParams();return null==e.limit?20:e.limit}noLimit(){return this.limit(0)}offset(e=0){if(!Number.isNatural(e))throw new Error(`Offset '${e}' is invalid!`);return this.params({offset:e})}between(e,s){if(!Number.isNatural(e))throw new Error(`From '${e}' is invalid!`);if(!Number.isNatural(s))throw new Error(`To '${s}' is invalid!`);return this.params({offset:e,limit:s-e+1})}only(e){if(!Number.isNatural(e))throw new Error(`Index '${e}' is invalid!`);return this.params({offset:e,limit:1})}page(e=1){if(!Number.isNatural(e)||0==e)throw new Error(`Page '${e}' is invalid!`);const s=this.getLimit(),t=(e-1)*s;return this.params({offset:t,limit:s})}search(e){if("string"!=typeof e)throw new Error("Search query must be a string!");return this.params({search:e})}filter(e){const s=e instanceof c;if("string"!=typeof e&&!s)throw new Error("Filter must be either string or instance of FilterBuilder");return s&&(e=e.toString()),this.params({filter:e})}}p.prototype.all=p.prototype.noLimit,p.prototype.cut=p.prototype.between;class w extends h{delete(){return this.method("DELETE")}}class d extends p{constructor(e){super(e),this.push("cleanup-configurations")}specific(){return new w(this).push("specific")}}class f extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("cleanup-configurations",s)}devices(){return new p(this).push("devices")}}class m extends p{constructor(e){super(e),this.push("devices")}filters(){return new w(this).push("filters")}cleanupConfigurations(){return new d(this)}cleanupConfiguration(e){return new f(this,e)}desktopBrowserCapabilities(){return new w(this).push("desktop-browser-capabilities")}}class b extends p{constructor(e){super(e),this.push("users")}activate(){return new w(this).push("activate").post()}recoveries(){return new w(this).push("recoveries")}passwordRecovery(){return new w(this).push("password-recovery")}resetApiKey(){return new w(this).push("reset-api-key")}validateVatId(){return new w(this).push("validateVatId")}}class v extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("billing-periods",s)}receipt(){return new w(this).push("receipt").setRequestConfig({responseType:"arraybuffer"})}}class g extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("builds",s)}abort(){return new w(this).push("abort")}outputFiles(){return new p(this).push("output-file-set","files")}}class E extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("jobs",s)}builds(){return new p(this).push("builds")}build(e){return new g(this,e)}}class x extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("device-groups",s)}devices(){return new p(this).push("devices")}device(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("devices",e)}selectors(){return new p(this).push("selectors")}selector(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("selectors",e)}share(){return new w(this).push("share")}}function y(e,s,t){const r=new w(e).push(s);return null!=t&&r.params({deviceRunIds:t}),r.post()}class R extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("runs",s)}abort(){return new w(this).push("abort").post()}dataAvailability(){return new p(this).push("data-availability")}deviceSessions(){return new p(this).push("device-sessions")}filesZip(e){return y(this,"files.zip",e)}logsZip(e){return y(this,"logs.zip",e)}performanceZip(e){return y(this,"performance.zip",e)}retry(e){return y(this,"retry",e).setRequestConfig({timeout:0})}screenshotNames(){return new p(this).push("screenshot-names")}screenshots(){return new p(this).push("screenshots")}screenshotsZip(e){return y(this,"screenshots.zip",e)}steps(){return new p(this).push("steps")}tags(){return new p(this).push("tags")}tag(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("tags",e)}}class k extends w{constructor(e){super(e),this.push("input-file-set")}files(){return new p(this).push("files")}filesZip(){return new w(this).push("files.zip")}}const D=new c;D.eq("state","READY"),D.notin("mimetype",["image/png","image/jpg","image/jpeg","image/webp","image/gif","video/mp4","video/avi","video/webm","video/ogg","video/mpeg"]);class I extends w{constructor(e){super(e),this.push("output-file-set")}files(){return new p(this).push("files")}file(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("files",e)}filesZip(){return new w(this).push("files.zip")}screenshots(){return new p(this).push("screenshots")}screenshot(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("screenshots",e)}screenshotFile(e){this.screenshot(e).push("file")}videos(){return this.files().params({filter:"s_state_eq_READY",tag:["video"]})}nonMediaFiles(){return this.files().filter(D)}}class C extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("device-sessions",s)}commands(){return new p(this).push("commands")}input(){return new k(this)}output(){return new I(this)}screenshots(){return new p(this).push("screenshots")}screenshot(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("screenshots",e)}steps(){return new p(this).push("steps")}step(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("steps",e)}currentStep(){return this.step("current")}testCaseRuns(){return new p(this).push("test-case-runs")}}class q extends C{abort(){return new w(this).push("abort").post()}retry(){return new w(this).push("retry").post()}}class S extends R{deviceSession(e){return new q(this,e)}}class T extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("projects",s)}runs(){return new p(this).push("runs")}run(e){return new S(this,e)}runsExtended(){return new p(this).push("runs-extended")}runExtended(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("runs-extended",e)}files(){return new p(this).push("files")}filesZip(){return new w(this).push("files.zip")}sharings(){return new p(this).push("sharings")}sharing(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("sharings",e)}}class j extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("files",s)}file(){return new w(this).push("file")}icon(){return new w(this).push("icon")}tags(){return new p(this).push("tags")}}class P extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("notifications",s)}test(){return new w(this).push("test")}}class A extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("access-groups",s)}users(){return new p(this).push("users")}user(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("users",e)}resources(){return new p(this).push("resources")}resource(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("resources",e)}}class U extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("additional-users",s)}resendActivation(){return new w(this).push("resend-activation")}}class $ extends w{constructor(e){super(e),this.push("account")}additionalUsers(){return new p(this).push("additional-users")}additionalUser(e){return new U(this,e)}serviceBillingPeriod(e){if(null==e)throw new Error("Resource ID cannot be null!");const s=new w(this);return s.last+="-services",s.push(e,"billing-period"),s}}class L extends p{constructor(e){super(e),this.push("device-time")}reserved(){return new p(this).push("reserved")}used(){return new p(this).push("used")}}class N extends p{constructor(e){super(e),this.push("files")}upload(e){let s;if(!global.isNodeJs)throw new Error("Not supported yet!");{const t=require("fs");s=new(require("form-data")),s.append("file",t.createReadStream(e.dir+"/"+e.filename),{filename:e.filename})}return this.post().headers(s.getHeaders()).data(s)}}class F extends p{constructor(e){super(e),this.push("purchased")}}class _ extends p{constructor(e){super(e),this.push("services")}purchased(){return new F(this)}available(){return new p(this).push("available")}active(){const e=new p(this);return"me"===this.first?e.push("active"):e.params({notArchived:!0}),e}}class G extends p{constructor(e){super(e),this.push("runs")}config(){return new w(this).push("config")}}class z extends p{constructor(e){super(e),this.push("notifications")}scopes(){return new p(this).push("scopes")}channels(){return new p(this).push("channels")}}class O extends p{constructor(e){super(e),this.push("tunnels")}active(e){return this.params({active:e})}}class B extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("device-sessions",s)}connections(){return new p(this).push("connections")}connection(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("connections",e)}input(){return new k(this)}output(){return new I(this)}release(){return new w(this).push("release").post()}}class Z extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");if(super(e),"me"===s)this.push("me");else{if("number"!=typeof s)throw new TypeError("id is not a number");this.push("users",s)}}account(){return new $(this)}deviceTime(){return new L(this)}deviceTimeSummary(){return new p(this).push("device-time-summary")}services(){return new _(this)}service(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("services",e)}billingPeriods(){return new p(this).push("billing-periods")}billingPeriod(e){return new v(this,e)}jobs(){return new p(this).push("jobs")}job(e){return new E(this,e)}deviceGroups(){return new p(this).push("device-groups")}deviceGroup(e){return new x(this,e)}deviceSessions(){return new p(this).push("device-sessions")}deviceSession(e){return new B(this,e)}projects(){return new p(this).push("projects")}project(e){return new T(this,e)}files(){return new N(this)}file(e){return new j(this,e)}runs(){return new G(this)}availableBuildExecutors(){return new p(this).push("available-build-executors")}availableFrameworks(){return new p(this).push("available-frameworks")}resetApiKey(){return new w(this).push("reset-api-key")}restore(){return new w(this).push("restore")}feedback(){return new w(this).push("feedback")}notifications(){return new z(this)}notification(e){return new P(this,e)}receipts(){return new p(this).push("receipts")}preferences(){return new w(this).push("preferences")}uiPreferences(){return new w(this).push("ui-preferences")}deviceUsage(){return new p(this).push("device-usage")}statistics(){return new p(this).push("statistics")}deviceStatistics(){return new p(this).push("device-statistics")}accessGroups(){return new p(this).push("access-groups")}accessGroup(e){return new A(this,e)}smartbearTunnel(e){return new w(this).push("tunnels",e)}smartbearTunnels(){return new O(this)}}class K extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("devices",s)}properties(){return new p(this).push("properties")}}class M extends w{constructor(e){super(e),this.push("user-sessions")}login(e){return new w(this).push("login").post().data(e)}logout(){return new w(this).push("logout").post()}sso(e){return new w(this).push(e+"-login")}portalLogin(){return new w(this).push("portal-login").post()}}class V extends p{constructor(e){super(e),this.push("admin","runs")}config(){const e=new w(this);return e.stack=["runs","config"],e}}class J extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("clusters",s)}devices(){return new p(this).push("devices")}}class Y extends w{constructor(e){super(e),this.push("admin","device-time")}countSessionReport(){return new p(this).push("count-session-report")}stepTimeReport(){return new p(this).push("step-time-report")}}class W extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","runs",s)}abort(){return new w(this).push("abort").post()}changeBillable(e){return new w(this).push("changebillable").post().params({billable:e})}changePriority(e){return new w(this).push("changepriority").post().params({priority:e})}retry(e){return y(this,"retry",e).setRequestConfig({timeout:0})}deviceSessions(){return new p(this).shift().push("device-sessions")}deviceSession(e){return new C(this,e).shift()}}class H extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","devices",s)}queue(){return new p(this).push("queue")}cleanupConfiguration(){return new w(this).push("cleanup-configuration")}labels(){return new p(this).push("labels")}label(e){return new w(this).push("labels",e)}blink(){return new w(this).push("blink").post()}}class Q extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","account-services",s)}activate(){return new w(this).push("activate").post()}deactivate(){return new w(this).push("deactivate").post()}}class X extends w{constructor(e){super(e),this.push("account")}roles(){return new p(this).push("roles")}role(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("roles",e)}services(){const e=new p(this);return e.last+="-services",e}update(){const e=new w(this);return e.last="update-account",e.post()}}class ee extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","users",s)}disable(){return new w(this).push("disable")}enable(){return new w(this).push("enable")}licenses(){return new p(this).push("licenses")}resendActivation(){return new w(this).push("resend-activation").post()}account(){return new X(this)}}class se extends C{changeBillable(e){return function(e,s){const t=new w(e),r=t.last;return t.restack("admin","device-sessions",r,"changebillable").params({billable:s}).post()}(this,e)}connections(){return new p(this).push("connections")}connection(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("connections",e)}release(){return new w(this).push("release").post()}}class te extends p{constructor(e){super(e),this.push("admin","devices")}filters(){return new w(this).push("filters")}cleanupConfigurations(){return new d(this)}cleanupConfiguration(e){return new f(this,e)}desktopBrowserCapabilities(){return new w(this).push("desktop-browser-capabilities")}}class re extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","frameworks",s)}config(){return new w(this).push("config")}requiredRoles(){return new p(this).push("required-roles")}}class ne extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","licenses",s)}activate(){return new w(this).push("activate")}deactivate(){return new w(this).push("deactivate")}resend(){return new w(this).push("resend")}download(){return new w(this).push("download")}}class ie extends p{constructor(e){super(e),this.push("admin","notification-plans")}channels(){return new p(this).push("channels")}scopes(){return new p(this).push("scopes")}}class ue extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","notification-plans",s)}check(){return new p(this).push("check")}test(){return new w(this).push("test")}execute(){return new w(this).push("execute")}}class oe extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","services",s)}activate(){return new w(this).push("activate").post()}deactivate(){return new w(this).push("deactivate").post()}roles(){return new p(this).push("roles")}}class he extends p{constructor(e){super(e),this.push("admin","services")}purchased(){return new F(this)}available(){return new p(this).push("available")}active(){const e=new p(this);return"me"===this.first?e.push("active"):e.params({notArchived:!0}),e}activated(){const e=this.active();return e.params({filter:"activated_eq_true",limit:0,sort:"name_a"}),e}inUse(){const e=new p(this);return e.params({inUse:!0,limit:0,sort:"name_a"}),e}byPrice(){const e=new p(this);return e.params({sort:"centPrice_a"}),e}}class ae extends p{constructor(e){super(e),this.push("admin","statistics")}deviceSessions(){return new p(this).push("device-sessions")}frameworks(){return new p(this).push("frameworks")}}class ce extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","device-models",s)}browsers(){return new p(this).push("browsers")}}class le extends w{constructor(e){super(e)}accessGroups(){return new p(this).push("access-groups")}accessGroup(e){return new A(this,e)}accounts(){return new p(this).push("admin","accounts")}account(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","accounts",e)}accountServices(){return new p(this).push("admin","account-services")}accountService(e){return new Q(this,e)}activities(){return new p(this).push("admin","activities")}billingPeriods(){return new p(this).push("admin","billing-periods")}billingPeriod(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","billing-periods",e)}browsers(){return new p(this).push("admin","browsers")}browser(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","browsers",e)}clusters(){return new p(this).push("clusters")}cluster(e){return new J(this,e)}countryVatRates(){return new p(this).push("admin","country-vat-rates")}countryVatRate(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","country-vat-rates",e)}devices(){return new te(this)}device(e){return new H(this,e)}devicesForModel(e){if(null==e)throw new Error("Resource ID cannot be null!");const s=this.devices();return s.params({filter:"deviceModelId_eq_"+e}),s}deviceStatuses(){return new p(this).push("admin","device","statuses")}deviceModels(){return new p(this).push("admin","device-models")}deviceModel(e){return new ce(this,e)}deviceProblems(){return new p(this).push("admin","device-problems")}deviceModelCriterias(){return new p(this).push("admin","device-model-criteria")}deviceModelCriteria(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","device-model-criteria",e)}deviceSessions(){return new p(this).push("admin","device-sessions")}deviceSession(e){return new se(this,e)}deviceTime(){return new Y(this)}deviceTimeSummary(){return new p(this).push("admin","device-time-summary")}deviceTypes(){return new p(this).push("admin","device-types")}deviceType(e){return new w(this).push("admin","device-types",e)}deviceGroups(){return new p(this).push("device-groups")}deviceGroup(e){return new x(this,e)}emails(){return new p(this).push("admin","emails")}resendEmail(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","emails",e,"resend").post()}errors(){return new p(this).push("admin","errors")}files(){return new p(this).push("files")}file(e){return new j(this,e)}frameworks(){return new p(this).push("admin","frameworks")}framework(e){return new re(this,e)}frameworkAvailableLabels(){const e=this.frameworks();return e.push("available-labels"),e}interactiveQueue(){return new p(this).push("admin","interactive-queue")}licenses(){return new p(this).push("admin","licenses")}license(e){return new ne(this,e)}maintenance(){return new w(this).push("admin","maintenance")}marketShares(){return new p(this).push("admin","market-shares")}notificationPlans(){return new ie(this)}notificationPlan(e){return new ue(this,e)}overview(){return new w(this).push("admin","overview")}pools(){return new p(this).push("admin","pools")}pool(e){return new w(this).push("admin","pools",e)}projects(){return new p(this).push("projects")}project(e){return new T(this,e)}roles(){return new p(this).push("admin","roles")}runs(){return new V(this)}run(e){return new W(this,e)}samples(){return new p(this).push("admin","samples")}sample(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("admin","samples",e)}services(){return new he(this)}service(e){return new oe(this,e)}settings(){return new w(this).push("admin","settings")}statistics(){return new ae(this)}users(){return new p(this).push("users")}createUser(){return new p(this).push("admin","users").post()}user(e){return new ee(this,e)}}class pe extends w{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("accounts",s)}concurrencyStatus(){return new w(this).push("concurrency-status")}preferences(){return new w(this).push("preferences")}}class we extends w{constructor(e){super(e),this.push("broker")}hubs(){return new p(this).push("hubs")}}global.isNodeJs&&(i.default.defaults.headers.common["User-Agent"]="Bitbar Cloud API Client for JavaScript v0.56.0"),i.default.defaults.maxContentLength=1073741824;return{API:class{constructor(e){if(null==e)throw new Error("config cannot be empty");if(this.config=e,this.axiosConfig={},null==this.config.cloudUrl)throw new TypeError("cloudUrl cannot be empty");if("string"!=typeof this.config.cloudUrl)throw new TypeError("cloudUrl must be a string");if(!/^https?:\/\/.{2,}/.test(this.config.cloudUrl))throw new Error("cloudUrl doesn't look like a URL");if(this.axiosConfig.baseURL=this.config.cloudUrl.replace(/\/+$/,"")+"/api",this.config.v2=!!this.config.v2,this.config.v2&&(this.axiosConfig.baseURL+="/v2"),this.config.apiKey){if("string"!=typeof this.config.apiKey)throw new TypeError("apiKey must be a string");if(!/^[A-Za-z0-9]{32}$/.test(this.config.apiKey))throw new Error("apiKey is in the wrong format");this.axiosConfig.auth={username:this.config.apiKey,password:""}}this.axiosConfig.withCredentials=null!=e.withCredentials&&e.withCredentials,this.axios=i.default.create(this.axiosConfig)}userSession(){return new M(this)}user(e){return new Z(this,e)}users(){return new b(this)}account(e){return new pe(this,e)}me(){return this.user("me")}admin(){return new le(this)}devices(){return new m(this)}device(e){return new K(this,e)}deviceGroups(){return new p(this).push("device-groups")}deviceGroup(e){return new x(this,e)}deviceSessions(){return new p(this).push("device-sessions")}deviceSession(e){return new q(this,e)}labelGroups(){return new p(this).push("label-groups")}deviceStatistics(){return new p(this).push("device-statistics")}enums(){return new w(this).push("enums")}licenses(){return new w(this).push("licenses")}labels(){return new p(this).push("labels")}broker(){return new we(this)}},FilterBuilder:c}}));
|
|
1
|
+
/* @bitbar/cloud-api-client v1.0.0 | Copyright 2022 (c) SmartBear Software and contributors | .git/blob/master/LICENSE */
|
|
2
|
+
!function(e,s){"object"==typeof exports&&"undefined"!=typeof module?module.exports=s(require("axios"),require("@bitbar/finka"),require("qs"),require("node-abort-controller")):"function"==typeof define&&define.amd?define(["axios","@bitbar/finka","qs","node-abort-controller"],s):(e="undefined"!=typeof globalThis?globalThis:e||self)["bitbar-cloud-api-client"]=s(e.axios,e["@bitbar/finka"],e.qs,e["node-abort-controller"])}(this,(function(e,s,t,r){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(e),u=n(s);
|
|
3
|
+
/******************************************************************************
|
|
4
|
+
Copyright (c) Microsoft Corporation.
|
|
5
|
+
|
|
6
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7
|
+
purpose with or without fee is hereby granted.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
10
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
11
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
12
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
13
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
14
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
15
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
16
|
+
***************************************************************************** */
|
|
17
|
+
function o(e,s,t,r){var n,i=arguments.length,u=i<3?s:null===r?r=Object.getOwnPropertyDescriptor(s,t):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)u=Reflect.decorate(e,s,t,r);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(u=(i<3?n(u):i>3?n(s,t,u):n(s,t))||u);return i>3&&u&&Object.defineProperty(s,t,u),u}class h{constructor(e,s,t){this.name=e,this.value=s,this.operand=t}}u.default();class a{constructor(){this.filters=[]}gt(e,s){return this.add(e,s,"gt")}lt(e,s){return this.add(e,s,"lt")}after(e,s){return this.add(e,s,"after",!0)}afterorequal(e,s){return this.add(e,s,"afterorequal",!0)}before(e,s){return this.add(e,s,"before",!0)}beforeorequal(e,s){return this.add(e,s,"beforeorequal",!0)}on(e,s){return this.add(e,s,"on")}eq(e,s){return this.add(e,s,"eq")}contains(e,s){return this.add(e,s,"contains")}like(e,s){return this.add(e,s,"like")}notlike(e,s){return this.add(e,s,"notlike")}isnull(e){return this.add(e,void 0,"isnull")}in(e,s){return this.add(e,s,"in",!0)}notin(e,s){return this.add(e,s,"notin",!0)}raw(e){const s=Array.wrap(e);for(const e of s){if(!this.isFilterPart(e))throw new SyntaxError(`Filter ${e} has invalid syntax`);this.filters.push(e)}}isFilterPart(e){return/^[a-zA-Z0-9.]{2,12}_(?:isnull$|(?:gt|lt|(?:after|before)(?:orequal)?|on|eq|contains|like|(?:not)?in)_)/.test(e)}toString(){const e=[];let s,t;for(const r of this.filters)"string"==typeof r?s=r:(t="",(r.value.length>1||void 0!==r.value[0])&&(t=`_${r.value.join("|")}`),s=`${r.name}_${r.operand}${t}`),e.push(s);return e.join(";")}add(e,s,t,r=!1){let n=Array.wrap(s);if(0===n.length)return this;for(let e=0;e<n.length;e++){const s=n[e];"object"==typeof s&&s instanceof Date&&(n[e]=s.getTime())}let i=!1;if(r){for(const e of n)null===e&&(i=!0);i&&(n=n.filter((e=>null!==e)),t+="ornull")}return t.endsWith("ornull")&&0===n.length&&(t="isnull"),this.filters.push(new h(e,n,t)),this}}const c=["GET","POST","DELETE"];var l;!function(e){e.asc="a",e.desc="d"}(l||(l={}));class p{constructor(e){this.stack=[],this.requestConfig={},this.ALLOWED_HTTP_METHODS=c,e instanceof p?(this.root=e.root,Array.isArray(e.stack)&&this.push(...e.stack),null!=e.requestConfig&&this.setRequestConfig(e.requestConfig)):this.root=e,this.abortController=new r.AbortController}abortRequest(){this.abortController.abort()}push(...e){return this.stack=this.stack.concat(e),this}shift(){return this.stack.shift(),this}restack(...e){return this.stack=e,this}get first(){return this.stack[0]}get last(){return this.stack[this.stack.length-1]}set last(e){this.stack[this.stack.length-1]=e}toUrl(e=!1){let s=`/${this.stack.join("/")}`;return e&&(s=this.root.baseUrl+s),s}setRequestConfig(e){return Object.deepAssign(this.requestConfig,e),this}removeRequestConfig(e){return delete this.requestConfig[e],this}headers(e){const s={};for(const t in e){s[t.replace(/(?:^|-)([a-z])/g,(e=>e.toUpperCase()))]=e[t]}return this.setRequestConfig({headers:s})}method(e){const s=e.toLocaleUpperCase();if(!(this.ALLOWED_HTTP_METHODS.indexOf(s)>-1))throw new Error(`Method '${s}' is not allowed! You can use: ${this.ALLOWED_HTTP_METHODS.join(", ")}`);return this.setRequestConfig({method:s})}get(){return this.method("GET")}post(){return this.method("POST")}params(e){return this.setRequestConfig({params:e}),this}getParams(){return null==this.requestConfig.params?{}:this.requestConfig.params}removeParam(e){return delete this.requestConfig.params[e],this}data(e){return this.setRequestConfig({data:e}),this}jsonData(e){return this.headers({"Content-Type":"application/json"}).data(e),this}formData(e){return this.headers({"Content-Type":"multipart/form-data"}).data(e),this}send(){const e=Object.deepAssign({},this.requestConfig,{url:`/${this.stack.join("/")}`,signal:this.abortController.signal});return null==e.headers&&(e.headers={}),null==e.headers["Content-Type"]&&(e.headers["Content-Type"]="application/x-www-form-urlencoded; charset=UTF-8"),"POST"===e.method&&e.headers["Content-Type"].startsWith("application/x-www-form-urlencoded")&&null!=e.data&&(e.data=this.paramsSerializer(e.data)),e.params&&(e.paramsSerializer=this.paramsSerializer),this.root.axios.request(e)}paramsSerializer(e){return t.stringify(e,{arrayFormat:"brackets"})}}class w extends p{constructor(){super(...arguments),this.all=this.noLimit,this.cut=this.between}create(e){return this.post().data(e).send()}sort(e,s=l.asc){return this.params({sort:`${e}_${s}`})}limit(e=20){if(!Number.isNatural(e))throw new Error(`Limit '${e}' is invalid!`);return this.params({limit:e})}getLimit(){const e=this.getParams();return null==e.limit?20:e.limit}noLimit(){return this.limit(0)}offset(e=0){if(!Number.isNatural(e))throw new Error(`Offset '${e}' is invalid!`);return this.params({offset:e})}between(e,s){if(!Number.isNatural(e))throw new Error(`From '${e}' is invalid!`);if(!Number.isNatural(s))throw new Error(`To '${s}' is invalid!`);return this.params({offset:e,limit:s-e+1})}only(e){if(!Number.isNatural(e))throw new Error(`Index '${e}' is invalid!`);return this.params({offset:e,limit:1})}page(e=1){if(!Number.isNatural(e)||0==e)throw new Error(`Page '${e}' is invalid!`);const s=this.getLimit(),t=(e-1)*s;return this.params({offset:t,limit:s})}search(e){if("string"!=typeof e)throw new Error("Search query must be a string!");return this.params({search:e})}filter(e){if("string"!=typeof e&&!(e instanceof a))throw new Error("Filter must be either string or instance of FilterBuilder");return this.params({filter:e.toString()})}}class d extends p{delete(){return this.method("DELETE")}}class f extends w{constructor(e){super(e),this.push("cleanup-configurations")}specific(){return new d(this).push("specific")}}class m extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("cleanup-configurations",s)}devices(){return new d(this).push("devices")}}class b extends w{constructor(e){super(e),this.push("admin","devices")}cleanupConfigurations(){return new f(this)}cleanupConfiguration(e){return new m(this,e)}}class v extends w{constructor(e){super(e),this.push("admin","notification-plans")}channels(){return new w(this).push("channels")}scopes(){return new w(this).push("scopes")}}class g extends w{constructor(e){super(e),this.ALLOWED_HTTP_METHODS=["GET"],this.push("admin","runs")}config(){const e=new d(this);return e.restack("runs","config"),e}}class E extends w{constructor(e){super(e),this.push("admin","services")}active(){const e=new w(this);return e.params({notArchived:!0}),e}activated(){const e=this.active();return e.params({filter:"activated_eq_true",limit:0,sort:"name_a"}),e}inUse(){const e=new w(this);return e.params({inUse:!0,limit:0,sort:"name_a"}),e}byPrice(){const e=new w(this);return e.params({sort:"centPrice_a"}),e}}function y(e){return class extends e{send(){return Promise.reject()}}}let x=class extends w{constructor(e){super(e),this.push("admin","statistics")}deviceSessions(){return new w(this).push("device-sessions")}frameworks(){return new w(this).push("frameworks")}};x=o([y],x);class R extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","account-services",s)}activate(){return new d(this).push("activate").post()}deactivate(){return new d(this).push("deactivate").post()}}class D extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("clusters",s)}devices(){return new w(this).push("devices")}}class T extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","devices",s)}blink(){return new d(this).push("blink").post()}cleanupConfiguration(){return new d(this).push("cleanup-configuration")}labels(){return new w(this).push("labels")}label(e){return new d(this).push("labels",e)}queue(){return new w(this).push("queue")}}class I extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","device-models",s)}browsers(){return new w(this).push("browsers")}}let C=class extends d{constructor(e){super(e),this.push("input-file-set")}files(){return new w(this).push("files")}filesZip(){return new d(this).push("files.zip")}};C=o([y],C);const q=new a;q.eq("state","READY"),q.in("mimetype",["image/png","image/jpg","image/jpeg","image/webp","image/gif"]),q.notlike("name","action-%%");const k=new a;k.eq("state","READY"),k.notin("mimetype",["image/png","image/jpg","image/jpeg","image/webp","image/gif","video/mp4","video/avi","video/webm","video/ogg","video/mpeg"]);let S=class extends d{constructor(e){super(e),this.push("output-file-set")}files(){return new w(this).push("files")}file(e){return new d(this).push("files",e)}filesZip(){return new d(this).push("files.zip")}screenshots(){return new w(this).push("screenshots")}screenshot(e){return new d(this).push("screenshots",e)}screenshotFile(e){return this.screenshot(e).push("file")}videos(){return this.files().params({filter:"s_state_eq_READY",tag:["video"]})}nonMediaFiles(){return this.files().filter(k)}performance(){return this.files().params({tag:["performance"]})}images(){return this.files().filter(q)}};S=o([y],S);class P extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("device-sessions",s)}commands(){return new w(this).push("commands")}input(){return new C(this)}output(){return new S(this)}screenshots(){return new w(this).push("screenshots")}screenshot(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("screenshots",e)}steps(){return new w(this).push("steps")}step(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("steps",e)}currentStep(){return this.step("current")}testCaseRuns(){return new w(this).push("test-case-runs")}connections(){return new w(this).push("connections")}logs(){return new d(this).push("logs").setRequestConfig({responseType:"text"})}}class _ extends P{changeBillable(e){return function(e,s){const t=new d(e),r=t.last;return t.restack("admin","device-sessions",r,"changebillable").params({billable:s}).post()}(this,e)}}class A extends w{constructor(e){super(e),this.push("admin","device-time")}countSessionReport(){return new w(this).push("count-session-report")}stepTimeReport(){return new w(this).push("step-time-report")}}class j extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","frameworks",s)}config(){return new d(this).push("config")}requiredRoles(){return new w(this).push("required-roles")}}class L extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","licenses",s)}activate(){return new d(this).push("activate")}deactivate(){return new d(this).push("deactivate")}resend(){return new d(this).push("resend")}download(){return new d(this).push("download")}}class O extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","notification-plans",s)}check(){return new w(this).push("check")}test(){return new d(this).push("test")}execute(){return new d(this).push("execute")}}function U(e,s,t){const r=new d(e).push(s);return null!=t&&r.params({deviceRunIds:t}),r.post()}class N extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","runs",s)}abort(){return new d(this).push("abort").post()}changeBillable(e){return new d(this).push("changebillable").post().params({billable:e})}changePriority(e){return new d(this).push("changepriority").post().params({priority:e})}retry(e){return U(this,"retry",e).setRequestConfig({timeout:0})}}class $ extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","services",s)}activate(){return new d(this).push("activate").post()}}let G=class extends d{constructor(e){super(e),this.push("account")}roles(){return new w(this).push("roles")}role(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("roles",e)}services(){const e=new w(this);return e.last+="-services",e}update(){const e=new d(this);return e.last="update-account",e.post()}};G=o([y],G);class H extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("device-sessions",s)}connections(){return new w(this).push("connections")}connection(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("connections",e)}input(){return new C(this)}output(){return new S(this)}release(){return new d(this).push("release").post()}}let M=class extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("admin","users",s)}disable(){return new d(this).push("disable")}enable(){return new d(this).push("enable")}licenses(){return new w(this).push("licenses")}resendActivation(){return new d(this).push("resend-activation").post()}account(){return new G(this)}deviceSession(e){return new H(this,e)}};M=o([y],M);class z extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("access-groups",s)}users(){return new w(this).push("users")}user(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("users",e)}resources(){return new w(this).push("resources")}resource(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("resources",e)}}class F extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("device-groups",s)}devices(){return new w(this).push("devices")}device(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("devices",e)}selectors(){return new w(this).push("selectors")}selector(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("selectors",e)}share(){return new d(this).push("share")}}class B extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("files",s)}file(){return new d(this).push("file")}icon(){return new d(this).push("icon")}tags(){return new w(this).push("tags")}share(){return new w(this).push("share")}}class W extends P{abort(){return new d(this).push("abort").post()}retry(){return new d(this).push("retry").post()}}class Z extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("runs",s)}abort(){return new d(this).push("abort").post()}dataAvailability(){return new d(this).push("data-availability")}deviceSessions(){return new w(this).push("device-sessions")}filesZip(e){return U(this,"files.zip",e)}logsZip(e){return U(this,"logs.zip",e)}performanceZip(e){return U(this,"performance.zip",e)}retry(e){return U(this,"retry",e).setRequestConfig({timeout:0})}screenshotNames(){return new w(this).push("screenshot-names")}screenshots(){return new w(this).push("screenshots")}screenshotsZip(e){return U(this,"screenshots.zip",e)}steps(){return new w(this).push("steps")}tags(){return new w(this).push("tags")}tag(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("tags",e)}}class K extends Z{deviceSession(e){return new W(this,e)}}class V extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("projects",s)}runs(){return new w(this).push("runs")}run(e){return new K(this,e)}}let Y=class extends d{constructor(e){super(e)}accessGroups(){return new w(this).push("access-groups")}accessGroup(e){return new z(this,e)}accounts(){return new w(this).push("admin","accounts")}account(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","accounts",e)}accountServices(){return new w(this).push("admin","account-services")}accountService(e){return new R(this,e)}activities(){return new w(this).push("admin","activities")}billingPeriods(){return new w(this).push("admin","billing-periods")}billingPeriod(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","billing-periods",e)}browsers(){return new w(this).push("admin","browsers")}browser(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","browsers",e)}clusters(){return new w(this).push("clusters")}cluster(e){return new D(this,e)}countryVatRates(){return new w(this).push("admin","country-vat-rates")}countryVatRate(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","country-vat-rates",e)}devices(){return new b(this)}device(e){return new T(this,e)}devicesForModel(e){if(null==e)throw new Error("Resource ID cannot be null!");const s=this.devices();return s.params({filter:"deviceModelId_eq_"+e}),s}deviceStatuses(){return new w(this).push("admin","device","statuses")}deviceModels(){return new w(this).push("admin","device-models")}deviceModel(e){return new I(this,e)}deviceProblems(){return new w(this).push("admin","device-problems")}deviceModelCriterias(){return new w(this).push("admin","device-model-criteria")}deviceModelCriteria(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","device-model-criteria",e)}deviceSessions(){return new w(this).push("admin","device-sessions")}deviceSession(e){return new _(this,e)}deviceTime(){return new A(this)}deviceTimeSummary(){return new w(this).push("admin","device-time-summary")}deviceTypes(){return new w(this).push("admin","device-types")}deviceType(e){return new d(this).push("admin","device-types",e)}deviceGroups(){return new w(this).push("device-groups")}deviceGroup(e){return new F(this,e)}emails(){return new w(this).push("admin","emails")}resendEmail(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","emails",e,"resend").post()}errors(){return new w(this).push("admin","errors")}files(){return new w(this).push("files")}file(e){return new B(this,e)}frameworks(){return new w(this).push("admin","frameworks")}framework(e){return new j(this,e)}frameworkAvailableLabels(){const e=this.frameworks();return e.push("available-labels"),e}interactiveQueue(){return new w(this).push("admin","interactive-queue")}licenses(){return new w(this).push("admin","licenses")}license(e){return new L(this,e)}maintenance(){return new d(this).push("admin","maintenance")}notificationPlans(){return new v(this)}notificationPlan(e){return new O(this,e)}overview(){return new d(this).push("admin","overview")}pools(){return new w(this).push("admin","pools")}pool(e){return new d(this).push("admin","pools",e)}projects(){return new w(this).push("projects")}project(e){return new V(this,e)}roles(){return new w(this).push("admin","roles")}runs(){return new g(this)}run(e){return new N(this,e)}samples(){return new w(this).push("admin","samples")}sample(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("admin","samples",e)}services(){return new E(this)}service(e){return new $(this,e)}settings(){return new d(this).push("admin","settings")}statistics(){return new x(this)}users(){return new w(this).push("users")}createUser(){return new w(this).push("admin","users").post()}user(e){return new M(this,e)}};Y=o([y],Y);class J extends w{constructor(e){super(e),this.push("devices")}filters(){return new d(this).push("filters")}desktopBrowserCapabilities(){return new d(this).push("desktop-browser-capabilities")}}class Q extends w{constructor(e){super(e),this.push("properties")}appBan(e){if(null==e)throw new Error("Resource ID cannot be null!");return new w(this).push("app-bans").params({testRunId:e})}maintenance(){return new w(this).params({filter:"name_eq_CLOUD_HEADER_ANNOUNCEMENT",limit:1,sort:"updateTime_d"})}}class X extends w{constructor(e){super(e),this.ALLOWED_HTTP_METHODS=["POST"],this.push("services")}available(){return new w(this).push("available")}active(){const e=new w(this);return"me"===this.first?e.push("active"):e.params({notArchived:!0}),e}byPrice(){return new w(this).sort("centPrice")}availableByPrice(){return new w(this).push("available").sort("centPrice")}}class ee extends w{constructor(e){super(e),this.ALLOWED_HTTP_METHODS=["POST"],this.push("users")}activate(){return new d(this).push("activate").post()}recoveries(){return new d(this).push("recoveries")}passwordRecovery(){return new d(this).push("password-recovery")}validateVatId(){return new d(this).push("validateVatId")}}class se extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("accounts",s)}concurrencyStatus(){return new d(this).push("concurrency-status")}preferences(){return new d(this).push("preferences")}}class te extends d{constructor(e){super(e),this.push("broker")}hubs(){return new w(this).push("hubs")}}class re extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("devices",s)}properties(){return new w(this).push("properties")}browsers(){return new w(this).push("browsers")}}class ne extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("label-groups",s)}labels(){return new w(this).push("labels")}label(e){return new d(this).push("labels",e)}}class ie extends w{constructor(e){super(e),this.push("device-time")}reserved(){return new p(this).push("reserved")}used(){return new p(this).push("used")}}class ue extends w{constructor(e){super(e),this.push("files")}upload(e){if(global.isNodeJs)return this.nodeUpload(e);throw new Error("Not supported yet!")}nodeUpload(e){const s=require("fs"),t=new(require("form-data"));return t.append("file",s.createReadStream(e.dir+"/"+e.filename),{filename:e.filename}),this.post().headers(t.getHeaders()).data(t)}}class oe extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("channels",s)}scopes(){return new w(this).push("scopes")}}class he extends w{constructor(e){super(e),this.push("notifications")}scopes(){return new w(this).push("scopes")}channels(){return new w(this).push("channels")}channel(e){return new oe(this,e)}}class ae extends w{constructor(e){super(e),this.push("runs")}config(){return new d(this).push("config")}}class ce extends w{constructor(e){super(e),this.ALLOWED_HTTP_METHODS=["GET"],this.push("tunnels")}active(e){return this.params({active:e})}}class le extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("billing-periods",s)}receipt(){return new d(this).push("receipt").setRequestConfig({responseType:"arraybuffer"})}}class pe extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("notifications",s)}test(){return new d(this).push("test")}}class we extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");super(e),this.push("additional-users",s)}resendActivation(){return new d(this).push("resend-activation")}}class de extends d{constructor(e){super(e),this.push("account")}additionalUsers(){return new w(this).push("additional-users")}additionalUser(e){return new we(this,e)}serviceBillingPeriod(e){if(null==e)throw new Error("Resource ID cannot be null!");const s=new d(this);return s.last+="-services",s.push(e,"billing-period"),s}}class fe extends d{constructor(e,s){if(null==s)throw new Error("Resource ID cannot be null!");if(super(e),"me"===s)this.push("me");else{if("number"!=typeof s)throw new TypeError("id is not a number");this.push("users",s)}}account(){return new de(this)}deviceTime(){return new ie(this)}deviceTimeSummary(){return new w(this).push("device-time-summary")}services(){return new X(this)}service(e){if(null==e)throw new Error("Resource ID cannot be null!");return new d(this).push("services",e)}billingPeriods(){return new w(this).push("billing-periods")}billingPeriod(e){return new le(this,e)}deviceGroups(){return new w(this).push("device-groups")}deviceGroup(e){return new F(this,e)}deviceSessions(){return new w(this).push("device-sessions")}deviceSession(e){return new H(this,e)}projects(){return new w(this).push("projects")}project(e){return new V(this,e)}files(){return new ue(this)}file(e){return new B(this,e)}runs(){return new ae(this)}availableFrameworks(){return new w(this).push("available-frameworks")}resetApiKey(){return new d(this).push("reset-api-key")}restore(){return new d(this).push("restore")}feedback(){return new d(this).push("feedback")}notifications(){return new he(this)}notification(e){return new pe(this,e)}preferences(){return new d(this).push("preferences")}uiPreferences(){return new d(this).push("ui-preferences")}deviceUsage(){return new w(this).push("device-usage")}statistics(){return new d(this).push("statistics")}deviceStatistics(){return new w(this).push("device-statistics")}accessGroups(){return new w(this).push("access-groups")}accessGroup(e){return new z(this,e)}smartbearTunnel(e){return new d(this).push("tunnels",e)}smartbearTunnels(){return new ce(this)}deleteAccount(){return new d(this).push("delete")}}class me extends d{constructor(e){super(e),this.push("user-sessions")}login(e){return new d(this).push("login").post().data(e)}logout(){return new d(this).push("logout").post()}sso(e){return new d(this).push(e+"-login")}portalLogin(){return new d(this).push("portal-login").post()}}globalThis.isNodeJs&&(i.default.defaults.headers.common["User-Agent"]="Bitbar Cloud API Client for JavaScript v1.0.0"),i.default.defaults.maxContentLength=1073741824;return{API:class{constructor(e){if(this.config=e,this.axiosConfig={},null==e)throw new Error("config cannot be empty");if(null==this.config.cloudUrl)throw new TypeError("cloudUrl cannot be empty");if("string"!=typeof this.config.cloudUrl)throw new TypeError("cloudUrl must be a string");if(!/^https?:\/\/.{2,}/.test(this.config.cloudUrl))throw new Error("cloudUrl doesn't look like a URL");if(this.axiosConfig.baseURL=this.config.cloudUrl.replace(/\/+$/,"")+"/api",this.config.v2=!!this.config.v2,this.config.v2&&(this.axiosConfig.baseURL+="/v2"),this.config.apiKey){if("string"!=typeof this.config.apiKey)throw new TypeError("apiKey must be a string");if(!/^[A-Za-z0-9]{32}$/.test(this.config.apiKey))throw new Error("apiKey is in the wrong format");this.axiosConfig.auth={username:this.config.apiKey,password:""}}this.axiosConfig.withCredentials=null!=e.withCredentials&&e.withCredentials,this.axios=i.default.create(this.axiosConfig)}get baseUrl(){return this.axiosConfig.baseURL}account(e){return new se(this,e)}admin(){return new Y(this)}broker(){return new te(this)}clusters(){return new w(this).push("clusters")}cluster(e){return new D(this,e)}device(e){return new re(this,e)}deviceGroup(e){return new F(this,e)}deviceGroups(){return new w(this).push("device-groups")}devices(){return new J(this)}deviceSession(e){return new W(this,e)}deviceSessions(){return new w(this).push("device-sessions")}deviceStatistics(){return new w(this).push("device-statistics")}enums(){return new d(this).push("enums")}files(){return new w(this).push("files")}file(e){return new B(this,e)}labelGroups(){return new w(this).push("label-groups")}labelGroup(e){return new ne(this,e)}labels(){return new w(this).push("labels")}licenses(){return new d(this).push("licenses")}license(){return new d(this).push("license")}me(){return this.user("me")}projects(){return new w(this).push("projects")}project(e){return new V(this,e)}properties(){return new Q(this)}property(e){return new d(this).push("properties",e)}run(e){return new K(this,e)}services(){return new X(this)}user(e){return new fe(this,e)}users(){return new ee(this)}userSession(){return new me(this)}},FilterBuilder:a}}));
|
|
3
18
|
//# sourceMappingURL=bitbar-cloud-api-client.min.js.map
|