-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
77 additions
and
15 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import asyncio | ||
|
||
from yatracker import YaTracker | ||
from yatracker.types import FullIssue | ||
|
||
# CAUTION! Don't store credentials in your code! | ||
ORG_ID = ... | ||
TOKEN = ... | ||
|
||
|
||
# Create your own custom Issue type: | ||
class HelpIssue(FullIssue, kw_only=True): | ||
"""Your own FullIssue type. | ||
For example, you have some fields passed by external system. | ||
One of them called 'userUsername', second - 'userId'. | ||
""" | ||
|
||
user_username: str | None | ||
user_id: int | ||
|
||
|
||
async def main() -> None: | ||
"""Run example.""" | ||
# define tracker (once) | ||
tracker = YaTracker(ORG_ID, TOKEN) | ||
|
||
# create an issue | ||
issue = await tracker.create_issue( | ||
summary="New Issue", | ||
queue="KEY", | ||
user_id=1234567890, | ||
_type=HelpIssue, | ||
) | ||
print(issue.user_id) | ||
|
||
# don't forget to close tracker on app shutdown (once) | ||
await tracker.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
asyncio.run(main()) |
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
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
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