Skip to content
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

adds create_transaction_tag method #78

Merged
merged 2 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ As of writing this README, the following methods are supported:
- `update_transaction` - modifies one or more attributes for an existing transaction
- `delete_transaction` - deletes a given transaction by the provided transaction id
- `update_transaction_splits` - modifies how a transaction is split (or not)
- `create_transaction_tag` - creates a tag for transactions
- `set_transaction_tags` - sets the tags on a transaction
- `set_budget_amount` - sets a budget's value to the given amount (date allowed, will only apply to month specified by default). A zero amount value will "unset" or "clear" the budget for the given category.
- `create_manual_account` - creates a new manual account
Expand Down
35 changes: 35 additions & 0 deletions monarchmoney/monarchmoney.py
Original file line number Diff line number Diff line change
Expand Up @@ -1563,6 +1563,41 @@ async def create_transaction_category(
variables=variables,
)

async def create_transaction_tag(self, name: str, color: str) -> Dict[str, Any]:
"""
Creates a new transaction tag.
:param name: The name of the tag
:param color: The color of the tag. Not limited to selections in the dashboard.
cciollaro marked this conversation as resolved.
Show resolved Hide resolved
"""
mutation = gql(
"""
mutation Common_CreateTransactionTag($input: CreateTransactionTagInput!) {
createTransactionTag(input: $input) {
tag {
id
name
color
order
transactionCount
__typename
}
errors {
message
__typename
}
__typename
}
}
"""
)
variables = {"input": {"name": name, "color": color}}

return await self.gql_call(
operation="Common_CreateTransactionTag",
graphql_query=mutation,
variables=variables,
)

async def get_transaction_tags(self) -> Dict[str, Any]:
"""
Gets all the tags configured in the account.
Expand Down
Loading