From ad371e63f5b0022444c6c9e8214d65b481ab2a68 Mon Sep 17 00:00:00 2001 From: Jonxslays <51417989+Jonxslays@users.noreply.github.com> Date: Wed, 16 Aug 2023 02:27:56 +0000 Subject: [PATCH] Deployed 7b74d5c to v0.4.1 with MkDocs 1.5.2 and mike 1.1.2 --- stable/404.html | 6 +- stable/changelog/index.html | 6 +- stable/contributing/index.html | 6 +- stable/getting-started/client/index.html | 6 +- .../getting-started/installation/index.html | 6 +- stable/getting-started/result/index.html | 6 +- stable/index.html | 6 +- stable/license/index.html | 6 +- stable/reference/client/index.html | 6 +- stable/reference/errors/index.html | 6 +- stable/reference/models/index.html | 6 +- stable/reference/result/index.html | 6 +- stable/reference/routes/index.html | 6 +- stable/reference/serializer/index.html | 6 +- stable/reference/services/index.html | 6 +- stable/reference/undefined/index.html | 16 + v0.4.1/404.html | 707 ++ v0.4.1/assets/_mkdocstrings.css | 64 + v0.4.1/assets/images/favicon.png | Bin 0 -> 1870 bytes .../assets/javascripts/bundle.220ee61c.min.js | 29 + .../javascripts/bundle.220ee61c.min.js.map | 8 + .../javascripts/lunr/min/lunr.ar.min.js | 1 + .../javascripts/lunr/min/lunr.da.min.js | 18 + .../javascripts/lunr/min/lunr.de.min.js | 18 + .../javascripts/lunr/min/lunr.du.min.js | 18 + .../javascripts/lunr/min/lunr.es.min.js | 18 + .../javascripts/lunr/min/lunr.fi.min.js | 18 + .../javascripts/lunr/min/lunr.fr.min.js | 18 + .../javascripts/lunr/min/lunr.hi.min.js | 1 + .../javascripts/lunr/min/lunr.hu.min.js | 18 + .../javascripts/lunr/min/lunr.hy.min.js | 1 + .../javascripts/lunr/min/lunr.it.min.js | 18 + .../javascripts/lunr/min/lunr.ja.min.js | 1 + .../javascripts/lunr/min/lunr.jp.min.js | 1 + .../javascripts/lunr/min/lunr.kn.min.js | 1 + .../javascripts/lunr/min/lunr.ko.min.js | 1 + .../javascripts/lunr/min/lunr.multi.min.js | 1 + .../javascripts/lunr/min/lunr.nl.min.js | 18 + .../javascripts/lunr/min/lunr.no.min.js | 18 + .../javascripts/lunr/min/lunr.pt.min.js | 18 + .../javascripts/lunr/min/lunr.ro.min.js | 18 + .../javascripts/lunr/min/lunr.ru.min.js | 18 + .../javascripts/lunr/min/lunr.sa.min.js | 1 + .../lunr/min/lunr.stemmer.support.min.js | 1 + .../javascripts/lunr/min/lunr.sv.min.js | 18 + .../javascripts/lunr/min/lunr.ta.min.js | 1 + .../javascripts/lunr/min/lunr.te.min.js | 1 + .../javascripts/lunr/min/lunr.th.min.js | 1 + .../javascripts/lunr/min/lunr.tr.min.js | 18 + .../javascripts/lunr/min/lunr.vi.min.js | 1 + .../javascripts/lunr/min/lunr.zh.min.js | 1 + v0.4.1/assets/javascripts/lunr/tinyseg.js | 206 + v0.4.1/assets/javascripts/lunr/wordcut.js | 6708 +++++++++++++++++ .../workers/search.74e28a9f.min.js | 42 + .../workers/search.74e28a9f.min.js.map | 8 + .../assets/stylesheets/main.26e3688c.min.css | 1 + .../stylesheets/main.26e3688c.min.css.map | 1 + .../stylesheets/palette.ecc896b0.min.css | 1 + .../stylesheets/palette.ecc896b0.min.css.map | 1 + v0.4.1/changelog/index.html | 1086 +++ v0.4.1/contributing/index.html | 867 +++ v0.4.1/getting-started/client/index.html | 888 +++ .../getting-started/installation/index.html | 822 ++ v0.4.1/getting-started/result/index.html | 836 ++ v0.4.1/index.html | 960 +++ v0.4.1/license/index.html | 1353 ++++ v0.4.1/objects.inv | Bin 0 -> 906 bytes v0.4.1/reference/client/index.html | 1434 ++++ v0.4.1/reference/errors/index.html | 1022 +++ v0.4.1/reference/models/index.html | 3241 ++++++++ v0.4.1/reference/result/index.html | 1274 ++++ v0.4.1/reference/routes/index.html | 1589 ++++ v0.4.1/reference/serializer/index.html | 1076 +++ v0.4.1/reference/services/index.html | 3747 +++++++++ v0.4.1/reference/undefined/index.html | 1257 +++ v0.4.1/search/search_index.json | 1 + v0.4.1/sitemap.xml | 78 + v0.4.1/sitemap.xml.gz | Bin 0 -> 339 bytes versions.json | 2 +- 79 files changed, 29654 insertions(+), 46 deletions(-) create mode 100644 stable/reference/undefined/index.html create mode 100644 v0.4.1/404.html create mode 100644 v0.4.1/assets/_mkdocstrings.css create mode 100644 v0.4.1/assets/images/favicon.png create mode 100644 v0.4.1/assets/javascripts/bundle.220ee61c.min.js create mode 100644 v0.4.1/assets/javascripts/bundle.220ee61c.min.js.map create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.ar.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.da.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.de.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.du.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.es.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.fi.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.fr.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.hi.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.hu.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.hy.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.it.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.ja.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.jp.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.kn.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.ko.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.multi.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.nl.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.no.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.pt.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.ro.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.ru.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.sa.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.stemmer.support.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.sv.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.ta.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.te.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.th.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.tr.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.vi.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/min/lunr.zh.min.js create mode 100644 v0.4.1/assets/javascripts/lunr/tinyseg.js create mode 100644 v0.4.1/assets/javascripts/lunr/wordcut.js create mode 100644 v0.4.1/assets/javascripts/workers/search.74e28a9f.min.js create mode 100644 v0.4.1/assets/javascripts/workers/search.74e28a9f.min.js.map create mode 100644 v0.4.1/assets/stylesheets/main.26e3688c.min.css create mode 100644 v0.4.1/assets/stylesheets/main.26e3688c.min.css.map create mode 100644 v0.4.1/assets/stylesheets/palette.ecc896b0.min.css create mode 100644 v0.4.1/assets/stylesheets/palette.ecc896b0.min.css.map create mode 100644 v0.4.1/changelog/index.html create mode 100644 v0.4.1/contributing/index.html create mode 100644 v0.4.1/getting-started/client/index.html create mode 100644 v0.4.1/getting-started/installation/index.html create mode 100644 v0.4.1/getting-started/result/index.html create mode 100644 v0.4.1/index.html create mode 100644 v0.4.1/license/index.html create mode 100644 v0.4.1/objects.inv create mode 100644 v0.4.1/reference/client/index.html create mode 100644 v0.4.1/reference/errors/index.html create mode 100644 v0.4.1/reference/models/index.html create mode 100644 v0.4.1/reference/result/index.html create mode 100644 v0.4.1/reference/routes/index.html create mode 100644 v0.4.1/reference/serializer/index.html create mode 100644 v0.4.1/reference/services/index.html create mode 100644 v0.4.1/reference/undefined/index.html create mode 100644 v0.4.1/search/search_index.json create mode 100644 v0.4.1/sitemap.xml create mode 100644 v0.4.1/sitemap.xml.gz diff --git a/stable/404.html b/stable/404.html index 09ef3c0..a50fffc 100644 --- a/stable/404.html +++ b/stable/404.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../v0.4.0/404.html... + Redirecting to ../v0.4.1/404.html... \ No newline at end of file diff --git a/stable/changelog/index.html b/stable/changelog/index.html index fe14d6f..4240ab7 100644 --- a/stable/changelog/index.html +++ b/stable/changelog/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../v0.4.0/changelog/... + Redirecting to ../../v0.4.1/changelog/... \ No newline at end of file diff --git a/stable/contributing/index.html b/stable/contributing/index.html index d0afb02..223ac4c 100644 --- a/stable/contributing/index.html +++ b/stable/contributing/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../v0.4.0/contributing/... + Redirecting to ../../v0.4.1/contributing/... \ No newline at end of file diff --git a/stable/getting-started/client/index.html b/stable/getting-started/client/index.html index e60f890..5fcb99d 100644 --- a/stable/getting-started/client/index.html +++ b/stable/getting-started/client/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/getting-started/client/... + Redirecting to ../../../v0.4.1/getting-started/client/... \ No newline at end of file diff --git a/stable/getting-started/installation/index.html b/stable/getting-started/installation/index.html index a42a030..6d1dbc9 100644 --- a/stable/getting-started/installation/index.html +++ b/stable/getting-started/installation/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/getting-started/installation/... + Redirecting to ../../../v0.4.1/getting-started/installation/... \ No newline at end of file diff --git a/stable/getting-started/result/index.html b/stable/getting-started/result/index.html index 843e5c6..6b5fde2 100644 --- a/stable/getting-started/result/index.html +++ b/stable/getting-started/result/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/getting-started/result/... + Redirecting to ../../../v0.4.1/getting-started/result/... \ No newline at end of file diff --git a/stable/index.html b/stable/index.html index e320b9e..6f26096 100644 --- a/stable/index.html +++ b/stable/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../v0.4.0/... + Redirecting to ../v0.4.1/... \ No newline at end of file diff --git a/stable/license/index.html b/stable/license/index.html index 86968a8..ed8f158 100644 --- a/stable/license/index.html +++ b/stable/license/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../v0.4.0/license/... + Redirecting to ../../v0.4.1/license/... \ No newline at end of file diff --git a/stable/reference/client/index.html b/stable/reference/client/index.html index bf1f76c..5b32aa8 100644 --- a/stable/reference/client/index.html +++ b/stable/reference/client/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/client/... + Redirecting to ../../../v0.4.1/reference/client/... \ No newline at end of file diff --git a/stable/reference/errors/index.html b/stable/reference/errors/index.html index 8bca623..9c8a2b1 100644 --- a/stable/reference/errors/index.html +++ b/stable/reference/errors/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/errors/... + Redirecting to ../../../v0.4.1/reference/errors/... \ No newline at end of file diff --git a/stable/reference/models/index.html b/stable/reference/models/index.html index d45c319..6a82d8e 100644 --- a/stable/reference/models/index.html +++ b/stable/reference/models/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/models/... + Redirecting to ../../../v0.4.1/reference/models/... \ No newline at end of file diff --git a/stable/reference/result/index.html b/stable/reference/result/index.html index 26b6f21..c8b5b25 100644 --- a/stable/reference/result/index.html +++ b/stable/reference/result/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/result/... + Redirecting to ../../../v0.4.1/reference/result/... \ No newline at end of file diff --git a/stable/reference/routes/index.html b/stable/reference/routes/index.html index b92f36b..f5c1ce8 100644 --- a/stable/reference/routes/index.html +++ b/stable/reference/routes/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/routes/... + Redirecting to ../../../v0.4.1/reference/routes/... \ No newline at end of file diff --git a/stable/reference/serializer/index.html b/stable/reference/serializer/index.html index ab22aab..839aeb1 100644 --- a/stable/reference/serializer/index.html +++ b/stable/reference/serializer/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/serializer/... + Redirecting to ../../../v0.4.1/reference/serializer/... \ No newline at end of file diff --git a/stable/reference/services/index.html b/stable/reference/services/index.html index 5e1a0d1..fa38792 100644 --- a/stable/reference/services/index.html +++ b/stable/reference/services/index.html @@ -4,13 +4,13 @@ Redirecting - Redirecting to ../../../v0.4.0/reference/services/... + Redirecting to ../../../v0.4.1/reference/services/... \ No newline at end of file diff --git a/stable/reference/undefined/index.html b/stable/reference/undefined/index.html new file mode 100644 index 0000000..f1db739 --- /dev/null +++ b/stable/reference/undefined/index.html @@ -0,0 +1,16 @@ + + + + + Redirecting + + + + + Redirecting to ../../../v0.4.1/reference/undefined/... + + \ No newline at end of file diff --git a/v0.4.1/404.html b/v0.4.1/404.html new file mode 100644 index 0000000..d9c139f --- /dev/null +++ b/v0.4.1/404.html @@ -0,0 +1,707 @@ + + + + + + + + + + + + + + + + + + unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ +

404 - Not found

