@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/solid.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,
@@ -355,6 +356,8 @@ var IssueCode = Schema6.Literals([
355
356
  "tiktok_upload_required",
356
357
  "tiktok_too_many_mentions",
357
358
  "queue_and_time_conflict",
359
+ "queue_not_found",
360
+ "queue_unavailable",
358
361
  "invalid_field",
359
362
  "account_ambiguous",
360
363
  "unsupported_placement",
@@ -365,8 +368,9 @@ var IssueCode = Schema6.Literals([
365
368
  var PostIssue = Schema6.Struct({
366
369
  code: IssueCode,
367
370
  path: Schema6.Array(Schema6.Union([Schema6.String, Schema6.Int])),
368
- message: Schema6.String
369
- });
371
+ message: Schema6.String,
372
+ candidates: Schema6.optionalKey(Schema6.Array(Schema6.Struct({ accountId: AccountId, name: Schema6.String })))
373
+ }).annotate({ identifier: "PostIssue" });
370
374
  var schemaIssueFormatter = SchemaIssue.makeFormatterStandardSchemaV1();
371
375
 
372
376
  // ../protocol/src/provider.ts
@@ -583,7 +587,10 @@ var DeliveryIssue = Schema8.Literals([
583
587
  "tiktok_settings_not_allowed",
584
588
  "tiktok_processing_failed",
585
589
  "submission_uncertain",
586
- "confirmation_unavailable"
590
+ "confirmation_unavailable",
591
+ "billing_inactive",
592
+ "spend_cap_reached",
593
+ "insufficient_credit"
587
594
  ]);
588
595
  var FirstCommentStatus = Schema8.Literals([
589
596
  "pending",
@@ -682,6 +689,7 @@ var BillingSubscriptionStatus = Schema9.Literals([
682
689
  var UsageMeter = Schema9.Literals([
683
690
  "confirmed_publish",
684
691
  "x_passthrough",
692
+ "x_read",
685
693
  "managed_ad",
686
694
  "inbox_reply",
687
695
  "automation_run"
@@ -698,10 +706,15 @@ var BillingPlan = Schema9.Struct({
698
706
  monthlyPrice: Schema9.NullOr(Money),
699
707
  annualPrice: Schema9.NullOr(Money),
700
708
  meters: Schema9.Array(BillingPlanMeter),
709
+ xReads: Schema9.Boolean,
710
+ includedXReadMicros: Schema9.NullOr(Schema9.Int),
701
711
  seatsLimit: Schema9.NullOr(Schema9.Int),
702
712
  analyticsRetentionDays: Schema9.Int,
703
713
  whiteLabelOAuth: Schema9.Boolean,
704
- ssoSaml: Schema9.Boolean
714
+ ssoSaml: Schema9.Boolean,
715
+ priorityQueue: Schema9.Boolean,
716
+ adsInsights: Schema9.Boolean,
717
+ adsWrite: Schema9.Boolean
705
718
  }).annotate({ identifier: "BillingPlan" });
706
719
  var BillingPlanList = Schema9.Struct({
707
720
  data: Schema9.Array(BillingPlan)
@@ -737,6 +750,8 @@ var WorkspaceBilling = Schema9.Struct({
737
750
  creditBalance: Money,
738
751
  spendControls: BillingSpendControls,
739
752
  currentPeriod: Schema9.Struct({
753
+ start: Schema9.String,
754
+ end: Schema9.String,
740
755
  meters: Schema9.Array(BillingMeterUsage),
741
756
  totalVariableSpendMicros: Schema9.Int,
742
757
  seatsUsed: Schema9.Int,
@@ -1878,7 +1893,51 @@ var ApiLimits = Schema15.Struct({
1878
1893
  media: MediaLimits,
1879
1894
  rateLimits: RateLimits
1880
1895
  }).annotate({ identifier: "ApiLimits" });
1896
+ var pollOptionCount = { minOptions: 2, maxOptions: 4 };
1897
+ var xPollLimits = {
1898
+ ...pollOptionCount,
1899
+ optionCharacters: 25,
1900
+ minDurationMinutes: 5,
1901
+ maxDurationMinutes: 10080
1902
+ };
1903
+ var linkedinPollLimits = {
1904
+ ...pollOptionCount,
1905
+ questionCharacters: 140,
1906
+ optionCharacters: 30,
1907
+ durations: ["ONE_DAY", "THREE_DAYS", "SEVEN_DAYS", "FOURTEEN_DAYS"]
1908
+ };
1909
+ var xReplySettings = [
1910
+ "following",
1911
+ "mentionedUsers",
1912
+ "subscribers",
1913
+ "verified"
1914
+ ];
1915
+ var xMediaTagLimit = 10;
1916
+ var pollOptionLimits = {
1917
+ minOptions: Schema15.Int,
1918
+ maxOptions: Schema15.Int,
1919
+ optionCharacters: Schema15.Int
1920
+ };
1921
+ var FeedSettingsCapability = Schema15.Struct({
1922
+ poll: Schema15.Union([
1923
+ Schema15.Struct({
1924
+ ...pollOptionLimits,
1925
+ minDurationMinutes: Schema15.Int,
1926
+ maxDurationMinutes: Schema15.Int
1927
+ }),
1928
+ Schema15.Struct({
1929
+ ...pollOptionLimits,
1930
+ questionCharacters: Schema15.Int,
1931
+ durations: Schema15.Array(Schema15.Literals(linkedinPollLimits.durations))
1932
+ })
1933
+ ]),
1934
+ replySettings: Schema15.optionalKey(Schema15.Array(Schema15.Literals(xReplySettings))),
1935
+ maxMediaTags: Schema15.optionalKey(Schema15.Int),
1936
+ placeId: Schema15.optionalKey(Schema15.Boolean),
1937
+ quotePostId: Schema15.optionalKey(Schema15.Boolean)
1938
+ });
1881
1939
  var PlacementCapability = Schema15.Struct({
1940
+ settings: Schema15.optionalKey(FeedSettingsCapability),
1882
1941
  placement: PublishPlacement,
1883
1942
  default: Schema15.Boolean,
1884
1943
  mediaTypes: Schema15.Array(MediaType),
@@ -2176,6 +2235,12 @@ var OAuthFailureReason = Schema17.Literals([
2176
2235
  "connection_changed",
2177
2236
  "connection_failed"
2178
2237
  ]);
2238
+ var ConnectionEmptyReason = Schema17.Literals([
2239
+ "pages_permission_declined",
2240
+ "no_pages",
2241
+ "granted_pages_not_listed",
2242
+ "business_assets_unavailable"
2243
+ ]);
2179
2244
  var attempt2 = { attemptId: uuid3, provider: AccountProvider };
2180
2245
  var ConnectionStatus = Schema17.Union([
2181
2246
  Schema17.Struct({
@@ -2243,9 +2308,14 @@ var InstagramAudioSearch = Schema17.Struct({
2243
2308
  import { Schema as Schema28 } from "effect";
2244
2309
 
2245
2310
  // ../protocol/src/publishing.ts
2246
- import { Schema as Schema18 } from "effect";
2311
+ import { Effect, Schema as Schema18 } from "effect";
2247
2312
  var postTextLimit = 128000;
2248
2313
  var threadPostTextLimit = 1250;
2314
+ var blueskyPostMaxBytes = 3000;
2315
+ var graphemeSegmenter = new Intl.Segmenter(undefined, {
2316
+ granularity: "grapheme"
2317
+ });
2318
+ var utf8 = new TextEncoder;
2249
2319
  var redditTitleMaxLength = 300;
2250
2320
  var threadsTextLimit = 500;
2251
2321
  var xArticleTitleMaxLength = 100;
@@ -2353,12 +2423,34 @@ var InstagramStorySettings = Schema18.Struct({
2353
2423
  muteAudio: Schema18.optionalKey(Schema18.Boolean),
2354
2424
  userTags: instagramTags
2355
2425
  }).annotate({ identifier: "InstagramStorySettings" });
2426
+ var blueskyPostText = Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(blueskyPostMaxBytes));
2356
2427
  var BlueskyFeedSettings = Schema18.Struct({
2357
- firstComment: Schema18.optionalKey(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(300))),
2358
- thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(300))).check(Schema18.isMaxLength(24))),
2428
+ firstComment: Schema18.optionalKey(blueskyPostText),
2429
+ thread: Schema18.optionalKey(Schema18.Array(blueskyPostText).check(Schema18.isMaxLength(24))),
2359
2430
  altText: Schema18.optionalKey(Schema18.String.check(Schema18.isMaxLength(1000)))
2360
2431
  }).annotate({ identifier: "BlueskyFeedSettings" });
2432
+ var nonblank = Schema18.makeFilter((value) => value.trim().length > 0 || "Supply a nonblank string.", { toJsonSchema: () => ({ pattern: "\\S" }) });
2433
+ function pollText(maximum) {
2434
+ return Schema18.String.check(Schema18.isBetweenCodePoints(1, maximum, {
2435
+ expected: `between 1 and ${maximum} characters`
2436
+ }), nonblank);
2437
+ }
2438
+ function pollOptions({
2439
+ minOptions,
2440
+ maxOptions,
2441
+ optionCharacters
2442
+ }) {
2443
+ return Schema18.Array(pollText(optionCharacters)).check(Schema18.isMinLength(minOptions), Schema18.isMaxLength(maxOptions));
2444
+ }
2445
+ var LinkedInPoll = Schema18.Struct({
2446
+ question: pollText(linkedinPollLimits.questionCharacters),
2447
+ options: pollOptions(linkedinPollLimits),
2448
+ duration: Schema18.Literals(linkedinPollLimits.durations)
2449
+ }).annotate({
2450
+ description: "Organic LinkedIn poll. Include post text and omit media, altText, and documentTitle."
2451
+ });
2361
2452
  var LinkedInFeedSettings = Schema18.Struct({
2453
+ poll: Schema18.optionalKey(LinkedInPoll),
2362
2454
  firstComment: Schema18.optionalKey(text),
2363
2455
  thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadPostTextLimit))).check(Schema18.isMaxLength(24))),
2364
2456
  visibility: Schema18.optionalKey(Schema18.Literals(["PUBLIC", "CONNECTIONS"])),
@@ -2395,6 +2487,7 @@ var YouTubeVideoSettings = Schema18.Struct({
2395
2487
  title: Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(100)),
2396
2488
  description: Schema18.optionalKey(Schema18.String.check(Schema18.isMaxLength(5000))),
2397
2489
  privacyStatus: Schema18.Literals(["public", "unlisted", "private"]),
2490
+ firstComment: Schema18.optionalKey(text),
2398
2491
  tags: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMaxLength(100))).check(Schema18.isMaxLength(30))),
2399
2492
  categoryId: Schema18.optionalKey(Schema18.String.check(Schema18.isPattern(/^\d{1,3}$/))),
2400
2493
  madeForKids: Schema18.optionalKey(Schema18.Boolean),
@@ -2409,14 +2502,66 @@ var XArticleDraftSettings = Schema18.Struct({
2409
2502
  title: Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(xArticleTitleMaxLength)),
2410
2503
  content: Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(xArticleContentMaxLength))
2411
2504
  }).annotate({ identifier: "XArticleDraftSettings" });
2505
+ var XPoll = Schema18.Struct({
2506
+ options: pollOptions(xPollLimits),
2507
+ durationMinutes: Schema18.Number.check(Schema18.isInt({ expected: "an integer number of minutes" }), Schema18.isBetween({
2508
+ minimum: xPollLimits.minDurationMinutes,
2509
+ maximum: xPollLimits.maxDurationMinutes
2510
+ }, {
2511
+ expected: `between ${xPollLimits.minDurationMinutes} and ${xPollLimits.maxDurationMinutes} minutes`
2512
+ }))
2513
+ }).annotate({
2514
+ description: "X poll on the root post. Include post text and omit attachments."
2515
+ });
2516
+ var xPostOptionId = Schema18.String.check(Schema18.isPattern(/^[0-9]{1,19}$/, {
2517
+ expected: "an X ID string of 1 to 19 digits"
2518
+ }));
2412
2519
  var XFeedSettings = Schema18.Struct({
2520
+ poll: Schema18.optionalKey(XPoll),
2521
+ replySettings: Schema18.optionalKey(Schema18.Literals(xReplySettings).annotate({
2522
+ description: "Who may reply to the root X post. Omit for the provider default."
2523
+ })),
2524
+ quotePostId: Schema18.optionalKey(xPostOptionId.annotate({
2525
+ 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."
2526
+ })),
2527
+ mediaTaggedUserIds: Schema18.optionalKey(Schema18.Array(xPostOptionId).check(Schema18.isMaxLength(xMediaTagLimit)).annotate({
2528
+ description: "X user ID strings to tag on root post photos (JPEG, PNG, or WebP)."
2529
+ })),
2530
+ placeId: Schema18.optionalKey(Schema18.String.check(Schema18.isTrimmed({
2531
+ expected: "an X Place ID without surrounding whitespace"
2532
+ }), nonblank).annotate({
2533
+ description: "Opaque X Place ID such as geo.place_id from a post lookup."
2534
+ })),
2413
2535
  firstComment: Schema18.optionalKey(text),
2414
- thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(280))).check(Schema18.isMaxLength(24))),
2536
+ thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadPostTextLimit))).check(Schema18.isMaxLength(24))),
2415
2537
  article: Schema18.optionalKey(XArticleDraftSettings)
2416
2538
  }).annotate({ identifier: "XFeedSettings" });
2417
- var GoogleBusinessFeedSettings = Schema18.Struct({}).annotate({
2418
- identifier: "GoogleBusinessFeedSettings"
2419
- });
2539
+ var googleBusinessLocalTimeFormat = "Use a valid location-local date and time in YYYY-MM-DDTHH:MM format.";
2540
+ 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]$/, {
2541
+ message: googleBusinessLocalTimeFormat
2542
+ }), Schema18.makeFilter((value) => {
2543
+ const year = Number(value.slice(0, 4));
2544
+ const date = new Date(`${value}:00Z`);
2545
+ return year > 0 && date.getUTCMonth() + 1 === Number(value.slice(5, 7)) && date.getUTCDate() === Number(value.slice(8, 10)) || googleBusinessLocalTimeFormat;
2546
+ })).annotate({ description: googleBusinessLocalTimeFormat });
2547
+ var googleBusinessNonblank = Schema18.String.check(Schema18.isPattern(/\S/, {
2548
+ message: "Enter a string with non-whitespace content."
2549
+ }));
2550
+ var googleBusinessLink = MediaUrl.annotate({
2551
+ description: "Use an HTTPS URL of at most 2,048 characters without embedded credentials.",
2552
+ message: "Use an HTTPS URL of at most 2,048 characters without embedded credentials."
2553
+ });
2554
+ var GoogleBusinessFeedSettings = Schema18.Struct({
2555
+ topicType: Schema18.optionalKey(Schema18.Literals(["standard", "event", "offer"])),
2556
+ title: Schema18.optionalKey(googleBusinessNonblank),
2557
+ startsAt: Schema18.optionalKey(googleBusinessLocalTime),
2558
+ endsAt: Schema18.optionalKey(googleBusinessLocalTime),
2559
+ couponCode: Schema18.optionalKey(googleBusinessNonblank),
2560
+ redeemUrl: Schema18.optionalKey(googleBusinessLink),
2561
+ terms: Schema18.optionalKey(googleBusinessNonblank),
2562
+ callToAction: Schema18.optionalKey(Schema18.Literals(["book", "order", "shop", "learn_more", "sign_up", "call"])),
2563
+ callToActionUrl: Schema18.optionalKey(googleBusinessLink)
2564
+ }).annotate({ identifier: "GoogleBusinessFeedSettings" });
2420
2565
  var ThreadsFeedSettings = Schema18.Struct({
2421
2566
  firstComment: Schema18.optionalKey(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadsTextLimit))),
2422
2567
  thread: Schema18.optionalKey(Schema18.Array(Schema18.String.check(Schema18.isMinLength(1), Schema18.isMaxLength(threadsTextLimit))).check(Schema18.isMaxLength(24)))
@@ -2595,6 +2740,41 @@ var providerSettings = Schema18.Union([
2595
2740
  TikTokFeedSettings,
2596
2741
  GoogleBusinessFeedSettings
2597
2742
  ]);
2743
+ function settingsShapeErrors(issue, depth = 0) {
2744
+ switch (issue._tag) {
2745
+ case "Composite":
2746
+ return issue.issues.reduce((count, child) => count + settingsShapeErrors(child, depth), 0);
2747
+ case "AnyOf":
2748
+ return issue.issues.length === 0 ? 0 : Math.min(...issue.issues.map((child) => settingsShapeErrors(child, depth)));
2749
+ case "Pointer":
2750
+ return settingsShapeErrors(issue.issue, depth + issue.path.length);
2751
+ case "UnexpectedKey":
2752
+ return depth === 1 ? 3 : 2;
2753
+ case "MissingKey":
2754
+ return depth === 1 ? 4 : 1;
2755
+ default:
2756
+ return 0;
2757
+ }
2758
+ }
2759
+ var createTargetSettings = providerSettings.pipe(Schema18.catchDecoding((issue) => {
2760
+ if (issue._tag !== "AnyOf")
2761
+ return Effect.fail(issue);
2762
+ const [first, ...others] = issue.issues;
2763
+ if (!first)
2764
+ return Effect.fail(issue);
2765
+ let closest = first;
2766
+ let fewest = settingsShapeErrors(first);
2767
+ for (const candidate of others) {
2768
+ if (fewest === 0)
2769
+ break;
2770
+ const errors = settingsShapeErrors(candidate);
2771
+ if (errors < fewest) {
2772
+ closest = candidate;
2773
+ fewest = errors;
2774
+ }
2775
+ }
2776
+ return Effect.fail(closest);
2777
+ }));
2598
2778
  var CreatePostTarget = Schema18.Struct({
2599
2779
  accountId: AccountId,
2600
2780
  provider: Schema18.optionalKey(Provider),
@@ -2606,7 +2786,7 @@ var CreatePostTarget = Schema18.Struct({
2606
2786
  queueId: Schema18.optionalKey(Schema18.String.check(Schema18.isUUID()).annotate({
2607
2787
  description: "Assign this destination to its connected account's schedule queue."
2608
2788
  })),
2609
- settings: Schema18.optionalKey(providerSettings)
2789
+ settings: Schema18.optionalKey(createTargetSettings)
2610
2790
  }).annotate({ identifier: "CreatePostTarget" });
2611
2791
  var postText = Schema18.Trim.check(Schema18.isMaxLength(postTextLimit)).pipe(Schema18.annotateEncoded({
2612
2792
  description: `At most ${postTextLimit} characters after trimming.`
@@ -3298,6 +3478,31 @@ var InboxReviewList = Schema21.Struct({
3298
3478
  var InboxUnreadCount = Schema21.Struct({
3299
3479
  unreadCount: Schema21.Int
3300
3480
  }).annotate({ identifier: "InboxUnreadCount" });
3481
+ var InboxUnavailableReason = Schema21.Literals([
3482
+ "provider_subscription_limit",
3483
+ "missing_scopes",
3484
+ "webhook_invalid",
3485
+ "subscription_pending",
3486
+ "plan_required",
3487
+ "insufficient_credit",
3488
+ "spend_cap_reached"
3489
+ ]);
3490
+ var InboxUnavailableState = Schema21.Struct({
3491
+ reason: InboxUnavailableReason,
3492
+ action: Schema21.Literals([
3493
+ "contact_pubnio",
3494
+ "reconnect_account",
3495
+ "wait_for_repair",
3496
+ "upgrade_plan",
3497
+ "add_credit",
3498
+ "raise_spend_cap"
3499
+ ])
3500
+ });
3501
+ var InboxDeliveryGap = Schema21.Struct({
3502
+ from: Schema21.String,
3503
+ to: Schema21.String,
3504
+ action: Schema21.Literal("review_on_x")
3505
+ });
3301
3506
  var InboxChannelCapability = Schema21.Struct({
3302
3507
  resource: InboxResource,
3303
3508
  supported: Schema21.Boolean,
@@ -3310,7 +3515,8 @@ var InboxChannelCapability = Schema21.Struct({
3310
3515
  syncMode: InboxSyncMode,
3311
3516
  backfillDays: Schema21.Int,
3312
3517
  missingScopes: Schema21.Array(Schema21.String),
3313
- missingTasks: Schema21.Array(Schema21.String)
3518
+ missingTasks: Schema21.Array(Schema21.String),
3519
+ unavailable: Schema21.NullOr(InboxUnavailableState)
3314
3520
  }).annotate({ identifier: "InboxChannelCapability" });
3315
3521
  var InboxAccountCapabilities = Schema21.Struct({
3316
3522
  accountId: AccountId,
@@ -3325,6 +3531,7 @@ var InboxAccountCapabilities = Schema21.Struct({
3325
3531
  mentions: InboxChannelCapability,
3326
3532
  replyWindow: InboxReplyWindow,
3327
3533
  lastSyncError: Schema21.NullOr(Schema21.String),
3534
+ deliveryGap: Schema21.NullOr(InboxDeliveryGap),
3328
3535
  checkedAt: Schema21.String
3329
3536
  }).annotate({ identifier: "InboxAccountCapabilities" });
3330
3537
  var InboxCapabilities = Schema21.Struct({
@@ -4237,7 +4444,8 @@ var WorkspaceEventType = Schema26.Literals([
4237
4444
  "billing.credit.topped_up",
4238
4445
  "billing.credit.low",
4239
4446
  "billing.spend_cap.reached",
4240
- "billing.invoice.payment_failed"
4447
+ "billing.invoice.payment_failed",
4448
+ "billing.subscription.duplicate_refunded"
4241
4449
  ]);
4242
4450
  var WorkspaceEventEnvelope = Schema26.Struct({
4243
4451
  id: Schema26.String.check(Schema26.isUUID()),
@@ -4818,6 +5026,15 @@ var WebhookEvent = Schema27.Union([
4818
5026
  hostedInvoiceUrl: Schema27.NullOr(Schema27.String)
4819
5027
  })
4820
5028
  }),
5029
+ Schema27.Struct({
5030
+ ...envelope,
5031
+ type: Schema27.Literal("billing.subscription.duplicate_refunded"),
5032
+ data: Schema27.Struct({
5033
+ subscriptionId: Schema27.String,
5034
+ amountRefundedMinor: Schema27.Int,
5035
+ currency: Schema27.String
5036
+ })
5037
+ }),
4821
5038
  Schema27.Struct({
4822
5039
  ...envelope,
4823
5040
  type: Schema27.Literal("webhook.test"),
@@ -5001,6 +5218,27 @@ class SeatLimitReached extends HttpApiError.Problem()("SeatLimitReached", {
5001
5218
  }) {
5002
5219
  }
5003
5220
 
5221
+ class PlanRequired extends HttpApiError.Problem()("PlanRequired", {
5222
+ type: "urn:pubnio:problem:plan-required",
5223
+ status: 402,
5224
+ title: "Plan upgrade required"
5225
+ }, {
5226
+ code: Schema28.Literal("plan_required"),
5227
+ entitlement: Schema28.Literals([
5228
+ "adsInsights",
5229
+ "adsWrite",
5230
+ "analyticsHistory"
5231
+ ]),
5232
+ currentPlan: BillingPlanId,
5233
+ minimumPlan: BillingPlanId,
5234
+ fundingUrl: Schema28.String,
5235
+ canManageBilling: Schema28.Boolean,
5236
+ nextAction: Schema28.String,
5237
+ param: Schema28.optionalKey(Schema28.String),
5238
+ earliestDate: Schema28.optionalKey(Schema28.String)
5239
+ }) {
5240
+ }
5241
+
5004
5242
  class AlreadyMember extends HttpApiError.Problem()("AlreadyMember", {
5005
5243
  type: "urn:pubnio:problem:already-member",
5006
5244
  status: 409,
@@ -5472,7 +5710,15 @@ class InboxUnsupportedContent extends HttpApiError.Problem()("InboxUnsupportedCo
5472
5710
  capability: ProductCapability
5473
5711
  }) {
5474
5712
  }
5713
+
5714
+ class InboxUnavailable extends HttpApiError.Problem()("InboxUnavailable", {
5715
+ type: "urn:pubnio:problem:inbox-unavailable",
5716
+ status: 409,
5717
+ title: "Inbox unavailable"
5718
+ }, InboxUnavailableState.fields) {
5719
+ }
5475
5720
  var InboxProblems = [
5721
+ InboxUnavailable,
5476
5722
  InboxReplyWindowClosed,
5477
5723
  InboxTargetChanged,
5478
5724
  InboxSyncInProgress,
@@ -5713,7 +5959,8 @@ var AdsProblems = [
5713
5959
  AdKillSwitchActive,
5714
5960
  AdOperationNotRetryable,
5715
5961
  AdProviderRejected,
5716
- InvalidAdRequest
5962
+ InvalidAdRequest,
5963
+ PlanRequired
5717
5964
  ];
5718
5965
  var SchedulingProblems = [
5719
5966
  QueueNotFound,
@@ -6144,7 +6391,7 @@ import { ProblemDetails } from "effect/http";
6144
6391
  // package.json
6145
6392
  var package_default = {
6146
6393
  name: "@pubnio/sdk",
6147
- version: "0.2.12",
6394
+ version: "0.3.0",
6148
6395
  description: "JavaScript and TypeScript client for the PubNio API",
6149
6396
  type: "module",
6150
6397
  exports: {
@@ -7811,6 +8058,15 @@ var postsCreate = (options) => (options.client ?? client).post({
7811
8058
  ...options.headers
7812
8059
  }
7813
8060
  });
8061
+ var postsValidateBody = (options) => (options.client ?? client).post({
8062
+ security: [{ scheme: "bearer", type: "http" }],
8063
+ url: "/api/v1/posts/validate",
8064
+ ...options,
8065
+ headers: {
8066
+ "Content-Type": "application/json",
8067
+ ...options.headers
8068
+ }
8069
+ });
7814
8070
  var postsDelete = (options) => (options.client ?? client).delete({
7815
8071
  security: [{ scheme: "bearer", type: "http" }],
7816
8072
  url: "/api/v1/posts/{postId}",
@@ -9348,6 +9604,15 @@ function createPubNioClient({
9348
9604
  query: { workspaceId },
9349
9605
  ...transport()
9350
9606
  })),
9607
+ validateBody: (input) => {
9608
+ const body = input;
9609
+ return decode(PostValidation, postsValidateBody({
9610
+ client,
9611
+ query: { workspaceId },
9612
+ body,
9613
+ ...transport()
9614
+ }));
9615
+ },
9351
9616
  publish: (postId, input) => {
9352
9617
  const { idempotencyKey = crypto.randomUUID(), ...publish } = input;
9353
9618
  return withIdempotencyKey(idempotencyKey, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pubnio/sdk",
3
- "version": "0.2.12",
3
+ "version": "0.3.0",
4
4
  "description": "JavaScript and TypeScript client for the PubNio API",
5
5
  "homepage": "https://pubnio.com",
6
6
  "keywords": [