@itm-studio/partner-sdk 0.6.6 → 0.6.7

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.
package/README.md CHANGED
@@ -2169,9 +2169,9 @@ const { createPartnerBrandSubscription: signup } = await itm.mutation({
2169
2169
  // signup.verificationRequired === false; no OTP or user login step is required.
2170
2170
  ```
2171
2171
 
2172
- - `createPartnerBrandDrop` supports `ctaType: 'SUBSCRIBE'`. Upload/register an
2173
- image with `getPartnerUploadUrl` and `createPartnerMediaAsset`, or select an
2174
- existing image with `getPartnerMediaAssets`. Both cover images must be active
2172
+ - `createPartnerBrandDrop` supports `ctaType: 'SUBSCRIBE'`. Upload an image
2173
+ with `uploadPartnerMedia`, or select an existing image with
2174
+ `getPartnerMediaAssets`. Both cover images must be active
2175
2175
  assets owned by this brand. Save the returned drop UID and reuse it for signups;
2176
2176
  retrying drop creation creates another drop.
2177
2177
  - `dropUid` is optional. Supplying it creates both the brand subscription and the
@@ -2405,50 +2405,129 @@ export async function finishOtpSubscription(
2405
2405
 
2406
2406
  ### Media Upload Flow
2407
2407
 
2408
- Uploading media (e.g. cover images) is a two-step process:
2408
+ Uploads go straight from your server to storage; the file never passes through
2409
+ the ITM API. `uploadPartnerMedia` runs the whole flow and returns the asset:
2409
2410
 
2410
- #### Step 1: `getPartnerUploadUrl`
2411
+ ```typescript
2412
+ import {
2413
+ createITMPartnerClient,
2414
+ uploadPartnerMedia,
2415
+ } from "@itm-studio/partner-sdk";
2411
2416
 
2412
- Get a presigned S3 URL to upload a file directly.
2417
+ const itm = createITMPartnerClient({ token: process.env.ITM_PARTNER_TOKEN! });
2413
2418
 
2414
- ```typescript
2415
- const { getPartnerUploadUrl } = await itm.mutation({
2416
- getPartnerUploadUrl: {
2417
- __args: { filename: "event-cover", fileExtension: "jpg" },
2418
- url: true,
2419
- filename: true,
2420
- },
2421
- });
2419
+ // From a file on disk (streamed on Node 20+)
2420
+ const asset = await uploadPartnerMedia(itm, { path: "./event-cover.jpg" });
2422
2421
 
2423
- // Upload the file to S3 using the presigned URL
2424
- await fetch(getPartnerUploadUrl.url, {
2425
- method: "PUT",
2426
- body: fileBuffer, // Buffer, Blob, or ReadableStream
2427
- headers: { "Content-Type": "image/jpeg" },
2428
- });
2422
+ // Or from bytes you already hold: a Buffer, Uint8Array, ArrayBuffer or Blob
2423
+ const fromBytes = await uploadPartnerMedia(itm, { data: fileBuffer });
2424
+
2425
+ // asset.uid is the coverImageUid for createPartnerMoment
2426
+ console.log(asset.uid, asset.url, asset.dimensions);
2427
+ ```
2428
+
2429
+ It returns `uid`, `url`, `mimeType`, `size`, `dimensions` and `createdAt`.
2430
+
2431
+ | Kind | Types | Largest file |
2432
+ | ----- | --------------------------------------------------------------------------------- | ------------ |
2433
+ | Image | `image/jpeg`, `image/png`, `image/gif`, `image/webp`, `image/avif` | 25 MB |
2434
+ | Audio | `audio/mpeg`, `audio/mp4`, `audio/wav`, `audio/flac`, `audio/ogg`, `audio/webm` | 250 MB |
2435
+ | Video | `video/mp4`, `video/quicktime`, `video/webm` | 1 GB |
2436
+
2437
+ - **Type.** The helper reads the type from the file's first bytes, so you do not
2438
+ have to pass one. If you pass `contentType` (or a `Blob` with a `type`) and the
2439
+ file is something else, it throws before any request is made. SVG, PDF and
2440
+ other formats are refused.
2441
+ - **Dimensions.** ITM measures images from the file, so there is nothing to
2442
+ compute. For a video, pass the frame size as the third argument when you know
2443
+ it: `uploadPartnerMedia(itm, source, { dimensions: { width: 1920, height: 1080 } })`.
2444
+ - **Video and audio** are queued for streaming after the upload completes;
2445
+ Query the asset for `transforms.hls` after processing if your credentials allow it.
2446
+ - **Cancelling.** Pass `{ signal }` to cancel the storage upload and stop
2447
+ between steps. Pass the same signal when creating the client to also cancel
2448
+ an ITM API call in flight.
2449
+
2450
+ #### Errors
2451
+
2452
+ | Thrown | When |
2453
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------- |
2454
+ | `ITMPartnerMediaUploadError` | `stage: "read"`: the file is missing, empty or not a supported format. `stage: "upload"`: storage refused the bytes or could not be reached; `status` holds the HTTP status when there was a response. |
2455
+ | `GenqlError` | ITM rejected the request: the type or size is not allowed, or the stored file failed verification. |
2456
+ | `ITMPartnerTransportError` | The ITM API itself failed. A lost response to the final step is retried once, because that step is repeatable. |
2457
+
2458
+ The upload URL is a credential. It never appears in an error message; keep it
2459
+ out of your own logs too.
2460
+
2461
+ #### Uploading a file from a URL
2462
+
2463
+ Fetch it yourself and pass the bytes:
2464
+
2465
+ ```typescript
2466
+ const response = await fetch(imageUrl);
2467
+ if (!response.ok) throw new Error(`Download failed: ${response.status}`);
2468
+ const asset = await uploadPartnerMedia(itm, { data: await response.blob() });
2429
2469
  ```
2430
2470
 
2431
- #### Step 2: `createPartnerMediaAsset`
2471
+ If the URL comes from a user or any other source you do not control, validate
2472
+ it before fetching: your server would otherwise fetch whatever address it is
2473
+ given, including ones inside your own network.
2474
+
2475
+ #### The three steps, if you need them separately
2432
2476
 
2433
- After uploading, register the asset so it's linked to your brand.
2477
+ Use these when the bytes are not on the server that holds the token, for
2478
+ example when another service performs the PUT.
2434
2479
 
2435
2480
  ```typescript
2436
- const { createPartnerMediaAsset } = await itm.mutation({
2437
- createPartnerMediaAsset: {
2481
+ // 1. Reserve an upload for exactly this type and size
2482
+ const { createPartnerMediaUpload: upload } = await itm.mutation({
2483
+ createPartnerMediaUpload: {
2438
2484
  __args: {
2439
- mimetype: "image/jpeg",
2440
- filename: getPartnerUploadUrl.filename, // from Step 1
2441
- dimensions: { width: 1920, height: 1080 },
2485
+ input: { contentType: "image/jpeg", byteSize: fileBuffer.byteLength },
2442
2486
  },
2487
+ uploadKey: true,
2488
+ uploadUrl: true,
2489
+ expiresAt: true,
2490
+ },
2491
+ });
2492
+
2493
+ // 2. PUT the bytes. Content-Type and the byte count are part of the signature,
2494
+ // so they must match step 1 exactly. The URL works for 15 minutes.
2495
+ await fetch(upload.uploadUrl, {
2496
+ method: "PUT",
2497
+ headers: { "Content-Type": "image/jpeg" },
2498
+ body: fileBuffer,
2499
+ });
2500
+
2501
+ // 3. Have ITM verify the stored file and create the asset
2502
+ const { completePartnerMediaUpload: asset } = await itm.mutation({
2503
+ completePartnerMediaUpload: {
2504
+ __args: { input: { uploadKey: upload.uploadKey } },
2443
2505
  uid: true,
2444
2506
  url: true,
2445
2507
  mimeType: true,
2508
+ dimensions: { width: true, height: true },
2446
2509
  },
2447
2510
  });
2448
-
2449
- // Use createPartnerMediaAsset.uid as coverImageUid when creating a moment
2450
2511
  ```
2451
2512
 
2513
+ - Step 2 needs a body with a known length (a `Buffer`, `Uint8Array` or `Blob`),
2514
+ not a stream: storage refuses a chunked upload because the size is signed.
2515
+ - Step 3 checks that the stored bytes really are the declared type, then copies
2516
+ them to their permanent location. Calling it again with the same `uploadKey`
2517
+ returns the same asset, so it is safe to retry.
2518
+ - An upload that is never completed creates no asset.
2519
+ - Both mutations are limited to 30 requests per minute.
2520
+
2521
+ Brand-agent sessions keep their own reserved-upload flow
2522
+ (`reserveAgentMediaUpload`); these mutations take a partner token or an
2523
+ integration credential.
2524
+
2525
+ #### Legacy flow
2526
+
2527
+ `getPartnerUploadUrl` and `createPartnerMediaAsset` still work for existing
2528
+ integrations. They do not check the file's type or size and take the dimensions
2529
+ you send as given, so new code should use `uploadPartnerMedia`.
2530
+
2452
2531
  ### `createPartnerMoment`
2453
2532
 
2454
2533
  Create a moment (event) with optional venue and ticket tiers in one atomic operation.
@@ -2466,7 +2545,7 @@ const { createPartnerMoment } = await itm.mutation({
2466
2545
  timezone: "America/New_York",
2467
2546
  type: "IRL",
2468
2547
  capacity: 250,
2469
- coverImageUid: createPartnerMediaAsset.uid, // from upload flow
2548
+ coverImageUid: asset.uid, // from uploadPartnerMedia
2470
2549
  venue: {
2471
2550
  name: "Rooftop Bar",
2472
2551
  city: "New York",
@@ -2600,43 +2679,19 @@ const { editPartnerTicketTiersForMoment } = await itm.mutation({
2600
2679
  ### Complete Upload + Create Moment Flow
2601
2680
 
2602
2681
  ```typescript
2603
- import { createITMPartnerClient } from "@itm-studio/partner-sdk";
2604
- import { readFile } from "fs/promises";
2682
+ import {
2683
+ createITMPartnerClient,
2684
+ uploadPartnerMedia,
2685
+ } from "@itm-studio/partner-sdk";
2605
2686
 
2606
2687
  const itm = createITMPartnerClient({
2607
2688
  token: process.env.ITM_PARTNER_TOKEN!,
2608
2689
  });
2609
2690
 
2610
- // 1. Get presigned upload URL
2611
- const { getPartnerUploadUrl } = await itm.mutation({
2612
- getPartnerUploadUrl: {
2613
- __args: { filename: "event-cover", fileExtension: "jpg" },
2614
- url: true,
2615
- filename: true,
2616
- },
2617
- });
2618
-
2619
- // 2. Upload file to S3
2620
- const file = await readFile("./event-cover.jpg");
2621
- await fetch(getPartnerUploadUrl.url, {
2622
- method: "PUT",
2623
- body: file,
2624
- headers: { "Content-Type": "image/jpeg" },
2625
- });
2691
+ // 1. Upload the cover image
2692
+ const cover = await uploadPartnerMedia(itm, { path: "./event-cover.jpg" });
2626
2693
 
2627
- // 3. Register the uploaded asset
2628
- const { createPartnerMediaAsset } = await itm.mutation({
2629
- createPartnerMediaAsset: {
2630
- __args: {
2631
- mimetype: "image/jpeg",
2632
- filename: getPartnerUploadUrl.filename,
2633
- dimensions: { width: 1920, height: 1080 },
2634
- },
2635
- uid: true,
2636
- },
2637
- });
2638
-
2639
- // 4. Create the moment with the uploaded cover image
2694
+ // 2. Create the moment with the uploaded cover image
2640
2695
  const { createPartnerMoment } = await itm.mutation({
2641
2696
  createPartnerMoment: {
2642
2697
  __args: {
@@ -2648,7 +2703,7 @@ const { createPartnerMoment } = await itm.mutation({
2648
2703
  endDate: "2026-07-16T02:00:00.000Z",
2649
2704
  timezone: "America/New_York",
2650
2705
  type: "IRL",
2651
- coverImageUid: createPartnerMediaAsset.uid,
2706
+ coverImageUid: cover.uid,
2652
2707
  venue: {
2653
2708
  name: "The Venue",
2654
2709
  city: "New York",
@@ -3451,4 +3506,6 @@ const { getPartnerBrand } = await client.query({
3451
3506
 
3452
3507
  Provide exactly one of `token`, `agentSession`, `agentAccess`, or `integration`. Extra headers cannot override credential headers, regardless of casing. Create a client per inbound request; asynchronous token getters run per API request. `signal` cancels requests in every authentication mode. `ITMPartnerTransportError` exposes the HTTP status without copying a possibly sensitive response body; GraphQL failures remain `GenqlError`.
3453
3508
 
3509
+ An integration credential reads only what its scopes allow and writes one thing: with `itm:media:write` it can browse the media library (`getPartnerMediaAssets`, `getPartnerMediaAsset`) and upload into it (`createPartnerMediaUpload`, `completePartnerMediaUpload`, or `uploadPartnerMedia`, which selects only fields the credential may read). Every other mutation is refused.
3510
+
3454
3511
  This SDK does not log in operators, choose brands, retain OAuth refresh tokens, or decide permissions. The MCP caller handles OAuth and supplies the delegated API credential.
package/dist/index.d.mts CHANGED
@@ -1102,11 +1102,11 @@ interface Query {
1102
1102
  /** Get the authenticated agent operator email for the approval preview. Requires a brand-agent session with SEND_EMAIL; unavailable to partner API keys. */
1103
1103
  getPartnerAgentEmailContext: BrandAgentEmailContext;
1104
1104
  getAgentMediaUpload: AgentMediaUploadReservation;
1105
- /** Active brand-linked assets, newest first. Defaults to 50, capped at 100. READ_MEDIA for agents. */
1105
+ /** Active brand-linked assets, newest first. Defaults to 50, capped at 100. READ_MEDIA for agents; itm:media:write for AI connections. */
1106
1106
  getPartnerMediaAssets: GetPartnerMediaAssetsResponse;
1107
1107
  /** List the brand's merch with sizes and pickup moments, to find the merchUid, merchSizeUid and pickupMomentUid for createPartnerMerchPurchase. */
1108
1108
  getPartnerMerch: GetMerchPaginatedResponse;
1109
- /** An active asset linked to the caller's brand; null when unavailable. READ_MEDIA for agents. */
1109
+ /** An active asset linked to the caller's brand; null when unavailable. READ_MEDIA for agents; itm:media:write for AI connections. */
1110
1110
  getPartnerMediaAsset: (MediaAsset | null);
1111
1111
  /** Get details for the brand associated with the partner token. */
1112
1112
  getPartnerBrand: PartnerBrand;
@@ -1218,9 +1218,24 @@ interface MediaAssetUploadUrl {
1218
1218
  filename: Scalars['String'];
1219
1219
  __typename: 'MediaAssetUploadUrl';
1220
1220
  }
1221
+ /**
1222
+ * A short-lived upload that stores only the declared type and exact size.
1223
+ * Returned by createPartnerMediaUpload.
1224
+ */
1225
+ interface PartnerMediaUpload {
1226
+ /** Pass back to completePartnerMediaUpload after the PUT. */
1227
+ uploadKey: Scalars['String'];
1228
+ /**
1229
+ * PUT the file here with the declared Content-Type and exact byte size (both signed).
1230
+ * Treat it as a secret until it expires.
1231
+ */
1232
+ uploadUrl: Scalars['String'];
1233
+ expiresAt: Scalars['DateTime'];
1234
+ __typename: 'PartnerMediaUpload';
1235
+ }
1221
1236
  /**
1222
1237
  * A media asset uploaded by a partner.
1223
- * Returned by createPartnerMediaAsset.
1238
+ * Returned by completePartnerMediaUpload and createPartnerMediaAsset.
1224
1239
  */
1225
1240
  interface MediaAsset {
1226
1241
  uid: Scalars['ID'];
@@ -1273,13 +1288,27 @@ interface Mutation {
1273
1288
  reserveAgentMediaUpload: AgentMediaUploadReservation;
1274
1289
  finishAgentMediaUpload: Scalars['Boolean'];
1275
1290
  /**
1276
- * Get a presigned S3 URL for direct file upload.
1291
+ * Start a brand media upload: a short-lived URL that stores only the declared
1292
+ * type and exact size. PUT the file there, then call completePartnerMediaUpload.
1293
+ * Partner tokens, and AI connections holding itm:media:write.
1294
+ * Rate limited to 30 requests per minute.
1295
+ */
1296
+ createPartnerMediaUpload: PartnerMediaUpload;
1297
+ /**
1298
+ * Verify an uploaded file and add it to the brand's media library. The stored
1299
+ * bytes must be the declared type; images are measured from the file.
1300
+ * Completing the same upload again returns the same asset.
1301
+ * Rate limited to 30 requests per minute.
1302
+ */
1303
+ completePartnerMediaUpload: MediaAsset;
1304
+ /**
1305
+ * Legacy upload URL with no type or size check. Prefer createPartnerMediaUpload.
1277
1306
  * Rate limited to 30 requests per minute.
1278
1307
  */
1279
1308
  getPartnerUploadUrl: MediaAssetUploadUrl;
1280
1309
  /**
1281
- * Record an uploaded media asset and link it to the partner's brand.
1282
- * Call after uploading to S3 via the presigned URL from getPartnerUploadUrl.
1310
+ * Record a file uploaded through getPartnerUploadUrl and link it to the partner's brand.
1311
+ * Legacy: the type and dimensions are taken as given. Prefer completePartnerMediaUpload.
1283
1312
  */
1284
1313
  createPartnerMediaAsset: MediaAsset;
1285
1314
  /** Create a SUBSCRIBE drop for the authenticated partner brand. */
@@ -3317,7 +3346,7 @@ interface QueryGenqlSelection {
3317
3346
  uid: Scalars['String'];
3318
3347
  };
3319
3348
  });
3320
- /** Active brand-linked assets, newest first. Defaults to 50, capped at 100. READ_MEDIA for agents. */
3349
+ /** Active brand-linked assets, newest first. Defaults to 50, capped at 100. READ_MEDIA for agents; itm:media:write for AI connections. */
3321
3350
  getPartnerMediaAssets?: (GetPartnerMediaAssetsResponseGenqlSelection & {
3322
3351
  __args: {
3323
3352
  input: GetPartnerMediaAssetsInput;
@@ -3329,7 +3358,7 @@ interface QueryGenqlSelection {
3329
3358
  input: GetMerchPaginatedInput;
3330
3359
  };
3331
3360
  });
3332
- /** An active asset linked to the caller's brand; null when unavailable. READ_MEDIA for agents. */
3361
+ /** An active asset linked to the caller's brand; null when unavailable. READ_MEDIA for agents; itm:media:write for AI connections. */
3333
3362
  getPartnerMediaAsset?: (MediaAssetGenqlSelection & {
3334
3363
  __args: {
3335
3364
  uid: Scalars['String'];
@@ -3877,9 +3906,44 @@ interface MediaAssetUploadUrlGenqlSelection {
3877
3906
  __typename?: boolean | number;
3878
3907
  __scalar?: boolean | number;
3879
3908
  }
3909
+ interface CreatePartnerMediaUploadInput {
3910
+ /**
3911
+ * MIME type of the file: image/jpeg, image/png, image/gif, image/webp, image/avif,
3912
+ * video/mp4, video/quicktime, video/webm, audio/mpeg, audio/mp4, audio/wav,
3913
+ * audio/flac, audio/ogg or audio/webm.
3914
+ */
3915
+ contentType: Scalars['String'];
3916
+ /** Exact file size in bytes. Images up to 25 MB, audio up to 250 MB, video up to 1 GB. */
3917
+ byteSize: Scalars['Int'];
3918
+ }
3919
+ /**
3920
+ * A short-lived upload that stores only the declared type and exact size.
3921
+ * Returned by createPartnerMediaUpload.
3922
+ */
3923
+ interface PartnerMediaUploadGenqlSelection {
3924
+ /** Pass back to completePartnerMediaUpload after the PUT. */
3925
+ uploadKey?: boolean | number;
3926
+ /**
3927
+ * PUT the file here with the declared Content-Type and exact byte size (both signed).
3928
+ * Treat it as a secret until it expires.
3929
+ */
3930
+ uploadUrl?: boolean | number;
3931
+ expiresAt?: boolean | number;
3932
+ __typename?: boolean | number;
3933
+ __scalar?: boolean | number;
3934
+ }
3935
+ interface CompletePartnerMediaUploadInput {
3936
+ /** uploadKey from createPartnerMediaUpload. */
3937
+ uploadKey: Scalars['String'];
3938
+ /**
3939
+ * Frame size of a video, when known. Ignored for images, which are measured
3940
+ * from the file, and for audio.
3941
+ */
3942
+ dimensions?: (DimensionsInput | null);
3943
+ }
3880
3944
  /**
3881
3945
  * A media asset uploaded by a partner.
3882
- * Returned by createPartnerMediaAsset.
3946
+ * Returned by completePartnerMediaUpload and createPartnerMediaAsset.
3883
3947
  */
3884
3948
  interface MediaAssetGenqlSelection {
3885
3949
  uid?: boolean | number;
@@ -3971,7 +4035,29 @@ interface MutationGenqlSelection {
3971
4035
  };
3972
4036
  };
3973
4037
  /**
3974
- * Get a presigned S3 URL for direct file upload.
4038
+ * Start a brand media upload: a short-lived URL that stores only the declared
4039
+ * type and exact size. PUT the file there, then call completePartnerMediaUpload.
4040
+ * Partner tokens, and AI connections holding itm:media:write.
4041
+ * Rate limited to 30 requests per minute.
4042
+ */
4043
+ createPartnerMediaUpload?: (PartnerMediaUploadGenqlSelection & {
4044
+ __args: {
4045
+ input: CreatePartnerMediaUploadInput;
4046
+ };
4047
+ });
4048
+ /**
4049
+ * Verify an uploaded file and add it to the brand's media library. The stored
4050
+ * bytes must be the declared type; images are measured from the file.
4051
+ * Completing the same upload again returns the same asset.
4052
+ * Rate limited to 30 requests per minute.
4053
+ */
4054
+ completePartnerMediaUpload?: (MediaAssetGenqlSelection & {
4055
+ __args: {
4056
+ input: CompletePartnerMediaUploadInput;
4057
+ };
4058
+ });
4059
+ /**
4060
+ * Legacy upload URL with no type or size check. Prefer createPartnerMediaUpload.
3975
4061
  * Rate limited to 30 requests per minute.
3976
4062
  */
3977
4063
  getPartnerUploadUrl?: (MediaAssetUploadUrlGenqlSelection & {
@@ -3981,8 +4067,8 @@ interface MutationGenqlSelection {
3981
4067
  };
3982
4068
  });
3983
4069
  /**
3984
- * Record an uploaded media asset and link it to the partner's brand.
3985
- * Call after uploading to S3 via the presigned URL from getPartnerUploadUrl.
4070
+ * Record a file uploaded through getPartnerUploadUrl and link it to the partner's brand.
4071
+ * Legacy: the type and dimensions are taken as given. Prefer completePartnerMediaUpload.
3986
4072
  */
3987
4073
  createPartnerMediaAsset?: (MediaAssetGenqlSelection & {
3988
4074
  __args: {
@@ -5119,4 +5205,73 @@ declare class ITMPartnerTransportError extends Error {
5119
5205
  constructor(status: number | undefined, requestId?: string | undefined);
5120
5206
  }
5121
5207
 
5122
- export { type AgentThreadSeedContext, type ApplyDynamicPricingInput, type BrandAgentEmailMessageInput, type BrandAgentEmailSendBatch, type BrandAgentEmailSendBatchStatus, type BrandAgentEmailSendMessage, type BrandAgentEmailSendMessageStatus, type BrandApp, type BrandAppStatus, type BrandDrop, type BrandDropCtaType, type BrandDropMusicLink, type BrandSubscription, type ChargeCategory, type ChargeStatus, type CheckoutMarketingConsentInput, type CheckoutMarketingConsentPrompt, type CheckoutPlatform, type ConsentChannel, type ConsentPromptCategory, type ConsentStatus, type ContributionAdmin, type ContributionPageAdmin, type ContributionPageStatusFilter, type ContributionPagesResponse, type ContributionSource, type ContributionStatus, type ContributionsResponse, type CreateBrandAppInput, type CreateManualContributionInput, type CreateMomentOnlineConfigInput, type CreatePartnerBrandDropInput, type CreatePartnerBrandSubscriptionInput, type CreatePartnerBrandSubscriptionResponse, type CreatePartnerMerchPurchaseInput, type CreatePartnerMomentInput, type CreatePartnerTicketTierInput, type CreatePlanBudgetInput, type CreatePlanInput, type Currency, DEFAULT_API_URL, type Dimensions, type DimensionsInput, type DynamicPricingActorType, type DynamicPricingAdmissionWindow, type DynamicPricingBatch, type DynamicPricingBatchEvent, type DynamicPricingBatchEventType, type DynamicPricingBatchItem, type DynamicPricingBatchItemStatus, type DynamicPricingBatchStatus, type DynamicPricingContext, type DynamicPricingExecutionMode, type DynamicPricingInventoryGuardInput, type DynamicPricingInventoryGuardMode, type DynamicPricingInventoryMetric, type DynamicPricingMomentInput, type DynamicPricingTierContext, type DynamicPricingTierUpdateInput, type Echo, type EchoMediaAsset, type EchoType, type EditPartnerTicketTiersForMomentInput, type EventImportPlatform, type Form, type FormFaq, type FormField, type FormFieldOptionImage, type FormFieldSection, type FormFieldType, type FormResponseMode, type FormSource, type FulfillmentPlatform, GenqlError, type GetBrandEchoesForUserResponse, type GetFormsPaginatedResponse, type GetInPersonOrdersResponse, type GetMerchPaginatedInput, type GetMerchPaginatedResponse, type GetMomentGalleryPhotosResponse, type GetMomentGuestListFiltersInput, type GetMomentLineupsResponse, type GetMomentTagAssignmentsResponse, type GetPartnerAudienceInput, type GetPartnerAudienceResponse, type GetPartnerCustomersResponse, type GetPartnerDropsResponse, type GetPartnerFormResponsesInput, type GetPartnerFormResponsesResponse, type GetPartnerFormsInput, type GetPartnerGuestListCheckInsResponse, type GetPartnerInPersonChargesResponse, type GetPartnerMediaAssetsInput, type GetPartnerMediaAssetsResponse, type GetPartnerMembersInput, type GetPartnerMembersResponse, type GetPartnerMembershipTiersInput, type GetPartnerMembershipTiersResponse, type GetPartnerMomentGuestListResponse, type GetPartnerTicketTiersForMomentInput, type GetPartnerTicketTiersForMomentResponse, type GetPlansInput, type GetPlansResponse, type GetPublicMomentsResponse, type GetTicketsResponse, type ITMPartnerAgentAccessConfig, type ITMPartnerAgentAccessCredentials, type ITMPartnerAgentSessionConfig, type ITMPartnerAgentSessionCredentials, type ITMPartnerClient, type ITMPartnerClientConfig, type ITMPartnerHeaders, type ITMPartnerHeadersObject, type ITMPartnerIntegrationConfig, type ITMPartnerIntegrationCredentials, type ITMPartnerTokenConfig, ITMPartnerTransportError, type InPersonCharge, type InPersonOrder, type InPersonOrderItem, type InPersonOrderItemType, type InPersonOrderMerchPurchase, type InPersonOrderRefund, type InPersonOrderRefundAllocation, type InPersonOrderRefundAllocationStatus, type InPersonOrderRefundSource, type InPersonOrderRefundStatus, type InPersonOrderStatus, type InPersonOrderTicket, type InPersonOrderUser, type LinkingMethod, type LoginCodeChannel, type ManualContributionReceiptType, type MediaAsset, type MediaAssetUploadUrl, type MembershipBillingInterval, type MembershipExpiryType, type MembershipPassType, type MembershipPurchaseType, type MembershipSource, type MembershipStatus, type Merch, type MerchFiltersInput, type MerchFulfillmentType, type MerchPurchase, type MerchPurchaseFulfillmentChoice, type MerchPurchasePaymentMethod, type MerchPurchaseSource, type MerchPurchaseState, type MerchSize, type Moment, type MomentCategory, type MomentCollection, type MomentCollectionLink, type MomentDiscountCodeUsage, type MomentDynamicPricingPolicy, type MomentDynamicPricingTierRule, type MomentGuestListCheckInSource, type MomentGuestListCheckInStatus, type MomentGuestListGuestInfo, type MomentGuestListLabel, type MomentGuestListSortField, type MomentGuestListSortInput, type MomentGuestListSource, type MomentGuestListTotals, type MomentLineup, type MomentLineupDisplayLabel, type MomentLineupResponseResult, type MomentLineupStatus, type MomentLineupType, type MomentMedia, type MomentOccurrenceScheduleFrequency, type MomentOnlineProvider, type MomentPublicVenuePreview, type MomentSortOrder, type MomentStatus, type MomentSubcategory, type MomentTagAssignment, type MomentType, type MusicReleaseType, type Mutation, type PaginationInput, type PartnerAppLogin, type PartnerAppLoginChallenge, type PartnerAppLoginProfile, type PartnerAudienceCustomer, type PartnerAudienceFiltersInput, type PartnerAudienceSortField, type PartnerAudienceSortInput, type PartnerBrand, type PartnerCustomer, type PartnerFormFieldResponse, type PartnerFormResponse, type PartnerGuestListCheckIn, type PartnerGuestListInvitationResponse, type PartnerInPersonCharge, type PartnerMember, type PartnerMemberCustomer, type PartnerMemberTier, type PartnerMembershipTier, type PartnerMerchCustomerInput, type PartnerMerchPurchase, type PartnerMerchShippingAddressInput, type PartnerMomentAttendanceCount, type PartnerMomentAttendanceLookupInput, type PartnerMomentAttendanceStats, type PartnerMomentGuestList, type PartnerMomentGuestlistAttendance, type PartnerMomentGuestlistLabelAttendance, type PartnerMomentStats, type PartnerMomentTicketAttendance, type PartnerMomentTicketTierAttendance, type PartnerMomentsFiltersInput, type PartnerTicketStatus, type PartnerTicketTier, type PartnerTicketTierUpdateInput, type PartnerTicketUserLookupInput, type PartnerTicketsForUserInput, type Payment, type PaymentStatus, type Plan, type PlanBudget, type PlanBudgetAllocationType, type PlanBudgetArtistDealBasis, type PlanBudgetArtistDealInput, type PlanBudgetArtistDealType, type PlanBudgetCapacityAllocationInput, type PlanBudgetCategoryInput, type PlanBudgetCategoryKind, type PlanBudgetChargeCalculation, type PlanBudgetChargeKind, type PlanBudgetChargeTreatment, type PlanBudgetExternalTicketingChannelInput, type PlanBudgetFeeAssessment, type PlanBudgetFeeComponentKind, type PlanBudgetFeePercentageBasis, type PlanBudgetGuaranteeBasis, type PlanBudgetLineBasis, type PlanBudgetLineInput, type PlanBudgetPaymentStatus, type PlanBudgetPricingMode, type PlanBudgetSummary, type PlanBudgetTicketChargeRuleInput, type PlanBudgetTicketTierInput, type PlanBudgetTicketingChannelType, type PlanBudgetTicketingFeeComponentInput, type PlanKind, type PlanLinkMetadataStatus, type PlanMoodboard, type PlanMoodboardItem, type PlanMoodboardItemType, type PlanSchedule, type PlanScheduleInput, type PlanScheduleTime, type PlanScheduleTimeInput, type PlanScheduleType, type PlanStatus, type PlanSummary, type PlanningProposal, type PlanningSource, type PlanningSourceDispositionInput, type PlanningSourceSection, type PostSubscriptionEmailInput, type PostSubscriptionMessageInput, type PostSubscriptionPushInput, type PostSubscriptionSmsInput, type PreparePlanningProposalInput, type PublicMomentLineupInfo, type Query, type ReplacePlanBudgetDraftInput, type RespondToMomentLineupInput, type SendPartnerAgentEmailInput, type SortDirection, type StartPartnerAppLoginInput, type SubscriptionComplianceInput, type Tag, type TagSource, type ThirdPartyEchoType, type Ticket, type TicketAdmissionWindowSource, type TicketAttendanceMode, type TicketExtension, type TicketExtensionStatus, type TicketState, type TicketTier, type Transforms, type UpdatePlanInput, type User, type UserLinkingStatus, type UserSource, type Venue, type VenueInput, type VerifyPartnerAppLoginInput, type VerifyPartnerBrandSubscriptionInput, createITMPartnerClient, everything, generateMutationOp, generateQueryOp };
5208
+ /**
5209
+ * The file to upload: bytes already in memory, or a path on disk. Give
5210
+ * `contentType` when you know it; otherwise it is read from the file's
5211
+ * signature (and from a Blob's own `type`).
5212
+ */
5213
+ type ITMPartnerMediaSource = {
5214
+ data: Uint8Array | ArrayBuffer | Blob;
5215
+ contentType?: string;
5216
+ } | {
5217
+ path: string;
5218
+ contentType?: string;
5219
+ };
5220
+ interface ITMPartnerMediaUploadOptions {
5221
+ /** Frame size of a video, when known. Images are measured by ITM. */
5222
+ dimensions?: {
5223
+ width: number;
5224
+ height: number;
5225
+ };
5226
+ /** Cancels the storage PUT and stops between steps. Pass the same signal to the client to cancel API calls in flight. */
5227
+ signal?: AbortSignal;
5228
+ /** Used for the storage PUT only. Defaults to the global `fetch`. */
5229
+ fetch?: typeof fetch;
5230
+ }
5231
+ /** The asset `uploadPartnerMedia` returns. Use `uid` wherever ITM takes a media asset. */
5232
+ interface ITMPartnerUploadedMedia {
5233
+ uid: string;
5234
+ url: string;
5235
+ mimeType: string;
5236
+ size: number;
5237
+ dimensions: {
5238
+ width: number | null;
5239
+ height: number | null;
5240
+ };
5241
+ createdAt: string;
5242
+ }
5243
+ /**
5244
+ * A failure outside the ITM API: the file could not be read or recognized
5245
+ * (`read`), or storage refused the bytes (`upload`). API failures keep their
5246
+ * own types, `GenqlError` and `ITMPartnerTransportError`. The upload URL is a
5247
+ * credential and never appears in a message.
5248
+ */
5249
+ declare class ITMPartnerMediaUploadError extends Error {
5250
+ readonly stage: 'read' | 'upload';
5251
+ /** HTTP status from storage, for `upload` failures that got a response. */
5252
+ readonly status?: number | undefined;
5253
+ readonly name = "ITMPartnerMediaUploadError";
5254
+ constructor(stage: 'read' | 'upload', message: string,
5255
+ /** HTTP status from storage, for `upload` failures that got a response. */
5256
+ status?: number | undefined);
5257
+ }
5258
+ /**
5259
+ * The media types ITM accepts, recognized from a file's first bytes. Returns
5260
+ * every type the signature fits (a WebM container may be audio or video), most
5261
+ * likely first, or an empty list when the file is none of them.
5262
+ */
5263
+ declare function detectPartnerMediaTypes(prefix: Uint8Array): string[];
5264
+ /**
5265
+ * Upload a file to the brand's media library in one call: reserve a signed
5266
+ * upload, PUT the bytes straight to storage, then have ITM verify the file and
5267
+ * return the asset. Works with a partner token, or an integration credential
5268
+ * holding `itm:media:write`.
5269
+ *
5270
+ * ```typescript
5271
+ * const asset = await uploadPartnerMedia(itm, { path: './cover.jpg' });
5272
+ * // asset.uid is the coverImageUid for createPartnerMoment
5273
+ * ```
5274
+ */
5275
+ declare function uploadPartnerMedia(client: ITMPartnerClient, source: ITMPartnerMediaSource, options?: ITMPartnerMediaUploadOptions): Promise<ITMPartnerUploadedMedia>;
5276
+
5277
+ export { type AgentThreadSeedContext, type ApplyDynamicPricingInput, type BrandAgentEmailMessageInput, type BrandAgentEmailSendBatch, type BrandAgentEmailSendBatchStatus, type BrandAgentEmailSendMessage, type BrandAgentEmailSendMessageStatus, type BrandApp, type BrandAppStatus, type BrandDrop, type BrandDropCtaType, type BrandDropMusicLink, type BrandSubscription, type ChargeCategory, type ChargeStatus, type CheckoutMarketingConsentInput, type CheckoutMarketingConsentPrompt, type CheckoutPlatform, type CompletePartnerMediaUploadInput, type ConsentChannel, type ConsentPromptCategory, type ConsentStatus, type ContributionAdmin, type ContributionPageAdmin, type ContributionPageStatusFilter, type ContributionPagesResponse, type ContributionSource, type ContributionStatus, type ContributionsResponse, type CreateBrandAppInput, type CreateManualContributionInput, type CreateMomentOnlineConfigInput, type CreatePartnerBrandDropInput, type CreatePartnerBrandSubscriptionInput, type CreatePartnerBrandSubscriptionResponse, type CreatePartnerMediaUploadInput, type CreatePartnerMerchPurchaseInput, type CreatePartnerMomentInput, type CreatePartnerTicketTierInput, type CreatePlanBudgetInput, type CreatePlanInput, type Currency, DEFAULT_API_URL, type Dimensions, type DimensionsInput, type DynamicPricingActorType, type DynamicPricingAdmissionWindow, type DynamicPricingBatch, type DynamicPricingBatchEvent, type DynamicPricingBatchEventType, type DynamicPricingBatchItem, type DynamicPricingBatchItemStatus, type DynamicPricingBatchStatus, type DynamicPricingContext, type DynamicPricingExecutionMode, type DynamicPricingInventoryGuardInput, type DynamicPricingInventoryGuardMode, type DynamicPricingInventoryMetric, type DynamicPricingMomentInput, type DynamicPricingTierContext, type DynamicPricingTierUpdateInput, type Echo, type EchoMediaAsset, type EchoType, type EditPartnerTicketTiersForMomentInput, type EventImportPlatform, type Form, type FormFaq, type FormField, type FormFieldOptionImage, type FormFieldSection, type FormFieldType, type FormResponseMode, type FormSource, type FulfillmentPlatform, GenqlError, type GetBrandEchoesForUserResponse, type GetFormsPaginatedResponse, type GetInPersonOrdersResponse, type GetMerchPaginatedInput, type GetMerchPaginatedResponse, type GetMomentGalleryPhotosResponse, type GetMomentGuestListFiltersInput, type GetMomentLineupsResponse, type GetMomentTagAssignmentsResponse, type GetPartnerAudienceInput, type GetPartnerAudienceResponse, type GetPartnerCustomersResponse, type GetPartnerDropsResponse, type GetPartnerFormResponsesInput, type GetPartnerFormResponsesResponse, type GetPartnerFormsInput, type GetPartnerGuestListCheckInsResponse, type GetPartnerInPersonChargesResponse, type GetPartnerMediaAssetsInput, type GetPartnerMediaAssetsResponse, type GetPartnerMembersInput, type GetPartnerMembersResponse, type GetPartnerMembershipTiersInput, type GetPartnerMembershipTiersResponse, type GetPartnerMomentGuestListResponse, type GetPartnerTicketTiersForMomentInput, type GetPartnerTicketTiersForMomentResponse, type GetPlansInput, type GetPlansResponse, type GetPublicMomentsResponse, type GetTicketsResponse, type ITMPartnerAgentAccessConfig, type ITMPartnerAgentAccessCredentials, type ITMPartnerAgentSessionConfig, type ITMPartnerAgentSessionCredentials, type ITMPartnerClient, type ITMPartnerClientConfig, type ITMPartnerHeaders, type ITMPartnerHeadersObject, type ITMPartnerIntegrationConfig, type ITMPartnerIntegrationCredentials, type ITMPartnerMediaSource, ITMPartnerMediaUploadError, type ITMPartnerMediaUploadOptions, type ITMPartnerTokenConfig, ITMPartnerTransportError, type ITMPartnerUploadedMedia, type InPersonCharge, type InPersonOrder, type InPersonOrderItem, type InPersonOrderItemType, type InPersonOrderMerchPurchase, type InPersonOrderRefund, type InPersonOrderRefundAllocation, type InPersonOrderRefundAllocationStatus, type InPersonOrderRefundSource, type InPersonOrderRefundStatus, type InPersonOrderStatus, type InPersonOrderTicket, type InPersonOrderUser, type LinkingMethod, type LoginCodeChannel, type ManualContributionReceiptType, type MediaAsset, type MediaAssetUploadUrl, type MembershipBillingInterval, type MembershipExpiryType, type MembershipPassType, type MembershipPurchaseType, type MembershipSource, type MembershipStatus, type Merch, type MerchFiltersInput, type MerchFulfillmentType, type MerchPurchase, type MerchPurchaseFulfillmentChoice, type MerchPurchasePaymentMethod, type MerchPurchaseSource, type MerchPurchaseState, type MerchSize, type Moment, type MomentCategory, type MomentCollection, type MomentCollectionLink, type MomentDiscountCodeUsage, type MomentDynamicPricingPolicy, type MomentDynamicPricingTierRule, type MomentGuestListCheckInSource, type MomentGuestListCheckInStatus, type MomentGuestListGuestInfo, type MomentGuestListLabel, type MomentGuestListSortField, type MomentGuestListSortInput, type MomentGuestListSource, type MomentGuestListTotals, type MomentLineup, type MomentLineupDisplayLabel, type MomentLineupResponseResult, type MomentLineupStatus, type MomentLineupType, type MomentMedia, type MomentOccurrenceScheduleFrequency, type MomentOnlineProvider, type MomentPublicVenuePreview, type MomentSortOrder, type MomentStatus, type MomentSubcategory, type MomentTagAssignment, type MomentType, type MusicReleaseType, type Mutation, type PaginationInput, type PartnerAppLogin, type PartnerAppLoginChallenge, type PartnerAppLoginProfile, type PartnerAudienceCustomer, type PartnerAudienceFiltersInput, type PartnerAudienceSortField, type PartnerAudienceSortInput, type PartnerBrand, type PartnerCustomer, type PartnerFormFieldResponse, type PartnerFormResponse, type PartnerGuestListCheckIn, type PartnerGuestListInvitationResponse, type PartnerInPersonCharge, type PartnerMediaUpload, type PartnerMember, type PartnerMemberCustomer, type PartnerMemberTier, type PartnerMembershipTier, type PartnerMerchCustomerInput, type PartnerMerchPurchase, type PartnerMerchShippingAddressInput, type PartnerMomentAttendanceCount, type PartnerMomentAttendanceLookupInput, type PartnerMomentAttendanceStats, type PartnerMomentGuestList, type PartnerMomentGuestlistAttendance, type PartnerMomentGuestlistLabelAttendance, type PartnerMomentStats, type PartnerMomentTicketAttendance, type PartnerMomentTicketTierAttendance, type PartnerMomentsFiltersInput, type PartnerTicketStatus, type PartnerTicketTier, type PartnerTicketTierUpdateInput, type PartnerTicketUserLookupInput, type PartnerTicketsForUserInput, type Payment, type PaymentStatus, type Plan, type PlanBudget, type PlanBudgetAllocationType, type PlanBudgetArtistDealBasis, type PlanBudgetArtistDealInput, type PlanBudgetArtistDealType, type PlanBudgetCapacityAllocationInput, type PlanBudgetCategoryInput, type PlanBudgetCategoryKind, type PlanBudgetChargeCalculation, type PlanBudgetChargeKind, type PlanBudgetChargeTreatment, type PlanBudgetExternalTicketingChannelInput, type PlanBudgetFeeAssessment, type PlanBudgetFeeComponentKind, type PlanBudgetFeePercentageBasis, type PlanBudgetGuaranteeBasis, type PlanBudgetLineBasis, type PlanBudgetLineInput, type PlanBudgetPaymentStatus, type PlanBudgetPricingMode, type PlanBudgetSummary, type PlanBudgetTicketChargeRuleInput, type PlanBudgetTicketTierInput, type PlanBudgetTicketingChannelType, type PlanBudgetTicketingFeeComponentInput, type PlanKind, type PlanLinkMetadataStatus, type PlanMoodboard, type PlanMoodboardItem, type PlanMoodboardItemType, type PlanSchedule, type PlanScheduleInput, type PlanScheduleTime, type PlanScheduleTimeInput, type PlanScheduleType, type PlanStatus, type PlanSummary, type PlanningProposal, type PlanningSource, type PlanningSourceDispositionInput, type PlanningSourceSection, type PostSubscriptionEmailInput, type PostSubscriptionMessageInput, type PostSubscriptionPushInput, type PostSubscriptionSmsInput, type PreparePlanningProposalInput, type PublicMomentLineupInfo, type Query, type ReplacePlanBudgetDraftInput, type RespondToMomentLineupInput, type SendPartnerAgentEmailInput, type SortDirection, type StartPartnerAppLoginInput, type SubscriptionComplianceInput, type Tag, type TagSource, type ThirdPartyEchoType, type Ticket, type TicketAdmissionWindowSource, type TicketAttendanceMode, type TicketExtension, type TicketExtensionStatus, type TicketState, type TicketTier, type Transforms, type UpdatePlanInput, type User, type UserLinkingStatus, type UserSource, type Venue, type VenueInput, type VerifyPartnerAppLoginInput, type VerifyPartnerBrandSubscriptionInput, createITMPartnerClient, detectPartnerMediaTypes, everything, generateMutationOp, generateQueryOp, uploadPartnerMedia };