+ +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/assets/_mkdocstrings.css b/v0.4.1/assets/_mkdocstrings.css new file mode 100644 index 0000000..049a254 --- /dev/null +++ b/v0.4.1/assets/_mkdocstrings.css @@ -0,0 +1,64 @@ + +/* Avoid breaking parameter names, etc. in table cells. */ +.doc-contents td code { + word-break: normal !important; +} + +/* No line break before first paragraph of descriptions. */ +.doc-md-description, +.doc-md-description>p:first-child { + display: inline; +} + +/* Max width for docstring sections tables. */ +.doc .md-typeset__table, +.doc .md-typeset__table table { + display: table !important; + width: 100%; +} + +.doc .md-typeset__table tr { + display: table-row; +} + +/* Defaults in Spacy table style. */ +.doc-param-default { + float: right; +} + +/* Keep headings consistent. */ +h1.doc-heading, +h2.doc-heading, +h3.doc-heading, +h4.doc-heading, +h5.doc-heading, +h6.doc-heading { + font-weight: 400; + line-height: 1.5; + color: inherit; + text-transform: none; +} + +h1.doc-heading { + font-size: 1.6rem; +} + +h2.doc-heading { + font-size: 1.2rem; +} + +h3.doc-heading { + font-size: 1.15rem; +} + +h4.doc-heading { + font-size: 1.10rem; +} + +h5.doc-heading { + font-size: 1.05rem; +} + +h6.doc-heading { + font-size: 1rem; +} \ No newline at end of file diff --git a/v0.4.1/assets/images/favicon.png b/v0.4.1/assets/images/favicon.png new file mode 100644 index 0000000000000000000000000000000000000000..1cf13b9f9d978896599290a74f77d5dbe7d1655c GIT binary patch literal 1870 zcmV-U2eJ5xP)Gc)JR9QMau)O=X#!i9;T z37kk-upj^(fsR36MHs_+1RCI)NNu9}lD0S{B^g8PN?Ww(5|~L#Ng*g{WsqleV}|#l zz8@ri&cTzw_h33bHI+12+kK6WN$h#n5cD8OQt`5kw6p~9H3()bUQ8OS4Q4HTQ=1Ol z_JAocz`fLbT2^{`8n~UAo=#AUOf=SOq4pYkt;XbC&f#7lb$*7=$na!mWCQ`dBQsO0 zLFBSPj*N?#u5&pf2t4XjEGH|=pPQ8xh7tpx;US5Cx_Ju;!O`ya-yF`)b%TEt5>eP1ZX~}sjjA%FJF?h7cX8=b!DZl<6%Cv z*G0uvvU+vmnpLZ2paivG-(cd*y3$hCIcsZcYOGh{$&)A6*XX&kXZd3G8m)G$Zz-LV z^GF3VAW^Mdv!)4OM8EgqRiz~*Cji;uzl2uC9^=8I84vNp;ltJ|q-*uQwGp2ma6cY7 z;`%`!9UXO@fr&Ebapfs34OmS9^u6$)bJxrucutf>`dKPKT%%*d3XlFVKunp9 zasduxjrjs>f8V=D|J=XNZp;_Zy^WgQ$9WDjgY=z@stwiEBm9u5*|34&1Na8BMjjgf3+SHcr`5~>oz1Y?SW^=K z^bTyO6>Gar#P_W2gEMwq)ot3; zREHn~U&Dp0l6YT0&k-wLwYjb?5zGK`W6S2v+K>AM(95m2C20L|3m~rN8dprPr@t)5lsk9Hu*W z?pS990s;Ez=+Rj{x7p``4>+c0G5^pYnB1^!TL=(?HLHZ+HicG{~4F1d^5Awl_2!1jICM-!9eoLhbbT^;yHcefyTAaqRcY zmuctDopPT!%k+}x%lZRKnzykr2}}XfG_ne?nRQO~?%hkzo;@RN{P6o`&mMUWBYMTe z6i8ChtjX&gXl`nvrU>jah)2iNM%JdjqoaeaU%yVn!^70x-flljp6Q5tK}5}&X8&&G zX3fpb3E(!rH=zVI_9Gjl45w@{(ITqngWFe7@9{mX;tO25Z_8 zQHEpI+FkTU#4xu>RkN>b3Tnc3UpWzPXWm#o55GKF09j^Mh~)K7{QqbO_~(@CVq! zS<8954|P8mXN2MRs86xZ&Q4EfM@JB94b=(YGuk)s&^jiSF=t3*oNK3`rD{H`yQ?d; ztE=laAUoZx5?RC8*WKOj`%LXEkgDd>&^Q4M^z`%u0rg-It=hLCVsq!Z%^6eB-OvOT zFZ28TN&cRmgU}Elrnk43)!>Z1FCPL2K$7}gwzIc48NX}#!A1BpJP?#v5wkNprhV** z?Cpalt1oH&{r!o3eSKc&ap)iz2BTn_VV`4>9M^b3;(YY}4>#ML6{~(4mH+?%07*qo IM6N<$f(jP3KmY&$ literal 0 HcmV?d00001 diff --git a/v0.4.1/assets/javascripts/bundle.220ee61c.min.js b/v0.4.1/assets/javascripts/bundle.220ee61c.min.js new file mode 100644 index 0000000..116072a --- /dev/null +++ b/v0.4.1/assets/javascripts/bundle.220ee61c.min.js @@ -0,0 +1,29 @@ +"use strict";(()=>{var Ci=Object.create;var gr=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var ki=Object.getOwnPropertyNames,Ht=Object.getOwnPropertySymbols,Hi=Object.getPrototypeOf,yr=Object.prototype.hasOwnProperty,nn=Object.prototype.propertyIsEnumerable;var rn=(e,t,r)=>t in e?gr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,P=(e,t)=>{for(var r in t||(t={}))yr.call(t,r)&&rn(e,r,t[r]);if(Ht)for(var r of Ht(t))nn.call(t,r)&&rn(e,r,t[r]);return e};var on=(e,t)=>{var r={};for(var n in e)yr.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Ht)for(var n of Ht(e))t.indexOf(n)<0&&nn.call(e,n)&&(r[n]=e[n]);return r};var Pt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Pi=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ki(t))!yr.call(e,o)&&o!==r&&gr(e,o,{get:()=>t[o],enumerable:!(n=Ri(t,o))||n.enumerable});return e};var yt=(e,t,r)=>(r=e!=null?Ci(Hi(e)):{},Pi(t||!e||!e.__esModule?gr(r,"default",{value:e,enumerable:!0}):r,e));var sn=Pt((xr,an)=>{(function(e,t){typeof xr=="object"&&typeof an!="undefined"?t():typeof define=="function"&&define.amd?define(t):t()})(xr,function(){"use strict";function e(r){var n=!0,o=!1,i=null,s={text:!0,search:!0,url:!0,tel:!0,email:!0,password:!0,number:!0,date:!0,month:!0,week:!0,time:!0,datetime:!0,"datetime-local":!0};function a(O){return!!(O&&O!==document&&O.nodeName!=="HTML"&&O.nodeName!=="BODY"&&"classList"in O&&"contains"in O.classList)}function f(O){var Qe=O.type,De=O.tagName;return!!(De==="INPUT"&&s[Qe]&&!O.readOnly||De==="TEXTAREA"&&!O.readOnly||O.isContentEditable)}function c(O){O.classList.contains("focus-visible")||(O.classList.add("focus-visible"),O.setAttribute("data-focus-visible-added",""))}function u(O){O.hasAttribute("data-focus-visible-added")&&(O.classList.remove("focus-visible"),O.removeAttribute("data-focus-visible-added"))}function p(O){O.metaKey||O.altKey||O.ctrlKey||(a(r.activeElement)&&c(r.activeElement),n=!0)}function m(O){n=!1}function d(O){a(O.target)&&(n||f(O.target))&&c(O.target)}function h(O){a(O.target)&&(O.target.classList.contains("focus-visible")||O.target.hasAttribute("data-focus-visible-added"))&&(o=!0,window.clearTimeout(i),i=window.setTimeout(function(){o=!1},100),u(O.target))}function v(O){document.visibilityState==="hidden"&&(o&&(n=!0),Y())}function Y(){document.addEventListener("mousemove",N),document.addEventListener("mousedown",N),document.addEventListener("mouseup",N),document.addEventListener("pointermove",N),document.addEventListener("pointerdown",N),document.addEventListener("pointerup",N),document.addEventListener("touchmove",N),document.addEventListener("touchstart",N),document.addEventListener("touchend",N)}function B(){document.removeEventListener("mousemove",N),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",N),document.removeEventListener("pointermove",N),document.removeEventListener("pointerdown",N),document.removeEventListener("pointerup",N),document.removeEventListener("touchmove",N),document.removeEventListener("touchstart",N),document.removeEventListener("touchend",N)}function N(O){O.target.nodeName&&O.target.nodeName.toLowerCase()==="html"||(n=!1,B())}document.addEventListener("keydown",p,!0),document.addEventListener("mousedown",m,!0),document.addEventListener("pointerdown",m,!0),document.addEventListener("touchstart",m,!0),document.addEventListener("visibilitychange",v,!0),Y(),r.addEventListener("focus",d,!0),r.addEventListener("blur",h,!0),r.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&r.host?r.host.setAttribute("data-js-focus-visible",""):r.nodeType===Node.DOCUMENT_NODE&&(document.documentElement.classList.add("js-focus-visible"),document.documentElement.setAttribute("data-js-focus-visible",""))}if(typeof window!="undefined"&&typeof document!="undefined"){window.applyFocusVisiblePolyfill=e;var t;try{t=new CustomEvent("focus-visible-polyfill-ready")}catch(r){t=document.createEvent("CustomEvent"),t.initCustomEvent("focus-visible-polyfill-ready",!1,!1,{})}window.dispatchEvent(t)}typeof document!="undefined"&&e(document)})});var cn=Pt(Er=>{(function(e){var t=function(){try{return!!Symbol.iterator}catch(c){return!1}},r=t(),n=function(c){var u={next:function(){var p=c.shift();return{done:p===void 0,value:p}}};return r&&(u[Symbol.iterator]=function(){return u}),u},o=function(c){return encodeURIComponent(c).replace(/%20/g,"+")},i=function(c){return decodeURIComponent(String(c).replace(/\+/g," "))},s=function(){var c=function(p){Object.defineProperty(this,"_entries",{writable:!0,value:{}});var m=typeof p;if(m!=="undefined")if(m==="string")p!==""&&this._fromString(p);else if(p instanceof c){var d=this;p.forEach(function(B,N){d.append(N,B)})}else if(p!==null&&m==="object")if(Object.prototype.toString.call(p)==="[object Array]")for(var h=0;hd[0]?1:0}),c._entries&&(c._entries={});for(var p=0;p1?i(d[1]):"")}})})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er);(function(e){var t=function(){try{var o=new e.URL("b","http://a");return o.pathname="c d",o.href==="http://a/c%20d"&&o.searchParams}catch(i){return!1}},r=function(){var o=e.URL,i=function(f,c){typeof f!="string"&&(f=String(f)),c&&typeof c!="string"&&(c=String(c));var u=document,p;if(c&&(e.location===void 0||c!==e.location.href)){c=c.toLowerCase(),u=document.implementation.createHTMLDocument(""),p=u.createElement("base"),p.href=c,u.head.appendChild(p);try{if(p.href.indexOf(c)!==0)throw new Error(p.href)}catch(O){throw new Error("URL unable to set base "+c+" due to "+O)}}var m=u.createElement("a");m.href=f,p&&(u.body.appendChild(m),m.href=m.href);var d=u.createElement("input");if(d.type="url",d.value=f,m.protocol===":"||!/:/.test(m.href)||!d.checkValidity()&&!c)throw new TypeError("Invalid URL");Object.defineProperty(this,"_anchorElement",{value:m});var h=new e.URLSearchParams(this.search),v=!0,Y=!0,B=this;["append","delete","set"].forEach(function(O){var Qe=h[O];h[O]=function(){Qe.apply(h,arguments),v&&(Y=!1,B.search=h.toString(),Y=!0)}}),Object.defineProperty(this,"searchParams",{value:h,enumerable:!0});var N=void 0;Object.defineProperty(this,"_updateSearchParams",{enumerable:!1,configurable:!1,writable:!1,value:function(){this.search!==N&&(N=this.search,Y&&(v=!1,this.searchParams._fromString(this.search),v=!0))}})},s=i.prototype,a=function(f){Object.defineProperty(s,f,{get:function(){return this._anchorElement[f]},set:function(c){this._anchorElement[f]=c},enumerable:!0})};["hash","host","hostname","port","protocol"].forEach(function(f){a(f)}),Object.defineProperty(s,"search",{get:function(){return this._anchorElement.search},set:function(f){this._anchorElement.search=f,this._updateSearchParams()},enumerable:!0}),Object.defineProperties(s,{toString:{get:function(){var f=this;return function(){return f.href}}},href:{get:function(){return this._anchorElement.href.replace(/\?$/,"")},set:function(f){this._anchorElement.href=f,this._updateSearchParams()},enumerable:!0},pathname:{get:function(){return this._anchorElement.pathname.replace(/(^\/?)/,"/")},set:function(f){this._anchorElement.pathname=f},enumerable:!0},origin:{get:function(){var f={"http:":80,"https:":443,"ftp:":21}[this._anchorElement.protocol],c=this._anchorElement.port!=f&&this._anchorElement.port!=="";return this._anchorElement.protocol+"//"+this._anchorElement.hostname+(c?":"+this._anchorElement.port:"")},enumerable:!0},password:{get:function(){return""},set:function(f){},enumerable:!0},username:{get:function(){return""},set:function(f){},enumerable:!0}}),i.createObjectURL=function(f){return o.createObjectURL.apply(o,arguments)},i.revokeObjectURL=function(f){return o.revokeObjectURL.apply(o,arguments)},e.URL=i};if(t()||r(),e.location!==void 0&&!("origin"in e.location)){var n=function(){return e.location.protocol+"//"+e.location.hostname+(e.location.port?":"+e.location.port:"")};try{Object.defineProperty(e.location,"origin",{get:n,enumerable:!0})}catch(o){setInterval(function(){e.location.origin=n()},100)}}})(typeof global!="undefined"?global:typeof window!="undefined"?window:typeof self!="undefined"?self:Er)});var qr=Pt((Mt,Nr)=>{/*! + * clipboard.js v2.0.11 + * https://clipboardjs.com/ + * + * Licensed MIT © Zeno Rocha + */(function(t,r){typeof Mt=="object"&&typeof Nr=="object"?Nr.exports=r():typeof define=="function"&&define.amd?define([],r):typeof Mt=="object"?Mt.ClipboardJS=r():t.ClipboardJS=r()})(Mt,function(){return function(){var e={686:function(n,o,i){"use strict";i.d(o,{default:function(){return Ai}});var s=i(279),a=i.n(s),f=i(370),c=i.n(f),u=i(817),p=i.n(u);function m(j){try{return document.execCommand(j)}catch(T){return!1}}var d=function(T){var E=p()(T);return m("cut"),E},h=d;function v(j){var T=document.documentElement.getAttribute("dir")==="rtl",E=document.createElement("textarea");E.style.fontSize="12pt",E.style.border="0",E.style.padding="0",E.style.margin="0",E.style.position="absolute",E.style[T?"right":"left"]="-9999px";var H=window.pageYOffset||document.documentElement.scrollTop;return E.style.top="".concat(H,"px"),E.setAttribute("readonly",""),E.value=j,E}var Y=function(T,E){var H=v(T);E.container.appendChild(H);var I=p()(H);return m("copy"),H.remove(),I},B=function(T){var E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body},H="";return typeof T=="string"?H=Y(T,E):T instanceof HTMLInputElement&&!["text","search","url","tel","password"].includes(T==null?void 0:T.type)?H=Y(T.value,E):(H=p()(T),m("copy")),H},N=B;function O(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?O=function(E){return typeof E}:O=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},O(j)}var Qe=function(){var T=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},E=T.action,H=E===void 0?"copy":E,I=T.container,q=T.target,Me=T.text;if(H!=="copy"&&H!=="cut")throw new Error('Invalid "action" value, use either "copy" or "cut"');if(q!==void 0)if(q&&O(q)==="object"&&q.nodeType===1){if(H==="copy"&&q.hasAttribute("disabled"))throw new Error('Invalid "target" attribute. Please use "readonly" instead of "disabled" attribute');if(H==="cut"&&(q.hasAttribute("readonly")||q.hasAttribute("disabled")))throw new Error(`Invalid "target" attribute. You can't cut text from elements with "readonly" or "disabled" attributes`)}else throw new Error('Invalid "target" value, use a valid Element');if(Me)return N(Me,{container:I});if(q)return H==="cut"?h(q):N(q,{container:I})},De=Qe;function $e(j){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$e=function(E){return typeof E}:$e=function(E){return E&&typeof Symbol=="function"&&E.constructor===Symbol&&E!==Symbol.prototype?"symbol":typeof E},$e(j)}function Ei(j,T){if(!(j instanceof T))throw new TypeError("Cannot call a class as a function")}function tn(j,T){for(var E=0;E0&&arguments[0]!==void 0?arguments[0]:{};this.action=typeof I.action=="function"?I.action:this.defaultAction,this.target=typeof I.target=="function"?I.target:this.defaultTarget,this.text=typeof I.text=="function"?I.text:this.defaultText,this.container=$e(I.container)==="object"?I.container:document.body}},{key:"listenClick",value:function(I){var q=this;this.listener=c()(I,"click",function(Me){return q.onClick(Me)})}},{key:"onClick",value:function(I){var q=I.delegateTarget||I.currentTarget,Me=this.action(q)||"copy",kt=De({action:Me,container:this.container,target:this.target(q),text:this.text(q)});this.emit(kt?"success":"error",{action:Me,text:kt,trigger:q,clearSelection:function(){q&&q.focus(),window.getSelection().removeAllRanges()}})}},{key:"defaultAction",value:function(I){return vr("action",I)}},{key:"defaultTarget",value:function(I){var q=vr("target",I);if(q)return document.querySelector(q)}},{key:"defaultText",value:function(I){return vr("text",I)}},{key:"destroy",value:function(){this.listener.destroy()}}],[{key:"copy",value:function(I){var q=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{container:document.body};return N(I,q)}},{key:"cut",value:function(I){return h(I)}},{key:"isSupported",value:function(){var I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:["copy","cut"],q=typeof I=="string"?[I]:I,Me=!!document.queryCommandSupported;return q.forEach(function(kt){Me=Me&&!!document.queryCommandSupported(kt)}),Me}}]),E}(a()),Ai=Li},828:function(n){var o=9;if(typeof Element!="undefined"&&!Element.prototype.matches){var i=Element.prototype;i.matches=i.matchesSelector||i.mozMatchesSelector||i.msMatchesSelector||i.oMatchesSelector||i.webkitMatchesSelector}function s(a,f){for(;a&&a.nodeType!==o;){if(typeof a.matches=="function"&&a.matches(f))return a;a=a.parentNode}}n.exports=s},438:function(n,o,i){var s=i(828);function a(u,p,m,d,h){var v=c.apply(this,arguments);return u.addEventListener(m,v,h),{destroy:function(){u.removeEventListener(m,v,h)}}}function f(u,p,m,d,h){return typeof u.addEventListener=="function"?a.apply(null,arguments):typeof m=="function"?a.bind(null,document).apply(null,arguments):(typeof u=="string"&&(u=document.querySelectorAll(u)),Array.prototype.map.call(u,function(v){return a(v,p,m,d,h)}))}function c(u,p,m,d){return function(h){h.delegateTarget=s(h.target,p),h.delegateTarget&&d.call(u,h)}}n.exports=f},879:function(n,o){o.node=function(i){return i!==void 0&&i instanceof HTMLElement&&i.nodeType===1},o.nodeList=function(i){var s=Object.prototype.toString.call(i);return i!==void 0&&(s==="[object NodeList]"||s==="[object HTMLCollection]")&&"length"in i&&(i.length===0||o.node(i[0]))},o.string=function(i){return typeof i=="string"||i instanceof String},o.fn=function(i){var s=Object.prototype.toString.call(i);return s==="[object Function]"}},370:function(n,o,i){var s=i(879),a=i(438);function f(m,d,h){if(!m&&!d&&!h)throw new Error("Missing required arguments");if(!s.string(d))throw new TypeError("Second argument must be a String");if(!s.fn(h))throw new TypeError("Third argument must be a Function");if(s.node(m))return c(m,d,h);if(s.nodeList(m))return u(m,d,h);if(s.string(m))return p(m,d,h);throw new TypeError("First argument must be a String, HTMLElement, HTMLCollection, or NodeList")}function c(m,d,h){return m.addEventListener(d,h),{destroy:function(){m.removeEventListener(d,h)}}}function u(m,d,h){return Array.prototype.forEach.call(m,function(v){v.addEventListener(d,h)}),{destroy:function(){Array.prototype.forEach.call(m,function(v){v.removeEventListener(d,h)})}}}function p(m,d,h){return a(document.body,m,d,h)}n.exports=f},817:function(n){function o(i){var s;if(i.nodeName==="SELECT")i.focus(),s=i.value;else if(i.nodeName==="INPUT"||i.nodeName==="TEXTAREA"){var a=i.hasAttribute("readonly");a||i.setAttribute("readonly",""),i.select(),i.setSelectionRange(0,i.value.length),a||i.removeAttribute("readonly"),s=i.value}else{i.hasAttribute("contenteditable")&&i.focus();var f=window.getSelection(),c=document.createRange();c.selectNodeContents(i),f.removeAllRanges(),f.addRange(c),s=f.toString()}return s}n.exports=o},279:function(n){function o(){}o.prototype={on:function(i,s,a){var f=this.e||(this.e={});return(f[i]||(f[i]=[])).push({fn:s,ctx:a}),this},once:function(i,s,a){var f=this;function c(){f.off(i,c),s.apply(a,arguments)}return c._=s,this.on(i,c,a)},emit:function(i){var s=[].slice.call(arguments,1),a=((this.e||(this.e={}))[i]||[]).slice(),f=0,c=a.length;for(f;f{"use strict";/*! + * escape-html + * Copyright(c) 2012-2013 TJ Holowaychuk + * Copyright(c) 2015 Andreas Lubbe + * Copyright(c) 2015 Tiancheng "Timothy" Gu + * MIT Licensed + */var rs=/["'&<>]/;Yo.exports=ns;function ns(e){var t=""+e,r=rs.exec(t);if(!r)return t;var n,o="",i=0,s=0;for(i=r.index;i0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function W(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),o,i=[],s;try{for(;(t===void 0||t-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return i}function D(e,t,r){if(r||arguments.length===2)for(var n=0,o=t.length,i;n1||a(m,d)})})}function a(m,d){try{f(n[m](d))}catch(h){p(i[0][3],h)}}function f(m){m.value instanceof et?Promise.resolve(m.value.v).then(c,u):p(i[0][2],m)}function c(m){a("next",m)}function u(m){a("throw",m)}function p(m,d){m(d),i.shift(),i.length&&a(i[0][0],i[0][1])}}function pn(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],r;return t?t.call(e):(e=typeof Ee=="function"?Ee(e):e[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=e[i]&&function(s){return new Promise(function(a,f){s=e[i](s),o(a,f,s.done,s.value)})}}function o(i,s,a,f){Promise.resolve(f).then(function(c){i({value:c,done:a})},s)}}function C(e){return typeof e=="function"}function at(e){var t=function(n){Error.call(n),n.stack=new Error().stack},r=e(t);return r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r}var It=at(function(e){return function(r){e(this),this.message=r?r.length+` errors occurred during unsubscription: +`+r.map(function(n,o){return o+1+") "+n.toString()}).join(` + `):"",this.name="UnsubscriptionError",this.errors=r}});function Ve(e,t){if(e){var r=e.indexOf(t);0<=r&&e.splice(r,1)}}var Ie=function(){function e(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}return e.prototype.unsubscribe=function(){var t,r,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=Ee(s),f=a.next();!f.done;f=a.next()){var c=f.value;c.remove(this)}}catch(v){t={error:v}}finally{try{f&&!f.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}else s.remove(this);var u=this.initialTeardown;if(C(u))try{u()}catch(v){i=v instanceof It?v.errors:[v]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var m=Ee(p),d=m.next();!d.done;d=m.next()){var h=d.value;try{ln(h)}catch(v){i=i!=null?i:[],v instanceof It?i=D(D([],W(i)),W(v.errors)):i.push(v)}}}catch(v){n={error:v}}finally{try{d&&!d.done&&(o=m.return)&&o.call(m)}finally{if(n)throw n.error}}}if(i)throw new It(i)}},e.prototype.add=function(t){var r;if(t&&t!==this)if(this.closed)ln(t);else{if(t instanceof e){if(t.closed||t._hasParent(this))return;t._addParent(this)}(this._finalizers=(r=this._finalizers)!==null&&r!==void 0?r:[]).push(t)}},e.prototype._hasParent=function(t){var r=this._parentage;return r===t||Array.isArray(r)&&r.includes(t)},e.prototype._addParent=function(t){var r=this._parentage;this._parentage=Array.isArray(r)?(r.push(t),r):r?[r,t]:t},e.prototype._removeParent=function(t){var r=this._parentage;r===t?this._parentage=null:Array.isArray(r)&&Ve(r,t)},e.prototype.remove=function(t){var r=this._finalizers;r&&Ve(r,t),t instanceof e&&t._removeParent(this)},e.EMPTY=function(){var t=new e;return t.closed=!0,t}(),e}();var Sr=Ie.EMPTY;function jt(e){return e instanceof Ie||e&&"closed"in e&&C(e.remove)&&C(e.add)&&C(e.unsubscribe)}function ln(e){C(e)?e():e.unsubscribe()}var Le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var st={setTimeout:function(e,t){for(var r=[],n=2;n0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(r){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,r)},t.prototype._subscribe=function(r){return this._throwIfClosed(),this._checkFinalizedStatuses(r),this._innerSubscribe(r)},t.prototype._innerSubscribe=function(r){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?Sr:(this.currentObservers=null,a.push(r),new Ie(function(){n.currentObservers=null,Ve(a,r)}))},t.prototype._checkFinalizedStatuses=function(r){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?r.error(i):s&&r.complete()},t.prototype.asObservable=function(){var r=new F;return r.source=this,r},t.create=function(r,n){return new xn(r,n)},t}(F);var xn=function(e){ie(t,e);function t(r,n){var o=e.call(this)||this;return o.destination=r,o.source=n,o}return t.prototype.next=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,r)},t.prototype.error=function(r){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,r)},t.prototype.complete=function(){var r,n;(n=(r=this.destination)===null||r===void 0?void 0:r.complete)===null||n===void 0||n.call(r)},t.prototype._subscribe=function(r){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(r))!==null&&o!==void 0?o:Sr},t}(x);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var wt=function(e){ie(t,e);function t(r,n,o){r===void 0&&(r=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=e.call(this)||this;return i._bufferSize=r,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,r),i._windowTime=Math.max(1,n),i}return t.prototype.next=function(r){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,f=n._windowTime;o||(i.push(r),!s&&i.push(a.now()+f)),this._trimBuffer(),e.prototype.next.call(this,r)},t.prototype._subscribe=function(r){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(r),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),f=0;f0?e.prototype.requestAsyncId.call(this,r,n,o):(r.actions.push(this),r._scheduled||(r._scheduled=ut.requestAnimationFrame(function(){return r.flush(void 0)})))},t.prototype.recycleAsyncId=function(r,n,o){var i;if(o===void 0&&(o=0),o!=null?o>0:this.delay>0)return e.prototype.recycleAsyncId.call(this,r,n,o);var s=r.actions;n!=null&&((i=s[s.length-1])===null||i===void 0?void 0:i.id)!==n&&(ut.cancelAnimationFrame(n),r._scheduled=void 0)},t}(Wt);var Sn=function(e){ie(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.flush=function(r){this._active=!0;var n=this._scheduled;this._scheduled=void 0;var o=this.actions,i;r=r||o.shift();do if(i=r.execute(r.state,r.delay))break;while((r=o[0])&&r.id===n&&o.shift());if(this._active=!1,i){for(;(r=o[0])&&r.id===n&&o.shift();)r.unsubscribe();throw i}},t}(Dt);var Oe=new Sn(wn);var M=new F(function(e){return e.complete()});function Vt(e){return e&&C(e.schedule)}function Cr(e){return e[e.length-1]}function Ye(e){return C(Cr(e))?e.pop():void 0}function Te(e){return Vt(Cr(e))?e.pop():void 0}function zt(e,t){return typeof Cr(e)=="number"?e.pop():t}var pt=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function Nt(e){return C(e==null?void 0:e.then)}function qt(e){return C(e[ft])}function Kt(e){return Symbol.asyncIterator&&C(e==null?void 0:e[Symbol.asyncIterator])}function Qt(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function zi(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Yt=zi();function Gt(e){return C(e==null?void 0:e[Yt])}function Bt(e){return un(this,arguments,function(){var r,n,o,i;return $t(this,function(s){switch(s.label){case 0:r=e.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,et(r.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,et(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,et(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return r.releaseLock(),[7];case 10:return[2]}})})}function Jt(e){return C(e==null?void 0:e.getReader)}function U(e){if(e instanceof F)return e;if(e!=null){if(qt(e))return Ni(e);if(pt(e))return qi(e);if(Nt(e))return Ki(e);if(Kt(e))return On(e);if(Gt(e))return Qi(e);if(Jt(e))return Yi(e)}throw Qt(e)}function Ni(e){return new F(function(t){var r=e[ft]();if(C(r.subscribe))return r.subscribe(t);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function qi(e){return new F(function(t){for(var r=0;r=2;return function(n){return n.pipe(e?A(function(o,i){return e(o,i,n)}):de,ge(1),r?He(t):Dn(function(){return new Zt}))}}function Vn(){for(var e=[],t=0;t=2,!0))}function pe(e){e===void 0&&(e={});var t=e.connector,r=t===void 0?function(){return new x}:t,n=e.resetOnError,o=n===void 0?!0:n,i=e.resetOnComplete,s=i===void 0?!0:i,a=e.resetOnRefCountZero,f=a===void 0?!0:a;return function(c){var u,p,m,d=0,h=!1,v=!1,Y=function(){p==null||p.unsubscribe(),p=void 0},B=function(){Y(),u=m=void 0,h=v=!1},N=function(){var O=u;B(),O==null||O.unsubscribe()};return y(function(O,Qe){d++,!v&&!h&&Y();var De=m=m!=null?m:r();Qe.add(function(){d--,d===0&&!v&&!h&&(p=$r(N,f))}),De.subscribe(Qe),!u&&d>0&&(u=new rt({next:function($e){return De.next($e)},error:function($e){v=!0,Y(),p=$r(B,o,$e),De.error($e)},complete:function(){h=!0,Y(),p=$r(B,s),De.complete()}}),U(O).subscribe(u))})(c)}}function $r(e,t){for(var r=[],n=2;ne.next(document)),e}function K(e,t=document){return Array.from(t.querySelectorAll(e))}function z(e,t=document){let r=ce(e,t);if(typeof r=="undefined")throw new ReferenceError(`Missing element: expected "${e}" to be present`);return r}function ce(e,t=document){return t.querySelector(e)||void 0}function _e(){return document.activeElement instanceof HTMLElement&&document.activeElement||void 0}function tr(e){return L(b(document.body,"focusin"),b(document.body,"focusout")).pipe(ke(1),l(()=>{let t=_e();return typeof t!="undefined"?e.contains(t):!1}),V(e===_e()),J())}function Xe(e){return{x:e.offsetLeft,y:e.offsetTop}}function Kn(e){return L(b(window,"load"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>Xe(e)),V(Xe(e)))}function rr(e){return{x:e.scrollLeft,y:e.scrollTop}}function dt(e){return L(b(e,"scroll"),b(window,"resize")).pipe(Ce(0,Oe),l(()=>rr(e)),V(rr(e)))}var Yn=function(){if(typeof Map!="undefined")return Map;function e(t,r){var n=-1;return t.some(function(o,i){return o[0]===r?(n=i,!0):!1}),n}return function(){function t(){this.__entries__=[]}return Object.defineProperty(t.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),t.prototype.get=function(r){var n=e(this.__entries__,r),o=this.__entries__[n];return o&&o[1]},t.prototype.set=function(r,n){var o=e(this.__entries__,r);~o?this.__entries__[o][1]=n:this.__entries__.push([r,n])},t.prototype.delete=function(r){var n=this.__entries__,o=e(n,r);~o&&n.splice(o,1)},t.prototype.has=function(r){return!!~e(this.__entries__,r)},t.prototype.clear=function(){this.__entries__.splice(0)},t.prototype.forEach=function(r,n){n===void 0&&(n=null);for(var o=0,i=this.__entries__;o0},e.prototype.connect_=function(){!Wr||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),va?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},e.prototype.disconnect_=function(){!Wr||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},e.prototype.onTransitionEnd_=function(t){var r=t.propertyName,n=r===void 0?"":r,o=ba.some(function(i){return!!~n.indexOf(i)});o&&this.refresh()},e.getInstance=function(){return this.instance_||(this.instance_=new e),this.instance_},e.instance_=null,e}(),Gn=function(e,t){for(var r=0,n=Object.keys(t);r0},e}(),Jn=typeof WeakMap!="undefined"?new WeakMap:new Yn,Xn=function(){function e(t){if(!(this instanceof e))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var r=ga.getInstance(),n=new La(t,r,this);Jn.set(this,n)}return e}();["observe","unobserve","disconnect"].forEach(function(e){Xn.prototype[e]=function(){var t;return(t=Jn.get(this))[e].apply(t,arguments)}});var Aa=function(){return typeof nr.ResizeObserver!="undefined"?nr.ResizeObserver:Xn}(),Zn=Aa;var eo=new x,Ca=$(()=>k(new Zn(e=>{for(let t of e)eo.next(t)}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function he(e){return{width:e.offsetWidth,height:e.offsetHeight}}function ye(e){return Ca.pipe(S(t=>t.observe(e)),g(t=>eo.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(()=>he(e)))),V(he(e)))}function bt(e){return{width:e.scrollWidth,height:e.scrollHeight}}function ar(e){let t=e.parentElement;for(;t&&(e.scrollWidth<=t.scrollWidth&&e.scrollHeight<=t.scrollHeight);)t=(e=t).parentElement;return t?e:void 0}var to=new x,Ra=$(()=>k(new IntersectionObserver(e=>{for(let t of e)to.next(t)},{threshold:0}))).pipe(g(e=>L(ze,k(e)).pipe(R(()=>e.disconnect()))),X(1));function sr(e){return Ra.pipe(S(t=>t.observe(e)),g(t=>to.pipe(A(({target:r})=>r===e),R(()=>t.unobserve(e)),l(({isIntersecting:r})=>r))))}function ro(e,t=16){return dt(e).pipe(l(({y:r})=>{let n=he(e),o=bt(e);return r>=o.height-n.height-t}),J())}var cr={drawer:z("[data-md-toggle=drawer]"),search:z("[data-md-toggle=search]")};function no(e){return cr[e].checked}function Ke(e,t){cr[e].checked!==t&&cr[e].click()}function Ue(e){let t=cr[e];return b(t,"change").pipe(l(()=>t.checked),V(t.checked))}function ka(e,t){switch(e.constructor){case HTMLInputElement:return e.type==="radio"?/^Arrow/.test(t):!0;case HTMLSelectElement:case HTMLTextAreaElement:return!0;default:return e.isContentEditable}}function Ha(){return L(b(window,"compositionstart").pipe(l(()=>!0)),b(window,"compositionend").pipe(l(()=>!1))).pipe(V(!1))}function oo(){let e=b(window,"keydown").pipe(A(t=>!(t.metaKey||t.ctrlKey)),l(t=>({mode:no("search")?"search":"global",type:t.key,claim(){t.preventDefault(),t.stopPropagation()}})),A(({mode:t,type:r})=>{if(t==="global"){let n=_e();if(typeof n!="undefined")return!ka(n,r)}return!0}),pe());return Ha().pipe(g(t=>t?M:e))}function le(){return new URL(location.href)}function ot(e){location.href=e.href}function io(){return new x}function ao(e,t){if(typeof t=="string"||typeof t=="number")e.innerHTML+=t.toString();else if(t instanceof Node)e.appendChild(t);else if(Array.isArray(t))for(let r of t)ao(e,r)}function _(e,t,...r){let n=document.createElement(e);if(t)for(let o of Object.keys(t))typeof t[o]!="undefined"&&(typeof t[o]!="boolean"?n.setAttribute(o,t[o]):n.setAttribute(o,""));for(let o of r)ao(n,o);return n}function fr(e){if(e>999){let t=+((e-950)%1e3>99);return`${((e+1e-6)/1e3).toFixed(t)}k`}else return e.toString()}function so(){return location.hash.substring(1)}function Dr(e){let t=_("a",{href:e});t.addEventListener("click",r=>r.stopPropagation()),t.click()}function Pa(e){return L(b(window,"hashchange"),e).pipe(l(so),V(so()),A(t=>t.length>0),X(1))}function co(e){return Pa(e).pipe(l(t=>ce(`[id="${t}"]`)),A(t=>typeof t!="undefined"))}function Vr(e){let t=matchMedia(e);return er(r=>t.addListener(()=>r(t.matches))).pipe(V(t.matches))}function fo(){let e=matchMedia("print");return L(b(window,"beforeprint").pipe(l(()=>!0)),b(window,"afterprint").pipe(l(()=>!1))).pipe(V(e.matches))}function zr(e,t){return e.pipe(g(r=>r?t():M))}function ur(e,t={credentials:"same-origin"}){return ue(fetch(`${e}`,t)).pipe(fe(()=>M),g(r=>r.status!==200?Ot(()=>new Error(r.statusText)):k(r)))}function We(e,t){return ur(e,t).pipe(g(r=>r.json()),X(1))}function uo(e,t){let r=new DOMParser;return ur(e,t).pipe(g(n=>n.text()),l(n=>r.parseFromString(n,"text/xml")),X(1))}function pr(e){let t=_("script",{src:e});return $(()=>(document.head.appendChild(t),L(b(t,"load"),b(t,"error").pipe(g(()=>Ot(()=>new ReferenceError(`Invalid script: ${e}`))))).pipe(l(()=>{}),R(()=>document.head.removeChild(t)),ge(1))))}function po(){return{x:Math.max(0,scrollX),y:Math.max(0,scrollY)}}function lo(){return L(b(window,"scroll",{passive:!0}),b(window,"resize",{passive:!0})).pipe(l(po),V(po()))}function mo(){return{width:innerWidth,height:innerHeight}}function ho(){return b(window,"resize",{passive:!0}).pipe(l(mo),V(mo()))}function bo(){return G([lo(),ho()]).pipe(l(([e,t])=>({offset:e,size:t})),X(1))}function lr(e,{viewport$:t,header$:r}){let n=t.pipe(ee("size")),o=G([n,r]).pipe(l(()=>Xe(e)));return G([r,t,o]).pipe(l(([{height:i},{offset:s,size:a},{x:f,y:c}])=>({offset:{x:s.x-f,y:s.y-c+i},size:a})))}(()=>{function e(n,o){parent.postMessage(n,o||"*")}function t(...n){return n.reduce((o,i)=>o.then(()=>new Promise(s=>{let a=document.createElement("script");a.src=i,a.onload=s,document.body.appendChild(a)})),Promise.resolve())}var r=class extends EventTarget{constructor(n){super(),this.url=n,this.m=i=>{i.source===this.w&&(this.dispatchEvent(new MessageEvent("message",{data:i.data})),this.onmessage&&this.onmessage(i))},this.e=(i,s,a,f,c)=>{if(s===`${this.url}`){let u=new ErrorEvent("error",{message:i,filename:s,lineno:a,colno:f,error:c});this.dispatchEvent(u),this.onerror&&this.onerror(u)}};let o=document.createElement("iframe");o.hidden=!0,document.body.appendChild(this.iframe=o),this.w.document.open(),this.w.document.write(` + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + +

Changelog

+

v0.4.1 (Aug 2023)

+

Changes

+
    +
  • UNDEFINED is now guaranteed to be a singleton, preventing id(obj) mismatches.
  • +
+

Bugfixes

+
    +
  • Client.start() now correctly initialized a new client session if called + after closing the client previously.
  • +
+

Additions

+
    +
  • Tests :).
  • +
+
+

v0.4.0 (Jul 2023)

+

Additions

+
    +
  • Add UNDEFINED, UndefinedOr, and UndefinedNoneOr types.
  • +
  • Add update_key method to key service.
  • +
  • Add name parameter to the create_key method.
  • +
+

Changes

+
    +
  • Refactor existing methods to use the new UNDEFINED type.
  • +
+
+

v0.3.0 (Jul 2023)

+

Bugfixes

+
    +
  • Remove debug print statement in list_keys.
  • +
+

Additions

+
    +
  • Add ErrorCode enum.
  • +
  • Add remaining parameter to create_key.
  • +
  • Add remaining field to ApiKeyVerification and ApiKeyMeta models.
  • +
  • Add code field to ApiKeyVerification model.
  • +
  • Add code field to HttpResponse model.
  • +
+

Changes

+
    +
  • Update status code for revoke_key to 200 OK.
  • +
+
+

v0.2.0 (Jun 2023)

+

Additions

+
    +
  • Add Client, KeyService and ApiService.
  • +
  • Add Serializer, and other necessary base services.
  • +
  • Add relevant models.
  • +
  • Add support for all publicly documented endpoints:
  • +
  • Get API
  • +
  • List Keys
  • +
  • Create Key
  • +
  • Verify Key
  • +
  • Revoke Key
  • +
+
+

v0.1.0 (Jun 2023)

+
    +
  • Initial release!
  • +
+ + + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/contributing/index.html b/v0.4.1/contributing/index.html new file mode 100644 index 0000000..87745f6 --- /dev/null +++ b/v0.4.1/contributing/index.html @@ -0,0 +1,867 @@ + + + + + + + + + + + + + + + + + + + + + + + + Contributing - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + +

Contributing

+

Thanks for your interest in unkey.py! Here are some tips for contributing.

+

Guidelines

+
    +
  • If you have an idea, but are unsure on the proper implementation - open an issue.
  • +
  • Implementations should be well tested before opening a pull request.
  • +
  • Max code line length of 99, max docs line length of 80.
  • +
  • Code should be written in black's code style.
  • +
  • Code should be PEP 8 compliant.
  • +
  • Use informative commit messages.
  • +
+

Installing poetry

+

unkey.py uses Poetry for dependency management.

+

Check out poetry's full +installation guide +for detailed instructions if you aren't familiar with it.

+

Installing dependencies

+
    +
  1. Create a fork of unkey.py, and clone the fork to your local machine.
  2. +
  3. Change directory into the project dir.
  4. +
  5. Run poetry shell to create a new virtual environment, and activate it.
  6. +
  7. Run poetry install to install dependencies (this includes dev deps).
  8. +
+

Writing code

+
    +
  1. Check out a new branch to commit your work to, e.g. git checkout -b bugfix/typing-errors.
  2. +
  3. Make your changes, then run nox and address any issues that arise.
  4. +
  5. Commit your work, using an informative commit message.
  6. +
  7. Open a pull request into the master branch of this repository.
  8. +
+

After submitting your PR, it will be reviewed (and hopefully merged!). +Thanks again for taking the time to read this contributing guide, and for your +interest in unkey.py. I look forward to working with you.

+ + + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/getting-started/client/index.html b/v0.4.1/getting-started/client/index.html new file mode 100644 index 0000000..fb6cbb0 --- /dev/null +++ b/v0.4.1/getting-started/client/index.html @@ -0,0 +1,888 @@ + + + + + + + + + + + + + + + + + + + + + + + + Using the client - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Using the client

+

The Client class is used to interact with the unkey API. You use +the client to make requests.

+

Instantiating the client

+
import unkey
+
+client = unkey.Client(
+    "api_abc123",  # The root api key to use.
+    api_version=1,
+    api_base_url="https://api.unkey.dev",
+)
+
+

Api version and base url are both optional. The client defaults to api v1 +and the production unkey api url. If you are running a local instance of the +api you can set the base url to your instance.

+

Handling client resources

+

The unkey Client uses an aiohttp.ClientSession under the hood, so +it is important that you call Client.start and Client.close appropriately.

+
# ...continued from above
+
+await client.start()
+
+# Make requests here...
+
+await client.close()
+
+

You will receive errors/warnings if you do not properly starting the client +before using it, or closing it before your program terminates.

+

Example client usage

+
import asyncio
+import os
+
+import unkey
+
+
+async def main() -> None:
+    client = unkey.Client(api_key=os.environ["API_KEY"])
+    await client.start()
+
+    # 10 requests/second
+    ratelimit = unkey.Ratelimit(
+        unkey.RatelimitType.Fast,
+        limit=10,
+        refill_rate=10,
+        refill_interval=1000,
+    )
+
+    result = await client.keys.create_key(
+        os.environ["API_ID"],
+        "jonxslays",  # user id
+        "test",  # prefix
+        byte_length=32,
+        ratelimit=ratelimit,
+        meta={"is_cool": True},
+        expires=9600 * 1000,  # 9600 seconds in the future
+    )
+
+    if result.is_ok:
+        data = result.unwrap()
+        print(data.key_id)
+        print(data.key)
+    else:
+        print(result.unwrap_err())
+
+    await client.close()
+
+
+if __name__ == "__main__":
+    asyncio.run(main())
+
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/getting-started/installation/index.html b/v0.4.1/getting-started/installation/index.html new file mode 100644 index 0000000..a0fea3e --- /dev/null +++ b/v0.4.1/getting-started/installation/index.html @@ -0,0 +1,822 @@ + + + + + + + + + + + + + + + + + + + + + + + + Installation - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

Installation

+

Python version 3.8 or greater is required to use unkey.py.

+

Stable

+
pip install -U unkey.py
+
+

Development

+
pip install -U git+https://github.com/Jonxslays/unkey.py
+
+

For more information on using pip, check out the pip documentation.

+
+

You can verify your installation succeeded with the unkeypy command. The output should look +similar to this:

+
unkey.py v0.2.0 from [HEAD]
+@ /path/to/unkey.py/installation
+CPython 3.11.3 GCC 13.1.1 20230429
+Linux love 6.1.34-1-lts x86_64
+#1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023 17:36:07 +0000
+
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/getting-started/result/index.html b/v0.4.1/getting-started/result/index.html new file mode 100644 index 0000000..fc7ff19 --- /dev/null +++ b/v0.4.1/getting-started/result/index.html @@ -0,0 +1,836 @@ + + + + + + + + + + + + + + + + + + + + + + + + The result type - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

The result type

+

Those of you familiar with Rust will feel right at home with the Result +type this library implements. All requests that go out over the network +via the Client come back to you in the form of a Result. The result +can be one of two things: an Ok or an Err.

+

Correct usage

+
client = unkey.Client("unkey_123")
+
+await client.start()
+
+result = await client.keys.verify_key("test_123")
+
+if result.is_ok:
+    print(result.unwrap())
+else:
+    print(result.unwrap_err())
+
+

Incorrect usage

+
client = unkey.Client()
+
+await client.start()
+
+result = await client.keys.create_key(
+    "api_123abc",
+    "jonxslays",
+    "test",
+    byte_length=-1,
+)
+
+print(result.unwrap()) # <-- Exception raised
+# Raises UnwrapError because byte length can not be -1.
+
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/index.html b/v0.4.1/index.html new file mode 100644 index 0000000..2c59258 --- /dev/null +++ b/v0.4.1/index.html @@ -0,0 +1,960 @@ + + + + + + + + + + + + + + + + + + + + + + About - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + + +

unkey.py

+

An asynchronous Python SDK for unkey.dev.

+

Documentation

+ +

Installation

+

Python version 3.8 or greater is required to use unkey.py.

+

Stable

+
pip install -U unkey.py
+
+

Development

+
pip install -U git+https://github.com/Jonxslays/unkey.py
+
+

For more information on using pip, check out the pip documentation.

+

Example

+
import asyncio
+import os
+
+import unkey
+
+
+async def main() -> None:
+    client = unkey.Client(api_key=os.environ["API_KEY"])
+    await client.start()
+
+    result = await client.keys.verify_key("prefix_123ABC")
+
+    if result.is_ok:
+        data = result.unwrap()
+        print(data.valid)
+        print(data.owner_id)
+        print(data.meta)
+        print(data.error)
+    else:
+        print(result.unwrap_err())
+
+    await client.close()
+
+
+if __name__ == "__main__":
+    asyncio.run(main())
+
+

What is unkey.dev

+

unkey.dev is a fully open source API key management solution. It allows you to create, +manage, and validate API keys for your applications users. You can even host it yourself, +that's the beauty of open source.

+

If you're interested in learning more about the project, consider checking out any of these links:

+ +

Contributing

+

unkey.py is open to contributions. Check out the +contributing guide to learn how.

+

License

+

unkey.py is licensed under the GPLv3 License.

+ + + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/license/index.html b/v0.4.1/license/index.html new file mode 100644 index 0000000..7b7c5bb --- /dev/null +++ b/v0.4.1/license/index.html @@ -0,0 +1,1353 @@ + + + + + + + + + + + + + + + + + + + + + + + + License - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

License

+ + +
                GNU GENERAL PUBLIC LICENSE
+                   Version 3, 29 June 2007
+
+

Copyright (C) 2007 Free Software Foundation, Inc. https://fsf.org/ + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed.

+
                        Preamble
+
+

The GNU General Public License is a free, copyleft license for +software and other kinds of works.

+

The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too.

+

When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things.

+

To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others.

+

For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights.

+

Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it.

+

For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions.

+

Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users.

+

Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free.

+

The precise terms and conditions for copying, distribution and +modification follow.

+
                   TERMS AND CONDITIONS
+
+
    +
  1. Definitions.
  2. +
+

"This License" refers to version 3 of the GNU General Public License.

+

"Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks.

+

"The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations.

+

To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work.

+

A "covered work" means either the unmodified Program or a work based +on the Program.

+

To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well.

+

To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying.

+

An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion.

+
    +
  1. Source Code.
  2. +
+

The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work.

+

A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language.

+

The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it.

+

The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work.

+

The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source.

+

The Corresponding Source for a work in source code form is that +same work.

+
    +
  1. Basic Permissions.
  2. +
+

All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law.

+

You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you.

+

Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary.

+
    +
  1. Protecting Users' Legal Rights From Anti-Circumvention Law.
  2. +
+

No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures.

+

When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures.

+
    +
  1. Conveying Verbatim Copies.
  2. +
+

You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program.

+

You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee.

+
    +
  1. Conveying Modified Source Versions.
  2. +
+

You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions:

+
a) The work must carry prominent notices stating that you modified
+it, and giving a relevant date.
+
+b) The work must carry prominent notices stating that it is
+released under this License and any conditions added under section
+7.  This requirement modifies the requirement in section 4 to
+"keep intact all notices".
+
+c) You must license the entire work, as a whole, under this
+License to anyone who comes into possession of a copy.  This
+License will therefore apply, along with any applicable section 7
+additional terms, to the whole of the work, and all its parts,
+regardless of how they are packaged.  This License gives no
+permission to license the work in any other way, but it does not
+invalidate such permission if you have separately received it.
+
+d) If the work has interactive user interfaces, each must display
+Appropriate Legal Notices; however, if the Program has interactive
+interfaces that do not display Appropriate Legal Notices, your
+work need not make them do so.
+
+

A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate.

+
    +
  1. Conveying Non-Source Forms.
  2. +
+

You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways:

+
a) Convey the object code in, or embodied in, a physical product
+(including a physical distribution medium), accompanied by the
+Corresponding Source fixed on a durable physical medium
+customarily used for software interchange.
+
+b) Convey the object code in, or embodied in, a physical product
+(including a physical distribution medium), accompanied by a
+written offer, valid for at least three years and valid for as
+long as you offer spare parts or customer support for that product
+model, to give anyone who possesses the object code either (1) a
+copy of the Corresponding Source for all the software in the
+product that is covered by this License, on a durable physical
+medium customarily used for software interchange, for a price no
+more than your reasonable cost of physically performing this
+conveying of source, or (2) access to copy the
+Corresponding Source from a network server at no charge.
+
+c) Convey individual copies of the object code with a copy of the
+written offer to provide the Corresponding Source.  This
+alternative is allowed only occasionally and noncommercially, and
+only if you received the object code with such an offer, in accord
+with subsection 6b.
+
+d) Convey the object code by offering access from a designated
+place (gratis or for a charge), and offer equivalent access to the
+Corresponding Source in the same way through the same place at no
+further charge.  You need not require recipients to copy the
+Corresponding Source along with the object code.  If the place to
+copy the object code is a network server, the Corresponding Source
+may be on a different server (operated by you or a third party)
+that supports equivalent copying facilities, provided you maintain
+clear directions next to the object code saying where to find the
+Corresponding Source.  Regardless of what server hosts the
+Corresponding Source, you remain obligated to ensure that it is
+available for as long as needed to satisfy these requirements.
+
+e) Convey the object code using peer-to-peer transmission, provided
+you inform other peers where the object code and Corresponding
+Source of the work are being offered to the general public at no
+charge under subsection 6d.
+
+

A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work.

+

A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product.

+

"Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made.

+

If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM).

+

The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network.

+

Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying.

+
    +
  1. Additional Terms.
  2. +
+

"Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions.

+

When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission.

+

Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms:

+
a) Disclaiming warranty or limiting liability differently from the
+terms of sections 15 and 16 of this License; or
+
+b) Requiring preservation of specified reasonable legal notices or
+author attributions in that material or in the Appropriate Legal
+Notices displayed by works containing it; or
+
+c) Prohibiting misrepresentation of the origin of that material, or
+requiring that modified versions of such material be marked in
+reasonable ways as different from the original version; or
+
+d) Limiting the use for publicity purposes of names of licensors or
+authors of the material; or
+
+e) Declining to grant rights under trademark law for use of some
+trade names, trademarks, or service marks; or
+
+f) Requiring indemnification of licensors and authors of that
+material by anyone who conveys the material (or modified versions of
+it) with contractual assumptions of liability to the recipient, for
+any liability that these contractual assumptions directly impose on
+those licensors and authors.
+
+

All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying.

+

If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms.

+

Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way.

+
    +
  1. Termination.
  2. +
+

You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11).

+

However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation.

+

Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice.

+

Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10.

+
    +
  1. Acceptance Not Required for Having Copies.
  2. +
+

You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so.

+
    +
  1. Automatic Licensing of Downstream Recipients.
  2. +
+

Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License.

+

An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts.

+

You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it.

+
    +
  1. Patents.
  2. +
+

A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version".

+

A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License.

+

Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version.

+

In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party.

+

If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid.

+

If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it.

+

A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007.

+

Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law.

+
    +
  1. No Surrender of Others' Freedom.
  2. +
+

If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program.

+
    +
  1. Use with the GNU Affero General Public License.
  2. +
+

Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such.

+
    +
  1. Revised Versions of this License.
  2. +
+

The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns.

+

Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation.

+

If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program.

+

Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version.

+
    +
  1. Disclaimer of Warranty.
  2. +
+

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

+
    +
  1. Limitation of Liability.
  2. +
+

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES.

+
    +
  1. Interpretation of Sections 15 and 16.
  2. +
+

If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee.

+
                 END OF TERMS AND CONDITIONS
+
+        How to Apply These Terms to Your New Programs
+
+

If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms.

+

To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found.

+
<one line to give the program's name and a brief idea of what it does.>
+Copyright (C) <year>  <name of author>
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+

Also add information on how to contact you by electronic and paper mail.

+

If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode:

+
<program>  Copyright (C) <year>  <name of author>
+This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it
+under certain conditions; type `show c' for details.
+
+

The hypothetical commands show w' andshow c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box".

+

You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +https://www.gnu.org/licenses/.

+

The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +https://www.gnu.org/licenses/why-not-lgpl.html.

+ + + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/objects.inv b/v0.4.1/objects.inv new file mode 100644 index 0000000000000000000000000000000000000000..66cf33e68601b9ae99c20e06a9cfcd5fc8cdb2de GIT binary patch literal 906 zcmV;519ki(AX9K?X>NERX>N99Zgg*Qc_4OWa&u{KZXhxWBOp+6Z)#;@bUGk)Zfj+E zE^v7YBOq2~a&u{KZaN?^E-)@I3L_v?Xk{RBWo=<;Ze(S0Aa78b#rNMXCQiPX<{x4c-pO)O>^5I5Qgvl6`pCYCDUtfX_8Jmt=$=C z(yNA`waplT%7p$4s$Hj(9R8i(D<7jNoA_#9v1sBX@U;c~r%KaOiCZ}r+$(Kv}x zp5$KB8a2K*4n)k%rg7Mv+}3=2fT$wGZjcdPjz;2jp`;ZgO7}`{O-&gT*wMZEM-y}i zTf=rcDak2hr;m6cPMq;iZfxQToz(F|V=}=iOGV1;=U{2N&x1P51?{>^2Gc+-lm)eU z9Qa%NO>OcZxyDo{pQaPkUV_ecs`f4wyyBTY)lg9`{gIi6>9RsPBKL6l4VtewqsN?- z9P}?Kg!$%Vqk1H0b4flbD*$_>>_F_%@*}B-+fjj?*|BJlu0pPUD62XxS!q=j#_DK^ zgX9zyJv;-R7C`gxnQF~Z>~lv^a%S=4f3vn;f~l2kDp$l5HeTA(Cv2o4qXJ{-Ive9p zD(jFrWcl)}#hxpjn4})pXM$I7Aqp-n=pD8u7-xk%lEtxydMdytZzp0`y{2*4oh&=m z(DheDgqy-2y`$5cAXVEWr8{09qFZj7yq)({gmM;Q_m8G=*qz*|s^$X9W%wEK@FZ=> zN*gtPUQZ;{RMX1j5OixrD!^%;Bj0noDb8k$uUrh3vIOa_Pqep@vBqkIjmBqopU?k+ zjzs9W!?=t*_6S2CMFBg`qWhw49+QNcMkF*w!Ho_hGVV3vdtT@raYD5iC16nkjPix;$CI>ayxw$j}^d~aJt~9 z`|6UXVW+ll$a8i1rt{l{i^>7bbF%a`mxMBM9ChuZBJ#AjfB5=+@o*pH-XMw+w_gh- g;g`-rWXi__?uwfFQnly5QLkTv$O9ho9}@1( + + + + + + + + + + + + + + + + + + + + + + client - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

client

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Client + + +

+ + +
+ + +

An asynchronous client used for interacting with the API.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_key + str + +
+

The root api key to use for requests.

+
+
+ required +
+ + + +

Other Parameters:

+ + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
api_version + t.Optional[int] + +
+

The api version to access. Defaults to 1.

+
+
api_base_url + t.Optional[str] + +
+

The base url to use for the api (no trailing /). +Defaults to https://api.unkey.dev.

+
+
+ +
+ Source code in unkey/client.py +
13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
class Client:
+    """An asynchronous client used for interacting with the API.
+
+    Args:
+        api_key: The root api key to use for requests.
+
+    Keyword Args:
+        api_version: The api version to access. Defaults to 1.
+
+        api_base_url: The base url to use for the api (no trailing /).
+            Defaults to `https://api.unkey.dev`.
+    """
+
+    __slots__ = (
+        "_apis",
+        "_http",
+        "_keys",
+        "_serializer",
+    )
+
+    def __init__(
+        self,
+        api_key: str,
+        *,
+        api_version: t.Optional[int] = None,
+        api_base_url: t.Optional[str] = None,
+    ) -> None:
+        self._serializer = serializer.Serializer()
+        self._http = services.HttpService(api_key, api_version, api_base_url)
+        self.__init_core_services()
+
+    def __init_core_services(self) -> None:
+        self._apis = self.__init_service(services.ApiService)
+        self._keys = self.__init_service(services.KeyService)
+
+    def __init_service(self, service: t.Type[ServiceT]) -> ServiceT:
+        if not issubclass(service, services.BaseService):
+            raise TypeError(f"{service.__name__!r} can not be initialized as a service.")
+
+        return service(self._http, self._serializer)  # type: ignore[return-value]
+
+    @property
+    def keys(self) -> services.KeyService:
+        """The key service used to make key related requests."""
+        return self._keys
+
+    @property
+    def apis(self) -> services.ApiService:
+        """The api service used to make api related requests."""
+        return self._apis
+
+    def set_api_key(self, api_key: str) -> None:
+        """Sets the api key used by the http service.
+
+        Args:
+            api_key: The new root api key to use for requests.
+        """
+        self._http.set_api_key(api_key)
+
+    def set_api_base_url(self, base_url: str) -> None:
+        """Sets the api base url used by the http service.
+
+        Args:
+            base_url: The new api base url to use for requests.
+        """
+        self._http.set_base_url(base_url)
+
+    async def start(self) -> None:
+        """Starts the client session to be used for http requests."""
+        await self._http.start()
+
+    async def close(self) -> None:
+        """Closes the existing client session, if it's still open."""
+        await self._http.close()
+
+
+ + + +
+ + + + + + + +
+ + + +

+ apis + + + + property + + +

+
apis: services.ApiService
+
+ +
+ +

The api service used to make api related requests.

+
+ +
+ +
+ + + +

+ keys + + + + property + + +

+
keys: services.KeyService
+
+ +
+ +

The key service used to make key related requests.

+
+ +
+ + + + +
+ + + +

+ close + + + + async + + +

+
close() -> None
+
+ +
+ +

Closes the existing client session, if it's still open.

+ +
+ Source code in unkey/client.py +
84
+85
+86
async def close(self) -> None:
+    """Closes the existing client session, if it's still open."""
+    await self._http.close()
+
+
+
+ +
+ + +
+ + + +

+ set_api_base_url + + +

+
set_api_base_url(base_url: str) -> None
+
+ +
+ +

Sets the api base url used by the http service.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
base_url + str + +
+

The new api base url to use for requests.

+
+
+ required +
+ +
+ Source code in unkey/client.py +
72
+73
+74
+75
+76
+77
+78
def set_api_base_url(self, base_url: str) -> None:
+    """Sets the api base url used by the http service.
+
+    Args:
+        base_url: The new api base url to use for requests.
+    """
+    self._http.set_base_url(base_url)
+
+
+
+ +
+ + +
+ + + +

+ set_api_key + + +

+
set_api_key(api_key: str) -> None
+
+ +
+ +

Sets the api key used by the http service.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_key + str + +
+

The new root api key to use for requests.

+
+
+ required +
+ +
+ Source code in unkey/client.py +
64
+65
+66
+67
+68
+69
+70
def set_api_key(self, api_key: str) -> None:
+    """Sets the api key used by the http service.
+
+    Args:
+        api_key: The new root api key to use for requests.
+    """
+    self._http.set_api_key(api_key)
+
+
+
+ +
+ + +
+ + + +

+ start + + + + async + + +

+
start() -> None
+
+ +
+ +

Starts the client session to be used for http requests.

+ +
+ Source code in unkey/client.py +
80
+81
+82
async def start(self) -> None:
+    """Starts the client session to be used for http requests."""
+    await self._http.start()
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/errors/index.html b/v0.4.1/reference/errors/index.html new file mode 100644 index 0000000..0a56d8d --- /dev/null +++ b/v0.4.1/reference/errors/index.html @@ -0,0 +1,1022 @@ + + + + + + + + + + + + + + + + + + + + + + + + errors - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

errors

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ BaseError + + +

+ + +
+

+ Bases: Exception

+ + +

The base error all unkey errors inherit from.

+ +
+ Source code in unkey/errors.py +
6
+7
+8
+9
class BaseError(Exception):
+    """The base error all unkey errors inherit from."""
+
+    __slots__ = ()
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ MissingRequiredArgument + + +

+ + +
+

+ Bases: BaseError

+ + +

Raised when a required argument is missing.

+ +
+ Source code in unkey/errors.py +
21
+22
+23
+24
+25
+26
+27
class MissingRequiredArgument(BaseError):
+    """Raised when a required argument is missing."""
+
+    __slots__ = ()
+
+    def __init__(self, message: str) -> None:
+        super().__init__(f"Missing required argument: {message}")
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ UnwrapError + + +

+ + +
+

+ Bases: BaseError

+ + +

Raised when calling unwrap or unwrap_err incorrectly.

+ +
+ Source code in unkey/errors.py +
12
+13
+14
+15
+16
+17
+18
class UnwrapError(BaseError):
+    """Raised when calling unwrap or unwrap_err incorrectly."""
+
+    __slots__ = ()
+
+    def __init__(self, message: str) -> None:
+        super().__init__(f"Unwrap failed: {message}")
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/models/index.html b/v0.4.1/reference/models/index.html new file mode 100644 index 0000000..73aa2d8 --- /dev/null +++ b/v0.4.1/reference/models/index.html @@ -0,0 +1,3241 @@ + + + + + + + + + + + + + + + + + + + + + + + + models - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

models

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Api + + +

+ + +
+

+ Bases: BaseModel

+ + +

Data representing a particular ratelimit.

+ +
+ Source code in unkey/models/apis.py +
13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
@attrs.define(init=False, weakref_slot=False)
+class Api(BaseModel):
+    """Data representing a particular ratelimit."""
+
+    id: str
+    """The id for this api."""
+
+    name: str
+    """The name of the api."""
+
+    workspace_id: str
+    """The id for the workspace this api belongs to."""
+
+
+ + + +
+ + + + + + + +
+ + + +

+ id + + + + instance-attribute + + +

+
id: str
+
+ +
+ +

The id for this api.

+
+ +
+ +
+ + + +

+ name + + + + instance-attribute + + +

+
name: str
+
+ +
+ +

The name of the api.

+
+ +
+ +
+ + + +

+ workspace_id + + + + instance-attribute + + +

+
workspace_id: str
+
+ +
+ +

The id for the workspace this api belongs to.

+
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +

+ ApiKey + + +

+ + +
+

+ Bases: BaseModel

+ + +

Minimal representation of an api key.

+ +
+ Source code in unkey/models/keys.py +
36
+37
+38
+39
+40
+41
+42
+43
+44
@attrs.define(init=False, weakref_slot=False)
+class ApiKey(BaseModel):
+    """Minimal representation of an api key."""
+
+    key_id: str
+    """The id of this key stored at unkey."""
+
+    key: str
+    """The api key itself."""
+
+
+ + + +
+ + + + + + + +
+ + + +

+ key + + + + instance-attribute + + +

+
key: str
+
+ +
+ +

The api key itself.

+
+ +
+ +
+ + + +

+ key_id + + + + instance-attribute + + +

+
key_id: str
+
+ +
+ +

The id of this key stored at unkey.

+
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +

+ ApiKeyList + + +

+ + +
+

+ Bases: BaseModel

+ + +

Data representing keys for an api.

+ +
+ Source code in unkey/models/apis.py +
27
+28
+29
+30
+31
+32
+33
+34
+35
@attrs.define(init=False, weakref_slot=False)
+class ApiKeyList(BaseModel):
+    """Data representing keys for an api."""
+
+    keys: t.List[ApiKeyMeta]
+    """A list of keys associated with the api."""
+
+    total: int
+    """The total number of keys associated with the api."""
+
+
+ + + +
+ + + + + + + +
+ + + +

+ keys + + + + instance-attribute + + +

+
keys: t.List[ApiKeyMeta]
+
+ +
+ +

A list of keys associated with the api.

+
+ +
+ +
+ + + +

+ total + + + + instance-attribute + + +

+
total: int
+
+ +
+ +

The total number of keys associated with the api.

+
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +

+ ApiKeyMeta + + +

+ + +
+

+ Bases: BaseModel

+ + +

Metadata about an api key.

+ +
+ Source code in unkey/models/keys.py +
47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
@attrs.define(init=False, weakref_slot=False)
+class ApiKeyMeta(BaseModel):
+    """Metadata about an api key."""
+
+    id: str
+    """The id of this key."""
+
+    api_id: str
+    """The id of the api this key belongs to."""
+
+    workspace_id: str
+    """The id of the workspace this key belongs to."""
+
+    start: str
+    """The prefix and beginning 3 letters of the key."""
+
+    created_at: int
+    """The unix epoch representing when this key was created in
+    milliseconds."""
+
+    owner_id: t.Optional[str]
+    """The owner of this api key if one was specified."""
+
+    expires: t.Optional[int]
+    """The optional unix epoch representing when this key expires in
+    milliseconds."""
+
+    ratelimit: t.Optional[Ratelimit]
+    """The optional ratelimit associated with this key."""
+
+    meta: t.Optional[t.Dict[str, t.Any]]
+    """The dynamic mapping of data used during key creation, if
+    the key was found.
+    """
+
+    remaining: t.Optional[int]
+    """The remaining verifications before this key is invalidated.
+    If `None`, this field was not used in the keys creation and can
+    be ignored.
+    """
+
+
+ + + +
+ + + + + + + +
+ + + +

+ api_id + + + + instance-attribute + + +

+
api_id: str
+
+ +
+ +

The id of the api this key belongs to.

+
+ +
+ +
+ + + +

+ created_at + + + + instance-attribute + + +

+
created_at: int
+
+ +
+ +

The unix epoch representing when this key was created in +milliseconds.

+
+ +
+ +
+ + + +

+ expires + + + + instance-attribute + + +

+
expires: t.Optional[int]
+
+ +
+ +

The optional unix epoch representing when this key expires in +milliseconds.

+
+ +
+ +
+ + + +

+ id + + + + instance-attribute + + +

+
id: str
+
+ +
+ +

The id of this key.

+
+ +
+ +
+ + + +

+ meta + + + + instance-attribute + + +

+
meta: t.Optional[t.Dict[str, t.Any]]
+
+ +
+ +

The dynamic mapping of data used during key creation, if +the key was found.

+
+ +
+ +
+ + + +

+ owner_id + + + + instance-attribute + + +

+
owner_id: t.Optional[str]
+
+ +
+ +

The owner of this api key if one was specified.

+
+ +
+ +
+ + + +

+ ratelimit + + + + instance-attribute + + +

+
ratelimit: t.Optional[Ratelimit]
+
+ +
+ +

The optional ratelimit associated with this key.

+
+ +
+ +
+ + + +

+ remaining + + + + instance-attribute + + +

+
remaining: t.Optional[int]
+
+ +
+ +

The remaining verifications before this key is invalidated. +If None, this field was not used in the keys creation and can +be ignored.

+
+ +
+ +
+ + + +

+ start + + + + instance-attribute + + +

+
start: str
+
+ +
+ +

The prefix and beginning 3 letters of the key.

+
+ +
+ +
+ + + +

+ workspace_id + + + + instance-attribute + + +

+
workspace_id: str
+
+ +
+ +

The id of the workspace this key belongs to.

+
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +

+ ApiKeyVerification + + +

+ + +
+

+ Bases: BaseModel

+ + +

Data about whether this api key is valid.

+ +
+ Source code in unkey/models/keys.py +
@attrs.define(init=False, weakref_slot=False)
+class ApiKeyVerification(BaseModel):
+    """Data about whether this api key is valid."""
+
+    valid: bool
+    """Whether or not this key is valid and passes ratelimit."""
+
+    owner_id: t.Optional[str]
+    """The id of the owner for this key, if the key was found."""
+
+    meta: t.Optional[t.Dict[str, t.Any]]
+    """Dynamic mapping of data used during key creation, if the
+    key was found.
+    """
+
+    remaining: t.Optional[int]
+    """The remaining verifications before this key is invalidated.
+    If `None`, this field was not used in the keys creation and can
+    be ignored.
+    """
+
+    code: t.Optional[ErrorCode]
+    """The optional error code returned by the unkey api."""
+
+    error: t.Optional[str]
+    """The error message if the key was invalid."""
+
+
+ + + +
+ + + + + + + +
+ + + +

+ code + + + + instance-attribute + + +

+
code: t.Optional[ErrorCode]
+
+ +
+ +

The optional error code returned by the unkey api.

+
+ +
+ +
+ + + +

+ error + + + + instance-attribute + + +

+
error: t.Optional[str]
+
+ +
+ +

The error message if the key was invalid.

+
+ +
+ +
+ + + +

+ meta + + + + instance-attribute + + +

+
meta: t.Optional[t.Dict[str, t.Any]]
+
+ +
+ +

Dynamic mapping of data used during key creation, if the +key was found.

+
+ +
+ +
+ + + +

+ owner_id + + + + instance-attribute + + +

+
owner_id: t.Optional[str]
+
+ +
+ +

The id of the owner for this key, if the key was found.

+
+ +
+ +
+ + + +

+ remaining + + + + instance-attribute + + +

+
remaining: t.Optional[int]
+
+ +
+ +

The remaining verifications before this key is invalidated. +If None, this field was not used in the keys creation and can +be ignored.

+
+ +
+ +
+ + + +

+ valid + + + + instance-attribute + + +

+
valid: bool
+
+ +
+ +

Whether or not this key is valid and passes ratelimit.

+
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +

+ BaseEnum + + +

+ + +
+

+ Bases: Enum

+ + +

The base enum all library enums inherit from.

+ +
+ Source code in unkey/models/base.py +
26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
class BaseEnum(Enum):
+    """The base enum all library enums inherit from."""
+
+    __slots__ = ()
+
+    value: str  # pyright: ignore
+
+    def __str__(self) -> str:
+        return self.value
+
+    @classmethod
+    def from_str(cls: t.Type[T], value: str) -> T:
+        """Generate this enum from the given value.
+
+        Args:
+            value: The value to generate from.
+
+        Returns:
+            The generated enum.
+        """
+        try:
+            return cls(value)
+        except ValueError as e:
+            raise ValueError(
+                f"{e} variant. Please report this issue on github at "
+                "https://github.com/Jonxslays/unkey.py/issues/new"
+            ) from None
+
+    @classmethod
+    def from_str_maybe(cls: t.Type[T], value: str) -> t.Optional[T]:
+        """Attempt to generate this enum from the given value.
+
+        Args:
+            value: The value to generate from.
+
+        Returns:
+            The generated enum or `None` if the value was not a valid
+                enum variant.
+        """
+        try:
+            return cls(value)
+        except ValueError:
+            return None
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+ from_str + + + + classmethod + + +

+
from_str(value: str) -> T
+
+ +
+ +

Generate this enum from the given value.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
value + str + +
+

The value to generate from.

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ T + +
+

The generated enum.

+
+
+ +
+ Source code in unkey/models/base.py +
36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
@classmethod
+def from_str(cls: t.Type[T], value: str) -> T:
+    """Generate this enum from the given value.
+
+    Args:
+        value: The value to generate from.
+
+    Returns:
+        The generated enum.
+    """
+    try:
+        return cls(value)
+    except ValueError as e:
+        raise ValueError(
+            f"{e} variant. Please report this issue on github at "
+            "https://github.com/Jonxslays/unkey.py/issues/new"
+        ) from None
+
+
+
+ +
+ + +
+ + + +

+ from_str_maybe + + + + classmethod + + +

+
from_str_maybe(value: str) -> t.Optional[T]
+
+ +
+ +

Attempt to generate this enum from the given value.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
value + str + +
+

The value to generate from.

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ t.Optional[T] + +
+

The generated enum or None if the value was not a valid +enum variant.

+
+
+ +
+ Source code in unkey/models/base.py +
54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
@classmethod
+def from_str_maybe(cls: t.Type[T], value: str) -> t.Optional[T]:
+    """Attempt to generate this enum from the given value.
+
+    Args:
+        value: The value to generate from.
+
+    Returns:
+        The generated enum or `None` if the value was not a valid
+            enum variant.
+    """
+    try:
+        return cls(value)
+    except ValueError:
+        return None
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ BaseModel + + +

+ + +
+ + +

The base model all library models inherit from.

+ +
+ Source code in unkey/models/base.py +
13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
@attrs.define(weakref_slot=False)
+class BaseModel:
+    """The base model all library models inherit from."""
+
+    def to_dict(self) -> t.Dict[str, t.Any]:
+        """Converts this class into a dictionary.
+
+        Returns:
+            The requested dictionary.
+        """
+        return attrs.asdict(self)
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+ to_dict + + +

+
to_dict() -> t.Dict[str, t.Any]
+
+ +
+ +

Converts this class into a dictionary.

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ t.Dict[str, t.Any] + +
+

The requested dictionary.

+
+
+ +
+ Source code in unkey/models/base.py +
17
+18
+19
+20
+21
+22
+23
def to_dict(self) -> t.Dict[str, t.Any]:
+    """Converts this class into a dictionary.
+
+    Returns:
+        The requested dictionary.
+    """
+    return attrs.asdict(self)
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ HttpResponse + + +

+ + +
+

+ Bases: BaseModel

+ + +

Directly represents a response from the api.

+

Could indicate either success or failure.

+ +
+ Source code in unkey/models/http.py +
24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
@attrs.define(weakref_slot=False)
+class HttpResponse(BaseModel):
+    """Directly represents a response from the api.
+
+    Could indicate either success or failure.
+    """
+
+    status: int
+    """The HTTP status code."""
+
+    message: str
+    """The error or success message."""
+
+    code: t.Optional[ErrorCode] = None
+    """The optional error code returned by the unkey api."""
+
+
+ + + +
+ + + + + + + +
+ + + +

+ code + + + + class-attribute + instance-attribute + + +

+
code: t.Optional[ErrorCode] = None
+
+ +
+ +

The optional error code returned by the unkey api.

+
+ +
+ +
+ + + +

+ message + + + + instance-attribute + + +

+
message: str
+
+ +
+ +

The error or success message.

+
+ +
+ +
+ + + +

+ status + + + + instance-attribute + + +

+
status: int
+
+ +
+ +

The HTTP status code.

+
+ +
+ + + + + +
+ +
+ +
+ +
+ + + +

+ Ratelimit + + +

+ + +
+

+ Bases: BaseModel

+ + +

Data representing a particular ratelimit.

+ +
+ Source code in unkey/models/keys.py +
19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
@attrs.define(weakref_slot=False)
+class Ratelimit(BaseModel):
+    """Data representing a particular ratelimit."""
+
+    type: RatelimitType
+    """The type of ratelimiting to implement."""
+
+    limit: int
+    """The total amount of burstable requests."""
+
+    refill_rate: int
+    """How many tokens to refill during each refill interval."""
+
+    refill_interval: int
+    """The speed at which tokens are refilled."""
+
+
+ + + +
+ + + + + + + +
+ + + +

+ limit + + + + instance-attribute + + +

+
limit: int
+
+ +
+ +

The total amount of burstable requests.

+
+ +
+ +
+ + + +

+ refill_interval + + + + instance-attribute + + +

+
refill_interval: int
+
+ +
+ +

The speed at which tokens are refilled.

+
+ +
+ +
+ + + +

+ refill_rate + + + + instance-attribute + + +

+
refill_rate: int
+
+ +
+ +

How many tokens to refill during each refill interval.

+
+ +
+ +
+ + + +

+ type + + + + instance-attribute + + +

+
type: RatelimitType
+
+ +
+ +

The type of ratelimiting to implement.

+
+ +
+ + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/result/index.html b/v0.4.1/reference/result/index.html new file mode 100644 index 0000000..7c3bf7f --- /dev/null +++ b/v0.4.1/reference/result/index.html @@ -0,0 +1,1274 @@ + + + + + + + + + + + + + + + + + + + + + + + + result - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

result

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Result + + +

+ + +
+

+ Bases: t.Generic[T, E], abc.ABC

+ + +

Represents a potential Ok or Err result.

+ +
+ Note +

This class can not be instantiated, only its variants can.

+
+
+ Source code in unkey/result.py +
14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
class Result(t.Generic[T, E], abc.ABC):
+    """Represents a potential `Ok` or `Err` result.
+
+    Note:
+        This class can not be instantiated, only its variants can.
+    """
+
+    __slots__ = ("_error", "_value")
+
+    def __repr__(self) -> str:
+        inner = self._value if self.is_ok else self._error  # type: ignore [attr-defined]
+        return f"{self.__class__.__name__}({inner})"
+
+    @property
+    @abc.abstractmethod
+    def is_ok(self) -> bool:
+        """`True` if this result is the `Ok` variant."""
+
+    @property
+    @abc.abstractmethod
+    def is_err(self) -> bool:
+        """`True` if this result is the `Err` variant."""
+
+    @abc.abstractmethod
+    def unwrap(self) -> T:
+        """Unwraps the result to produce the value.
+
+        Returns:
+            The unwrapped value.
+
+        Raises:
+            UnwrapError: If the result was an `Err` and not `Ok`.
+        """
+
+    @abc.abstractmethod
+    def unwrap_err(self) -> E:
+        """Unwraps the result to produce the error.
+
+        Returns:
+            The unwrapped error.
+
+        Raises:
+            UnwrapError: If the result was `Ok` and not an `Err`.
+        """
+
+
+ + + +
+ + + + + + + +
+ + + +

+ is_err + + + + abstractmethod + property + + +

+
is_err: bool
+
+ +
+ +

True if this result is the Err variant.

+
+ +
+ +
+ + + +

+ is_ok + + + + abstractmethod + property + + +

+
is_ok: bool
+
+ +
+ +

True if this result is the Ok variant.

+
+ +
+ + + + +
+ + + +

+ unwrap + + + + abstractmethod + + +

+
unwrap() -> T
+
+ +
+ +

Unwraps the result to produce the value.

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ T + +
+

The unwrapped value.

+
+
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ UnwrapError + +
+

If the result was an Err and not Ok.

+
+
+ +
+ Source code in unkey/result.py +
37
+38
+39
+40
+41
+42
+43
+44
+45
+46
@abc.abstractmethod
+def unwrap(self) -> T:
+    """Unwraps the result to produce the value.
+
+    Returns:
+        The unwrapped value.
+
+    Raises:
+        UnwrapError: If the result was an `Err` and not `Ok`.
+    """
+
+
+
+ +
+ + +
+ + + +

+ unwrap_err + + + + abstractmethod + + +

+
unwrap_err() -> E
+
+ +
+ +

Unwraps the result to produce the error.

+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ E + +
+

The unwrapped error.

+
+
+ + + +

Raises:

+ + + + + + + + + + + + + +
TypeDescription
+ UnwrapError + +
+

If the result was Ok and not an Err.

+
+
+ +
+ Source code in unkey/result.py +
48
+49
+50
+51
+52
+53
+54
+55
+56
+57
@abc.abstractmethod
+def unwrap_err(self) -> E:
+    """Unwraps the result to produce the error.
+
+    Returns:
+        The unwrapped error.
+
+    Raises:
+        UnwrapError: If the result was `Ok` and not an `Err`.
+    """
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/routes/index.html b/v0.4.1/reference/routes/index.html new file mode 100644 index 0000000..2a5438a --- /dev/null +++ b/v0.4.1/reference/routes/index.html @@ -0,0 +1,1589 @@ + + + + + + + + + + + + + + + + + + + + + + + + routes - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

routes

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ CompiledRoute + + +

+ + +
+ + +

A route that has been compiled to include uri variables.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
route + Route + +
+

The route itself.

+
+
+ required +
uri + str + +
+

The endpoint for this route.

+
+
+ required +
+ +
+ Source code in unkey/routes.py +
12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
@attrs.define(weakref_slot=False)
+class CompiledRoute:
+    """A route that has been compiled to include uri variables.
+
+    Args:
+        route: The route itself.
+        uri: The endpoint for this route.
+    """
+
+    route: Route
+    """The route itself."""
+
+    uri: str
+    """The routes uri endpoint."""
+
+    params: t.Dict[str, t.Union[str, int]] = attrs.field(init=False)
+    """The query params for the route."""
+
+    def __init__(self, route: Route, uri: str) -> None:
+        self.route = route
+        self.uri = uri
+        self.params = {}
+
+    @property
+    def method(self) -> str:
+        """The routes method, i.e. GET, POST..."""
+        return self.route.method
+
+    def with_params(self, params: t.Dict[str, t.Any]) -> CompiledRoute:
+        """Adds additional query params to this compiled route.
+
+        Args:
+            params: The query params to compile.
+
+        Returns:
+            The compiled route for chained calls.
+        """
+        if params:
+            self.params.update(params)
+
+        return self
+
+
+ + + +
+ + + + + + + +
+ + + +

+ method + + + + property + + +

+
method: str
+
+ +
+ +

The routes method, i.e. GET, POST...

+
+ +
+ +
+ + + +

+ params + + + + class-attribute + instance-attribute + + +

+
params: t.Dict[str, t.Union[str, int]] = {}
+
+ +
+ +

The query params for the route.

+
+ +
+ +
+ + + +

+ route + + + + instance-attribute + + +

+
route: Route = route
+
+ +
+ +

The route itself.

+
+ +
+ +
+ + + +

+ uri + + + + instance-attribute + + +

+
uri: str = uri
+
+ +
+ +

The routes uri endpoint.

+
+ +
+ + + + +
+ + + +

+ with_params + + +

+
with_params(params: t.Dict[str, t.Any]) -> CompiledRoute
+
+ +
+ +

Adds additional query params to this compiled route.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
params + t.Dict[str, t.Any] + +
+

The query params to compile.

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ CompiledRoute + +
+

The compiled route for chained calls.

+
+
+ +
+ Source code in unkey/routes.py +
40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
def with_params(self, params: t.Dict[str, t.Any]) -> CompiledRoute:
+    """Adds additional query params to this compiled route.
+
+    Args:
+        params: The query params to compile.
+
+    Returns:
+        The compiled route for chained calls.
+    """
+    if params:
+        self.params.update(params)
+
+    return self
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ Route + + +

+ + +
+ + +

A route that has not been compiled yet.

+ +
+ Source code in unkey/routes.py +
55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
@attrs.define(weakref_slot=False)
+class Route:
+    """A route that has not been compiled yet."""
+
+    method: str
+    """The request method to use."""
+
+    uri: str
+    """The request uri."""
+
+    def compile(self, *args: t.Union[str, int]) -> CompiledRoute:
+        """Turn this route into a compiled route.
+
+        Args:
+            *args: The arguments to insert into the uri.
+
+        Returns:
+            The compiled route.
+        """
+        compiled = CompiledRoute(self, self.uri)
+
+        for arg in args:
+            compiled.uri = compiled.uri.replace(r"{}", str(arg), 1)
+
+        return compiled
+
+
+ + + +
+ + + + + + + +
+ + + +

+ method + + + + instance-attribute + + +

+
method: str
+
+ +
+ +

The request method to use.

+
+ +
+ +
+ + + +

+ uri + + + + instance-attribute + + +

+
uri: str
+
+ +
+ +

The request uri.

+
+ +
+ + + + +
+ + + +

+ compile + + +

+
compile(*args: t.Union[str, int]) -> CompiledRoute
+
+ +
+ +

Turn this route into a compiled route.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
*args + t.Union[str, int] + +
+

The arguments to insert into the uri.

+
+
+ () +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ CompiledRoute + +
+

The compiled route.

+
+
+ +
+ Source code in unkey/routes.py +
65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
def compile(self, *args: t.Union[str, int]) -> CompiledRoute:
+    """Turn this route into a compiled route.
+
+    Args:
+        *args: The arguments to insert into the uri.
+
+    Returns:
+        The compiled route.
+    """
+    compiled = CompiledRoute(self, self.uri)
+
+    for arg in args:
+        compiled.uri = compiled.uri.replace(r"{}", str(arg), 1)
+
+    return compiled
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/serializer/index.html b/v0.4.1/reference/serializer/index.html new file mode 100644 index 0000000..f833389 --- /dev/null +++ b/v0.4.1/reference/serializer/index.html @@ -0,0 +1,1076 @@ + + + + + + + + + + + + + + + + + + + + + + + + serializer - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

serializer

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ Serializer + + +

+ + +
+ + +

Deserializes JSON data into wom.py model classes.

+ +
+ Source code in unkey/serializer.py +
class Serializer:
+    """Deserializes JSON data into wom.py model classes."""
+
+    __slots__ = ()
+
+    def _dt_from_iso(self, timestamp: str) -> datetime:
+        return datetime.fromisoformat(timestamp.rstrip("Z"))
+
+    def _dt_from_iso_maybe(self, timestamp: t.Optional[str]) -> t.Optional[datetime]:
+        return self._dt_from_iso(timestamp) if timestamp else None
+
+    def to_camel_case(self, attr: str) -> str:
+        first, *rest = attr.split("_")
+        return "".join((first.lower(), *map(str.title, rest)))
+
+    def _set_attrs(
+        self,
+        model: t.Any,
+        data: DictT,
+        *attrs: str,
+        transform: TransformT = None,
+        camel_case: bool = False,
+        maybe: bool = False,
+    ) -> None:
+        if transform and maybe:
+            raise RuntimeError("Only one of 'maybe' and 'transform' may be used.")
+
+        for attr in attrs:
+            cased_attr = self.to_camel_case(attr) if camel_case else attr
+
+            if transform:
+                setattr(
+                    model,
+                    attr,
+                    transform(data.get(cased_attr, None) if maybe else data[cased_attr]),
+                )
+            else:
+                setattr(model, attr, data.get(cased_attr, None) if maybe else data[cased_attr])
+
+    def _set_attrs_cased(
+        self,
+        model: t.Any,
+        data: DictT,
+        *attrs: str,
+        transform: TransformT = None,
+        maybe: bool = False,
+    ) -> None:
+        self._set_attrs(model, data, *attrs, transform=transform, camel_case=True, maybe=maybe)
+
+    def to_api_key(self, data: DictT) -> models.ApiKey:
+        model = models.ApiKey()
+        self._set_attrs_cased(model, data, "key", "key_id")
+        return model
+
+    def to_api_key_verification(self, data: DictT) -> models.ApiKeyVerification:
+        model = models.ApiKeyVerification()
+        model.code = models.ErrorCode.from_str_maybe(data.get("code", ""))
+        self._set_attrs_cased(
+            model, data, "valid", "owner_id", "meta", "remaining", "error", maybe=True
+        )
+
+        return model
+
+    def to_api(self, data: DictT) -> models.Api:
+        model = models.Api()
+        self._set_attrs_cased(model, data, "id", "name", "workspace_id")
+        return model
+
+    def to_ratelimit(self, data: DictT) -> models.Ratelimit:
+        return models.Ratelimit(
+            limit=data["limit"],
+            refill_rate=data["refillRate"],
+            refill_interval=data["refillInterval"],
+            type=models.RatelimitType.from_str(data["type"]),
+        )
+
+    def to_api_key_meta(self, data: DictT) -> models.ApiKeyMeta:
+        model = models.ApiKeyMeta()
+        ratelimit = data.get("ratelimit")
+        model.ratelimit = self.to_ratelimit(ratelimit) if ratelimit else ratelimit
+        self._set_attrs_cased(
+            model,
+            data,
+            "id",
+            "meta",
+            "start",
+            "api_id",
+            "expires",
+            "remaining",
+            "owner_id",
+            "created_at",
+            "workspace_id",
+            maybe=True,
+        )
+
+        return model
+
+    def to_api_key_list(self, data: DictT) -> models.ApiKeyList:
+        model = models.ApiKeyList()
+        model.total = data["total"]
+        model.keys = [self.to_api_key_meta(key) for key in data["keys"]]
+        return model
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/services/index.html b/v0.4.1/reference/services/index.html new file mode 100644 index 0000000..a727c46 --- /dev/null +++ b/v0.4.1/reference/services/index.html @@ -0,0 +1,3747 @@ + + + + + + + + + + + + + + + + + + + + + + + + services - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

services

+ + +
+ + + +
+ + + +
+ + + + + + + + +
+ + + +

+ ApiService + + +

+ + +
+

+ Bases: BaseService

+ + +

Handles api related requests.

+ +
+ Source code in unkey/services/apis.py +
19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
class ApiService(BaseService):
+    """Handles api related requests."""
+
+    __slots__ = ()
+
+    async def get_api(self, api_id: str) -> ResultT[models.Api]:
+        """Gets information about an api.
+
+        Args:
+            api_id: The id of the api.
+
+        Returns:
+            A result containing the requested information or an error.
+        """
+        route = routes.GET_API.compile(api_id)
+        data = await self._http.fetch(route)
+
+        if isinstance(data, models.HttpResponse):
+            return result.Err(data)
+
+        if "error" in data:
+            return result.Err(
+                models.HttpResponse(
+                    404,
+                    data["error"],
+                    models.ErrorCode.from_str_maybe(data.get("code", "unknown")),
+                )
+            )
+
+        return result.Ok(self._serializer.to_api(data))
+
+    async def list_keys(
+        self,
+        api_id: str,
+        *,
+        owner_id: UndefinedOr[str] = UNDEFINED,
+        limit: int = 100,
+        offset: int = 0,
+    ) -> ResultT[models.ApiKeyList]:
+        """Gets a paginated list of keys for the given api.
+
+        Args:
+            api_id: The id of the api.
+
+        Keyword Args:
+            owner_id: The optional owner id to list the keys for.
+
+            limit: The max number of keys to include in this page.
+                Defaults to 100.
+
+            offset: How many keys to offset by, for pagination.
+
+        Returns:
+            A result containing api key list or an error.
+        """
+        params = self._generate_map(ownerId=owner_id, limit=limit, offset=offset)
+        route = routes.GET_KEYS.compile(api_id).with_params(params)
+        data = await self._http.fetch(route)
+
+        if isinstance(data, models.HttpResponse):
+            return result.Err(data)
+
+        if "error" in data:
+            return result.Err(
+                models.HttpResponse(
+                    404,
+                    data["error"],
+                    models.ErrorCode.from_str_maybe(data.get("code", "unknown")),
+                )
+            )
+
+        return result.Ok(self._serializer.to_api_key_list(data))
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+ get_api + + + + async + + +

+
get_api(api_id: str) -> ResultT[models.Api]
+
+ +
+ +

Gets information about an api.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_id + str + +
+

The id of the api.

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ResultT[models.Api] + +
+

A result containing the requested information or an error.

+
+
+ +
+ Source code in unkey/services/apis.py +
24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
async def get_api(self, api_id: str) -> ResultT[models.Api]:
+    """Gets information about an api.
+
+    Args:
+        api_id: The id of the api.
+
+    Returns:
+        A result containing the requested information or an error.
+    """
+    route = routes.GET_API.compile(api_id)
+    data = await self._http.fetch(route)
+
+    if isinstance(data, models.HttpResponse):
+        return result.Err(data)
+
+    if "error" in data:
+        return result.Err(
+            models.HttpResponse(
+                404,
+                data["error"],
+                models.ErrorCode.from_str_maybe(data.get("code", "unknown")),
+            )
+        )
+
+    return result.Ok(self._serializer.to_api(data))
+
+
+
+ +
+ + +
+ + + +

+ list_keys + + + + async + + +

+
list_keys(
+    api_id: str,
+    *,
+    owner_id: UndefinedOr[str] = UNDEFINED,
+    limit: int = 100,
+    offset: int = 0
+) -> ResultT[models.ApiKeyList]
+
+ +
+ +

Gets a paginated list of keys for the given api.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_id + str + +
+

The id of the api.

+
+
+ required +
+ + + +

Other Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
owner_id + UndefinedOr[str] + +
+

The optional owner id to list the keys for.

+
+
limit + int + +
+

The max number of keys to include in this page. +Defaults to 100.

+
+
offset + int + +
+

How many keys to offset by, for pagination.

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ResultT[models.ApiKeyList] + +
+

A result containing api key list or an error.

+
+
+ +
+ Source code in unkey/services/apis.py +
50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
async def list_keys(
+    self,
+    api_id: str,
+    *,
+    owner_id: UndefinedOr[str] = UNDEFINED,
+    limit: int = 100,
+    offset: int = 0,
+) -> ResultT[models.ApiKeyList]:
+    """Gets a paginated list of keys for the given api.
+
+    Args:
+        api_id: The id of the api.
+
+    Keyword Args:
+        owner_id: The optional owner id to list the keys for.
+
+        limit: The max number of keys to include in this page.
+            Defaults to 100.
+
+        offset: How many keys to offset by, for pagination.
+
+    Returns:
+        A result containing api key list or an error.
+    """
+    params = self._generate_map(ownerId=owner_id, limit=limit, offset=offset)
+    route = routes.GET_KEYS.compile(api_id).with_params(params)
+    data = await self._http.fetch(route)
+
+    if isinstance(data, models.HttpResponse):
+        return result.Err(data)
+
+    if "error" in data:
+        return result.Err(
+            models.HttpResponse(
+                404,
+                data["error"],
+                models.ErrorCode.from_str_maybe(data.get("code", "unknown")),
+            )
+        )
+
+    return result.Ok(self._serializer.to_api_key_list(data))
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ BaseService + + +

+ + +
+

+ Bases: abc.ABC

+ + +

The base service all API services inherit from.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
http_service + HttpService + +
+

The http service to use for requests.

+
+
+ required +
serializer + serializer.Serializer + +
+

The serializer to use for handling incoming +JSON data from the API.

+
+
+ required +
+ +
+ Source code in unkey/services/base.py +
18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
class BaseService(abc.ABC):
+    """The base service all API services inherit from.
+
+    Args:
+        http_service: The http service to use for requests.
+
+        serializer: The serializer to use for handling incoming
+            JSON data from the API.
+    """
+
+    __slots__ = ("_http", "_serializer")
+
+    def __init__(self, http_service: HttpService, serializer: serializer.Serializer) -> None:
+        self._http = http_service
+        self._serializer = serializer
+
+    def _generate_map(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:
+        return {k: v for k, v in kwargs.items() if v is not undefined.UNDEFINED}
+
+    def _expires_in(
+        self, *, milliseconds: int = 0, seconds: int = 0, minutes: int = 0, days: int = 0
+    ) -> undefined.UndefinedOr[int]:
+        if not any({milliseconds, seconds, minutes, days}):
+            return undefined.UNDEFINED
+
+        delta = timedelta(days=days, minutes=minutes, seconds=seconds, milliseconds=milliseconds)
+        return int((datetime.now() + delta).timestamp()) * 1000
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ +
+ + + +

+ HttpService + + +

+ + +
+ + +

The HTTP service used to make requests to the unkey API.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_key + str + +
+

The api key to use.

+
+
+ required +
api_version + t.Optional[int] + +
+

The optional version of the api to use.

+
+
+ required +
api_base_url + t.Optional[str] + +
+

The optional api base url to use.

+
+
+ required +
+ +
+ Source code in unkey/services/http.py +
class HttpService:
+    """The HTTP service used to make requests to the unkey API.
+
+    Args:
+        api_key: The api key to use.
+
+        api_version: The optional version of the api to use.
+
+        api_base_url: The optional api base url to use.
+    """
+
+    __slots__ = (
+        "_api_version",
+        "_base_url",
+        "_headers",
+        "_ok_responses",
+        "_method_mapping",
+        "_session",
+    )
+
+    def __init__(
+        self,
+        api_key: str,
+        api_version: t.Optional[int],
+        api_base_url: t.Optional[str],
+    ) -> None:
+        if not api_key:
+            raise ValueError("Api key must be provided.")
+
+        self._headers = {
+            "x-user-agent": constants.USER_AGENT,
+            "Authorization": f"Bearer {api_key}",
+        }
+
+        self._ok_responses = {200, 202}
+        self._api_version = f"/v{api_version or 1}"
+        self._base_url = api_base_url or constants.API_BASE_URL
+
+    async def _try_get_json(self, response: aiohttp.ClientResponse) -> t.Any:
+        try:
+            return await response.json()
+        except Exception:
+            if response.status not in self._ok_responses:
+                return models.HttpResponse(response.status, await response.text())
+
+            return await response.text()
+
+    async def _request(
+        self, req: t.Callable[..., t.Awaitable[t.Any]], url: str, **kwargs: t.Any
+    ) -> t.Any:
+        response = await req(url, **kwargs)
+        data = await self._try_get_json(response)
+
+        if isinstance(data, models.HttpResponse):
+            return data
+
+        # Skipping 404's seems hacky but whatever
+        if response.status not in (*self._ok_responses, 404):
+            return models.HttpResponse(
+                response.status,
+                data.get("error")
+                or data.get("message")
+                or "An unexpected error occurred while making the request.",
+            )
+
+        return data
+
+    def _get_request_func(self, method: str) -> t.Callable[..., t.Awaitable[t.Any]]:
+        if not hasattr(self, "_method_mapping"):
+            raise RuntimeError("HttpService.start was never called, aborting...")
+
+        return self._method_mapping[method]  # type: ignore
+
+    async def _init_session(self) -> None:
+        self._session = aiohttp.ClientSession()
+        self._method_mapping = {
+            constants.GET: self._session.get,
+            constants.PUT: self._session.put,
+            constants.POST: self._session.post,
+            constants.PATCH: self._session.patch,
+            constants.DELETE: self._session.delete,
+        }
+
+    def set_api_key(self, api_key: str) -> None:
+        """Sets the api key used by the http service.
+
+        Args:
+            api_key: The new api key to use.
+        """
+        self._headers["x-api-key"] = api_key
+
+    def set_base_url(self, base_url: str) -> None:
+        """Sets the api base url used by the http service.
+
+        Args:
+            base_url: The new base url to use.
+        """
+        self._base_url = base_url
+
+    async def start(self) -> None:
+        """Starts the client session to be used by the http service."""
+        if not hasattr(self, "_session") or self._session.closed:
+            await self._init_session()
+
+    async def close(self) -> None:
+        """Closes the existing client session, if it's still open."""
+        if hasattr(self, "_session") and not self._session.closed:
+            await self._session.close()
+
+    async def fetch(
+        self,
+        route: routes.CompiledRoute,
+        *,
+        payload: t.Optional[t.Dict[str, t.Any]] = None,
+    ) -> dict[str, t.Any] | models.HttpResponse:
+        """Fetches the given route.
+
+        Args:
+            route: The route to make the request to.
+
+            payload: The optional payload to send in the request body.
+
+        Returns:
+            The requested json data or the error response.
+        """
+        return await self._request(  # type: ignore[no-any-return]
+            self._get_request_func(route.method),
+            self._base_url + self._api_version + route.uri,
+            headers=self._headers,
+            params=route.params,
+            json=payload or None,
+        )
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+ close + + + + async + + +

+
close() -> None
+
+ +
+ +

Closes the existing client session, if it's still open.

+ +
+ Source code in unkey/services/http.py +
async def close(self) -> None:
+    """Closes the existing client session, if it's still open."""
+    if hasattr(self, "_session") and not self._session.closed:
+        await self._session.close()
+
+
+
+ +
+ + +
+ + + +

+ fetch + + + + async + + +

+
fetch(
+    route: routes.CompiledRoute,
+    *,
+    payload: t.Optional[t.Dict[str, t.Any]] = None
+) -> dict[str, t.Any] | models.HttpResponse
+
+ +
+ +

Fetches the given route.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
route + routes.CompiledRoute + +
+

The route to make the request to.

+
+
+ required +
payload + t.Optional[t.Dict[str, t.Any]] + +
+

The optional payload to send in the request body.

+
+
+ None +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ dict[str, t.Any] | models.HttpResponse + +
+

The requested json data or the error response.

+
+
+ +
+ Source code in unkey/services/http.py +
async def fetch(
+    self,
+    route: routes.CompiledRoute,
+    *,
+    payload: t.Optional[t.Dict[str, t.Any]] = None,
+) -> dict[str, t.Any] | models.HttpResponse:
+    """Fetches the given route.
+
+    Args:
+        route: The route to make the request to.
+
+        payload: The optional payload to send in the request body.
+
+    Returns:
+        The requested json data or the error response.
+    """
+    return await self._request(  # type: ignore[no-any-return]
+        self._get_request_func(route.method),
+        self._base_url + self._api_version + route.uri,
+        headers=self._headers,
+        params=route.params,
+        json=payload or None,
+    )
+
+
+
+ +
+ + +
+ + + +

+ set_api_key + + +

+
set_api_key(api_key: str) -> None
+
+ +
+ +

Sets the api key used by the http service.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
api_key + str + +
+

The new api key to use.

+
+
+ required +
+ +
+ Source code in unkey/services/http.py +
def set_api_key(self, api_key: str) -> None:
+    """Sets the api key used by the http service.
+
+    Args:
+        api_key: The new api key to use.
+    """
+    self._headers["x-api-key"] = api_key
+
+
+
+ +
+ + +
+ + + +

+ set_base_url + + +

+
set_base_url(base_url: str) -> None
+
+ +
+ +

Sets the api base url used by the http service.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
base_url + str + +
+

The new base url to use.

+
+
+ required +
+ +
+ Source code in unkey/services/http.py +
def set_base_url(self, base_url: str) -> None:
+    """Sets the api base url used by the http service.
+
+    Args:
+        base_url: The new base url to use.
+    """
+    self._base_url = base_url
+
+
+
+ +
+ + +
+ + + +

+ start + + + + async + + +

+
start() -> None
+
+ +
+ +

Starts the client session to be used by the http service.

+ +
+ Source code in unkey/services/http.py +
async def start(self) -> None:
+    """Starts the client session to be used by the http service."""
+    if not hasattr(self, "_session") or self._session.closed:
+        await self._init_session()
+
+
+
+ +
+ + + +
+ +
+ +
+ +
+ + + +

+ KeyService + + +

+ + +
+

+ Bases: BaseService

+ + +

Handles api key related requests.

+ +
+ Source code in unkey/services/keys.py +
class KeyService(BaseService):
+    """Handles api key related requests."""
+
+    __slots__ = ()
+
+    async def create_key(
+        self,
+        api_id: str,
+        owner_id: str,
+        prefix: str,
+        *,
+        name: UndefinedOr[str] = UNDEFINED,
+        byte_length: UndefinedOr[int] = UNDEFINED,
+        meta: UndefinedOr[t.Dict[str, t.Any]] = UNDEFINED,
+        expires: UndefinedOr[int] = UNDEFINED,
+        remaining: UndefinedOr[int] = UNDEFINED,
+        ratelimit: UndefinedOr[models.Ratelimit] = UNDEFINED,
+    ) -> ResultT[models.ApiKey]:
+        """Creates a new api key.
+
+        Args:
+            name: The name to use for this key.
+
+            api_id: The id of the api this key is for.
+
+            owner_id: The owner id to use for this key. Represents the
+                user who will use this key.
+
+            prefix: The prefix to place at the beginning of the key.
+
+        Keyword Args:
+            byte_length: The optional desired length of they in bytes.
+                Defaults to 16.
+
+            meta: An optional dynamic mapping of information used to
+                provide context around this keys user.
+
+            expires: The optional number of milliseconds into the future
+                when this key should expire.
+
+            remaining: The optional max number of times this key can be
+                used. Useful for creating long lived keys but with a
+                limit on total uses.
+
+            ratelimit: The optional Ratelimit to set on this key.
+
+        Returns:
+            A result containing the requested information or an error.
+        """
+        route = routes.CREATE_KEY.compile()
+        payload = self._generate_map(
+            meta=meta,
+            name=name,
+            apiId=api_id,
+            prefix=prefix,
+            ownerId=owner_id,
+            remaining=remaining,
+            byteLength=byte_length,
+            expires=self._expires_in(milliseconds=expires or 0),
+            ratelimit=None
+            if not ratelimit
+            else self._generate_map(
+                limit=ratelimit.limit,
+                type=ratelimit.type.value,
+                refillRate=ratelimit.refill_rate,
+                refillInterval=ratelimit.refill_interval,
+            ),
+        )
+
+        data = await self._http.fetch(route, payload=payload)
+
+        if isinstance(data, models.HttpResponse):
+            return result.Err(data)
+
+        return result.Ok(self._serializer.to_api_key(data))
+
+    async def verify_key(self, key: str) -> ResultT[models.ApiKeyVerification]:
+        """Verifies a key is valid and within ratelimit.
+
+        Args:
+            key: The key to verify.
+
+        Returns:
+            A result containing the api key verification or an error.
+        """
+        route = routes.VERIFY_KEY.compile()
+        payload = self._generate_map(key=key)
+        data = await self._http.fetch(route, payload=payload)
+
+        if isinstance(data, models.HttpResponse):
+            return result.Err(data)
+
+        return result.Ok(self._serializer.to_api_key_verification(data))
+
+    async def revoke_key(self, key_id: str) -> ResultT[models.HttpResponse]:
+        """Revokes a keys validity.
+
+        Args:
+            key_id: The id of the key to revoke.
+
+        Returns:
+            A result containing the http response or an error.
+        """
+        route = routes.REVOKE_KEY.compile(key_id)
+        data = await self._http.fetch(route)
+
+        if isinstance(data, models.HttpResponse):
+            return result.Err(data)
+
+        if "error" in data:
+            return result.Err(
+                models.HttpResponse(
+                    404,
+                    data["error"],
+                    models.ErrorCode.from_str_maybe(data.get("code", "unknown")),
+                )
+            )
+
+        return result.Ok(models.HttpResponse(200, "OK"))
+
+    async def update_key(
+        self,
+        key_id: str,
+        *,
+        name: UndefinedNoneOr[str] = UNDEFINED,
+        owner_id: UndefinedNoneOr[str] = UNDEFINED,
+        meta: UndefinedNoneOr[t.Dict[str, t.Any]] = UNDEFINED,
+        expires: UndefinedNoneOr[int] = UNDEFINED,
+        remaining: UndefinedNoneOr[int] = UNDEFINED,
+        ratelimit: UndefinedNoneOr[models.Ratelimit] = UNDEFINED,
+    ) -> ResultT[models.HttpResponse]:
+        """Updates an existing api key. To delete a key set its value
+        to `None`.
+
+        Args:
+            key_id: The id of the key to update.
+
+        Keyword Args:
+            name: The new name to use for this key.
+
+            owner_id: The new owner id to use for this key.
+
+            meta: The new dynamic mapping of information used
+                to provide context around this keys user.
+
+            expires: The new number of milliseconds into the future
+                when this key should expire.
+
+            remaining: The new max number of times this key can be
+                used.
+
+            ratelimit: The new Ratelimit to set on this key.
+
+        Returns:
+            A result containing the OK response or an error.
+        """
+        if all_undefined(name, owner_id, meta, expires, remaining, ratelimit):
+            raise errors.MissingRequiredArgument("At least one value is required to be updated.")
+
+        route = routes.UPDATE_KEY.compile(key_id)
+        payload = self._generate_map(
+            name=name,
+            meta=meta,
+            keyId=key_id,
+            ownerId=owner_id,
+            remaining=remaining,
+            ratelimit=ratelimit,
+            expires=self._expires_in(milliseconds=expires or 0)
+            if expires is not None
+            else expires,
+        )
+
+        data = await self._http.fetch(route, payload=payload)
+
+        if isinstance(data, models.HttpResponse):
+            return result.Err(data)
+
+        return result.Ok(models.HttpResponse(200, "OK"))
+
+
+ + + +
+ + + + + + + + + + +
+ + + +

+ create_key + + + + async + + +

+
create_key(
+    api_id: str,
+    owner_id: str,
+    prefix: str,
+    *,
+    name: UndefinedOr[str] = UNDEFINED,
+    byte_length: UndefinedOr[int] = UNDEFINED,
+    meta: UndefinedOr[t.Dict[str, t.Any]] = UNDEFINED,
+    expires: UndefinedOr[int] = UNDEFINED,
+    remaining: UndefinedOr[int] = UNDEFINED,
+    ratelimit: UndefinedOr[models.Ratelimit] = UNDEFINED
+) -> ResultT[models.ApiKey]
+
+ +
+ +

Creates a new api key.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + UndefinedOr[str] + +
+

The name to use for this key.

+
+
+ UNDEFINED +
api_id + str + +
+

The id of the api this key is for.

+
+
+ required +
owner_id + str + +
+

The owner id to use for this key. Represents the +user who will use this key.

+
+
+ required +
prefix + str + +
+

The prefix to place at the beginning of the key.

+
+
+ required +
+ + + +

Other Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
byte_length + UndefinedOr[int] + +
+

The optional desired length of they in bytes. +Defaults to 16.

+
+
meta + UndefinedOr[t.Dict[str, t.Any]] + +
+

An optional dynamic mapping of information used to +provide context around this keys user.

+
+
expires + UndefinedOr[int] + +
+

The optional number of milliseconds into the future +when this key should expire.

+
+
remaining + UndefinedOr[int] + +
+

The optional max number of times this key can be +used. Useful for creating long lived keys but with a +limit on total uses.

+
+
ratelimit + UndefinedOr[models.Ratelimit] + +
+

The optional Ratelimit to set on this key.

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ResultT[models.ApiKey] + +
+

A result containing the requested information or an error.

+
+
+ +
+ Source code in unkey/services/keys.py +
27
+28
+29
+30
+31
+32
+33
+34
+35
+36
+37
+38
+39
+40
+41
+42
+43
+44
+45
+46
+47
+48
+49
+50
+51
+52
+53
+54
+55
+56
+57
+58
+59
+60
+61
+62
+63
+64
+65
+66
+67
+68
+69
+70
+71
+72
+73
+74
+75
+76
+77
+78
+79
+80
+81
+82
+83
+84
+85
+86
+87
+88
+89
+90
+91
+92
+93
+94
+95
+96
async def create_key(
+    self,
+    api_id: str,
+    owner_id: str,
+    prefix: str,
+    *,
+    name: UndefinedOr[str] = UNDEFINED,
+    byte_length: UndefinedOr[int] = UNDEFINED,
+    meta: UndefinedOr[t.Dict[str, t.Any]] = UNDEFINED,
+    expires: UndefinedOr[int] = UNDEFINED,
+    remaining: UndefinedOr[int] = UNDEFINED,
+    ratelimit: UndefinedOr[models.Ratelimit] = UNDEFINED,
+) -> ResultT[models.ApiKey]:
+    """Creates a new api key.
+
+    Args:
+        name: The name to use for this key.
+
+        api_id: The id of the api this key is for.
+
+        owner_id: The owner id to use for this key. Represents the
+            user who will use this key.
+
+        prefix: The prefix to place at the beginning of the key.
+
+    Keyword Args:
+        byte_length: The optional desired length of they in bytes.
+            Defaults to 16.
+
+        meta: An optional dynamic mapping of information used to
+            provide context around this keys user.
+
+        expires: The optional number of milliseconds into the future
+            when this key should expire.
+
+        remaining: The optional max number of times this key can be
+            used. Useful for creating long lived keys but with a
+            limit on total uses.
+
+        ratelimit: The optional Ratelimit to set on this key.
+
+    Returns:
+        A result containing the requested information or an error.
+    """
+    route = routes.CREATE_KEY.compile()
+    payload = self._generate_map(
+        meta=meta,
+        name=name,
+        apiId=api_id,
+        prefix=prefix,
+        ownerId=owner_id,
+        remaining=remaining,
+        byteLength=byte_length,
+        expires=self._expires_in(milliseconds=expires or 0),
+        ratelimit=None
+        if not ratelimit
+        else self._generate_map(
+            limit=ratelimit.limit,
+            type=ratelimit.type.value,
+            refillRate=ratelimit.refill_rate,
+            refillInterval=ratelimit.refill_interval,
+        ),
+    )
+
+    data = await self._http.fetch(route, payload=payload)
+
+    if isinstance(data, models.HttpResponse):
+        return result.Err(data)
+
+    return result.Ok(self._serializer.to_api_key(data))
+
+
+
+ +
+ + +
+ + + +

+ revoke_key + + + + async + + +

+
revoke_key(key_id: str) -> ResultT[models.HttpResponse]
+
+ +
+ +

Revokes a keys validity.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key_id + str + +
+

The id of the key to revoke.

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ResultT[models.HttpResponse] + +
+

A result containing the http response or an error.

+
+
+ +
+ Source code in unkey/services/keys.py +
async def revoke_key(self, key_id: str) -> ResultT[models.HttpResponse]:
+    """Revokes a keys validity.
+
+    Args:
+        key_id: The id of the key to revoke.
+
+    Returns:
+        A result containing the http response or an error.
+    """
+    route = routes.REVOKE_KEY.compile(key_id)
+    data = await self._http.fetch(route)
+
+    if isinstance(data, models.HttpResponse):
+        return result.Err(data)
+
+    if "error" in data:
+        return result.Err(
+            models.HttpResponse(
+                404,
+                data["error"],
+                models.ErrorCode.from_str_maybe(data.get("code", "unknown")),
+            )
+        )
+
+    return result.Ok(models.HttpResponse(200, "OK"))
+
+
+
+ +
+ + +
+ + + +

+ update_key + + + + async + + +

+
update_key(
+    key_id: str,
+    *,
+    name: UndefinedNoneOr[str] = UNDEFINED,
+    owner_id: UndefinedNoneOr[str] = UNDEFINED,
+    meta: UndefinedNoneOr[t.Dict[str, t.Any]] = UNDEFINED,
+    expires: UndefinedNoneOr[int] = UNDEFINED,
+    remaining: UndefinedNoneOr[int] = UNDEFINED,
+    ratelimit: UndefinedNoneOr[models.Ratelimit] = UNDEFINED
+) -> ResultT[models.HttpResponse]
+
+ +
+ +

Updates an existing api key. To delete a key set its value +to None.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key_id + str + +
+

The id of the key to update.

+
+
+ required +
+ + + +

Other Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescription
name + UndefinedNoneOr[str] + +
+

The new name to use for this key.

+
+
owner_id + UndefinedNoneOr[str] + +
+

The new owner id to use for this key.

+
+
meta + UndefinedNoneOr[t.Dict[str, t.Any]] + +
+

The new dynamic mapping of information used +to provide context around this keys user.

+
+
expires + UndefinedNoneOr[int] + +
+

The new number of milliseconds into the future +when this key should expire.

+
+
remaining + UndefinedNoneOr[int] + +
+

The new max number of times this key can be +used.

+
+
ratelimit + UndefinedNoneOr[models.Ratelimit] + +
+

The new Ratelimit to set on this key.

+
+
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ResultT[models.HttpResponse] + +
+

A result containing the OK response or an error.

+
+
+ +
+ Source code in unkey/services/keys.py +
async def update_key(
+    self,
+    key_id: str,
+    *,
+    name: UndefinedNoneOr[str] = UNDEFINED,
+    owner_id: UndefinedNoneOr[str] = UNDEFINED,
+    meta: UndefinedNoneOr[t.Dict[str, t.Any]] = UNDEFINED,
+    expires: UndefinedNoneOr[int] = UNDEFINED,
+    remaining: UndefinedNoneOr[int] = UNDEFINED,
+    ratelimit: UndefinedNoneOr[models.Ratelimit] = UNDEFINED,
+) -> ResultT[models.HttpResponse]:
+    """Updates an existing api key. To delete a key set its value
+    to `None`.
+
+    Args:
+        key_id: The id of the key to update.
+
+    Keyword Args:
+        name: The new name to use for this key.
+
+        owner_id: The new owner id to use for this key.
+
+        meta: The new dynamic mapping of information used
+            to provide context around this keys user.
+
+        expires: The new number of milliseconds into the future
+            when this key should expire.
+
+        remaining: The new max number of times this key can be
+            used.
+
+        ratelimit: The new Ratelimit to set on this key.
+
+    Returns:
+        A result containing the OK response or an error.
+    """
+    if all_undefined(name, owner_id, meta, expires, remaining, ratelimit):
+        raise errors.MissingRequiredArgument("At least one value is required to be updated.")
+
+    route = routes.UPDATE_KEY.compile(key_id)
+    payload = self._generate_map(
+        name=name,
+        meta=meta,
+        keyId=key_id,
+        ownerId=owner_id,
+        remaining=remaining,
+        ratelimit=ratelimit,
+        expires=self._expires_in(milliseconds=expires or 0)
+        if expires is not None
+        else expires,
+    )
+
+    data = await self._http.fetch(route, payload=payload)
+
+    if isinstance(data, models.HttpResponse):
+        return result.Err(data)
+
+    return result.Ok(models.HttpResponse(200, "OK"))
+
+
+
+ +
+ + +
+ + + +

+ verify_key + + + + async + + +

+
verify_key(key: str) -> ResultT[models.ApiKeyVerification]
+
+ +
+ +

Verifies a key is valid and within ratelimit.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
key + str + +
+

The key to verify.

+
+
+ required +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ ResultT[models.ApiKeyVerification] + +
+

A result containing the api key verification or an error.

+
+
+ +
+ Source code in unkey/services/keys.py +
async def verify_key(self, key: str) -> ResultT[models.ApiKeyVerification]:
+    """Verifies a key is valid and within ratelimit.
+
+    Args:
+        key: The key to verify.
+
+    Returns:
+        A result containing the api key verification or an error.
+    """
+    route = routes.VERIFY_KEY.compile()
+    payload = self._generate_map(key=key)
+    data = await self._http.fetch(route, payload=payload)
+
+    if isinstance(data, models.HttpResponse):
+        return result.Err(data)
+
+    return result.Ok(self._serializer.to_api_key_verification(data))
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/reference/undefined/index.html b/v0.4.1/reference/undefined/index.html new file mode 100644 index 0000000..5931c3f --- /dev/null +++ b/v0.4.1/reference/undefined/index.html @@ -0,0 +1,1257 @@ + + + + + + + + + + + + + + + + + + + + + + undefined - unkey.py + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + +
+ + + + + + + +
+ +
+ + + + +
+
+ + + +
+
+
+ + + + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + + + + +

undefined

+ + +
+ + + +
+ + + +
+ + + + + + + +
+ + + +

+ UNDEFINED + + + + module-attribute + + +

+
UNDEFINED = Undefined()
+
+ +
+ +

A value that does not exist.

+
+ +
+ +
+ + + +

+ UndefinedNoneOr + + + + module-attribute + + +

+
UndefinedNoneOr = UndefinedOr[t.Optional[T]]
+
+ +
+ +

A value that is undefined, none, or T

+
+ +
+ +
+ + + +

+ UndefinedOr + + + + module-attribute + + +

+
UndefinedOr = t.Union[T, Undefined]
+
+ +
+ +

A value that is undefined or T

+
+ +
+ + +
+ + + +

+ Undefined + + +

+ + +
+ + +

Represents an undefined value - without being None.

+ +
+ Source code in unkey/undefined.py +
 8
+ 9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
+25
+26
+27
+28
+29
+30
+31
+32
+33
class Undefined:
+    """Represents an undefined value - without being None."""
+
+    __slots__ = ()
+
+    def __bool__(self) -> t.Literal[False]:
+        return False
+
+    def __copy__(self) -> Undefined:
+        return self
+
+    def __deepcopy__(self, memo: t.MutableMapping[int, t.Any]) -> Undefined:
+        memo[id(self)] = self
+        return self
+
+    def __getstate__(self) -> t.Any:
+        return False
+
+    def __repr__(self) -> str:
+        return "UNDEFINED"
+
+    def __reduce__(self) -> str:
+        return "UNDEFINED"
+
+    def __str__(self) -> str:
+        return "UNDEFINED"
+
+
+ + + +
+ + + + + + + + + + + +
+ +
+ +
+ + + +
+ + + +

+ all_undefined + + +

+
all_undefined(*values: t.Any) -> bool
+
+ +
+ +

Whether or not all values are undefined.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
*values + t.Any + +
+

The values to check.

+
+
+ () +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ bool + +
+

True if all values were undefined.

+
+
+ +
+ Source code in unkey/undefined.py +
54
+55
+56
+57
+58
+59
+60
+61
+62
+63
def all_undefined(*values: t.Any) -> bool:
+    """Whether or not all values are undefined.
+
+    Arguments:
+        *values: The values to check.
+
+    Returns:
+        `True` if all values were undefined.
+    """
+    return all(v is UNDEFINED for v in values)
+
+
+
+ +
+ + +
+ + + +

+ any_undefined + + +

+
any_undefined(*values: t.Any) -> bool
+
+ +
+ +

Whether or not any values are undefined.

+ + + +

Parameters:

+ + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
*values + t.Any + +
+

The values to check.

+
+
+ () +
+ + + +

Returns:

+ + + + + + + + + + + + + +
TypeDescription
+ bool + +
+

True if any values were undefined.

+
+
+ +
+ Source code in unkey/undefined.py +
66
+67
+68
+69
+70
+71
+72
+73
+74
+75
def any_undefined(*values: t.Any) -> bool:
+    """Whether or not any values are undefined.
+
+    Arguments:
+        *values: The values to check.
+
+    Returns:
+        `True` if any values were undefined.
+    """
+    return any(v is UNDEFINED for v in values)
+
+
+
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + + + +
+ + + +
+ + + +
+
+
+
+ + + + + + + + + \ No newline at end of file diff --git a/v0.4.1/search/search_index.json b/v0.4.1/search/search_index.json new file mode 100644 index 0000000..d3ea4c6 --- /dev/null +++ b/v0.4.1/search/search_index.json @@ -0,0 +1 @@ +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"About","text":""},{"location":"#unkeypy","title":"unkey.py","text":"

An asynchronous Python SDK for unkey.dev.

"},{"location":"#documentation","title":"Documentation","text":"
  • Stable
  • Development
"},{"location":"#installation","title":"Installation","text":"

Python version 3.8 or greater is required to use unkey.py.

"},{"location":"#stable","title":"Stable","text":"
pip install -U unkey.py\n
"},{"location":"#development","title":"Development","text":"
pip install -U git+https://github.com/Jonxslays/unkey.py\n

For more information on using pip, check out the pip documentation.

"},{"location":"#example","title":"Example","text":"
import asyncio\nimport os\nimport unkey\nasync def main() -> None:\nclient = unkey.Client(api_key=os.environ[\"API_KEY\"])\nawait client.start()\nresult = await client.keys.verify_key(\"prefix_123ABC\")\nif result.is_ok:\ndata = result.unwrap()\nprint(data.valid)\nprint(data.owner_id)\nprint(data.meta)\nprint(data.error)\nelse:\nprint(result.unwrap_err())\nawait client.close()\nif __name__ == \"__main__\":\nasyncio.run(main())\n
"},{"location":"#what-is-unkeydev","title":"What is unkey.dev","text":"

unkey.dev is a fully open source API key management solution. It allows you to create, manage, and validate API keys for your applications users. You can even host it yourself, that's the beauty of open source.

If you're interested in learning more about the project, consider checking out any of these links:

  • Website
  • API documentation
  • Github repository
  • Discord community
"},{"location":"#contributing","title":"Contributing","text":"

unkey.py is open to contributions. Check out the contributing guide to learn how.

"},{"location":"#license","title":"License","text":"

unkey.py is licensed under the GPLv3 License.

"},{"location":"changelog/","title":"Changelog","text":""},{"location":"changelog/#changelog","title":"Changelog","text":""},{"location":"changelog/#v041-aug-2023","title":"v0.4.1 (Aug 2023)","text":""},{"location":"changelog/#changes","title":"Changes","text":"
  • UNDEFINED is now guaranteed to be a singleton, preventing id(obj) mismatches.
"},{"location":"changelog/#bugfixes","title":"Bugfixes","text":"
  • Client.start() now correctly initialized a new client session if called after closing the client previously.
"},{"location":"changelog/#additions","title":"Additions","text":"
  • Tests :).
"},{"location":"changelog/#v040-jul-2023","title":"v0.4.0 (Jul 2023)","text":""},{"location":"changelog/#additions_1","title":"Additions","text":"
  • Add UNDEFINED, UndefinedOr, and UndefinedNoneOr types.
  • Add update_key method to key service.
  • Add name parameter to the create_key method.
"},{"location":"changelog/#changes_1","title":"Changes","text":"
  • Refactor existing methods to use the new UNDEFINED type.
"},{"location":"changelog/#v030-jul-2023","title":"v0.3.0 (Jul 2023)","text":""},{"location":"changelog/#bugfixes_1","title":"Bugfixes","text":"
  • Remove debug print statement in list_keys.
"},{"location":"changelog/#additions_2","title":"Additions","text":"
  • Add ErrorCode enum.
  • Add remaining parameter to create_key.
  • Add remaining field to ApiKeyVerification and ApiKeyMeta models.
  • Add code field to ApiKeyVerification model.
  • Add code field to HttpResponse model.
"},{"location":"changelog/#changes_2","title":"Changes","text":"
  • Update status code for revoke_key to 200 OK.
"},{"location":"changelog/#v020-jun-2023","title":"v0.2.0 (Jun 2023)","text":""},{"location":"changelog/#additions_3","title":"Additions","text":"
  • Add Client, KeyService and ApiService.
  • Add Serializer, and other necessary base services.
  • Add relevant models.
  • Add support for all publicly documented endpoints:
  • Get API
  • List Keys
  • Create Key
  • Verify Key
  • Revoke Key
"},{"location":"changelog/#v010-jun-2023","title":"v0.1.0 (Jun 2023)","text":"
  • Initial release!
"},{"location":"contributing/","title":"Contributing","text":""},{"location":"contributing/#contributing","title":"Contributing","text":"

Thanks for your interest in unkey.py! Here are some tips for contributing.

"},{"location":"contributing/#guidelines","title":"Guidelines","text":"
  • If you have an idea, but are unsure on the proper implementation - open an issue.
  • Implementations should be well tested before opening a pull request.
  • Max code line length of 99, max docs line length of 80.
  • Code should be written in black's code style.
  • Code should be PEP 8 compliant.
  • Use informative commit messages.
"},{"location":"contributing/#installing-poetry","title":"Installing poetry","text":"

unkey.py uses Poetry for dependency management.

Check out poetry's full installation guide for detailed instructions if you aren't familiar with it.

"},{"location":"contributing/#installing-dependencies","title":"Installing dependencies","text":"
  1. Create a fork of unkey.py, and clone the fork to your local machine.
  2. Change directory into the project dir.
  3. Run poetry shell to create a new virtual environment, and activate it.
  4. Run poetry install to install dependencies (this includes dev deps).
"},{"location":"contributing/#writing-code","title":"Writing code","text":"
  1. Check out a new branch to commit your work to, e.g. git checkout -b bugfix/typing-errors.
  2. Make your changes, then run nox and address any issues that arise.
  3. Commit your work, using an informative commit message.
  4. Open a pull request into the master branch of this repository.

After submitting your PR, it will be reviewed (and hopefully merged!). Thanks again for taking the time to read this contributing guide, and for your interest in unkey.py. I look forward to working with you.

"},{"location":"license/","title":"License","text":"
                GNU GENERAL PUBLIC LICENSE\n                   Version 3, 29 June 2007\n

Copyright (C) 2007 Free Software Foundation, Inc. https://fsf.org/ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.

                        Preamble\n

The GNU General Public License is a free, copyleft license for software and other kinds of works.

The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.

When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.

To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.

For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.

Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.

For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.

Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.

Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.

The precise terms and conditions for copying, distribution and modification follow.

                   TERMS AND CONDITIONS\n
  1. Definitions.

\"This License\" refers to version 3 of the GNU General Public License.

\"Copyright\" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.

\"The Program\" refers to any copyrightable work licensed under this License. Each licensee is addressed as \"you\". \"Licensees\" and \"recipients\" may be individuals or organizations.

To \"modify\" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a \"modified version\" of the earlier work or a work \"based on\" the earlier work.

A \"covered work\" means either the unmodified Program or a work based on the Program.

To \"propagate\" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.

To \"convey\" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.

An interactive user interface displays \"Appropriate Legal Notices\" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.

  1. Source Code.

The \"source code\" for a work means the preferred form of the work for making modifications to it. \"Object code\" means any non-source form of a work.

A \"Standard Interface\" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.

The \"System Libraries\" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A \"Major Component\", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.

The \"Corresponding Source\" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.

The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.

The Corresponding Source for a work in source code form is that same work.

  1. Basic Permissions.

All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.

You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.

Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.

  1. Protecting Users' Legal Rights From Anti-Circumvention Law.

No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.

When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.

  1. Conveying Verbatim Copies.

You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.

You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.

  1. Conveying Modified Source Versions.

You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:

a) The work must carry prominent notices stating that you modified\nit, and giving a relevant date.\n\nb) The work must carry prominent notices stating that it is\nreleased under this License and any conditions added under section\n7.  This requirement modifies the requirement in section 4 to\n\"keep intact all notices\".\n\nc) You must license the entire work, as a whole, under this\nLicense to anyone who comes into possession of a copy.  This\nLicense will therefore apply, along with any applicable section 7\nadditional terms, to the whole of the work, and all its parts,\nregardless of how they are packaged.  This License gives no\npermission to license the work in any other way, but it does not\ninvalidate such permission if you have separately received it.\n\nd) If the work has interactive user interfaces, each must display\nAppropriate Legal Notices; however, if the Program has interactive\ninterfaces that do not display Appropriate Legal Notices, your\nwork need not make them do so.\n

A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an \"aggregate\" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.

  1. Conveying Non-Source Forms.

You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:

a) Convey the object code in, or embodied in, a physical product\n(including a physical distribution medium), accompanied by the\nCorresponding Source fixed on a durable physical medium\ncustomarily used for software interchange.\n\nb) Convey the object code in, or embodied in, a physical product\n(including a physical distribution medium), accompanied by a\nwritten offer, valid for at least three years and valid for as\nlong as you offer spare parts or customer support for that product\nmodel, to give anyone who possesses the object code either (1) a\ncopy of the Corresponding Source for all the software in the\nproduct that is covered by this License, on a durable physical\nmedium customarily used for software interchange, for a price no\nmore than your reasonable cost of physically performing this\nconveying of source, or (2) access to copy the\nCorresponding Source from a network server at no charge.\n\nc) Convey individual copies of the object code with a copy of the\nwritten offer to provide the Corresponding Source.  This\nalternative is allowed only occasionally and noncommercially, and\nonly if you received the object code with such an offer, in accord\nwith subsection 6b.\n\nd) Convey the object code by offering access from a designated\nplace (gratis or for a charge), and offer equivalent access to the\nCorresponding Source in the same way through the same place at no\nfurther charge.  You need not require recipients to copy the\nCorresponding Source along with the object code.  If the place to\ncopy the object code is a network server, the Corresponding Source\nmay be on a different server (operated by you or a third party)\nthat supports equivalent copying facilities, provided you maintain\nclear directions next to the object code saying where to find the\nCorresponding Source.  Regardless of what server hosts the\nCorresponding Source, you remain obligated to ensure that it is\navailable for as long as needed to satisfy these requirements.\n\ne) Convey the object code using peer-to-peer transmission, provided\nyou inform other peers where the object code and Corresponding\nSource of the work are being offered to the general public at no\ncharge under subsection 6d.\n

