|
| 1 | +export interface UUID { |
| 2 | + _sdkType: "UUID"; |
| 3 | + uuid: string; |
| 4 | +} |
| 5 | + |
| 6 | +export interface Money { |
| 7 | + _sdkType: "Money"; |
| 8 | + amount: number; |
| 9 | + currency: string; |
| 10 | +} |
| 11 | + |
| 12 | +export interface ResourceReference { |
| 13 | + id: UUID; |
| 14 | + type: string; |
| 15 | +} |
| 16 | + |
| 17 | +export interface IncludedResource { |
| 18 | + type: string; |
| 19 | + id?: { |
| 20 | + uuid: string; |
| 21 | + }; |
| 22 | + [key: string]: unknown; |
| 23 | +} |
| 24 | + |
| 25 | +export interface TransactionRelationships { |
| 26 | + customer: { |
| 27 | + data: ResourceReference; |
| 28 | + }; |
| 29 | + provider: { |
| 30 | + data: ResourceReference; |
| 31 | + }; |
| 32 | + listing: { |
| 33 | + data: ResourceReference; |
| 34 | + }; |
| 35 | + marketplace?: { |
| 36 | + data: ResourceReference; |
| 37 | + }; |
| 38 | + messages: { |
| 39 | + data: ResourceReference[]; |
| 40 | + }; |
| 41 | +} |
| 42 | + |
| 43 | +export interface TransactionAttributes { |
| 44 | + lastTransition?: string; |
| 45 | + payinTotal?: Money; |
| 46 | + processName?: string; |
| 47 | + metadata?: { |
| 48 | + lastUpdatedAt?: string; |
| 49 | + }; |
| 50 | + transitions?: unknown[]; |
| 51 | + createdAt?: number; |
| 52 | +} |
| 53 | + |
| 54 | +export interface Transaction { |
| 55 | + id: UUID; |
| 56 | + type: string; |
| 57 | + attributes: TransactionAttributes; |
| 58 | + relationships: TransactionRelationships; |
| 59 | +} |
| 60 | + |
| 61 | +export interface UserProfile { |
| 62 | + displayName?: string; |
| 63 | + firstName?: string; |
| 64 | + lastName?: string; |
| 65 | + publicData?: { |
| 66 | + userType?: string; |
| 67 | + [key: string]: unknown; |
| 68 | + }; |
| 69 | +} |
| 70 | + |
| 71 | +export interface UserAttributes { |
| 72 | + email: string; |
| 73 | + profile: UserProfile; |
| 74 | + state?: string; |
| 75 | +} |
| 76 | + |
| 77 | +export interface UserRelationships { |
| 78 | + profileImage?: { |
| 79 | + data?: ResourceReference; |
| 80 | + }; |
| 81 | +} |
| 82 | + |
| 83 | +export interface User { |
| 84 | + id: UUID; |
| 85 | + type: string; |
| 86 | + attributes: UserAttributes; |
| 87 | + relationships?: UserRelationships; |
| 88 | +} |
| 89 | + |
| 90 | +export interface ListingAttributes { |
| 91 | + title: string; |
| 92 | + description?: string; |
| 93 | + state?: string; |
| 94 | + price?: Money; |
| 95 | + publicData?: Record<string, unknown>; |
| 96 | + privateData?: Record<string, unknown>; |
| 97 | + deleted?: boolean; |
| 98 | + geolocation?: unknown; |
| 99 | + createdAt?: number; |
| 100 | + availabilityPlan?: unknown; |
| 101 | + metadata?: Record<string, unknown>; |
| 102 | +} |
| 103 | + |
| 104 | +export interface ListingRelationships { |
| 105 | + author?: { |
| 106 | + data: ResourceReference; |
| 107 | + }; |
| 108 | + marketplace?: { |
| 109 | + data: ResourceReference; |
| 110 | + }; |
| 111 | + currentStock?: { |
| 112 | + data: ResourceReference; |
| 113 | + }; |
| 114 | + images?: { |
| 115 | + data: ResourceReference[]; |
| 116 | + }; |
| 117 | +} |
| 118 | + |
| 119 | +export interface Listing { |
| 120 | + id: UUID; |
| 121 | + type: string; |
| 122 | + attributes: ListingAttributes; |
| 123 | + relationships?: ListingRelationships; |
| 124 | +} |
| 125 | + |
| 126 | +export interface MessageAttributes { |
| 127 | + content: string; |
| 128 | + createdAt: { |
| 129 | + _seconds: number; |
| 130 | + _nanoseconds: number; |
| 131 | + }; |
| 132 | +} |
| 133 | + |
| 134 | +export interface MessageRelationships { |
| 135 | + transaction: { |
| 136 | + data: ResourceReference; |
| 137 | + }; |
| 138 | + sender?: { |
| 139 | + data: ResourceReference; |
| 140 | + }; |
| 141 | + customer?: { |
| 142 | + data: ResourceReference; |
| 143 | + }; |
| 144 | + provider?: { |
| 145 | + data: ResourceReference; |
| 146 | + }; |
| 147 | +} |
| 148 | + |
| 149 | +export interface Message { |
| 150 | + id: UUID; |
| 151 | + type: string; |
| 152 | + attributes: MessageAttributes; |
| 153 | + relationships: MessageRelationships; |
| 154 | +} |
| 155 | + |
| 156 | +export interface EventAttributes { |
| 157 | + sequenceId: number; |
| 158 | + marketplaceId: string; |
| 159 | + eventType: string; |
| 160 | + resourceType: string; |
| 161 | + resourceId: string; |
| 162 | + resource: unknown; |
| 163 | + previousValues?: Record<string, unknown>; |
| 164 | + source?: string; |
| 165 | + createdAt: string; |
| 166 | +} |
| 167 | + |
| 168 | +export interface Event { |
| 169 | + id: UUID; |
| 170 | + type: string; |
| 171 | + attributes: EventAttributes; |
| 172 | +} |
| 173 | + |
| 174 | +export interface MarketplaceAttributes { |
| 175 | + name: string; |
| 176 | + description: string | null; |
| 177 | +} |
| 178 | + |
| 179 | +export interface MarketplaceData { |
| 180 | + id: UUID; |
| 181 | + type: string; |
| 182 | + attributes: MarketplaceAttributes; |
| 183 | +} |
| 184 | + |
| 185 | +export interface MarketplaceShowResponse { |
| 186 | + status: number; |
| 187 | + statusText: string; |
| 188 | + data: { |
| 189 | + data: MarketplaceData; |
| 190 | + }; |
| 191 | +} |
| 192 | + |
| 193 | +export interface QueryMeta { |
| 194 | + totalPages: number; |
| 195 | + totalItems?: number; |
| 196 | + page?: number; |
| 197 | + perPage?: number; |
| 198 | +} |
| 199 | + |
| 200 | +export interface QueryResponse<T> { |
| 201 | + status: number; |
| 202 | + data: { |
| 203 | + data: T[]; |
| 204 | + included?: IncludedResource[]; |
| 205 | + meta: QueryMeta; |
| 206 | + }; |
| 207 | +} |
| 208 | + |
| 209 | +export interface ShowResponse<T> { |
| 210 | + status: number; |
| 211 | + data: { |
| 212 | + data: T; |
| 213 | + included?: IncludedResource[]; |
| 214 | + }; |
| 215 | +} |
| 216 | + |
| 217 | +export interface MutationResponse { |
| 218 | + status: number; |
| 219 | + data: unknown; |
| 220 | +} |
| 221 | + |
| 222 | +export interface IntegrationSdk { |
| 223 | + marketplace: { |
| 224 | + show: () => Promise<MarketplaceShowResponse>; |
| 225 | + }; |
| 226 | + events: { |
| 227 | + query: (params?: { startAfterSequenceId?: number }) => Promise<QueryResponse<Event>>; |
| 228 | + }; |
| 229 | + users: { |
| 230 | + query: (params?: { page?: number; include?: string[] }) => Promise<QueryResponse<User>>; |
| 231 | + show: (params: { id: string; include?: string[] }) => Promise<ShowResponse<User>>; |
| 232 | + updatePermissions: (params: Record<string, unknown>) => Promise<MutationResponse>; |
| 233 | + }; |
| 234 | + transactions: { |
| 235 | + query: (params?: { page?: number; include?: string[] }) => Promise<QueryResponse<Transaction>>; |
| 236 | + transition: ( |
| 237 | + params: { id: string; transition: string; params: Record<string, unknown> }, |
| 238 | + ) => Promise<MutationResponse>; |
| 239 | + updateMetadata: ( |
| 240 | + params: { id: string; metadata: Record<string, unknown> }, |
| 241 | + options?: { expand?: boolean }, |
| 242 | + ) => Promise<MutationResponse>; |
| 243 | + }; |
| 244 | + listings: { |
| 245 | + query: (params?: { page?: number; include?: string[] }) => Promise<QueryResponse<Listing>>; |
| 246 | + }; |
| 247 | +} |
| 248 | + |
| 249 | +export function createInstance(config: { |
| 250 | + clientId: string; |
| 251 | + clientSecret: string; |
| 252 | + queryLimiter?: unknown; |
| 253 | + commandLimiter?: unknown; |
| 254 | +}): IntegrationSdk; |
| 255 | + |
| 256 | +export namespace util { |
| 257 | + function createRateLimiter(config: unknown): unknown; |
| 258 | + const prodQueryLimiterConfig: unknown; |
| 259 | + const prodCommandLimiterConfig: unknown; |
| 260 | +} |
0 commit comments