Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
fix models
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Rossow-Greenberg committed Feb 16, 2024
1 parent 89318ff commit b1710e6
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 28 deletions.
14 changes: 5 additions & 9 deletions pytdx/models/asset.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from typing import Optional, List, Dict
from base_model import BaseModel


class BaseClass:
def to_dict(self):
return {key: value for key, value in vars(self).items() if value is not None}


class Choice(BaseClass):
class Choice(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand All @@ -24,7 +20,7 @@ def __init__(
self.Order = Order


class Attribute(BaseClass):
class Attribute(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down Expand Up @@ -60,7 +56,7 @@ def __init__(
self.Choices = Choices


class Asset(BaseClass):
class Asset(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down Expand Up @@ -166,7 +162,7 @@ def __init__(
self.Uri = Uri


class AssetModel(BaseClass):
class AssetModel(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down
8 changes: 2 additions & 6 deletions pytdx/models/attribute.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from typing import Optional, List
from base_model import BaseModel


class BaseClass:
def to_dict(self):
return {key: value for key, value in vars(self).items() if value is not None}


class AttributeChoice(BaseClass):
class AttributeChoice(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down
3 changes: 3 additions & 0 deletions pytdx/models/base_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class BaseModel:
def to_dict(self):
return {key: value for key, value in vars(self).items() if value is not None}
5 changes: 3 additions & 2 deletions pytdx/models/knowledge_article.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from typing import Optional, List
from base_model import BaseModel


class Attribute:
class Attribute(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down Expand Up @@ -37,7 +38,7 @@ def __init__(
self.AssociatedItemIDs = AssociatedItemIDs


class KnowledgeArticle:
class KnowledgeArticle(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down
16 changes: 6 additions & 10 deletions pytdx/models/ticket.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from typing import Optional, List
from base_model import BaseModel


class BaseClass:
def to_dict(self):
return {key: value for key, value in vars(self).items() if value is not None}


class NotifyItem(BaseClass):
class NotifyItem(BaseModel):
def __init__(
self,
ItemRole: Optional[str] = None,
Expand All @@ -24,7 +20,7 @@ def __init__(
self.ProfileImageFileName = ProfileImageFileName


class AttributeItem(BaseClass):
class AttributeItem(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down Expand Up @@ -60,7 +56,7 @@ def __init__(
self.AssociatedItemIDs = AssociatedItemIDs


class Ticket(BaseClass):
class Ticket(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down Expand Up @@ -300,7 +296,7 @@ def __init__(
self.WorkflowName = WorkflowName


class TicketFeed(BaseClass):
class TicketFeed(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down Expand Up @@ -370,7 +366,7 @@ def __init__(
self.Uri = Uri


class TicketType(BaseClass):
class TicketType(BaseModel):
def __init__(
self,
ID: Optional[int] = None,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="py-teamdynamix",
version="0.2.4",
version="0.2.5",
author="Julien Rossow-Greenberg",
author_email="[email protected]",
description="Python client for interacting with the TeamDynamix ITSM APIs",
Expand Down

0 comments on commit b1710e6

Please sign in to comment.