UNPKG

@putdotio/api-client

Version:

JavaScript SDK for interacting with the put.io API.

3 lines (2 loc) 22.6 kB
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var e=t(require("axios")),n=t(require("qs")),i=t(require("event-emitter")),r=require("js-base64"),o=t(require("urijs"));function s(){return(s=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t}).apply(this,arguments)}var a={},u={config:a,data:{foo:"bar",status:"OK"},headers:{"x-trace-id":"MOCK_TRACE_ID"},status:200,statusText:"ok"},c={config:a,isAxiosError:!0,name:"AXIOS_ERROR",message:"AXIOS_ERROR_MESSAGE",toJSON:function(){return{name:this.name,message:this.message}}},l=s({},c,{data:{error_type:"MOCK_ERROR",error_message:"MOCK_MESSAGE",status_code:0,extra:{foo:"bar"}},toJSON:function(){return this.data}}),p={baseURL:"https://api.put.io/v2",clientID:1,webAppURL:"https://app.put.io"},f=function(t){return t},d=function(t){return"object"==typeof t&&!!t&&!!t.error_type},h=function(t){return Object.keys(t).reduce((function(e,n){return e.append(n,t[n]),e}),new FormData)},_={ERROR:"ERROR",CLIENT_IP_CHANGED:"CLIENT_IP_CHANGED"},g=i(),v=function(){var t="",e=function(e){var n=e.headers["putio-client-ip"];if(t)return n&&t!==n?(g.emit(_.CLIENT_IP_CHANGED,{IP:t,newIP:n}),void(t=n)):void 0;t=n};return{onFulfilled:function(t){return e(t),t},onRejected:function(t){return t.response&&e(t.response),Promise.reject(t)}}},m=function(){return{onFulfilled:f,onRejected:function(t){return g.emit(_.ERROR,t),Promise.reject(t)}}},y=function(){return{onFulfilled:function(t){return s({},t,{body:t.data})},onRejected:function(t){if(!e.isAxiosError(t))return Promise.reject(t);try{var n,i={"x-trace-id":null==(n=t.response)?void 0:n.headers["x-trace-id"],error_message:t.message,error_type:"ERROR",status_code:0,extra:{}};if("ECONNABORTED"===t.code&&(i=s({},i,{status_code:408,error_message:"Request timed out"})),t.response&&t.response.data){var r=t.response,o=r.status,a=r.data;i=d(a)?s({},i,a,{status_code:o}):s({},i,{status_code:o})}else if(t.request instanceof XMLHttpRequest&&4===t.request.readyState){var u=t.request,c=u.status,l=JSON.parse(u.responseText);i=s({},i,l,{status_code:c})}var p=s({},t,{data:i,toJSON:function(){return i}});return Promise.reject(p)}catch(e){return Promise.reject(t)}}}},S=function(){function t(t){this.client=t}var e=t.prototype;return e.Info=function(t){return void 0===t&&(t={}),this.client.get("/account/info",{params:t})},e.Settings=function(){return this.client.get("/account/settings")},e.SaveSettings=function(t){return this.client.post("/account/settings",{data:t})},e.Clear=function(t){return this.client.post("/account/clear",{data:t})},e.Destroy=function(t){return this.client.post("/account/destroy",{data:{current_password:t}})},e.Confirmations=function(t){return this.client.get("/account/confirmation/list",{data:{type:t}})},t}(),C=function(){function t(t){this.client=t}var e=t.prototype;return e.GenerateTOTP=function(){return this.client.post("/two_factor/generate/totp")},e.VerifyTOTP=function(t,e){return this.client.post("/two_factor/verify/totp",{params:{oauth_token:t},data:{code:e}})},e.GetRecoveryCodes=function(){return this.client.get("/two_factor/recovery_codes")},e.RegenerateRecoveryCodes=function(){return this.client.post("/two_factor/recovery_codes/refresh")},t}(),R=function(){function t(t){this.client=t,this.TwoFactor=new C(t)}var e=t.prototype;return e.GetLoginURL=function(t){var e=t.redirectURI,n=t.responseType,i=void 0===n?"token":n,r=t.state,s=t.clientID,a=t.clientName,u=this.client.options;return new o(u.webAppURL+"/authenticate").addQuery({client_id:s||u.clientID,client_name:a,redirect_uri:e,response_type:i,isolated:1,state:r}).toString()},e.Login=function(t){var e=t.app;return this.client.put("/oauth2/authorizations/clients/"+e.client_id+"?client_secret="+e.client_secret,{headers:{Authorization:"Basic "+r.Base64.encode(t.username+":"+t.password)}})},e.Logout=function(){return this.client.post("/oauth/grants/logout")},e.Register=function(t){return this.client.post("/registration/register",{data:s({client_id:this.client.options.clientID},t)})},e.Exists=function(t,e){return this.client.get("/registration/exists/"+t,{params:{value:e}})},e.GetVoucher=function(t){return this.client.get("/registration/voucher/"+t)},e.GetGiftCard=function(t){return this.client.get("/registration/gift_card/"+t)},e.GetFamilyInvite=function(t){return this.client.get("/registration/family/"+t)},e.ForgotPassword=function(t){return this.client.post("/registration/password/forgot",{data:{mail:t}})},e.ResetPassword=function(t,e){return this.client.post("/registration/password/reset",{data:{key:t,password:e}})},e.GetCode=function(t,e){return this.client.get("/oauth2/oob/code",{params:{app_id:t,client_name:e}})},e.CheckCodeMatch=function(t){return this.client.get("/oauth2/oob/code/"+t)},e.LinkDevice=function(t){return this.client.post("/oauth2/oob/code",{data:{code:t}})},e.Grants=function(){return this.client.get("/oauth/grants/")},e.RevokeApp=function(t){return this.client.post("/oauth/grants/"+t+"/delete")},e.Clients=function(){return this.client.get("/oauth/clients/")},e.RevokeClient=function(t){return this.client.post("/oauth/clients/"+t+"/delete")},e.RevokeAllClients=function(){return this.client.post("/oauth/clients/delete-all")},e.ValidateToken=function(t){return this.client.get("/oauth2/validate",{params:{oauth_token:t}})},t}(),E=function(){function t(t){this.client=t}var e=t.prototype;return e.GetAuthorizeURL=function(t){void 0===t&&(t={});var e=this.client,n=e.token;return new o(e.options.baseURL+"/oauth2/authorize").addQuery(s({},t,{oauth_token:n})).toString()},e.Query=function(){return this.client.get("/oauth/apps")},e.Get=function(t){return this.client.get("/oauth/apps/"+t)},e.GetIconURL=function(t){var e=this.client;return e.options.baseURL+"/oauth/apps/"+t+"/icon?oauth_token="+e.token},e.SetIcon=function(t,e){return this.client.post("/oauth/apps/"+t+"/icon",{data:e})},e.Create=function(t){return this.client.post("/oauth/apps/register",{data:h(t)})},e.Update=function(t){return this.client.post("/oauth/apps/"+t.id,{data:h(t)})},e.Delete=function(t){return this.client.post("/oauth/apps/"+t+"/delete")},e.RegenerateToken=function(t){return this.client.post("/oauth/apps/"+t+"/regenerate_token")},e.GetPopularApps=function(){return this.client.get("/oauth/apps/popular")},t}(),I=function(){function t(t){this.client=t}var e=t.prototype;return e.Create=function(t){var e=t.ids,n=t.cursor,i=t.excludeIds,r=void 0===i?[]:i;return this.client.post("/download_links/create",{data:{file_ids:(void 0===e?[]:e).join(","),exclude_ids:r.join(","),cursor:n}})},e.Get=function(t){return this.client.get("/download_links/"+t)},t}(),w=function(){function t(t){this.client=t}var e=t.prototype;return e.Clone=function(t){var e=t.ids,n=t.cursor,i=t.excludeIds,r=void 0===i?[]:i,o=t.parentId,s=void 0===o?0:o;return this.client.post("/sharing/clone",{data:{file_ids:(void 0===e?[]:e).join(","),exclude_ids:r.join(","),parent_id:s,cursor:n}})},e.CloneInfo=function(t){return this.client.get("/sharing/clone/"+t)},t}(),x=function(){function t(t){this.client=t}var e=t.prototype;return e.Read=function(){return this.client.get("/config")},e.Write=function(t){return this.client.put("/config",{data:{config:t}})},e.GetKey=function(t){return this.client.get("/config/"+t)},e.SetKey=function(t,e){return this.client.put("/config/"+t,{data:{value:e}})},e.DeleteKey=function(t){return this.client.delete("/config/"+t)},t}(),A=function(){function t(t){this.client=t}var e=t.prototype;return e.Query=function(){return this.client.get("/events/list")},e.Delete=function(t){return this.client.post("/events/delete/"+t)},e.Clear=function(){return this.client.post("/events/delete")},t}(),T=function(){function t(t){this.client=t}var e=t.prototype;return e.Download=function(t){return this.client.get("/files/"+t+"/download")},e.GetStorageURL=function(t){return this.client.get("/files/"+t+"/url")},e.GetContent=function(t){return this.client.get("/files/"+t+"/stream")},e.Subtitles=function(t,e,n){return this.client.get("/files/"+t+"/subtitles",{params:{languages:n,oauth_token:e}})},e.GetHLSStreamURL=function(t,e){var n=void 0===e?{}:e,i=n.token,r=void 0===i?"":i,s=n.subtitleLanguages,a=void 0===s?[]:s,u=n.maxSubtitleCount,c=n.playOriginal;return new o(this.client.options.baseURL+"/files/"+t+"/hls/media.m3u8").addQuery({oauth_token:r||this.client.token,subtitle_languages:a,max_subtitle_count:u,original:"boolean"==typeof c?c?1:0:void 0}).toString()},e.ConvertToMp4=function(t){return this.client.post("/files/"+t+"/mp4")},e.ConvertStatus=function(t){return this.client.get("/files/"+t+"/mp4")},e.DeleteMp4=function(t){return this.client.delete("/files/"+t+"/mp4")},e.SharedWith=function(t){return this.client.get("/files/"+t+"/shared-with")},e.Unshare=function(t,e){var n=e;return n&&(n=(n=Array.isArray(n)?n.map((function(t){return t.toString()})):[n.toString()]).join(",")),this.client.post("/files/"+t+"/unshare",{data:{shares:n||"everyone"}})},e.SaveAsMp4=function(t){return this.client.get("/files/"+t+"/put-mp4-to-my-folders")},e.Rename=function(t,e){return this.client.post("/files/rename",{data:{file_id:t,name:e}})},e.GetStartFrom=function(t){return this.client.get("/files/"+t+"/start-from")},e.SetStartFrom=function(t,e){return this.client.post("/files/"+t+"/start-from/set",{data:{time:parseInt(e,10)}})},e.ResetStartFrom=function(t){return this.client.get("/files/"+t+"/start-from/delete")},e.Extract=function(t,e){return this.client.post("/files/extract",{data:{password:e,user_file_ids:[t.toString()]}})},e.FindNextFile=function(t,e){return this.client.get("/files/"+t+"/next-file",{params:{file_type:e}})},e.FindNextVideo=function(t){return this.client.get("/files/"+t+"/next-video")},t}(),P=function(){function t(t){this.client=t}var e=t.prototype;return e.Query=function(t,e){var n=void 0===e?{}:e;return this.client.get("/files/"+("friends"===t?"items-shared-with-you":"list"),{params:{parent_id:"friends"!==t?t:null,per_page:n.perPage,sort_by:n.sortBy,content_type:n.contentType,file_type:n.fileType,stream_url:n.streamUrl,stream_url_parent:n.streamUrlParent,mp4_stream_url:n.mp4StreamUrl,mp4_stream_url_parent:n.mp4StreamUrlParent,hidden:n.hidden,mp4_status:n.mp4Status,mp4_status_parent:n.mp4StatusParent,video_metadata:n.videoMetadata,video_metadata_parent:n.videoMetadataParent,codecs_parent:n.codecsParent,media_info_parent:n.mediaInfoParent,breadcrumbs:n.breadcrumbs,total:n.total}})},e.Continue=function(t,e){return this.client.post("/files/list/continue",{data:{cursor:t},params:{per_page:(void 0===e?{}:e).perPage}})},e.Search=function(t,e){var n=void 0===e?{perPage:50}:e;return this.client.get("/files/search",{params:{query:t,per_page:n.perPage,type:n.fileType}})},e.ContinueSearch=function(t,e){return this.client.post("/files/search/continue",{data:{cursor:t},params:{per_page:(void 0===e?{}:e).perPage}})},e.NewFolder=function(t,e){return void 0===e&&(e=0),this.CreateFolder({name:t,parentId:e})},e.CreateFolder=function(t){return this.client.post("/files/create-folder",{data:{name:t.name,parent_id:t.parentId,path:t.path}})},e.DeleteAll=function(t,e,n){void 0===e&&(e=[]);var i=n.partialDelete,r=void 0!==i&&i,o=n.skipTrash;return this.client.post("/files/delete",{data:{cursor:t,exclude_ids:e.join(",")},params:{skip_nonexistents:!0,partial_delete:r,skip_trash:o}})},e.Delete=function(t,e){void 0===t&&(t=[]);var n=void 0===e?{}:e,i=n.ignoreFileOwner,r=void 0!==i&&i,o=n.partialDelete,s=void 0!==o&&o,a=n.skipTrash;return this.client.post("/files/delete",{data:{file_ids:t.join(",")},params:{skip_nonexistents:!0,skip_owner_check:r,partial_delete:s,skip_trash:a}})},e.Extract=function(t){var e=t.ids,n=t.cursor,i=t.excludeIds,r=void 0===i?[]:i;return this.client.post("/files/extract",{data:{user_file_ids:(void 0===e?[]:e).join(","),exclude_ids:r.join(","),cursor:n}})},e.ExtractStatus=function(){return this.client.get("/files/extract")},e.Share=function(t){var e=t.ids,n=t.excludeIds,i=void 0===n?[]:n;return this.client.post("/files/share",{data:{cursor:t.cursor,friends:t.friends,file_ids:(void 0===e?[]:e).join(","),exclude_ids:i.join(",")}})},e.Move=function(t,e){return this.client.post("/files/move",{data:{file_ids:t.join(","),parent_id:e}})},e.MoveAll=function(t){var e=t.excludeIds;return this.client.post("/files/move",{data:{cursor:t.cursor,parent_id:t.to,exclude_ids:(void 0===e?[]:e).join(",")}})},e.ConvertToMp4=function(t){var e=t.ids,n=t.cursor,i=t.excludeIds,r=void 0===i?[]:i;return this.client.post("/files/convert_mp4",{data:{file_ids:(void 0===e?[]:e).join(","),exclude_ids:r.join(","),cursor:n}})},e.SharedOnes=function(){return this.client.get("/files/shared")},e.PublicShares=function(){return this.client.get("/files/public/list")},e.SetWatchStatus=function(t){var e=t.ids,n=t.cursor,i=t.excludeIds,r=void 0===i?[]:i,o=t.watched;return this.client.post("/files/watch-status",{data:{file_ids:(void 0===e?[]:e).join(","),exclude_ids:r.join(","),cursor:n,watched:o}})},e.Upload=function(t){var e=t.file,n=t.fileName,i=t.parentId,r=void 0===i?0:i,o=new FormData;return o.append("file",e),n&&o.append("filename",n),r&&o.append("parent_id",r.toString()),this.client.post("/files/upload",{data:o,headers:{"Content-Type":"multipart/form-data"}})},t}(),D=function(){function t(t){this.client=t}var e=t.prototype;return e.GetAll=function(){return this.client.get("/account/friend_invites")},e.Create=function(){return this.client.post("/account/create_friend_invitation")},t}(),O=function(){function t(t){this.client=t}var e=t.prototype;return e.Query=function(){return this.client.get("/friends/list")},e.Search=function(t){return this.client.get("/friends/user-search/"+t)},e.WaitingRequests=function(){return this.client.get("/friends/waiting-requests")},e.WaitingRequestsCount=function(){return this.client.get("/friends/waiting-requests-count")},e.SendFrienshipRequest=function(t){return this.client.post("/friends/"+t+"/request")},e.Remove=function(t){return this.client.post("/friends/"+t+"/unfriend")},e.Approve=function(t){return this.client.post("/friends/"+t+"/approve")},e.Deny=function(t){return this.client.post("/friends/"+t+"/deny")},e.SharedFolder=function(t){return this.client.get("/friends/"+t+"/files")},t}(),k=function(){function t(t){this.client=t}return t.prototype.SendEvent=function(t){var e=t.ingredients;return this.client.post("/ifttt-client/event",{data:{client_name:t.clientName,event_type:t.eventType,ingredients:void 0===e?{}:e}})},t}(),j=function(){function t(t){var e=this;this.ChangePlan={GET:function(t){return e.client.get("/payment/change_plan/"+t.plan_path,{params:{payment_type:t.payment_type,coupon_code:t.coupon_code}})},POST:function(t){return e.client.post("/payment/change_plan/"+t.plan_path,{data:{payment_type:t.payment_type,confirmation_code:t.confirmation_code},params:{coupon_code:t.coupon_code}})}},this.client=t}var e=t.prototype;return e.Info=function(){return this.client.get("/payment/info")},e.Plans=function(){return this.client.get("/payment/plans")},e.Options=function(){return this.client.get("/payment/options")},e.History=function(t){var e=(void 0===t?{}:t).unReportedOnly;return this.client.get("/payment/history",{params:{unreported_only:void 0!==e&&e}})},e.Invites=function(){return this.client.get("/payment/invites")},e.CreateNanoPaymentRequest=function(t){return this.client.post("/payment/methods/nano/request",{data:{plan_code:t.planCode}})},e.CreateOpenNodeCharge=function(t){return this.client.post("/payment/methods/opennode/charge",{data:{plan_fs_path:t.planPath}})},e.CancelSubscription=function(){return this.client.post("/payment/stop_subscription")},e.GetVoucherInfo=function(t){return this.client.get("/payment/redeem_voucher/"+t)},e.RedeemVoucher=function(t){return this.client.post("/payment/redeem_voucher/"+t)},e.Report=function(t){return void 0===t&&(t=[]),this.client.post("/payment/report",{data:{payment_ids:t.join(",")}})},e.AddWaitingPayment=function(t){return this.client.post("/payment/paddle_waiting_payment",{data:t})},t}(),b=function(){function t(t){this.client=t}var e=t.prototype;return e.Query=function(){return this.client.get("/rss/list")},e.Get=function(t){return this.client.get("/rss/"+t)},e.Create=function(t){return this.client.post("/rss/create",{data:t})},e.Update=function(t,e){return this.client.post("/rss/"+t,{data:e})},e.Pause=function(t){return this.client.post("/rss/"+t+"/pause")},e.Resume=function(t){return this.client.post("/rss/"+t+"/resume")},e.Delete=function(t){return this.client.post("/rss/"+t+"/delete")},e.Logs=function(t){return this.client.get("/rss/"+t+"/items")},e.ClearLogs=function(t){return this.client.post("/rss/"+t+"/clear-log")},e.RetryItem=function(t,e){return this.client.post("/rss/"+t+"/items/"+e+"/retry")},t}(),F=function(){function t(t){this.client=t}var e=t.prototype;return e.Add=function(t){return this.client.post("/transfers/add",{data:t})},e.AddMulti=function(t){return this.client.post("/transfers/add-multi",{data:{urls:JSON.stringify(t)}})},e.Get=function(t){return this.client.get("/transfers/"+t)},e.Query=function(t){var e=void 0===t?{}:t;return this.client.get("/transfers/list",{params:{per_page:e.perPage,total:e.total}})},e.Continue=function(t,e){return this.client.post("/transfers/list/continue",{data:{cursor:t,per_page:(void 0===e?{}:e).perPage}})},e.ClearAll=function(){return this.client.post("/transfers/clean")},e.Cancel=function(t){return void 0===t&&(t=[]),this.client.post("/transfers/cancel",{data:{transfer_ids:t.join(",")}})},e.Retry=function(t){return this.client.post("/transfers/retry",{data:{id:t}})},e.Reannounce=function(t){return this.client.post("/transfers/reannounce",{data:{id:t}})},e.Count=function(){return this.client.get("/transfers/count")},t}(),L=function(){function t(t){this.client=t}var e=t.prototype;return e.List=function(t){var e=(void 0===t?{}:t).limit;return this.client.get("/trash/list",{params:{per_page:void 0===e?50:e}})},e.Continue=function(t,e){var n=(void 0===e?{}:e).limit;return this.client.post("/trash/list/continue",{data:{cursor:t,per_page:void 0===n?50:n}})},e.Restore=function(t){var e=t.useCursor,n=void 0!==e&&e,i=t.ids;return this.client.post("/trash/restore",{data:{cursor:n?t.cursor:void 0,file_ids:n?void 0:(void 0===i?[]:i).join(",")}})},e.Delete=function(t){var e=t.useCursor,n=void 0!==e&&e,i=t.ids;return this.client.post("/trash/delete",{data:{cursor:n?t.cursor:void 0,file_ids:n?void 0:(void 0===i?[]:i).join(",")}})},e.Empty=function(){return this.client.post("/trash/empty")},t}(),N=function(){function t(t){this.client=t}return t.prototype.Routes=function(){return this.client.get("/tunnel/routes")},t}(),G=function(){function t(t){this.client=t}var e=t.prototype;return e.Info=function(t){return this.client.get("/account/info",{params:t})},e.Settings=function(){return this.client.get("/account/settings")},e.SaveSettings=function(t){return this.client.post("/account/settings",{data:t})},e.Config=function(){return this.client.get("/config")},e.SaveConfig=function(t){return this.client.put("/config",{data:{config:t}})},e.ClearData=function(t){return this.client.post("/account/clear",{data:t})},e.Destroy=function(t){return this.client.post("/account/destroy",{data:{current_password:t}})},e.Confirmations=function(t){return this.client.get("/account/confirmation/list",{data:{type:t}})},t}(),M=function(){function t(t){this.client=t}var e=t.prototype;return e.Query=function(){return this.client.get("/zips/list")},e.Create=function(t){var e=t.excludeIds,n=t.ids,i=void 0===n?[]:n;return this.client.post("/zips/create",{data:{cursor:t.cursor,exclude_ids:(void 0===e?[]:e).join(","),file_ids:i.join(",")}})},e.Get=function(t){return this.client.get("/zips/"+t)},e.Retry=function(t){return this.client.get("/zips/"+t+"/retry")},e.Cancel=function(t){return this.client.get("/zips/"+t+"/cancel")},t}(),U=function(){function t(e){this.options=s({},t.DEFAULT_OPTIONS,e),this.http=this.createHTTPClient(),this.Account=new S(this),this.Auth=new R(this),this.DownloadLinks=new I(this),this.Sharing=new w(this),this.Config=new x(this),this.Events=new A(this),this.Files=new P(this),this.File=new T(this),this.Friends=new O(this),this.FriendInvites=new D(this),this.OAuth=new E(this),this.Payment=new j(this),this.RSS=new b(this),this.Transfers=new F(this),this.Trash=new L(this),this.Tunnel=new N(this),this.User=new G(this),this.Zips=new M(this),this.IFTTT=new k(this)}var i=t.prototype;return i.once=function(t,e){g.once(t,e)},i.on=function(t,e){g.on(t,e)},i.off=function(t,e){g.off(t,e)},i.configure=function(t){return this.options=s({},this.options,t),this},i.setToken=function(t){return this.token=t,this.http.defaults.headers.common.Authorization="token "+t,this},i.clearToken=function(){return this.token=void 0,this.http.defaults.headers.common.Authorization="",this},i.get=function(t,e){return this.http(s({method:"GET",url:t},e))},i.post=function(t,e){return this.http(s({method:"POST",url:t},e))},i.put=function(t,e){return this.http(s({method:"PUT",url:t},e))},i.delete=function(t,e){return this.http(s({method:"DELETE",url:t},e))},i.createHTTPClient=function(){var t=this,i=e.create({baseURL:this.options.baseURL,withCredentials:!0,timeout:3e4,paramsSerializer:function(t){return n.stringify(t,{arrayFormat:"comma"})}});return[y,v,m].map((function(e){return e(t.options)})).forEach((function(t){i.interceptors.response.use(t.onFulfilled,t.onRejected)})),i},t}();U.EVENTS=_,U.DEFAULT_OPTIONS=p,exports.ACCOUNT_CLEAR_OPTION_KEYS=["files","finished_transfers","active_transfers","rss_feeds","rss_logs","history","trash","friends"],exports.DEFAULT_CLIENT_OPTIONS=p,exports.FileSortOptions={NAME_ASC:"NAME_ASC",NAME_DESC:"NAME_DESC",SIZE_ASC:"SIZE_ASC",SIZE_DESC:"SIZE_DESC",DATE_ASC:"DATE_ASC",DATE_DESC:"DATE_DESC",MODIFIED_ASC:"MODIFIED_ASC",MODIFIED_DESC:"MODIFIED_DESC"},exports.createMockErrorResponse=function(t){return s({},c,{data:t,toJSON:function(){return this.data}})},exports.createMockResponse=function(t,e){return void 0===e&&(e=200),{config:a,data:s({},t,{status:"OK"}),status:e,headers:{},statusText:"ok"}},exports.createMockXMLHttpRequest=function(t,e,n){var i=new XMLHttpRequest;return new Proxy(i,{get:function(i,r){return"readyState"===r?t:"status"===r?e:"responseText"===r?n:i[r]}})},exports.default=U,exports.isPutioAPIError=function(t){return"object"==typeof t&&!!t&&!!t.data&&d(t.data)},exports.isPutioAPIErrorResponse=d,exports.mockAxiosError=c,exports.mockPutioAPIClientError=l,exports.mockPutioAPIClientResponse=u; //# sourceMappingURL=api-client.cjs.production.min.js.map