zih-models 0.1.0__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,7 @@
1
+ Copyright (c) 2025, TUD Dresden University of Technology
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the " Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,20 @@
1
+ Metadata-Version: 2.3
2
+ Name: zih-models
3
+ Version: 0.1.0
4
+ Summary: Pydantic models for ZIH services
5
+ License: MIT
6
+ Author: Ansgar Burchardt
7
+ Author-email: ansgar.burchardt@tu-dresden.de
8
+ Requires-Python: >=3.11
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Dist: pydantic (>=2.11.7,<3.0.0)
12
+ Project-URL: Repository, https://gitlab.hrz.tu-chemnitz.de/zih/sde/zih-models
13
+ Description-Content-Type: text/markdown
14
+
15
+ <!-- SPDX-License-Identifier: MIT -->
16
+
17
+ # zih-models
18
+
19
+ Pydantic models for ZIH services
20
+
@@ -0,0 +1,5 @@
1
+ <!-- SPDX-License-Identifier: MIT -->
2
+
3
+ # zih-models
4
+
5
+ Pydantic models for ZIH services
@@ -0,0 +1,46 @@
1
+ [project]
2
+ name = "zih-models"
3
+ version = "0.1.0"
4
+ description = "Pydantic models for ZIH services"
5
+ authors = [
6
+ {name = "Ansgar Burchardt",email = "ansgar.burchardt@tu-dresden.de"}
7
+ ]
8
+ license = {text = "MIT"}
9
+ readme = "README.md"
10
+ classifiers = [
11
+ "Programming Language :: Python :: 3",
12
+ "Operating System :: OS Independent",
13
+ ]
14
+ requires-python = ">=3.11"
15
+ dependencies = [
16
+ "pydantic (>=2.11.7,<3.0.0)"
17
+ ]
18
+
19
+ [project.urls]
20
+ repository = "https://gitlab.hrz.tu-chemnitz.de/zih/sde/zih-models"
21
+
22
+ [tool.poetry]
23
+
24
+ [tool.poetry.group.dev.dependencies]
25
+ mypy = "^1.17.0"
26
+ ruff = "^0.12.3"
27
+ isort = "^6.0.1"
28
+ black = "^25.1.0"
29
+ pytest = "^8.4.1"
30
+
31
+ [tool.black]
32
+ line-length = 79
33
+
34
+ [tool.isort]
35
+ profile = "black"
36
+
37
+ [tool.mypy]
38
+ strict = true
39
+ packages = ["zih_models"]
40
+ plugins = ["pydantic.mypy"]
41
+ check_untyped_defs = true
42
+ enable_error_code = "explicit-override"
43
+
44
+ [build-system]
45
+ requires = ["poetry-core>=2.0.0,<3.0.0"]
46
+ build-backend = "poetry.core.masonry.api"
File without changes
File without changes
@@ -0,0 +1,86 @@
1
+ # SPDX-License-Identifier: MIT
2
+
3
+ """models for the sharepoint api"""
4
+
5
+ from enum import IntEnum, StrEnum
6
+ from typing import Annotated, Literal
7
+
8
+ from pydantic import BaseModel, Field
9
+
10
+
11
+ class SharepointNotFoundError(BaseModel):
12
+ """Return of the api if target not found"""
13
+
14
+ detail: Literal["Not Found"] = "Not Found"
15
+
16
+
17
+ class SiteType(StrEnum):
18
+ """possible types of a site"""
19
+
20
+ DEFAULT = "default"
21
+ PROJECT = "project"
22
+
23
+
24
+ class Site(BaseModel):
25
+ """Sharepoint Site"""
26
+
27
+ SiteUrl: str
28
+ SiteId: str
29
+ Admin1: str | None = None
30
+ Admin2: str | None = None
31
+
32
+
33
+ class Language(StrEnum):
34
+ """site language"""
35
+
36
+ GERMAN = "de"
37
+ ENGLISH = "en"
38
+
39
+
40
+ class SharepointLanguageCodes(IntEnum):
41
+ """sharepoint language codes"""
42
+
43
+ GERMAN = 1031
44
+ ENGLISH = 1033
45
+
46
+
47
+ LanguageMapper = {
48
+ Language.GERMAN: SharepointLanguageCodes.GERMAN,
49
+ Language.ENGLISH: SharepointLanguageCodes.ENGLISH,
50
+ }
51
+
52
+ LanguageMapperLogList = {
53
+ Language.GERMAN: "Deutsch (Deutschland)",
54
+ Language.ENGLISH: "Englisch (USA)",
55
+ }
56
+
57
+
58
+ class PrivacyLevel(StrEnum):
59
+ """privacy level of site"""
60
+
61
+ NORMAL = "normal"
62
+ HIGH = "high"
63
+
64
+
65
+ class User(BaseModel):
66
+ """User Object with all Infos Sharepoint needs"""
67
+
68
+ login: str
69
+ mail: str
70
+
71
+
72
+ class CreateSiteData(BaseModel):
73
+ """Sharepoint Site data which is used to create a new Site"""
74
+
75
+ applicant: User
76
+ head: User
77
+ it_referent: User
78
+ ticket_number: str
79
+ org_id: str
80
+ site_name: str
81
+ url_name: Annotated[str, Field(max_length=10)]
82
+ site_type: SiteType
83
+ purpose: str
84
+ site_language: Language
85
+ privacy_level: PrivacyLevel
86
+ admins: Annotated[list[User], Field(min_length=2, max_length=2)]