Last active
June 17, 2022 05:16
-
-
Save mustafa-qamaruddin/a14bd88a1575e8b8b7cc9ceeefdbbc46 to your computer and use it in GitHub Desktop.
access account
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# create some data | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
} | |
} | |
{ | |
"values": { | |
"Pair": { | |
"hypi": { | |
"id": "p1" | |
}, | |
"key": "k", | |
"value": "v" | |
} | |
} | |
} | |
# create a user | |
mutation createAccount($value:AccountInput!) { | |
createAccount(value:$value) | |
{ | |
id | |
instanceId | |
} | |
} | |
{ | |
"value": { | |
"hypi": { | |
"id": "user101" | |
}, | |
"username": "cameron", | |
"emails": {"value": "[email protected]"}, | |
"password": { | |
"value": "1234567890" | |
} | |
} | |
} | |
# create access right | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
instanceId | |
} | |
} | |
{ | |
"values": { | |
"AccessRight": { | |
"hypi": { | |
"id": "rbp.allow-user", | |
"instanceId": "01FW4Q87QH10DH5N0QDAAZJA0R" | |
}, | |
"targetInstanceId": "01FW4Q87QH10DH5N0QDAAZJA0R", | |
"resource": "p1", | |
"resourceType": "Pair", | |
"resourceOwnerId": "01FW4Q5V127R1ANNJ1PKYSY5AT", | |
"resourceOwnerInstanceId": "01FW4Q5V128Q1E5K69MQD62BQG", | |
"operationType": "Query", | |
"operation": "get", | |
"permissionType": "RBP", | |
"approved": true, | |
"members": [ | |
{ | |
"hypi": { | |
"id": "01FW5RZHJRYJCCNQ560627CRK4", | |
"instanceId": "01FW4Q87QH10DH5N0QDAAZJA0R" | |
} | |
} | |
] | |
} | |
} | |
} | |
# login the user | |
{ | |
login( | |
username: "cameron", | |
password: "1234567890" | |
) { | |
sessionToken | |
sessionExpires | |
errorCode | |
errorMsg | |
} | |
} | |
# access the data | |
{ | |
get(type: Pair, id: "p1") { | |
... on Pair { | |
hypi { | |
id | |
instanceId | |
createdBy | |
} | |
key | |
value | |
} | |
} | |
} | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
instanceId | |
} | |
} | |
{ | |
"values": { | |
"AccessRight": { | |
"hypi": { | |
"id": "rbp.allow-user", | |
"instanceId": "01FW4Q87QH10DH5N0QDAAZJA0R" | |
}, | |
"targetInstanceId": "01FW4Q87QH10DH5N0QDAAZJA0R", | |
"resource": "p1", | |
"resourceType": "Pair", | |
"resourceOwnerId": "01FW4Q5V127R1ANNJ1PKYSY5AT", | |
"resourceOwnerInstanceId": "01FW4Q5V128Q1E5K69MQD62BQG", | |
"operationType": "Query", | |
"operation": "get", | |
"permissionType": "RBP", | |
"approved": true, | |
"membersSourceType": "MyAwesomeNewType", | |
"membersSourceField": "myAwesomeNewField" | |
} | |
} | |
} | |
type MyAwesomeNewType { | |
# ... other fields | |
myAwesomeNewField: [Account!] | |
# ... other fields | |
} | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
instanceId | |
} | |
} | |
{ | |
"values": { | |
"MyAwesomeNewtype": { | |
# ... other fields | |
"members": [ | |
{ | |
"hypi": { | |
"id": "01FW5RZHJRYJCCNQ560627CRK4", | |
"instanceId": "01FW4Q87QH10DH5N0QDAAZJA0R" | |
} | |
} | |
] | |
# ... other fields | |
} | |
} | |
} | |
mutation link( | |
$from: HypiMutationType!, | |
$to: HypiMutationType!, | |
$via: String!, | |
$whereFromID: String!, | |
$andToID: String! | |
) { | |
link( | |
from: $from, | |
to: $to, | |
via: $via, | |
whereFromID: $whereFromID, | |
andToID: $andToID | |
) | |
} | |
{ | |
"from": "MyAwesomeNewType", | |
"to": "Account", | |
"via": "myAwesomeNewField", | |
"whereFromID": objectIDOfMyAwesomeNewType, | |
"andToID": memberAccountId | |
} | |
mutation upsert($values:HypiUpsertInputUnion!) { | |
upsert(values:$values){ | |
id | |
instanceId | |
} | |
} | |
{ | |
"values": { | |
"AccessRight": { | |
"hypi": { | |
"id": "rbp.allow-user-to-query-find-another-user", | |
"instanceId": "01FW4Q87QH10DH5N0QDAAZJA0R" | |
}, | |
"targetInstanceId": "01FW4Q87QH10DH5N0QDAAZJA0R", | |
"resource": "replaceMeWithTargetUserHypiAccountId", | |
"resourceType": "Account", | |
"resourceOwnerId": "replaceMeWithTargetUserHypiAccountId", | |
"resourceOwnerInstanceId": "01FW4Q5V128Q1E5K69MQD62BQG", | |
"operationType": "Query", | |
"operation": "find", | |
"permissionType": "RBP", | |
"approved": true, | |
"membersSourceType": "MyAwesomeNewType", | |
"membersSourceField": "myAwesomeNewField" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment