@widgetic/api-sdk-ts 1.11.111 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/apis/BrandKitApi.d.ts +40 -40
- package/dist/apis/BrandKitApi.js +40 -40
- package/dist/apis/CanvasesApi.d.ts +15 -15
- package/dist/apis/CompositionsApi.d.ts +255 -155
- package/dist/apis/CompositionsApi.js +333 -133
- package/dist/apis/CreditsApi.d.ts +7 -7
- package/dist/apis/CreditsApi.js +1 -1
- package/dist/apis/EntitlementsApi.d.ts +6 -6
- package/dist/apis/InvoicesApi.d.ts +6 -6
- package/dist/apis/InvoicesApi.js +2 -2
- package/dist/apis/ManagedUsersApi.d.ts +97 -63
- package/dist/apis/ManagedUsersApi.js +106 -39
- package/dist/apis/OperationsApi.d.ts +4 -4
- package/dist/apis/OperationsApi.js +5 -5
- package/dist/apis/PartnersApi.d.ts +125 -125
- package/dist/apis/PartnersApi.js +11 -11
- package/dist/apis/PublicEmbedApi.d.ts +42 -42
- package/dist/apis/PublicEmbedApi.js +29 -29
- package/dist/apis/TokensApi.d.ts +2 -0
- package/dist/apis/TokensApi.js +2 -0
- package/dist/apis/UploadsApi.d.ts +38 -38
- package/dist/apis/UploadsApi.js +60 -60
- package/dist/apis/UsersApi.d.ts +40 -40
- package/dist/apis/UsersApi.js +4 -4
- package/dist/apis/WidgetsApi.d.ts +23 -23
- package/dist/apis/WidgetsApi.js +36 -36
- package/dist/apis/WorkflowsApi.d.ts +85 -127
- package/dist/apis/WorkflowsApi.js +82 -192
- package/dist/apis/index.d.ts +0 -2
- package/dist/apis/index.js +0 -2
- package/dist/esm/apis/BrandKitApi.js +39 -39
- package/dist/esm/apis/CompositionsApi.js +333 -133
- package/dist/esm/apis/CreditsApi.js +2 -2
- package/dist/esm/apis/InvoicesApi.js +1 -1
- package/dist/esm/apis/ManagedUsersApi.js +106 -39
- package/dist/esm/apis/OperationsApi.js +6 -6
- package/dist/esm/apis/PartnersApi.js +12 -12
- package/dist/esm/apis/PublicEmbedApi.js +30 -30
- package/dist/esm/apis/TokensApi.js +2 -0
- package/dist/esm/apis/UploadsApi.js +60 -60
- package/dist/esm/apis/UsersApi.js +5 -5
- package/dist/esm/apis/WidgetsApi.js +37 -37
- package/dist/esm/apis/WorkflowsApi.js +82 -192
- package/dist/esm/apis/index.js +0 -2
- package/dist/esm/models/{GetPartnerCreditTransactions200Response.js → AccountCreditTransactionListResponse.js} +8 -8
- package/dist/esm/models/{GetUserAdapterConnections200Response.js → AdapterConnectionListResponse.js} +8 -8
- package/dist/esm/models/{RemoveUserAdapterConnection200Response.js → AdapterConnectionRemovalResponse.js} +8 -8
- package/dist/esm/models/{SetUserAdapterConnection200Response.js → AdapterConnectionResponse.js} +8 -8
- package/dist/esm/models/{AddAiAnswersKnowledgeDocument201Response.js → AiAnswersKnowledgeDocumentResponse.js} +8 -8
- package/dist/esm/models/{CreateCompositionDatabaseRecord201Response.js → CompositionDatabaseRecordResponse.js} +8 -8
- package/dist/esm/models/{CreateCompositionContentItem201Response.js → ContentItemWriteResultResponse.js} +8 -8
- package/dist/esm/models/{OperationsIdGetResponse.js → DeleteUpload200Response.js} +11 -11
- package/dist/esm/models/{UploadsIdDelete200ResponseData.js → DeleteUpload200ResponseData.js} +8 -8
- package/dist/esm/models/{GetPartnerDesignDefaults200Response.js → DesignDefaultsResponse.js} +8 -8
- package/dist/esm/models/GetOperationResponse.js +51 -0
- package/dist/esm/models/{OperationsIdGetResponseData.js → GetOperationResponseData.js} +12 -11
- package/dist/esm/models/GetOperationResponseDataMetadata.js +58 -0
- package/dist/esm/models/{UploadsGet200Response.js → ListUploads200Response.js} +8 -8
- package/dist/esm/models/{GetManagedUserLimits200Response.js → ManagedUserLimitsResponse.js} +8 -8
- package/dist/esm/models/{DeleteManagedUser200Response.js → ManagedUserRemovalResponse.js} +8 -8
- package/dist/esm/models/PublicWorkflowEventsRequestEventsInner.js +11 -0
- package/dist/esm/models/{GetPublicWorkflow200Response.js → PublicWorkflowResponse.js} +8 -8
- package/dist/esm/models/WidgetClarification.js +52 -0
- package/dist/esm/models/WidgetClarificationOption.js +51 -0
- package/dist/esm/models/WidgetClarificationQuestion.js +60 -0
- package/dist/esm/models/WidgetNextStep.js +67 -0
- package/dist/esm/models/WidgetPlan.js +61 -0
- package/dist/esm/models/WidgetPlanDecisions.js +68 -0
- package/dist/esm/models/WidgetPlanDecisionsAdaptersInner.js +47 -0
- package/dist/esm/models/WidgetPlanDecisionsLibrariesInner.js +51 -0
- package/dist/esm/models/WidgetPlanDecisionsResponsive.js +51 -0
- package/dist/esm/models/WidgetPlanTask.js +80 -0
- package/dist/esm/models/{CreateWorkspaceWorkflowFromPreset201Response.js → WorkflowDetailResponse.js} +8 -8
- package/dist/esm/models/WorkflowFailureReason.js +49 -0
- package/dist/esm/models/WorkflowFailureReasonCounter.js +52 -0
- package/dist/esm/models/{SaveWorkspaceWorkflow200Response.js → WorkflowResponse.js} +8 -8
- package/dist/esm/models/WorkflowStats.js +3 -0
- package/dist/esm/models/index.js +31 -19
- package/dist/esm/runtime.js +1 -1
- package/dist/models/AccountCreditTransactionListResponse.d.ts +46 -0
- package/dist/models/{GetPartnerCreditTransactions200Response.js → AccountCreditTransactionListResponse.js} +13 -13
- package/dist/models/AdapterConnectionListResponse.d.ts +46 -0
- package/dist/models/{GetUserAdapterConnections200Response.js → AdapterConnectionListResponse.js} +13 -13
- package/dist/models/AdapterConnectionRemovalResponse.d.ts +46 -0
- package/dist/models/{RemoveUserAdapterConnection200Response.js → AdapterConnectionRemovalResponse.js} +13 -13
- package/dist/models/AdapterConnectionResponse.d.ts +46 -0
- package/dist/models/{SetUserAdapterConnection200Response.js → AdapterConnectionResponse.js} +13 -13
- package/dist/models/AiAnswersKnowledgeDocumentResponse.d.ts +46 -0
- package/dist/models/{AddAiAnswersKnowledgeDocument201Response.js → AiAnswersKnowledgeDocumentResponse.js} +13 -13
- package/dist/models/CompositionDatabaseRecordResponse.d.ts +48 -0
- package/dist/models/CompositionDatabaseRecordResponse.js +57 -0
- package/dist/models/ContentItemWriteResultResponse.d.ts +46 -0
- package/dist/models/{CreateCompositionContentItem201Response.js → ContentItemWriteResultResponse.js} +13 -13
- package/dist/models/DeleteUpload200Response.d.ts +46 -0
- package/dist/models/{OperationsIdGetResponse.js → DeleteUpload200Response.js} +16 -16
- package/dist/models/DeleteUpload200ResponseData.d.ts +32 -0
- package/dist/models/DeleteUpload200ResponseData.js +48 -0
- package/dist/models/DesignDefaultsResponse.d.ts +46 -0
- package/dist/models/{GetPartnerDesignDefaults200Response.js → DesignDefaultsResponse.js} +13 -13
- package/dist/models/GetOperationResponse.d.ts +46 -0
- package/dist/models/GetOperationResponse.js +58 -0
- package/dist/models/GetOperationResponseData.d.ts +86 -0
- package/dist/models/{OperationsIdGetResponseData.js → GetOperationResponseData.js} +18 -17
- package/dist/models/GetOperationResponseDataMetadata.d.ts +65 -0
- package/dist/models/GetOperationResponseDataMetadata.js +66 -0
- package/dist/models/ListUploads200Response.d.ts +46 -0
- package/dist/models/{UploadsGet200Response.js → ListUploads200Response.js} +13 -13
- package/dist/models/ManagedUserLimitsResponse.d.ts +46 -0
- package/dist/models/{GetManagedUserLimits200Response.js → ManagedUserLimitsResponse.js} +13 -13
- package/dist/models/ManagedUserRemovalResponse.d.ts +46 -0
- package/dist/models/{DeleteManagedUser200Response.js → ManagedUserRemovalResponse.js} +13 -13
- package/dist/models/PublicWorkflowEventsRequestEventsInner.d.ts +21 -0
- package/dist/models/PublicWorkflowEventsRequestEventsInner.js +12 -1
- package/dist/models/PublicWorkflowResponse.d.ts +46 -0
- package/dist/models/{GetPublicWorkflow200Response.js → PublicWorkflowResponse.js} +13 -13
- package/dist/models/Upload.d.ts +1 -1
- package/dist/models/UploadLimits.d.ts +3 -3
- package/dist/models/WidgetClarification.d.ts +45 -0
- package/dist/models/WidgetClarification.js +59 -0
- package/dist/models/WidgetClarificationOption.d.ts +44 -0
- package/dist/models/WidgetClarificationOption.js +58 -0
- package/dist/models/WidgetClarificationQuestion.d.ts +57 -0
- package/dist/models/WidgetClarificationQuestion.js +67 -0
- package/dist/models/WidgetNextStep.d.ts +63 -0
- package/dist/models/WidgetNextStep.js +75 -0
- package/dist/models/WidgetPlan.d.ts +58 -0
- package/dist/models/WidgetPlan.js +68 -0
- package/dist/models/WidgetPlanDecisions.d.ts +71 -0
- package/dist/models/WidgetPlanDecisions.js +75 -0
- package/dist/models/WidgetPlanDecisionsAdaptersInner.d.ts +38 -0
- package/dist/models/WidgetPlanDecisionsAdaptersInner.js +54 -0
- package/dist/models/WidgetPlanDecisionsLibrariesInner.d.ts +44 -0
- package/dist/models/WidgetPlanDecisionsLibrariesInner.js +58 -0
- package/dist/models/WidgetPlanDecisionsResponsive.d.ts +44 -0
- package/dist/models/WidgetPlanDecisionsResponsive.js +58 -0
- package/dist/models/WidgetPlanTask.d.ts +77 -0
- package/dist/models/WidgetPlanTask.js +88 -0
- package/dist/models/WorkflowDetailResponse.d.ts +46 -0
- package/dist/models/WorkflowDetailResponse.js +58 -0
- package/dist/models/WorkflowFailureReason.d.ts +31 -0
- package/dist/models/WorkflowFailureReason.js +57 -0
- package/dist/models/WorkflowFailureReasonCounter.d.ts +45 -0
- package/dist/models/WorkflowFailureReasonCounter.js +59 -0
- package/dist/models/WorkflowResponse.d.ts +46 -0
- package/dist/models/{SaveWorkspaceWorkflow200Response.js → WorkflowResponse.js} +13 -13
- package/dist/models/WorkflowStats.d.ts +16 -1
- package/dist/models/WorkflowStats.js +3 -0
- package/dist/models/index.d.ts +31 -19
- package/dist/models/index.js +31 -19
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +1 -1
- package/package.json +1 -1
- package/dist/apis/PartnerApi.d.ts +0 -2707
- package/dist/apis/PartnerApi.js +0 -7073
- package/dist/apis/WorkspacesApi.d.ts +0 -352
- package/dist/apis/WorkspacesApi.js +0 -946
- package/dist/esm/apis/PartnerApi.js +0 -7036
- package/dist/esm/apis/WorkspacesApi.js +0 -909
- package/dist/esm/models/CreateCompositionFromWidget201Response.js +0 -51
- package/dist/esm/models/UploadsIdDelete200Response.js +0 -51
- package/dist/models/AddAiAnswersKnowledgeDocument201Response.d.ts +0 -46
- package/dist/models/CreateCompositionContentItem201Response.d.ts +0 -46
- package/dist/models/CreateCompositionDatabaseRecord201Response.d.ts +0 -48
- package/dist/models/CreateCompositionDatabaseRecord201Response.js +0 -57
- package/dist/models/CreateCompositionFromWidget201Response.d.ts +0 -46
- package/dist/models/CreateCompositionFromWidget201Response.js +0 -58
- package/dist/models/CreateWorkspaceWorkflowFromPreset201Response.d.ts +0 -46
- package/dist/models/CreateWorkspaceWorkflowFromPreset201Response.js +0 -58
- package/dist/models/DeleteManagedUser200Response.d.ts +0 -46
- package/dist/models/GetManagedUserLimits200Response.d.ts +0 -46
- package/dist/models/GetPartnerCreditTransactions200Response.d.ts +0 -46
- package/dist/models/GetPartnerDesignDefaults200Response.d.ts +0 -46
- package/dist/models/GetPublicWorkflow200Response.d.ts +0 -46
- package/dist/models/GetUserAdapterConnections200Response.d.ts +0 -46
- package/dist/models/OperationsIdGetResponse.d.ts +0 -46
- package/dist/models/OperationsIdGetResponseData.d.ts +0 -88
- package/dist/models/RemoveUserAdapterConnection200Response.d.ts +0 -46
- package/dist/models/SaveWorkspaceWorkflow200Response.d.ts +0 -46
- package/dist/models/SetUserAdapterConnection200Response.d.ts +0 -46
- package/dist/models/UploadsGet200Response.d.ts +0 -46
- package/dist/models/UploadsIdDelete200Response.d.ts +0 -46
- package/dist/models/UploadsIdDelete200Response.js +0 -58
- package/dist/models/UploadsIdDelete200ResponseData.d.ts +0 -32
- package/dist/models/UploadsIdDelete200ResponseData.js +0 -48
|
@@ -10,107 +10,107 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime';
|
|
13
|
-
import type {
|
|
14
|
-
export interface
|
|
15
|
-
limit?: number;
|
|
16
|
-
managedUserId?: string;
|
|
17
|
-
managedUserExternalId?: string;
|
|
18
|
-
}
|
|
19
|
-
export interface UploadsIdDelete0Request {
|
|
13
|
+
import type { DeleteUpload200Response, ListUploads200Response, UploadLimitsResponse, UploadResponse } from '../models/index';
|
|
14
|
+
export interface DeleteUploadRequest {
|
|
20
15
|
id: string;
|
|
21
16
|
}
|
|
22
|
-
export interface
|
|
17
|
+
export interface GetUploadRequest {
|
|
23
18
|
id: string;
|
|
24
19
|
}
|
|
25
|
-
export interface
|
|
20
|
+
export interface ListUploadsRequest {
|
|
21
|
+
limit?: number;
|
|
22
|
+
managedUserId?: string;
|
|
23
|
+
managedUserExternalId?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface UploadFileRequest {
|
|
26
26
|
file: Blob;
|
|
27
|
-
contextType?:
|
|
28
|
-
source?:
|
|
27
|
+
contextType?: UploadFileContextTypeEnum;
|
|
28
|
+
source?: UploadFileSourceEnum;
|
|
29
29
|
managedUserId?: string;
|
|
30
30
|
managedUserExternalId?: string;
|
|
31
|
-
purpose?:
|
|
31
|
+
purpose?: UploadFilePurposeEnum;
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
34
34
|
*
|
|
35
35
|
*/
|
|
36
36
|
export declare class UploadsApi extends runtime.BaseAPI {
|
|
37
|
-
/**
|
|
38
|
-
* The files the account has uploaded, newest first. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user\'s files with `managedUserId` or `managedUserExternalId`. The files that visitors sent through a widget\'s upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account\'s own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.
|
|
39
|
-
* List the account\'s uploads
|
|
40
|
-
*/
|
|
41
|
-
uploadsGetRaw(requestParameters: UploadsGet0Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UploadsGet200Response>>;
|
|
42
|
-
/**
|
|
43
|
-
* The files the account has uploaded, newest first. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user\'s files with `managedUserId` or `managedUserExternalId`. The files that visitors sent through a widget\'s upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account\'s own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.
|
|
44
|
-
* List the account\'s uploads
|
|
45
|
-
*/
|
|
46
|
-
uploadsGet(requestParameters?: UploadsGet0Request, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UploadsGet200Response>;
|
|
47
37
|
/**
|
|
48
38
|
* Removes the stored file and the upload row. A file in Widgetic\'s own storage gives back the space it took from your storage allowance; a file in your own bucket is removed from your bucket. Deleting an upload that is already gone succeeds the same way as the first delete. An upload that belongs to another account is not found. If the storage cannot be reached the call fails and nothing is marked deleted, so it can be repeated.
|
|
49
39
|
* Delete an upload
|
|
50
40
|
*/
|
|
51
|
-
|
|
41
|
+
deleteUploadRaw(requestParameters: DeleteUploadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DeleteUpload200Response>>;
|
|
52
42
|
/**
|
|
53
43
|
* Removes the stored file and the upload row. A file in Widgetic\'s own storage gives back the space it took from your storage allowance; a file in your own bucket is removed from your bucket. Deleting an upload that is already gone succeeds the same way as the first delete. An upload that belongs to another account is not found. If the storage cannot be reached the call fails and nothing is marked deleted, so it can be repeated.
|
|
54
44
|
* Delete an upload
|
|
55
45
|
*/
|
|
56
|
-
|
|
46
|
+
deleteUpload(requestParameters: DeleteUploadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DeleteUpload200Response>;
|
|
57
47
|
/**
|
|
58
48
|
* The details of one of the account\'s uploads. An upload that belongs to another account is not found.
|
|
59
49
|
* Get an upload by id
|
|
60
50
|
*/
|
|
61
|
-
|
|
51
|
+
getUploadRaw(requestParameters: GetUploadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UploadResponse>>;
|
|
62
52
|
/**
|
|
63
53
|
* The details of one of the account\'s uploads. An upload that belongs to another account is not found.
|
|
64
54
|
* Get an upload by id
|
|
65
55
|
*/
|
|
66
|
-
|
|
56
|
+
getUpload(requestParameters: GetUploadRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UploadResponse>;
|
|
67
57
|
/**
|
|
68
58
|
* The size limit and the accepted file types of the upload endpoints. Read them from here rather than hard-coding thresholds: they are configuration and can change. The limits are the same for every account, whatever its plan: `multipart_max_bytes` for a file sent in one request (10 MB) and `tus_max_bytes` for a resumable upload (250 MB).
|
|
69
59
|
* Upload size limits and accepted file types
|
|
70
60
|
*/
|
|
71
|
-
|
|
61
|
+
getUploadLimitsRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UploadLimitsResponse>>;
|
|
72
62
|
/**
|
|
73
63
|
* The size limit and the accepted file types of the upload endpoints. Read them from here rather than hard-coding thresholds: they are configuration and can change. The limits are the same for every account, whatever its plan: `multipart_max_bytes` for a file sent in one request (10 MB) and `tus_max_bytes` for a resumable upload (250 MB).
|
|
74
64
|
* Upload size limits and accepted file types
|
|
75
65
|
*/
|
|
76
|
-
|
|
66
|
+
getUploadLimits(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UploadLimitsResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* The files the account has uploaded, newest first. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user\'s files with `managedUserId` or `managedUserExternalId`. The files that visitors sent through a widget\'s upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account\'s own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.
|
|
69
|
+
* List the account\'s uploads
|
|
70
|
+
*/
|
|
71
|
+
listUploadsRaw(requestParameters: ListUploadsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ListUploads200Response>>;
|
|
72
|
+
/**
|
|
73
|
+
* The files the account has uploaded, newest first. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user\'s files with `managedUserId` or `managedUserExternalId`. The files that visitors sent through a widget\'s upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account\'s own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.
|
|
74
|
+
* List the account\'s uploads
|
|
75
|
+
*/
|
|
76
|
+
listUploads(requestParameters?: ListUploadsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ListUploads200Response>;
|
|
77
77
|
/**
|
|
78
|
-
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `
|
|
78
|
+
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `getUploadLimits` lists the size limit and the accepted types. A file is judged by what is in it, not by the type it is sent as. A file that is not the type it claims (a web page sent as `image/png`) is refused with 415 and `UPLOAD_UNSUPPORTED_TYPE`, and a picture sent under the wrong picture type is stored under the type it really is, which `mime_type` in the answer says. An SVG is rewritten as it is stored: script, `foreignObject`, animation and references to other addresses are taken out, it must be UTF-8 and at most 2 MB, and the stored file can be larger or smaller than the one sent. Anything that is not an image, audio or video (a PDF, for example) is served as a download rather than shown in a page. When the full storage is a Shopify store\'s team\'s, extra storage cannot be added through Shopify yet, so the message ends by saying so and what to do instead: delete files, or contact support. On a Solo plan it names the Teams plan (which holds more) and `error.details.planPageUrl` is the address of the plan page on Shopify. `error.suggestedAction` says the same in a few words, instead of the usual \"upgrade your storage plan\". Any other team, and a person\'s own workspace, get the shorter message. To upload the file for one of your managed users, send `managedUserId` (Widgetic\'s id for the user) or `managedUserExternalId` (your own identifier for the user), not both. The file stays in your account and counts against its allowance; the tag lets you list one user\'s files with `listUploads`. The managed user must be yours and active: one that is not yours, or does not exist, is refused with 404 and `MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`, before the file is stored. The tag is set here and does not change afterwards. Called with an editor session (`createManagedUserEditorSession`), the file is always filed for the session\'s own managed user and is always media for widget content: naming another managed user is refused with 403 and `MANAGED_USER_SESSION_MISMATCH`, and `contextType`, `source`, `widgetId` and `conversationId` are ignored. A full storage allowance is refused with the same 413 and `QUOTA_STORAGE_EXCEEDED`, but the message only says that it is not available right now (not how much is stored: that is the partner\'s business) and `error.details.limit` is `storage`. An account that administers a partner with a storage destination (`setPartnerStorageDestination`) has its files stored in the partner\'s own bucket instead. Such a file takes none of the allowance, its `url` is served from the partner\'s public address, and its `storage_key` is the key in the partner\'s bucket. The file is never stored with Widgetic instead: when the destination cannot be used the upload is refused with 503 and `STORAGE_DESTINATION_UNAVAILABLE`, and when the partner\'s storage rejects the file with 502 and `STORAGE_DESTINATION_WRITE_FAILED`. Partner storage is not optional, and it does not depend on how the file arrives. A partner\'s own uploads (with its API key, an SDK token, or from the Widgetic website, the resumable route and the media library alike) and the uploads of its customers\' editor sessions are kept in the partner\'s own storage or not at all, so a partner with no destination (or one that removed it after the session was made) has them refused with 409 and `PARTNER_STORAGE_REQUIRED`; they are never stored with Widgetic. An editor session\'s browser is only told that the feature is not available right now.
|
|
79
79
|
* Upload a file
|
|
80
80
|
*/
|
|
81
|
-
|
|
81
|
+
uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UploadResponse>>;
|
|
82
82
|
/**
|
|
83
|
-
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `
|
|
83
|
+
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `getUploadLimits` lists the size limit and the accepted types. A file is judged by what is in it, not by the type it is sent as. A file that is not the type it claims (a web page sent as `image/png`) is refused with 415 and `UPLOAD_UNSUPPORTED_TYPE`, and a picture sent under the wrong picture type is stored under the type it really is, which `mime_type` in the answer says. An SVG is rewritten as it is stored: script, `foreignObject`, animation and references to other addresses are taken out, it must be UTF-8 and at most 2 MB, and the stored file can be larger or smaller than the one sent. Anything that is not an image, audio or video (a PDF, for example) is served as a download rather than shown in a page. When the full storage is a Shopify store\'s team\'s, extra storage cannot be added through Shopify yet, so the message ends by saying so and what to do instead: delete files, or contact support. On a Solo plan it names the Teams plan (which holds more) and `error.details.planPageUrl` is the address of the plan page on Shopify. `error.suggestedAction` says the same in a few words, instead of the usual \"upgrade your storage plan\". Any other team, and a person\'s own workspace, get the shorter message. To upload the file for one of your managed users, send `managedUserId` (Widgetic\'s id for the user) or `managedUserExternalId` (your own identifier for the user), not both. The file stays in your account and counts against its allowance; the tag lets you list one user\'s files with `listUploads`. The managed user must be yours and active: one that is not yours, or does not exist, is refused with 404 and `MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`, before the file is stored. The tag is set here and does not change afterwards. Called with an editor session (`createManagedUserEditorSession`), the file is always filed for the session\'s own managed user and is always media for widget content: naming another managed user is refused with 403 and `MANAGED_USER_SESSION_MISMATCH`, and `contextType`, `source`, `widgetId` and `conversationId` are ignored. A full storage allowance is refused with the same 413 and `QUOTA_STORAGE_EXCEEDED`, but the message only says that it is not available right now (not how much is stored: that is the partner\'s business) and `error.details.limit` is `storage`. An account that administers a partner with a storage destination (`setPartnerStorageDestination`) has its files stored in the partner\'s own bucket instead. Such a file takes none of the allowance, its `url` is served from the partner\'s public address, and its `storage_key` is the key in the partner\'s bucket. The file is never stored with Widgetic instead: when the destination cannot be used the upload is refused with 503 and `STORAGE_DESTINATION_UNAVAILABLE`, and when the partner\'s storage rejects the file with 502 and `STORAGE_DESTINATION_WRITE_FAILED`. Partner storage is not optional, and it does not depend on how the file arrives. A partner\'s own uploads (with its API key, an SDK token, or from the Widgetic website, the resumable route and the media library alike) and the uploads of its customers\' editor sessions are kept in the partner\'s own storage or not at all, so a partner with no destination (or one that removed it after the session was made) has them refused with 409 and `PARTNER_STORAGE_REQUIRED`; they are never stored with Widgetic. An editor session\'s browser is only told that the feature is not available right now.
|
|
84
84
|
* Upload a file
|
|
85
85
|
*/
|
|
86
|
-
|
|
86
|
+
uploadFile(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UploadResponse>;
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* @export
|
|
90
90
|
*/
|
|
91
|
-
export declare const
|
|
91
|
+
export declare const UploadFileContextTypeEnum: {
|
|
92
92
|
readonly WidgetCodegen: 'widget-codegen';
|
|
93
93
|
readonly BrowserIc: 'browser-ic';
|
|
94
94
|
readonly ContentProperty: 'content-property';
|
|
95
95
|
};
|
|
96
|
-
export type
|
|
96
|
+
export type UploadFileContextTypeEnum = typeof UploadFileContextTypeEnum[keyof typeof UploadFileContextTypeEnum];
|
|
97
97
|
/**
|
|
98
98
|
* @export
|
|
99
99
|
*/
|
|
100
|
-
export declare const
|
|
100
|
+
export declare const UploadFileSourceEnum: {
|
|
101
101
|
readonly ChatUpload: 'chat-upload';
|
|
102
102
|
readonly ChatScreenshot: 'chat-screenshot';
|
|
103
103
|
readonly BrowserIcScreenshot: 'browser-ic-screenshot';
|
|
104
104
|
readonly PreviewScreenshot: 'preview-screenshot';
|
|
105
105
|
readonly FileBrowserUpload: 'file-browser-upload';
|
|
106
106
|
};
|
|
107
|
-
export type
|
|
107
|
+
export type UploadFileSourceEnum = typeof UploadFileSourceEnum[keyof typeof UploadFileSourceEnum];
|
|
108
108
|
/**
|
|
109
109
|
* @export
|
|
110
110
|
*/
|
|
111
|
-
export declare const
|
|
111
|
+
export declare const UploadFilePurposeEnum: {
|
|
112
112
|
readonly Canvas: 'canvas';
|
|
113
113
|
readonly Chat: 'chat';
|
|
114
114
|
readonly Field: 'field';
|
|
115
115
|
};
|
|
116
|
-
export type
|
|
116
|
+
export type UploadFilePurposeEnum = typeof UploadFilePurposeEnum[keyof typeof UploadFilePurposeEnum];
|
package/dist/apis/UploadsApi.js
CHANGED
|
@@ -46,7 +46,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
46
46
|
};
|
|
47
47
|
})();
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.
|
|
49
|
+
exports.UploadFilePurposeEnum = exports.UploadFileSourceEnum = exports.UploadFileContextTypeEnum = exports.UploadsApi = void 0;
|
|
50
50
|
const runtime = __importStar(require("../runtime"));
|
|
51
51
|
const index_1 = require("../models/index");
|
|
52
52
|
/**
|
|
@@ -54,20 +54,14 @@ const index_1 = require("../models/index");
|
|
|
54
54
|
*/
|
|
55
55
|
class UploadsApi extends runtime.BaseAPI {
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
57
|
+
* Removes the stored file and the upload row. A file in Widgetic\'s own storage gives back the space it took from your storage allowance; a file in your own bucket is removed from your bucket. Deleting an upload that is already gone succeeds the same way as the first delete. An upload that belongs to another account is not found. If the storage cannot be reached the call fails and nothing is marked deleted, so it can be repeated.
|
|
58
|
+
* Delete an upload
|
|
59
59
|
*/
|
|
60
|
-
async
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
queryParameters['limit'] = requestParameters['limit'];
|
|
64
|
-
}
|
|
65
|
-
if (requestParameters['managedUserId'] != null) {
|
|
66
|
-
queryParameters['managedUserId'] = requestParameters['managedUserId'];
|
|
67
|
-
}
|
|
68
|
-
if (requestParameters['managedUserExternalId'] != null) {
|
|
69
|
-
queryParameters['managedUserExternalId'] = requestParameters['managedUserExternalId'];
|
|
60
|
+
async deleteUploadRaw(requestParameters, initOverrides) {
|
|
61
|
+
if (requestParameters['id'] == null) {
|
|
62
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling deleteUpload().');
|
|
70
63
|
}
|
|
64
|
+
const queryParameters = {};
|
|
71
65
|
const headerParameters = {};
|
|
72
66
|
if (this.configuration && this.configuration.accessToken) {
|
|
73
67
|
const token = this.configuration.accessToken;
|
|
@@ -77,28 +71,28 @@ class UploadsApi extends runtime.BaseAPI {
|
|
|
77
71
|
}
|
|
78
72
|
}
|
|
79
73
|
const response = await this.request({
|
|
80
|
-
path: `/uploads`,
|
|
81
|
-
method: '
|
|
74
|
+
path: `/uploads/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
75
|
+
method: 'DELETE',
|
|
82
76
|
headers: headerParameters,
|
|
83
77
|
query: queryParameters,
|
|
84
78
|
}, initOverrides);
|
|
85
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.
|
|
79
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.DeleteUpload200ResponseFromJSON)(jsonValue));
|
|
86
80
|
}
|
|
87
81
|
/**
|
|
88
|
-
*
|
|
89
|
-
*
|
|
82
|
+
* Removes the stored file and the upload row. A file in Widgetic\'s own storage gives back the space it took from your storage allowance; a file in your own bucket is removed from your bucket. Deleting an upload that is already gone succeeds the same way as the first delete. An upload that belongs to another account is not found. If the storage cannot be reached the call fails and nothing is marked deleted, so it can be repeated.
|
|
83
|
+
* Delete an upload
|
|
90
84
|
*/
|
|
91
|
-
async
|
|
92
|
-
const response = await this.
|
|
85
|
+
async deleteUpload(requestParameters, initOverrides) {
|
|
86
|
+
const response = await this.deleteUploadRaw(requestParameters, initOverrides);
|
|
93
87
|
return await response.value();
|
|
94
88
|
}
|
|
95
89
|
/**
|
|
96
|
-
*
|
|
97
|
-
*
|
|
90
|
+
* The details of one of the account\'s uploads. An upload that belongs to another account is not found.
|
|
91
|
+
* Get an upload by id
|
|
98
92
|
*/
|
|
99
|
-
async
|
|
93
|
+
async getUploadRaw(requestParameters, initOverrides) {
|
|
100
94
|
if (requestParameters['id'] == null) {
|
|
101
|
-
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling
|
|
95
|
+
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling getUpload().');
|
|
102
96
|
}
|
|
103
97
|
const queryParameters = {};
|
|
104
98
|
const headerParameters = {};
|
|
@@ -111,28 +105,25 @@ class UploadsApi extends runtime.BaseAPI {
|
|
|
111
105
|
}
|
|
112
106
|
const response = await this.request({
|
|
113
107
|
path: `/uploads/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))),
|
|
114
|
-
method: '
|
|
108
|
+
method: 'GET',
|
|
115
109
|
headers: headerParameters,
|
|
116
110
|
query: queryParameters,
|
|
117
111
|
}, initOverrides);
|
|
118
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.
|
|
112
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UploadResponseFromJSON)(jsonValue));
|
|
119
113
|
}
|
|
120
114
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
115
|
+
* The details of one of the account\'s uploads. An upload that belongs to another account is not found.
|
|
116
|
+
* Get an upload by id
|
|
123
117
|
*/
|
|
124
|
-
async
|
|
125
|
-
const response = await this.
|
|
118
|
+
async getUpload(requestParameters, initOverrides) {
|
|
119
|
+
const response = await this.getUploadRaw(requestParameters, initOverrides);
|
|
126
120
|
return await response.value();
|
|
127
121
|
}
|
|
128
122
|
/**
|
|
129
|
-
* The
|
|
130
|
-
*
|
|
123
|
+
* The size limit and the accepted file types of the upload endpoints. Read them from here rather than hard-coding thresholds: they are configuration and can change. The limits are the same for every account, whatever its plan: `multipart_max_bytes` for a file sent in one request (10 MB) and `tus_max_bytes` for a resumable upload (250 MB).
|
|
124
|
+
* Upload size limits and accepted file types
|
|
131
125
|
*/
|
|
132
|
-
async
|
|
133
|
-
if (requestParameters['id'] == null) {
|
|
134
|
-
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling uploadsIdGet().');
|
|
135
|
-
}
|
|
126
|
+
async getUploadLimitsRaw(initOverrides) {
|
|
136
127
|
const queryParameters = {};
|
|
137
128
|
const headerParameters = {};
|
|
138
129
|
if (this.configuration && this.configuration.accessToken) {
|
|
@@ -143,27 +134,36 @@ class UploadsApi extends runtime.BaseAPI {
|
|
|
143
134
|
}
|
|
144
135
|
}
|
|
145
136
|
const response = await this.request({
|
|
146
|
-
path: `/uploads/
|
|
137
|
+
path: `/uploads/limits`,
|
|
147
138
|
method: 'GET',
|
|
148
139
|
headers: headerParameters,
|
|
149
140
|
query: queryParameters,
|
|
150
141
|
}, initOverrides);
|
|
151
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.
|
|
142
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UploadLimitsResponseFromJSON)(jsonValue));
|
|
152
143
|
}
|
|
153
144
|
/**
|
|
154
|
-
* The
|
|
155
|
-
*
|
|
145
|
+
* The size limit and the accepted file types of the upload endpoints. Read them from here rather than hard-coding thresholds: they are configuration and can change. The limits are the same for every account, whatever its plan: `multipart_max_bytes` for a file sent in one request (10 MB) and `tus_max_bytes` for a resumable upload (250 MB).
|
|
146
|
+
* Upload size limits and accepted file types
|
|
156
147
|
*/
|
|
157
|
-
async
|
|
158
|
-
const response = await this.
|
|
148
|
+
async getUploadLimits(initOverrides) {
|
|
149
|
+
const response = await this.getUploadLimitsRaw(initOverrides);
|
|
159
150
|
return await response.value();
|
|
160
151
|
}
|
|
161
152
|
/**
|
|
162
|
-
* The
|
|
163
|
-
*
|
|
153
|
+
* The files the account has uploaded, newest first. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user\'s files with `managedUserId` or `managedUserExternalId`. The files that visitors sent through a widget\'s upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account\'s own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.
|
|
154
|
+
* List the account\'s uploads
|
|
164
155
|
*/
|
|
165
|
-
async
|
|
156
|
+
async listUploadsRaw(requestParameters, initOverrides) {
|
|
166
157
|
const queryParameters = {};
|
|
158
|
+
if (requestParameters['limit'] != null) {
|
|
159
|
+
queryParameters['limit'] = requestParameters['limit'];
|
|
160
|
+
}
|
|
161
|
+
if (requestParameters['managedUserId'] != null) {
|
|
162
|
+
queryParameters['managedUserId'] = requestParameters['managedUserId'];
|
|
163
|
+
}
|
|
164
|
+
if (requestParameters['managedUserExternalId'] != null) {
|
|
165
|
+
queryParameters['managedUserExternalId'] = requestParameters['managedUserExternalId'];
|
|
166
|
+
}
|
|
167
167
|
const headerParameters = {};
|
|
168
168
|
if (this.configuration && this.configuration.accessToken) {
|
|
169
169
|
const token = this.configuration.accessToken;
|
|
@@ -173,28 +173,28 @@ class UploadsApi extends runtime.BaseAPI {
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
const response = await this.request({
|
|
176
|
-
path: `/uploads
|
|
176
|
+
path: `/uploads`,
|
|
177
177
|
method: 'GET',
|
|
178
178
|
headers: headerParameters,
|
|
179
179
|
query: queryParameters,
|
|
180
180
|
}, initOverrides);
|
|
181
|
-
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.
|
|
181
|
+
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.ListUploads200ResponseFromJSON)(jsonValue));
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* The
|
|
185
|
-
*
|
|
184
|
+
* The files the account has uploaded, newest first. Deleted files are not listed. Returns at most `limit` files and has no further pages: a client that needs more narrows the list instead, for example to one managed user\'s files with `managedUserId` or `managedUserExternalId`. The files that visitors sent through a widget\'s upload adapter (`source` is `widget-visitor-upload`) are not part of this list, so that a popular widget does not push the account\'s own files out of it; naming one widget with `widgetId` lists what visitors sent to that widget as well.
|
|
185
|
+
* List the account\'s uploads
|
|
186
186
|
*/
|
|
187
|
-
async
|
|
188
|
-
const response = await this.
|
|
187
|
+
async listUploads(requestParameters = {}, initOverrides) {
|
|
188
|
+
const response = await this.listUploadsRaw(requestParameters, initOverrides);
|
|
189
189
|
return await response.value();
|
|
190
190
|
}
|
|
191
191
|
/**
|
|
192
|
-
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `
|
|
192
|
+
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `getUploadLimits` lists the size limit and the accepted types. A file is judged by what is in it, not by the type it is sent as. A file that is not the type it claims (a web page sent as `image/png`) is refused with 415 and `UPLOAD_UNSUPPORTED_TYPE`, and a picture sent under the wrong picture type is stored under the type it really is, which `mime_type` in the answer says. An SVG is rewritten as it is stored: script, `foreignObject`, animation and references to other addresses are taken out, it must be UTF-8 and at most 2 MB, and the stored file can be larger or smaller than the one sent. Anything that is not an image, audio or video (a PDF, for example) is served as a download rather than shown in a page. When the full storage is a Shopify store\'s team\'s, extra storage cannot be added through Shopify yet, so the message ends by saying so and what to do instead: delete files, or contact support. On a Solo plan it names the Teams plan (which holds more) and `error.details.planPageUrl` is the address of the plan page on Shopify. `error.suggestedAction` says the same in a few words, instead of the usual \"upgrade your storage plan\". Any other team, and a person\'s own workspace, get the shorter message. To upload the file for one of your managed users, send `managedUserId` (Widgetic\'s id for the user) or `managedUserExternalId` (your own identifier for the user), not both. The file stays in your account and counts against its allowance; the tag lets you list one user\'s files with `listUploads`. The managed user must be yours and active: one that is not yours, or does not exist, is refused with 404 and `MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`, before the file is stored. The tag is set here and does not change afterwards. Called with an editor session (`createManagedUserEditorSession`), the file is always filed for the session\'s own managed user and is always media for widget content: naming another managed user is refused with 403 and `MANAGED_USER_SESSION_MISMATCH`, and `contextType`, `source`, `widgetId` and `conversationId` are ignored. A full storage allowance is refused with the same 413 and `QUOTA_STORAGE_EXCEEDED`, but the message only says that it is not available right now (not how much is stored: that is the partner\'s business) and `error.details.limit` is `storage`. An account that administers a partner with a storage destination (`setPartnerStorageDestination`) has its files stored in the partner\'s own bucket instead. Such a file takes none of the allowance, its `url` is served from the partner\'s public address, and its `storage_key` is the key in the partner\'s bucket. The file is never stored with Widgetic instead: when the destination cannot be used the upload is refused with 503 and `STORAGE_DESTINATION_UNAVAILABLE`, and when the partner\'s storage rejects the file with 502 and `STORAGE_DESTINATION_WRITE_FAILED`. Partner storage is not optional, and it does not depend on how the file arrives. A partner\'s own uploads (with its API key, an SDK token, or from the Widgetic website, the resumable route and the media library alike) and the uploads of its customers\' editor sessions are kept in the partner\'s own storage or not at all, so a partner with no destination (or one that removed it after the session was made) has them refused with 409 and `PARTNER_STORAGE_REQUIRED`; they are never stored with Widgetic. An editor session\'s browser is only told that the feature is not available right now.
|
|
193
193
|
* Upload a file
|
|
194
194
|
*/
|
|
195
|
-
async
|
|
195
|
+
async uploadFileRaw(requestParameters, initOverrides) {
|
|
196
196
|
if (requestParameters['file'] == null) {
|
|
197
|
-
throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling
|
|
197
|
+
throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling uploadFile().');
|
|
198
198
|
}
|
|
199
199
|
const queryParameters = {};
|
|
200
200
|
const headerParameters = {};
|
|
@@ -248,11 +248,11 @@ class UploadsApi extends runtime.BaseAPI {
|
|
|
248
248
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.UploadResponseFromJSON)(jsonValue));
|
|
249
249
|
}
|
|
250
250
|
/**
|
|
251
|
-
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `
|
|
251
|
+
* Stores one file for the account and returns its public address. This is how a user\'s own images, video and PDFs reach a widget\'s content. Send a `multipart/form-data` request with the file in the field named `file`. The file counts against the storage of the workspace it is uploaded in, and a full workspace is refused with 413 and `QUOTA_STORAGE_EXCEEDED`. For a person signed in on widgetic.com that is the workspace they are currently working in: inside a team, the team\'s shared storage; inside their own workspace, their own allowance. An organization API key, and a Shopify store\'s session, always work in that team\'s shared storage. A personal API key or an SDK token always uses the account\'s own allowance. The two never add up and one never lends room to the other. A file over the size limit is refused with 413 and `UPLOAD_TOO_LARGE`, and a type that is not accepted with 415 and `UPLOAD_UNSUPPORTED_TYPE`; `getUploadLimits` lists the size limit and the accepted types. A file is judged by what is in it, not by the type it is sent as. A file that is not the type it claims (a web page sent as `image/png`) is refused with 415 and `UPLOAD_UNSUPPORTED_TYPE`, and a picture sent under the wrong picture type is stored under the type it really is, which `mime_type` in the answer says. An SVG is rewritten as it is stored: script, `foreignObject`, animation and references to other addresses are taken out, it must be UTF-8 and at most 2 MB, and the stored file can be larger or smaller than the one sent. Anything that is not an image, audio or video (a PDF, for example) is served as a download rather than shown in a page. When the full storage is a Shopify store\'s team\'s, extra storage cannot be added through Shopify yet, so the message ends by saying so and what to do instead: delete files, or contact support. On a Solo plan it names the Teams plan (which holds more) and `error.details.planPageUrl` is the address of the plan page on Shopify. `error.suggestedAction` says the same in a few words, instead of the usual \"upgrade your storage plan\". Any other team, and a person\'s own workspace, get the shorter message. To upload the file for one of your managed users, send `managedUserId` (Widgetic\'s id for the user) or `managedUserExternalId` (your own identifier for the user), not both. The file stays in your account and counts against its allowance; the tag lets you list one user\'s files with `listUploads`. The managed user must be yours and active: one that is not yours, or does not exist, is refused with 404 and `MANAGED_USER_NOT_FOUND`, and one that is switched off with 409 and `MANAGED_USER_INACTIVE`, before the file is stored. The tag is set here and does not change afterwards. Called with an editor session (`createManagedUserEditorSession`), the file is always filed for the session\'s own managed user and is always media for widget content: naming another managed user is refused with 403 and `MANAGED_USER_SESSION_MISMATCH`, and `contextType`, `source`, `widgetId` and `conversationId` are ignored. A full storage allowance is refused with the same 413 and `QUOTA_STORAGE_EXCEEDED`, but the message only says that it is not available right now (not how much is stored: that is the partner\'s business) and `error.details.limit` is `storage`. An account that administers a partner with a storage destination (`setPartnerStorageDestination`) has its files stored in the partner\'s own bucket instead. Such a file takes none of the allowance, its `url` is served from the partner\'s public address, and its `storage_key` is the key in the partner\'s bucket. The file is never stored with Widgetic instead: when the destination cannot be used the upload is refused with 503 and `STORAGE_DESTINATION_UNAVAILABLE`, and when the partner\'s storage rejects the file with 502 and `STORAGE_DESTINATION_WRITE_FAILED`. Partner storage is not optional, and it does not depend on how the file arrives. A partner\'s own uploads (with its API key, an SDK token, or from the Widgetic website, the resumable route and the media library alike) and the uploads of its customers\' editor sessions are kept in the partner\'s own storage or not at all, so a partner with no destination (or one that removed it after the session was made) has them refused with 409 and `PARTNER_STORAGE_REQUIRED`; they are never stored with Widgetic. An editor session\'s browser is only told that the feature is not available right now.
|
|
252
252
|
* Upload a file
|
|
253
253
|
*/
|
|
254
|
-
async
|
|
255
|
-
const response = await this.
|
|
254
|
+
async uploadFile(requestParameters, initOverrides) {
|
|
255
|
+
const response = await this.uploadFileRaw(requestParameters, initOverrides);
|
|
256
256
|
return await response.value();
|
|
257
257
|
}
|
|
258
258
|
}
|
|
@@ -260,7 +260,7 @@ exports.UploadsApi = UploadsApi;
|
|
|
260
260
|
/**
|
|
261
261
|
* @export
|
|
262
262
|
*/
|
|
263
|
-
exports.
|
|
263
|
+
exports.UploadFileContextTypeEnum = {
|
|
264
264
|
WidgetCodegen: 'widget-codegen',
|
|
265
265
|
BrowserIc: 'browser-ic',
|
|
266
266
|
ContentProperty: 'content-property'
|
|
@@ -268,7 +268,7 @@ exports.UploadsPost0ContextTypeEnum = {
|
|
|
268
268
|
/**
|
|
269
269
|
* @export
|
|
270
270
|
*/
|
|
271
|
-
exports.
|
|
271
|
+
exports.UploadFileSourceEnum = {
|
|
272
272
|
ChatUpload: 'chat-upload',
|
|
273
273
|
ChatScreenshot: 'chat-screenshot',
|
|
274
274
|
BrowserIcScreenshot: 'browser-ic-screenshot',
|
|
@@ -278,7 +278,7 @@ exports.UploadsPost0SourceEnum = {
|
|
|
278
278
|
/**
|
|
279
279
|
* @export
|
|
280
280
|
*/
|
|
281
|
-
exports.
|
|
281
|
+
exports.UploadFilePurposeEnum = {
|
|
282
282
|
Canvas: 'canvas',
|
|
283
283
|
Chat: 'chat',
|
|
284
284
|
Field: 'field'
|