@unkey/api 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/README.md +4 -7
  2. package/RUNTIMES.md +6 -6
  3. package/bin/mcp-server.js +160 -68
  4. package/bin/mcp-server.js.map +53 -50
  5. package/dist/commonjs/funcs/apisCreateApi.js +1 -1
  6. package/dist/commonjs/funcs/apisCreateApi.js.map +1 -1
  7. package/dist/commonjs/funcs/apisDeleteApi.js +1 -1
  8. package/dist/commonjs/funcs/apisDeleteApi.js.map +1 -1
  9. package/dist/commonjs/funcs/apisGetApi.js +1 -1
  10. package/dist/commonjs/funcs/apisGetApi.js.map +1 -1
  11. package/dist/commonjs/funcs/apisListKeys.js +1 -1
  12. package/dist/commonjs/funcs/apisListKeys.js.map +1 -1
  13. package/dist/commonjs/funcs/identitiesCreateIdentity.js +1 -1
  14. package/dist/commonjs/funcs/identitiesCreateIdentity.js.map +1 -1
  15. package/dist/commonjs/funcs/identitiesDeleteIdentity.js +1 -1
  16. package/dist/commonjs/funcs/identitiesDeleteIdentity.js.map +1 -1
  17. package/dist/commonjs/funcs/identitiesGetIdentity.js +1 -1
  18. package/dist/commonjs/funcs/identitiesGetIdentity.js.map +1 -1
  19. package/dist/commonjs/funcs/identitiesListIdentities.js +4 -1
  20. package/dist/commonjs/funcs/identitiesListIdentities.js.map +1 -1
  21. package/dist/commonjs/funcs/identitiesUpdateIdentity.js +1 -1
  22. package/dist/commonjs/funcs/identitiesUpdateIdentity.js.map +1 -1
  23. package/dist/commonjs/funcs/keysAddPermissions.js +1 -1
  24. package/dist/commonjs/funcs/keysAddPermissions.js.map +1 -1
  25. package/dist/commonjs/funcs/keysAddRoles.js +1 -1
  26. package/dist/commonjs/funcs/keysAddRoles.js.map +1 -1
  27. package/dist/commonjs/funcs/keysCreateKey.js +1 -1
  28. package/dist/commonjs/funcs/keysCreateKey.js.map +1 -1
  29. package/dist/commonjs/funcs/keysDeleteKey.js +1 -1
  30. package/dist/commonjs/funcs/keysDeleteKey.js.map +1 -1
  31. package/dist/commonjs/funcs/keysGetKey.js +1 -1
  32. package/dist/commonjs/funcs/keysGetKey.js.map +1 -1
  33. package/dist/commonjs/funcs/keysRemovePermissions.js +1 -1
  34. package/dist/commonjs/funcs/keysRemovePermissions.js.map +1 -1
  35. package/dist/commonjs/funcs/keysRemoveRoles.js +1 -1
  36. package/dist/commonjs/funcs/keysRemoveRoles.js.map +1 -1
  37. package/dist/commonjs/funcs/keysRerollKey.js +1 -1
  38. package/dist/commonjs/funcs/keysRerollKey.js.map +1 -1
  39. package/dist/commonjs/funcs/keysSetPermissions.js +1 -1
  40. package/dist/commonjs/funcs/keysSetPermissions.js.map +1 -1
  41. package/dist/commonjs/funcs/keysSetRoles.js +1 -1
  42. package/dist/commonjs/funcs/keysSetRoles.js.map +1 -1
  43. package/dist/commonjs/funcs/keysUpdateCredits.js +1 -1
  44. package/dist/commonjs/funcs/keysUpdateCredits.js.map +1 -1
  45. package/dist/commonjs/funcs/keysUpdateKey.js +1 -1
  46. package/dist/commonjs/funcs/keysUpdateKey.js.map +1 -1
  47. package/dist/commonjs/funcs/keysVerifyKey.js +1 -1
  48. package/dist/commonjs/funcs/keysVerifyKey.js.map +1 -1
  49. package/dist/commonjs/funcs/keysWhoami.js +1 -1
  50. package/dist/commonjs/funcs/keysWhoami.js.map +1 -1
  51. package/dist/commonjs/funcs/permissionsCreatePermission.js +1 -1
  52. package/dist/commonjs/funcs/permissionsCreatePermission.js.map +1 -1
  53. package/dist/commonjs/funcs/permissionsCreateRole.js +1 -1
  54. package/dist/commonjs/funcs/permissionsCreateRole.js.map +1 -1
  55. package/dist/commonjs/funcs/permissionsDeletePermission.js +1 -1
  56. package/dist/commonjs/funcs/permissionsDeletePermission.js.map +1 -1
  57. package/dist/commonjs/funcs/permissionsDeleteRole.js +1 -1
  58. package/dist/commonjs/funcs/permissionsDeleteRole.js.map +1 -1
  59. package/dist/commonjs/funcs/permissionsGetPermission.js +1 -1
  60. package/dist/commonjs/funcs/permissionsGetPermission.js.map +1 -1
  61. package/dist/commonjs/funcs/permissionsGetRole.js +1 -1
  62. package/dist/commonjs/funcs/permissionsGetRole.js.map +1 -1
  63. package/dist/commonjs/funcs/permissionsListPermissions.js +1 -1
  64. package/dist/commonjs/funcs/permissionsListPermissions.js.map +1 -1
  65. package/dist/commonjs/funcs/permissionsListRoles.js +1 -1
  66. package/dist/commonjs/funcs/permissionsListRoles.js.map +1 -1
  67. package/dist/commonjs/funcs/ratelimitDeleteOverride.js +1 -1
  68. package/dist/commonjs/funcs/ratelimitDeleteOverride.js.map +1 -1
  69. package/dist/commonjs/funcs/ratelimitGetOverride.js +1 -1
  70. package/dist/commonjs/funcs/ratelimitGetOverride.js.map +1 -1
  71. package/dist/commonjs/funcs/ratelimitLimit.d.ts +2 -2
  72. package/dist/commonjs/funcs/ratelimitLimit.d.ts.map +1 -1
  73. package/dist/commonjs/funcs/ratelimitLimit.js +4 -4
  74. package/dist/commonjs/funcs/ratelimitLimit.js.map +1 -1
  75. package/dist/commonjs/funcs/ratelimitListOverrides.js +1 -1
  76. package/dist/commonjs/funcs/ratelimitListOverrides.js.map +1 -1
  77. package/dist/commonjs/funcs/ratelimitSetOverride.js +1 -1
  78. package/dist/commonjs/funcs/ratelimitSetOverride.js.map +1 -1
  79. package/dist/commonjs/lib/config.d.ts +3 -3
  80. package/dist/commonjs/lib/config.js +3 -3
  81. package/dist/commonjs/lib/config.js.map +1 -1
  82. package/dist/commonjs/lib/security.d.ts.map +1 -1
  83. package/dist/commonjs/lib/security.js.map +1 -1
  84. package/dist/commonjs/lib/url.js +1 -1
  85. package/dist/commonjs/lib/url.js.map +1 -1
  86. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  87. package/dist/commonjs/mcp-server/server.js +1 -1
  88. package/dist/commonjs/mcp-server/tools/ratelimitLimit.js +1 -1
  89. package/dist/commonjs/models/components/identity.d.ts +6 -26
  90. package/dist/commonjs/models/components/identity.d.ts.map +1 -1
  91. package/dist/commonjs/models/components/identity.js +3 -26
  92. package/dist/commonjs/models/components/identity.js.map +1 -1
  93. package/dist/commonjs/models/components/index.d.ts +2 -0
  94. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  95. package/dist/commonjs/models/components/index.js +2 -0
  96. package/dist/commonjs/models/components/index.js.map +1 -1
  97. package/dist/commonjs/models/components/keycreditsrefill.d.ts +8 -8
  98. package/dist/commonjs/models/components/keycreditsrefill.d.ts.map +1 -1
  99. package/dist/commonjs/models/components/keycreditsrefill.js +13 -14
  100. package/dist/commonjs/models/components/keycreditsrefill.js.map +1 -1
  101. package/dist/commonjs/models/components/updatekeycreditsdata.d.ts +41 -0
  102. package/dist/commonjs/models/components/updatekeycreditsdata.d.ts.map +1 -0
  103. package/dist/commonjs/models/components/updatekeycreditsdata.js +72 -0
  104. package/dist/commonjs/models/components/updatekeycreditsdata.js.map +1 -0
  105. package/dist/commonjs/models/components/updatekeycreditsrefill.d.ts +81 -0
  106. package/dist/commonjs/models/components/updatekeycreditsrefill.d.ts.map +1 -0
  107. package/dist/commonjs/models/components/updatekeycreditsrefill.js +95 -0
  108. package/dist/commonjs/models/components/updatekeycreditsrefill.js.map +1 -0
  109. package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.d.ts +3 -3
  110. package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.d.ts.map +1 -1
  111. package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.js +3 -3
  112. package/dist/commonjs/models/components/v2keysupdatekeyrequestbody.js.map +1 -1
  113. package/dist/commonjs/models/errors/goneerrorresponse.d.ts +72 -0
  114. package/dist/commonjs/models/errors/goneerrorresponse.d.ts.map +1 -0
  115. package/dist/commonjs/models/errors/goneerrorresponse.js +99 -0
  116. package/dist/commonjs/models/errors/goneerrorresponse.js.map +1 -0
  117. package/dist/commonjs/models/errors/index.d.ts +2 -0
  118. package/dist/commonjs/models/errors/index.d.ts.map +1 -1
  119. package/dist/commonjs/models/errors/index.js +2 -0
  120. package/dist/commonjs/models/errors/index.js.map +1 -1
  121. package/dist/commonjs/sdk/ratelimit.d.ts +1 -1
  122. package/dist/commonjs/sdk/ratelimit.js +1 -1
  123. package/dist/esm/funcs/apisCreateApi.js +1 -1
  124. package/dist/esm/funcs/apisCreateApi.js.map +1 -1
  125. package/dist/esm/funcs/apisDeleteApi.js +1 -1
  126. package/dist/esm/funcs/apisDeleteApi.js.map +1 -1
  127. package/dist/esm/funcs/apisGetApi.js +1 -1
  128. package/dist/esm/funcs/apisGetApi.js.map +1 -1
  129. package/dist/esm/funcs/apisListKeys.js +1 -1
  130. package/dist/esm/funcs/apisListKeys.js.map +1 -1
  131. package/dist/esm/funcs/identitiesCreateIdentity.js +1 -1
  132. package/dist/esm/funcs/identitiesCreateIdentity.js.map +1 -1
  133. package/dist/esm/funcs/identitiesDeleteIdentity.js +1 -1
  134. package/dist/esm/funcs/identitiesDeleteIdentity.js.map +1 -1
  135. package/dist/esm/funcs/identitiesGetIdentity.js +1 -1
  136. package/dist/esm/funcs/identitiesGetIdentity.js.map +1 -1
  137. package/dist/esm/funcs/identitiesListIdentities.js +4 -1
  138. package/dist/esm/funcs/identitiesListIdentities.js.map +1 -1
  139. package/dist/esm/funcs/identitiesUpdateIdentity.js +1 -1
  140. package/dist/esm/funcs/identitiesUpdateIdentity.js.map +1 -1
  141. package/dist/esm/funcs/keysAddPermissions.js +1 -1
  142. package/dist/esm/funcs/keysAddPermissions.js.map +1 -1
  143. package/dist/esm/funcs/keysAddRoles.js +1 -1
  144. package/dist/esm/funcs/keysAddRoles.js.map +1 -1
  145. package/dist/esm/funcs/keysCreateKey.js +1 -1
  146. package/dist/esm/funcs/keysCreateKey.js.map +1 -1
  147. package/dist/esm/funcs/keysDeleteKey.js +1 -1
  148. package/dist/esm/funcs/keysDeleteKey.js.map +1 -1
  149. package/dist/esm/funcs/keysGetKey.js +1 -1
  150. package/dist/esm/funcs/keysGetKey.js.map +1 -1
  151. package/dist/esm/funcs/keysRemovePermissions.js +1 -1
  152. package/dist/esm/funcs/keysRemovePermissions.js.map +1 -1
  153. package/dist/esm/funcs/keysRemoveRoles.js +1 -1
  154. package/dist/esm/funcs/keysRemoveRoles.js.map +1 -1
  155. package/dist/esm/funcs/keysRerollKey.js +1 -1
  156. package/dist/esm/funcs/keysRerollKey.js.map +1 -1
  157. package/dist/esm/funcs/keysSetPermissions.js +1 -1
  158. package/dist/esm/funcs/keysSetPermissions.js.map +1 -1
  159. package/dist/esm/funcs/keysSetRoles.js +1 -1
  160. package/dist/esm/funcs/keysSetRoles.js.map +1 -1
  161. package/dist/esm/funcs/keysUpdateCredits.js +1 -1
  162. package/dist/esm/funcs/keysUpdateCredits.js.map +1 -1
  163. package/dist/esm/funcs/keysUpdateKey.js +1 -1
  164. package/dist/esm/funcs/keysUpdateKey.js.map +1 -1
  165. package/dist/esm/funcs/keysVerifyKey.js +1 -1
  166. package/dist/esm/funcs/keysVerifyKey.js.map +1 -1
  167. package/dist/esm/funcs/keysWhoami.js +1 -1
  168. package/dist/esm/funcs/keysWhoami.js.map +1 -1
  169. package/dist/esm/funcs/permissionsCreatePermission.js +1 -1
  170. package/dist/esm/funcs/permissionsCreatePermission.js.map +1 -1
  171. package/dist/esm/funcs/permissionsCreateRole.js +1 -1
  172. package/dist/esm/funcs/permissionsCreateRole.js.map +1 -1
  173. package/dist/esm/funcs/permissionsDeletePermission.js +1 -1
  174. package/dist/esm/funcs/permissionsDeletePermission.js.map +1 -1
  175. package/dist/esm/funcs/permissionsDeleteRole.js +1 -1
  176. package/dist/esm/funcs/permissionsDeleteRole.js.map +1 -1
  177. package/dist/esm/funcs/permissionsGetPermission.js +1 -1
  178. package/dist/esm/funcs/permissionsGetPermission.js.map +1 -1
  179. package/dist/esm/funcs/permissionsGetRole.js +1 -1
  180. package/dist/esm/funcs/permissionsGetRole.js.map +1 -1
  181. package/dist/esm/funcs/permissionsListPermissions.js +1 -1
  182. package/dist/esm/funcs/permissionsListPermissions.js.map +1 -1
  183. package/dist/esm/funcs/permissionsListRoles.js +1 -1
  184. package/dist/esm/funcs/permissionsListRoles.js.map +1 -1
  185. package/dist/esm/funcs/ratelimitDeleteOverride.js +1 -1
  186. package/dist/esm/funcs/ratelimitDeleteOverride.js.map +1 -1
  187. package/dist/esm/funcs/ratelimitGetOverride.js +1 -1
  188. package/dist/esm/funcs/ratelimitGetOverride.js.map +1 -1
  189. package/dist/esm/funcs/ratelimitLimit.d.ts +2 -2
  190. package/dist/esm/funcs/ratelimitLimit.d.ts.map +1 -1
  191. package/dist/esm/funcs/ratelimitLimit.js +4 -4
  192. package/dist/esm/funcs/ratelimitLimit.js.map +1 -1
  193. package/dist/esm/funcs/ratelimitListOverrides.js +1 -1
  194. package/dist/esm/funcs/ratelimitListOverrides.js.map +1 -1
  195. package/dist/esm/funcs/ratelimitSetOverride.js +1 -1
  196. package/dist/esm/funcs/ratelimitSetOverride.js.map +1 -1
  197. package/dist/esm/lib/config.d.ts +3 -3
  198. package/dist/esm/lib/config.js +3 -3
  199. package/dist/esm/lib/config.js.map +1 -1
  200. package/dist/esm/lib/security.d.ts.map +1 -1
  201. package/dist/esm/lib/security.js.map +1 -1
  202. package/dist/esm/lib/url.js +1 -1
  203. package/dist/esm/lib/url.js.map +1 -1
  204. package/dist/esm/mcp-server/mcp-server.js +1 -1
  205. package/dist/esm/mcp-server/server.js +1 -1
  206. package/dist/esm/mcp-server/tools/ratelimitLimit.js +1 -1
  207. package/dist/esm/models/components/identity.d.ts +6 -26
  208. package/dist/esm/models/components/identity.d.ts.map +1 -1
  209. package/dist/esm/models/components/identity.js +2 -23
  210. package/dist/esm/models/components/identity.js.map +1 -1
  211. package/dist/esm/models/components/index.d.ts +2 -0
  212. package/dist/esm/models/components/index.d.ts.map +1 -1
  213. package/dist/esm/models/components/index.js +2 -0
  214. package/dist/esm/models/components/index.js.map +1 -1
  215. package/dist/esm/models/components/keycreditsrefill.d.ts +8 -8
  216. package/dist/esm/models/components/keycreditsrefill.d.ts.map +1 -1
  217. package/dist/esm/models/components/keycreditsrefill.js +12 -13
  218. package/dist/esm/models/components/keycreditsrefill.js.map +1 -1
  219. package/dist/esm/models/components/updatekeycreditsdata.d.ts +41 -0
  220. package/dist/esm/models/components/updatekeycreditsdata.d.ts.map +1 -0
  221. package/dist/esm/models/components/updatekeycreditsdata.js +34 -0
  222. package/dist/esm/models/components/updatekeycreditsdata.js.map +1 -0
  223. package/dist/esm/models/components/updatekeycreditsrefill.d.ts +81 -0
  224. package/dist/esm/models/components/updatekeycreditsrefill.d.ts.map +1 -0
  225. package/dist/esm/models/components/updatekeycreditsrefill.js +57 -0
  226. package/dist/esm/models/components/updatekeycreditsrefill.js.map +1 -0
  227. package/dist/esm/models/components/v2keysupdatekeyrequestbody.d.ts +3 -3
  228. package/dist/esm/models/components/v2keysupdatekeyrequestbody.d.ts.map +1 -1
  229. package/dist/esm/models/components/v2keysupdatekeyrequestbody.js +3 -3
  230. package/dist/esm/models/components/v2keysupdatekeyrequestbody.js.map +1 -1
  231. package/dist/esm/models/errors/goneerrorresponse.d.ts +72 -0
  232. package/dist/esm/models/errors/goneerrorresponse.d.ts.map +1 -0
  233. package/dist/esm/models/errors/goneerrorresponse.js +62 -0
  234. package/dist/esm/models/errors/goneerrorresponse.js.map +1 -0
  235. package/dist/esm/models/errors/index.d.ts +2 -0
  236. package/dist/esm/models/errors/index.d.ts.map +1 -1
  237. package/dist/esm/models/errors/index.js +2 -0
  238. package/dist/esm/models/errors/index.js.map +1 -1
  239. package/dist/esm/sdk/ratelimit.d.ts +1 -1
  240. package/dist/esm/sdk/ratelimit.js +1 -1
  241. package/docs/sdks/ratelimit/README.md +2 -1
  242. package/examples/apisCreateApi.example.ts +1 -1
  243. package/examples/package-lock.json +1 -1
  244. package/jsr.json +1 -1
  245. package/package.json +1 -1
  246. package/src/funcs/apisCreateApi.ts +1 -1
  247. package/src/funcs/apisDeleteApi.ts +1 -1
  248. package/src/funcs/apisGetApi.ts +1 -1
  249. package/src/funcs/apisListKeys.ts +1 -1
  250. package/src/funcs/identitiesCreateIdentity.ts +1 -1
  251. package/src/funcs/identitiesDeleteIdentity.ts +1 -1
  252. package/src/funcs/identitiesGetIdentity.ts +1 -1
  253. package/src/funcs/identitiesListIdentities.ts +4 -1
  254. package/src/funcs/identitiesUpdateIdentity.ts +1 -1
  255. package/src/funcs/keysAddPermissions.ts +1 -1
  256. package/src/funcs/keysAddRoles.ts +1 -1
  257. package/src/funcs/keysCreateKey.ts +1 -1
  258. package/src/funcs/keysDeleteKey.ts +1 -1
  259. package/src/funcs/keysGetKey.ts +1 -1
  260. package/src/funcs/keysRemovePermissions.ts +1 -1
  261. package/src/funcs/keysRemoveRoles.ts +1 -1
  262. package/src/funcs/keysRerollKey.ts +1 -1
  263. package/src/funcs/keysSetPermissions.ts +1 -1
  264. package/src/funcs/keysSetRoles.ts +1 -1
  265. package/src/funcs/keysUpdateCredits.ts +1 -1
  266. package/src/funcs/keysUpdateKey.ts +1 -1
  267. package/src/funcs/keysVerifyKey.ts +1 -1
  268. package/src/funcs/keysWhoami.ts +1 -1
  269. package/src/funcs/permissionsCreatePermission.ts +1 -1
  270. package/src/funcs/permissionsCreateRole.ts +1 -1
  271. package/src/funcs/permissionsDeletePermission.ts +1 -1
  272. package/src/funcs/permissionsDeleteRole.ts +1 -1
  273. package/src/funcs/permissionsGetPermission.ts +1 -1
  274. package/src/funcs/permissionsGetRole.ts +1 -1
  275. package/src/funcs/permissionsListPermissions.ts +1 -1
  276. package/src/funcs/permissionsListRoles.ts +1 -1
  277. package/src/funcs/ratelimitDeleteOverride.ts +1 -1
  278. package/src/funcs/ratelimitGetOverride.ts +1 -1
  279. package/src/funcs/ratelimitLimit.ts +7 -3
  280. package/src/funcs/ratelimitListOverrides.ts +1 -1
  281. package/src/funcs/ratelimitSetOverride.ts +1 -1
  282. package/src/lib/config.ts +3 -3
  283. package/src/lib/security.ts +4 -1
  284. package/src/lib/url.ts +1 -1
  285. package/src/mcp-server/mcp-server.ts +1 -1
  286. package/src/mcp-server/server.ts +1 -1
  287. package/src/mcp-server/tools/ratelimitLimit.ts +1 -1
  288. package/src/models/components/identity.ts +4 -53
  289. package/src/models/components/index.ts +2 -0
  290. package/src/models/components/keycreditsrefill.ts +18 -14
  291. package/src/models/components/updatekeycreditsdata.ts +85 -0
  292. package/src/models/components/updatekeycreditsrefill.ts +126 -0
  293. package/src/models/components/v2keysupdatekeyrequestbody.ts +10 -10
  294. package/src/models/errors/goneerrorresponse.ts +118 -0
  295. package/src/models/errors/index.ts +2 -0
  296. package/src/sdk/ratelimit.ts +1 -1
  297. package/docs/sdks/unkey/README.md +0 -82
@@ -117,7 +117,7 @@ async function $do(
117
117
  options: client._options,
118
118
  baseURL: options?.serverURL ?? client._baseURL ?? "",
119
119
  operationID: "deleteRole",
120
- oAuth2Scopes: [],
120
+ oAuth2Scopes: null,
121
121
 
122
122
  resolvedSecurity: requestSecurity,
123
123
 
@@ -119,7 +119,7 @@ async function $do(
119
119
  options: client._options,
120
120
  baseURL: options?.serverURL ?? client._baseURL ?? "",
121
121
  operationID: "getPermission",
122
- oAuth2Scopes: [],
122
+ oAuth2Scopes: null,
123
123
 
124
124
  resolvedSecurity: requestSecurity,
125
125
 
@@ -117,7 +117,7 @@ async function $do(
117
117
  options: client._options,
118
118
  baseURL: options?.serverURL ?? client._baseURL ?? "",
119
119
  operationID: "getRole",
120
- oAuth2Scopes: [],
120
+ oAuth2Scopes: null,
121
121
 
122
122
  resolvedSecurity: requestSecurity,
123
123
 
@@ -118,7 +118,7 @@ async function $do(
118
118
  options: client._options,
119
119
  baseURL: options?.serverURL ?? client._baseURL ?? "",
120
120
  operationID: "listPermissions",
121
- oAuth2Scopes: [],
121
+ oAuth2Scopes: null,
122
122
 
123
123
  resolvedSecurity: requestSecurity,
124
124
 
@@ -118,7 +118,7 @@ async function $do(
118
118
  options: client._options,
119
119
  baseURL: options?.serverURL ?? client._baseURL ?? "",
120
120
  operationID: "listRoles",
121
- oAuth2Scopes: [],
121
+ oAuth2Scopes: null,
122
122
 
123
123
  resolvedSecurity: requestSecurity,
124
124
 
@@ -120,7 +120,7 @@ async function $do(
120
120
  options: client._options,
121
121
  baseURL: options?.serverURL ?? client._baseURL ?? "",
122
122
  operationID: "ratelimit.deleteOverride",
123
- oAuth2Scopes: [],
123
+ oAuth2Scopes: null,
124
124
 
125
125
  resolvedSecurity: requestSecurity,
126
126
 
@@ -118,7 +118,7 @@ async function $do(
118
118
  options: client._options,
119
119
  baseURL: options?.serverURL ?? client._baseURL ?? "",
120
120
  operationID: "ratelimit.getOverride",
121
- oAuth2Scopes: [],
121
+ oAuth2Scopes: null,
122
122
 
123
123
  resolvedSecurity: requestSecurity,
124
124
 
@@ -33,7 +33,7 @@ import { Result } from "../types/fp.js";
33
33
  *
34
34
  * Use this for rate limiting beyond API keys - limit users by ID, IPs by address, or any custom identifier. Supports namespace organization, variable costs, and custom overrides.
35
35
  *
36
- * **Important**: Always returns HTTP 200. Check the `success` field to determine if the request should proceed.
36
+ * **Response Codes**: Rate limit checks return HTTP 200 regardless of whether the limit is exceeded - check the `success` field in the response to determine if the request should be allowed. 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors.
37
37
  *
38
38
  * **Required Permissions**
39
39
  *
@@ -56,6 +56,7 @@ export function ratelimitLimit(
56
56
  | errors.UnauthorizedErrorResponse
57
57
  | errors.ForbiddenErrorResponse
58
58
  | errors.NotFoundErrorResponse
59
+ | errors.GoneErrorResponse
59
60
  | errors.InternalServerErrorResponse
60
61
  | UnkeyError
61
62
  | ResponseValidationError
@@ -86,6 +87,7 @@ async function $do(
86
87
  | errors.UnauthorizedErrorResponse
87
88
  | errors.ForbiddenErrorResponse
88
89
  | errors.NotFoundErrorResponse
90
+ | errors.GoneErrorResponse
89
91
  | errors.InternalServerErrorResponse
90
92
  | UnkeyError
91
93
  | ResponseValidationError
@@ -126,7 +128,7 @@ async function $do(
126
128
  options: client._options,
127
129
  baseURL: options?.serverURL ?? client._baseURL ?? "",
128
130
  operationID: "ratelimit.limit",
129
- oAuth2Scopes: [],
131
+ oAuth2Scopes: null,
130
132
 
131
133
  resolvedSecurity: requestSecurity,
132
134
 
@@ -164,7 +166,7 @@ async function $do(
164
166
 
165
167
  const doResult = await client._do(req, {
166
168
  context,
167
- errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
169
+ errorCodes: ["400", "401", "403", "404", "410", "4XX", "500", "5XX"],
168
170
  retryConfig: context.retryConfig,
169
171
  retryCodes: context.retryCodes,
170
172
  });
@@ -183,6 +185,7 @@ async function $do(
183
185
  | errors.UnauthorizedErrorResponse
184
186
  | errors.ForbiddenErrorResponse
185
187
  | errors.NotFoundErrorResponse
188
+ | errors.GoneErrorResponse
186
189
  | errors.InternalServerErrorResponse
187
190
  | UnkeyError
188
191
  | ResponseValidationError
@@ -198,6 +201,7 @@ async function $do(
198
201
  M.jsonErr(401, errors.UnauthorizedErrorResponse$inboundSchema),
199
202
  M.jsonErr(403, errors.ForbiddenErrorResponse$inboundSchema),
200
203
  M.jsonErr(404, errors.NotFoundErrorResponse$inboundSchema),
204
+ M.jsonErr(410, errors.GoneErrorResponse$inboundSchema),
201
205
  M.jsonErr(500, errors.InternalServerErrorResponse$inboundSchema),
202
206
  M.fail("4XX"),
203
207
  M.fail("5XX"),
@@ -120,7 +120,7 @@ async function $do(
120
120
  options: client._options,
121
121
  baseURL: options?.serverURL ?? client._baseURL ?? "",
122
122
  operationID: "ratelimit.listOverrides",
123
- oAuth2Scopes: [],
123
+ oAuth2Scopes: null,
124
124
 
125
125
  resolvedSecurity: requestSecurity,
126
126
 
@@ -118,7 +118,7 @@ async function $do(
118
118
  options: client._options,
119
119
  baseURL: options?.serverURL ?? client._baseURL ?? "",
120
120
  operationID: "ratelimit.setOverride",
121
- oAuth2Scopes: [],
121
+ oAuth2Scopes: null,
122
122
 
123
123
  resolvedSecurity: requestSecurity,
124
124
 
package/src/lib/config.ts CHANGED
@@ -58,7 +58,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
58
58
  export const SDK_METADATA = {
59
59
  language: "typescript",
60
60
  openapiDocVersion: "2.0.0",
61
- sdkVersion: "2.0.4",
62
- genVersion: "2.683.1",
63
- userAgent: "speakeasy-sdk/typescript 2.0.4 2.683.1 2.0.0 @unkey/api",
61
+ sdkVersion: "2.0.6",
62
+ genVersion: "2.723.11",
63
+ userAgent: "speakeasy-sdk/typescript 2.0.6 2.723.11 2.0.0 @unkey/api",
64
64
  } as const;
@@ -84,7 +84,10 @@ type SecurityInputOAuth2 = {
84
84
  type SecurityInputOAuth2ClientCredentials = {
85
85
  type: "oauth2:client_credentials";
86
86
  value:
87
- | { clientID?: string | undefined; clientSecret?: string | undefined }
87
+ | {
88
+ clientID?: string | undefined;
89
+ clientSecret?: string | undefined;
90
+ }
88
91
  | null
89
92
  | string
90
93
  | undefined;
package/src/lib/url.ts CHANGED
@@ -10,7 +10,7 @@ export function pathToFunc(
10
10
  pathPattern: string,
11
11
  options?: { charEncoding?: "percent" | "none" },
12
12
  ): (params?: Params) => string {
13
- const paramRE = /\{([a-zA-Z0-9_]+?)\}/g;
13
+ const paramRE = /\{([a-zA-Z0-9_][a-zA-Z0-9_-]*?)\}/g;
14
14
 
15
15
  return function buildURLPath(params: Record<string, unknown> = {}): string {
16
16
  return pathPattern.replace(paramRE, function (_, placeholder) {
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "2.0.4",
22
+ currentVersion: "2.0.6",
23
23
  },
24
24
  });
25
25
 
@@ -60,7 +60,7 @@ export function createMCPServer(deps: {
60
60
  }) {
61
61
  const server = new McpServer({
62
62
  name: "Unkey",
63
- version: "2.0.4",
63
+ version: "2.0.6",
64
64
  });
65
65
 
66
66
  const client = new UnkeyCore({
@@ -18,7 +18,7 @@ Check and enforce rate limits for any identifier (user ID, IP address, API clien
18
18
 
19
19
  Use this for rate limiting beyond API keys - limit users by ID, IPs by address, or any custom identifier. Supports namespace organization, variable costs, and custom overrides.
20
20
 
21
- **Important**: Always returns HTTP 200. Check the \`success\` field to determine if the request should proceed.
21
+ **Response Codes**: Rate limit checks return HTTP 200 regardless of whether the limit is exceeded - check the \`success\` field in the response to determine if the request should be allowed. 4xx responses indicate auth, namespace existence/deletion, or validation errors (e.g., 410 Gone for deleted namespaces). 5xx responses indicate server errors.
22
22
 
23
23
  **Required Permissions**
24
24
 
@@ -13,11 +13,6 @@ import {
13
13
  RatelimitResponse$outboundSchema,
14
14
  } from "./ratelimitresponse.js";
15
15
 
16
- /**
17
- * Identity metadata
18
- */
19
- export type IdentityMeta = {};
20
-
21
16
  export type Identity = {
22
17
  /**
23
18
  * Identity ID
@@ -30,57 +25,13 @@ export type Identity = {
30
25
  /**
31
26
  * Identity metadata
32
27
  */
33
- meta?: IdentityMeta | undefined;
28
+ meta?: { [k: string]: any } | undefined;
34
29
  /**
35
30
  * Identity ratelimits
36
31
  */
37
32
  ratelimits?: Array<RatelimitResponse> | undefined;
38
33
  };
39
34
 
40
- /** @internal */
41
- export const IdentityMeta$inboundSchema: z.ZodType<
42
- IdentityMeta,
43
- z.ZodTypeDef,
44
- unknown
45
- > = z.object({});
46
-
47
- /** @internal */
48
- export type IdentityMeta$Outbound = {};
49
-
50
- /** @internal */
51
- export const IdentityMeta$outboundSchema: z.ZodType<
52
- IdentityMeta$Outbound,
53
- z.ZodTypeDef,
54
- IdentityMeta
55
- > = z.object({});
56
-
57
- /**
58
- * @internal
59
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
60
- */
61
- export namespace IdentityMeta$ {
62
- /** @deprecated use `IdentityMeta$inboundSchema` instead. */
63
- export const inboundSchema = IdentityMeta$inboundSchema;
64
- /** @deprecated use `IdentityMeta$outboundSchema` instead. */
65
- export const outboundSchema = IdentityMeta$outboundSchema;
66
- /** @deprecated use `IdentityMeta$Outbound` instead. */
67
- export type Outbound = IdentityMeta$Outbound;
68
- }
69
-
70
- export function identityMetaToJSON(identityMeta: IdentityMeta): string {
71
- return JSON.stringify(IdentityMeta$outboundSchema.parse(identityMeta));
72
- }
73
-
74
- export function identityMetaFromJSON(
75
- jsonString: string,
76
- ): SafeParseResult<IdentityMeta, SDKValidationError> {
77
- return safeParse(
78
- jsonString,
79
- (x) => IdentityMeta$inboundSchema.parse(JSON.parse(x)),
80
- `Failed to parse 'IdentityMeta' from JSON`,
81
- );
82
- }
83
-
84
35
  /** @internal */
85
36
  export const Identity$inboundSchema: z.ZodType<
86
37
  Identity,
@@ -89,7 +40,7 @@ export const Identity$inboundSchema: z.ZodType<
89
40
  > = z.object({
90
41
  id: z.string(),
91
42
  externalId: z.string(),
92
- meta: z.lazy(() => IdentityMeta$inboundSchema).optional(),
43
+ meta: z.record(z.any()).optional(),
93
44
  ratelimits: z.array(RatelimitResponse$inboundSchema).optional(),
94
45
  });
95
46
 
@@ -97,7 +48,7 @@ export const Identity$inboundSchema: z.ZodType<
97
48
  export type Identity$Outbound = {
98
49
  id: string;
99
50
  externalId: string;
100
- meta?: IdentityMeta$Outbound | undefined;
51
+ meta?: { [k: string]: any } | undefined;
101
52
  ratelimits?: Array<RatelimitResponse$Outbound> | undefined;
102
53
  };
103
54
 
@@ -109,7 +60,7 @@ export const Identity$outboundSchema: z.ZodType<
109
60
  > = z.object({
110
61
  id: z.string(),
111
62
  externalId: z.string(),
112
- meta: z.lazy(() => IdentityMeta$outboundSchema).optional(),
63
+ meta: z.record(z.any()).optional(),
113
64
  ratelimits: z.array(RatelimitResponse$outboundSchema).optional(),
114
65
  });
115
66
 
@@ -19,6 +19,8 @@ export * from "./ratelimitrequest.js";
19
19
  export * from "./ratelimitresponse.js";
20
20
  export * from "./role.js";
21
21
  export * from "./security.js";
22
+ export * from "./updatekeycreditsdata.js";
23
+ export * from "./updatekeycreditsrefill.js";
22
24
  export * from "./v2apiscreateapirequestbody.js";
23
25
  export * from "./v2apiscreateapiresponsebody.js";
24
26
  export * from "./v2apiscreateapiresponsedata.js";
@@ -11,14 +11,16 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
11
  /**
12
12
  * How often credits are automatically refilled.
13
13
  */
14
- export const Interval = {
14
+ export const KeyCreditsRefillInterval = {
15
15
  Daily: "daily",
16
16
  Monthly: "monthly",
17
17
  } as const;
18
18
  /**
19
19
  * How often credits are automatically refilled.
20
20
  */
21
- export type Interval = ClosedEnum<typeof Interval>;
21
+ export type KeyCreditsRefillInterval = ClosedEnum<
22
+ typeof KeyCreditsRefillInterval
23
+ >;
22
24
 
23
25
  /**
24
26
  * Configuration for automatic credit refill behavior.
@@ -27,7 +29,7 @@ export type KeyCreditsRefill = {
27
29
  /**
28
30
  * How often credits are automatically refilled.
29
31
  */
30
- interval: Interval;
32
+ interval: KeyCreditsRefillInterval;
31
33
  /**
32
34
  * Number of credits to add during each refill cycle.
33
35
  */
@@ -43,22 +45,24 @@ export type KeyCreditsRefill = {
43
45
  };
44
46
 
45
47
  /** @internal */
46
- export const Interval$inboundSchema: z.ZodNativeEnum<typeof Interval> = z
47
- .nativeEnum(Interval);
48
+ export const KeyCreditsRefillInterval$inboundSchema: z.ZodNativeEnum<
49
+ typeof KeyCreditsRefillInterval
50
+ > = z.nativeEnum(KeyCreditsRefillInterval);
48
51
 
49
52
  /** @internal */
50
- export const Interval$outboundSchema: z.ZodNativeEnum<typeof Interval> =
51
- Interval$inboundSchema;
53
+ export const KeyCreditsRefillInterval$outboundSchema: z.ZodNativeEnum<
54
+ typeof KeyCreditsRefillInterval
55
+ > = KeyCreditsRefillInterval$inboundSchema;
52
56
 
53
57
  /**
54
58
  * @internal
55
59
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
56
60
  */
57
- export namespace Interval$ {
58
- /** @deprecated use `Interval$inboundSchema` instead. */
59
- export const inboundSchema = Interval$inboundSchema;
60
- /** @deprecated use `Interval$outboundSchema` instead. */
61
- export const outboundSchema = Interval$outboundSchema;
61
+ export namespace KeyCreditsRefillInterval$ {
62
+ /** @deprecated use `KeyCreditsRefillInterval$inboundSchema` instead. */
63
+ export const inboundSchema = KeyCreditsRefillInterval$inboundSchema;
64
+ /** @deprecated use `KeyCreditsRefillInterval$outboundSchema` instead. */
65
+ export const outboundSchema = KeyCreditsRefillInterval$outboundSchema;
62
66
  }
63
67
 
64
68
  /** @internal */
@@ -67,7 +71,7 @@ export const KeyCreditsRefill$inboundSchema: z.ZodType<
67
71
  z.ZodTypeDef,
68
72
  unknown
69
73
  > = z.object({
70
- interval: Interval$inboundSchema,
74
+ interval: KeyCreditsRefillInterval$inboundSchema,
71
75
  amount: z.number().int(),
72
76
  refillDay: z.number().int().optional(),
73
77
  });
@@ -85,7 +89,7 @@ export const KeyCreditsRefill$outboundSchema: z.ZodType<
85
89
  z.ZodTypeDef,
86
90
  KeyCreditsRefill
87
91
  > = z.object({
88
- interval: Interval$outboundSchema,
92
+ interval: KeyCreditsRefillInterval$outboundSchema,
89
93
  amount: z.number().int(),
90
94
  refillDay: z.number().int().optional(),
91
95
  });
@@ -0,0 +1,85 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../../types/fp.js";
8
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
+ import {
10
+ UpdateKeyCreditsRefill,
11
+ UpdateKeyCreditsRefill$inboundSchema,
12
+ UpdateKeyCreditsRefill$Outbound,
13
+ UpdateKeyCreditsRefill$outboundSchema,
14
+ } from "./updatekeycreditsrefill.js";
15
+
16
+ /**
17
+ * Credit configuration and remaining balance for this key.
18
+ */
19
+ export type UpdateKeyCreditsData = {
20
+ /**
21
+ * Number of credits remaining (null for unlimited). This also clears the refilling schedule.
22
+ */
23
+ remaining?: number | null | undefined;
24
+ /**
25
+ * Configuration for automatic credit refill behavior.
26
+ */
27
+ refill?: UpdateKeyCreditsRefill | null | undefined;
28
+ };
29
+
30
+ /** @internal */
31
+ export const UpdateKeyCreditsData$inboundSchema: z.ZodType<
32
+ UpdateKeyCreditsData,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = z.object({
36
+ remaining: z.nullable(z.number().int()).optional(),
37
+ refill: z.nullable(UpdateKeyCreditsRefill$inboundSchema).optional(),
38
+ });
39
+
40
+ /** @internal */
41
+ export type UpdateKeyCreditsData$Outbound = {
42
+ remaining?: number | null | undefined;
43
+ refill?: UpdateKeyCreditsRefill$Outbound | null | undefined;
44
+ };
45
+
46
+ /** @internal */
47
+ export const UpdateKeyCreditsData$outboundSchema: z.ZodType<
48
+ UpdateKeyCreditsData$Outbound,
49
+ z.ZodTypeDef,
50
+ UpdateKeyCreditsData
51
+ > = z.object({
52
+ remaining: z.nullable(z.number().int()).optional(),
53
+ refill: z.nullable(UpdateKeyCreditsRefill$outboundSchema).optional(),
54
+ });
55
+
56
+ /**
57
+ * @internal
58
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
59
+ */
60
+ export namespace UpdateKeyCreditsData$ {
61
+ /** @deprecated use `UpdateKeyCreditsData$inboundSchema` instead. */
62
+ export const inboundSchema = UpdateKeyCreditsData$inboundSchema;
63
+ /** @deprecated use `UpdateKeyCreditsData$outboundSchema` instead. */
64
+ export const outboundSchema = UpdateKeyCreditsData$outboundSchema;
65
+ /** @deprecated use `UpdateKeyCreditsData$Outbound` instead. */
66
+ export type Outbound = UpdateKeyCreditsData$Outbound;
67
+ }
68
+
69
+ export function updateKeyCreditsDataToJSON(
70
+ updateKeyCreditsData: UpdateKeyCreditsData,
71
+ ): string {
72
+ return JSON.stringify(
73
+ UpdateKeyCreditsData$outboundSchema.parse(updateKeyCreditsData),
74
+ );
75
+ }
76
+
77
+ export function updateKeyCreditsDataFromJSON(
78
+ jsonString: string,
79
+ ): SafeParseResult<UpdateKeyCreditsData, SDKValidationError> {
80
+ return safeParse(
81
+ jsonString,
82
+ (x) => UpdateKeyCreditsData$inboundSchema.parse(JSON.parse(x)),
83
+ `Failed to parse 'UpdateKeyCreditsData' from JSON`,
84
+ );
85
+ }
@@ -0,0 +1,126 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { safeParse } from "../../lib/schemas.js";
7
+ import { ClosedEnum } from "../../types/enums.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ /**
12
+ * How often credits are automatically refilled.
13
+ */
14
+ export const UpdateKeyCreditsRefillInterval = {
15
+ Daily: "daily",
16
+ Monthly: "monthly",
17
+ } as const;
18
+ /**
19
+ * How often credits are automatically refilled.
20
+ */
21
+ export type UpdateKeyCreditsRefillInterval = ClosedEnum<
22
+ typeof UpdateKeyCreditsRefillInterval
23
+ >;
24
+
25
+ /**
26
+ * Configuration for automatic credit refill behavior.
27
+ */
28
+ export type UpdateKeyCreditsRefill = {
29
+ /**
30
+ * How often credits are automatically refilled.
31
+ */
32
+ interval: UpdateKeyCreditsRefillInterval;
33
+ /**
34
+ * Number of credits to add during each refill cycle.
35
+ */
36
+ amount: number;
37
+ /**
38
+ * Day of the month for monthly refills (1-31).
39
+ *
40
+ * @remarks
41
+ * Only required when interval is 'monthly'.
42
+ * For days beyond the month's length, refill occurs on the last day of the month.
43
+ */
44
+ refillDay?: number | undefined;
45
+ };
46
+
47
+ /** @internal */
48
+ export const UpdateKeyCreditsRefillInterval$inboundSchema: z.ZodNativeEnum<
49
+ typeof UpdateKeyCreditsRefillInterval
50
+ > = z.nativeEnum(UpdateKeyCreditsRefillInterval);
51
+
52
+ /** @internal */
53
+ export const UpdateKeyCreditsRefillInterval$outboundSchema: z.ZodNativeEnum<
54
+ typeof UpdateKeyCreditsRefillInterval
55
+ > = UpdateKeyCreditsRefillInterval$inboundSchema;
56
+
57
+ /**
58
+ * @internal
59
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
60
+ */
61
+ export namespace UpdateKeyCreditsRefillInterval$ {
62
+ /** @deprecated use `UpdateKeyCreditsRefillInterval$inboundSchema` instead. */
63
+ export const inboundSchema = UpdateKeyCreditsRefillInterval$inboundSchema;
64
+ /** @deprecated use `UpdateKeyCreditsRefillInterval$outboundSchema` instead. */
65
+ export const outboundSchema = UpdateKeyCreditsRefillInterval$outboundSchema;
66
+ }
67
+
68
+ /** @internal */
69
+ export const UpdateKeyCreditsRefill$inboundSchema: z.ZodType<
70
+ UpdateKeyCreditsRefill,
71
+ z.ZodTypeDef,
72
+ unknown
73
+ > = z.object({
74
+ interval: UpdateKeyCreditsRefillInterval$inboundSchema,
75
+ amount: z.number().int(),
76
+ refillDay: z.number().int().optional(),
77
+ });
78
+
79
+ /** @internal */
80
+ export type UpdateKeyCreditsRefill$Outbound = {
81
+ interval: string;
82
+ amount: number;
83
+ refillDay?: number | undefined;
84
+ };
85
+
86
+ /** @internal */
87
+ export const UpdateKeyCreditsRefill$outboundSchema: z.ZodType<
88
+ UpdateKeyCreditsRefill$Outbound,
89
+ z.ZodTypeDef,
90
+ UpdateKeyCreditsRefill
91
+ > = z.object({
92
+ interval: UpdateKeyCreditsRefillInterval$outboundSchema,
93
+ amount: z.number().int(),
94
+ refillDay: z.number().int().optional(),
95
+ });
96
+
97
+ /**
98
+ * @internal
99
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
100
+ */
101
+ export namespace UpdateKeyCreditsRefill$ {
102
+ /** @deprecated use `UpdateKeyCreditsRefill$inboundSchema` instead. */
103
+ export const inboundSchema = UpdateKeyCreditsRefill$inboundSchema;
104
+ /** @deprecated use `UpdateKeyCreditsRefill$outboundSchema` instead. */
105
+ export const outboundSchema = UpdateKeyCreditsRefill$outboundSchema;
106
+ /** @deprecated use `UpdateKeyCreditsRefill$Outbound` instead. */
107
+ export type Outbound = UpdateKeyCreditsRefill$Outbound;
108
+ }
109
+
110
+ export function updateKeyCreditsRefillToJSON(
111
+ updateKeyCreditsRefill: UpdateKeyCreditsRefill,
112
+ ): string {
113
+ return JSON.stringify(
114
+ UpdateKeyCreditsRefill$outboundSchema.parse(updateKeyCreditsRefill),
115
+ );
116
+ }
117
+
118
+ export function updateKeyCreditsRefillFromJSON(
119
+ jsonString: string,
120
+ ): SafeParseResult<UpdateKeyCreditsRefill, SDKValidationError> {
121
+ return safeParse(
122
+ jsonString,
123
+ (x) => UpdateKeyCreditsRefill$inboundSchema.parse(JSON.parse(x)),
124
+ `Failed to parse 'UpdateKeyCreditsRefill' from JSON`,
125
+ );
126
+ }
@@ -6,18 +6,18 @@ import * as z from "zod";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
7
  import { Result as SafeParseResult } from "../../types/fp.js";
8
8
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
9
- import {
10
- KeyCreditsData,
11
- KeyCreditsData$inboundSchema,
12
- KeyCreditsData$Outbound,
13
- KeyCreditsData$outboundSchema,
14
- } from "./keycreditsdata.js";
15
9
  import {
16
10
  RatelimitRequest,
17
11
  RatelimitRequest$inboundSchema,
18
12
  RatelimitRequest$Outbound,
19
13
  RatelimitRequest$outboundSchema,
20
14
  } from "./ratelimitrequest.js";
15
+ import {
16
+ UpdateKeyCreditsData,
17
+ UpdateKeyCreditsData$inboundSchema,
18
+ UpdateKeyCreditsData$Outbound,
19
+ UpdateKeyCreditsData$outboundSchema,
20
+ } from "./updatekeycreditsdata.js";
21
21
 
22
22
  export type V2KeysUpdateKeyRequestBody = {
23
23
  /**
@@ -68,7 +68,7 @@ export type V2KeysUpdateKeyRequestBody = {
68
68
  /**
69
69
  * Credit configuration and remaining balance for this key.
70
70
  */
71
- credits?: KeyCreditsData | undefined;
71
+ credits?: UpdateKeyCreditsData | null | undefined;
72
72
  /**
73
73
  * Defines time-based rate limits that protect against abuse by controlling request frequency.
74
74
  *
@@ -102,7 +102,7 @@ export const V2KeysUpdateKeyRequestBody$inboundSchema: z.ZodType<
102
102
  externalId: z.nullable(z.string()).optional(),
103
103
  meta: z.nullable(z.record(z.any())).optional(),
104
104
  expires: z.nullable(z.number().int()).optional(),
105
- credits: KeyCreditsData$inboundSchema.optional(),
105
+ credits: z.nullable(UpdateKeyCreditsData$inboundSchema).optional(),
106
106
  ratelimits: z.array(RatelimitRequest$inboundSchema).optional(),
107
107
  enabled: z.boolean().optional(),
108
108
  roles: z.array(z.string()).optional(),
@@ -116,7 +116,7 @@ export type V2KeysUpdateKeyRequestBody$Outbound = {
116
116
  externalId?: string | null | undefined;
117
117
  meta?: { [k: string]: any } | null | undefined;
118
118
  expires?: number | null | undefined;
119
- credits?: KeyCreditsData$Outbound | undefined;
119
+ credits?: UpdateKeyCreditsData$Outbound | null | undefined;
120
120
  ratelimits?: Array<RatelimitRequest$Outbound> | undefined;
121
121
  enabled?: boolean | undefined;
122
122
  roles?: Array<string> | undefined;
@@ -134,7 +134,7 @@ export const V2KeysUpdateKeyRequestBody$outboundSchema: z.ZodType<
134
134
  externalId: z.nullable(z.string()).optional(),
135
135
  meta: z.nullable(z.record(z.any())).optional(),
136
136
  expires: z.nullable(z.number().int()).optional(),
137
- credits: KeyCreditsData$outboundSchema.optional(),
137
+ credits: z.nullable(UpdateKeyCreditsData$outboundSchema).optional(),
138
138
  ratelimits: z.array(RatelimitRequest$outboundSchema).optional(),
139
139
  enabled: z.boolean().optional(),
140
140
  roles: z.array(z.string()).optional(),