A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.

A \"User Product\" is either (1) a \"consumer product\", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, \"normally used\" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.

\"Installation Information\" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.

If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).

The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.

Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.

  1. Additional Terms.

\"Additional permissions\" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.

When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.

Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:

a) Disclaiming warranty or limiting liability differently from the\nterms of sections 15 and 16 of this License; or\n\nb) Requiring preservation of specified reasonable legal notices or\nauthor attributions in that material or in the Appropriate Legal\nNotices displayed by works containing it; or\n\nc) Prohibiting misrepresentation of the origin of that material, or\nrequiring that modified versions of such material be marked in\nreasonable ways as different from the original version; or\n\nd) Limiting the use for publicity purposes of names of licensors or\nauthors of the material; or\n\ne) Declining to grant rights under trademark law for use of some\ntrade names, trademarks, or service marks; or\n\nf) Requiring indemnification of licensors and authors of that\nmaterial by anyone who conveys the material (or modified versions of\nit) with contractual assumptions of liability to the recipient, for\nany liability that these contractual assumptions directly impose on\nthose licensors and authors.\n

All other non-permissive additional terms are considered \"further restrictions\" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.

If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.

Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.

  1. Termination.

You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).

However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.

Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.

Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.

  1. Acceptance Not Required for Having Copies.

You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.

  1. Automatic Licensing of Downstream Recipients.

Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.

