@snagsolutions/sdk 0.1.0-alpha.10

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 (342) hide show
  1. package/CHANGELOG.md +125 -0
  2. package/LICENSE +201 -0
  3. package/README.md +297 -0
  4. package/_shims/MultipartBody.d.ts +9 -0
  5. package/_shims/MultipartBody.d.ts.map +1 -0
  6. package/_shims/MultipartBody.js +16 -0
  7. package/_shims/MultipartBody.js.map +1 -0
  8. package/_shims/MultipartBody.mjs +12 -0
  9. package/_shims/MultipartBody.mjs.map +1 -0
  10. package/_shims/README.md +46 -0
  11. package/_shims/auto/runtime-bun.d.ts +5 -0
  12. package/_shims/auto/runtime-bun.d.ts.map +1 -0
  13. package/_shims/auto/runtime-bun.js +21 -0
  14. package/_shims/auto/runtime-bun.js.map +1 -0
  15. package/_shims/auto/runtime-bun.mjs +2 -0
  16. package/_shims/auto/runtime-bun.mjs.map +1 -0
  17. package/_shims/auto/runtime-node.d.ts +5 -0
  18. package/_shims/auto/runtime-node.d.ts.map +1 -0
  19. package/_shims/auto/runtime-node.js +21 -0
  20. package/_shims/auto/runtime-node.js.map +1 -0
  21. package/_shims/auto/runtime-node.mjs +2 -0
  22. package/_shims/auto/runtime-node.mjs.map +1 -0
  23. package/_shims/auto/runtime.d.ts +5 -0
  24. package/_shims/auto/runtime.d.ts.map +1 -0
  25. package/_shims/auto/runtime.js +21 -0
  26. package/_shims/auto/runtime.js.map +1 -0
  27. package/_shims/auto/runtime.mjs +2 -0
  28. package/_shims/auto/runtime.mjs.map +1 -0
  29. package/_shims/auto/types-node.d.ts +5 -0
  30. package/_shims/auto/types-node.d.ts.map +1 -0
  31. package/_shims/auto/types-node.js +21 -0
  32. package/_shims/auto/types-node.js.map +1 -0
  33. package/_shims/auto/types-node.mjs +2 -0
  34. package/_shims/auto/types-node.mjs.map +1 -0
  35. package/_shims/auto/types.d.ts +101 -0
  36. package/_shims/auto/types.js +3 -0
  37. package/_shims/auto/types.mjs +3 -0
  38. package/_shims/bun-runtime.d.ts +6 -0
  39. package/_shims/bun-runtime.d.ts.map +1 -0
  40. package/_shims/bun-runtime.js +14 -0
  41. package/_shims/bun-runtime.js.map +1 -0
  42. package/_shims/bun-runtime.mjs +10 -0
  43. package/_shims/bun-runtime.mjs.map +1 -0
  44. package/_shims/index.d.ts +81 -0
  45. package/_shims/index.js +13 -0
  46. package/_shims/index.mjs +7 -0
  47. package/_shims/manual-types.d.ts +12 -0
  48. package/_shims/manual-types.js +3 -0
  49. package/_shims/manual-types.mjs +3 -0
  50. package/_shims/node-runtime.d.ts +3 -0
  51. package/_shims/node-runtime.d.ts.map +1 -0
  52. package/_shims/node-runtime.js +89 -0
  53. package/_shims/node-runtime.js.map +1 -0
  54. package/_shims/node-runtime.mjs +56 -0
  55. package/_shims/node-runtime.mjs.map +1 -0
  56. package/_shims/node-types.d.ts +42 -0
  57. package/_shims/node-types.js +3 -0
  58. package/_shims/node-types.mjs +3 -0
  59. package/_shims/registry.d.ts +37 -0
  60. package/_shims/registry.d.ts.map +1 -0
  61. package/_shims/registry.js +41 -0
  62. package/_shims/registry.js.map +1 -0
  63. package/_shims/registry.mjs +37 -0
  64. package/_shims/registry.mjs.map +1 -0
  65. package/_shims/web-runtime.d.ts +5 -0
  66. package/_shims/web-runtime.d.ts.map +1 -0
  67. package/_shims/web-runtime.js +78 -0
  68. package/_shims/web-runtime.js.map +1 -0
  69. package/_shims/web-runtime.mjs +71 -0
  70. package/_shims/web-runtime.mjs.map +1 -0
  71. package/_shims/web-types.d.ts +83 -0
  72. package/_shims/web-types.js +3 -0
  73. package/_shims/web-types.mjs +3 -0
  74. package/core.d.ts +241 -0
  75. package/core.d.ts.map +1 -0
  76. package/core.js +908 -0
  77. package/core.js.map +1 -0
  78. package/core.mjs +876 -0
  79. package/core.mjs.map +1 -0
  80. package/error.d.ts +47 -0
  81. package/error.d.ts.map +1 -0
  82. package/error.js +113 -0
  83. package/error.js.map +1 -0
  84. package/error.mjs +97 -0
  85. package/error.mjs.map +1 -0
  86. package/index.d.mts +126 -0
  87. package/index.d.ts +126 -0
  88. package/index.d.ts.map +1 -0
  89. package/index.js +141 -0
  90. package/index.js.map +1 -0
  91. package/index.mjs +98 -0
  92. package/index.mjs.map +1 -0
  93. package/internal/qs/formats.d.ts +6 -0
  94. package/internal/qs/formats.d.ts.map +1 -0
  95. package/internal/qs/formats.js +11 -0
  96. package/internal/qs/formats.js.map +1 -0
  97. package/internal/qs/formats.mjs +8 -0
  98. package/internal/qs/formats.mjs.map +1 -0
  99. package/internal/qs/index.d.ts +10 -0
  100. package/internal/qs/index.d.ts.map +1 -0
  101. package/internal/qs/index.js +14 -0
  102. package/internal/qs/index.js.map +1 -0
  103. package/internal/qs/index.mjs +10 -0
  104. package/internal/qs/index.mjs.map +1 -0
  105. package/internal/qs/stringify.d.ts +3 -0
  106. package/internal/qs/stringify.d.ts.map +1 -0
  107. package/internal/qs/stringify.js +280 -0
  108. package/internal/qs/stringify.js.map +1 -0
  109. package/internal/qs/stringify.mjs +276 -0
  110. package/internal/qs/stringify.mjs.map +1 -0
  111. package/internal/qs/types.d.ts +57 -0
  112. package/internal/qs/types.d.ts.map +1 -0
  113. package/internal/qs/types.js +3 -0
  114. package/internal/qs/types.js.map +1 -0
  115. package/internal/qs/types.mjs +2 -0
  116. package/internal/qs/types.mjs.map +1 -0
  117. package/internal/qs/utils.d.ts +14 -0
  118. package/internal/qs/utils.d.ts.map +1 -0
  119. package/internal/qs/utils.js +229 -0
  120. package/internal/qs/utils.js.map +1 -0
  121. package/internal/qs/utils.mjs +217 -0
  122. package/internal/qs/utils.mjs.map +1 -0
  123. package/package.json +103 -0
  124. package/resource.d.ts +6 -0
  125. package/resource.d.ts.map +1 -0
  126. package/resource.js +11 -0
  127. package/resource.js.map +1 -0
  128. package/resource.mjs +7 -0
  129. package/resource.mjs.map +1 -0
  130. package/resources/assets.d.ts +50 -0
  131. package/resources/assets.d.ts.map +1 -0
  132. package/resources/assets.js +17 -0
  133. package/resources/assets.js.map +1 -0
  134. package/resources/assets.mjs +13 -0
  135. package/resources/assets.mjs.map +1 -0
  136. package/resources/auction-bids.d.ts +81 -0
  137. package/resources/auction-bids.d.ts.map +1 -0
  138. package/resources/auction-bids.js +30 -0
  139. package/resources/auction-bids.js.map +1 -0
  140. package/resources/auction-bids.mjs +26 -0
  141. package/resources/auction-bids.mjs.map +1 -0
  142. package/resources/drip/drip.d.ts +14 -0
  143. package/resources/drip/drip.d.ts.map +1 -0
  144. package/resources/drip/drip.js +43 -0
  145. package/resources/drip/drip.js.map +1 -0
  146. package/resources/drip/drip.mjs +16 -0
  147. package/resources/drip/drip.mjs.map +1 -0
  148. package/resources/drip/index.d.ts +4 -0
  149. package/resources/drip/index.d.ts.map +1 -0
  150. package/resources/drip/index.js +11 -0
  151. package/resources/drip/index.js.map +1 -0
  152. package/resources/drip/index.mjs +5 -0
  153. package/resources/drip/index.mjs.map +1 -0
  154. package/resources/drip/quests.d.ts +168 -0
  155. package/resources/drip/quests.d.ts.map +1 -0
  156. package/resources/drip/quests.js +17 -0
  157. package/resources/drip/quests.js.map +1 -0
  158. package/resources/drip/quests.mjs +13 -0
  159. package/resources/drip/quests.mjs.map +1 -0
  160. package/resources/drip/status.d.ts +26 -0
  161. package/resources/drip/status.d.ts.map +1 -0
  162. package/resources/drip/status.js +16 -0
  163. package/resources/drip/status.js.map +1 -0
  164. package/resources/drip/status.mjs +12 -0
  165. package/resources/drip/status.mjs.map +1 -0
  166. package/resources/index.d.ts +7 -0
  167. package/resources/index.d.ts.map +1 -0
  168. package/resources/index.js +17 -0
  169. package/resources/index.js.map +1 -0
  170. package/resources/index.mjs +8 -0
  171. package/resources/index.mjs.map +1 -0
  172. package/resources/loyalty/accounts.d.ts +157 -0
  173. package/resources/loyalty/accounts.d.ts.map +1 -0
  174. package/resources/loyalty/accounts.js +16 -0
  175. package/resources/loyalty/accounts.js.map +1 -0
  176. package/resources/loyalty/accounts.mjs +12 -0
  177. package/resources/loyalty/accounts.mjs.map +1 -0
  178. package/resources/loyalty/badges.d.ts +299 -0
  179. package/resources/loyalty/badges.d.ts.map +1 -0
  180. package/resources/loyalty/badges.js +46 -0
  181. package/resources/loyalty/badges.js.map +1 -0
  182. package/resources/loyalty/badges.mjs +42 -0
  183. package/resources/loyalty/badges.mjs.map +1 -0
  184. package/resources/loyalty/currencies.d.ts +252 -0
  185. package/resources/loyalty/currencies.d.ts.map +1 -0
  186. package/resources/loyalty/currencies.js +21 -0
  187. package/resources/loyalty/currencies.js.map +1 -0
  188. package/resources/loyalty/currencies.mjs +17 -0
  189. package/resources/loyalty/currencies.mjs.map +1 -0
  190. package/resources/loyalty/index.d.ts +9 -0
  191. package/resources/loyalty/index.d.ts.map +1 -0
  192. package/resources/loyalty/index.js +21 -0
  193. package/resources/loyalty/index.js.map +1 -0
  194. package/resources/loyalty/index.mjs +10 -0
  195. package/resources/loyalty/index.mjs.map +1 -0
  196. package/resources/loyalty/loyalty.d.ts +34 -0
  197. package/resources/loyalty/loyalty.d.ts.map +1 -0
  198. package/resources/loyalty/loyalty.js +63 -0
  199. package/resources/loyalty/loyalty.js.map +1 -0
  200. package/resources/loyalty/loyalty.mjs +36 -0
  201. package/resources/loyalty/loyalty.mjs.map +1 -0
  202. package/resources/loyalty/multipliers.d.ts +129 -0
  203. package/resources/loyalty/multipliers.d.ts.map +1 -0
  204. package/resources/loyalty/multipliers.js +34 -0
  205. package/resources/loyalty/multipliers.js.map +1 -0
  206. package/resources/loyalty/multipliers.mjs +30 -0
  207. package/resources/loyalty/multipliers.mjs.map +1 -0
  208. package/resources/loyalty/rule-edits.d.ts +330 -0
  209. package/resources/loyalty/rule-edits.d.ts.map +1 -0
  210. package/resources/loyalty/rule-edits.js +21 -0
  211. package/resources/loyalty/rule-edits.js.map +1 -0
  212. package/resources/loyalty/rule-edits.mjs +17 -0
  213. package/resources/loyalty/rule-edits.mjs.map +1 -0
  214. package/resources/loyalty/rules.d.ts +2430 -0
  215. package/resources/loyalty/rules.d.ts.map +1 -0
  216. package/resources/loyalty/rules.js +46 -0
  217. package/resources/loyalty/rules.js.map +1 -0
  218. package/resources/loyalty/rules.mjs +42 -0
  219. package/resources/loyalty/rules.mjs.map +1 -0
  220. package/resources/loyalty/transaction-entries.d.ts +175 -0
  221. package/resources/loyalty/transaction-entries.d.ts.map +1 -0
  222. package/resources/loyalty/transaction-entries.js +16 -0
  223. package/resources/loyalty/transaction-entries.js.map +1 -0
  224. package/resources/loyalty/transaction-entries.mjs +12 -0
  225. package/resources/loyalty/transaction-entries.mjs.map +1 -0
  226. package/resources/users/index.d.ts +4 -0
  227. package/resources/users/index.d.ts.map +1 -0
  228. package/resources/users/index.js +11 -0
  229. package/resources/users/index.js.map +1 -0
  230. package/resources/users/index.mjs +5 -0
  231. package/resources/users/index.mjs.map +1 -0
  232. package/resources/users/metadatas.d.ts +64 -0
  233. package/resources/users/metadatas.d.ts.map +1 -0
  234. package/resources/users/metadatas.js +16 -0
  235. package/resources/users/metadatas.js.map +1 -0
  236. package/resources/users/metadatas.mjs +12 -0
  237. package/resources/users/metadatas.mjs.map +1 -0
  238. package/resources/users/users.d.ts +14 -0
  239. package/resources/users/users.d.ts.map +1 -0
  240. package/resources/users/users.js +43 -0
  241. package/resources/users/users.js.map +1 -0
  242. package/resources/users/users.mjs +16 -0
  243. package/resources/users/users.mjs.map +1 -0
  244. package/resources/users/wallets.d.ts +193 -0
  245. package/resources/users/wallets.d.ts.map +1 -0
  246. package/resources/users/wallets.js +28 -0
  247. package/resources/users/wallets.js.map +1 -0
  248. package/resources/users/wallets.mjs +24 -0
  249. package/resources/users/wallets.mjs.map +1 -0
  250. package/resources/websites.d.ts +203 -0
  251. package/resources/websites.d.ts.map +1 -0
  252. package/resources/websites.js +22 -0
  253. package/resources/websites.js.map +1 -0
  254. package/resources/websites.mjs +18 -0
  255. package/resources/websites.mjs.map +1 -0
  256. package/shims/node.d.ts +30 -0
  257. package/shims/node.d.ts.map +1 -0
  258. package/shims/node.js +31 -0
  259. package/shims/node.js.map +1 -0
  260. package/shims/node.mjs +5 -0
  261. package/shims/node.mjs.map +1 -0
  262. package/shims/web.d.ts +26 -0
  263. package/shims/web.d.ts.map +1 -0
  264. package/shims/web.js +31 -0
  265. package/shims/web.js.map +1 -0
  266. package/shims/web.mjs +5 -0
  267. package/shims/web.mjs.map +1 -0
  268. package/src/_shims/MultipartBody.ts +9 -0
  269. package/src/_shims/README.md +46 -0
  270. package/src/_shims/auto/runtime-bun.ts +4 -0
  271. package/src/_shims/auto/runtime-node.ts +4 -0
  272. package/src/_shims/auto/runtime.ts +4 -0
  273. package/src/_shims/auto/types-node.ts +4 -0
  274. package/src/_shims/auto/types.d.ts +101 -0
  275. package/src/_shims/auto/types.js +3 -0
  276. package/src/_shims/auto/types.mjs +3 -0
  277. package/src/_shims/bun-runtime.ts +14 -0
  278. package/src/_shims/index.d.ts +81 -0
  279. package/src/_shims/index.js +13 -0
  280. package/src/_shims/index.mjs +7 -0
  281. package/src/_shims/manual-types.d.ts +12 -0
  282. package/src/_shims/manual-types.js +3 -0
  283. package/src/_shims/manual-types.mjs +3 -0
  284. package/src/_shims/node-runtime.ts +81 -0
  285. package/src/_shims/node-types.d.ts +42 -0
  286. package/src/_shims/node-types.js +3 -0
  287. package/src/_shims/node-types.mjs +3 -0
  288. package/src/_shims/registry.ts +67 -0
  289. package/src/_shims/web-runtime.ts +103 -0
  290. package/src/_shims/web-types.d.ts +83 -0
  291. package/src/_shims/web-types.js +3 -0
  292. package/src/_shims/web-types.mjs +3 -0
  293. package/src/core.ts +1201 -0
  294. package/src/error.ts +130 -0
  295. package/src/index.ts +235 -0
  296. package/src/internal/qs/LICENSE.md +13 -0
  297. package/src/internal/qs/README.md +3 -0
  298. package/src/internal/qs/formats.ts +9 -0
  299. package/src/internal/qs/index.ts +13 -0
  300. package/src/internal/qs/stringify.ts +388 -0
  301. package/src/internal/qs/types.ts +71 -0
  302. package/src/internal/qs/utils.ts +265 -0
  303. package/src/lib/.keep +4 -0
  304. package/src/resource.ts +11 -0
  305. package/src/resources/assets.ts +71 -0
  306. package/src/resources/auction-bids.ts +123 -0
  307. package/src/resources/drip/drip.ts +25 -0
  308. package/src/resources/drip/index.ts +5 -0
  309. package/src/resources/drip/quests.ts +210 -0
  310. package/src/resources/drip/status.ts +33 -0
  311. package/src/resources/index.ts +14 -0
  312. package/src/resources/loyalty/accounts.ts +199 -0
  313. package/src/resources/loyalty/badges.ts +435 -0
  314. package/src/resources/loyalty/currencies.ts +321 -0
  315. package/src/resources/loyalty/index.ts +61 -0
  316. package/src/resources/loyalty/loyalty.ts +159 -0
  317. package/src/resources/loyalty/multipliers.ts +238 -0
  318. package/src/resources/loyalty/rule-edits.ts +421 -0
  319. package/src/resources/loyalty/rules.ts +3513 -0
  320. package/src/resources/loyalty/transaction-entries.ts +229 -0
  321. package/src/resources/users/index.ts +12 -0
  322. package/src/resources/users/metadatas.ts +103 -0
  323. package/src/resources/users/users.ts +39 -0
  324. package/src/resources/users/wallets.ts +271 -0
  325. package/src/resources/websites.ts +259 -0
  326. package/src/shims/node.ts +50 -0
  327. package/src/shims/web.ts +50 -0
  328. package/src/tsconfig.json +11 -0
  329. package/src/uploads.ts +255 -0
  330. package/src/version.ts +1 -0
  331. package/uploads.d.ts +75 -0
  332. package/uploads.d.ts.map +1 -0
  333. package/uploads.js +171 -0
  334. package/uploads.js.map +1 -0
  335. package/uploads.mjs +158 -0
  336. package/uploads.mjs.map +1 -0
  337. package/version.d.ts +2 -0
  338. package/version.d.ts.map +1 -0
  339. package/version.js +5 -0
  340. package/version.js.map +1 -0
  341. package/version.mjs +2 -0
  342. package/version.mjs.map +1 -0
