Skip to content

Commit

Permalink
simplify person creation (#22)
Browse files Browse the repository at this point in the history
* chore: update flake.lock

Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/f4f322d1424aa547eba9cb092f905f5ceb9b639c' (2024-07-29)
  → 'github:NixOS/nixpkgs/3563397b2f10ffa1891e1a6ce99d13d960d73acd' (2024-07-30)

* feat: improve persons creation API

* fix: mixin for undefined cases
  • Loading branch information
joscha authored Jul 30, 2024
1 parent 5b8318d commit 66ffd6f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/v1/persons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export type CreatePersonRequest = {
/**
* The email addresses of the person. If there are no email addresses, please specify an empty array.
*/
emails: string[]
emails?: string[]
/**
* An array of unique identifiers of organizations that the person is associated with.
*/
Expand Down Expand Up @@ -349,7 +349,10 @@ export class Persons {
): Promise<SimplePersonResponse> {
const response = await this.axios.post<SimplePersonResponse>(
personsUrl(),
data,
{
...data,
emails: data.emails ?? [], // the API requires this field to be present
},
)
return response.data
}
Expand Down

0 comments on commit 66ffd6f

Please sign in to comment.