go
str, err := client.Permission.LookupEntityStream(context.Background(), &v1.PermissionLookupEntityRequest{
Metadata: &v1.PermissionLookupEntityRequestMetadata{
SnapToken: "",
SchemaVersion: "",
Depth: 50,
},
EntityType: "document",
Permission: "view",
Subject: &v1.Subject{
Type: "user",
Id: "1",
},
PageSize: 20,
ContinuousToken: "",
})
// handle stream response
for {
res, err := str.Recv()
if err == io.EOF {
break
}
// res.EntityId
}const permify = require("@permify/permify-node");
const {PermissionLookupEntityStreamResponse} = require("@permify/permify-node/dist/src/grpc/generated/base/v1/service");
function main() {
const client = new permify.grpc.newClient({
endpoint: "localhost:3478",
});
let res = client.permission.lookupEntityStream({
metadata: {
snapToken: "",
schemaVersion: "",
depth: 20
},
entityType: "document",
permission: "view",
subject: {
type: "user",
id: "1"
},
page_size: 20,
continuous_token: ""
});
handle(res);
}
async function handle(res: AsyncIterable<PermissionLookupEntityStreamResponse>) {
for await (const response of res) {
// response.entityId
}
}{
"result": {
"entity_id": "<string>",
"continuous_token": "<string>"
},
"error": {
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}Permission Service
Lookup Entity (Streaming)
POST
/
v1
/
tenants
/
{tenant_id}
/
permissions
/
lookup-entity-stream
go
str, err := client.Permission.LookupEntityStream(context.Background(), &v1.PermissionLookupEntityRequest{
Metadata: &v1.PermissionLookupEntityRequestMetadata{
SnapToken: "",
SchemaVersion: "",
Depth: 50,
},
EntityType: "document",
Permission: "view",
Subject: &v1.Subject{
Type: "user",
Id: "1",
},
PageSize: 20,
ContinuousToken: "",
})
// handle stream response
for {
res, err := str.Recv()
if err == io.EOF {
break
}
// res.EntityId
}const permify = require("@permify/permify-node");
const {PermissionLookupEntityStreamResponse} = require("@permify/permify-node/dist/src/grpc/generated/base/v1/service");
function main() {
const client = new permify.grpc.newClient({
endpoint: "localhost:3478",
});
let res = client.permission.lookupEntityStream({
metadata: {
snapToken: "",
schemaVersion: "",
depth: 20
},
entityType: "document",
permission: "view",
subject: {
type: "user",
id: "1"
},
page_size: 20,
continuous_token: ""
});
handle(res);
}
async function handle(res: AsyncIterable<PermissionLookupEntityStreamResponse>) {
for await (const response of res) {
// response.entityId
}
}{
"result": {
"entity_id": "<string>",
"continuous_token": "<string>"
},
"error": {
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}
}{
"code": 123,
"message": "<string>",
"details": [
{
"@type": "<string>"
}
]
}The difference between this endpoint from direct Lookup Entity is response of this entity gives the IDs’ as stream. This could be useful if you have large data set that getting all of the authorized data can take long with direct lookup entity endpoint.
Path Parameters
Body
application/json
PermissionLookupEntityRequest is the request message for the LookupEntity method in the Permission service.