An \"entity transaction\" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.

You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.

  1. Patents.

A \"contributor\" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's \"contributor version\".

A contributor's \"essential patent claims\" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, \"control\" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.

Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.

In the following three paragraphs, a \"patent license\" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To \"grant\" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.

If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. \"Knowingly relying\" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.

If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.

A patent license is \"discriminatory\" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.

Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.

  1. No Surrender of Others' Freedom.

If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.

  1. Use with the GNU Affero General Public License.

Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.

  1. Revised Versions of this License.

The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.

Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License \"or any later version\" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.

If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.

Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.

  1. Disclaimer of Warranty.

THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

  1. Limitation of Liability.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

  1. Interpretation of Sections 15 and 16.

If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.

                 END OF TERMS AND CONDITIONS\n\n        How to Apply These Terms to Your New Programs\n

If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.

To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the \"copyright\" line and a pointer to where the full notice is found.

<one line to give the program's name and a brief idea of what it does.>\nCopyright (C) <year>  <name of author>\n\nThis program is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nThis program is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with this program.  If not, see <https://www.gnu.org/licenses/>.\n

Also add information on how to contact you by electronic and paper mail.

If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:

<program>  Copyright (C) <year>  <name of author>\nThis program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\nThis is free software, and you are welcome to redistribute it\nunder certain conditions; type `show c' for details.\n

The hypothetical commands show w' andshow c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an \"about box\".

You should also get your employer (if you work as a programmer) or school, if any, to sign a \"copyright disclaimer\" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see https://www.gnu.org/licenses/.

The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read https://www.gnu.org/licenses/why-not-lgpl.html.

"},{"location":"getting-started/client/","title":"Using the client","text":"

The Client class is used to interact with the unkey API. You use the client to make requests.

"},{"location":"getting-started/client/#instantiating-the-client","title":"Instantiating the client","text":"
import unkey\nclient = unkey.Client(\n\"api_abc123\",  # The root api key to use.\napi_version=1,\napi_base_url=\"https://api.unkey.dev\",\n)\n

Api version and base url are both optional. The client defaults to api v1 and the production unkey api url. If you are running a local instance of the api you can set the base url to your instance.

"},{"location":"getting-started/client/#handling-client-resources","title":"Handling client resources","text":"

The unkey Client uses an aiohttp.ClientSession under the hood, so it is important that you call Client.start and Client.close appropriately.

# ...continued from above\nawait client.start()\n# Make requests here...\nawait client.close()\n

You will receive errors/warnings if you do not properly starting the client before using it, or closing it before your program terminates.

"},{"location":"getting-started/client/#example-client-usage","title":"Example client usage","text":"
import asyncio\nimport os\nimport unkey\nasync def main() -> None:\nclient = unkey.Client(api_key=os.environ[\"API_KEY\"])\nawait client.start()\n# 10 requests/second\nratelimit = unkey.Ratelimit(\nunkey.RatelimitType.Fast,\nlimit=10,\nrefill_rate=10,\nrefill_interval=1000,\n)\nresult = await client.keys.create_key(\nos.environ[\"API_ID\"],\n\"jonxslays\",  # user id\n\"test\",  # prefix\nbyte_length=32,\nratelimit=ratelimit,\nmeta={\"is_cool\": True},\nexpires=9600 * 1000,  # 9600 seconds in the future\n)\nif result.is_ok:\ndata = result.unwrap()\nprint(data.key_id)\nprint(data.key)\nelse:\nprint(result.unwrap_err())\nawait client.close()\nif __name__ == \"__main__\":\nasyncio.run(main())\n
"},{"location":"getting-started/installation/","title":"Installation","text":"

Python version 3.8 or greater is required to use unkey.py.

"},{"location":"getting-started/installation/#stable","title":"Stable","text":"
pip install -U unkey.py\n
"},{"location":"getting-started/installation/#development","title":"Development","text":"
pip install -U git+https://github.com/Jonxslays/unkey.py\n

For more information on using pip, check out the pip documentation.

You can verify your installation succeeded with the unkeypy command. The output should look similar to this:

unkey.py v0.2.0 from [HEAD]\n@ /path/to/unkey.py/installation\nCPython 3.11.3 GCC 13.1.1 20230429\nLinux love 6.1.34-1-lts x86_64\n#1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023 17:36:07 +0000\n
"},{"location":"getting-started/result/","title":"The result type","text":"

Those of you familiar with Rust will feel right at home with the Result type this library implements. All requests that go out over the network via the Client come back to you in the form of a Result. The result can be one of two things: an Ok or an Err.

"},{"location":"getting-started/result/#correct-usage","title":"Correct usage","text":"
client = unkey.Client(\"unkey_123\")\nawait client.start()\nresult = await client.keys.verify_key(\"test_123\")\nif result.is_ok:\nprint(result.unwrap())\nelse:\nprint(result.unwrap_err())\n
"},{"location":"getting-started/result/#incorrect-usage","title":"Incorrect usage","text":"
client = unkey.Client()\nawait client.start()\nresult = await client.keys.create_key(\n\"api_123abc\",\n\"jonxslays\",\n\"test\",\nbyte_length=-1,\n)\nprint(result.unwrap()) # <-- Exception raised\n# Raises UnwrapError because byte length can not be -1.\n
"},{"location":"reference/client/","title":"client","text":""},{"location":"reference/client/#unkey.client.Client","title":"Client","text":"

An asynchronous client used for interacting with the API.

Parameters:

Name Type Description Default api_key str

The root api key to use for requests.

required

Other Parameters:

Name Type Description api_version t.Optional[int]

The api version to access. Defaults to 1.

api_base_url t.Optional[str]

The base url to use for the api (no trailing /). Defaults to https://api.unkey.dev.

Source code in unkey/client.py
class Client:\n\"\"\"An asynchronous client used for interacting with the API.\n    Args:\n        api_key: The root api key to use for requests.\n    Keyword Args:\n        api_version: The api version to access. Defaults to 1.\n        api_base_url: The base url to use for the api (no trailing /).\n            Defaults to `https://api.unkey.dev`.\n    \"\"\"\n__slots__ = (\n\"_apis\",\n\"_http\",\n\"_keys\",\n\"_serializer\",\n)\ndef __init__(\nself,\napi_key: str,\n*,\napi_version: t.Optional[int] = None,\napi_base_url: t.Optional[str] = None,\n) -> None:\nself._serializer = serializer.Serializer()\nself._http = services.HttpService(api_key, api_version, api_base_url)\nself.__init_core_services()\ndef __init_core_services(self) -> None:\nself._apis = self.__init_service(services.ApiService)\nself._keys = self.__init_service(services.KeyService)\ndef __init_service(self, service: t.Type[ServiceT]) -> ServiceT:\nif not issubclass(service, services.BaseService):\nraise TypeError(f\"{service.__name__!r} can not be initialized as a service.\")\nreturn service(self._http, self._serializer)  # type: ignore[return-value]\n@property\ndef keys(self) -> services.KeyService:\n\"\"\"The key service used to make key related requests.\"\"\"\nreturn self._keys\n@property\ndef apis(self) -> services.ApiService:\n\"\"\"The api service used to make api related requests.\"\"\"\nreturn self._apis\ndef set_api_key(self, api_key: str) -> None:\n\"\"\"Sets the api key used by the http service.\n        Args:\n            api_key: The new root api key to use for requests.\n        \"\"\"\nself._http.set_api_key(api_key)\ndef set_api_base_url(self, base_url: str) -> None:\n\"\"\"Sets the api base url used by the http service.\n        Args:\n            base_url: The new api base url to use for requests.\n        \"\"\"\nself._http.set_base_url(base_url)\nasync def start(self) -> None:\n\"\"\"Starts the client session to be used for http requests.\"\"\"\nawait self._http.start()\nasync def close(self) -> None:\n\"\"\"Closes the existing client session, if it's still open.\"\"\"\nawait self._http.close()\n
"},{"location":"reference/client/#unkey.client.Client.apis","title":"apis property","text":"
apis: services.ApiService\n

The api service used to make api related requests.

"},{"location":"reference/client/#unkey.client.Client.keys","title":"keys property","text":"
keys: services.KeyService\n

The key service used to make key related requests.

"},{"location":"reference/client/#unkey.client.Client.close","title":"close async","text":"
close() -> None\n

Closes the existing client session, if it's still open.

Source code in unkey/client.py
async def close(self) -> None:\n\"\"\"Closes the existing client session, if it's still open.\"\"\"\nawait self._http.close()\n
"},{"location":"reference/client/#unkey.client.Client.set_api_base_url","title":"set_api_base_url","text":"
set_api_base_url(base_url: str) -> None\n

Sets the api base url used by the http service.

Parameters:

Name Type Description Default base_url str

The new api base url to use for requests.

required Source code in unkey/client.py
def set_api_base_url(self, base_url: str) -> None:\n\"\"\"Sets the api base url used by the http service.\n    Args:\n        base_url: The new api base url to use for requests.\n    \"\"\"\nself._http.set_base_url(base_url)\n
"},{"location":"reference/client/#unkey.client.Client.set_api_key","title":"set_api_key","text":"
set_api_key(api_key: str) -> None\n

Sets the api key used by the http service.

Parameters:

Name Type Description Default api_key str

The new root api key to use for requests.

required Source code in unkey/client.py
def set_api_key(self, api_key: str) -> None:\n\"\"\"Sets the api key used by the http service.\n    Args:\n        api_key: The new root api key to use for requests.\n    \"\"\"\nself._http.set_api_key(api_key)\n
"},{"location":"reference/client/#unkey.client.Client.start","title":"start async","text":"
start() -> None\n

Starts the client session to be used for http requests.

Source code in unkey/client.py
async def start(self) -> None:\n\"\"\"Starts the client session to be used for http requests.\"\"\"\nawait self._http.start()\n
"},{"location":"reference/errors/","title":"errors","text":""},{"location":"reference/errors/#unkey.errors.BaseError","title":"BaseError","text":"

Bases: Exception

The base error all unkey errors inherit from.

Source code in unkey/errors.py
class BaseError(Exception):\n\"\"\"The base error all unkey errors inherit from.\"\"\"\n__slots__ = ()\n
"},{"location":"reference/errors/#unkey.errors.MissingRequiredArgument","title":"MissingRequiredArgument","text":"

Bases: BaseError

Raised when a required argument is missing.

Source code in unkey/errors.py
class MissingRequiredArgument(BaseError):\n\"\"\"Raised when a required argument is missing.\"\"\"\n__slots__ = ()\ndef __init__(self, message: str) -> None:\nsuper().__init__(f\"Missing required argument: {message}\")\n
"},{"location":"reference/errors/#unkey.errors.UnwrapError","title":"UnwrapError","text":"

Bases: BaseError

Raised when calling unwrap or unwrap_err incorrectly.

Source code in unkey/errors.py
class UnwrapError(BaseError):\n\"\"\"Raised when calling unwrap or unwrap_err incorrectly.\"\"\"\n__slots__ = ()\ndef __init__(self, message: str) -> None:\nsuper().__init__(f\"Unwrap failed: {message}\")\n
"},{"location":"reference/models/","title":"models","text":""},{"location":"reference/models/#unkey.models.Api","title":"Api","text":"

Bases: BaseModel

Data representing a particular ratelimit.

Source code in unkey/models/apis.py
@attrs.define(init=False, weakref_slot=False)\nclass Api(BaseModel):\n\"\"\"Data representing a particular ratelimit.\"\"\"\nid: str\n\"\"\"The id for this api.\"\"\"\nname: str\n\"\"\"The name of the api.\"\"\"\nworkspace_id: str\n\"\"\"The id for the workspace this api belongs to.\"\"\"\n
"},{"location":"reference/models/#unkey.models.apis.Api.id","title":"id instance-attribute","text":"
id: str\n

The id for this api.

"},{"location":"reference/models/#unkey.models.apis.Api.name","title":"name instance-attribute","text":"
name: str\n

The name of the api.

"},{"location":"reference/models/#unkey.models.apis.Api.workspace_id","title":"workspace_id instance-attribute","text":"
workspace_id: str\n

The id for the workspace this api belongs to.

"},{"location":"reference/models/#unkey.models.ApiKey","title":"ApiKey","text":"

Bases: BaseModel

Minimal representation of an api key.

Source code in unkey/models/keys.py
@attrs.define(init=False, weakref_slot=False)\nclass ApiKey(BaseModel):\n\"\"\"Minimal representation of an api key.\"\"\"\nkey_id: str\n\"\"\"The id of this key stored at unkey.\"\"\"\nkey: str\n\"\"\"The api key itself.\"\"\"\n
"},{"location":"reference/models/#unkey.models.keys.ApiKey.key","title":"key instance-attribute","text":"
key: str\n

The api key itself.

"},{"location":"reference/models/#unkey.models.keys.ApiKey.key_id","title":"key_id instance-attribute","text":"
key_id: str\n

The id of this key stored at unkey.

"},{"location":"reference/models/#unkey.models.ApiKeyList","title":"ApiKeyList","text":"

Bases: BaseModel

Data representing keys for an api.

Source code in unkey/models/apis.py
@attrs.define(init=False, weakref_slot=False)\nclass ApiKeyList(BaseModel):\n\"\"\"Data representing keys for an api.\"\"\"\nkeys: t.List[ApiKeyMeta]\n\"\"\"A list of keys associated with the api.\"\"\"\ntotal: int\n\"\"\"The total number of keys associated with the api.\"\"\"\n
"},{"location":"reference/models/#unkey.models.apis.ApiKeyList.keys","title":"keys instance-attribute","text":"
keys: t.List[ApiKeyMeta]\n

A list of keys associated with the api.

"},{"location":"reference/models/#unkey.models.apis.ApiKeyList.total","title":"total instance-attribute","text":"
total: int\n

The total number of keys associated with the api.

"},{"location":"reference/models/#unkey.models.ApiKeyMeta","title":"ApiKeyMeta","text":"

Bases: BaseModel

Metadata about an api key.