@@ -0,0 +1,265 @@
1
+ import { RFC1738 } from './formats';
2
+ import type { DefaultEncoder, Format } from './types';
3
+
4
+ const has = Object.prototype.hasOwnProperty;
5
+ const is_array = Array.isArray;
6
+
7
+ const hex_table = (() => {
8
+ const array = [];
9
+ for (let i = 0; i < 256; ++i) {
10
+ array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase());
11
+ }
12
+
13
+ return array;
14
+ })();
15
+
16
+ function compact_queue<T extends Record<string, any>>(queue: Array<{ obj: T; prop: string }>) {
17
+ while (queue.length > 1) {
18
+ const item = queue.pop();
19
+ if (!item) continue;
20
+
21
+ const obj = item.obj[item.prop];
22
+
23
+ if (is_array(obj)) {
24
+ const compacted: unknown[] = [];
25
+
26
+ for (let j = 0; j < obj.length; ++j) {
27
+ if (typeof obj[j] !== 'undefined') {
28
+ compacted.push(obj[j]);
29
+ }
30
+ }
31
+
32
+ // @ts-ignore
33
+ item.obj[item.prop] = compacted;
34
+ }
35
+ }
36
+ }
37
+
38
+ function array_to_object(source: any[], options: { plainObjects: boolean }) {
39
+ const obj = options && options.plainObjects ? Object.create(null) : {};
40
+ for (let i = 0; i < source.length; ++i) {
41
+ if (typeof source[i] !== 'undefined') {
42
+ obj[i] = source[i];
43
+ }
44
+ }
45
+
46
+ return obj;
47
+ }
48
+
49
+ export function merge(
50
+ target: any,
51
+ source: any,
52
+ options: { plainObjects?: boolean; allowPrototypes?: boolean } = {},
53
+ ) {
54
+ if (!source) {
55
+ return target;
56
+ }
57
+
58
+ if (typeof source !== 'object') {
59
+ if (is_array(target)) {
60
+ target.push(source);
61
+ } else if (target && typeof target === 'object') {
62
+ if (
63
+ (options && (options.plainObjects || options.allowPrototypes)) ||
64
+ !has.call(Object.prototype, source)
65
+ ) {
66
+ target[source] = true;
67
+ }
68
+ } else {
69
+ return [target, source];
70
+ }
71
+
72
+ return target;
73
+ }
74
+
75
+ if (!target || typeof target !== 'object') {
76
+ return [target].concat(source);
77
+ }
78
+
79
+ let mergeTarget = target;
80
+ if (is_array(target) && !is_array(source)) {
81
+ // @ts-ignore
82
+ mergeTarget = array_to_object(target, options);
83
+ }
84
+
85
+ if (is_array(target) && is_array(source)) {
86
+ source.forEach(function (item, i) {
87
+ if (has.call(target, i)) {
88
+ const targetItem = target[i];
89
+ if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') {
90
+ target[i] = merge(targetItem, item, options);
91
+ } else {
92
+ target.push(item);
93
+ }
94
+ } else {
95
+ target[i] = item;
96
+ }
97
+ });
98
+ return target;
99
+ }
100
+
101
+ return Object.keys(source).reduce(function (acc, key) {
102
+ const value = source[key];
103
+
104
+ if (has.call(acc, key)) {
105
+ acc[key] = merge(acc[key], value, options);
106
+ } else {
107
+ acc[key] = value;
108
+ }
109
+ return acc;
110
+ }, mergeTarget);
111
+ }
112
+
113
+ export function assign_single_source(target: any, source: any) {
114
+ return Object.keys(source).reduce(function (acc, key) {
115
+ acc[key] = source[key];
116
+ return acc;
117
+ }, target);
118
+ }
119
+
120
+ export function decode(str: string, _: any, charset: string) {
121
+ const strWithoutPlus = str.replace(/\+/g, ' ');
122
+ if (charset === 'iso-8859-1') {
123
+ // unescape never throws, no try...catch needed:
124
+ return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape);
125
+ }
126
+ // utf-8
127
+ try {
128
+ return decodeURIComponent(strWithoutPlus);
129
+ } catch (e) {
130
+ return strWithoutPlus;
131
+ }
132
+ }
133
+
134
+ const limit = 1024;
135
+
136
+ export const encode: (
137
+ str: any,
138
+ defaultEncoder: DefaultEncoder,
139
+ charset: string,
140
+ type: 'key' | 'value',
141
+ format: Format,
142
+ ) => string = (str, _defaultEncoder, charset, _kind, format: Format) => {
143
+ // This code was originally written by Brian White for the io.js core querystring library.
144
+ // It has been adapted here for stricter adherence to RFC 3986
145
+ if (str.length === 0) {
146
+ return str;
147
+ }
148
+
149
+ let string = str;
150
+ if (typeof str === 'symbol') {
151
+ string = Symbol.prototype.toString.call(str);
152
+ } else if (typeof str !== 'string') {
153
+ string = String(str);
154
+ }
155
+
156
+ if (charset === 'iso-8859-1') {
157
+ return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) {
158
+ return '%26%23' + parseInt($0.slice(2), 16) + '%3B';
159
+ });
160
+ }
161
+
162
+ let out = '';
163
+ for (let j = 0; j < string.length; j += limit) {
164
+ const segment = string.length >= limit ? string.slice(j, j + limit) : string;
165
+ const arr = [];
166
+
167
+ for (let i = 0; i < segment.length; ++i) {
168
+ let c = segment.charCodeAt(i);
169
+ if (
170
+ c === 0x2d || // -
171
+ c === 0x2e || // .
172
+ c === 0x5f || // _
173
+ c === 0x7e || // ~
174
+ (c >= 0x30 && c <= 0x39) || // 0-9
175
+ (c >= 0x41 && c <= 0x5a) || // a-z
176
+ (c >= 0x61 && c <= 0x7a) || // A-Z
177
+ (format === RFC1738 && (c === 0x28 || c === 0x29)) // ( )
178
+ ) {
179
+ arr[arr.length] = segment.charAt(i);
180
+ continue;
181
+ }
182
+
183
+ if (c < 0x80) {
184
+ arr[arr.length] = hex_table[c];
185
+ continue;
186
+ }
187
+
188
+ if (c < 0x800) {
189
+ arr[arr.length] = hex_table[0xc0 | (c >> 6)]! + hex_table[0x80 | (c & 0x3f)];
190
+ continue;
191
+ }
192
+
193
+ if (c < 0xd800 || c >= 0xe000) {
194
+ arr[arr.length] =
195
+ hex_table[0xe0 | (c >> 12)]! + hex_table[0x80 | ((c >> 6) & 0x3f)] + hex_table[0x80 | (c & 0x3f)];
196
+ continue;
197
+ }
198
+
199
+ i += 1;
200
+ c = 0x10000 + (((c & 0x3ff) << 10) | (segment.charCodeAt(i) & 0x3ff));
201
+
202
+ arr[arr.length] =
203
+ hex_table[0xf0 | (c >> 18)]! +
204
+ hex_table[0x80 | ((c >> 12) & 0x3f)] +
205
+ hex_table[0x80 | ((c >> 6) & 0x3f)] +
206
+ hex_table[0x80 | (c & 0x3f)];
207
+ }
208
+
209
+ out += arr.join('');
210
+ }
211
+
212
+ return out;
213
+ };
214
+
215
+ export function compact(value: any) {
216
+ const queue = [{ obj: { o: value }, prop: 'o' }];
217
+ const refs = [];
218
+
219
+ for (let i = 0; i < queue.length; ++i) {
220
+ const item = queue[i];
221
+ // @ts-ignore
222
+ const obj = item.obj[item.prop];
223
+
224
+ const keys = Object.keys(obj);
225
+ for (let j = 0; j < keys.length; ++j) {
226
+ const key = keys[j]!;
227
+ const val = obj[key];
228
+ if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) {
229
+ queue.push({ obj: obj, prop: key });
230
+ refs.push(val);
231
+ }
232
+ }
233
+ }
234
+
235
+ compact_queue(queue);
236
+
237
+ return value;
238
+ }
239
+
240
+ export function is_regexp(obj: any) {
241
+ return Object.prototype.toString.call(obj) === '[object RegExp]';
242
+ }
243
+
244
+ export function is_buffer(obj: any) {
245
+ if (!obj || typeof obj !== 'object') {
246
+ return false;
247
+ }
248
+
249
+ return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj));
250
+ }
251
+
252
+ export function combine(a: any, b: any) {
253
+ return [].concat(a, b);
254
+ }
255
+
256
+ export function maybe_map<T>(val: T[], fn: (v: T) => T) {
257
+ if (is_array(val)) {
258
+ const mapped = [];
259
+ for (let i = 0; i < val.length; i += 1) {
260
+ mapped.push(fn(val[i]!));
261
+ }
262
+ return mapped;
263
+ }
264
+ return fn(val);
265
+ }
package/src/lib/.keep ADDED
@@ -0,0 +1,4 @@
1
+ File generated from our OpenAPI spec by Stainless.
2
+
3
+ This directory can be used to store custom files to expand the SDK.
4
+ It is ignored by Stainless code generation and its content (other than this keep file) won't be touched.
@@ -0,0 +1,11 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import type { SnagSolutions } from './index';
4
+
5
+ export class APIResource {
6
+ protected _client: SnagSolutions;
7
+
8
+ constructor(client: SnagSolutions) {
9
+ this._client = client;
10
+ }
11
+ }
@@ -0,0 +1,71 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import * as Core from '../core';
5
+
6
+ export class Assets extends APIResource {
7
+ /**
8
+ * This endpoint allows you to upload a file to the resource. returns a presigned
9
+ * URL and the asset's public URL call put with the file as the body to upload the
10
+ * asst
11
+ */
12
+ create(body: AssetCreateParams, options?: Core.RequestOptions): Core.APIPromise<AssetCreateResponse> {
13
+ return this._client.post('/api/assets', { body, ...options });
14
+ }
15
+ }
16
+
17
+ /**
18
+ * Response returned upon successful generation of the signed URL for uploading the
19
+ * file.
20
+ */
21
+ export interface AssetCreateResponse {
22
+ /**
23
+ * The pre-signed URL to be used for uploading the file.
24
+ */
25
+ signedUrl: string;
26
+
27
+ /**
28
+ * The URL of the uploaded file.
29
+ */
30
+ url: string;
31
+ }
32
+
33
+ export interface AssetCreateParams {
34
+ /**
35
+ * The name of the file, must match the regex pattern (converted to lowercase)
36
+ */
37
+ fileName: string;
38
+
39
+ /**
40
+ * The file path, must be a valid enum value.
41
+ */
42
+ filePath?:
43
+ | 'announcements'
44
+ | 'images'
45
+ | 'videos'
46
+ | 'banners'
47
+ | 'fonts'
48
+ | 'posts'
49
+ | 'profiles'
50
+ | 'minting'
51
+ | 'loyalty';
52
+
53
+ /**
54
+ * UUID of the organization (optional, converted to lowercase)
55
+ */
56
+ organizationId?: string;
57
+
58
+ /**
59
+ * UUID of the user (optional, converted to lowercase)
60
+ */
61
+ userId?: string;
62
+
63
+ /**
64
+ * UUID of the website (optional, converted to lowercase)
65
+ */
66
+ websiteId?: string;
67
+ }
68
+
69
+ export declare namespace Assets {
70
+ export { type AssetCreateResponse as AssetCreateResponse, type AssetCreateParams as AssetCreateParams };
71
+ }
@@ -0,0 +1,123 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../resource';
4
+ import { isRequestOptions } from '../core';
5
+ import * as Core from '../core';
6
+
7
+ export class AuctionBids extends APIResource {
8
+ /**
9
+ * Creates a new bid for an auction.
10
+ */
11
+ create(body: AuctionBidCreateParams, options?: Core.RequestOptions): Core.APIPromise<void> {
12
+ return this._client.post('/api/auction_bids', {
13
+ body,
14
+ ...options,
15
+ headers: { Accept: '*/*', ...options?.headers },
16
+ });
17
+ }
18
+
19
+ /**
20
+ * Returns a list of auction bids with optional filtering and pagination.
21
+ */
22
+ list(query?: AuctionBidListParams, options?: Core.RequestOptions): Core.APIPromise<void>;
23
+ list(options?: Core.RequestOptions): Core.APIPromise<void>;
24
+ list(
25
+ query: AuctionBidListParams | Core.RequestOptions = {},
26
+ options?: Core.RequestOptions,
27
+ ): Core.APIPromise<void> {
28
+ if (isRequestOptions(query)) {
29
+ return this.list({}, query);
30
+ }
31
+ return this._client.get('/api/auction_bids', {
32
+ query,
33
+ ...options,
34
+ headers: { Accept: '*/*', ...options?.headers },
35
+ });
36
+ }
37
+ }
38
+
39
+ export interface AuctionBidCreateParams {
40
+ /**
41
+ * Bid amount
42
+ */
43
+ amount: unknown;
44
+
45
+ /**
46
+ * ID of the auction
47
+ */
48
+ auctionId: string;
49
+
50
+ /**
51
+ * Name of the blockchain chain
52
+ */
53
+ chainName: string;
54
+
55
+ /**
56
+ * ID of the organization
57
+ */
58
+ organizationId: string;
59
+
60
+ /**
61
+ * Signature of the bid
62
+ */
63
+ signature: string;
64
+
65
+ /**
66
+ * ID of the website
67
+ */
68
+ websiteId: string;
69
+ }
70
+
71
+ export interface AuctionBidListParams {
72
+ /**
73
+ * The bid ID
74
+ */
75
+ id?: string;
76
+
77
+ /**
78
+ * ID of the auction
79
+ */
80
+ auctionId?: string;
81
+
82
+ /**
83
+ * Maximum number of bids to return
84
+ */
85
+ limit?: number | null;
86
+
87
+ /**
88
+ * ID of the organization
89
+ */
90
+ organizationId?: string;
91
+
92
+ /**
93
+ * Pagination cursor to start after a specific bid ID
94
+ */
95
+ startingAfter?: string;
96
+
97
+ /**
98
+ * Status of the bid
99
+ */
100
+ status?: 'submitted' | 'accepted' | 'rejected' | 'fulfilled';
101
+
102
+ /**
103
+ * ID of the user who made the bid
104
+ */
105
+ userId?: string;
106
+
107
+ /**
108
+ * Wallet address of the bidder
109
+ */
110
+ walletAddress?: string;
111
+
112
+ /**
113
+ * ID of the website
114
+ */
115
+ websiteId?: string;
116
+ }
117
+
118
+ export declare namespace AuctionBids {
119
+ export {
120
+ type AuctionBidCreateParams as AuctionBidCreateParams,
121
+ type AuctionBidListParams as AuctionBidListParams,
122
+ };
123
+ }
@@ -0,0 +1,25 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as QuestsAPI from './quests';
5
+ import { QuestCompleteParams, QuestCompleteResponse, Quests } from './quests';
6
+ import * as StatusAPI from './status';
7
+ import { Status, StatusRetrieveResponse } from './status';
8
+
9
+ export class Drip extends APIResource {
10
+ quests: QuestsAPI.Quests = new QuestsAPI.Quests(this._client);
11
+ status: StatusAPI.Status = new StatusAPI.Status(this._client);
12
+ }
13
+
14
+ Drip.Quests = Quests;
15
+ Drip.Status = Status;
16
+
17
+ export declare namespace Drip {
18
+ export {
19
+ Quests as Quests,
20
+ type QuestCompleteResponse as QuestCompleteResponse,
21
+ type QuestCompleteParams as QuestCompleteParams,
22
+ };
23
+
24
+ export { Status as Status, type StatusRetrieveResponse as StatusRetrieveResponse };
25
+ }
@@ -0,0 +1,5 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Drip } from './drip';
4
+ export { Quests, type QuestCompleteResponse, type QuestCompleteParams } from './quests';
5
+ export { Status, type StatusRetrieveResponse } from './status';
@@ -0,0 +1,210 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../resource';
4
+ import * as Core from '../../core';
5
+
6
+ export class Quests extends APIResource {
7
+ /**
8
+ * Completes a specified quest for a user and updates their loyalty account balance
9
+ * if applicable. Run asynchronously; use the verification endpoint to check
10
+ * status.
11
+ */
12
+ complete(
13
+ dripQuestId: string,
14
+ body: QuestCompleteParams,
15
+ options?: Core.RequestOptions,
16
+ ): Core.APIPromise<QuestCompleteResponse> {
17
+ return this._client.post(`/api/drip/quests/${dripQuestId}/complete`, { body, ...options });
18
+ }
19
+ }
20
+
21
+ export type QuestCompleteResponse = QuestCompleteResponse.Quest | QuestCompleteResponse.UnionMember1;
22
+
23
+ export namespace QuestCompleteResponse {
24
+ export interface Quest {
25
+ /**
26
+ * Schema for a drip quest
27
+ */
28
+ quest: Quest.Quest;
29
+ }
30
+
31
+ export namespace Quest {
32
+ /**
33
+ * Schema for a drip quest
34
+ */
35
+ export interface Quest {
36
+ /**
37
+ * Unique identifier for the drip quest
38
+ */
39
+ id: string;
40
+
41
+ /**
42
+ * Amount of reward for completing the quest
43
+ */
44
+ amount: number;
45
+
46
+ /**
47
+ * Text to display on the action button
48
+ */
49
+ buttonText: string;
50
+
51
+ /**
52
+ * Timestamp when the quest was claimed, if applicable
53
+ */
54
+ claimedAt: string | null;
55
+
56
+ /**
57
+ * Indicates if the quest has been completed
58
+ */
59
+ completed: boolean;
60
+
61
+ /**
62
+ * Description of the drip quest
63
+ */
64
+ description: string;
65
+
66
+ /**
67
+ * Indicates if the quest has expired
68
+ */
69
+ expired: boolean;
70
+
71
+ /**
72
+ * Expiration timestamp of the quest
73
+ */
74
+ expiresAt: string;
75
+
76
+ /**
77
+ * Message associated with the quest
78
+ */
79
+ message: string;
80
+
81
+ /**
82
+ * Array of requirements for the drip quest
83
+ */
84
+ requirements: Array<Quest.Requirement>;
85
+
86
+ /**
87
+ * Title of the drip quest
88
+ */
89
+ title: string;
90
+ }
91
+
92
+ export namespace Quest {
93
+ /**
94
+ * A requirement for completing the drip quest
95
+ */
96
+ export interface Requirement {
97
+ /**
98
+ * Array of conditions for the requirement
99
+ */
100
+ conditions: Array<Requirement.Condition>;
101
+
102
+ /**
103
+ * Link associated with the requirement
104
+ */
105
+ link: string;
106
+
107
+ /**
108
+ * Type of the requirement
109
+ */
110
+ type: string;
111
+ }
112
+
113
+ export namespace Requirement {
114
+ /**
115
+ * A condition for the requirement
116
+ */
117
+ export interface Condition {
118
+ /**
119
+ * Condition that checks if a user has commented in X
120
+ */
121
+ hasCommentedInX?: Condition.HasCommentedInX;
122
+
123
+ /**
124
+ * Condition that checks if a user has followed X
125
+ */
126
+ hasFollowedX?: Condition.HasFollowedX;
127
+
128
+ /**
129
+ * Condition that checks if a user has liked in X
130
+ */
131
+ hasLikedInX?: Condition.HasLikedInX;
132
+
133
+ /**
134
+ * Condition that checks if a user has reposted in X
135
+ */
136
+ hasRepostedInX?: Condition.HasRepostedInX;
137
+ }
138
+
139
+ export namespace Condition {
140
+ /**
141
+ * Condition that checks if a user has commented in X
142
+ */
143
+ export interface HasCommentedInX {
144
+ /**
145
+ * Value for the condition
146
+ */
147
+ value: string;
148
+ }
149
+
150
+ /**
151
+ * Condition that checks if a user has followed X
152
+ */
153
+ export interface HasFollowedX {
154
+ /**
155
+ * Value for the condition
156
+ */
157
+ value: string;
158
+ }
159
+
160
+ /**
161
+ * Condition that checks if a user has liked in X
162
+ */
163
+ export interface HasLikedInX {
164
+ /**
165
+ * Value for the condition
166
+ */
167
+ value: string;
168
+ }
169
+
170
+ /**
171
+ * Condition that checks if a user has reposted in X
172
+ */
173
+ export interface HasRepostedInX {
174
+ /**
175
+ * Value for the condition
176
+ */
177
+ value: string;
178
+ }
179
+ }
180
+ }
181
+ }
182
+ }
183
+
184
+ export interface UnionMember1 {
185
+ data: UnionMember1.Data;
186
+
187
+ message: string;
188
+ }
189
+
190
+ export namespace UnionMember1 {
191
+ export interface Data {
192
+ verificationId: string;
193
+ }
194
+ }
195
+ }
196
+
197
+ export interface QuestCompleteParams {
198
+ organizationId: string;
199
+
200
+ websiteId: string;
201
+
202
+ userId?: string;
203
+ }
204
+
205
+ export declare namespace Quests {
206
+ export {
207
+ type QuestCompleteResponse as QuestCompleteResponse,
208
+ type QuestCompleteParams as QuestCompleteParams,
209
+ };
210
+ }