zammad_py 3.2.0__tar.gz → 3.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ # Credits
2
+
3
+ ## Development Lead
4
+
5
+ * Joe Paul <joeirimpan@gmail.com>
6
+
7
+ ## Contributors
8
+
9
+ * Matthew Frost <matthew@uptic.nl>
@@ -0,0 +1,182 @@
1
+ Metadata-Version: 2.1
2
+ Name: zammad_py
3
+ Version: 3.2.1
4
+ Summary: Python API client for zammad
5
+ Home-page: https://github.com/joeirimpan/zammad_py
6
+ License: MIT
7
+ Author: Joe Paul
8
+ Author-email: joeirimpan@gmail.com
9
+ Requires-Python: >=3.9,<4.0
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: License :: OSI Approved :: MIT License
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Requires-Dist: requests (>=2.25.1,<3.0.0)
21
+ Project-URL: Documentation, https://zammad-py.readthedocs.io/
22
+ Project-URL: Repository, https://github.com/joeirimpan/zammad_py.git
23
+ Description-Content-Type: text/markdown
24
+
25
+ # Zammad API Client
26
+
27
+ [![PyPI version](https://img.shields.io/pypi/v/zammad_py.svg)](https://pypi.python.org/pypi/zammad_py)
28
+ [![Documentation Status](https://readthedocs.org/projects/zammad-py/badge/?version=latest)](https://zammad-py.readthedocs.io/en/latest/?badge=latest)
29
+
30
+ Python API client for zammad
31
+
32
+ * Free software: MIT license
33
+ * Documentation: https://zammad-py.readthedocs.io.
34
+
35
+ ## Quickstart
36
+
37
+ ```python
38
+ from zammad_py import ZammadAPI
39
+
40
+ # Initialize the client with the URL, username, and password
41
+ # Note the Host URL should be in this format: 'https://zammad.example.org/api/v1/'
42
+ client = ZammadAPI(url='<HOST>', username='<USERNAME>', password='<PASSWORD>')
43
+
44
+ # Example: Access all users
45
+ this_page = client.user.all()
46
+ for user in this_page:
47
+ print(user)
48
+
49
+ # Example: Get information about the current user
50
+ print(client.user.me())
51
+
52
+ # Example: Create a ticket
53
+ params = {
54
+ "title": "Help me!",
55
+ "group": "2nd Level",
56
+ "customer": "david@example.com",
57
+ "article": {
58
+ "subject": "My subject",
59
+ "body": "I am a message!",
60
+ "type": "note",
61
+ "internal": False
62
+ }
63
+ }
64
+ new_ticket = client.ticket.create(params=params)
65
+ ```
66
+
67
+ ## General Methods
68
+
69
+ Most resources support these methods:
70
+
71
+ - `.all()`: Returns a paginated response with the current page number and a list of elements.
72
+ - `.next_page()`: Returns the next page of the current pagination object.
73
+ - `.prev_page()`: Returns the previous page of the current pagination object.
74
+ - `.search(params)`: Returns a paginated response based on the search parameters.
75
+ - `.find(id)`: Returns a single object with the specified ID.
76
+ - `.create(params)`: Creates a new object with the specified parameters.
77
+ - `.update(params)`: Updates an existing object with the specified parameters.
78
+ - `.destroy(id)`: Deletes an object with the specified ID.
79
+
80
+ ## Available Resources
81
+
82
+ | Resource | Property |
83
+ |----------|----------|
84
+ | User | `client.user` |
85
+ | Organization | `client.organization` |
86
+ | Group | `client.group` |
87
+ | Role | `client.role` |
88
+ | Ticket | `client.ticket` |
89
+ | Link | `client.link` |
90
+ | TicketArticle | `client.ticket_article` |
91
+ | TicketArticleAttachment | `client.ticket_article_attachment` |
92
+ | TicketArticlePlain | `client.ticket_article_plain` |
93
+ | TicketPriority | `client.ticket_priority` |
94
+ | TicketState | `client.ticket_state` |
95
+ | TagList | `client.taglist` |
96
+ | TicketTag | `client.ticket_tag` |
97
+ | KnowledgeBases | `client.knowledge_bases` |
98
+ | KnowledgeBasesAnswers | `client.knowledge_bases_answers` |
99
+ | KnowledgeBasesCategories | `client.knowledge_bases_categories` |
100
+
101
+ ## Resource-Specific Methods
102
+
103
+ ### User
104
+ - `.me()`: Returns information about the current user.
105
+
106
+ ### Ticket
107
+ - `.articles(id)`: Returns all articles associated with a ticket.
108
+ - `.tags(id)`: Returns all tags associated with a ticket.
109
+ - `.merge(id, number)`: Merges two tickets (requires password auth).
110
+
111
+ ### Link
112
+ - `.get(id)`: Returns all links associated with a ticket.
113
+ - `.add(...)`: Creates a link between two objects.
114
+ - `.remove(...)`: Removes a link between two objects.
115
+
116
+ ### TicketArticleAttachment
117
+ - `.download(id, article_id, ticket_id)`: Downloads a ticket attachment.
118
+
119
+ ### TagList
120
+ - `.all()`: Returns all tags (paginated).
121
+ - `.create(params)`: Creates a new tag.
122
+ - `.destroy(id)`: Deletes a tag.
123
+
124
+ ### TicketTag
125
+ - `.add(id, tag)`: Adds a tag to a ticket.
126
+ - `.remove(id, tag)`: Removes a tag from a ticket.
127
+
128
+ ### KnowledgeBases
129
+ - `.init()`: Returns the entire knowledge base structure.
130
+ - `.manage(id, settings)`: Updates knowledge base settings.
131
+ - `.show_permissions(id)`: Returns permissions for a knowledge base.
132
+ - `.change_permissions(id, permissions)`: Updates permissions.
133
+ - `.reorder_sub_categories(id, category_id, params)`: Reorders sub-categories.
134
+ - `.reorder_root_categories(id, params)`: Reorders root categories.
135
+
136
+ ### KnowledgeBasesAnswers
137
+ - `.find_answer(knowledge_base_id, answer_id)`: Retrieves a specific answer.
138
+ - `.create(params)`: Creates a new answer (requires `knowledge_base_id` in params).
139
+ - `.update(id, params)`: Updates an answer (requires `answer_id` in params).
140
+ - `.destroy_answer(knowledge_base_id, answer_id)`: Deletes an answer.
141
+ - `.change_answer_visibility(knowledge_base_id, answer_id, visibility)`: Updates answer visibility.
142
+ - `.add_attachment(knowledge_base_id, answer_id, attachment)`: Uploads an attachment.
143
+ - `.delete_attachment(knowledge_base_id, answer_id, attachment_id)`: Removes an attachment.
144
+
145
+ ### KnowledgeBasesCategories
146
+ - `.find_category(knowledge_base_id, category_id)`: Retrieves a specific category.
147
+ - `.create(params)`: Creates a new category (requires `knowledge_base_id` in params).
148
+ - `.update(id, params)`: Updates a category (requires `category_id` in params).
149
+ - `.destroy_category(knowledge_base_id, category_id)`: Deletes a category.
150
+ - `.show_permissions(knowledge_base_id, category_id)`: Returns category permissions.
151
+ - `.change_permissions(knowledge_base_id, category_id, permissions)`: Updates permissions.
152
+ - `.reorder_answers(knowledge_base_id, category_id, params)`: Reorders answers.
153
+
154
+ ## On Behalf Of
155
+
156
+ You can set the `on_behalf_of` attribute to perform actions on behalf of another user:
157
+
158
+ ```python
159
+ client.on_behalf_of = 'user@example.com'
160
+ ```
161
+
162
+ Or use the context manager:
163
+
164
+ ```python
165
+ with client.request_on_behalf_of('user@example.com'):
166
+ client.ticket.create(params=params)
167
+ ```
168
+
169
+ ## Contributing
170
+
171
+ The Zammad API Client (zammad_py) welcomes contributions.
172
+
173
+ You can contribute by reporting bugs, fixing bugs, implementing new features, writing documentation, and submitting feedback.
174
+
175
+ To get started, see the contributing section in the docs!
176
+
177
+ Please ensure that your changes include tests and updated documentation if necessary.
178
+
179
+ ## Credits
180
+
181
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
182
+
@@ -0,0 +1,157 @@
1
+ # Zammad API Client
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/zammad_py.svg)](https://pypi.python.org/pypi/zammad_py)
4
+ [![Documentation Status](https://readthedocs.org/projects/zammad-py/badge/?version=latest)](https://zammad-py.readthedocs.io/en/latest/?badge=latest)
5
+
6
+ Python API client for zammad
7
+
8
+ * Free software: MIT license
9
+ * Documentation: https://zammad-py.readthedocs.io.
10
+
11
+ ## Quickstart
12
+
13
+ ```python
14
+ from zammad_py import ZammadAPI
15
+
16
+ # Initialize the client with the URL, username, and password
17
+ # Note the Host URL should be in this format: 'https://zammad.example.org/api/v1/'
18
+ client = ZammadAPI(url='<HOST>', username='<USERNAME>', password='<PASSWORD>')
19
+
20
+ # Example: Access all users
21
+ this_page = client.user.all()
22
+ for user in this_page:
23
+ print(user)
24
+
25
+ # Example: Get information about the current user
26
+ print(client.user.me())
27
+
28
+ # Example: Create a ticket
29
+ params = {
30
+ "title": "Help me!",
31
+ "group": "2nd Level",
32
+ "customer": "david@example.com",
33
+ "article": {
34
+ "subject": "My subject",
35
+ "body": "I am a message!",
36
+ "type": "note",
37
+ "internal": False
38
+ }
39
+ }
40
+ new_ticket = client.ticket.create(params=params)
41
+ ```
42
+
43
+ ## General Methods
44
+
45
+ Most resources support these methods:
46
+
47
+ - `.all()`: Returns a paginated response with the current page number and a list of elements.
48
+ - `.next_page()`: Returns the next page of the current pagination object.
49
+ - `.prev_page()`: Returns the previous page of the current pagination object.
50
+ - `.search(params)`: Returns a paginated response based on the search parameters.
51
+ - `.find(id)`: Returns a single object with the specified ID.
52
+ - `.create(params)`: Creates a new object with the specified parameters.
53
+ - `.update(params)`: Updates an existing object with the specified parameters.
54
+ - `.destroy(id)`: Deletes an object with the specified ID.
55
+
56
+ ## Available Resources
57
+
58
+ | Resource | Property |
59
+ |----------|----------|
60
+ | User | `client.user` |
61
+ | Organization | `client.organization` |
62
+ | Group | `client.group` |
63
+ | Role | `client.role` |
64
+ | Ticket | `client.ticket` |
65
+ | Link | `client.link` |
66
+ | TicketArticle | `client.ticket_article` |
67
+ | TicketArticleAttachment | `client.ticket_article_attachment` |
68
+ | TicketArticlePlain | `client.ticket_article_plain` |
69
+ | TicketPriority | `client.ticket_priority` |
70
+ | TicketState | `client.ticket_state` |
71
+ | TagList | `client.taglist` |
72
+ | TicketTag | `client.ticket_tag` |
73
+ | KnowledgeBases | `client.knowledge_bases` |
74
+ | KnowledgeBasesAnswers | `client.knowledge_bases_answers` |
75
+ | KnowledgeBasesCategories | `client.knowledge_bases_categories` |
76
+
77
+ ## Resource-Specific Methods
78
+
79
+ ### User
80
+ - `.me()`: Returns information about the current user.
81
+
82
+ ### Ticket
83
+ - `.articles(id)`: Returns all articles associated with a ticket.
84
+ - `.tags(id)`: Returns all tags associated with a ticket.
85
+ - `.merge(id, number)`: Merges two tickets (requires password auth).
86
+
87
+ ### Link
88
+ - `.get(id)`: Returns all links associated with a ticket.
89
+ - `.add(...)`: Creates a link between two objects.
90
+ - `.remove(...)`: Removes a link between two objects.
91
+
92
+ ### TicketArticleAttachment
93
+ - `.download(id, article_id, ticket_id)`: Downloads a ticket attachment.
94
+
95
+ ### TagList
96
+ - `.all()`: Returns all tags (paginated).
97
+ - `.create(params)`: Creates a new tag.
98
+ - `.destroy(id)`: Deletes a tag.
99
+
100
+ ### TicketTag
101
+ - `.add(id, tag)`: Adds a tag to a ticket.
102
+ - `.remove(id, tag)`: Removes a tag from a ticket.
103
+
104
+ ### KnowledgeBases
105
+ - `.init()`: Returns the entire knowledge base structure.
106
+ - `.manage(id, settings)`: Updates knowledge base settings.
107
+ - `.show_permissions(id)`: Returns permissions for a knowledge base.
108
+ - `.change_permissions(id, permissions)`: Updates permissions.
109
+ - `.reorder_sub_categories(id, category_id, params)`: Reorders sub-categories.
110
+ - `.reorder_root_categories(id, params)`: Reorders root categories.
111
+
112
+ ### KnowledgeBasesAnswers
113
+ - `.find_answer(knowledge_base_id, answer_id)`: Retrieves a specific answer.
114
+ - `.create(params)`: Creates a new answer (requires `knowledge_base_id` in params).
115
+ - `.update(id, params)`: Updates an answer (requires `answer_id` in params).
116
+ - `.destroy_answer(knowledge_base_id, answer_id)`: Deletes an answer.
117
+ - `.change_answer_visibility(knowledge_base_id, answer_id, visibility)`: Updates answer visibility.
118
+ - `.add_attachment(knowledge_base_id, answer_id, attachment)`: Uploads an attachment.
119
+ - `.delete_attachment(knowledge_base_id, answer_id, attachment_id)`: Removes an attachment.
120
+
121
+ ### KnowledgeBasesCategories
122
+ - `.find_category(knowledge_base_id, category_id)`: Retrieves a specific category.
123
+ - `.create(params)`: Creates a new category (requires `knowledge_base_id` in params).
124
+ - `.update(id, params)`: Updates a category (requires `category_id` in params).
125
+ - `.destroy_category(knowledge_base_id, category_id)`: Deletes a category.
126
+ - `.show_permissions(knowledge_base_id, category_id)`: Returns category permissions.
127
+ - `.change_permissions(knowledge_base_id, category_id, permissions)`: Updates permissions.
128
+ - `.reorder_answers(knowledge_base_id, category_id, params)`: Reorders answers.
129
+
130
+ ## On Behalf Of
131
+
132
+ You can set the `on_behalf_of` attribute to perform actions on behalf of another user:
133
+
134
+ ```python
135
+ client.on_behalf_of = 'user@example.com'
136
+ ```
137
+
138
+ Or use the context manager:
139
+
140
+ ```python
141
+ with client.request_on_behalf_of('user@example.com'):
142
+ client.ticket.create(params=params)
143
+ ```
144
+
145
+ ## Contributing
146
+
147
+ The Zammad API Client (zammad_py) welcomes contributions.
148
+
149
+ You can contribute by reporting bugs, fixing bugs, implementing new features, writing documentation, and submitting feedback.
150
+
151
+ To get started, see the contributing section in the docs!
152
+
153
+ Please ensure that your changes include tests and updated documentation if necessary.
154
+
155
+ ## Credits
156
+
157
+ This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [audreyr/cookiecutter-pypackage](https://github.com/audreyr/cookiecutter-pypackage) project template.
@@ -1,7 +1,7 @@
1
1
  [tool.poetry]
2
2
  name = "zammad_py"
3
- version = "3.2.0"
4
- readme = "README.rst"
3
+ version = "3.2.1"
4
+ readme = "README.md"
5
5
  description = "Python API client for zammad"
6
6
  authors = ["Joe Paul <joeirimpan@gmail.com>"]
7
7
  license = "MIT"
@@ -24,11 +24,14 @@ requests = "^2.25.1"
24
24
  [tool.poetry.group.dev.dependencies]
25
25
  pytest = "^8.0.0"
26
26
  vcrpy = "^5.1.0"
27
- flake8 = "7.2.0"
28
- black = "24.1.1"
29
- isort = "5.13.2"
27
+ flake8 = "7.3.0"
28
+ black = "25.1.0"
29
+ isort = "6.1.0"
30
30
  pytest-vcr = "^1.0.2"
31
31
 
32
+ [tool.isort]
33
+ profile = "black"
34
+
32
35
  [tool.mypy]
33
36
  files = "zammad_py"
34
37
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  __author__ = """Joe Paul"""
4
4
  __email__ = "joeirimpan@gmail.com"
5
- __version__ = "3.2.0"
5
+ __version__ = "3.2.1"
6
6
 
7
7
  from .api import ZammadAPI # noqa: F401