@snagsolutions/sdk 0.1.0-alpha.13 → 0.1.0-alpha.14

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 (241) hide show
  1. package/CHANGELOG.md +40 -0
  2. package/README.md +1 -1
  3. package/core.d.ts.map +1 -1
  4. package/core.js +12 -6
  5. package/core.js.map +1 -1
  6. package/core.mjs +12 -6
  7. package/core.mjs.map +1 -1
  8. package/index.d.mts +9 -9
  9. package/index.d.ts +9 -9
  10. package/index.d.ts.map +1 -1
  11. package/index.js +1 -1
  12. package/index.js.map +1 -1
  13. package/index.mjs +1 -1
  14. package/index.mjs.map +1 -1
  15. package/package.json +29 -8
  16. package/resources/assets/assets.d.ts +153 -0
  17. package/resources/assets/assets.d.ts.map +1 -0
  18. package/resources/assets/assets.js +69 -0
  19. package/resources/assets/assets.js.map +1 -0
  20. package/resources/assets/assets.mjs +42 -0
  21. package/resources/assets/assets.mjs.map +1 -0
  22. package/resources/assets/index.d.ts +7 -0
  23. package/resources/assets/index.d.ts.map +1 -0
  24. package/resources/assets/index.js +17 -0
  25. package/resources/assets/index.js.map +1 -0
  26. package/resources/assets/index.mjs +8 -0
  27. package/resources/assets/index.mjs.map +1 -0
  28. package/resources/assets/minting.d.ts +95 -0
  29. package/resources/assets/minting.d.ts.map +1 -0
  30. package/resources/assets/minting.js +15 -0
  31. package/resources/assets/minting.js.map +1 -0
  32. package/resources/assets/minting.mjs +11 -0
  33. package/resources/assets/minting.mjs.map +1 -0
  34. package/resources/assets/referral/index.d.ts +3 -0
  35. package/resources/assets/referral/index.d.ts.map +1 -0
  36. package/resources/assets/referral/index.js +9 -0
  37. package/resources/assets/referral/index.js.map +1 -0
  38. package/resources/assets/referral/index.mjs +4 -0
  39. package/resources/assets/referral/index.mjs.map +1 -0
  40. package/resources/assets/referral/referral.d.ts +30 -0
  41. package/resources/assets/referral/referral.d.ts.map +1 -0
  42. package/resources/assets/referral/referral.js +46 -0
  43. package/resources/assets/referral/referral.js.map +1 -0
  44. package/resources/assets/referral/referral.mjs +19 -0
  45. package/resources/assets/referral/referral.mjs.map +1 -0
  46. package/resources/assets/referral/users.d.ts +57 -0
  47. package/resources/assets/referral/users.d.ts.map +1 -0
  48. package/resources/assets/referral/users.js +21 -0
  49. package/resources/assets/referral/users.js.map +1 -0
  50. package/resources/assets/referral/users.mjs +17 -0
  51. package/resources/assets/referral/users.mjs.map +1 -0
  52. package/resources/assets/users.d.ts +285 -0
  53. package/resources/assets/users.d.ts.map +1 -0
  54. package/resources/assets/users.js +34 -0
  55. package/resources/assets/users.js.map +1 -0
  56. package/resources/assets/users.mjs +30 -0
  57. package/resources/assets/users.mjs.map +1 -0
  58. package/resources/assets/website-collections.d.ts +73 -0
  59. package/resources/assets/website-collections.d.ts.map +1 -0
  60. package/resources/assets/website-collections.js +25 -0
  61. package/resources/assets/website-collections.js.map +1 -0
  62. package/resources/assets/website-collections.mjs +21 -0
  63. package/resources/assets/website-collections.mjs.map +1 -0
  64. package/resources/assets/website-user-roles.d.ts +73 -0
  65. package/resources/assets/website-user-roles.d.ts.map +1 -0
  66. package/resources/assets/website-user-roles.js +22 -0
  67. package/resources/assets/website-user-roles.js.map +1 -0
  68. package/resources/assets/website-user-roles.mjs +18 -0
  69. package/resources/assets/website-user-roles.mjs.map +1 -0
  70. package/resources/auction-bids.d.ts +2 -32
  71. package/resources/auction-bids.d.ts.map +1 -1
  72. package/resources/auction-bids.js +0 -10
  73. package/resources/auction-bids.js.map +1 -1
  74. package/resources/auction-bids.mjs +0 -10
  75. package/resources/auction-bids.mjs.map +1 -1
  76. package/resources/drip/drip.d.ts +4 -4
  77. package/resources/drip/drip.d.ts.map +1 -1
  78. package/resources/drip/drip.js.map +1 -1
  79. package/resources/drip/drip.mjs.map +1 -1
  80. package/resources/drip/index.d.ts +2 -2
  81. package/resources/drip/index.d.ts.map +1 -1
  82. package/resources/drip/index.js.map +1 -1
  83. package/resources/drip/index.mjs.map +1 -1
  84. package/resources/drip/quests.d.ts +0 -164
  85. package/resources/drip/quests.d.ts.map +1 -1
  86. package/resources/drip/quests.js +0 -8
  87. package/resources/drip/quests.js.map +1 -1
  88. package/resources/drip/quests.mjs +0 -8
  89. package/resources/drip/quests.mjs.map +1 -1
  90. package/resources/drip/status.d.ts +0 -22
  91. package/resources/drip/status.d.ts.map +1 -1
  92. package/resources/drip/status.js +0 -7
  93. package/resources/drip/status.js.map +1 -1
  94. package/resources/drip/status.mjs +0 -7
  95. package/resources/drip/status.mjs.map +1 -1
  96. package/resources/index.d.ts +2 -2
  97. package/resources/index.d.ts.map +1 -1
  98. package/resources/index.js +1 -1
  99. package/resources/index.js.map +1 -1
  100. package/resources/index.mjs +1 -1
  101. package/resources/index.mjs.map +1 -1
  102. package/resources/loyalty/accounts.d.ts +0 -153
  103. package/resources/loyalty/accounts.d.ts.map +1 -1
  104. package/resources/loyalty/accounts.js +0 -7
  105. package/resources/loyalty/accounts.js.map +1 -1
  106. package/resources/loyalty/accounts.mjs +0 -7
  107. package/resources/loyalty/accounts.mjs.map +1 -1
  108. package/resources/loyalty/badges.d.ts +639 -72
  109. package/resources/loyalty/badges.d.ts.map +1 -1
  110. package/resources/loyalty/currencies.d.ts +1 -7
  111. package/resources/loyalty/currencies.d.ts.map +1 -1
  112. package/resources/loyalty/index.d.ts +3 -3
  113. package/resources/loyalty/index.d.ts.map +1 -1
  114. package/resources/loyalty/index.js +2 -2
  115. package/resources/loyalty/index.js.map +1 -1
  116. package/resources/loyalty/index.mjs +1 -1
  117. package/resources/loyalty/index.mjs.map +1 -1
  118. package/resources/loyalty/loyalty.d.ts +7 -7
  119. package/resources/loyalty/loyalty.d.ts.map +1 -1
  120. package/resources/loyalty/loyalty.js +2 -2
  121. package/resources/loyalty/loyalty.js.map +1 -1
  122. package/resources/loyalty/loyalty.mjs +2 -2
  123. package/resources/loyalty/loyalty.mjs.map +1 -1
  124. package/resources/loyalty/multipliers.d.ts +29 -4
  125. package/resources/loyalty/multipliers.d.ts.map +1 -1
  126. package/resources/loyalty/multipliers.js +3 -3
  127. package/resources/loyalty/multipliers.js.map +1 -1
  128. package/resources/loyalty/multipliers.mjs +3 -3
  129. package/resources/loyalty/multipliers.mjs.map +1 -1
  130. package/resources/loyalty/rule-edits.d.ts +1 -1
  131. package/resources/loyalty/rule-edits.d.ts.map +1 -1
  132. package/resources/loyalty/rule-edits.js +1 -1
  133. package/resources/loyalty/rule-edits.js.map +1 -1
  134. package/resources/loyalty/rule-edits.mjs +1 -1
  135. package/resources/loyalty/rule-edits.mjs.map +1 -1
  136. package/resources/loyalty/rules.d.ts +132 -71
  137. package/resources/loyalty/rules.d.ts.map +1 -1
  138. package/resources/loyalty/transaction-entries/accounts.d.ts +191 -0
  139. package/resources/loyalty/transaction-entries/accounts.d.ts.map +1 -0
  140. package/resources/loyalty/transaction-entries/accounts.js +24 -0
  141. package/resources/loyalty/transaction-entries/accounts.js.map +1 -0
  142. package/resources/loyalty/transaction-entries/accounts.mjs +20 -0
  143. package/resources/loyalty/transaction-entries/accounts.mjs.map +1 -0
  144. package/resources/loyalty/transaction-entries/index.d.ts +5 -0
  145. package/resources/loyalty/transaction-entries/index.d.ts.map +1 -0
  146. package/resources/loyalty/transaction-entries/index.js +13 -0
  147. package/resources/loyalty/transaction-entries/index.js.map +1 -0
  148. package/resources/loyalty/transaction-entries/index.mjs +6 -0
  149. package/resources/loyalty/transaction-entries/index.mjs.map +1 -0
  150. package/resources/loyalty/transaction-entries/questions-responses.d.ts +97 -0
  151. package/resources/loyalty/transaction-entries/questions-responses.d.ts.map +1 -0
  152. package/resources/loyalty/transaction-entries/questions-responses.js +22 -0
  153. package/resources/loyalty/transaction-entries/questions-responses.js.map +1 -0
  154. package/resources/loyalty/transaction-entries/questions-responses.mjs +18 -0
  155. package/resources/loyalty/transaction-entries/questions-responses.mjs.map +1 -0
  156. package/resources/loyalty/transaction-entries/questions.d.ts +150 -0
  157. package/resources/loyalty/transaction-entries/questions.d.ts.map +1 -0
  158. package/resources/loyalty/transaction-entries/questions.js +27 -0
  159. package/resources/loyalty/transaction-entries/questions.js.map +1 -0
  160. package/resources/loyalty/transaction-entries/questions.mjs +23 -0
  161. package/resources/loyalty/transaction-entries/questions.mjs.map +1 -0
  162. package/resources/loyalty/transaction-entries/transaction-entries.d.ts +300 -0
  163. package/resources/loyalty/transaction-entries/transaction-entries.d.ts.map +1 -0
  164. package/resources/loyalty/transaction-entries/transaction-entries.js +66 -0
  165. package/resources/loyalty/transaction-entries/transaction-entries.js.map +1 -0
  166. package/resources/loyalty/transaction-entries/transaction-entries.mjs +39 -0
  167. package/resources/loyalty/transaction-entries/transaction-entries.mjs.map +1 -0
  168. package/resources/users/index.d.ts +2 -2
  169. package/resources/users/index.d.ts.map +1 -1
  170. package/resources/users/index.js.map +1 -1
  171. package/resources/users/index.mjs +2 -2
  172. package/resources/users/index.mjs.map +1 -1
  173. package/resources/users/metadatas.d.ts +79 -11
  174. package/resources/users/metadatas.d.ts.map +1 -1
  175. package/resources/users/metadatas.js +6 -0
  176. package/resources/users/metadatas.js.map +1 -1
  177. package/resources/users/metadatas.mjs +6 -0
  178. package/resources/users/metadatas.mjs.map +1 -1
  179. package/resources/users/users.d.ts +4 -4
  180. package/resources/users/users.d.ts.map +1 -1
  181. package/resources/users/users.js.map +1 -1
  182. package/resources/users/users.mjs +2 -2
  183. package/resources/users/users.mjs.map +1 -1
  184. package/resources/users/wallets.d.ts +0 -189
  185. package/resources/users/wallets.d.ts.map +1 -1
  186. package/resources/users/wallets.js +0 -19
  187. package/resources/users/wallets.js.map +1 -1
  188. package/resources/users/wallets.mjs +0 -19
  189. package/resources/users/wallets.mjs.map +1 -1
  190. package/src/core.ts +14 -6
  191. package/src/index.ts +14 -12
  192. package/src/resources/assets/assets.ts +294 -0
  193. package/src/resources/assets/index.ts +38 -0
  194. package/src/resources/assets/minting.ts +153 -0
  195. package/src/resources/assets/referral/index.ts +14 -0
  196. package/src/resources/assets/referral/referral.ts +74 -0
  197. package/src/resources/assets/referral/users.ts +99 -0
  198. package/src/resources/assets/users.ts +415 -0
  199. package/src/resources/assets/website-collections.ts +147 -0
  200. package/src/resources/assets/website-user-roles.ts +107 -0
  201. package/src/resources/auction-bids.ts +2 -48
  202. package/src/resources/drip/drip.ts +4 -8
  203. package/src/resources/drip/index.ts +2 -2
  204. package/src/resources/drip/quests.ts +1 -206
  205. package/src/resources/drip/status.ts +1 -29
  206. package/src/resources/index.ts +7 -2
  207. package/src/resources/loyalty/accounts.ts +1 -195
  208. package/src/resources/loyalty/badges.ts +779 -77
  209. package/src/resources/loyalty/currencies.ts +1 -7
  210. package/src/resources/loyalty/index.ts +7 -2
  211. package/src/resources/loyalty/loyalty.ts +14 -8
  212. package/src/resources/loyalty/multipliers.ts +49 -4
  213. package/src/resources/loyalty/rule-edits.ts +2 -2
  214. package/src/resources/loyalty/rules.ts +247 -159
  215. package/src/resources/loyalty/transaction-entries/accounts.ts +251 -0
  216. package/src/resources/loyalty/transaction-entries/index.ts +34 -0
  217. package/src/resources/loyalty/transaction-entries/questions-responses.ts +146 -0
  218. package/src/resources/loyalty/transaction-entries/questions.ts +208 -0
  219. package/src/resources/loyalty/transaction-entries/transaction-entries.ts +525 -0
  220. package/src/resources/users/index.ts +8 -9
  221. package/src/resources/users/metadatas.ts +109 -10
  222. package/src/resources/users/users.ts +11 -17
  223. package/src/resources/users/wallets.ts +1 -267
  224. package/src/version.ts +1 -1
  225. package/version.d.ts +1 -1
  226. package/version.js +1 -1
  227. package/version.mjs +1 -1
  228. package/resources/assets.d.ts +0 -50
  229. package/resources/assets.d.ts.map +0 -1
  230. package/resources/assets.js +0 -17
  231. package/resources/assets.js.map +0 -1
  232. package/resources/assets.mjs +0 -13
  233. package/resources/assets.mjs.map +0 -1
  234. package/resources/loyalty/transaction-entries.d.ts +0 -175
  235. package/resources/loyalty/transaction-entries.d.ts.map +0 -1
  236. package/resources/loyalty/transaction-entries.js +0 -16
  237. package/resources/loyalty/transaction-entries.js.map +0 -1
  238. package/resources/loyalty/transaction-entries.mjs +0 -12
  239. package/resources/loyalty/transaction-entries.mjs.map +0 -1
  240. package/src/resources/assets.ts +0 -71
  241. package/src/resources/loyalty/transaction-entries.ts +0 -229
