Skip to content

Commit 88b0660

Browse files
Merge pull request #182 from authzed/sohanmaheshwar-patch-1
Update example.js
2 parents 2a65c3a + ec283f7 commit 88b0660

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

examples/v1/example.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { v1 } from '@authzed/authzed-node';
2+
const { promises: promiseClient } = client; // access client.promises
23
// set up it on localhost like this:
34
// const client = v1.NewClient('mytokenhere', 'localhost:50051', 1);
45
const client = v1.NewClient('mytokenhere');
@@ -82,3 +83,26 @@ console.log(
8283
checkResult.permissionship ===
8384
v1.CheckPermissionResponse_Permissionship.HAS_PERMISSION
8485
);
86+
87+
// Lookup Resources
88+
89+
const lookupResourcesRequest = v1.LookupResourcesRequest.create({
90+
consistency: v1.Consistency.create({
91+
requirement: {
92+
oneofKind: 'fullyConsistent',
93+
fullyConsistent: true,
94+
},
95+
}),
96+
resourceObjectType: 'test/document',
97+
permission: 'view',
98+
subject: v1.SubjectReference.create({
99+
object: v1.ObjectReference.create({
100+
objectType: 'test/user',
101+
objectId: 'fred',
102+
}),
103+
}),
104+
});
105+
106+
const results = await promiseClient.lookupResources(lookupResourcesRequest)
107+
108+
console.log(results);

0 commit comments

Comments
 (0)