UNPKG

@nethesis/phone-island

Version:
3 lines (2 loc) 4.97 kB
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),t=require("../store/index.js");exports.changeDefaultDevice=function(r){return e.__awaiter(this,void 0,void 0,(function(){var s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),s=t.store.getState().fetchDefaults,n=s.baseURL,a=s.headers,[4,fetch("".concat(n,"/user/default_device"),{method:"POST",headers:e.__assign({},a),body:JSON.stringify(r)})];case 1:if(!(o=i.sent()).ok)throw new Error(o.statusText);return[2,!0];case 2:throw i.sent();case 3:return[2]}}))}))},exports.changeOperatorStatus=function(r){return e.__awaiter(this,void 0,void 0,(function(){var s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),s=t.store.getState().fetchDefaults,n=s.baseURL,a=s.headers,[4,fetch("".concat(n,"/user/presence"),{method:"POST",headers:e.__assign({},a),body:JSON.stringify(r)})];case 1:if(!(o=i.sent()).ok)throw new Error(o.statusText);return[2,!0];case 2:throw i.sent();case 3:return[2]}}))}))},exports.getAllAvatars=function(){return e.__awaiter(this,void 0,void 0,(function(){var r,s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),r=t.store.getState().fetchDefaults,s=r.baseURL,n=r.headers,[4,fetch("".concat(s,"/user/all_avatars"),{headers:e.__assign({},n)})];case 1:if(!(a=i.sent()).ok)throw new Error(a.statusText);return[4,a.json()];case 2:return[2,i.sent()];case 3:throw o=i.sent(),new Error(o);case 4:return[2]}}))}))},exports.getAllUsersEndpoints=function(){return e.__awaiter(this,void 0,void 0,(function(){var r,s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),r=t.store.getState().fetchDefaults,s=r.baseURL,n=r.headers,[4,fetch("".concat(s,"/user/endpoints/all"),{headers:e.__assign({},n)})];case 1:if(!(a=i.sent()).ok)throw new Error(a.statusText);return[4,a.json()];case 2:return[2,i.sent()];case 3:throw o=i.sent(),new Error(o);case 4:return[2]}}))}))},exports.getCurrentUserInfo=function(){return e.__awaiter(this,void 0,void 0,(function(){var r,s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),r=t.store.getState().fetchDefaults,s=r.baseURL,n=r.headers,[4,fetch("".concat(s,"/user/me"),{headers:e.__assign({},n)})];case 1:if(!(a=i.sent()).ok)throw new Error(a.statusText);return[4,a.json()];case 2:return[2,i.sent()];case 3:throw o=i.sent(),new Error(o);case 4:return[2]}}))}))},exports.getParamUrl=function(){return e.__awaiter(this,void 0,void 0,(function(){var r,s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),r=t.store.getState().fetchDefaults,s=r.baseURL,n=r.headers,[4,fetch("".concat(s,"/user/paramurl"),{headers:e.__assign({},n)})];case 1:if(!(a=i.sent()).ok)throw new Error(a.statusText);return[4,a.json()];case 2:return[2,i.sent()];case 3:throw o=i.sent(),new Error(o);case 4:return[2]}}))}))},exports.getVideoSources=function(){return e.__awaiter(this,void 0,void 0,(function(){var r,s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,3,,4]),r=t.store.getState().fetchDefaults,s=r.baseURL,n=r.headers,[4,fetch("".concat(s,"/streaming/sources"),{headers:e.__assign({},n)})];case 1:if(!(a=i.sent()).ok)throw new Error(a.statusText);return[4,a.json()];case 2:return[2,i.sent()];case 3:throw o=i.sent(),new Error(o);case 4:return[2]}}))}))},exports.openVideoSource=function(r){return e.__awaiter(this,void 0,void 0,(function(){var s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),s=t.store.getState().fetchDefaults,n=s.baseURL,a=s.headers,[4,fetch("".concat(n,"/streaming/open"),{method:"POST",headers:e.__assign({},a),body:JSON.stringify(r)})];case 1:if(!(o=i.sent()).ok)throw new Error(o.statusText);return[2,!0];case 2:throw i.sent();case 3:return[2]}}))}))},exports.subscribe=function(r){return e.__awaiter(this,void 0,void 0,(function(){var s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),s=t.store.getState().fetchDefaults,n=s.baseURL,a=s.headers,[4,fetch("".concat(n,"/streaming/subscribe"),{method:"POST",headers:e.__assign({},a),body:JSON.stringify(r)})];case 1:if(!(o=i.sent()).ok)throw new Error(o.statusText);return[2,!0];case 2:throw i.sent();case 3:return[2]}}))}))},exports.unsubscribe=function(r){return e.__awaiter(this,void 0,void 0,(function(){var s,n,a,o;return e.__generator(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),s=t.store.getState().fetchDefaults,n=s.baseURL,a=s.headers,[4,fetch("".concat(n,"/streaming/unsubscribe"),{method:"POST",headers:e.__assign({},a),body:JSON.stringify(r)})];case 1:if(!(o=i.sent()).ok)throw new Error(o.statusText);return[2,!0];case 2:throw i.sent();case 3:return[2]}}))}))}; //# sourceMappingURL=user.js.map