@@ -0,0 +1,251 @@
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 Accounts extends APIResource {
8
+ /**
9
+ * Get loyalty accounts
10
+ */
11
+ list(query?: AccountListParams, options?: Core.RequestOptions): Core.APIPromise<AccountListResponse>;
12
+ list(options?: Core.RequestOptions): Core.APIPromise<AccountListResponse>;
13
+ list(
14
+ query: AccountListParams | Core.RequestOptions = {},
15
+ options?: Core.RequestOptions,
16
+ ): Core.APIPromise<AccountListResponse> {
17
+ if (isRequestOptions(query)) {
18
+ return this.list({}, query);
19
+ }
20
+ return this._client.get('/api/loyalty/accounts', { query, ...options });
21
+ }
22
+
23
+ /**
24
+ * Returns the user's rank determined by their loyalty points for the specified
25
+ * loyalty currency. This can be a slow operation for large organizations. We
26
+ * recommend caching when possible.
27
+ */
28
+ retrieveRank(
29
+ pathId: string,
30
+ query: AccountRetrieveRankParams,
31
+ options?: Core.RequestOptions,
32
+ ): Core.APIPromise<AccountRetrieveRankResponse> {
33
+ return this._client.get(`/api/loyalty/accounts/${pathId}/rank`, { query, ...options });
34
+ }
35
+ }
36
+
37
+ /**
38
+ * Schema for the response of getting loyalty accounts
39
+ */
40
+ export interface AccountListResponse {
41
+ /**
42
+ * Array of loyalty accounts
43
+ */
44
+ data: Array<AccountListResponse.Data>;
45
+
46
+ /**
47
+ * Indicates if there is a next page of results
48
+ */
49
+ hasNextPage: boolean;
50
+
51
+ /**
52
+ * Optional message
53
+ */
54
+ message?: string;
55
+ }
56
+
57
+ export namespace AccountListResponse {
58
+ /**
59
+ * Schema for a loyalty account
60
+ */
61
+ export interface Data {
62
+ /**
63
+ * Unique identifier for the loyalty account
64
+ */
65
+ id: string;
66
+
67
+ /**
68
+ * Unique identifier for the loyalty currency
69
+ */
70
+ loyaltyCurrencyId: string;
71
+
72
+ /**
73
+ * User associated with the loyalty account
74
+ */
75
+ user: Data.User | null;
76
+
77
+ /**
78
+ * Unique identifier for the user
79
+ */
80
+ userId: string | null;
81
+
82
+ /**
83
+ * Balance amount in the loyalty account
84
+ */
85
+ amount?: unknown;
86
+
87
+ /**
88
+ * Version number used for optimistic locking
89
+ */
90
+ lockVersion?: unknown;
91
+ }
92
+
93
+ export namespace Data {
94
+ /**
95
+ * Schema for a user
96
+ */
97
+ export interface User {
98
+ /**
99
+ * Unique identifier for the user
100
+ */
101
+ id: string;
102
+
103
+ /**
104
+ * Array of metadata associated with the user
105
+ */
106
+ userMetadata: Array<User.UserMetadata>;
107
+
108
+ /**
109
+ * Ethereum wallet address of the user
110
+ */
111
+ walletAddress: string | null;
112
+ }
113
+
114
+ export namespace User {
115
+ /**
116
+ * Schema for user metadata
117
+ */
118
+ export interface UserMetadata {
119
+ /**
120
+ * Discord username associated with the user
121
+ */
122
+ discordUser: string | null;
123
+
124
+ /**
125
+ * Display name of the user
126
+ */
127
+ displayName: string | null;
128
+
129
+ /**
130
+ * URL of the user's logo
131
+ */
132
+ logoUrl: string | null;
133
+
134
+ /**
135
+ * Twitter username associated with the user
136
+ */
137
+ twitterUser: string | null;
138
+
139
+ /**
140
+ * Identifier for the wallet group
141
+ */
142
+ walletGroupIdentifier: string | null;
143
+ }
144
+ }
145
+ }
146
+ }
147
+
148
+ export interface AccountRetrieveRankResponse {
149
+ /**
150
+ * Rank of the user
151
+ */
152
+ rank: number;
153
+ }
154
+
155
+ export interface AccountListParams {
156
+ /**
157
+ * Discord username to filter accounts by
158
+ */
159
+ discordUser?: string;
160
+
161
+ /**
162
+ * Maximum number of accounts to return
163
+ */
164
+ limit?: number;
165
+
166
+ /**
167
+ * Unique identifier for the loyalty currency
168
+ */
169
+ loyaltyCurrencyId?: string;
170
+
171
+ /**
172
+ * Order the accounts by amount in ascending or descending order
173
+ */
174
+ 'orderBy[amount]'?: 'asc' | 'desc';
175
+
176
+ /**
177
+ * Unique identifier for the organization to filter by
178
+ */
179
+ organizationId?: string;
180
+
181
+ /**
182
+ * Pagination cursor to start after a specific account ID
183
+ */
184
+ startingAfter?: string;
185
+
186
+ /**
187
+ * Twitter username to filter accounts by
188
+ */
189
+ twitterUser?: string;
190
+
191
+ /**
192
+ * External identifier for the user group controlled by you
193
+ */
194
+ userGroupExternalIdentifier?: string;
195
+
196
+ /**
197
+ * Unique identifier for the user group
198
+ */
199
+ userGroupId?: string;
200
+
201
+ /**
202
+ * User ID(s) to filter accounts by
203
+ */
204
+ userId?: string | Array<string>;
205
+
206
+ /**
207
+ * Wallet address(es) to filter accounts by
208
+ */
209
+ walletAddress?: string | Array<string>;
210
+
211
+ /**
212
+ * Wallet group identifier to filter accounts by
213
+ */
214
+ walletGroupIdentifier?: string;
215
+
216
+ /**
217
+ * Unique identifier for the website to filter by
218
+ */
219
+ websiteId?: string;
220
+ }
221
+
222
+ export interface AccountRetrieveRankParams {
223
+ /**
224
+ * UUID of the account
225
+ */
226
+ query_id: string;
227
+
228
+ /**
229
+ * UUID of the loyalty currency
230
+ */
231
+ loyaltyCurrencyId: string;
232
+
233
+ /**
234
+ * UUID of the organization
235
+ */
236
+ organizationId: string;
237
+
238
+ /**
239
+ * UUID of the website
240
+ */
241
+ websiteId: string;
242
+ }
243
+
244
+ export declare namespace Accounts {
245
+ export {
246
+ type AccountListResponse as AccountListResponse,
247
+ type AccountRetrieveRankResponse as AccountRetrieveRankResponse,
248
+ type AccountListParams as AccountListParams,
249
+ type AccountRetrieveRankParams as AccountRetrieveRankParams,
250
+ };
251
+ }
@@ -0,0 +1,34 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export {
4
+ Accounts,
5
+ type AccountListResponse,
6
+ type AccountRetrieveRankResponse,
7
+ type AccountListParams,
8
+ type AccountRetrieveRankParams,
9
+ } from './accounts';
10
+ export {
11
+ Questions,
12
+ type QuestionCreateResponse,
13
+ type QuestionUpdateResponse,
14
+ type QuestionListResponse,
15
+ type QuestionCreateParams,
16
+ type QuestionUpdateParams,
17
+ type QuestionListParams,
18
+ } from './questions';
19
+ export {
20
+ QuestionsResponses,
21
+ type QuestionsResponseListResponse,
22
+ type QuestionsResponseSubmitResponse,
23
+ type QuestionsResponseListParams,
24
+ type QuestionsResponseSubmitParams,
25
+ } from './questions-responses';
26
+ export {
27
+ TransactionEntries,
28
+ type TransactionEntryListResponse,
29
+ type TransactionEntryCreateTransactionResponse,
30
+ type TransactionEntryListRuleGroupsResponse,
31
+ type TransactionEntryListParams,
32
+ type TransactionEntryCreateTransactionParams,
33
+ type TransactionEntryListRuleGroupsParams,
34
+ } from './transaction-entries';
@@ -0,0 +1,146 @@
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 QuestionsResponses extends APIResource {
8
+ /**
9
+ * Retrieve responses submitted by the authenticated user, optionally filtered by
10
+ * question IDs
11
+ */
12
+ list(
13
+ query?: QuestionsResponseListParams,
14
+ options?: Core.RequestOptions,
15
+ ): Core.APIPromise<QuestionsResponseListResponse>;
16
+ list(options?: Core.RequestOptions): Core.APIPromise<QuestionsResponseListResponse>;
17
+ list(
18
+ query: QuestionsResponseListParams | Core.RequestOptions = {},
19
+ options?: Core.RequestOptions,
20
+ ): Core.APIPromise<QuestionsResponseListResponse> {
21
+ if (isRequestOptions(query)) {
22
+ return this.list({}, query);
23
+ }
24
+ return this._client.get('/api/loyalty/questions_responses', { query, ...options });
25
+ }
26
+
27
+ /**
28
+ * This endpoint allows you to submit a response to a question.
29
+ */
30
+ submit(
31
+ body: QuestionsResponseSubmitParams,
32
+ options?: Core.RequestOptions,
33
+ ): Core.APIPromise<QuestionsResponseSubmitResponse> {
34
+ return this._client.post('/api/loyalty/questions_responses', { body, ...options });
35
+ }
36
+ }
37
+
38
+ /**
39
+ * List of question responses with details
40
+ */
41
+ export interface QuestionsResponseListResponse {
42
+ responses: Array<QuestionsResponseListResponse.Response>;
43
+ }
44
+
45
+ export namespace QuestionsResponseListResponse {
46
+ /**
47
+ * Response details including the question and choice information
48
+ */
49
+ export interface Response {
50
+ id: string;
51
+
52
+ createdAt: string;
53
+
54
+ isCorrect: boolean;
55
+
56
+ loyaltyQuestionChoiceId: string;
57
+
58
+ loyaltyQuestionId: string;
59
+
60
+ question: Response.Question;
61
+
62
+ userId: string;
63
+ }
64
+
65
+ export namespace Response {
66
+ export interface Question {
67
+ loyaltyQuestionChoices: Array<Question.LoyaltyQuestionChoice>;
68
+
69
+ text: string;
70
+ }
71
+
72
+ export namespace Question {
73
+ export interface LoyaltyQuestionChoice {
74
+ id: string;
75
+
76
+ isCorrect: boolean;
77
+
78
+ text: string;
79
+ }
80
+ }
81
+ }
82
+ }
83
+
84
+ /**
85
+ * Response returned when submitting an answer to a question
86
+ */
87
+ export interface QuestionsResponseSubmitResponse {
88
+ /**
89
+ * Whether the user had already submitted an answer to this question
90
+ */
91
+ alreadySubmitted: boolean;
92
+
93
+ /**
94
+ * Whether the submitted answer was correct
95
+ */
96
+ isCorrect: boolean;
97
+
98
+ response: QuestionsResponseSubmitResponse.Response;
99
+ }
100
+
101
+ export namespace QuestionsResponseSubmitResponse {
102
+ export interface Response {
103
+ /**
104
+ * UUID of the response
105
+ */
106
+ id: string;
107
+
108
+ /**
109
+ * UUID of the selected choice
110
+ */
111
+ loyaltyQuestionChoiceId: string;
112
+
113
+ /**
114
+ * UUID of the question being answered
115
+ */
116
+ loyaltyQuestionId: string;
117
+
118
+ /**
119
+ * UUID of the user who submitted the response
120
+ */
121
+ userId: string;
122
+ }
123
+ }
124
+
125
+ export interface QuestionsResponseListParams {
126
+ /**
127
+ * UUID(s) of the questions to filter responses
128
+ */
129
+ questionsId?: string | Array<string>;
130
+ }
131
+
132
+ export interface QuestionsResponseSubmitParams {
133
+ /**
134
+ * UUID of the selected choice
135
+ */
136
+ loyaltyQuestionChoiceId: string;
137
+ }
138
+
139
+ export declare namespace QuestionsResponses {
140
+ export {
141
+ type QuestionsResponseListResponse as QuestionsResponseListResponse,
142
+ type QuestionsResponseSubmitResponse as QuestionsResponseSubmitResponse,
143
+ type QuestionsResponseListParams as QuestionsResponseListParams,
144
+ type QuestionsResponseSubmitParams as QuestionsResponseSubmitParams,
145
+ };
146
+ }
@@ -0,0 +1,208 @@
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 Questions extends APIResource {
7
+ /**
8
+ * This endpoint allows you to create a new question.
9
+ */
10
+ create(body: QuestionCreateParams, options?: Core.RequestOptions): Core.APIPromise<QuestionCreateResponse> {
11
+ return this._client.post('/api/loyalty/questions', { body, ...options });
12
+ }
13
+
14
+ /**
15
+ * This endpoint allows you to update an existing question.
16
+ */
17
+ update(
18
+ id: string,
19
+ body: QuestionUpdateParams,
20
+ options?: Core.RequestOptions,
21
+ ): Core.APIPromise<QuestionUpdateResponse> {
22
+ return this._client.post(`/api/loyalty/questions/${id}`, { body, ...options });
23
+ }
24
+
25
+ /**
26
+ * This endpoint allows you to fetch questions for a loyalty rule.
27
+ */
28
+ list(query: QuestionListParams, options?: Core.RequestOptions): Core.APIPromise<QuestionListResponse> {
29
+ return this._client.get('/api/loyalty/questions', { query, ...options });
30
+ }
31
+ }
32
+
33
+ /**
34
+ * Response returned for a question
35
+ */
36
+ export interface QuestionCreateResponse {
37
+ id: string;
38
+
39
+ loyaltyQuestionChoices: Array<QuestionCreateResponse.LoyaltyQuestionChoice>;
40
+
41
+ text: string;
42
+ }
43
+
44
+ export namespace QuestionCreateResponse {
45
+ export interface LoyaltyQuestionChoice {
46
+ id: string;
47
+
48
+ sortIdentifier: number;
49
+
50
+ text: string;
51
+ }
52
+ }
53
+
54
+ /**
55
+ * Response returned for a question
56
+ */
57
+ export interface QuestionUpdateResponse {
58
+ id: string;
59
+
60
+ loyaltyQuestionChoices: Array<QuestionUpdateResponse.LoyaltyQuestionChoice>;
61
+
62
+ text: string;
63
+ }
64
+
65
+ export namespace QuestionUpdateResponse {
66
+ export interface LoyaltyQuestionChoice {
67
+ id: string;
68
+
69
+ sortIdentifier: number;
70
+
71
+ text: string;
72
+ }
73
+ }
74
+
75
+ export type QuestionListResponse = Array<QuestionListResponse.QuestionListResponseItem>;
76
+
77
+ export namespace QuestionListResponse {
78
+ /**
79
+ * Response returned for a question
80
+ */
81
+ export interface QuestionListResponseItem {
82
+ id: string;
83
+
84
+ loyaltyQuestionChoices: Array<QuestionListResponseItem.LoyaltyQuestionChoice>;
85
+
86
+ text: string;
87
+ }
88
+
89
+ export namespace QuestionListResponseItem {
90
+ export interface LoyaltyQuestionChoice {
91
+ id: string;
92
+
93
+ sortIdentifier: number;
94
+
95
+ text: string;
96
+ }
97
+ }
98
+ }
99
+
100
+ export interface QuestionCreateParams {
101
+ /**
102
+ * Array of choices for the question
103
+ */
104
+ loyaltyQuestionAnswers: Array<QuestionCreateParams.LoyaltyQuestionAnswer>;
105
+
106
+ /**
107
+ * UUID of the loyalty rule
108
+ */
109
+ loyaltyRuleId: string;
110
+
111
+ /**
112
+ * The text of the question
113
+ */
114
+ questionText: string;
115
+
116
+ /**
117
+ * Whether the question allows multiple attempts
118
+ */
119
+ allowMultipleAttempts?: boolean;
120
+ }
121
+
122
+ export namespace QuestionCreateParams {
123
+ export interface LoyaltyQuestionAnswer {
124
+ /**
125
+ * Whether this choice is correct
126
+ */
127
+ isCorrect: boolean;
128
+
129
+ /**
130
+ * The order in which to display the choice
131
+ */
132
+ sortIdentifier: number;
133
+
134
+ /**
135
+ * The text of the choice
136
+ */
137
+ text: string;
138
+
139
+ /**
140
+ * UUID of the choice (optional for new choices)
141
+ */
142
+ id?: string;
143
+ }
144
+ }
145
+
146
+ export interface QuestionUpdateParams {
147
+ /**
148
+ * Array of choices for the question
149
+ */
150
+ loyaltyQuestionAnswers: Array<QuestionUpdateParams.LoyaltyQuestionAnswer>;
151
+
152
+ /**
153
+ * The text of the question
154
+ */
155
+ questionText: string;
156
+ }
157
+
158
+ export namespace QuestionUpdateParams {
159
+ export interface LoyaltyQuestionAnswer {
160
+ /**
161
+ * Whether this choice is correct
162
+ */
163
+ isCorrect: boolean;
164
+
165
+ /**
166
+ * The order in which to display the choice
167
+ */
168
+ sortIdentifier: number;
169
+
170
+ /**
171
+ * The text of the choice
172
+ */
173
+ text: string;
174
+
175
+ /**
176
+ * UUID of the choice (optional for new choices)
177
+ */
178
+ id?: string;
179
+ }
180
+ }
181
+
182
+ export interface QuestionListParams {
183
+ /**
184
+ * UUID of the loyalty rule to fetch questions for
185
+ */
186
+ loyaltyRuleIds: string | Array<string>;
187
+
188
+ /**
189
+ * UUID of the organization to fetch questions for
190
+ */
191
+ organizationId: string;
192
+
193
+ /**
194
+ * UUID of the website to fetch questions for
195
+ */
196
+ websiteId: string;
197
+ }
198
+
199
+ export declare namespace Questions {
200
+ export {
201
+ type QuestionCreateResponse as QuestionCreateResponse,
202
+ type QuestionUpdateResponse as QuestionUpdateResponse,
203
+ type QuestionListResponse as QuestionListResponse,
204
+ type QuestionCreateParams as QuestionCreateParams,
205
+ type QuestionUpdateParams as QuestionUpdateParams,
206
+ type QuestionListParams as QuestionListParams,
207
+ };
208
+ }