Source code in unkey/models/keys.py
@attrs.define(init=False, weakref_slot=False)\nclass ApiKeyMeta(BaseModel):\n\"\"\"Metadata about an api key.\"\"\"\nid: str\n\"\"\"The id of this key.\"\"\"\napi_id: str\n\"\"\"The id of the api this key belongs to.\"\"\"\nworkspace_id: str\n\"\"\"The id of the workspace this key belongs to.\"\"\"\nstart: str\n\"\"\"The prefix and beginning 3 letters of the key.\"\"\"\ncreated_at: int\n\"\"\"The unix epoch representing when this key was created in\n    milliseconds.\"\"\"\nowner_id: t.Optional[str]\n\"\"\"The owner of this api key if one was specified.\"\"\"\nexpires: t.Optional[int]\n\"\"\"The optional unix epoch representing when this key expires in\n    milliseconds.\"\"\"\nratelimit: t.Optional[Ratelimit]\n\"\"\"The optional ratelimit associated with this key.\"\"\"\nmeta: t.Optional[t.Dict[str, t.Any]]\n\"\"\"The dynamic mapping of data used during key creation, if\n    the key was found.\n    \"\"\"\nremaining: t.Optional[int]\n\"\"\"The remaining verifications before this key is invalidated.\n    If `None`, this field was not used in the keys creation and can\n    be ignored.\n    \"\"\"\n
"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.api_id","title":"api_id instance-attribute","text":"
api_id: str\n

The id of the api this key belongs to.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.created_at","title":"created_at instance-attribute","text":"
created_at: int\n

The unix epoch representing when this key was created in milliseconds.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.expires","title":"expires instance-attribute","text":"
expires: t.Optional[int]\n

The optional unix epoch representing when this key expires in milliseconds.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.id","title":"id instance-attribute","text":"
id: str\n

The id of this key.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.meta","title":"meta instance-attribute","text":"
meta: t.Optional[t.Dict[str, t.Any]]\n

The dynamic mapping of data used during key creation, if the key was found.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.owner_id","title":"owner_id instance-attribute","text":"
owner_id: t.Optional[str]\n

The owner of this api key if one was specified.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.ratelimit","title":"ratelimit instance-attribute","text":"
ratelimit: t.Optional[Ratelimit]\n

The optional ratelimit associated with this key.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.remaining","title":"remaining instance-attribute","text":"
remaining: t.Optional[int]\n

The remaining verifications before this key is invalidated. If None, this field was not used in the keys creation and can be ignored.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.start","title":"start instance-attribute","text":"
start: str\n

The prefix and beginning 3 letters of the key.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyMeta.workspace_id","title":"workspace_id instance-attribute","text":"
workspace_id: str\n

The id of the workspace this key belongs to.

"},{"location":"reference/models/#unkey.models.ApiKeyVerification","title":"ApiKeyVerification","text":"

Bases: BaseModel

Data about whether this api key is valid.

Source code in unkey/models/keys.py
@attrs.define(init=False, weakref_slot=False)\nclass ApiKeyVerification(BaseModel):\n\"\"\"Data about whether this api key is valid.\"\"\"\nvalid: bool\n\"\"\"Whether or not this key is valid and passes ratelimit.\"\"\"\nowner_id: t.Optional[str]\n\"\"\"The id of the owner for this key, if the key was found.\"\"\"\nmeta: t.Optional[t.Dict[str, t.Any]]\n\"\"\"Dynamic mapping of data used during key creation, if the\n    key was found.\n    \"\"\"\nremaining: t.Optional[int]\n\"\"\"The remaining verifications before this key is invalidated.\n    If `None`, this field was not used in the keys creation and can\n    be ignored.\n    \"\"\"\ncode: t.Optional[ErrorCode]\n\"\"\"The optional error code returned by the unkey api.\"\"\"\nerror: t.Optional[str]\n\"\"\"The error message if the key was invalid.\"\"\"\n
"},{"location":"reference/models/#unkey.models.keys.ApiKeyVerification.code","title":"code instance-attribute","text":"
code: t.Optional[ErrorCode]\n

The optional error code returned by the unkey api.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyVerification.error","title":"error instance-attribute","text":"
error: t.Optional[str]\n

The error message if the key was invalid.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyVerification.meta","title":"meta instance-attribute","text":"
meta: t.Optional[t.Dict[str, t.Any]]\n

Dynamic mapping of data used during key creation, if the key was found.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyVerification.owner_id","title":"owner_id instance-attribute","text":"
owner_id: t.Optional[str]\n

The id of the owner for this key, if the key was found.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyVerification.remaining","title":"remaining instance-attribute","text":"
remaining: t.Optional[int]\n

The remaining verifications before this key is invalidated. If None, this field was not used in the keys creation and can be ignored.

"},{"location":"reference/models/#unkey.models.keys.ApiKeyVerification.valid","title":"valid instance-attribute","text":"
valid: bool\n

Whether or not this key is valid and passes ratelimit.

"},{"location":"reference/models/#unkey.models.BaseEnum","title":"BaseEnum","text":"

Bases: Enum

The base enum all library enums inherit from.

Source code in unkey/models/base.py
class BaseEnum(Enum):\n\"\"\"The base enum all library enums inherit from.\"\"\"\n__slots__ = ()\nvalue: str  # pyright: ignore\ndef __str__(self) -> str:\nreturn self.value\n@classmethod\ndef from_str(cls: t.Type[T], value: str) -> T:\n\"\"\"Generate this enum from the given value.\n        Args:\n            value: The value to generate from.\n        Returns:\n            The generated enum.\n        \"\"\"\ntry:\nreturn cls(value)\nexcept ValueError as e:\nraise ValueError(\nf\"{e} variant. Please report this issue on github at \"\n\"https://github.com/Jonxslays/unkey.py/issues/new\"\n) from None\n@classmethod\ndef from_str_maybe(cls: t.Type[T], value: str) -> t.Optional[T]:\n\"\"\"Attempt to generate this enum from the given value.\n        Args:\n            value: The value to generate from.\n        Returns:\n            The generated enum or `None` if the value was not a valid\n                enum variant.\n        \"\"\"\ntry:\nreturn cls(value)\nexcept ValueError:\nreturn None\n
"},{"location":"reference/models/#unkey.models.base.BaseEnum.from_str","title":"from_str classmethod","text":"
from_str(value: str) -> T\n

Generate this enum from the given value.

Parameters:

Name Type Description Default value str

The value to generate from.

required

Returns:

Type Description T

The generated enum.

Source code in unkey/models/base.py
@classmethod\ndef from_str(cls: t.Type[T], value: str) -> T:\n\"\"\"Generate this enum from the given value.\n    Args:\n        value: The value to generate from.\n    Returns:\n        The generated enum.\n    \"\"\"\ntry:\nreturn cls(value)\nexcept ValueError as e:\nraise ValueError(\nf\"{e} variant. Please report this issue on github at \"\n\"https://github.com/Jonxslays/unkey.py/issues/new\"\n) from None\n
"},{"location":"reference/models/#unkey.models.base.BaseEnum.from_str_maybe","title":"from_str_maybe classmethod","text":"
from_str_maybe(value: str) -> t.Optional[T]\n

Attempt to generate this enum from the given value.

Parameters:

Name Type Description Default value str

The value to generate from.

required

Returns:

Type Description t.Optional[T]

The generated enum or None if the value was not a valid enum variant.

Source code in unkey/models/base.py
@classmethod\ndef from_str_maybe(cls: t.Type[T], value: str) -> t.Optional[T]:\n\"\"\"Attempt to generate this enum from the given value.\n    Args:\n        value: The value to generate from.\n    Returns:\n        The generated enum or `None` if the value was not a valid\n            enum variant.\n    \"\"\"\ntry:\nreturn cls(value)\nexcept ValueError:\nreturn None\n
"},{"location":"reference/models/#unkey.models.BaseModel","title":"BaseModel","text":"

The base model all library models inherit from.

Source code in unkey/models/base.py
@attrs.define(weakref_slot=False)\nclass BaseModel:\n\"\"\"The base model all library models inherit from.\"\"\"\ndef to_dict(self) -> t.Dict[str, t.Any]:\n\"\"\"Converts this class into a dictionary.\n        Returns:\n            The requested dictionary.\n        \"\"\"\nreturn attrs.asdict(self)\n
"},{"location":"reference/models/#unkey.models.base.BaseModel.to_dict","title":"to_dict","text":"
to_dict() -> t.Dict[str, t.Any]\n

Converts this class into a dictionary.

Returns:

Type Description t.Dict[str, t.Any]

The requested dictionary.

Source code in unkey/models/base.py
def to_dict(self) -> t.Dict[str, t.Any]:\n\"\"\"Converts this class into a dictionary.\n    Returns:\n        The requested dictionary.\n    \"\"\"\nreturn attrs.asdict(self)\n
"},{"location":"reference/models/#unkey.models.HttpResponse","title":"HttpResponse","text":"

Bases: BaseModel

Directly represents a response from the api.

Could indicate either success or failure.

Source code in unkey/models/http.py
@attrs.define(weakref_slot=False)\nclass HttpResponse(BaseModel):\n\"\"\"Directly represents a response from the api.\n    Could indicate either success or failure.\n    \"\"\"\nstatus: int\n\"\"\"The HTTP status code.\"\"\"\nmessage: str\n\"\"\"The error or success message.\"\"\"\ncode: t.Optional[ErrorCode] = None\n\"\"\"The optional error code returned by the unkey api.\"\"\"\n
"},{"location":"reference/models/#unkey.models.http.HttpResponse.code","title":"code class-attribute instance-attribute","text":"
code: t.Optional[ErrorCode] = None\n

The optional error code returned by the unkey api.

"},{"location":"reference/models/#unkey.models.http.HttpResponse.message","title":"message instance-attribute","text":"
message: str\n

The error or success message.

"},{"location":"reference/models/#unkey.models.http.HttpResponse.status","title":"status instance-attribute","text":"
status: int\n

The HTTP status code.

"},{"location":"reference/models/#unkey.models.Ratelimit","title":"Ratelimit","text":"

Bases: BaseModel

Data representing a particular ratelimit.

Source code in unkey/models/keys.py
@attrs.define(weakref_slot=False)\nclass Ratelimit(BaseModel):\n\"\"\"Data representing a particular ratelimit.\"\"\"\ntype: RatelimitType\n\"\"\"The type of ratelimiting to implement.\"\"\"\nlimit: int\n\"\"\"The total amount of burstable requests.\"\"\"\nrefill_rate: int\n\"\"\"How many tokens to refill during each refill interval.\"\"\"\nrefill_interval: int\n\"\"\"The speed at which tokens are refilled.\"\"\"\n
"},{"location":"reference/models/#unkey.models.keys.Ratelimit.limit","title":"limit instance-attribute","text":"
limit: int\n

The total amount of burstable requests.

"},{"location":"reference/models/#unkey.models.keys.Ratelimit.refill_interval","title":"refill_interval instance-attribute","text":"
refill_interval: int\n

The speed at which tokens are refilled.

"},{"location":"reference/models/#unkey.models.keys.Ratelimit.refill_rate","title":"refill_rate instance-attribute","text":"
refill_rate: int\n

How many tokens to refill during each refill interval.

"},{"location":"reference/models/#unkey.models.keys.Ratelimit.type","title":"type instance-attribute","text":"
type: RatelimitType\n

The type of ratelimiting to implement.

"},{"location":"reference/result/","title":"result","text":""},{"location":"reference/result/#unkey.result.Result","title":"Result","text":"

Bases: t.Generic[T, E], abc.ABC

Represents a potential Ok or Err result.

Note

This class can not be instantiated, only its variants can.

Source code in unkey/result.py
class Result(t.Generic[T, E], abc.ABC):\n\"\"\"Represents a potential `Ok` or `Err` result.\n    Note:\n        This class can not be instantiated, only its variants can.\n    \"\"\"\n__slots__ = (\"_error\", \"_value\")\ndef __repr__(self) -> str:\ninner = self._value if self.is_ok else self._error  # type: ignore [attr-defined]\nreturn f\"{self.__class__.__name__}({inner})\"\n@property\n@abc.abstractmethod\ndef is_ok(self) -> bool:\n\"\"\"`True` if this result is the `Ok` variant.\"\"\"\n@property\n@abc.abstractmethod\ndef is_err(self) -> bool:\n\"\"\"`True` if this result is the `Err` variant.\"\"\"\n@abc.abstractmethod\ndef unwrap(self) -> T:\n\"\"\"Unwraps the result to produce the value.\n        Returns:\n            The unwrapped value.\n        Raises:\n            UnwrapError: If the result was an `Err` and not `Ok`.\n        \"\"\"\n@abc.abstractmethod\ndef unwrap_err(self) -> E:\n\"\"\"Unwraps the result to produce the error.\n        Returns:\n            The unwrapped error.\n        Raises:\n            UnwrapError: If the result was `Ok` and not an `Err`.\n        \"\"\"\n
"},{"location":"reference/result/#unkey.result.Result.is_err","title":"is_err abstractmethod property","text":"
is_err: bool\n

True if this result is the Err variant.

"},{"location":"reference/result/#unkey.result.Result.is_ok","title":"is_ok abstractmethod property","text":"
is_ok: bool\n

True if this result is the Ok variant.

"},{"location":"reference/result/#unkey.result.Result.unwrap","title":"unwrap abstractmethod","text":"
unwrap() -> T\n

Unwraps the result to produce the value.

Returns:

Type Description T

The unwrapped value.

Raises:

Type Description UnwrapError

If the result was an Err and not Ok.

Source code in unkey/result.py
@abc.abstractmethod\ndef unwrap(self) -> T:\n\"\"\"Unwraps the result to produce the value.\n    Returns:\n        The unwrapped value.\n    Raises:\n        UnwrapError: If the result was an `Err` and not `Ok`.\n    \"\"\"\n
"},{"location":"reference/result/#unkey.result.Result.unwrap_err","title":"unwrap_err abstractmethod","text":"
unwrap_err() -> E\n

Unwraps the result to produce the error.

Returns:

Type Description E

The unwrapped error.

Raises:

Type Description UnwrapError

If the result was Ok and not an Err.

Source code in unkey/result.py
@abc.abstractmethod\ndef unwrap_err(self) -> E:\n\"\"\"Unwraps the result to produce the error.\n    Returns:\n        The unwrapped error.\n    Raises:\n        UnwrapError: If the result was `Ok` and not an `Err`.\n    \"\"\"\n
"},{"location":"reference/routes/","title":"routes","text":""},{"location":"reference/routes/#unkey.routes.CompiledRoute","title":"CompiledRoute","text":"

A route that has been compiled to include uri variables.

Parameters:

Name Type Description Default route Route

The route itself.

required uri str

The endpoint for this route.

required Source code in unkey/routes.py
@attrs.define(weakref_slot=False)\nclass CompiledRoute:\n\"\"\"A route that has been compiled to include uri variables.\n    Args:\n        route: The route itself.\n        uri: The endpoint for this route.\n    \"\"\"\nroute: Route\n\"\"\"The route itself.\"\"\"\nuri: str\n\"\"\"The routes uri endpoint.\"\"\"\nparams: t.Dict[str, t.Union[str, int]] = attrs.field(init=False)\n\"\"\"The query params for the route.\"\"\"\ndef __init__(self, route: Route, uri: str) -> None:\nself.route = route\nself.uri = uri\nself.params = {}\n@property\ndef method(self) -> str:\n\"\"\"The routes method, i.e. GET, POST...\"\"\"\nreturn self.route.method\ndef with_params(self, params: t.Dict[str, t.Any]) -> CompiledRoute:\n\"\"\"Adds additional query params to this compiled route.\n        Args:\n            params: The query params to compile.\n        Returns:\n            The compiled route for chained calls.\n        \"\"\"\nif params:\nself.params.update(params)\nreturn self\n
"},{"location":"reference/routes/#unkey.routes.CompiledRoute.method","title":"method property","text":"
method: str\n

The routes method, i.e. GET, POST...

"},{"location":"reference/routes/#unkey.routes.CompiledRoute.params","title":"params class-attribute instance-attribute","text":"
params: t.Dict[str, t.Union[str, int]] = {}\n

The query params for the route.

"},{"location":"reference/routes/#unkey.routes.CompiledRoute.route","title":"route instance-attribute","text":"
route: Route = route\n

The route itself.

"},{"location":"reference/routes/#unkey.routes.CompiledRoute.uri","title":"uri instance-attribute","text":"
uri: str = uri\n

The routes uri endpoint.

"},{"location":"reference/routes/#unkey.routes.CompiledRoute.with_params","title":"with_params","text":"
with_params(params: t.Dict[str, t.Any]) -> CompiledRoute\n

Adds additional query params to this compiled route.

Parameters:

Name Type Description Default params t.Dict[str, t.Any]

The query params to compile.

required

Returns:

Type Description CompiledRoute

The compiled route for chained calls.

Source code in unkey/routes.py
def with_params(self, params: t.Dict[str, t.Any]) -> CompiledRoute:\n\"\"\"Adds additional query params to this compiled route.\n    Args:\n        params: The query params to compile.\n    Returns:\n        The compiled route for chained calls.\n    \"\"\"\nif params:\nself.params.update(params)\nreturn self\n
"},{"location":"reference/routes/#unkey.routes.Route","title":"Route","text":"

A route that has not been compiled yet.

Source code in unkey/routes.py
@attrs.define(weakref_slot=False)\nclass Route:\n\"\"\"A route that has not been compiled yet.\"\"\"\nmethod: str\n\"\"\"The request method to use.\"\"\"\nuri: str\n\"\"\"The request uri.\"\"\"\ndef compile(self, *args: t.Union[str, int]) -> CompiledRoute:\n\"\"\"Turn this route into a compiled route.\n        Args:\n            *args: The arguments to insert into the uri.\n        Returns:\n            The compiled route.\n        \"\"\"\ncompiled = CompiledRoute(self, self.uri)\nfor arg in args:\ncompiled.uri = compiled.uri.replace(r\"{}\", str(arg), 1)\nreturn compiled\n
"},{"location":"reference/routes/#unkey.routes.Route.method","title":"method instance-attribute","text":"
method: str\n

The request method to use.

"},{"location":"reference/routes/#unkey.routes.Route.uri","title":"uri instance-attribute","text":"
uri: str\n

The request uri.

"},{"location":"reference/routes/#unkey.routes.Route.compile","title":"compile","text":"
compile(*args: t.Union[str, int]) -> CompiledRoute\n

Turn this route into a compiled route.

Parameters:

Name Type Description Default *args t.Union[str, int]

The arguments to insert into the uri.

()

Returns:

Type Description CompiledRoute

The compiled route.

Source code in unkey/routes.py
def compile(self, *args: t.Union[str, int]) -> CompiledRoute:\n\"\"\"Turn this route into a compiled route.\n    Args:\n        *args: The arguments to insert into the uri.\n    Returns:\n        The compiled route.\n    \"\"\"\ncompiled = CompiledRoute(self, self.uri)\nfor arg in args:\ncompiled.uri = compiled.uri.replace(r\"{}\", str(arg), 1)\nreturn compiled\n
"},{"location":"reference/serializer/","title":"serializer","text":""},{"location":"reference/serializer/#unkey.serializer.Serializer","title":"Serializer","text":"

Deserializes JSON data into wom.py model classes.

Source code in unkey/serializer.py
class Serializer:\n\"\"\"Deserializes JSON data into wom.py model classes.\"\"\"\n__slots__ = ()\ndef _dt_from_iso(self, timestamp: str) -> datetime:\nreturn datetime.fromisoformat(timestamp.rstrip(\"Z\"))\ndef _dt_from_iso_maybe(self, timestamp: t.Optional[str]) -> t.Optional[datetime]:\nreturn self._dt_from_iso(timestamp) if timestamp else None\ndef to_camel_case(self, attr: str) -> str:\nfirst, *rest = attr.split(\"_\")\nreturn \"\".join((first.lower(), *map(str.title, rest)))\ndef _set_attrs(\nself,\nmodel: t.Any,\ndata: DictT,\n*attrs: str,\ntransform: TransformT = None,\ncamel_case: bool = False,\nmaybe: bool = False,\n) -> None:\nif transform and maybe:\nraise RuntimeError(\"Only one of 'maybe' and 'transform' may be used.\")\nfor attr in attrs:\ncased_attr = self.to_camel_case(attr) if camel_case else attr\nif transform:\nsetattr(\nmodel,\nattr,\ntransform(data.get(cased_attr, None) if maybe else data[cased_attr]),\n)\nelse:\nsetattr(model, attr, data.get(cased_attr, None) if maybe else data[cased_attr])\ndef _set_attrs_cased(\nself,\nmodel: t.Any,\ndata: DictT,\n*attrs: str,\ntransform: TransformT = None,\nmaybe: bool = False,\n) -> None:\nself._set_attrs(model, data, *attrs, transform=transform, camel_case=True, maybe=maybe)\ndef to_api_key(self, data: DictT) -> models.ApiKey:\nmodel = models.ApiKey()\nself._set_attrs_cased(model, data, \"key\", \"key_id\")\nreturn model\ndef to_api_key_verification(self, data: DictT) -> models.ApiKeyVerification:\nmodel = models.ApiKeyVerification()\nmodel.code = models.ErrorCode.from_str_maybe(data.get(\"code\", \"\"))\nself._set_attrs_cased(\nmodel, data, \"valid\", \"owner_id\", \"meta\", \"remaining\", \"error\", maybe=True\n)\nreturn model\ndef to_api(self, data: DictT) -> models.Api:\nmodel = models.Api()\nself._set_attrs_cased(model, data, \"id\", \"name\", \"workspace_id\")\nreturn model\ndef to_ratelimit(self, data: DictT) -> models.Ratelimit:\nreturn models.Ratelimit(\nlimit=data[\"limit\"],\nrefill_rate=data[\"refillRate\"],\nrefill_interval=data[\"refillInterval\"],\ntype=models.RatelimitType.from_str(data[\"type\"]),\n)\ndef to_api_key_meta(self, data: DictT) -> models.ApiKeyMeta:\nmodel = models.ApiKeyMeta()\nratelimit = data.get(\"ratelimit\")\nmodel.ratelimit = self.to_ratelimit(ratelimit) if ratelimit else ratelimit\nself._set_attrs_cased(\nmodel,\ndata,\n\"id\",\n\"meta\",\n\"start\",\n\"api_id\",\n\"expires\",\n\"remaining\",\n\"owner_id\",\n\"created_at\",\n\"workspace_id\",\nmaybe=True,\n)\nreturn model\ndef to_api_key_list(self, data: DictT) -> models.ApiKeyList:\nmodel = models.ApiKeyList()\nmodel.total = data[\"total\"]\nmodel.keys = [self.to_api_key_meta(key) for key in data[\"keys\"]]\nreturn model\n
"},{"location":"reference/services/","title":"services","text":""},{"location":"reference/services/#unkey.services.ApiService","title":"ApiService","text":"

Bases: BaseService

Handles api related requests.

Source code in unkey/services/apis.py
class ApiService(BaseService):\n\"\"\"Handles api related requests.\"\"\"\n__slots__ = ()\nasync def get_api(self, api_id: str) -> ResultT[models.Api]:\n\"\"\"Gets information about an api.\n        Args:\n            api_id: The id of the api.\n        Returns:\n            A result containing the requested information or an error.\n        \"\"\"\nroute = routes.GET_API.compile(api_id)\ndata = await self._http.fetch(route)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nif \"error\" in data:\nreturn result.Err(\nmodels.HttpResponse(\n404,\ndata[\"error\"],\nmodels.ErrorCode.from_str_maybe(data.get(\"code\", \"unknown\")),\n)\n)\nreturn result.Ok(self._serializer.to_api(data))\nasync def list_keys(\nself,\napi_id: str,\n*,\nowner_id: UndefinedOr[str] = UNDEFINED,\nlimit: int = 100,\noffset: int = 0,\n) -> ResultT[models.ApiKeyList]:\n\"\"\"Gets a paginated list of keys for the given api.\n        Args:\n            api_id: The id of the api.\n        Keyword Args:\n            owner_id: The optional owner id to list the keys for.\n            limit: The max number of keys to include in this page.\n                Defaults to 100.\n            offset: How many keys to offset by, for pagination.\n        Returns:\n            A result containing api key list or an error.\n        \"\"\"\nparams = self._generate_map(ownerId=owner_id, limit=limit, offset=offset)\nroute = routes.GET_KEYS.compile(api_id).with_params(params)\ndata = await self._http.fetch(route)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nif \"error\" in data:\nreturn result.Err(\nmodels.HttpResponse(\n404,\ndata[\"error\"],\nmodels.ErrorCode.from_str_maybe(data.get(\"code\", \"unknown\")),\n)\n)\nreturn result.Ok(self._serializer.to_api_key_list(data))\n
"},{"location":"reference/services/#unkey.services.apis.ApiService.get_api","title":"get_api async","text":"
get_api(api_id: str) -> ResultT[models.Api]\n

Gets information about an api.

Parameters:

Name Type Description Default api_id str

The id of the api.

required

Returns:

Type Description ResultT[models.Api]

A result containing the requested information or an error.

Source code in unkey/services/apis.py
async def get_api(self, api_id: str) -> ResultT[models.Api]:\n\"\"\"Gets information about an api.\n    Args:\n        api_id: The id of the api.\n    Returns:\n        A result containing the requested information or an error.\n    \"\"\"\nroute = routes.GET_API.compile(api_id)\ndata = await self._http.fetch(route)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nif \"error\" in data:\nreturn result.Err(\nmodels.HttpResponse(\n404,\ndata[\"error\"],\nmodels.ErrorCode.from_str_maybe(data.get(\"code\", \"unknown\")),\n)\n)\nreturn result.Ok(self._serializer.to_api(data))\n
"},{"location":"reference/services/#unkey.services.apis.ApiService.list_keys","title":"list_keys async","text":"
list_keys(\napi_id: str,\n*,\nowner_id: UndefinedOr[str] = UNDEFINED,\nlimit: int = 100,\noffset: int = 0\n) -> ResultT[models.ApiKeyList]\n

Gets a paginated list of keys for the given api.

Parameters:

Name Type Description Default api_id str

The id of the api.

required

Other Parameters:

Name Type Description owner_id UndefinedOr[str]

The optional owner id to list the keys for.

limit int

The max number of keys to include in this page. Defaults to 100.

offset int

How many keys to offset by, for pagination.

Returns:

Type Description ResultT[models.ApiKeyList]

A result containing api key list or an error.

Source code in unkey/services/apis.py
async def list_keys(\nself,\napi_id: str,\n*,\nowner_id: UndefinedOr[str] = UNDEFINED,\nlimit: int = 100,\noffset: int = 0,\n) -> ResultT[models.ApiKeyList]:\n\"\"\"Gets a paginated list of keys for the given api.\n    Args:\n        api_id: The id of the api.\n    Keyword Args:\n        owner_id: The optional owner id to list the keys for.\n        limit: The max number of keys to include in this page.\n            Defaults to 100.\n        offset: How many keys to offset by, for pagination.\n    Returns:\n        A result containing api key list or an error.\n    \"\"\"\nparams = self._generate_map(ownerId=owner_id, limit=limit, offset=offset)\nroute = routes.GET_KEYS.compile(api_id).with_params(params)\ndata = await self._http.fetch(route)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nif \"error\" in data:\nreturn result.Err(\nmodels.HttpResponse(\n404,\ndata[\"error\"],\nmodels.ErrorCode.from_str_maybe(data.get(\"code\", \"unknown\")),\n)\n)\nreturn result.Ok(self._serializer.to_api_key_list(data))\n
"},{"location":"reference/services/#unkey.services.BaseService","title":"BaseService","text":"

