Skip to content

Commit 0901359

Browse files
authored
Add user by email (#89)
* Add method for getting user by email * Add changeset * Remove example
1 parent fa7fcd5 commit 0901359

File tree

4 files changed

+115
-17
lines changed

4 files changed

+115
-17
lines changed

.changeset/slow-days-bathe.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@team-plain/typescript-sdk': minor
3+
---
4+
5+
Add ability to get a user by email (userByEmail)

src/client.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ import {
4646
UpdateCustomerCardConfigDocument,
4747
UpsertCustomerDocument,
4848
type UpsertResult,
49+
UserByEmailDocument,
50+
type UserPartsFragment,
4951
type WorkspacePartsFragment,
5052
} from './graphql/types';
5153
import { request } from './request';
@@ -108,6 +110,20 @@ export class PlainClient {
108110
});
109111
}
110112

113+
/**
114+
* Get a paginated list of customers.
115+
*/
116+
async userByEmail(
117+
variables: VariablesOf<typeof UserByEmailDocument>
118+
): SDKResult<UserPartsFragment | null> {
119+
const res = await request(this.#ctx, {
120+
query: UserByEmailDocument,
121+
variables,
122+
});
123+
124+
return unwrapData(res, (q) => q.userByEmail || null);
125+
}
126+
111127
/**
112128
* Get a paginated list of customers.
113129
*/
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
query userByEmail($email: String!) {
2+
userByEmail(email: $email) {
3+
...UserParts
4+
}
5+
}

0 commit comments

Comments
 (0)