Skip to content

Commit a9e8042

Browse files
authored
Add metadata support to users (#82)
1 parent 81016dd commit a9e8042

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/resources/Users.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
import { Except } from "type-fest";
22
import { AboundBaseResource } from "./base/AboundBaseResource";
3-
import { DeepPartial, Notes, Pagination } from "./base/AboundResource";
3+
import {
4+
DeepPartial,
5+
Metadata,
6+
Notes,
7+
Pagination,
8+
} from "./base/AboundResource";
49
import { AboundBulkResponse, AboundResponse } from "./base/AboundResponse";
510

611
// request body
712
export interface UserRequest {
813
email?: string;
914
foreignId?: string;
15+
metadata?: Metadata;
1016
notes?: Notes;
1117
profile?: UserProfile;
1218
business?: UserBusiness;

src/resources/base/AboundResource.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { AboundBulkResponse, AboundResponse } from "./AboundResponse";
55
// see https://github.com/typescript-eslint/typescript-eslint/issues/2063#issuecomment-675156492
66
export type EmptyObject = Record<string, never>;
77

8+
export type Metadata = Record<string, string>;
9+
810
export type Notes = string | Record<string, unknown>;
911

1012
export interface Pagination extends Record<string, unknown> {

tests/resources/users.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ describe("Abound Users", () => {
1818
const createdUser: AboundResponse<User> = await abound.users.create({
1919
2020
foreignId: "tj_miller",
21+
metadata: {
22+
title: "Board member of Pied Piper",
23+
},
2124
notes: "Board member of Pied Piper",
2225
profile: {
2326
firstName: "Erlich",
@@ -57,6 +60,9 @@ Object {
5760
},
5861
"email": "[email protected]",
5962
"foreignId": "tj_miller",
63+
"metadata": Object {
64+
"title": "Board member of Pied Piper",
65+
},
6066
"notes": "Board member of Pied Piper",
6167
"profile": Object {
6268
"address": "3338 Thunder Road",

0 commit comments

Comments
 (0)