Closed FeodorFitsner closed 3 weeks ago
The type ReposOwnerRepoPullsPullNumberReviewsPostBodyType
is actually a TypedDict
, you could simply pass python dict as the argument. The IDE could detect the TypedDict and prompt you the field name, check the field value type.
Import the TypedDict will cause extra memory usage, but, you can still import it from the types
module:
from githubkit.versions.latest.types import ReposOwnerRepoPullsPullNumberReviewsPostBodyType
Yep, that worked. Thanks!
...though using strings instead of parameters is not so elegant :)
Would it make sense to export those classes from a module?
though using strings instead of parameters is not so elegant
I'm not sure how you are using the strings? you can just pass dicts or lists likes data={"body": "xxx", "comments": []}
Would it make sense to export those classes from a module?
The types can be actually imported from the types module i mentioned above:
from githubkit.versions.latest.types import ReposOwnerRepoPullsPullNumberReviewsPostBodyType
Yep, this is how I'm using it and it works:
await github.rest.pulls.async_create_review(
owner="owner",
repo="repo",
pull_number=1,
data={
"body": "Alright, this is my review!",
"event": "COMMENT",
"comments": [
{
"path": "docs/tutorials/python-todo.md",
"body": "1st suggestion...\n\n```suggestion\nPar 1...\n```\n",
"line": 136,
},
],
},
If there is any other questions, feel free to open an issue. i will close this.
Thanks for the great library - it's async and typed!
While using some of the API methods, for example
github.rest.pulls.async_create_review()
I noticed it's signature requiresReposOwnerRepoPullsPullNumberReviewsPostBody
which I was unable to import:I imported and used
ReposOwnerRepoPullsPullNumberReviewsPostBody
instead and review was successfully added.Am I using it wrongfully or there is a bug?