diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dbfff79..f3bc694 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -54,13 +54,6 @@ If you have updated the generated chat code you'll have to fix the following iss - Add `/** @ts-expect-error */ ` (make sure to use this exact comment format otherwise they will be missing from `d.ts` files) for imports for `ImageSizeRequest`, `OnlyUserIDRequest` in the `gen/chat/FilesApi.ts` and `gen/chat/MessagesApi.ts` files - Add `/** @ts-expect-error */ ` (make sure to use this exact comment format otherwise they will be missing from `d.ts` files) for duplicate exports in `gen/chat/index.ts` -- Fix the query param serizalization in the `gen/chat/MessagesApi.ts` file's `getManyMessagesRaw` function. This is the correct serialization: - -```typescript -if (requestParameters.ids) { - queryParameters["ids"] = requestParameters.ids.join(","); -} -``` ### Validate that the generated code works diff --git a/src/StreamClient.ts b/src/StreamClient.ts index 6d4f090..ebb4ad3 100644 --- a/src/StreamClient.ts +++ b/src/StreamClient.ts @@ -517,18 +517,18 @@ export class StreamClient { queryParamsStringify: (params: HTTPQuery) => { const newParams = []; for (const k in params) { - if (Array.isArray(params[k]) || typeof params[k] === 'object') { - newParams.push( - `${k}=${encodeURIComponent(JSON.stringify(params[k]))}`, - ); + const param = params[k]; + if (Array.isArray(param)) { + newParams.push(`${k}=${encodeURIComponent(param.join(','))}`); + } else if (typeof param === 'object') { + newParams.push(`${k}=${encodeURIComponent(JSON.stringify(param))}`); } else { - const value = params[k]; if ( - typeof value === 'string' || - typeof value === 'number' || - typeof value === 'boolean' + typeof param === 'string' || + typeof param === 'number' || + typeof param === 'boolean' ) { - newParams.push(`${k}=${encodeURIComponent(value)}`); + newParams.push(`${k}=${encodeURIComponent(param)}`); } } } diff --git a/src/gen/chat/apis/MessagesApi.ts b/src/gen/chat/apis/MessagesApi.ts index 42650c1..26d04ca 100644 --- a/src/gen/chat/apis/MessagesApi.ts +++ b/src/gen/chat/apis/MessagesApi.ts @@ -462,7 +462,7 @@ export class MessagesApi extends runtime.BaseAPI { const queryParameters: any = {}; if (requestParameters.ids) { - queryParameters['ids'] = requestParameters.ids.join(','); + queryParameters['ids'] = requestParameters.ids; } const headerParameters: runtime.HTTPHeaders = {};