diff --git a/src/ext/group-api.ts b/src/ext/group-api.ts index a360c70..92c0b3d 100644 --- a/src/ext/group-api.ts +++ b/src/ext/group-api.ts @@ -10,7 +10,11 @@ export class GroupApi { } async createGroup(groupToCreate: GroupToCreate, xRequestID?: string, options?: AxiosRequestConfig): Promise { - const response = await this.superClass.createGroup(groupToCreate, xRequestID, options); + const groupToCreateWithGuard = { + ...groupToCreate, + metadata: !groupToCreate?.metadata ? {} : groupToCreate.metadata + } + const response = await this.superClass.createGroup(groupToCreateWithGuard, xRequestID, options); return response.data; } diff --git a/src/ext/person-api.ts b/src/ext/person-api.ts index 2cde9fa..0cf25d2 100644 --- a/src/ext/person-api.ts +++ b/src/ext/person-api.ts @@ -11,7 +11,11 @@ export class PersonApi { } async createPerson(personFields: PersonFields, xRequestID?: string, options?: AxiosRequestConfig): Promise { - const response = await this.superClass.createPerson(personFields, xRequestID, options); + const personFieldsWithGuard = { + ...personFields, + metadata: !personFields?.metadata ? {} : personFields.metadata + } + const response = await this.superClass.createPerson(personFieldsWithGuard, xRequestID, options); return response.data; } async addImageToPerson(