@stream-io/node-sdk 0.2.6 → 0.3.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/index.cjs.js +2461 -2124
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +2450 -2109
- package/dist/index.es.js.map +1 -1
- package/dist/src/StreamCall.d.ts +1 -1
- package/dist/src/StreamChannel.d.ts +7 -9
- package/dist/src/StreamChatClient.d.ts +2 -5
- package/dist/src/StreamClient.d.ts +15 -26
- package/dist/src/gen/chat/apis/ProductchatApi.d.ts +1750 -0
- package/dist/src/gen/chat/apis/index.d.ts +1 -27
- package/dist/src/gen/chat/models/index.d.ts +5101 -5891
- package/dist/src/gen/chat/runtime.d.ts +2 -2
- package/dist/src/gen/video/apis/ProductvideoApi.d.ts +1 -1
- package/dist/src/gen/video/models/index.d.ts +189 -35
- package/dist/src/gen/video/runtime.d.ts +1 -1
- package/package.json +8 -1
- package/src/StreamCall.ts +7 -7
- package/src/StreamChannel.ts +44 -49
- package/src/StreamChatClient.ts +23 -35
- package/src/StreamClient.ts +71 -232
- package/src/gen/chat/.openapi-generator/FILES +1 -19
- package/src/gen/chat/apis/ProductchatApi.ts +7007 -0
- package/src/gen/chat/apis/index.ts +1 -27
- package/src/gen/chat/models/index.ts +5758 -6564
- package/src/gen/chat/runtime.ts +3 -3
- package/src/gen/video/apis/ProductvideoApi.ts +1 -1
- package/src/gen/video/models/index.ts +184 -36
- package/src/gen/video/runtime.ts +1 -1
- package/dist/src/gen/chat/apis/ChannelTypesApi.d.ts +0 -81
- package/dist/src/gen/chat/apis/ChannelsApi.d.ts +0 -280
- package/dist/src/gen/chat/apis/CustomCommandsApi.d.ts +0 -81
- package/dist/src/gen/chat/apis/DefaultApi.d.ts +0 -60
- package/dist/src/gen/chat/apis/DevicesApi.d.ts +0 -58
- package/dist/src/gen/chat/apis/EventsApi.d.ts +0 -47
- package/dist/src/gen/chat/apis/FilesApi.d.ts +0 -85
- package/dist/src/gen/chat/apis/GDPRApi.d.ts +0 -114
- package/dist/src/gen/chat/apis/ImportsApi.d.ts +0 -67
- package/dist/src/gen/chat/apis/MessagesApi.d.ts +0 -374
- package/dist/src/gen/chat/apis/ModerationApi.d.ts +0 -271
- package/dist/src/gen/chat/apis/PermissionsV2Api.d.ts +0 -77
- package/dist/src/gen/chat/apis/PushApi.d.ts +0 -65
- package/dist/src/gen/chat/apis/ReactionsApi.d.ts +0 -62
- package/dist/src/gen/chat/apis/ServerSideApi.d.ts +0 -31
- package/dist/src/gen/chat/apis/SettingsApi.d.ts +0 -257
- package/dist/src/gen/chat/apis/TasksApi.d.ts +0 -31
- package/dist/src/gen/chat/apis/TestingApi.d.ts +0 -57
- package/dist/src/gen/chat/apis/UsersApi.d.ts +0 -313
- package/src/gen/chat/apis/ChannelTypesApi.ts +0 -275
- package/src/gen/chat/apis/ChannelsApi.ts +0 -1096
- package/src/gen/chat/apis/CustomCommandsApi.ts +0 -276
- package/src/gen/chat/apis/DefaultApi.ts +0 -196
- package/src/gen/chat/apis/DevicesApi.ts +0 -180
- package/src/gen/chat/apis/EventsApi.ts +0 -147
- package/src/gen/chat/apis/FilesApi.ts +0 -312
- package/src/gen/chat/apis/GDPRApi.ts +0 -418
- package/src/gen/chat/apis/ImportsApi.ts +0 -222
- package/src/gen/chat/apis/MessagesApi.ts +0 -1475
- package/src/gen/chat/apis/ModerationApi.ts +0 -1038
- package/src/gen/chat/apis/PermissionsV2Api.ts +0 -259
- package/src/gen/chat/apis/PushApi.ts +0 -183
- package/src/gen/chat/apis/ReactionsApi.ts +0 -202
- package/src/gen/chat/apis/ServerSideApi.ts +0 -79
- package/src/gen/chat/apis/SettingsApi.ts +0 -948
- package/src/gen/chat/apis/TasksApi.ts +0 -75
- package/src/gen/chat/apis/TestingApi.ts +0 -185
- package/src/gen/chat/apis/UsersApi.ts +0 -1203
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Stream Chat API
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: v92.7.0
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import * as runtime from '../runtime';
|
|
17
|
-
import type {
|
|
18
|
-
APIError,
|
|
19
|
-
EventResponse,
|
|
20
|
-
Response,
|
|
21
|
-
SendEventRequest,
|
|
22
|
-
SendUserCustomEventRequest,
|
|
23
|
-
} from '../models';
|
|
24
|
-
|
|
25
|
-
export interface SendEventOperationRequest {
|
|
26
|
-
type: string;
|
|
27
|
-
id: string;
|
|
28
|
-
sendEventRequest: SendEventRequest | null;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface SendUserCustomEventOperationRequest {
|
|
32
|
-
userId: string;
|
|
33
|
-
sendUserCustomEventRequest: SendUserCustomEventRequest | null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
export class EventsApi extends runtime.BaseAPI {
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Sends event to the channel Sends events: - any Required permissions: - SendCustomEvent
|
|
43
|
-
* Send event
|
|
44
|
-
*/
|
|
45
|
-
async sendEventRaw(requestParameters: SendEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EventResponse>> {
|
|
46
|
-
if (requestParameters.type === null || requestParameters.type === undefined) {
|
|
47
|
-
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling sendEvent.');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
51
|
-
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling sendEvent.');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (requestParameters.sendEventRequest === null || requestParameters.sendEventRequest === undefined) {
|
|
55
|
-
throw new runtime.RequiredError('sendEventRequest','Required parameter requestParameters.sendEventRequest was null or undefined when calling sendEvent.');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
const queryParameters: any = {};
|
|
59
|
-
|
|
60
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
61
|
-
|
|
62
|
-
headerParameters['Content-Type'] = 'application/json';
|
|
63
|
-
|
|
64
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
65
|
-
headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
69
|
-
queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
73
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const response = await this.request({
|
|
77
|
-
path: `/channels/{type}/{id}/event`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
|
|
78
|
-
method: 'POST',
|
|
79
|
-
headers: headerParameters,
|
|
80
|
-
query: queryParameters,
|
|
81
|
-
body: requestParameters.sendEventRequest,
|
|
82
|
-
}, initOverrides);
|
|
83
|
-
|
|
84
|
-
return new runtime.JSONApiResponse(response);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Sends event to the channel Sends events: - any Required permissions: - SendCustomEvent
|
|
89
|
-
* Send event
|
|
90
|
-
*/
|
|
91
|
-
async sendEvent(requestParameters: SendEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EventResponse> {
|
|
92
|
-
const response = await this.sendEventRaw(requestParameters, initOverrides);
|
|
93
|
-
return await response.value();
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* Sends a custom event to a user Sends events: - custom
|
|
98
|
-
* Send user event
|
|
99
|
-
*/
|
|
100
|
-
async sendUserCustomEventRaw(requestParameters: SendUserCustomEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Response>> {
|
|
101
|
-
if (requestParameters.userId === null || requestParameters.userId === undefined) {
|
|
102
|
-
throw new runtime.RequiredError('userId','Required parameter requestParameters.userId was null or undefined when calling sendUserCustomEvent.');
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (requestParameters.sendUserCustomEventRequest === null || requestParameters.sendUserCustomEventRequest === undefined) {
|
|
106
|
-
throw new runtime.RequiredError('sendUserCustomEventRequest','Required parameter requestParameters.sendUserCustomEventRequest was null or undefined when calling sendUserCustomEvent.');
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const queryParameters: any = {};
|
|
110
|
-
|
|
111
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
112
|
-
|
|
113
|
-
headerParameters['Content-Type'] = 'application/json';
|
|
114
|
-
|
|
115
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
116
|
-
headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
120
|
-
queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
124
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
const response = await this.request({
|
|
128
|
-
path: `/users/{user_id}/event`.replace(`{${"user_id"}}`, encodeURIComponent(String(requestParameters.userId))),
|
|
129
|
-
method: 'POST',
|
|
130
|
-
headers: headerParameters,
|
|
131
|
-
query: queryParameters,
|
|
132
|
-
body: requestParameters.sendUserCustomEventRequest,
|
|
133
|
-
}, initOverrides);
|
|
134
|
-
|
|
135
|
-
return new runtime.JSONApiResponse(response);
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Sends a custom event to a user Sends events: - custom
|
|
140
|
-
* Send user event
|
|
141
|
-
*/
|
|
142
|
-
async sendUserCustomEvent(requestParameters: SendUserCustomEventOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Response> {
|
|
143
|
-
const response = await this.sendUserCustomEventRaw(requestParameters, initOverrides);
|
|
144
|
-
return await response.value();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
}
|
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
/* tslint:disable */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Stream Chat API
|
|
5
|
-
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
6
|
-
*
|
|
7
|
-
* The version of the OpenAPI document: v92.7.0
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
11
|
-
* https://openapi-generator.tech
|
|
12
|
-
* Do not edit the class manually.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
import * as runtime from '../runtime';
|
|
17
|
-
import type {
|
|
18
|
-
APIError,
|
|
19
|
-
FileDeleteResponse,
|
|
20
|
-
FileUploadResponse,
|
|
21
|
-
/** @ts-expect-error */
|
|
22
|
-
ImageSizeRequest,
|
|
23
|
-
ImageUploadResponse,
|
|
24
|
-
/** @ts-expect-error */
|
|
25
|
-
OnlyUserIDRequest,
|
|
26
|
-
} from '../models';
|
|
27
|
-
|
|
28
|
-
export interface DeleteFileRequest {
|
|
29
|
-
type: string;
|
|
30
|
-
id: string;
|
|
31
|
-
url?: string;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export interface DeleteImageRequest {
|
|
35
|
-
type: string;
|
|
36
|
-
id: string;
|
|
37
|
-
url?: string;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export interface UploadFileRequest {
|
|
41
|
-
type: string;
|
|
42
|
-
id: string;
|
|
43
|
-
file?: string;
|
|
44
|
-
user?: OnlyUserIDRequest;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface UploadImageRequest {
|
|
48
|
-
type: string;
|
|
49
|
-
id: string;
|
|
50
|
-
file?: string;
|
|
51
|
-
uploadSizes?: Array<ImageSizeRequest>;
|
|
52
|
-
user?: OnlyUserIDRequest;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
*
|
|
57
|
-
*/
|
|
58
|
-
export class FilesApi extends runtime.BaseAPI {
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Deletes previously uploaded file Required permissions: - DeleteAttachment
|
|
62
|
-
* Delete file
|
|
63
|
-
*/
|
|
64
|
-
async deleteFileRaw(requestParameters: DeleteFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FileDeleteResponse>> {
|
|
65
|
-
if (requestParameters.type === null || requestParameters.type === undefined) {
|
|
66
|
-
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deleteFile.');
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
70
|
-
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteFile.');
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const queryParameters: any = {};
|
|
74
|
-
|
|
75
|
-
if (requestParameters.url !== undefined) {
|
|
76
|
-
queryParameters['url'] = requestParameters.url;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
80
|
-
|
|
81
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
82
|
-
headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
86
|
-
queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
90
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
const response = await this.request({
|
|
94
|
-
path: `/channels/{type}/{id}/file`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
|
|
95
|
-
method: 'DELETE',
|
|
96
|
-
headers: headerParameters,
|
|
97
|
-
query: queryParameters,
|
|
98
|
-
}, initOverrides);
|
|
99
|
-
|
|
100
|
-
return new runtime.JSONApiResponse(response);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Deletes previously uploaded file Required permissions: - DeleteAttachment
|
|
105
|
-
* Delete file
|
|
106
|
-
*/
|
|
107
|
-
async deleteFile(requestParameters: DeleteFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FileDeleteResponse> {
|
|
108
|
-
const response = await this.deleteFileRaw(requestParameters, initOverrides);
|
|
109
|
-
return await response.value();
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Deletes previously uploaded image Required permissions: - DeleteAttachment
|
|
114
|
-
* Delete image
|
|
115
|
-
*/
|
|
116
|
-
async deleteImageRaw(requestParameters: DeleteImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FileDeleteResponse>> {
|
|
117
|
-
if (requestParameters.type === null || requestParameters.type === undefined) {
|
|
118
|
-
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling deleteImage.');
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
122
|
-
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling deleteImage.');
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const queryParameters: any = {};
|
|
126
|
-
|
|
127
|
-
if (requestParameters.url !== undefined) {
|
|
128
|
-
queryParameters['url'] = requestParameters.url;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
132
|
-
|
|
133
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
134
|
-
headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
138
|
-
queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
142
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const response = await this.request({
|
|
146
|
-
path: `/channels/{type}/{id}/image`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
|
|
147
|
-
method: 'DELETE',
|
|
148
|
-
headers: headerParameters,
|
|
149
|
-
query: queryParameters,
|
|
150
|
-
}, initOverrides);
|
|
151
|
-
|
|
152
|
-
return new runtime.JSONApiResponse(response);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
/**
|
|
156
|
-
* Deletes previously uploaded image Required permissions: - DeleteAttachment
|
|
157
|
-
* Delete image
|
|
158
|
-
*/
|
|
159
|
-
async deleteImage(requestParameters: DeleteImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FileDeleteResponse> {
|
|
160
|
-
const response = await this.deleteImageRaw(requestParameters, initOverrides);
|
|
161
|
-
return await response.value();
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Uploads file Required permissions: - UploadAttachment
|
|
166
|
-
* Upload file
|
|
167
|
-
*/
|
|
168
|
-
async uploadFileRaw(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FileUploadResponse>> {
|
|
169
|
-
if (requestParameters.type === null || requestParameters.type === undefined) {
|
|
170
|
-
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling uploadFile.');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
174
|
-
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling uploadFile.');
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
const queryParameters: any = {};
|
|
178
|
-
|
|
179
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
180
|
-
|
|
181
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
182
|
-
headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
186
|
-
queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
190
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
const consumes: runtime.Consume[] = [
|
|
194
|
-
{ contentType: 'multipart/form-data' },
|
|
195
|
-
];
|
|
196
|
-
// @ts-ignore: canConsumeForm may be unused
|
|
197
|
-
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
198
|
-
|
|
199
|
-
let formParams: { append(param: string, value: any): any };
|
|
200
|
-
let useForm = false;
|
|
201
|
-
if (useForm) {
|
|
202
|
-
formParams = new FormData();
|
|
203
|
-
} else {
|
|
204
|
-
formParams = new URLSearchParams();
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
if (requestParameters.file !== undefined) {
|
|
208
|
-
formParams.append('file', requestParameters.file as any);
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
if (requestParameters.user !== undefined) {
|
|
212
|
-
|
|
213
|
-
formParams.append('user', new Blob([JSON.stringify(requestParameters.user)], { type: "application/json", }));
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
const response = await this.request({
|
|
217
|
-
path: `/channels/{type}/{id}/file`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
|
|
218
|
-
method: 'POST',
|
|
219
|
-
headers: headerParameters,
|
|
220
|
-
query: queryParameters,
|
|
221
|
-
body: formParams,
|
|
222
|
-
}, initOverrides);
|
|
223
|
-
|
|
224
|
-
return new runtime.JSONApiResponse(response);
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Uploads file Required permissions: - UploadAttachment
|
|
229
|
-
* Upload file
|
|
230
|
-
*/
|
|
231
|
-
async uploadFile(requestParameters: UploadFileRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FileUploadResponse> {
|
|
232
|
-
const response = await this.uploadFileRaw(requestParameters, initOverrides);
|
|
233
|
-
return await response.value();
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Uploads image Required permissions: - UploadAttachment
|
|
238
|
-
* Upload image
|
|
239
|
-
*/
|
|
240
|
-
async uploadImageRaw(requestParameters: UploadImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ImageUploadResponse>> {
|
|
241
|
-
if (requestParameters.type === null || requestParameters.type === undefined) {
|
|
242
|
-
throw new runtime.RequiredError('type','Required parameter requestParameters.type was null or undefined when calling uploadImage.');
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
if (requestParameters.id === null || requestParameters.id === undefined) {
|
|
246
|
-
throw new runtime.RequiredError('id','Required parameter requestParameters.id was null or undefined when calling uploadImage.');
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const queryParameters: any = {};
|
|
250
|
-
|
|
251
|
-
const headerParameters: runtime.HTTPHeaders = {};
|
|
252
|
-
|
|
253
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
254
|
-
headerParameters["Stream-Auth-Type"] = this.configuration.apiKey("Stream-Auth-Type"); // stream-auth-type authentication
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
258
|
-
queryParameters["api_key"] = this.configuration.apiKey("api_key"); // api_key authentication
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
if (this.configuration && this.configuration.apiKey) {
|
|
262
|
-
headerParameters["Authorization"] = this.configuration.apiKey("Authorization"); // JWT authentication
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
const consumes: runtime.Consume[] = [
|
|
266
|
-
{ contentType: 'multipart/form-data' },
|
|
267
|
-
];
|
|
268
|
-
// @ts-ignore: canConsumeForm may be unused
|
|
269
|
-
const canConsumeForm = runtime.canConsumeForm(consumes);
|
|
270
|
-
|
|
271
|
-
let formParams: { append(param: string, value: any): any };
|
|
272
|
-
let useForm = false;
|
|
273
|
-
if (useForm) {
|
|
274
|
-
formParams = new FormData();
|
|
275
|
-
} else {
|
|
276
|
-
formParams = new URLSearchParams();
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
if (requestParameters.file !== undefined) {
|
|
280
|
-
formParams.append('file', requestParameters.file as any);
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
if (requestParameters.uploadSizes) {
|
|
284
|
-
formParams.append('upload_sizes', requestParameters.uploadSizes.join(runtime.COLLECTION_FORMATS["csv"]));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
if (requestParameters.user !== undefined) {
|
|
288
|
-
|
|
289
|
-
formParams.append('user', new Blob([JSON.stringify(requestParameters.user)], { type: "application/json", }));
|
|
290
|
-
}
|
|
291
|
-
|
|
292
|
-
const response = await this.request({
|
|
293
|
-
path: `/channels/{type}/{id}/image`.replace(`{${"type"}}`, encodeURIComponent(String(requestParameters.type))).replace(`{${"id"}}`, encodeURIComponent(String(requestParameters.id))),
|
|
294
|
-
method: 'POST',
|
|
295
|
-
headers: headerParameters,
|
|
296
|
-
query: queryParameters,
|
|
297
|
-
body: formParams,
|
|
298
|
-
}, initOverrides);
|
|
299
|
-
|
|
300
|
-
return new runtime.JSONApiResponse(response);
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Uploads image Required permissions: - UploadAttachment
|
|
305
|
-
* Upload image
|
|
306
|
-
*/
|
|
307
|
-
async uploadImage(requestParameters: UploadImageRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ImageUploadResponse> {
|
|
308
|
-
const response = await this.uploadImageRaw(requestParameters, initOverrides);
|
|
309
|
-
return await response.value();
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
}
|