@gpt-platform/client 0.8.1 → 0.8.2
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.d.mts +80 -5
- package/dist/index.d.ts +80 -5
- package/dist/index.js +401 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +401 -12
- package/dist/index.mjs.map +1 -1
- package/llms.txt +18 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1269,7 +1269,7 @@ function buildUserAgent(sdkVersion, appInfo) {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
1271
|
// src/version.ts
|
|
1272
|
-
var SDK_VERSION = "0.8.
|
|
1272
|
+
var SDK_VERSION = "0.8.2";
|
|
1273
1273
|
var DEFAULT_API_VERSION = "2026-03-11";
|
|
1274
1274
|
|
|
1275
1275
|
// src/base-client.ts
|
|
@@ -3306,6 +3306,15 @@ var patchCrawlerJobsByIdCancel = (options) => (options.client ?? client).patch({
|
|
|
3306
3306
|
...options.headers
|
|
3307
3307
|
}
|
|
3308
3308
|
});
|
|
3309
|
+
var postContentGenerateHashtags = (options) => (options.client ?? client).post({
|
|
3310
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3311
|
+
url: "/content/generate-hashtags",
|
|
3312
|
+
...options,
|
|
3313
|
+
headers: {
|
|
3314
|
+
"Content-Type": "application/vnd.api+json",
|
|
3315
|
+
...options.headers
|
|
3316
|
+
}
|
|
3317
|
+
});
|
|
3309
3318
|
var deleteClinicalNotesById = (options) => (options.client ?? client).delete({
|
|
3310
3319
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3311
3320
|
url: "/clinical/notes/{id}",
|
|
@@ -3534,6 +3543,15 @@ var patchEmailInboundAddressesByIdRotateToken = (options) => (options.client ??
|
|
|
3534
3543
|
...options.headers
|
|
3535
3544
|
}
|
|
3536
3545
|
});
|
|
3546
|
+
var postContentSeoEnrich = (options) => (options.client ?? client).post({
|
|
3547
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3548
|
+
url: "/content/seo-enrich",
|
|
3549
|
+
...options,
|
|
3550
|
+
headers: {
|
|
3551
|
+
"Content-Type": "application/vnd.api+json",
|
|
3552
|
+
...options.headers
|
|
3553
|
+
}
|
|
3554
|
+
});
|
|
3537
3555
|
var deleteSchedulingParticipantsById = (options) => (options.client ?? client).delete({
|
|
3538
3556
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3539
3557
|
url: "/scheduling/participants/{id}",
|
|
@@ -4110,6 +4128,15 @@ var postRoles = (options) => (options.client ?? client).post({
|
|
|
4110
4128
|
...options.headers
|
|
4111
4129
|
}
|
|
4112
4130
|
});
|
|
4131
|
+
var postContentGenerateText = (options) => (options.client ?? client).post({
|
|
4132
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4133
|
+
url: "/content/generate-text",
|
|
4134
|
+
...options,
|
|
4135
|
+
headers: {
|
|
4136
|
+
"Content-Type": "application/vnd.api+json",
|
|
4137
|
+
...options.headers
|
|
4138
|
+
}
|
|
4139
|
+
});
|
|
4113
4140
|
var getComplianceRequirementCompletions = (options) => (options.client ?? client).get({
|
|
4114
4141
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4115
4142
|
url: "/compliance-requirement-completions",
|
|
@@ -4241,6 +4268,15 @@ var postSocialPosts = (options) => (options.client ?? client).post({
|
|
|
4241
4268
|
...options.headers
|
|
4242
4269
|
}
|
|
4243
4270
|
});
|
|
4271
|
+
var postContentShorten = (options) => (options.client ?? client).post({
|
|
4272
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4273
|
+
url: "/content/shorten",
|
|
4274
|
+
...options,
|
|
4275
|
+
headers: {
|
|
4276
|
+
"Content-Type": "application/vnd.api+json",
|
|
4277
|
+
...options.headers
|
|
4278
|
+
}
|
|
4279
|
+
});
|
|
4244
4280
|
var deleteClinicalPatientsById = (options) => (options.client ?? client).delete({
|
|
4245
4281
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4246
4282
|
url: "/clinical/patients/{id}",
|
|
@@ -4561,6 +4597,15 @@ var getUserProfilesMe = (options) => (options.client ?? client).get({
|
|
|
4561
4597
|
url: "/user-profiles/me",
|
|
4562
4598
|
...options
|
|
4563
4599
|
});
|
|
4600
|
+
var postContentSuggestTopics = (options) => (options.client ?? client).post({
|
|
4601
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4602
|
+
url: "/content/suggest-topics",
|
|
4603
|
+
...options,
|
|
4604
|
+
headers: {
|
|
4605
|
+
"Content-Type": "application/vnd.api+json",
|
|
4606
|
+
...options.headers
|
|
4607
|
+
}
|
|
4608
|
+
});
|
|
4564
4609
|
var postDocumentsPresignedUpload = (options) => (options.client ?? client).post({
|
|
4565
4610
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4566
4611
|
url: "/documents/presigned-upload",
|
|
@@ -5151,6 +5196,15 @@ var getTransactions = (options) => (options.client ?? client).get({
|
|
|
5151
5196
|
url: "/transactions",
|
|
5152
5197
|
...options
|
|
5153
5198
|
});
|
|
5199
|
+
var postContentGenerateImagePrompt = (options) => (options.client ?? client).post({
|
|
5200
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
5201
|
+
url: "/content/generate-image-prompt",
|
|
5202
|
+
...options,
|
|
5203
|
+
headers: {
|
|
5204
|
+
"Content-Type": "application/vnd.api+json",
|
|
5205
|
+
...options.headers
|
|
5206
|
+
}
|
|
5207
|
+
});
|
|
5154
5208
|
var postSocialTrendingHistory = (options) => (options.client ?? client).post({
|
|
5155
5209
|
security: [{ scheme: "bearer", type: "http" }],
|
|
5156
5210
|
url: "/social/trending/history",
|
|
@@ -5355,6 +5409,15 @@ var patchEmailOutboundEmailsByIdCancelSchedule = (options) => (options.client ??
|
|
|
5355
5409
|
...options.headers
|
|
5356
5410
|
}
|
|
5357
5411
|
});
|
|
5412
|
+
var postContentRefine = (options) => (options.client ?? client).post({
|
|
5413
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
5414
|
+
url: "/content/refine",
|
|
5415
|
+
...options,
|
|
5416
|
+
headers: {
|
|
5417
|
+
"Content-Type": "application/vnd.api+json",
|
|
5418
|
+
...options.headers
|
|
5419
|
+
}
|
|
5420
|
+
});
|
|
5358
5421
|
var getLegalDocumentsByLocale = (options) => (options.client ?? client).get({
|
|
5359
5422
|
security: [{ scheme: "bearer", type: "http" }],
|
|
5360
5423
|
url: "/legal-documents/by-locale",
|
|
@@ -5657,6 +5720,15 @@ var patchSchedulingEventsById = (options) => (options.client ?? client).patch({
|
|
|
5657
5720
|
...options.headers
|
|
5658
5721
|
}
|
|
5659
5722
|
});
|
|
5723
|
+
var postContentRewriteTone = (options) => (options.client ?? client).post({
|
|
5724
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
5725
|
+
url: "/content/rewrite-tone",
|
|
5726
|
+
...options,
|
|
5727
|
+
headers: {
|
|
5728
|
+
"Content-Type": "application/vnd.api+json",
|
|
5729
|
+
...options.headers
|
|
5730
|
+
}
|
|
5731
|
+
});
|
|
5660
5732
|
var patchStorageFilesByIdSoftDelete = (options) => (options.client ?? client).patch({
|
|
5661
5733
|
security: [{ scheme: "bearer", type: "http" }],
|
|
5662
5734
|
url: "/storage-files/{id}/soft-delete",
|
|
@@ -5685,6 +5757,15 @@ var patchConnectorsById = (options) => (options.client ?? client).patch({
|
|
|
5685
5757
|
...options.headers
|
|
5686
5758
|
}
|
|
5687
5759
|
});
|
|
5760
|
+
var postContentGenerateImage = (options) => (options.client ?? client).post({
|
|
5761
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
5762
|
+
url: "/content/generate-image",
|
|
5763
|
+
...options,
|
|
5764
|
+
headers: {
|
|
5765
|
+
"Content-Type": "application/vnd.api+json",
|
|
5766
|
+
...options.headers
|
|
5767
|
+
}
|
|
5768
|
+
});
|
|
5688
5769
|
var patchWalletPlanCancel = (options) => (options.client ?? client).patch({
|
|
5689
5770
|
security: [{ scheme: "bearer", type: "http" }],
|
|
5690
5771
|
url: "/wallet/plan/cancel",
|
|
@@ -5973,6 +6054,15 @@ var postSchedulingEvents = (options) => (options.client ?? client).post({
|
|
|
5973
6054
|
...options.headers
|
|
5974
6055
|
}
|
|
5975
6056
|
});
|
|
6057
|
+
var postContentEditImage = (options) => (options.client ?? client).post({
|
|
6058
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
6059
|
+
url: "/content/edit-image",
|
|
6060
|
+
...options,
|
|
6061
|
+
headers: {
|
|
6062
|
+
"Content-Type": "application/vnd.api+json",
|
|
6063
|
+
...options.headers
|
|
6064
|
+
}
|
|
6065
|
+
});
|
|
5976
6066
|
var postEmailRecipients = (options) => (options.client ?? client).post({
|
|
5977
6067
|
security: [{ scheme: "bearer", type: "http" }],
|
|
5978
6068
|
url: "/email/recipients",
|
|
@@ -10679,6 +10769,249 @@ function createCatalogNamespace(rb) {
|
|
|
10679
10769
|
};
|
|
10680
10770
|
}
|
|
10681
10771
|
|
|
10772
|
+
// src/namespaces/content.ts
|
|
10773
|
+
function createContentNamespace(rb) {
|
|
10774
|
+
return {
|
|
10775
|
+
/**
|
|
10776
|
+
* Generate text from a prompt, optionally informed by brand identity.
|
|
10777
|
+
* @param attributes - { prompt, workspace_id, brand_identity_id?, task? }
|
|
10778
|
+
* @returns { text: string }
|
|
10779
|
+
* @example
|
|
10780
|
+
* ```typescript
|
|
10781
|
+
* const result = await client.content.generateText({
|
|
10782
|
+
* prompt: "Write about AI analytics",
|
|
10783
|
+
* workspace_id: "ws_abc",
|
|
10784
|
+
* });
|
|
10785
|
+
* ```
|
|
10786
|
+
*/
|
|
10787
|
+
generateText: async (attributes, options) => {
|
|
10788
|
+
return rb.execute(
|
|
10789
|
+
postContentGenerateText,
|
|
10790
|
+
{
|
|
10791
|
+
body: {
|
|
10792
|
+
data: { type: "content-generation", attributes }
|
|
10793
|
+
}
|
|
10794
|
+
},
|
|
10795
|
+
options
|
|
10796
|
+
);
|
|
10797
|
+
},
|
|
10798
|
+
/**
|
|
10799
|
+
* Generate an image from a text prompt via Gemini.
|
|
10800
|
+
* @param attributes - { prompt, workspace_id, style? }
|
|
10801
|
+
* @returns { url: string, provider: string }
|
|
10802
|
+
* @example
|
|
10803
|
+
* ```typescript
|
|
10804
|
+
* const result = await client.content.generateImage({
|
|
10805
|
+
* prompt: "A futuristic city skyline",
|
|
10806
|
+
* workspace_id: "ws_abc",
|
|
10807
|
+
* });
|
|
10808
|
+
* ```
|
|
10809
|
+
*/
|
|
10810
|
+
generateImage: async (attributes, options) => {
|
|
10811
|
+
return rb.execute(
|
|
10812
|
+
postContentGenerateImage,
|
|
10813
|
+
{
|
|
10814
|
+
body: {
|
|
10815
|
+
data: { type: "content-generation", attributes }
|
|
10816
|
+
}
|
|
10817
|
+
},
|
|
10818
|
+
options
|
|
10819
|
+
);
|
|
10820
|
+
},
|
|
10821
|
+
/**
|
|
10822
|
+
* Edit an existing image using natural language instructions.
|
|
10823
|
+
* @param attributes - { image_url, instructions, workspace_id }
|
|
10824
|
+
* @returns { url: string, provider: string }
|
|
10825
|
+
* @example
|
|
10826
|
+
* ```typescript
|
|
10827
|
+
* const result = await client.content.editImage({
|
|
10828
|
+
* image_url: "https://example.com/photo.png",
|
|
10829
|
+
* instructions: "Remove the background",
|
|
10830
|
+
* workspace_id: "ws_abc",
|
|
10831
|
+
* });
|
|
10832
|
+
* ```
|
|
10833
|
+
*/
|
|
10834
|
+
editImage: async (attributes, options) => {
|
|
10835
|
+
return rb.execute(
|
|
10836
|
+
postContentEditImage,
|
|
10837
|
+
{
|
|
10838
|
+
body: {
|
|
10839
|
+
data: { type: "content-generation", attributes }
|
|
10840
|
+
}
|
|
10841
|
+
},
|
|
10842
|
+
options
|
|
10843
|
+
);
|
|
10844
|
+
},
|
|
10845
|
+
/**
|
|
10846
|
+
* Rewrite text in a different tone.
|
|
10847
|
+
* @param attributes - { text, target_tone, workspace_id, max_length? }
|
|
10848
|
+
* @returns { rewritten_text: string }
|
|
10849
|
+
* @example
|
|
10850
|
+
* ```typescript
|
|
10851
|
+
* const result = await client.content.rewriteTone({
|
|
10852
|
+
* text: "We are pleased to announce our new product.",
|
|
10853
|
+
* target_tone: "casual",
|
|
10854
|
+
* workspace_id: "ws_abc",
|
|
10855
|
+
* });
|
|
10856
|
+
* ```
|
|
10857
|
+
*/
|
|
10858
|
+
rewriteTone: async (attributes, options) => {
|
|
10859
|
+
return rb.execute(
|
|
10860
|
+
postContentRewriteTone,
|
|
10861
|
+
{
|
|
10862
|
+
body: {
|
|
10863
|
+
data: { type: "content-generation", attributes }
|
|
10864
|
+
}
|
|
10865
|
+
},
|
|
10866
|
+
options
|
|
10867
|
+
);
|
|
10868
|
+
},
|
|
10869
|
+
/**
|
|
10870
|
+
* Shorten text to a target character count.
|
|
10871
|
+
* @param attributes - { text, max_chars, workspace_id, platform? }
|
|
10872
|
+
* @returns { shortened_text: string }
|
|
10873
|
+
* @example
|
|
10874
|
+
* ```typescript
|
|
10875
|
+
* const result = await client.content.shorten({
|
|
10876
|
+
* text: "This is a long piece of content that needs shortening.",
|
|
10877
|
+
* max_chars: 280,
|
|
10878
|
+
* workspace_id: "ws_abc",
|
|
10879
|
+
* });
|
|
10880
|
+
* ```
|
|
10881
|
+
*/
|
|
10882
|
+
shorten: async (attributes, options) => {
|
|
10883
|
+
return rb.execute(
|
|
10884
|
+
postContentShorten,
|
|
10885
|
+
{
|
|
10886
|
+
body: {
|
|
10887
|
+
data: { type: "content-generation", attributes }
|
|
10888
|
+
}
|
|
10889
|
+
},
|
|
10890
|
+
options
|
|
10891
|
+
);
|
|
10892
|
+
},
|
|
10893
|
+
/**
|
|
10894
|
+
* Refine text based on freeform instructions.
|
|
10895
|
+
* @param attributes - { text, instructions, workspace_id }
|
|
10896
|
+
* @returns { refined_text: string }
|
|
10897
|
+
* @example
|
|
10898
|
+
* ```typescript
|
|
10899
|
+
* const result = await client.content.refine({
|
|
10900
|
+
* text: "Draft blog post content here.",
|
|
10901
|
+
* instructions: "Make it more engaging and add a call to action",
|
|
10902
|
+
* workspace_id: "ws_abc",
|
|
10903
|
+
* });
|
|
10904
|
+
* ```
|
|
10905
|
+
*/
|
|
10906
|
+
refine: async (attributes, options) => {
|
|
10907
|
+
return rb.execute(
|
|
10908
|
+
postContentRefine,
|
|
10909
|
+
{
|
|
10910
|
+
body: {
|
|
10911
|
+
data: { type: "content-generation", attributes }
|
|
10912
|
+
}
|
|
10913
|
+
},
|
|
10914
|
+
options
|
|
10915
|
+
);
|
|
10916
|
+
},
|
|
10917
|
+
/**
|
|
10918
|
+
* Suggest content topics based on industry and audience.
|
|
10919
|
+
* @param attributes - { workspace_id, industry?, brand_identity_id?, count? }
|
|
10920
|
+
* @returns { suggestions: string }
|
|
10921
|
+
* @example
|
|
10922
|
+
* ```typescript
|
|
10923
|
+
* const result = await client.content.suggestTopics({
|
|
10924
|
+
* workspace_id: "ws_abc",
|
|
10925
|
+
* industry: "fintech",
|
|
10926
|
+
* count: 5,
|
|
10927
|
+
* });
|
|
10928
|
+
* ```
|
|
10929
|
+
*/
|
|
10930
|
+
suggestTopics: async (attributes, options) => {
|
|
10931
|
+
return rb.execute(
|
|
10932
|
+
postContentSuggestTopics,
|
|
10933
|
+
{
|
|
10934
|
+
body: {
|
|
10935
|
+
data: { type: "content-generation", attributes }
|
|
10936
|
+
}
|
|
10937
|
+
},
|
|
10938
|
+
options
|
|
10939
|
+
);
|
|
10940
|
+
},
|
|
10941
|
+
/**
|
|
10942
|
+
* Generate an image generation prompt from marketing copy.
|
|
10943
|
+
* @param attributes - { marketing_copy, workspace_id, style? }
|
|
10944
|
+
* @returns { image_prompt: string }
|
|
10945
|
+
* @example
|
|
10946
|
+
* ```typescript
|
|
10947
|
+
* const result = await client.content.generateImagePrompt({
|
|
10948
|
+
* marketing_copy: "Launch your brand into the future",
|
|
10949
|
+
* workspace_id: "ws_abc",
|
|
10950
|
+
* });
|
|
10951
|
+
* ```
|
|
10952
|
+
*/
|
|
10953
|
+
generateImagePrompt: async (attributes, options) => {
|
|
10954
|
+
return rb.execute(
|
|
10955
|
+
postContentGenerateImagePrompt,
|
|
10956
|
+
{
|
|
10957
|
+
body: {
|
|
10958
|
+
data: { type: "content-generation", attributes }
|
|
10959
|
+
}
|
|
10960
|
+
},
|
|
10961
|
+
options
|
|
10962
|
+
);
|
|
10963
|
+
},
|
|
10964
|
+
/**
|
|
10965
|
+
* Generate scored hashtags for content.
|
|
10966
|
+
* @param attributes - { text, platform, workspace_id, industry?, count? }
|
|
10967
|
+
* @returns { hashtags: Array<{ tag: string, score: number }> }
|
|
10968
|
+
* @example
|
|
10969
|
+
* ```typescript
|
|
10970
|
+
* const result = await client.content.generateHashtags({
|
|
10971
|
+
* text: "Check out our new AI-powered analytics tool",
|
|
10972
|
+
* platform: "instagram",
|
|
10973
|
+
* workspace_id: "ws_abc",
|
|
10974
|
+
* });
|
|
10975
|
+
* ```
|
|
10976
|
+
*/
|
|
10977
|
+
generateHashtags: async (attributes, options) => {
|
|
10978
|
+
return rb.execute(
|
|
10979
|
+
postContentGenerateHashtags,
|
|
10980
|
+
{
|
|
10981
|
+
body: {
|
|
10982
|
+
data: { type: "content-generation", attributes }
|
|
10983
|
+
}
|
|
10984
|
+
},
|
|
10985
|
+
options
|
|
10986
|
+
);
|
|
10987
|
+
},
|
|
10988
|
+
/**
|
|
10989
|
+
* Analyze content for SEO optimization against target keywords.
|
|
10990
|
+
* @param attributes - { text, target_keywords, workspace_id }
|
|
10991
|
+
* @returns { analysis: { keyword_coverage, suggestions, seo_score } }
|
|
10992
|
+
* @example
|
|
10993
|
+
* ```typescript
|
|
10994
|
+
* const result = await client.content.seoEnrich({
|
|
10995
|
+
* text: "Our product helps businesses grow",
|
|
10996
|
+
* target_keywords: ["growth", "business", "scale"],
|
|
10997
|
+
* workspace_id: "ws_abc",
|
|
10998
|
+
* });
|
|
10999
|
+
* ```
|
|
11000
|
+
*/
|
|
11001
|
+
seoEnrich: async (attributes, options) => {
|
|
11002
|
+
return rb.execute(
|
|
11003
|
+
postContentSeoEnrich,
|
|
11004
|
+
{
|
|
11005
|
+
body: {
|
|
11006
|
+
data: { type: "content-generation", attributes }
|
|
11007
|
+
}
|
|
11008
|
+
},
|
|
11009
|
+
options
|
|
11010
|
+
);
|
|
11011
|
+
}
|
|
11012
|
+
};
|
|
11013
|
+
}
|
|
11014
|
+
|
|
10682
11015
|
// src/namespaces/clinical.ts
|
|
10683
11016
|
function createClinicalNamespace(rb) {
|
|
10684
11017
|
return {
|
|
@@ -10779,6 +11112,27 @@ function createClinicalNamespace(rb) {
|
|
|
10779
11112
|
* ```
|
|
10780
11113
|
*/
|
|
10781
11114
|
delete: async (id, options) => rb.executeDelete(deleteClinicalPatientsById, { path: { id } }, options),
|
|
11115
|
+
/**
|
|
11116
|
+
* Look up a patient by their CRM Contact ID.
|
|
11117
|
+
*
|
|
11118
|
+
* Most ISV apps work with CRM Contact IDs, not Clinical Patient UUIDs.
|
|
11119
|
+
* Use this to resolve the patient record for a given contact.
|
|
11120
|
+
*
|
|
11121
|
+
* @param contactId - CRM Contact UUID
|
|
11122
|
+
* @param options - Request options
|
|
11123
|
+
* @returns {@link ClinicalPatient} record linked to the contact
|
|
11124
|
+
* @throws {@link NotFoundError} if no patient exists for the contact
|
|
11125
|
+
*
|
|
11126
|
+
* @example
|
|
11127
|
+
* ```typescript
|
|
11128
|
+
* const patient = await client.clinical.patients.getByContact('c7da2056-...');
|
|
11129
|
+
* console.log(patient.id); // Clinical Patient UUID
|
|
11130
|
+
* ```
|
|
11131
|
+
*/
|
|
11132
|
+
getByContact: async (contactId, options) => rb.rawGet(
|
|
11133
|
+
`/clinical/patients/by-contact/${contactId}`,
|
|
11134
|
+
options
|
|
11135
|
+
),
|
|
10782
11136
|
/**
|
|
10783
11137
|
* List health metrics for a patient (related resource).
|
|
10784
11138
|
*
|
|
@@ -29692,6 +30046,15 @@ function buildHeaders(getHeaders, options) {
|
|
|
29692
30046
|
}
|
|
29693
30047
|
return headers;
|
|
29694
30048
|
}
|
|
30049
|
+
function enrichError(error, result) {
|
|
30050
|
+
if (typeof error === "object" && error !== null && typeof result === "object" && result !== null) {
|
|
30051
|
+
const res = result.response;
|
|
30052
|
+
if (res && typeof res === "object" && "status" in res) {
|
|
30053
|
+
error.statusCode = res.status;
|
|
30054
|
+
}
|
|
30055
|
+
}
|
|
30056
|
+
return error;
|
|
30057
|
+
}
|
|
29695
30058
|
var RequestBuilder = class {
|
|
29696
30059
|
constructor(clientInstance, getHeaders, unwrap, requestWithRetry) {
|
|
29697
30060
|
this.clientInstance = clientInstance;
|
|
@@ -29706,7 +30069,7 @@ var RequestBuilder = class {
|
|
|
29706
30069
|
async execute(fn, params, options) {
|
|
29707
30070
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29708
30071
|
try {
|
|
29709
|
-
const
|
|
30072
|
+
const result = await this.requestWithRetry(
|
|
29710
30073
|
() => fn({
|
|
29711
30074
|
client: this.clientInstance,
|
|
29712
30075
|
throwOnError: true,
|
|
@@ -29715,9 +30078,9 @@ var RequestBuilder = class {
|
|
|
29715
30078
|
...options?.signal && { signal: options.signal }
|
|
29716
30079
|
})
|
|
29717
30080
|
);
|
|
29718
|
-
const { data, error } =
|
|
30081
|
+
const { data, error } = result;
|
|
29719
30082
|
if (error) {
|
|
29720
|
-
throw error;
|
|
30083
|
+
throw enrichError(error, result);
|
|
29721
30084
|
}
|
|
29722
30085
|
const innerData = data?.data;
|
|
29723
30086
|
return this.unwrap(innerData);
|
|
@@ -29751,13 +30114,17 @@ var RequestBuilder = class {
|
|
|
29751
30114
|
async rawGet(url, options) {
|
|
29752
30115
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29753
30116
|
try {
|
|
29754
|
-
const
|
|
30117
|
+
const result = await this.requestWithRetry(
|
|
29755
30118
|
() => this.clientInstance.get({
|
|
29756
30119
|
url,
|
|
29757
30120
|
headers,
|
|
29758
30121
|
...options?.signal && { signal: options.signal }
|
|
29759
30122
|
})
|
|
29760
30123
|
);
|
|
30124
|
+
const { data, error } = result;
|
|
30125
|
+
if (error) {
|
|
30126
|
+
throw handleApiError(enrichError(error, result));
|
|
30127
|
+
}
|
|
29761
30128
|
return this.unwrap(data?.data);
|
|
29762
30129
|
} catch (error) {
|
|
29763
30130
|
throw handleApiError(error);
|
|
@@ -29772,7 +30139,7 @@ var RequestBuilder = class {
|
|
|
29772
30139
|
async rawPostMultipart(url, body, options) {
|
|
29773
30140
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29774
30141
|
headers["Content-Type"] = null;
|
|
29775
|
-
const
|
|
30142
|
+
const result = await this.requestWithRetry(
|
|
29776
30143
|
() => this.clientInstance.post({
|
|
29777
30144
|
url,
|
|
29778
30145
|
headers,
|
|
@@ -29781,8 +30148,9 @@ var RequestBuilder = class {
|
|
|
29781
30148
|
...options?.signal && { signal: options.signal }
|
|
29782
30149
|
})
|
|
29783
30150
|
);
|
|
30151
|
+
const { data, error } = result;
|
|
29784
30152
|
if (error) {
|
|
29785
|
-
throw handleApiError(error);
|
|
30153
|
+
throw handleApiError(enrichError(error, result));
|
|
29786
30154
|
}
|
|
29787
30155
|
return data;
|
|
29788
30156
|
}
|
|
@@ -29793,7 +30161,7 @@ var RequestBuilder = class {
|
|
|
29793
30161
|
async rawPost(url, body, options) {
|
|
29794
30162
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29795
30163
|
try {
|
|
29796
|
-
const
|
|
30164
|
+
const result = await this.requestWithRetry(
|
|
29797
30165
|
() => this.clientInstance.post({
|
|
29798
30166
|
url,
|
|
29799
30167
|
headers,
|
|
@@ -29801,6 +30169,10 @@ var RequestBuilder = class {
|
|
|
29801
30169
|
...options?.signal && { signal: options.signal }
|
|
29802
30170
|
})
|
|
29803
30171
|
);
|
|
30172
|
+
const { data, error } = result;
|
|
30173
|
+
if (error) {
|
|
30174
|
+
throw handleApiError(enrichError(error, result));
|
|
30175
|
+
}
|
|
29804
30176
|
return this.unwrap(data?.data);
|
|
29805
30177
|
} catch (error) {
|
|
29806
30178
|
throw handleApiError(error);
|
|
@@ -29812,7 +30184,7 @@ var RequestBuilder = class {
|
|
|
29812
30184
|
async rawPut(url, body, options) {
|
|
29813
30185
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29814
30186
|
try {
|
|
29815
|
-
const
|
|
30187
|
+
const result = await this.requestWithRetry(
|
|
29816
30188
|
() => this.clientInstance.put({
|
|
29817
30189
|
url,
|
|
29818
30190
|
headers,
|
|
@@ -29820,6 +30192,10 @@ var RequestBuilder = class {
|
|
|
29820
30192
|
...options?.signal && { signal: options.signal }
|
|
29821
30193
|
})
|
|
29822
30194
|
);
|
|
30195
|
+
const { data, error } = result;
|
|
30196
|
+
if (error) {
|
|
30197
|
+
throw handleApiError(enrichError(error, result));
|
|
30198
|
+
}
|
|
29823
30199
|
return this.unwrap(data?.data);
|
|
29824
30200
|
} catch (error) {
|
|
29825
30201
|
throw handleApiError(error);
|
|
@@ -29831,7 +30207,7 @@ var RequestBuilder = class {
|
|
|
29831
30207
|
async rawPatch(url, body, options) {
|
|
29832
30208
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29833
30209
|
try {
|
|
29834
|
-
const
|
|
30210
|
+
const result = await this.requestWithRetry(
|
|
29835
30211
|
() => this.clientInstance.patch({
|
|
29836
30212
|
url,
|
|
29837
30213
|
headers,
|
|
@@ -29839,6 +30215,10 @@ var RequestBuilder = class {
|
|
|
29839
30215
|
...options?.signal && { signal: options.signal }
|
|
29840
30216
|
})
|
|
29841
30217
|
);
|
|
30218
|
+
const { data, error } = result;
|
|
30219
|
+
if (error) {
|
|
30220
|
+
throw handleApiError(enrichError(error, result));
|
|
30221
|
+
}
|
|
29842
30222
|
return this.unwrap(data?.data);
|
|
29843
30223
|
} catch (error) {
|
|
29844
30224
|
throw handleApiError(error);
|
|
@@ -29850,13 +30230,17 @@ var RequestBuilder = class {
|
|
|
29850
30230
|
async rawDelete(url, options) {
|
|
29851
30231
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29852
30232
|
try {
|
|
29853
|
-
const
|
|
30233
|
+
const result = await this.requestWithRetry(
|
|
29854
30234
|
() => this.clientInstance.delete({
|
|
29855
30235
|
url,
|
|
29856
30236
|
headers,
|
|
29857
30237
|
...options?.signal && { signal: options.signal }
|
|
29858
30238
|
})
|
|
29859
30239
|
);
|
|
30240
|
+
const { data, error } = result;
|
|
30241
|
+
if (error) {
|
|
30242
|
+
throw handleApiError(enrichError(error, result));
|
|
30243
|
+
}
|
|
29860
30244
|
return this.unwrap(data?.data);
|
|
29861
30245
|
} catch (error) {
|
|
29862
30246
|
throw handleApiError(error);
|
|
@@ -29874,7 +30258,7 @@ var RequestBuilder = class {
|
|
|
29874
30258
|
createPaginatedFetcher(fn, queryBuilder, options) {
|
|
29875
30259
|
return async (page, pageSize) => {
|
|
29876
30260
|
const headers = buildHeaders(this.getHeaders, options);
|
|
29877
|
-
const
|
|
30261
|
+
const result = await this.requestWithRetry(
|
|
29878
30262
|
() => fn({
|
|
29879
30263
|
client: this.clientInstance,
|
|
29880
30264
|
headers,
|
|
@@ -29882,6 +30266,10 @@ var RequestBuilder = class {
|
|
|
29882
30266
|
...queryBuilder(page, pageSize)
|
|
29883
30267
|
})
|
|
29884
30268
|
);
|
|
30269
|
+
const { data, error } = result;
|
|
30270
|
+
if (error) {
|
|
30271
|
+
throw handleApiError(enrichError(error, result));
|
|
30272
|
+
}
|
|
29885
30273
|
const envelope = data;
|
|
29886
30274
|
const items = this.unwrap(envelope.data) || [];
|
|
29887
30275
|
return { data: items, links: envelope.links };
|
|
@@ -29999,6 +30387,7 @@ var GptClient = class extends BaseClient {
|
|
|
29999
30387
|
this.ai = createAiNamespace(rb);
|
|
30000
30388
|
this.billing = createBillingNamespace(rb);
|
|
30001
30389
|
this.catalog = createCatalogNamespace(rb);
|
|
30390
|
+
this.content = createContentNamespace(rb);
|
|
30002
30391
|
this.clinical = createClinicalNamespace(rb);
|
|
30003
30392
|
this.compliance = createComplianceNamespace(rb);
|
|
30004
30393
|
this.communication = createCommunicationNamespace(rb);
|