-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Querying database requires full user info access #43
Comments
I did a bit of digging on this one. With the 3 different levels of access to user info that the notion API provides:
The shape returned from the Notion API expected by the library currently is 3, however when querying any content with a mention and the settings of 1 & 2 then the following shapes are returned from the Notion API: {
"type": "mention",
"mention": {
"type": "user",
"user": {
"object": "user",
"id": "1118608e-35e8-4fa3-aef7-a4ced85ce8e0"
}
},
"annotations": { ... },
"plain_text": "@Anonymous",
"href": null
} {
"type": "mention",
"mention": {
"type": "user",
"user": {
"object": "user",
"id": "1118608e-35e8-4fa3-aef7-a4ced85ce8e0",
"name": "John Doe",
"avatar_url": "https://secure.notion-static.com/e6a352a8-8381-44d0-a1dc-9ed80e62b53d.jpg",
"type": "person",
"person": {}
}
},
"annotations": { ... },
"plain_text": "@John Doe",
"href": null
} The missing email and type in 1, and the missing email in 2, cause the serde deserialisation to choke. The missing email can be resolved relatively trivially by wrapping the Bot and Person structs The missing type for fully anonymous users is a bit more challenging to resolve. Digging into serde I found an issue detailing the limitations for the library around mixing tagged and untagged deserialisation. I have tried the suggested workaround with the three enums by specifying a new User enum variant of Another option to resolve this issue is to swap to Not sure if that helps, but keen to get the issues resolved as I would like to use the lower-privileged integration at some point too :) |
Hello!
I have the following code, in a project where I don't need full user info, just the base (without the email).
If I don't have the e-mail permission granted, the code crashes with the error below, but with the permission granted it successfully queries.
IMHO, those should either be optional, or on an enum/nested struct, and not require full permissions (otherwise, could it be mentioned in the README?)
The text was updated successfully, but these errors were encountered: