Skip to content

Commit

Permalink
Merge pull request #182 from authzed/sohanmaheshwar-patch-1
Browse files Browse the repository at this point in the history
Update example.js
  • Loading branch information
sohanmaheshwar authored Nov 18, 2024
2 parents 2a65c3a + ec283f7 commit 88b0660
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions examples/v1/example.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { v1 } from '@authzed/authzed-node';
const { promises: promiseClient } = client; // access client.promises
// set up it on localhost like this:
// const client = v1.NewClient('mytokenhere', 'localhost:50051', 1);
const client = v1.NewClient('mytokenhere');
Expand Down Expand Up @@ -82,3 +83,26 @@ console.log(
checkResult.permissionship ===
v1.CheckPermissionResponse_Permissionship.HAS_PERMISSION
);

// Lookup Resources

const lookupResourcesRequest = v1.LookupResourcesRequest.create({
consistency: v1.Consistency.create({
requirement: {
oneofKind: 'fullyConsistent',
fullyConsistent: true,
},
}),
resourceObjectType: 'test/document',
permission: 'view',
subject: v1.SubjectReference.create({
object: v1.ObjectReference.create({
objectType: 'test/user',
objectId: 'fred',
}),
}),
});

const results = await promiseClient.lookupResources(lookupResourcesRequest)

console.log(results);

0 comments on commit 88b0660

Please sign in to comment.