Bases: abc.ABC

The base service all API services inherit from.

Parameters:

Name Type Description Default http_service HttpService

The http service to use for requests.

required serializer serializer.Serializer

The serializer to use for handling incoming JSON data from the API.

required Source code in unkey/services/base.py
class BaseService(abc.ABC):\n\"\"\"The base service all API services inherit from.\n    Args:\n        http_service: The http service to use for requests.\n        serializer: The serializer to use for handling incoming\n            JSON data from the API.\n    \"\"\"\n__slots__ = (\"_http\", \"_serializer\")\ndef __init__(self, http_service: HttpService, serializer: serializer.Serializer) -> None:\nself._http = http_service\nself._serializer = serializer\ndef _generate_map(self, **kwargs: t.Any) -> t.Dict[str, t.Any]:\nreturn {k: v for k, v in kwargs.items() if v is not undefined.UNDEFINED}\ndef _expires_in(\nself, *, milliseconds: int = 0, seconds: int = 0, minutes: int = 0, days: int = 0\n) -> undefined.UndefinedOr[int]:\nif not any({milliseconds, seconds, minutes, days}):\nreturn undefined.UNDEFINED\ndelta = timedelta(days=days, minutes=minutes, seconds=seconds, milliseconds=milliseconds)\nreturn int((datetime.now() + delta).timestamp()) * 1000\n
"},{"location":"reference/services/#unkey.services.HttpService","title":"HttpService","text":"

The HTTP service used to make requests to the unkey API.

Parameters:

Name Type Description Default api_key str

The api key to use.

required api_version t.Optional[int]

The optional version of the api to use.

required api_base_url t.Optional[str]

The optional api base url to use.

required Source code in unkey/services/http.py
class HttpService:\n\"\"\"The HTTP service used to make requests to the unkey API.\n    Args:\n        api_key: The api key to use.\n        api_version: The optional version of the api to use.\n        api_base_url: The optional api base url to use.\n    \"\"\"\n__slots__ = (\n\"_api_version\",\n\"_base_url\",\n\"_headers\",\n\"_ok_responses\",\n\"_method_mapping\",\n\"_session\",\n)\ndef __init__(\nself,\napi_key: str,\napi_version: t.Optional[int],\napi_base_url: t.Optional[str],\n) -> None:\nif not api_key:\nraise ValueError(\"Api key must be provided.\")\nself._headers = {\n\"x-user-agent\": constants.USER_AGENT,\n\"Authorization\": f\"Bearer {api_key}\",\n}\nself._ok_responses = {200, 202}\nself._api_version = f\"/v{api_version or 1}\"\nself._base_url = api_base_url or constants.API_BASE_URL\nasync def _try_get_json(self, response: aiohttp.ClientResponse) -> t.Any:\ntry:\nreturn await response.json()\nexcept Exception:\nif response.status not in self._ok_responses:\nreturn models.HttpResponse(response.status, await response.text())\nreturn await response.text()\nasync def _request(\nself, req: t.Callable[..., t.Awaitable[t.Any]], url: str, **kwargs: t.Any\n) -> t.Any:\nresponse = await req(url, **kwargs)\ndata = await self._try_get_json(response)\nif isinstance(data, models.HttpResponse):\nreturn data\n# Skipping 404's seems hacky but whatever\nif response.status not in (*self._ok_responses, 404):\nreturn models.HttpResponse(\nresponse.status,\ndata.get(\"error\")\nor data.get(\"message\")\nor \"An unexpected error occurred while making the request.\",\n)\nreturn data\ndef _get_request_func(self, method: str) -> t.Callable[..., t.Awaitable[t.Any]]:\nif not hasattr(self, \"_method_mapping\"):\nraise RuntimeError(\"HttpService.start was never called, aborting...\")\nreturn self._method_mapping[method]  # type: ignore\nasync def _init_session(self) -> None:\nself._session = aiohttp.ClientSession()\nself._method_mapping = {\nconstants.GET: self._session.get,\nconstants.PUT: self._session.put,\nconstants.POST: self._session.post,\nconstants.PATCH: self._session.patch,\nconstants.DELETE: self._session.delete,\n}\ndef set_api_key(self, api_key: str) -> None:\n\"\"\"Sets the api key used by the http service.\n        Args:\n            api_key: The new api key to use.\n        \"\"\"\nself._headers[\"x-api-key\"] = api_key\ndef set_base_url(self, base_url: str) -> None:\n\"\"\"Sets the api base url used by the http service.\n        Args:\n            base_url: The new base url to use.\n        \"\"\"\nself._base_url = base_url\nasync def start(self) -> None:\n\"\"\"Starts the client session to be used by the http service.\"\"\"\nif not hasattr(self, \"_session\") or self._session.closed:\nawait self._init_session()\nasync def close(self) -> None:\n\"\"\"Closes the existing client session, if it's still open.\"\"\"\nif hasattr(self, \"_session\") and not self._session.closed:\nawait self._session.close()\nasync def fetch(\nself,\nroute: routes.CompiledRoute,\n*,\npayload: t.Optional[t.Dict[str, t.Any]] = None,\n) -> dict[str, t.Any] | models.HttpResponse:\n\"\"\"Fetches the given route.\n        Args:\n            route: The route to make the request to.\n            payload: The optional payload to send in the request body.\n        Returns:\n            The requested json data or the error response.\n        \"\"\"\nreturn await self._request(  # type: ignore[no-any-return]\nself._get_request_func(route.method),\nself._base_url + self._api_version + route.uri,\nheaders=self._headers,\nparams=route.params,\njson=payload or None,\n)\n
"},{"location":"reference/services/#unkey.services.http.HttpService.close","title":"close async","text":"
close() -> None\n

Closes the existing client session, if it's still open.

Source code in unkey/services/http.py
async def close(self) -> None:\n\"\"\"Closes the existing client session, if it's still open.\"\"\"\nif hasattr(self, \"_session\") and not self._session.closed:\nawait self._session.close()\n
"},{"location":"reference/services/#unkey.services.http.HttpService.fetch","title":"fetch async","text":"
fetch(\nroute: routes.CompiledRoute,\n*,\npayload: t.Optional[t.Dict[str, t.Any]] = None\n) -> dict[str, t.Any] | models.HttpResponse\n

Fetches the given route.

Parameters:

Name Type Description Default route routes.CompiledRoute

The route to make the request to.

required payload t.Optional[t.Dict[str, t.Any]]

The optional payload to send in the request body.

None

Returns:

Type Description dict[str, t.Any] | models.HttpResponse

The requested json data or the error response.

Source code in unkey/services/http.py
async def fetch(\nself,\nroute: routes.CompiledRoute,\n*,\npayload: t.Optional[t.Dict[str, t.Any]] = None,\n) -> dict[str, t.Any] | models.HttpResponse:\n\"\"\"Fetches the given route.\n    Args:\n        route: The route to make the request to.\n        payload: The optional payload to send in the request body.\n    Returns:\n        The requested json data or the error response.\n    \"\"\"\nreturn await self._request(  # type: ignore[no-any-return]\nself._get_request_func(route.method),\nself._base_url + self._api_version + route.uri,\nheaders=self._headers,\nparams=route.params,\njson=payload or None,\n)\n
"},{"location":"reference/services/#unkey.services.http.HttpService.set_api_key","title":"set_api_key","text":"
set_api_key(api_key: str) -> None\n

Sets the api key used by the http service.

Parameters:

Name Type Description Default api_key str

The new api key to use.

required Source code in unkey/services/http.py
def set_api_key(self, api_key: str) -> None:\n\"\"\"Sets the api key used by the http service.\n    Args:\n        api_key: The new api key to use.\n    \"\"\"\nself._headers[\"x-api-key\"] = api_key\n
"},{"location":"reference/services/#unkey.services.http.HttpService.set_base_url","title":"set_base_url","text":"
set_base_url(base_url: str) -> None\n

Sets the api base url used by the http service.

Parameters:

Name Type Description Default base_url str

The new base url to use.

required Source code in unkey/services/http.py
def set_base_url(self, base_url: str) -> None:\n\"\"\"Sets the api base url used by the http service.\n    Args:\n        base_url: The new base url to use.\n    \"\"\"\nself._base_url = base_url\n
"},{"location":"reference/services/#unkey.services.http.HttpService.start","title":"start async","text":"
start() -> None\n

Starts the client session to be used by the http service.

Source code in unkey/services/http.py
async def start(self) -> None:\n\"\"\"Starts the client session to be used by the http service.\"\"\"\nif not hasattr(self, \"_session\") or self._session.closed:\nawait self._init_session()\n
"},{"location":"reference/services/#unkey.services.KeyService","title":"KeyService","text":"

Bases: BaseService

Handles api key related requests.

Source code in unkey/services/keys.py
class KeyService(BaseService):\n\"\"\"Handles api key related requests.\"\"\"\n__slots__ = ()\nasync def create_key(\nself,\napi_id: str,\nowner_id: str,\nprefix: str,\n*,\nname: UndefinedOr[str] = UNDEFINED,\nbyte_length: UndefinedOr[int] = UNDEFINED,\nmeta: UndefinedOr[t.Dict[str, t.Any]] = UNDEFINED,\nexpires: UndefinedOr[int] = UNDEFINED,\nremaining: UndefinedOr[int] = UNDEFINED,\nratelimit: UndefinedOr[models.Ratelimit] = UNDEFINED,\n) -> ResultT[models.ApiKey]:\n\"\"\"Creates a new api key.\n        Args:\n            name: The name to use for this key.\n            api_id: The id of the api this key is for.\n            owner_id: The owner id to use for this key. Represents the\n                user who will use this key.\n            prefix: The prefix to place at the beginning of the key.\n        Keyword Args:\n            byte_length: The optional desired length of they in bytes.\n                Defaults to 16.\n            meta: An optional dynamic mapping of information used to\n                provide context around this keys user.\n            expires: The optional number of milliseconds into the future\n                when this key should expire.\n            remaining: The optional max number of times this key can be\n                used. Useful for creating long lived keys but with a\n                limit on total uses.\n            ratelimit: The optional Ratelimit to set on this key.\n        Returns:\n            A result containing the requested information or an error.\n        \"\"\"\nroute = routes.CREATE_KEY.compile()\npayload = self._generate_map(\nmeta=meta,\nname=name,\napiId=api_id,\nprefix=prefix,\nownerId=owner_id,\nremaining=remaining,\nbyteLength=byte_length,\nexpires=self._expires_in(milliseconds=expires or 0),\nratelimit=None\nif not ratelimit\nelse self._generate_map(\nlimit=ratelimit.limit,\ntype=ratelimit.type.value,\nrefillRate=ratelimit.refill_rate,\nrefillInterval=ratelimit.refill_interval,\n),\n)\ndata = await self._http.fetch(route, payload=payload)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nreturn result.Ok(self._serializer.to_api_key(data))\nasync def verify_key(self, key: str) -> ResultT[models.ApiKeyVerification]:\n\"\"\"Verifies a key is valid and within ratelimit.\n        Args:\n            key: The key to verify.\n        Returns:\n            A result containing the api key verification or an error.\n        \"\"\"\nroute = routes.VERIFY_KEY.compile()\npayload = self._generate_map(key=key)\ndata = await self._http.fetch(route, payload=payload)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nreturn result.Ok(self._serializer.to_api_key_verification(data))\nasync def revoke_key(self, key_id: str) -> ResultT[models.HttpResponse]:\n\"\"\"Revokes a keys validity.\n        Args:\n            key_id: The id of the key to revoke.\n        Returns:\n            A result containing the http response or an error.\n        \"\"\"\nroute = routes.REVOKE_KEY.compile(key_id)\ndata = await self._http.fetch(route)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nif \"error\" in data:\nreturn result.Err(\nmodels.HttpResponse(\n404,\ndata[\"error\"],\nmodels.ErrorCode.from_str_maybe(data.get(\"code\", \"unknown\")),\n)\n)\nreturn result.Ok(models.HttpResponse(200, \"OK\"))\nasync def update_key(\nself,\nkey_id: str,\n*,\nname: UndefinedNoneOr[str] = UNDEFINED,\nowner_id: UndefinedNoneOr[str] = UNDEFINED,\nmeta: UndefinedNoneOr[t.Dict[str, t.Any]] = UNDEFINED,\nexpires: UndefinedNoneOr[int] = UNDEFINED,\nremaining: UndefinedNoneOr[int] = UNDEFINED,\nratelimit: UndefinedNoneOr[models.Ratelimit] = UNDEFINED,\n) -> ResultT[models.HttpResponse]:\n\"\"\"Updates an existing api key. To delete a key set its value\n        to `None`.\n        Args:\n            key_id: The id of the key to update.\n        Keyword Args:\n            name: The new name to use for this key.\n            owner_id: The new owner id to use for this key.\n            meta: The new dynamic mapping of information used\n                to provide context around this keys user.\n            expires: The new number of milliseconds into the future\n                when this key should expire.\n            remaining: The new max number of times this key can be\n                used.\n            ratelimit: The new Ratelimit to set on this key.\n        Returns:\n            A result containing the OK response or an error.\n        \"\"\"\nif all_undefined(name, owner_id, meta, expires, remaining, ratelimit):\nraise errors.MissingRequiredArgument(\"At least one value is required to be updated.\")\nroute = routes.UPDATE_KEY.compile(key_id)\npayload = self._generate_map(\nname=name,\nmeta=meta,\nkeyId=key_id,\nownerId=owner_id,\nremaining=remaining,\nratelimit=ratelimit,\nexpires=self._expires_in(milliseconds=expires or 0)\nif expires is not None\nelse expires,\n)\ndata = await self._http.fetch(route, payload=payload)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nreturn result.Ok(models.HttpResponse(200, \"OK\"))\n
"},{"location":"reference/services/#unkey.services.keys.KeyService.create_key","title":"create_key async","text":"
create_key(\napi_id: str,\nowner_id: str,\nprefix: str,\n*,\nname: UndefinedOr[str] = UNDEFINED,\nbyte_length: UndefinedOr[int] = UNDEFINED,\nmeta: UndefinedOr[t.Dict[str, t.Any]] = UNDEFINED,\nexpires: UndefinedOr[int] = UNDEFINED,\nremaining: UndefinedOr[int] = UNDEFINED,\nratelimit: UndefinedOr[models.Ratelimit] = UNDEFINED\n) -> ResultT[models.ApiKey]\n

Creates a new api key.

Parameters:

Name Type Description Default name UndefinedOr[str]

The name to use for this key.

UNDEFINED api_id str

The id of the api this key is for.

required owner_id str

The owner id to use for this key. Represents the user who will use this key.

required prefix str

The prefix to place at the beginning of the key.

required

Other Parameters:

Name Type Description byte_length UndefinedOr[int]

The optional desired length of they in bytes. Defaults to 16.

meta UndefinedOr[t.Dict[str, t.Any]]

An optional dynamic mapping of information used to provide context around this keys user.

expires UndefinedOr[int]

The optional number of milliseconds into the future when this key should expire.

remaining UndefinedOr[int]

The optional max number of times this key can be used. Useful for creating long lived keys but with a limit on total uses.

ratelimit UndefinedOr[models.Ratelimit]

The optional Ratelimit to set on this key.

Returns:

Type Description ResultT[models.ApiKey]

A result containing the requested information or an error.

Source code in unkey/services/keys.py
async def create_key(\nself,\napi_id: str,\nowner_id: str,\nprefix: str,\n*,\nname: UndefinedOr[str] = UNDEFINED,\nbyte_length: UndefinedOr[int] = UNDEFINED,\nmeta: UndefinedOr[t.Dict[str, t.Any]] = UNDEFINED,\nexpires: UndefinedOr[int] = UNDEFINED,\nremaining: UndefinedOr[int] = UNDEFINED,\nratelimit: UndefinedOr[models.Ratelimit] = UNDEFINED,\n) -> ResultT[models.ApiKey]:\n\"\"\"Creates a new api key.\n    Args:\n        name: The name to use for this key.\n        api_id: The id of the api this key is for.\n        owner_id: The owner id to use for this key. Represents the\n            user who will use this key.\n        prefix: The prefix to place at the beginning of the key.\n    Keyword Args:\n        byte_length: The optional desired length of they in bytes.\n            Defaults to 16.\n        meta: An optional dynamic mapping of information used to\n            provide context around this keys user.\n        expires: The optional number of milliseconds into the future\n            when this key should expire.\n        remaining: The optional max number of times this key can be\n            used. Useful for creating long lived keys but with a\n            limit on total uses.\n        ratelimit: The optional Ratelimit to set on this key.\n    Returns:\n        A result containing the requested information or an error.\n    \"\"\"\nroute = routes.CREATE_KEY.compile()\npayload = self._generate_map(\nmeta=meta,\nname=name,\napiId=api_id,\nprefix=prefix,\nownerId=owner_id,\nremaining=remaining,\nbyteLength=byte_length,\nexpires=self._expires_in(milliseconds=expires or 0),\nratelimit=None\nif not ratelimit\nelse self._generate_map(\nlimit=ratelimit.limit,\ntype=ratelimit.type.value,\nrefillRate=ratelimit.refill_rate,\nrefillInterval=ratelimit.refill_interval,\n),\n)\ndata = await self._http.fetch(route, payload=payload)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nreturn result.Ok(self._serializer.to_api_key(data))\n
"},{"location":"reference/services/#unkey.services.keys.KeyService.revoke_key","title":"revoke_key async","text":"
revoke_key(key_id: str) -> ResultT[models.HttpResponse]\n

Revokes a keys validity.

Parameters:

Name Type Description Default key_id str

The id of the key to revoke.

required

Returns:

Type Description ResultT[models.HttpResponse]

A result containing the http response or an error.

Source code in unkey/services/keys.py
async def revoke_key(self, key_id: str) -> ResultT[models.HttpResponse]:\n\"\"\"Revokes a keys validity.\n    Args:\n        key_id: The id of the key to revoke.\n    Returns:\n        A result containing the http response or an error.\n    \"\"\"\nroute = routes.REVOKE_KEY.compile(key_id)\ndata = await self._http.fetch(route)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nif \"error\" in data:\nreturn result.Err(\nmodels.HttpResponse(\n404,\ndata[\"error\"],\nmodels.ErrorCode.from_str_maybe(data.get(\"code\", \"unknown\")),\n)\n)\nreturn result.Ok(models.HttpResponse(200, \"OK\"))\n
"},{"location":"reference/services/#unkey.services.keys.KeyService.update_key","title":"update_key async","text":"
update_key(\nkey_id: str,\n*,\nname: UndefinedNoneOr[str] = UNDEFINED,\nowner_id: UndefinedNoneOr[str] = UNDEFINED,\nmeta: UndefinedNoneOr[t.Dict[str, t.Any]] = UNDEFINED,\nexpires: UndefinedNoneOr[int] = UNDEFINED,\nremaining: UndefinedNoneOr[int] = UNDEFINED,\nratelimit: UndefinedNoneOr[models.Ratelimit] = UNDEFINED\n) -> ResultT[models.HttpResponse]\n

Updates an existing api key. To delete a key set its value to None.

Parameters:

Name Type Description Default key_id str

The id of the key to update.

required

Other Parameters:

Name Type Description name UndefinedNoneOr[str]

The new name to use for this key.

owner_id UndefinedNoneOr[str]

The new owner id to use for this key.

meta UndefinedNoneOr[t.Dict[str, t.Any]]

The new dynamic mapping of information used to provide context around this keys user.

expires UndefinedNoneOr[int]

The new number of milliseconds into the future when this key should expire.

remaining UndefinedNoneOr[int]

The new max number of times this key can be used.

ratelimit UndefinedNoneOr[models.Ratelimit]

The new Ratelimit to set on this key.

Returns:

Type Description ResultT[models.HttpResponse]

A result containing the OK response or an error.

Source code in unkey/services/keys.py
async def update_key(\nself,\nkey_id: str,\n*,\nname: UndefinedNoneOr[str] = UNDEFINED,\nowner_id: UndefinedNoneOr[str] = UNDEFINED,\nmeta: UndefinedNoneOr[t.Dict[str, t.Any]] = UNDEFINED,\nexpires: UndefinedNoneOr[int] = UNDEFINED,\nremaining: UndefinedNoneOr[int] = UNDEFINED,\nratelimit: UndefinedNoneOr[models.Ratelimit] = UNDEFINED,\n) -> ResultT[models.HttpResponse]:\n\"\"\"Updates an existing api key. To delete a key set its value\n    to `None`.\n    Args:\n        key_id: The id of the key to update.\n    Keyword Args:\n        name: The new name to use for this key.\n        owner_id: The new owner id to use for this key.\n        meta: The new dynamic mapping of information used\n            to provide context around this keys user.\n        expires: The new number of milliseconds into the future\n            when this key should expire.\n        remaining: The new max number of times this key can be\n            used.\n        ratelimit: The new Ratelimit to set on this key.\n    Returns:\n        A result containing the OK response or an error.\n    \"\"\"\nif all_undefined(name, owner_id, meta, expires, remaining, ratelimit):\nraise errors.MissingRequiredArgument(\"At least one value is required to be updated.\")\nroute = routes.UPDATE_KEY.compile(key_id)\npayload = self._generate_map(\nname=name,\nmeta=meta,\nkeyId=key_id,\nownerId=owner_id,\nremaining=remaining,\nratelimit=ratelimit,\nexpires=self._expires_in(milliseconds=expires or 0)\nif expires is not None\nelse expires,\n)\ndata = await self._http.fetch(route, payload=payload)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nreturn result.Ok(models.HttpResponse(200, \"OK\"))\n
"},{"location":"reference/services/#unkey.services.keys.KeyService.verify_key","title":"verify_key async","text":"
verify_key(key: str) -> ResultT[models.ApiKeyVerification]\n

Verifies a key is valid and within ratelimit.

Parameters:

Name Type Description Default key str

The key to verify.

required

Returns:

Type Description ResultT[models.ApiKeyVerification]

A result containing the api key verification or an error.

Source code in unkey/services/keys.py
async def verify_key(self, key: str) -> ResultT[models.ApiKeyVerification]:\n\"\"\"Verifies a key is valid and within ratelimit.\n    Args:\n        key: The key to verify.\n    Returns:\n        A result containing the api key verification or an error.\n    \"\"\"\nroute = routes.VERIFY_KEY.compile()\npayload = self._generate_map(key=key)\ndata = await self._http.fetch(route, payload=payload)\nif isinstance(data, models.HttpResponse):\nreturn result.Err(data)\nreturn result.Ok(self._serializer.to_api_key_verification(data))\n
"},{"location":"reference/undefined/","title":"undefined","text":""},{"location":"reference/undefined/#unkey.undefined.UNDEFINED","title":"UNDEFINED module-attribute","text":"
UNDEFINED = Undefined()\n

A value that does not exist.

"},{"location":"reference/undefined/#unkey.undefined.UndefinedNoneOr","title":"UndefinedNoneOr module-attribute","text":"
UndefinedNoneOr = UndefinedOr[t.Optional[T]]\n

A value that is undefined, none, or T

"},{"location":"reference/undefined/#unkey.undefined.UndefinedOr","title":"UndefinedOr module-attribute","text":"
UndefinedOr = t.Union[T, Undefined]\n

A value that is undefined or T

"},{"location":"reference/undefined/#unkey.undefined.Undefined","title":"Undefined","text":"

Represents an undefined value - without being None.

Source code in unkey/undefined.py
class Undefined:\n\"\"\"Represents an undefined value - without being None.\"\"\"\n__slots__ = ()\ndef __bool__(self) -> t.Literal[False]:\nreturn False\ndef __copy__(self) -> Undefined:\nreturn self\ndef __deepcopy__(self, memo: t.MutableMapping[int, t.Any]) -> Undefined:\nmemo[id(self)] = self\nreturn self\ndef __getstate__(self) -> t.Any:\nreturn False\ndef __repr__(self) -> str:\nreturn \"UNDEFINED\"\ndef __reduce__(self) -> str:\nreturn \"UNDEFINED\"\ndef __str__(self) -> str:\nreturn \"UNDEFINED\"\n
"},{"location":"reference/undefined/#unkey.undefined.all_undefined","title":"all_undefined","text":"
all_undefined(*values: t.Any) -> bool\n

Whether or not all values are undefined.

Parameters:

Name Type Description Default *values t.Any

The values to check.

()

Returns:

Type Description bool

True if all values were undefined.

Source code in unkey/undefined.py
def all_undefined(*values: t.Any) -> bool:\n\"\"\"Whether or not all values are undefined.\n    Arguments:\n        *values: The values to check.\n    Returns:\n        `True` if all values were undefined.\n    \"\"\"\nreturn all(v is UNDEFINED for v in values)\n
"},{"location":"reference/undefined/#unkey.undefined.any_undefined","title":"any_undefined","text":"
any_undefined(*values: t.Any) -> bool\n

Whether or not any values are undefined.

Parameters:

Name Type Description Default *values t.Any

The values to check.

()

Returns:

Type Description bool

True if any values were undefined.

Source code in unkey/undefined.py
def any_undefined(*values: t.Any) -> bool:\n\"\"\"Whether or not any values are undefined.\n    Arguments:\n        *values: The values to check.\n    Returns:\n        `True` if any values were undefined.\n    \"\"\"\nreturn any(v is UNDEFINED for v in values)\n
"}]} \ No newline at end of file diff --git a/v0.4.1/sitemap.xml b/v0.4.1/sitemap.xml new file mode 100644 index 0000000..8ef978f --- /dev/null +++ b/v0.4.1/sitemap.xml @@ -0,0 +1,78 @@ + + + + https://jonxslays.github.io/unkey.py/v0.4.1/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/changelog/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/contributing/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/license/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/getting-started/client/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/getting-started/installation/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/getting-started/result/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/client/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/errors/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/models/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/result/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/routes/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/serializer/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/services/ + 2023-08-16 + daily + + + https://jonxslays.github.io/unkey.py/v0.4.1/reference/undefined/ + 2023-08-16 + daily + + \ No newline at end of file diff --git a/v0.4.1/sitemap.xml.gz b/v0.4.1/sitemap.xml.gz new file mode 100644 index 0000000000000000000000000000000000000000..ab2cc40e23816b5940e178a7b30d2ec645d5ef79 GIT binary patch literal 339 zcmV-Z0j&NXiwFoSG~8qY|8r?{Wo=<_E_iKh0M(YkZo?o9hVOlfDEC0xO;b0e>1|K2 zJpfIdgpQidHf^(~A8D$s_h|>XU@Y_N!&ruDdpWr51jN?kCSR&D&j1_WTI@IZ``c@= z&bRfV3gj3hi^0g7d=NRlXnj7P6>g1oHkfMGfKwqBL1hoW2;%cmG}^WB9t zgTWp;g3r1&){T|E^UP%W2kozrv$XSlBDfxf>@G;W>oka+Z2%e4fbBu1%oZ$$1X|rV z3n*!_Ta1=-Mq-yp^8^GOTq4;g=zwAuhNNodml}vXacb0&0$g&`Y1TFQAdp