|
1 | | -from mpt_api_client.http.mixins import ( |
2 | | - AsyncCreateFileMixin, |
3 | | - AsyncDownloadFileMixin, |
4 | | - CreateFileMixin, |
5 | | - DownloadFileMixin, |
6 | | -) |
7 | 1 | from mpt_api_client.models import ResourceData |
8 | 2 |
|
9 | 3 |
|
10 | | -# TODO: Consider moving publishable and activatable mixins to http/mixins |
11 | 4 | class PublishableMixin[Model]: |
12 | 5 | """Publishable mixin adds the ability to review, publish and unpublish.""" |
13 | 6 |
|
@@ -80,89 +73,3 @@ async def unpublish(self, resource_id: str, resource_data: ResourceData | None = |
80 | 73 | return await self._resource_action( # type: ignore[attr-defined, no-any-return] |
81 | 74 | resource_id, "POST", "unpublish", json=resource_data |
82 | 75 | ) |
83 | | - |
84 | | - |
85 | | -class AsyncDocumentMixin[Model]( |
86 | | - AsyncCreateFileMixin[Model], |
87 | | - AsyncDownloadFileMixin[Model], |
88 | | - AsyncPublishableMixin[Model], |
89 | | -): |
90 | | - """Async document mixin.""" |
91 | | - |
92 | | - |
93 | | -class DocumentMixin[Model]( |
94 | | - CreateFileMixin[Model], |
95 | | - DownloadFileMixin[Model], |
96 | | - PublishableMixin[Model], |
97 | | -): |
98 | | - """Document mixin.""" |
99 | | - |
100 | | - |
101 | | -class MediaMixin[Model]( |
102 | | - CreateFileMixin[Model], |
103 | | - DownloadFileMixin[Model], |
104 | | - PublishableMixin[Model], |
105 | | -): |
106 | | - """Media mixin.""" |
107 | | - |
108 | | - |
109 | | -class ActivatableMixin[Model]: |
110 | | - """Activatable mixin adds the ability to activate and deactivate.""" |
111 | | - |
112 | | - def activate(self, resource_id: str, resource_data: ResourceData | None = None) -> Model: |
113 | | - """Update state to Active. |
114 | | -
|
115 | | - Args: |
116 | | - resource_id: Resource ID |
117 | | - resource_data: Resource data will be updated |
118 | | - """ |
119 | | - return self._resource_action( # type: ignore[attr-defined, no-any-return] |
120 | | - resource_id, "POST", "activate", json=resource_data |
121 | | - ) |
122 | | - |
123 | | - def deactivate(self, resource_id: str, resource_data: ResourceData | None = None) -> Model: |
124 | | - """Update state to Inactive. |
125 | | -
|
126 | | - Args: |
127 | | - resource_id: Resource ID |
128 | | - resource_data: Resource data will be updated |
129 | | - """ |
130 | | - return self._resource_action( # type: ignore[attr-defined, no-any-return] |
131 | | - resource_id, "POST", "deactivate", json=resource_data |
132 | | - ) |
133 | | - |
134 | | - |
135 | | -class AsyncActivatableMixin[Model]: |
136 | | - """Activatable mixin adds the ability to activate and deactivate.""" |
137 | | - |
138 | | - async def activate(self, resource_id: str, resource_data: ResourceData | None = None) -> Model: |
139 | | - """Update state to Active. |
140 | | -
|
141 | | - Args: |
142 | | - resource_id: Resource ID |
143 | | - resource_data: Resource data will be updated |
144 | | - """ |
145 | | - return await self._resource_action( # type: ignore[attr-defined, no-any-return] |
146 | | - resource_id, "POST", "activate", json=resource_data |
147 | | - ) |
148 | | - |
149 | | - async def deactivate( |
150 | | - self, resource_id: str, resource_data: ResourceData | None = None |
151 | | - ) -> Model: |
152 | | - """Update state to Inactive. |
153 | | -
|
154 | | - Args: |
155 | | - resource_id: Resource ID |
156 | | - resource_data: Resource data will be updated |
157 | | - """ |
158 | | - return await self._resource_action( # type: ignore[attr-defined, no-any-return] |
159 | | - resource_id, "POST", "deactivate", json=resource_data |
160 | | - ) |
161 | | - |
162 | | - |
163 | | -class AsyncMediaMixin[Model]( |
164 | | - AsyncCreateFileMixin[Model], |
165 | | - AsyncDownloadFileMixin[Model], |
166 | | - AsyncPublishableMixin[Model], |
167 | | -): |
168 | | - """Media mixin.""" |
0 commit comments