ultracart_rest_api_v2_typescript 4.1.142 → 4.1.144

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.
@@ -1000,6 +1000,8 @@ src/models/SfvbFileEntry.ts
1000
1000
  src/models/SfvbFileRevertRequest.ts
1001
1001
  src/models/SfvbFileSearchRequest.ts
1002
1002
  src/models/SfvbFileSearchResponse.ts
1003
+ src/models/SfvbFileUploadRequest.ts
1004
+ src/models/SfvbFileUploadUrlResponse.ts
1003
1005
  src/models/SfvbFileVersion.ts
1004
1006
  src/models/SfvbFileVersionsResponse.ts
1005
1007
  src/models/SfvbFileWriteRequest.ts
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # UltraCart Typescript SDK
2
- ## ultracart_rest_api_v2_typescript@4.1.142
2
+ ## ultracart_rest_api_v2_typescript@4.1.144
3
3
 
4
4
  Every API method call has a sample for every language SDK. See https://github.com/UltraCart/sdk_samples
5
5
 
6
6
  Installation
7
7
 
8
8
  ```
9
- npm install ultracart_rest_api_v2_typescript@4.1.142 --save
9
+ npm install ultracart_rest_api_v2_typescript@4.1.144 --save
10
10
  ```
11
11
 
12
12
  ```typescript
@@ -85,6 +85,8 @@ Not every change is committed to every SDK.
85
85
 
86
86
  | Version | Date | Comments |
87
87
  | --: | :-: | --- |
88
+ | 4.1.144 | 09/02/2026 | sfvb - internal testing |
89
+ | 4.1.143 | 09/02/2026 | sfvb - internal development |
88
90
  | 4.1.142 | 08/26/2026 | sfvb - internal test |
89
91
  | 4.1.141 | 08/26/2026 | sfvb - internal testing |
90
92
  | 4.1.140 | 08/26/2026 | sfvb - internal testing |
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime';
13
- import { SfvbCompileRequest, SfvbCompileResponse, SfvbContainerResponse, SfvbContainerRevertRequest, SfvbContainerVersion, SfvbContainerVersionsResponse, SfvbContainerWriteRequest, SfvbElementSchemaResponse, SfvbElementsResponse, SfvbFileContentResponse, SfvbFileRevertRequest, SfvbFileSearchRequest, SfvbFileSearchResponse, SfvbFileVersionsResponse, SfvbFileWriteRequest, SfvbFileWriteResponse, SfvbFilesResponse, SfvbLibraryEntry, SfvbLibraryResponse, SfvbPreviewSessionRequest, SfvbPreviewSessionResponse, SfvbPreviewUrlResponse, SfvbRenderRequest, SfvbRenderResponse, SfvbStorefrontsResponse, SfvbTheme, SfvbThemeDuplicateRequest, SfvbThemeJobResponse, SfvbThemesResponse, SfvbUpsellOffersResponse, SfvbValidateRequest, SfvbValidationResponse, SfvbVelocityValidateRequest, SfvbVersionResponse, SfvbWhoamiResponse, SfvbWidgetIdsResponse } from '../models';
13
+ import { SfvbCompileRequest, SfvbCompileResponse, SfvbContainerResponse, SfvbContainerRevertRequest, SfvbContainerVersion, SfvbContainerVersionsResponse, SfvbContainerWriteRequest, SfvbElementSchemaResponse, SfvbElementsResponse, SfvbFileContentResponse, SfvbFileRevertRequest, SfvbFileSearchRequest, SfvbFileSearchResponse, SfvbFileUploadRequest, SfvbFileUploadUrlResponse, SfvbFileVersionsResponse, SfvbFileWriteRequest, SfvbFileWriteResponse, SfvbFilesResponse, SfvbLibraryEntry, SfvbLibraryResponse, SfvbPreviewSessionRequest, SfvbPreviewSessionResponse, SfvbPreviewUrlResponse, SfvbRenderRequest, SfvbRenderResponse, SfvbStorefrontsResponse, SfvbTheme, SfvbThemeDuplicateRequest, SfvbThemeJobResponse, SfvbThemesResponse, SfvbUpsellOffersResponse, SfvbValidateRequest, SfvbValidationResponse, SfvbVelocityValidateRequest, SfvbVersionResponse, SfvbWhoamiResponse, SfvbWidgetIdsResponse } from '../models';
14
14
  export interface CompileSfvbCjsonRequest {
15
15
  compileRequest: SfvbCompileRequest;
16
16
  }
@@ -26,6 +26,10 @@ export interface DeleteSfvbPreviewSessionRequest {
26
26
  storefrontOid: number;
27
27
  previewSessionId: string;
28
28
  }
29
+ export interface DownloadSfvbFileRequest {
30
+ storefrontOid: number;
31
+ path?: string;
32
+ }
29
33
  export interface DuplicateSfvbThemeRequest {
30
34
  storefrontOid: number;
31
35
  themeOid: number;
@@ -55,6 +59,10 @@ export interface GetSfvbFileContentRequest {
55
59
  path?: string;
56
60
  version?: number;
57
61
  }
62
+ export interface GetSfvbFileUploadUrlRequest {
63
+ storefrontOid: number;
64
+ extension: string;
65
+ }
58
66
  export interface GetSfvbLibraryEntryRequest {
59
67
  storefrontOid: number;
60
68
  libraryOid: number;
@@ -152,6 +160,11 @@ export interface SearchSfvbLibraryRequest {
152
160
  pageNumber?: number;
153
161
  resultsPerPage?: number;
154
162
  }
163
+ export interface UploadSfvbFileRequest {
164
+ storefrontOid: number;
165
+ fileUploadRequest: SfvbFileUploadRequest;
166
+ ifMatch?: string;
167
+ }
155
168
  export interface ValidateSfvbCjsonRequest {
156
169
  validateRequest: SfvbValidateRequest;
157
170
  }
@@ -226,6 +239,21 @@ export interface SfvbApiInterface {
226
239
  * Delete a preview session
227
240
  */
228
241
  deleteSfvbPreviewSession(requestParameters: DeleteSfvbPreviewSessionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
242
+ /**
243
+ * Returns the file itself rather than a JSON envelope, for any type including binaries that files/content refuses. Use this to verify what you uploaded, and note it is the only way to read a file inside a theme that is not active - such a file is served to nobody until the theme is promoted, so it has no public URL to fetch instead. On success the body is the file; on failure it is the usual JSON error object, so do not assume the content type without checking the status.
244
+ * @summary Read a storefront file\'s raw bytes
245
+ * @param {number} storefrontOid
246
+ * @param {string} [path]
247
+ * @param {*} [options] Override http request option.
248
+ * @throws {RequiredError}
249
+ * @memberof SfvbApiInterface
250
+ */
251
+ downloadSfvbFileRaw(requestParameters: DownloadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
252
+ /**
253
+ * Returns the file itself rather than a JSON envelope, for any type including binaries that files/content refuses. Use this to verify what you uploaded, and note it is the only way to read a file inside a theme that is not active - such a file is served to nobody until the theme is promoted, so it has no public URL to fetch instead. On success the body is the file; on failure it is the usual JSON error object, so do not assume the content type without checking the status.
254
+ * Read a storefront file\'s raw bytes
255
+ */
256
+ downloadSfvbFile(requestParameters: DownloadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
229
257
  /**
230
258
  * Copies a theme into a new one and returns a job handle to poll. Asynchronous, because copying a theme copies every file in it. Needs sfvb_write rather than sfvb_publish, because the job explicitly does not activate what it creates, so the worst outcome of a mistaken call is a spare theme. This is how you get somewhere safe to work - duplicate, edit the copy with an ordinary write scope, and let a human promote it.
231
259
  * @summary Duplicate a theme
@@ -304,7 +332,7 @@ export interface SfvbApiInterface {
304
332
  */
305
333
  getSfvbElement(requestParameters: GetSfvbElementRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbElementSchemaResponse>;
306
334
  /**
307
- * Returns the current content, or an earlier version when version is supplied. The content hash is returned as an ETag; send it back as If-Match when writing.
335
+ * Returns the current content, or an earlier version when version is supplied. Send the body\'s hash_sha256 back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so prefer the body value.
308
336
  * @summary Read a storefront file
309
337
  * @param {number} storefrontOid
310
338
  * @param {string} [path]
@@ -315,10 +343,25 @@ export interface SfvbApiInterface {
315
343
  */
316
344
  getSfvbFileContentRaw(requestParameters: GetSfvbFileContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SfvbFileContentResponse>>;
317
345
  /**
318
- * Returns the current content, or an earlier version when version is supplied. The content hash is returned as an ETag; send it back as If-Match when writing.
346
+ * Returns the current content, or an earlier version when version is supplied. Send the body\'s hash_sha256 back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so prefer the body value.
319
347
  * Read a storefront file
320
348
  */
321
349
  getSfvbFileContent(requestParameters: GetSfvbFileContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbFileContentResponse>;
350
+ /**
351
+ * Binary content does not travel through this API as JSON, so uploading an image, font, video or PDF is two steps. Ask here for a URL, PUT the raw bytes straight to it, then call uploadSfvbFile quoting the key you were given. The bytes never pass through the API server. The extension is checked against the accepted type list before a URL is issued, so an unsupported type fails here rather than after you have sent the file. The URL is short lived and the key is bound to your account.
352
+ * @summary Get a URL to upload a binary asset to
353
+ * @param {number} storefrontOid
354
+ * @param {string} extension
355
+ * @param {*} [options] Override http request option.
356
+ * @throws {RequiredError}
357
+ * @memberof SfvbApiInterface
358
+ */
359
+ getSfvbFileUploadUrlRaw(requestParameters: GetSfvbFileUploadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SfvbFileUploadUrlResponse>>;
360
+ /**
361
+ * Binary content does not travel through this API as JSON, so uploading an image, font, video or PDF is two steps. Ask here for a URL, PUT the raw bytes straight to it, then call uploadSfvbFile quoting the key you were given. The bytes never pass through the API server. The extension is checked against the accepted type list before a URL is issued, so an unsupported type fails here rather than after you have sent the file. The URL is short lived and the key is bound to your account.
362
+ * Get a URL to upload a binary asset to
363
+ */
364
+ getSfvbFileUploadUrl(requestParameters: GetSfvbFileUploadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbFileUploadUrlResponse>;
322
365
  /**
323
366
  * Returns the fragment as authored. If it references images or other storefront files those paths will not resolve on this storefront until the entry is installed, so use install rather than this when the intent is to place the fragment.
324
367
  * @summary Read one library entry including its CJSON
@@ -673,6 +716,22 @@ export interface SfvbApiInterface {
673
716
  * Search the element library
674
717
  */
675
718
  searchSfvbLibrary(requestParameters: SearchSfvbLibraryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbLibraryResponse>;
719
+ /**
720
+ * The second half of the two step upload. The bytes are fetched from the key, checked against the extension they claim to be, and written exactly as a text write is - so the same If-Match precondition, the same read only refusal and the same publish gate apply. An SVG is sanitized before it is stored. Writing outside /themes/ requires sfvb_publish, because anything served off the storefront root is live by definition.
721
+ * @summary Store a binary asset that was already uploaded
722
+ * @param {number} storefrontOid
723
+ * @param {SfvbFileUploadRequest} fileUploadRequest Where to store the uploaded bytes
724
+ * @param {string} [ifMatch] Content hash from the last read. Required when the file already exists; 428 when absent, 412 when stale.
725
+ * @param {*} [options] Override http request option.
726
+ * @throws {RequiredError}
727
+ * @memberof SfvbApiInterface
728
+ */
729
+ uploadSfvbFileRaw(requestParameters: UploadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SfvbFileWriteResponse>>;
730
+ /**
731
+ * The second half of the two step upload. The bytes are fetched from the key, checked against the extension they claim to be, and written exactly as a text write is - so the same If-Match precondition, the same read only refusal and the same publish gate apply. An SVG is sanitized before it is stored. Writing outside /themes/ requires sfvb_publish, because anything served off the storefront root is live by definition.
732
+ * Store a binary asset that was already uploaded
733
+ */
734
+ uploadSfvbFile(requestParameters: UploadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbFileWriteResponse>;
676
735
  /**
677
736
  * Runs the structural schema, the contextual business rules for the destination owner type, and the quality lint. A document that fails returns HTTP 200 with valid false rather than a transport error - the request was well formed, the document was not.
678
737
  * @summary Validate CJSON
@@ -748,6 +807,16 @@ export declare class SfvbApi extends runtime.BaseAPI implements SfvbApiInterface
748
807
  * Delete a preview session
749
808
  */
750
809
  deleteSfvbPreviewSession(requestParameters: DeleteSfvbPreviewSessionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
810
+ /**
811
+ * Returns the file itself rather than a JSON envelope, for any type including binaries that files/content refuses. Use this to verify what you uploaded, and note it is the only way to read a file inside a theme that is not active - such a file is served to nobody until the theme is promoted, so it has no public URL to fetch instead. On success the body is the file; on failure it is the usual JSON error object, so do not assume the content type without checking the status.
812
+ * Read a storefront file\'s raw bytes
813
+ */
814
+ downloadSfvbFileRaw(requestParameters: DownloadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
815
+ /**
816
+ * Returns the file itself rather than a JSON envelope, for any type including binaries that files/content refuses. Use this to verify what you uploaded, and note it is the only way to read a file inside a theme that is not active - such a file is served to nobody until the theme is promoted, so it has no public URL to fetch instead. On success the body is the file; on failure it is the usual JSON error object, so do not assume the content type without checking the status.
817
+ * Read a storefront file\'s raw bytes
818
+ */
819
+ downloadSfvbFile(requestParameters: DownloadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
751
820
  /**
752
821
  * Copies a theme into a new one and returns a job handle to poll. Asynchronous, because copying a theme copies every file in it. Needs sfvb_write rather than sfvb_publish, because the job explicitly does not activate what it creates, so the worst outcome of a mistaken call is a spare theme. This is how you get somewhere safe to work - duplicate, edit the copy with an ordinary write scope, and let a human promote it.
753
822
  * Duplicate a theme
@@ -795,15 +864,25 @@ export declare class SfvbApi extends runtime.BaseAPI implements SfvbApiInterface
795
864
  */
796
865
  getSfvbElement(requestParameters: GetSfvbElementRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbElementSchemaResponse>;
797
866
  /**
798
- * Returns the current content, or an earlier version when version is supplied. The content hash is returned as an ETag; send it back as If-Match when writing.
867
+ * Returns the current content, or an earlier version when version is supplied. Send the body\'s hash_sha256 back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so prefer the body value.
799
868
  * Read a storefront file
800
869
  */
801
870
  getSfvbFileContentRaw(requestParameters: GetSfvbFileContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SfvbFileContentResponse>>;
802
871
  /**
803
- * Returns the current content, or an earlier version when version is supplied. The content hash is returned as an ETag; send it back as If-Match when writing.
872
+ * Returns the current content, or an earlier version when version is supplied. Send the body\'s hash_sha256 back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so prefer the body value.
804
873
  * Read a storefront file
805
874
  */
806
875
  getSfvbFileContent(requestParameters: GetSfvbFileContentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbFileContentResponse>;
876
+ /**
877
+ * Binary content does not travel through this API as JSON, so uploading an image, font, video or PDF is two steps. Ask here for a URL, PUT the raw bytes straight to it, then call uploadSfvbFile quoting the key you were given. The bytes never pass through the API server. The extension is checked against the accepted type list before a URL is issued, so an unsupported type fails here rather than after you have sent the file. The URL is short lived and the key is bound to your account.
878
+ * Get a URL to upload a binary asset to
879
+ */
880
+ getSfvbFileUploadUrlRaw(requestParameters: GetSfvbFileUploadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SfvbFileUploadUrlResponse>>;
881
+ /**
882
+ * Binary content does not travel through this API as JSON, so uploading an image, font, video or PDF is two steps. Ask here for a URL, PUT the raw bytes straight to it, then call uploadSfvbFile quoting the key you were given. The bytes never pass through the API server. The extension is checked against the accepted type list before a URL is issued, so an unsupported type fails here rather than after you have sent the file. The URL is short lived and the key is bound to your account.
883
+ * Get a URL to upload a binary asset to
884
+ */
885
+ getSfvbFileUploadUrl(requestParameters: GetSfvbFileUploadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbFileUploadUrlResponse>;
807
886
  /**
808
887
  * Returns the fragment as authored. If it references images or other storefront files those paths will not resolve on this storefront until the entry is installed, so use install rather than this when the intent is to place the fragment.
809
888
  * Read one library entry including its CJSON
@@ -1026,6 +1105,16 @@ export declare class SfvbApi extends runtime.BaseAPI implements SfvbApiInterface
1026
1105
  * Search the element library
1027
1106
  */
1028
1107
  searchSfvbLibrary(requestParameters: SearchSfvbLibraryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbLibraryResponse>;
1108
+ /**
1109
+ * The second half of the two step upload. The bytes are fetched from the key, checked against the extension they claim to be, and written exactly as a text write is - so the same If-Match precondition, the same read only refusal and the same publish gate apply. An SVG is sanitized before it is stored. Writing outside /themes/ requires sfvb_publish, because anything served off the storefront root is live by definition.
1110
+ * Store a binary asset that was already uploaded
1111
+ */
1112
+ uploadSfvbFileRaw(requestParameters: UploadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<SfvbFileWriteResponse>>;
1113
+ /**
1114
+ * The second half of the two step upload. The bytes are fetched from the key, checked against the extension they claim to be, and written exactly as a text write is - so the same If-Match precondition, the same read only refusal and the same publish gate apply. An SVG is sanitized before it is stored. Writing outside /themes/ requires sfvb_publish, because anything served off the storefront root is live by definition.
1115
+ * Store a binary asset that was already uploaded
1116
+ */
1117
+ uploadSfvbFile(requestParameters: UploadSfvbFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<SfvbFileWriteResponse>;
1029
1118
  /**
1030
1119
  * Runs the structural schema, the contextual business rules for the destination owner type, and the quality lint. A document that fails returns HTTP 200 with valid false rather than a transport error - the request was well formed, the document was not.
1031
1120
  * Validate CJSON
@@ -321,6 +321,66 @@ var SfvbApi = /** @class */ (function (_super) {
321
321
  });
322
322
  });
323
323
  };
324
+ /**
325
+ * Returns the file itself rather than a JSON envelope, for any type including binaries that files/content refuses. Use this to verify what you uploaded, and note it is the only way to read a file inside a theme that is not active - such a file is served to nobody until the theme is promoted, so it has no public URL to fetch instead. On success the body is the file; on failure it is the usual JSON error object, so do not assume the content type without checking the status.
326
+ * Read a storefront file\'s raw bytes
327
+ */
328
+ SfvbApi.prototype.downloadSfvbFileRaw = function (requestParameters, initOverrides) {
329
+ return __awaiter(this, void 0, void 0, function () {
330
+ var queryParameters, headerParameters, _a, _b, response;
331
+ return __generator(this, function (_c) {
332
+ switch (_c.label) {
333
+ case 0:
334
+ if (requestParameters.storefrontOid === null || requestParameters.storefrontOid === undefined) {
335
+ throw new runtime.RequiredError('storefrontOid', 'Required parameter requestParameters.storefrontOid was null or undefined when calling downloadSfvbFile.');
336
+ }
337
+ queryParameters = {};
338
+ if (requestParameters.path !== undefined) {
339
+ queryParameters['path'] = requestParameters.path;
340
+ }
341
+ headerParameters = {};
342
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
343
+ // oauth required
344
+ _a = headerParameters;
345
+ _b = "Authorization";
346
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", [])];
347
+ case 1:
348
+ // oauth required
349
+ _a[_b] = _c.sent();
350
+ _c.label = 2;
351
+ case 2:
352
+ if (this.configuration && this.configuration.apiKey) {
353
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
354
+ }
355
+ return [4 /*yield*/, this.request({
356
+ path: "/sfvb/storefronts/{storefront_oid}/files/download".replace("{".concat("storefront_oid", "}"), encodeURIComponent(String(requestParameters.storefrontOid))),
357
+ method: 'GET',
358
+ headers: headerParameters,
359
+ query: queryParameters,
360
+ }, initOverrides)];
361
+ case 3:
362
+ response = _c.sent();
363
+ return [2 /*return*/, new runtime.VoidApiResponse(response)];
364
+ }
365
+ });
366
+ });
367
+ };
368
+ /**
369
+ * Returns the file itself rather than a JSON envelope, for any type including binaries that files/content refuses. Use this to verify what you uploaded, and note it is the only way to read a file inside a theme that is not active - such a file is served to nobody until the theme is promoted, so it has no public URL to fetch instead. On success the body is the file; on failure it is the usual JSON error object, so do not assume the content type without checking the status.
370
+ * Read a storefront file\'s raw bytes
371
+ */
372
+ SfvbApi.prototype.downloadSfvbFile = function (requestParameters, initOverrides) {
373
+ return __awaiter(this, void 0, void 0, function () {
374
+ return __generator(this, function (_a) {
375
+ switch (_a.label) {
376
+ case 0: return [4 /*yield*/, this.downloadSfvbFileRaw(requestParameters, initOverrides)];
377
+ case 1:
378
+ _a.sent();
379
+ return [2 /*return*/];
380
+ }
381
+ });
382
+ });
383
+ };
324
384
  /**
325
385
  * Copies a theme into a new one and returns a job handle to poll. Asynchronous, because copying a theme copies every file in it. Needs sfvb_write rather than sfvb_publish, because the job explicitly does not activate what it creates, so the worst outcome of a mistaken call is a spare theme. This is how you get somewhere safe to work - duplicate, edit the copy with an ordinary write scope, and let a human promote it.
326
386
  * Duplicate a theme
@@ -644,7 +704,7 @@ var SfvbApi = /** @class */ (function (_super) {
644
704
  });
645
705
  };
646
706
  /**
647
- * Returns the current content, or an earlier version when version is supplied. The content hash is returned as an ETag; send it back as If-Match when writing.
707
+ * Returns the current content, or an earlier version when version is supplied. Send the body\'s hash_sha256 back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so prefer the body value.
648
708
  * Read a storefront file
649
709
  */
650
710
  SfvbApi.prototype.getSfvbFileContentRaw = function (requestParameters, initOverrides) {
@@ -691,7 +751,7 @@ var SfvbApi = /** @class */ (function (_super) {
691
751
  });
692
752
  };
693
753
  /**
694
- * Returns the current content, or an earlier version when version is supplied. The content hash is returned as an ETag; send it back as If-Match when writing.
754
+ * Returns the current content, or an earlier version when version is supplied. Send the body\'s hash_sha256 back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so prefer the body value.
695
755
  * Read a storefront file
696
756
  */
697
757
  SfvbApi.prototype.getSfvbFileContent = function (requestParameters, initOverrides) {
@@ -708,6 +768,68 @@ var SfvbApi = /** @class */ (function (_super) {
708
768
  });
709
769
  });
710
770
  };
771
+ /**
772
+ * Binary content does not travel through this API as JSON, so uploading an image, font, video or PDF is two steps. Ask here for a URL, PUT the raw bytes straight to it, then call uploadSfvbFile quoting the key you were given. The bytes never pass through the API server. The extension is checked against the accepted type list before a URL is issued, so an unsupported type fails here rather than after you have sent the file. The URL is short lived and the key is bound to your account.
773
+ * Get a URL to upload a binary asset to
774
+ */
775
+ SfvbApi.prototype.getSfvbFileUploadUrlRaw = function (requestParameters, initOverrides) {
776
+ return __awaiter(this, void 0, void 0, function () {
777
+ var queryParameters, headerParameters, _a, _b, response;
778
+ return __generator(this, function (_c) {
779
+ switch (_c.label) {
780
+ case 0:
781
+ if (requestParameters.storefrontOid === null || requestParameters.storefrontOid === undefined) {
782
+ throw new runtime.RequiredError('storefrontOid', 'Required parameter requestParameters.storefrontOid was null or undefined when calling getSfvbFileUploadUrl.');
783
+ }
784
+ if (requestParameters.extension === null || requestParameters.extension === undefined) {
785
+ throw new runtime.RequiredError('extension', 'Required parameter requestParameters.extension was null or undefined when calling getSfvbFileUploadUrl.');
786
+ }
787
+ queryParameters = {};
788
+ headerParameters = {};
789
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
790
+ // oauth required
791
+ _a = headerParameters;
792
+ _b = "Authorization";
793
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", [])];
794
+ case 1:
795
+ // oauth required
796
+ _a[_b] = _c.sent();
797
+ _c.label = 2;
798
+ case 2:
799
+ if (this.configuration && this.configuration.apiKey) {
800
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
801
+ }
802
+ return [4 /*yield*/, this.request({
803
+ path: "/sfvb/storefronts/{storefront_oid}/files/upload_url/{extension}".replace("{".concat("storefront_oid", "}"), encodeURIComponent(String(requestParameters.storefrontOid))).replace("{".concat("extension", "}"), encodeURIComponent(String(requestParameters.extension))),
804
+ method: 'GET',
805
+ headers: headerParameters,
806
+ query: queryParameters,
807
+ }, initOverrides)];
808
+ case 3:
809
+ response = _c.sent();
810
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.SfvbFileUploadUrlResponseFromJSON)(jsonValue); })];
811
+ }
812
+ });
813
+ });
814
+ };
815
+ /**
816
+ * Binary content does not travel through this API as JSON, so uploading an image, font, video or PDF is two steps. Ask here for a URL, PUT the raw bytes straight to it, then call uploadSfvbFile quoting the key you were given. The bytes never pass through the API server. The extension is checked against the accepted type list before a URL is issued, so an unsupported type fails here rather than after you have sent the file. The URL is short lived and the key is bound to your account.
817
+ * Get a URL to upload a binary asset to
818
+ */
819
+ SfvbApi.prototype.getSfvbFileUploadUrl = function (requestParameters, initOverrides) {
820
+ return __awaiter(this, void 0, void 0, function () {
821
+ var response;
822
+ return __generator(this, function (_a) {
823
+ switch (_a.label) {
824
+ case 0: return [4 /*yield*/, this.getSfvbFileUploadUrlRaw(requestParameters, initOverrides)];
825
+ case 1:
826
+ response = _a.sent();
827
+ return [4 /*yield*/, response.value()];
828
+ case 2: return [2 /*return*/, _a.sent()];
829
+ }
830
+ });
831
+ });
832
+ };
711
833
  /**
712
834
  * Returns the fragment as authored. If it references images or other storefront files those paths will not resolve on this storefront until the entry is installed, so use install rather than this when the intent is to place the fragment.
713
835
  * Read one library entry including its CJSON
@@ -2191,6 +2313,73 @@ var SfvbApi = /** @class */ (function (_super) {
2191
2313
  });
2192
2314
  });
2193
2315
  };
2316
+ /**
2317
+ * The second half of the two step upload. The bytes are fetched from the key, checked against the extension they claim to be, and written exactly as a text write is - so the same If-Match precondition, the same read only refusal and the same publish gate apply. An SVG is sanitized before it is stored. Writing outside /themes/ requires sfvb_publish, because anything served off the storefront root is live by definition.
2318
+ * Store a binary asset that was already uploaded
2319
+ */
2320
+ SfvbApi.prototype.uploadSfvbFileRaw = function (requestParameters, initOverrides) {
2321
+ return __awaiter(this, void 0, void 0, function () {
2322
+ var queryParameters, headerParameters, _a, _b, response;
2323
+ return __generator(this, function (_c) {
2324
+ switch (_c.label) {
2325
+ case 0:
2326
+ if (requestParameters.storefrontOid === null || requestParameters.storefrontOid === undefined) {
2327
+ throw new runtime.RequiredError('storefrontOid', 'Required parameter requestParameters.storefrontOid was null or undefined when calling uploadSfvbFile.');
2328
+ }
2329
+ if (requestParameters.fileUploadRequest === null || requestParameters.fileUploadRequest === undefined) {
2330
+ throw new runtime.RequiredError('fileUploadRequest', 'Required parameter requestParameters.fileUploadRequest was null or undefined when calling uploadSfvbFile.');
2331
+ }
2332
+ queryParameters = {};
2333
+ headerParameters = {};
2334
+ headerParameters['Content-Type'] = 'application/json';
2335
+ if (requestParameters.ifMatch !== undefined && requestParameters.ifMatch !== null) {
2336
+ headerParameters['If-Match'] = String(requestParameters.ifMatch);
2337
+ }
2338
+ if (!(this.configuration && this.configuration.accessToken)) return [3 /*break*/, 2];
2339
+ // oauth required
2340
+ _a = headerParameters;
2341
+ _b = "Authorization";
2342
+ return [4 /*yield*/, this.configuration.accessToken("ultraCartOauth", [])];
2343
+ case 1:
2344
+ // oauth required
2345
+ _a[_b] = _c.sent();
2346
+ _c.label = 2;
2347
+ case 2:
2348
+ if (this.configuration && this.configuration.apiKey) {
2349
+ headerParameters["x-ultracart-simple-key"] = this.configuration.apiKey("x-ultracart-simple-key"); // ultraCartSimpleApiKey authentication
2350
+ }
2351
+ return [4 /*yield*/, this.request({
2352
+ path: "/sfvb/storefronts/{storefront_oid}/files/upload".replace("{".concat("storefront_oid", "}"), encodeURIComponent(String(requestParameters.storefrontOid))),
2353
+ method: 'POST',
2354
+ headers: headerParameters,
2355
+ query: queryParameters,
2356
+ body: (0, models_1.SfvbFileUploadRequestToJSON)(requestParameters.fileUploadRequest),
2357
+ }, initOverrides)];
2358
+ case 3:
2359
+ response = _c.sent();
2360
+ return [2 /*return*/, new runtime.JSONApiResponse(response, function (jsonValue) { return (0, models_1.SfvbFileWriteResponseFromJSON)(jsonValue); })];
2361
+ }
2362
+ });
2363
+ });
2364
+ };
2365
+ /**
2366
+ * The second half of the two step upload. The bytes are fetched from the key, checked against the extension they claim to be, and written exactly as a text write is - so the same If-Match precondition, the same read only refusal and the same publish gate apply. An SVG is sanitized before it is stored. Writing outside /themes/ requires sfvb_publish, because anything served off the storefront root is live by definition.
2367
+ * Store a binary asset that was already uploaded
2368
+ */
2369
+ SfvbApi.prototype.uploadSfvbFile = function (requestParameters, initOverrides) {
2370
+ return __awaiter(this, void 0, void 0, function () {
2371
+ var response;
2372
+ return __generator(this, function (_a) {
2373
+ switch (_a.label) {
2374
+ case 0: return [4 /*yield*/, this.uploadSfvbFileRaw(requestParameters, initOverrides)];
2375
+ case 1:
2376
+ response = _a.sent();
2377
+ return [4 /*yield*/, response.value()];
2378
+ case 2: return [2 /*return*/, _a.sent()];
2379
+ }
2380
+ });
2381
+ });
2382
+ };
2194
2383
  /**
2195
2384
  * Runs the structural schema, the contextual business rules for the destination owner type, and the quality lint. A document that fails returns HTTP 200 with valid false rather than a transport error - the request was well formed, the document was not.
2196
2385
  * Validate CJSON
@@ -28,7 +28,7 @@ export interface SfvbContainerVersion {
28
28
  */
29
29
  comment?: string;
30
30
  /**
31
- * History record oid. Pass to the revert operation on the owning container.
31
+ * History record oid. Pass to the revert operation on the owning container. Absent on the entry marked current, which holds the value stored right now, has no history row of its own, and so cannot be fetched or reverted to.
32
32
  * @type {number}
33
33
  * @memberof SfvbContainerVersion
34
34
  */
@@ -34,7 +34,7 @@ export interface SfvbFileContentResponse {
34
34
  */
35
35
  fs_file_oid?: number;
36
36
  /**
37
- * SHA-256 of the content. Also returned as the ETag header; send it back as If-Match when writing.
37
+ * SHA-256 of the content. Send this back as If-Match when writing. The ETag header carries the same hash, but a compressing proxy may append a suffix such as -gzip to it, so this body value is the authoritative one. Both forms are accepted on write.
38
38
  * @type {string}
39
39
  * @memberof SfvbFileContentResponse
40
40
  */
@@ -34,7 +34,7 @@ export interface SfvbFileEntry {
34
34
  */
35
35
  fs_directory_oid?: number;
36
36
  /**
37
- * StoreFront file system file oid.
37
+ * StoreFront file system file oid. Absent on a directory entry, which has no file oid.
38
38
  * @type {number}
39
39
  * @memberof SfvbFileEntry
40
40
  */
@@ -100,7 +100,7 @@ export interface SfvbFileEntry {
100
100
  */
101
101
  valid?: boolean;
102
102
  /**
103
- * Current version number of the file.
103
+ * Current version number of the file. Absent on a directory entry, which is not versioned.
104
104
  * @type {number}
105
105
  * @memberof SfvbFileEntry
106
106
  */
@@ -0,0 +1,49 @@
1
+ /**
2
+ * UltraCart Rest API V2
3
+ * UltraCart REST API Version 2
4
+ *
5
+ * The version of the OpenAPI document: 2.0.0
6
+ * Contact: support@ultracart.com
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ *
14
+ * @export
15
+ * @interface SfvbFileUploadRequest
16
+ */
17
+ export interface SfvbFileUploadRequest {
18
+ /**
19
+ * Optional comment recorded against the version this write creates.
20
+ * @type {string}
21
+ * @memberof SfvbFileUploadRequest
22
+ */
23
+ comment?: string;
24
+ /**
25
+ * Create the file if it does not exist. Defaults to true.
26
+ * @type {boolean}
27
+ * @memberof SfvbFileUploadRequest
28
+ */
29
+ create_if_missing?: boolean;
30
+ /**
31
+ * The key returned when the upload URL was issued.
32
+ * @type {string}
33
+ * @memberof SfvbFileUploadRequest
34
+ */
35
+ key?: string;
36
+ /**
37
+ * Storefront path to write, for example /assets/imgs/hero.jpg. The extension must match the one the upload URL was issued for, and must match the bytes.
38
+ * @type {string}
39
+ * @memberof SfvbFileUploadRequest
40
+ */
41
+ path?: string;
42
+ }
43
+ /**
44
+ * Check if a given object implements the SfvbFileUploadRequest interface.
45
+ */
46
+ export declare function instanceOfSfvbFileUploadRequest(value: object): boolean;
47
+ export declare function SfvbFileUploadRequestFromJSON(json: any): SfvbFileUploadRequest;
48
+ export declare function SfvbFileUploadRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SfvbFileUploadRequest;
49
+ export declare function SfvbFileUploadRequestToJSON(value?: SfvbFileUploadRequest | null): any;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ /* tslint:disable */
3
+ /* eslint-disable */
4
+ /**
5
+ * UltraCart Rest API V2
6
+ * UltraCart REST API Version 2
7
+ *
8
+ * The version of the OpenAPI document: 2.0.0
9
+ * Contact: support@ultracart.com
10
+ *
11
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
12
+ * https://openapi-generator.tech
13
+ * Do not edit the class manually.
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.SfvbFileUploadRequestToJSON = exports.SfvbFileUploadRequestFromJSONTyped = exports.SfvbFileUploadRequestFromJSON = exports.instanceOfSfvbFileUploadRequest = void 0;
17
+ var runtime_1 = require("../runtime");
18
+ /**
19
+ * Check if a given object implements the SfvbFileUploadRequest interface.
20
+ */
21
+ function instanceOfSfvbFileUploadRequest(value) {
22
+ var isInstance = true;
23
+ return isInstance;
24
+ }
25
+ exports.instanceOfSfvbFileUploadRequest = instanceOfSfvbFileUploadRequest;
26
+ function SfvbFileUploadRequestFromJSON(json) {
27
+ return SfvbFileUploadRequestFromJSONTyped(json, false);
28
+ }
29
+ exports.SfvbFileUploadRequestFromJSON = SfvbFileUploadRequestFromJSON;
30
+ function SfvbFileUploadRequestFromJSONTyped(json, ignoreDiscriminator) {
31
+ if ((json === undefined) || (json === null)) {
32
+ return json;
33
+ }
34
+ return {
35
+ 'comment': !(0, runtime_1.exists)(json, 'comment') ? undefined : json['comment'],
36
+ 'create_if_missing': !(0, runtime_1.exists)(json, 'create_if_missing') ? undefined : json['create_if_missing'],
37
+ 'key': !(0, runtime_1.exists)(json, 'key') ? undefined : json['key'],
38
+ 'path': !(0, runtime_1.exists)(json, 'path') ? undefined : json['path'],
39
+ };
40
+ }
41
+ exports.SfvbFileUploadRequestFromJSONTyped = SfvbFileUploadRequestFromJSONTyped;
42
+ function SfvbFileUploadRequestToJSON(value) {
43
+ if (value === undefined) {
44
+ return undefined;
45
+ }
46
+ if (value === null) {
47
+ return null;
48
+ }
49
+ return {
50
+ 'comment': value.comment,
51
+ 'create_if_missing': value.create_if_missing,
52
+ 'key': value.key,
53
+ 'path': value.path,
54
+ };
55
+ }
56
+ exports.SfvbFileUploadRequestToJSON = SfvbFileUploadRequestToJSON;