@pubnio/sdk 0.2.12 → 0.3.0

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/dist/index.js CHANGED
@@ -139,6 +139,7 @@ __export(exports_sdk_gen, {
139
139
  postsRetry: () => postsRetry,
140
140
  postsUpdate: () => postsUpdate,
141
141
  postsValidate: () => postsValidate,
142
+ postsValidateBody: () => postsValidateBody,
142
143
  profileDeactivate: () => profileDeactivate,
143
144
  profileGet: () => profileGet,
144
145
  profileUpdate: () => profileUpdate,
@@ -348,6 +349,8 @@ var IssueCode = Schema6.Literals([
348
349
  "tiktok_upload_required",
349
350
  "tiktok_too_many_mentions",
350
351
  "queue_and_time_conflict",
352
+ "queue_not_found",
353
+ "queue_unavailable",
351
354
  "invalid_field",
352
355
  "account_ambiguous",
353
356
  "unsupported_placement",
@@ -358,8 +361,9 @@ var IssueCode = Schema6.Literals([
358
361
  var PostIssue = Schema6.Struct({
359
362
  code: IssueCode,
360
363
  path: Schema6.Array(Schema6.Union([Schema6.String, Schema6.Int])),
361
- message: Schema6.String
362
- });
364
+ message: Schema6.String,
365
+ candidates: Schema6.optionalKey(Schema6.Array(Schema6.Struct({ accountId: AccountId, name: Schema6.String })))
366
+ }).annotate({ identifier: "PostIssue" });
363
367
  var schemaIssueFormatter = SchemaIssue.makeFormatterStandardSchemaV1();
364
368
 
365
369
  // ../protocol/src/provider.ts
@@ -576,7 +580,10 @@ var DeliveryIssue = Schema8.Literals([
576
580
  "tiktok_settings_not_allowed",
577
581
  "tiktok_processing_failed",
578
582
  "submission_uncertain",
579
- "confirmation_unavailable"
583
+ "confirmation_unavailable",
584
+ "billing_inactive",
585
+ "spend_cap_reached",
586
+ "insufficient_credit"
580
587
  ]);
581
588
  var FirstCommentStatus = Schema8.Literals([
582
589
  "pending",
@@ -675,6 +682,7 @@ var BillingSubscriptionStatus = Schema9.Literals([
675
682
  var UsageMeter = Schema9.Literals([
676
683
  "confirmed_publish",
677
684
  "x_passthrough",
685
+ "x_read",
678
686
  "managed_ad",
679
687
  "inbox_reply",
680
688
  "automation_run"
@@ -691,10 +699,15 @@ var BillingPlan = Schema9.Struct({
691
699
  monthlyPrice: Schema9.NullOr(Money),
692
700
  annualPrice: Schema9.NullOr(Money),
693
701
  meters: Schema9.Array(BillingPlanMeter),
702
+ xReads: Schema9.Boolean,
703
+ includedXReadMicros: Schema9.NullOr(Schema9.Int),
694
704
  seatsLimit: Schema9.NullOr(Schema9.Int),
695
705
  analyticsRetentionDays: Schema9.Int,
696
706
  whiteLabelOAuth: Schema9.Boolean,
697
- ssoSaml: Schema9.Boolean
707
+ ssoSaml: Schema9.Boolean,
708
+ priorityQueue: Schema9.Boolean,
709
+ adsInsights: Schema9.Boolean,
710
+ adsWrite: Schema9.Boolean
698
711
  }).annotate({ identifier: "BillingPlan" });
699
712
  var BillingPlanList = Schema9.Struct({
700
713
  data: Schema9.Array(BillingPlan)
@@ -730,6 +743,8 @@ var WorkspaceBilling = Schema9.Struct({
730
743
  creditBalance: Money,
731
744
  spendControls: BillingSpendControls,
732
745
  currentPeriod: Schema9.Struct({
746
+ start: Schema9.String,
747
+ end: Schema9.String,
733
748
  meters: Schema9.Array(BillingMeterUsage),
734
749
  totalVariableSpendMicros: Schema9.Int,
735
750
  seatsUsed: Schema9.Int,
@@ -1871,7 +1886,51 @@ var ApiLimits = Schema15.Struct({
1871
1886
  media: MediaLimits,
1872
1887
  rateLimits: RateLimits
1873
1888
  }).annotate({ identifier: "ApiLimits" });
1889
+ var pollOptionCount = { minOptions: 2, maxOptions: 4 };
1890
+ var xPollLimits = {
1891
+ ...pollOptionCount,
1892
+ optionCharacters: 25,
1893
+ minDurationMinutes: 5,
1894
+ maxDurationMinutes: 10080
1895
+ };
1896
+ var linkedinPollLimits = {
1897
+ ...pollOptionCount,
1898
+ questionCharacters: 140,
1899
+ optionCharacters: 30,
1900
+ durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
1901
+ };
1902
+ var xReplySettings = [
1903
+ "following",
1904
+ "mentionedUsers",
1905
+ "subscribers",
1906
+ "verified"
1907
+ ];
1908
+ var xMediaTagLimit = 10;
1909
+ var pollOptionLimits = {
1910
+ minOptions: Schema15.Int,
1911
+ maxOptions: Schema15.Int,
1912
+ optionCharacters: Schema15.Int
1913
+ };
1914
+ var FeedSettingsCapability = Schema15.Struct({
1915
+ poll: Schema15.Union([
1916
+ Schema15.Struct({
1917
+ ...pollOptionLimits,
1918
+ minDurationMinutes: Schema15.Int,
1919
+ maxDurationMinutes: Schema15.Int
1920
+ }),
1921
+ Schema15.Struct({
1922
+ ...pollOptionLimits,
1923
+ questionCharacters: Schema15.Int,
1924
+ durations: Schema15.Array(Schema15.Literals(linkedinPollLimits.durations))
1925
+ })
1926
+ ]),
1927
+ replySettings: Schema15.optionalKey(Schema15.Array(Schema15.Literals(xReplySettings))),
1928
+ maxMediaTags: Schema15.optionalKey(Schema15.Int),
1929
+ placeId: Schema15.optionalKey(Schema15.Boolean),
1930
+ quotePostId: Schema15.optionalKey(Schema15.Boolean)
1931
+ });
1874
1932
  var PlacementCapability = Schema15.Struct({
1933
+ settings: Schema15.optionalKey(FeedSettingsCapability),
1875
1934
  placement: PublishPlacement,
1876
1935
  default: Schema15.Boolean,
1877
1936
  mediaTypes: Schema15.Array(MediaType),
@@ -2169,6 +2228,12 @@ var OAuthFailureReason = Schema17.Literals([
2169
2228
  "connection_changed",
2170
2229
  "connection_failed"
2171
2230
  ]);
2231
+ var ConnectionEmptyReason = Schema17.Literals([
2232
+ "pages_permission_declined",
2233
+ "no_pages",
2234
+ "granted_pages_not_listed",
2235
+ "business_assets_unavailable"
2236
+ ]);
2172
2237
  var attempt2 = { attemptId: uuid3, provider: AccountProvider };
2173
2238
  var ConnectionStatus = Schema17.Union([
2174
2239
  Schema17.Struct({
@@ -2236,9 +2301,14 @@ var InstagramAudioSearch = Schema17.Struct({
2236
2301
  import { Schema as Schema28 } from "effect";
2237
2302
 
2238
2303
  // ../protocol/src/publishing.ts
2239
- import { Schema as Schema18 } from "effect";
2304
+ import { Effect, Schema as Schema18 } from "effect";
2240
2305
  var postTextLimit = 128000;
2241
2306
  var threadPostTextLimit = 1250;
2307
+ var blueskyPostMaxBytes = 3000;
2308
+ var graphemeSegmenter = new Intl.Segmenter(undefined, {
2309
+ granularity: "grapheme"
2310
+ });
2311
+ var utf8 = new TextEncoder;
2242
2312
  var redditTitleMaxLength = 300;
2243
2313
  var threadsTextLimit = 500;
2244
2314
  var xArticleTitleMaxLength = 100;
@@ -2346,12 +2416,34 @@ var InstagramStorySettings = Schema18.Struct({
2346
2416
  muteAudio: Schema18.optionalKey(Schema18.Boolean),
2347
2417
  userTags: instagramTags
2348
2418
  }).annotate({ identifier: "InstagramStorySettings" });
2419
+ var blueskyPostText = Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(blueskyPostMaxBytes));
2349
2420
  var BlueskyFeedSettings = Schema18.Struct({
2350
- firstComment: Schema18.optionalKey(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(300))),
2351
- thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(300))).check(Schema18.isMaxLength(24))),
2421
+ firstComment: Schema18.optionalKey(blueskyPostText),
2422
+ thread: Schema18.optionalKey(Schema18.Array(blueskyPostText).check(Schema18.isMaxLength(24))),
2352
2423
  altText: Schema18.optionalKey(Schema18.String.check(Schema18.isMaxLength(1000)))
2353
2424
  }).annotate({ identifier: "BlueskyFeedSettings" });
2425
+ var nonblank = Schema18.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
2426
+ function pollText(maximum) {
2427
+ return Schema18.String.check(Schema18.isBetweenCodePoints(1, maximum, {
2428
+ expected: `between 1 and ${maximum} characters`
2429
+ }), nonblank);
2430
+ }
2431
+ function pollOptions({
2432
+ minOptions,
2433
+ maxOptions,
2434
+ optionCharacters
2435
+ }) {
2436
+ return Schema18.Array(pollText(optionCharacters)).check(Schema18.isMinLength(minOptions), Schema18.isMaxLength(maxOptions));
2437
+ }
2438
+ var LinkedInPoll = Schema18.Struct({
2439
+ question: pollText(linkedinPollLimits.questionCharacters),
2440
+ options: pollOptions(linkedinPollLimits),
2441
+ duration: Schema18.Literals(linkedinPollLimits.durations)
2442
+ }).annotate({
2443
+ description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
2444
+ });
2354
2445
  var LinkedInFeedSettings = Schema18.Struct({
2446
+ poll: Schema18.optionalKey(LinkedInPoll),
2355
2447
  firstComment: Schema18.optionalKey(text),
2356
2448
  thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadPostTextLimit))).check(Schema18.isMaxLength(24))),
2357
2449
  visibility: Schema18.optionalKey(Schema18.Literals(["PUBLIC", "CONNECTIONS"])),
@@ -2388,6 +2480,7 @@ var YouTubeVideoSettings = Schema18.Struct({
2388
2480
  title: Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(100)),
2389
2481
  description: Schema18.optionalKey(Schema18.String.check(Schema18.isMaxLength(5000))),
2390
2482
  privacyStatus: Schema18.Literals(["public", "unlisted", "private"]),
2483
+ firstComment: Schema18.optionalKey(text),
2391
2484
  tags: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMaxLength(100))).check(Schema18.isMaxLength(30))),
2392
2485
  categoryId: Schema18.optionalKey(Schema18.String.check(Schema18.isPattern(/^\d{1,3}$/))),
2393
2486
  madeForKids: Schema18.optionalKey(Schema18.Boolean),
@@ -2402,14 +2495,66 @@ var XArticleDraftSettings = Schema18.Struct({
2402
2495
  title: Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(xArticleTitleMaxLength)),
2403
2496
  content: Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(xArticleContentMaxLength))
2404
2497
  }).annotate({ identifier: "XArticleDraftSettings" });
2498
+ var XPoll = Schema18.Struct({
2499
+ options: pollOptions(xPollLimits),
2500
+ durationMinutes: Schema18.Number.check(Schema18.isInt({ expected: "an integer number of minutes" }), Schema18.isBetween({
2501
+ minimum: xPollLimits.minDurationMinutes,
2502
+ maximum: xPollLimits.maxDurationMinutes
2503
+ }, {
2504
+ expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
2505
+ }))
2506
+ }).annotate({
2507
+ description: "X poll on the root post. Include post text and omit attachments."
2508
+ });
2509
+ var xPostOptionId = Schema18.String.check(Schema18.isPattern(/^[0-9]{1,19}$/, {
2510
+ expected: "an X ID string of 1 to 19 digits"
2511
+ }));
2405
2512
  var XFeedSettings = Schema18.Struct({
2513
+ poll: Schema18.optionalKey(XPoll),
2514
+ replySettings: Schema18.optionalKey(Schema18.Literals(xReplySettings).annotate({
2515
+ description: "Who may reply to the root X post. Omit for the provider default."
2516
+ })),
2517
+ quotePostId: Schema18.optionalKey(xPostOptionId.annotate({
2518
+ description: "Native quotes require an X Enterprise app. With PubNio's current app, omit this field and put the X post URL in the text."
2519
+ })),
2520
+ mediaTaggedUserIds: Schema18.optionalKey(Schema18.Array(xPostOptionId).check(Schema18.isMaxLength(xMediaTagLimit)).annotate({
2521
+ description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
2522
+ })),
2523
+ placeId: Schema18.optionalKey(Schema18.String.check(Schema18.isTrimmed({
2524
+ expected: "an X Place ID without surrounding whitespace"
2525
+ }), nonblank).annotate({
2526
+ description: "Opaque X Place ID such as geo.place_id from a post lookup."
2527
+ })),
2406
2528
  firstComment: Schema18.optionalKey(text),
2407
- thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(280))).check(Schema18.isMaxLength(24))),
2529
+ thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadPostTextLimit))).check(Schema18.isMaxLength(24))),
2408
2530
  article: Schema18.optionalKey(XArticleDraftSettings)
2409
2531
  }).annotate({ identifier: "XFeedSettings" });
2410
- var GoogleBusinessFeedSettings = Schema18.Struct({}).annotate({
2411
- identifier: "GoogleBusinessFeedSettings"
2412
- });
2532
+ var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
2533
+ var googleBusinessLocalTime = Schema18.String.check(Schema18.isPattern(/^[0-9]{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12][0-9]|3[01])T(?:[01][0-9]|2[0-3]):[0-5][0-9]$/, {
2534
+ message: googleBusinessLocalTimeFormat
2535
+ }), Schema18.makeFilter((value) => {
2536
+ const year = Number(value.slice(0, 4));
2537
+ const date = new Date(`${value}:00Z`);
2538
+ return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
2539
+ })).annotate({ description: googleBusinessLocalTimeFormat });
2540
+ var googleBusinessNonblank = Schema18.String.check(Schema18.isPattern(/\S/, {
2541
+ message: "Enter a string with non-whitespace content."
2542
+ }));
2543
+ var googleBusinessLink = MediaUrl.annotate({
2544
+ description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
2545
+ message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
2546
+ });
2547
+ var GoogleBusinessFeedSettings = Schema18.Struct({
2548
+ topicType: Schema18.optionalKey(Schema18.Literals(["standard", "event", "offer"])),
2549
+ title: Schema18.optionalKey(googleBusinessNonblank),
2550
+ startsAt: Schema18.optionalKey(googleBusinessLocalTime),
2551
+ endsAt: Schema18.optionalKey(googleBusinessLocalTime),
2552
+ couponCode: Schema18.optionalKey(googleBusinessNonblank),
2553
+ redeemUrl: Schema18.optionalKey(googleBusinessLink),
2554
+ terms: Schema18.optionalKey(googleBusinessNonblank),
2555
+ callToAction: Schema18.optionalKey(Schema18.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
2556
+ callToActionUrl: Schema18.optionalKey(googleBusinessLink)
2557
+ }).annotate({ identifier: "GoogleBusinessFeedSettings" });
2413
2558
  var ThreadsFeedSettings = Schema18.Struct({
2414
2559
  firstComment: Schema18.optionalKey(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadsTextLimit))),
2415
2560
  thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadsTextLimit))).check(Schema18.isMaxLength(24)))
@@ -2588,6 +2733,41 @@ var providerSettings = Schema18.Union([
2588
2733
  TikTokFeedSettings,
2589
2734
  GoogleBusinessFeedSettings
2590
2735
  ]);
2736
+ function settingsShapeErrors(issue, depth = 0) {
2737
+ switch (issue._tag) {
2738
+ case "Composite":
2739
+ return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
2740
+ case "AnyOf":
2741
+ return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
2742
+ case "Pointer":
2743
+ return settingsShapeErrors(issue.issue, depth + issue.path.length);
2744
+ case "UnexpectedKey":
2745
+ return depth === 1 ? 3 : 2;
2746
+ case "MissingKey":
2747
+ return depth === 1 ? 4 : 1;
2748
+ default:
2749
+ return 0;
2750
+ }
2751
+ }
2752
+ var createTargetSettings = providerSettings.pipe(Schema18.catchDecoding((issue) => {
2753
+ if (issue._tag !== "AnyOf")
2754
+ return Effect.fail(issue);
2755
+ const [first, ...others] = issue.issues;
2756
+ if (!first)
2757
+ return Effect.fail(issue);
2758
+ let closest = first;
2759
+ let fewest = settingsShapeErrors(first);
2760
+ for (const candidate of others) {
2761
+ if (fewest === 0)
2762
+ break;
2763
+ const errors = settingsShapeErrors(candidate);
2764
+ if (errors < fewest) {
2765
+ closest = candidate;
2766
+ fewest = errors;
2767
+ }
2768
+ }
2769
+ return Effect.fail(closest);
2770
+ }));
2591
2771
  var CreatePostTarget = Schema18.Struct({
2592
2772
  accountId: AccountId,
2593
2773
  provider: Schema18.optionalKey(Provider),
@@ -2599,7 +2779,7 @@ var CreatePostTarget = Schema18.Struct({
2599
2779
  queueId: Schema18.optionalKey(Schema18.String.check(Schema18.isUUID()).annotate({
2600
2780
  description: "Assign this destination to its connected account's schedule queue."
2601
2781
  })),
2602
- settings: Schema18.optionalKey(providerSettings)
2782
+ settings: Schema18.optionalKey(createTargetSettings)
2603
2783
  }).annotate({ identifier: "CreatePostTarget" });
2604
2784
  var postText = Schema18.Trim.check(Schema18.isMaxLength(postTextLimit)).pipe(Schema18.annotateEncoded({
2605
2785
  description: `At most ${postTextLimit} characters after trimming.`
@@ -3291,6 +3471,31 @@ var InboxReviewList = Schema21.Struct({
3291
3471
  var InboxUnreadCount = Schema21.Struct({
3292
3472
  unreadCount: Schema21.Int
3293
3473
  }).annotate({ identifier: "InboxUnreadCount" });
3474
+ var InboxUnavailableReason = Schema21.Literals([
3475
+ "provider_subscription_limit",
3476
+ "missing_scopes",
3477
+ "webhook_invalid",
3478
+ "subscription_pending",
3479
+ "plan_required",
3480
+ "insufficient_credit",
3481
+ "spend_cap_reached"
3482
+ ]);
3483
+ var InboxUnavailableState = Schema21.Struct({
3484
+ reason: InboxUnavailableReason,
3485
+ action: Schema21.Literals([
3486
+ "contact_pubnio",
3487
+ "reconnect_account",
3488
+ "wait_for_repair",
3489
+ "upgrade_plan",
3490
+ "add_credit",
3491
+ "raise_spend_cap"
3492
+ ])
3493
+ });
3494
+ var InboxDeliveryGap = Schema21.Struct({
3495
+ from: Schema21.String,
3496
+ to: Schema21.String,
3497
+ action: Schema21.Literal("review_on_x")
3498
+ });
3294
3499
  var InboxChannelCapability = Schema21.Struct({
3295
3500
  resource: InboxResource,
3296
3501
  supported: Schema21.Boolean,
@@ -3303,7 +3508,8 @@ var InboxChannelCapability = Schema21.Struct({
3303
3508
  syncMode: InboxSyncMode,
3304
3509
  backfillDays: Schema21.Int,
3305
3510
  missingScopes: Schema21.Array(Schema21.String),
3306
- missingTasks: Schema21.Array(Schema21.String)
3511
+ missingTasks: Schema21.Array(Schema21.String),
3512
+ unavailable: Schema21.NullOr(InboxUnavailableState)
3307
3513
  }).annotate({ identifier: "InboxChannelCapability" });
3308
3514
  var InboxAccountCapabilities = Schema21.Struct({
3309
3515
  accountId: AccountId,
@@ -3318,6 +3524,7 @@ var InboxAccountCapabilities = Schema21.Struct({
3318
3524
  mentions: InboxChannelCapability,
3319
3525
  replyWindow: InboxReplyWindow,
3320
3526
  lastSyncError: Schema21.NullOr(Schema21.String),
3527
+ deliveryGap: Schema21.NullOr(InboxDeliveryGap),
3321
3528
  checkedAt: Schema21.String
3322
3529
  }).annotate({ identifier: "InboxAccountCapabilities" });
3323
3530
  var InboxCapabilities = Schema21.Struct({
@@ -4230,7 +4437,8 @@ var WorkspaceEventType = Schema26.Literals([
4230
4437
  "billing.credit.topped_up",
4231
4438
  "billing.credit.low",
4232
4439
  "billing.spend_cap.reached",
4233
- "billing.invoice.payment_failed"
4440
+ "billing.invoice.payment_failed",
4441
+ "billing.subscription.duplicate_refunded"
4234
4442
  ]);
4235
4443
  var WorkspaceEventEnvelope = Schema26.Struct({
4236
4444
  id: Schema26.String.check(Schema26.isUUID()),
@@ -4811,6 +5019,15 @@ var WebhookEvent = Schema27.Union([
4811
5019
  hostedInvoiceUrl: Schema27.NullOr(Schema27.String)
4812
5020
  })
4813
5021
  }),
5022
+ Schema27.Struct({
5023
+ ...envelope,
5024
+ type: Schema27.Literal("billing.subscription.duplicate_refunded"),
5025
+ data: Schema27.Struct({
5026
+ subscriptionId: Schema27.String,
5027
+ amountRefundedMinor: Schema27.Int,
5028
+ currency: Schema27.String
5029
+ })
5030
+ }),
4814
5031
  Schema27.Struct({
4815
5032
  ...envelope,
4816
5033
  type: Schema27.Literal("webhook.test"),
@@ -4994,6 +5211,27 @@ class SeatLimitReached extends HttpApiError.Problem()("SeatLimitReached", {
4994
5211
  }) {
4995
5212
  }
4996
5213
 
5214
+ class PlanRequired extends HttpApiError.Problem()("PlanRequired", {
5215
+ type: "urn:pubnio:problem:plan-required",
5216
+ status: 402,
5217
+ title: "Plan upgrade required"
5218
+ }, {
5219
+ code: Schema28.Literal("plan_required"),
5220
+ entitlement: Schema28.Literals([
5221
+ "adsInsights",
5222
+ "adsWrite",
5223
+ "analyticsHistory"
5224
+ ]),
5225
+ currentPlan: BillingPlanId,
5226
+ minimumPlan: BillingPlanId,
5227
+ fundingUrl: Schema28.String,
5228
+ canManageBilling: Schema28.Boolean,
5229
+ nextAction: Schema28.String,
5230
+ param: Schema28.optionalKey(Schema28.String),
5231
+ earliestDate: Schema28.optionalKey(Schema28.String)
5232
+ }) {
5233
+ }
5234
+
4997
5235
  class AlreadyMember extends HttpApiError.Problem()("AlreadyMember", {
4998
5236
  type: "urn:pubnio:problem:already-member",
4999
5237
  status: 409,
@@ -5465,7 +5703,15 @@ class InboxUnsupportedContent extends HttpApiError.Problem()("InboxUnsupportedCo
5465
5703
  capability: ProductCapability
5466
5704
  }) {
5467
5705
  }
5706
+
5707
+ class InboxUnavailable extends HttpApiError.Problem()("InboxUnavailable", {
5708
+ type: "urn:pubnio:problem:inbox-unavailable",
5709
+ status: 409,
5710
+ title: "Inbox unavailable"
5711
+ }, InboxUnavailableState.fields) {
5712
+ }
5468
5713
  var InboxProblems = [
5714
+ InboxUnavailable,
5469
5715
  InboxReplyWindowClosed,
5470
5716
  InboxTargetChanged,
5471
5717
  InboxSyncInProgress,
@@ -5706,7 +5952,8 @@ var AdsProblems = [
5706
5952
  AdKillSwitchActive,
5707
5953
  AdOperationNotRetryable,
5708
5954
  AdProviderRejected,
5709
- InvalidAdRequest
5955
+ InvalidAdRequest,
5956
+ PlanRequired
5710
5957
  ];
5711
5958
  var SchedulingProblems = [
5712
5959
  QueueNotFound,
@@ -6137,7 +6384,7 @@ import { ProblemDetails } from "effect/http";
6137
6384
  // package.json
6138
6385
  var package_default = {
6139
6386
  name: "@pubnio/sdk",
6140
- version: "0.2.12",
6387
+ version: "0.3.0",
6141
6388
  description: "JavaScript and TypeScript client for the PubNio API",
6142
6389
  type: "module",
6143
6390
  exports: {
@@ -7804,6 +8051,15 @@ var postsCreate = (options) => (options.client ?? client).post({
7804
8051
  ...options.headers
7805
8052
  }
7806
8053
  });
8054
+ var postsValidateBody = (options) => (options.client ?? client).post({
8055
+ security: [{ scheme: "bearer", type: "http" }],
8056
+ url: "/api/v1/posts/validate",
8057
+ ...options,
8058
+ headers: {
8059
+ "Content-Type": "application/json",
8060
+ ...options.headers
8061
+ }
8062
+ });
7807
8063
  var postsDelete = (options) => (options.client ?? client).delete({
7808
8064
  security: [{ scheme: "bearer", type: "http" }],
7809
8065
  url: "/api/v1/posts/{postId}",
@@ -9341,6 +9597,15 @@ function createPubNioClient({
9341
9597
  query: { workspaceId },
9342
9598
  ...transport()
9343
9599
  })),
9600
+ validateBody: (input) => {
9601
+ const body = input;
9602
+ return decode(PostValidation, postsValidateBody({
9603
+ client,
9604
+ query: { workspaceId },
9605
+ body,
9606
+ ...transport()
9607
+ }));
9608
+ },
9344
9609
  publish: (postId, input) => {
9345
9610
  const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
9346
9611
  return withIdempotencyKey(idempotencyKey, async () => {