datahub-client 0.1.0__py3-none-any.whl

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.
Files changed (131) hide show
  1. Http/__init__.py +0 -0
  2. Http/authentication.py +44 -0
  3. Http/http_request.py +66 -0
  4. Http/http_response.py +40 -0
  5. Http/httpx_http_client.py +78 -0
  6. Http/ihttp_client.py +13 -0
  7. Json/__init__.py +0 -0
  8. Json/branch.py +88 -0
  9. Json/commit.py +131 -0
  10. Json/issue.py +193 -0
  11. Json/merge_request.py +185 -0
  12. Json/note.py +101 -0
  13. Json/package.py +120 -0
  14. Json/project.py +131 -0
  15. Json/repo_file.py +131 -0
  16. Json/thoth_extensions.py +51 -0
  17. Json/user.py +110 -0
  18. Models/__init__.py +0 -0
  19. Models/branch.py +76 -0
  20. Models/commit.py +108 -0
  21. Models/errors.py +123 -0
  22. Models/issue.py +155 -0
  23. Models/merge_request.py +165 -0
  24. Models/note.py +88 -0
  25. Models/package.py +98 -0
  26. Models/project.py +109 -0
  27. Models/repo_file.py +109 -0
  28. Models/user.py +87 -0
  29. Resources/__init__.py +0 -0
  30. Resources/files_api.py +130 -0
  31. Resources/issues_api.py +174 -0
  32. Resources/merge_requests_api.py +182 -0
  33. Resources/packages_api.py +86 -0
  34. Resources/projects_api.py +66 -0
  35. Resources/repository_api.py +81 -0
  36. Resources/resource_helpers.py +134 -0
  37. __init__.py +0 -0
  38. data_hub_client.py +72 -0
  39. datahub_client-0.1.0.dist-info/METADATA +11 -0
  40. datahub_client-0.1.0.dist-info/RECORD +131 -0
  41. datahub_client-0.1.0.dist-info/WHEEL +4 -0
  42. fable_modules/fable_python/Fable.Python.fsproj +57 -0
  43. fable_modules/fable_python/cognite-sdk/CogniteSdk.fs +15 -0
  44. fable_modules/fable_python/cognite-sdk/__init__.py +0 -0
  45. fable_modules/fable_python/cognite-sdk/cognite_sdk.py +23 -0
  46. fable_modules/fable_python/fable/Testing.fs +64 -0
  47. fable_modules/fable_python/fable/Types.fs +55 -0
  48. fable_modules/fable_python/fable/__init__.py +0 -0
  49. fable_modules/fable_python/fable/testing.py +131 -0
  50. fable_modules/fable_python/fable/types.py +48 -0
  51. fable_modules/fable_python/fastapi/FastAPI.fs +702 -0
  52. fable_modules/fable_python/fastapi/__init__.py +0 -0
  53. fable_modules/fable_python/fastapi/fast_api.py +115 -0
  54. fable_modules/fable_python/flask/Flask.fs +380 -0
  55. fable_modules/fable_python/flask/__init__.py +0 -0
  56. fable_modules/fable_python/flask/flask.py +28 -0
  57. fable_modules/fable_python/jupyter/IPyWidgets.fs +39 -0
  58. fable_modules/fable_python/jupyter/IPython.fs +16 -0
  59. fable_modules/fable_python/jupyter/__init__.py +0 -0
  60. fable_modules/fable_python/jupyter/ipy_widgets.py +48 -0
  61. fable_modules/fable_python/jupyter/ipython.py +13 -0
  62. fable_modules/fable_python/pydantic/Pydantic.fs +460 -0
  63. fable_modules/fable_python/pydantic/__init__.py +0 -0
  64. fable_modules/fable_python/pydantic/pydantic.py +74 -0
  65. fable_modules/fable_python/pyproject.toml +13 -0
  66. fable_modules/fable_python/stdlib/Ast.fs +163 -0
  67. fable_modules/fable_python/stdlib/Base64.fs +69 -0
  68. fable_modules/fable_python/stdlib/Builtins.fs +363 -0
  69. fable_modules/fable_python/stdlib/Datetime.fs +324 -0
  70. fable_modules/fable_python/stdlib/Functools.fs +44 -0
  71. fable_modules/fable_python/stdlib/Heapq.fs +34 -0
  72. fable_modules/fable_python/stdlib/Html.fs +22 -0
  73. fable_modules/fable_python/stdlib/Itertools.fs +189 -0
  74. fable_modules/fable_python/stdlib/Json.fs +188 -0
  75. fable_modules/fable_python/stdlib/Logging.fs +157 -0
  76. fable_modules/fable_python/stdlib/Math.fs +261 -0
  77. fable_modules/fable_python/stdlib/Os.fs +103 -0
  78. fable_modules/fable_python/stdlib/Queue.fs +94 -0
  79. fable_modules/fable_python/stdlib/Random.fs +151 -0
  80. fable_modules/fable_python/stdlib/String.fs +73 -0
  81. fable_modules/fable_python/stdlib/Sys.fs +78 -0
  82. fable_modules/fable_python/stdlib/Threading.fs +80 -0
  83. fable_modules/fable_python/stdlib/Time.fs +46 -0
  84. fable_modules/fable_python/stdlib/TkInter.fs +58 -0
  85. fable_modules/fable_python/stdlib/Traceback.fs +25 -0
  86. fable_modules/fable_python/stdlib/__init__.py +0 -0
  87. fable_modules/fable_python/stdlib/ast.py +30 -0
  88. fable_modules/fable_python/stdlib/asyncio/Events.fs +9 -0
  89. fable_modules/fable_python/stdlib/asyncio/Futures.fs +26 -0
  90. fable_modules/fable_python/stdlib/asyncio/Tasks.fs +40 -0
  91. fable_modules/fable_python/stdlib/asyncio/__init__.py +0 -0
  92. fable_modules/fable_python/stdlib/asyncio/events.py +15 -0
  93. fable_modules/fable_python/stdlib/asyncio/futures.py +42 -0
  94. fable_modules/fable_python/stdlib/asyncio/tasks.py +28 -0
  95. fable_modules/fable_python/stdlib/base64_.py +3 -0
  96. fable_modules/fable_python/stdlib/builtins_.py +62 -0
  97. fable_modules/fable_python/stdlib/datetime_.py +7 -0
  98. fable_modules/fable_python/stdlib/functools_.py +3 -0
  99. fable_modules/fable_python/stdlib/heapq.py +3 -0
  100. fable_modules/fable_python/stdlib/html.py +3 -0
  101. fable_modules/fable_python/stdlib/itertools_.py +3 -0
  102. fable_modules/fable_python/stdlib/json.py +44 -0
  103. fable_modules/fable_python/stdlib/logging.py +3 -0
  104. fable_modules/fable_python/stdlib/math_.py +3 -0
  105. fable_modules/fable_python/stdlib/os_.py +3 -0
  106. fable_modules/fable_python/stdlib/queue_.py +3 -0
  107. fable_modules/fable_python/stdlib/random_.py +3 -0
  108. fable_modules/fable_python/stdlib/string_.py +3 -0
  109. fable_modules/fable_python/stdlib/sys_.py +60 -0
  110. fable_modules/fable_python/stdlib/threading_.py +3 -0
  111. fable_modules/fable_python/stdlib/time_.py +3 -0
  112. fable_modules/fable_python/stdlib/tk_inter.py +3 -0
  113. fable_modules/fable_python/stdlib/traceback.py +3 -0
  114. fable_modules/thoth_json_core/Decode.fs +1592 -0
  115. fable_modules/thoth_json_core/DecoderCE.fs +106 -0
  116. fable_modules/thoth_json_core/Encode.fs +380 -0
  117. fable_modules/thoth_json_core/Thoth.Json.Core.fsproj +37 -0
  118. fable_modules/thoth_json_core/Types.fs +76 -0
  119. fable_modules/thoth_json_core/__init__.py +0 -0
  120. fable_modules/thoth_json_core/decode.py +1829 -0
  121. fable_modules/thoth_json_core/decoder_ce.py +95 -0
  122. fable_modules/thoth_json_core/encode.py +349 -0
  123. fable_modules/thoth_json_core/types.py +237 -0
  124. fable_modules/thoth_json_python/Decode.fs +96 -0
  125. fable_modules/thoth_json_python/Encode.fs +73 -0
  126. fable_modules/thoth_json_python/Python.fs +10 -0
  127. fable_modules/thoth_json_python/Thoth.Json.Python.fsproj +33 -0
  128. fable_modules/thoth_json_python/__init__.py +0 -0
  129. fable_modules/thoth_json_python/decode.py +114 -0
  130. fable_modules/thoth_json_python/encode.py +76 -0
  131. fable_modules/thoth_json_python/python.py +1 -0
Http/__init__.py ADDED
File without changes
Http/authentication.py ADDED
@@ -0,0 +1,44 @@
1
+ from __future__ import annotations
2
+ from fable_library.reflection import (TypeInfo, class_type)
3
+ from fable_library.util import (UNIT, Unit)
4
+
5
+ def _expr53() -> TypeInfo:
6
+ return class_type("DataHubClient.Authentication", None, Authentication)
7
+
8
+
9
+ class Authentication:
10
+ def __init__(self, header: str, value: str) -> None:
11
+ self.header: str = header
12
+ self.value: str = value
13
+
14
+ @property
15
+ def Header(self, __unit: Unit=UNIT) -> str:
16
+ _: Authentication = self
17
+ return _.header
18
+
19
+ @property
20
+ def Value(self, __unit: Unit=UNIT) -> str:
21
+ _: Authentication = self
22
+ return _.value
23
+
24
+ @staticmethod
25
+ def PersonalAccessToken(token: str) -> Authentication:
26
+ return Authentication(header = "PRIVATE-TOKEN", value = token)
27
+
28
+ @staticmethod
29
+ def OAuthToken(token: str) -> Authentication:
30
+ return Authentication(header = "Authorization", value = "Bearer " + token)
31
+
32
+ @staticmethod
33
+ def JobToken(token: str) -> Authentication:
34
+ return Authentication(header = "JOB-TOKEN", value = token)
35
+
36
+
37
+ Authentication_reflection = _expr53
38
+
39
+ def Authentication__ctor_Z384F8060(header: str, value: str) -> Authentication:
40
+ return Authentication(header, value)
41
+
42
+
43
+ __all__ = ["Authentication_reflection"]
44
+
Http/http_request.py ADDED
@@ -0,0 +1,66 @@
1
+ from __future__ import annotations
2
+ from typing import cast
3
+ from fable_library.list import (FSharpList, empty)
4
+ from fable_library.reflection import (TypeInfo, class_type)
5
+ from fable_library.util import (UNIT, Unit)
6
+
7
+ def _expr54() -> TypeInfo:
8
+ return class_type("DataHubClient.HttpRequest", None, HttpRequest)
9
+
10
+
11
+ class HttpRequest:
12
+ def __init__(self, url: str, method: str) -> None:
13
+ self._url: str = url
14
+ self._method: str = method
15
+ self._headers: FSharpList[tuple[str, str]] = empty()
16
+ self._body: str | None = cast(str | None, None)
17
+
18
+ @property
19
+ def Url(self, __unit: Unit=UNIT) -> str:
20
+ _: HttpRequest = self
21
+ return _._url
22
+
23
+ @Url.setter
24
+ def Url(self, value: str) -> None:
25
+ _: HttpRequest = self
26
+ _._url = value
27
+
28
+ @property
29
+ def Method(self, __unit: Unit=UNIT) -> str:
30
+ _: HttpRequest = self
31
+ return _._method
32
+
33
+ @Method.setter
34
+ def Method(self, value: str) -> None:
35
+ _: HttpRequest = self
36
+ _._method = value
37
+
38
+ @property
39
+ def Headers(self, __unit: Unit=UNIT) -> FSharpList[tuple[str, str]]:
40
+ _: HttpRequest = self
41
+ return _._headers
42
+
43
+ @Headers.setter
44
+ def Headers(self, value: FSharpList[tuple[str, str]]) -> None:
45
+ _: HttpRequest = self
46
+ _._headers = value
47
+
48
+ @property
49
+ def Body(self, __unit: Unit=UNIT) -> str | None:
50
+ _: HttpRequest = self
51
+ return _._body
52
+
53
+ @Body.setter
54
+ def Body(self, value: str | None=None) -> None:
55
+ _: HttpRequest = self
56
+ _._body = value
57
+
58
+
59
+ HttpRequest_reflection = _expr54
60
+
61
+ def HttpRequest__ctor_Z384F8060(url: str, method: str) -> HttpRequest:
62
+ return HttpRequest(url, method)
63
+
64
+
65
+ __all__ = ["HttpRequest_reflection"]
66
+
Http/http_response.py ADDED
@@ -0,0 +1,40 @@
1
+ from __future__ import annotations
2
+ from fable_library.core import int32
3
+ from fable_library.list import FSharpList
4
+ from fable_library.reflection import (TypeInfo, class_type)
5
+ from fable_library.util import (UNIT, Unit)
6
+
7
+ def _expr51() -> TypeInfo:
8
+ return class_type("DataHubClient.HttpResponse", None, HttpResponse)
9
+
10
+
11
+ class HttpResponse:
12
+ def __init__(self, status_code: int32, body: str, headers: FSharpList[tuple[str, str]]) -> None:
13
+ self.status_code: int32 = status_code
14
+ self.body: str = body
15
+ self.headers: FSharpList[tuple[str, str]] = headers
16
+
17
+ @property
18
+ def StatusCode(self, __unit: Unit=UNIT) -> int32:
19
+ _: HttpResponse = self
20
+ return _.status_code
21
+
22
+ @property
23
+ def Body(self, __unit: Unit=UNIT) -> str:
24
+ _: HttpResponse = self
25
+ return _.body
26
+
27
+ @property
28
+ def Headers(self, __unit: Unit=UNIT) -> FSharpList[tuple[str, str]]:
29
+ _: HttpResponse = self
30
+ return _.headers
31
+
32
+
33
+ HttpResponse_reflection = _expr51
34
+
35
+ def HttpResponse__ctor_54FCE56A(status_code: int32, body: str, headers: FSharpList[tuple[str, str]]) -> HttpResponse:
36
+ return HttpResponse(status_code, body, headers)
37
+
38
+
39
+ __all__ = ["HttpResponse_reflection"]
40
+
@@ -0,0 +1,78 @@
1
+ from __future__ import annotations
2
+ from abc import abstractmethod
3
+ from typing import (Protocol, Any, cast)
4
+ from fable_library.async_ import await_task
5
+ from fable_library.async_builder import (singleton, Async)
6
+ from fable_library.core import int32
7
+ from fable_library.list import FSharpList
8
+ from fable_library.protocols import IEnumerable_1
9
+ from fable_library.reflection import (TypeInfo, class_type)
10
+ from fable_library.resize_array import of_seq
11
+ from fable_library.seq import (to_list, delay, collect, singleton as singleton_1)
12
+ from fable_library.util import (UNIT, Unit)
13
+ from .http_request import HttpRequest
14
+ from .http_response import HttpResponse
15
+
16
+ class HttpxResponse(Protocol):
17
+ @property
18
+ @abstractmethod
19
+ def status_code(self, /) -> int32:
20
+ ...
21
+
22
+ @property
23
+ @abstractmethod
24
+ def text(self, /) -> str:
25
+ ...
26
+
27
+
28
+ class HttpxAsyncClient(Protocol):
29
+ pass
30
+
31
+ def _expr510() -> TypeInfo:
32
+ return class_type("DataHubClient.HttpxHttpClient", None, HttpxHttpClient)
33
+
34
+
35
+ class HttpxHttpClient:
36
+ def __init__(self, __unit: Unit=UNIT) -> None:
37
+ pass
38
+
39
+ def SendAsync(self, request: HttpRequest) -> Async[HttpResponse]:
40
+ def _arrow509(__unit: Unit=UNIT) -> Async[HttpResponse]:
41
+ client: HttpxAsyncClient = __import__('httpx').AsyncClient()
42
+ def _arrow504(__unit: Unit=UNIT) -> IEnumerable_1[tuple[str, str]]:
43
+ def _arrow503(match_value: tuple[str, str]) -> IEnumerable_1[tuple[str, str]]:
44
+ return singleton_1((match_value[0], match_value[1]))
45
+
46
+ return collect(_arrow503, request.Headers)
47
+
48
+ headers: Any = of_seq(to_list(delay(_arrow504)))
49
+ content: Any
50
+ match_value_1: str | None = request.Body
51
+ content = cast(Any, None) if (match_value_1 is None) else match_value_1
52
+ def _arrow508(_arg: HttpxResponse) -> Async[HttpResponse]:
53
+ response: HttpxResponse = _arg
54
+ def _arrow507(__unit: Unit=UNIT) -> Async[HttpResponse]:
55
+ def _arrow506(__unit: Unit=UNIT) -> IEnumerable_1[tuple[str, str]]:
56
+ def _arrow505(match_value_2: tuple[str, str]) -> IEnumerable_1[tuple[str, str]]:
57
+ return singleton_1((match_value_2[0], match_value_2[1]))
58
+
59
+ return collect(_arrow505, list(response.headers.items()))
60
+
61
+ collected: FSharpList[tuple[str, str]] = to_list(delay(_arrow506))
62
+ return singleton.Return(HttpResponse(status_code = response.status_code, body = response.text, headers = collected))
63
+
64
+ return singleton.Bind(await_task(client.aclose()), _arrow507)
65
+
66
+ return singleton.Bind(await_task(client.request(request.Method, request.Url, headers=headers, content=content)), _arrow508)
67
+
68
+ return singleton.Delay(_arrow509)
69
+
70
+
71
+ HttpxHttpClient_reflection = _expr510
72
+
73
+ def HttpxHttpClient__ctor(__unit: Unit=UNIT) -> HttpxHttpClient:
74
+ return HttpxHttpClient(__unit)
75
+
76
+
77
+ __all__ = ["HttpxHttpClient_reflection"]
78
+
Http/ihttp_client.py ADDED
@@ -0,0 +1,13 @@
1
+ from __future__ import annotations
2
+ from abc import abstractmethod
3
+ from typing import Protocol
4
+ from fable_library.async_builder import Async
5
+ from .http_request import HttpRequest
6
+ from .http_response import HttpResponse
7
+
8
+ class IHttpClient(Protocol):
9
+ @abstractmethod
10
+ def SendAsync(self, request: HttpRequest, /) -> Async[HttpResponse]:
11
+ ...
12
+
13
+
Json/__init__.py ADDED
File without changes
Json/branch.py ADDED
@@ -0,0 +1,88 @@
1
+ """JSON encoder and decoder for <see cref="T:DataHubClient.Branch"/>.
2
+ """
3
+ from __future__ import annotations
4
+ from typing import Any
5
+ from fable_library.protocols import IEnumerable_1
6
+ from fable_library.seq import map
7
+ from fable_library.util import (UNIT, Unit, to_enumerable)
8
+ from ..fable_modules.thoth_json_core.decode import (object, IRequiredGetter, string, bool_1, IGetters)
9
+ from ..fable_modules.thoth_json_core.types import (Decoder_1, IEncodable, IEncoderHelpers_1)
10
+ from ..Models.branch import Branch
11
+ from ..Models.commit import Commit
12
+ from .commit import (decoder as decoder_1, encoder as encoder_1)
13
+
14
+ def _arrow131(get: IGetters) -> Branch:
15
+ def _arrow124(__unit: Unit=UNIT) -> str:
16
+ object_arg: IRequiredGetter = get.Required
17
+ return object_arg.Field("name", string)
18
+
19
+ def _arrow126(__unit: Unit=UNIT) -> bool:
20
+ object_arg_1: IRequiredGetter = get.Required
21
+ return object_arg_1.Field("default", bool_1)
22
+
23
+ def _arrow128(__unit: Unit=UNIT) -> bool:
24
+ object_arg_2: IRequiredGetter = get.Required
25
+ return object_arg_2.Field("protected", bool_1)
26
+
27
+ def _arrow129(__unit: Unit=UNIT) -> bool:
28
+ object_arg_3: IRequiredGetter = get.Required
29
+ return object_arg_3.Field("merged", bool_1)
30
+
31
+ def _arrow130(__unit: Unit=UNIT) -> Commit:
32
+ object_arg_4: IRequiredGetter = get.Required
33
+ return object_arg_4.Field("commit", decoder_1)
34
+
35
+ return Branch(name = _arrow124(), is_default = _arrow126(), is_protected = _arrow128(), merged = _arrow129(), commit = _arrow130())
36
+
37
+
38
+ decoder: Decoder_1[Branch] = object(_arrow131)
39
+
40
+ def encoder(branch: Branch) -> IEncodable:
41
+ """Encodes a <see cref="T:DataHubClient.Branch"/> to its GitLab JSON representation.
42
+ """
43
+ def _arrow137(branch: Any=branch) -> IEncodable:
44
+ value: str = branch.Name
45
+ class ObjectExpr136(IEncodable):
46
+ def Encode[_A](self, helpers: IEncoderHelpers_1[_A]) -> _A:
47
+ return helpers.encode_string(value)
48
+
49
+ return ObjectExpr136()
50
+
51
+ def _arrow141(branch: Any=branch) -> IEncodable:
52
+ value_1: bool = branch.Default
53
+ class ObjectExpr140(IEncodable):
54
+ def Encode[_A](self, helpers_1: IEncoderHelpers_1[_A]) -> _A:
55
+ return helpers_1.encode_bool(value_1)
56
+
57
+ return ObjectExpr140()
58
+
59
+ def _arrow143(branch: Any=branch) -> IEncodable:
60
+ value_2: bool = branch.Protected
61
+ class ObjectExpr142(IEncodable):
62
+ def Encode[_A](self, helpers_2: IEncoderHelpers_1[_A]) -> _A:
63
+ return helpers_2.encode_bool(value_2)
64
+
65
+ return ObjectExpr142()
66
+
67
+ def _arrow147(branch: Any=branch) -> IEncodable:
68
+ value_3: bool = branch.Merged
69
+ class ObjectExpr146(IEncodable):
70
+ def Encode[_A](self, helpers_3: IEncoderHelpers_1[_A]) -> _A:
71
+ return helpers_3.encode_bool(value_3)
72
+
73
+ return ObjectExpr146()
74
+
75
+ values: IEnumerable_1[tuple[str, IEncodable]] = to_enumerable([("name", _arrow137()), ("default", _arrow141()), ("protected", _arrow143()), ("merged", _arrow147()), ("commit", encoder_1(branch.Commit))])
76
+ class ObjectExpr154(IEncodable):
77
+ def Encode[_A](self, helpers_4: IEncoderHelpers_1[_A]) -> _A:
78
+ def mapping(tupled_arg: tuple[str, IEncodable]) -> tuple[str, _A]:
79
+ return (tupled_arg[0], tupled_arg[1].Encode(helpers_4))
80
+
81
+ arg: IEnumerable_1[tuple[str, Any]] = map(mapping, values)
82
+ return helpers_4.encode_object(arg)
83
+
84
+ return ObjectExpr154()
85
+
86
+
87
+ __all__ = ["decoder", "encoder"]
88
+
Json/commit.py ADDED
@@ -0,0 +1,131 @@
1
+ """JSON encoder and decoder for <see cref="T:DataHubClient.Commit"/>.
2
+ """
3
+ from __future__ import annotations
4
+ from typing import Any
5
+ from fable_library.option import erase
6
+ from fable_library.protocols import IEnumerable_1
7
+ from fable_library.seq import map
8
+ from fable_library.util import (UNIT, Unit, to_enumerable)
9
+ from ..fable_modules.thoth_json_core.decode import (object, IRequiredGetter, string, IOptionalGetter, IGetters)
10
+ from ..fable_modules.thoth_json_core.types import (Decoder_1, IEncodable, IEncoderHelpers_1)
11
+ from ..Models.commit import Commit
12
+ from .thoth_extensions import encode_option
13
+
14
+ def _arrow127(get: IGetters) -> Commit:
15
+ def _arrow117(__unit: Unit=UNIT) -> str:
16
+ object_arg: IRequiredGetter = get.Required
17
+ return object_arg.Field("id", string)
18
+
19
+ def _arrow118(__unit: Unit=UNIT) -> str:
20
+ object_arg_1: IRequiredGetter = get.Required
21
+ return object_arg_1.Field("short_id", string)
22
+
23
+ def _arrow119(__unit: Unit=UNIT) -> str:
24
+ object_arg_2: IRequiredGetter = get.Required
25
+ return object_arg_2.Field("title", string)
26
+
27
+ def _arrow120(__unit: Unit=UNIT) -> str:
28
+ object_arg_3: IRequiredGetter = get.Required
29
+ return object_arg_3.Field("message", string)
30
+
31
+ def _arrow121(__unit: Unit=UNIT) -> str:
32
+ object_arg_4: IRequiredGetter = get.Required
33
+ return object_arg_4.Field("author_name", string)
34
+
35
+ def _arrow122(__unit: Unit=UNIT) -> str:
36
+ object_arg_5: IRequiredGetter = get.Required
37
+ return object_arg_5.Field("author_email", string)
38
+
39
+ def _arrow123(__unit: Unit=UNIT) -> str:
40
+ object_arg_6: IRequiredGetter = get.Required
41
+ return object_arg_6.Field("created_at", string)
42
+
43
+ def _arrow125(__unit: Unit=UNIT) -> str | None:
44
+ object_arg_7: IOptionalGetter = get.Optional
45
+ return erase(object_arg_7.Field("web_url", string))
46
+
47
+ return Commit(id = _arrow117(), short_id = _arrow118(), title = _arrow119(), message = _arrow120(), author_name = _arrow121(), author_email = _arrow122(), created_at = _arrow123(), web_url = _arrow125())
48
+
49
+
50
+ decoder: Decoder_1[Commit] = object(_arrow127)
51
+
52
+ def encoder(commit: Commit) -> IEncodable:
53
+ """Encodes a <see cref="T:DataHubClient.Commit"/> to its GitLab JSON representation.
54
+ """
55
+ def _arrow133(commit: Any=commit) -> IEncodable:
56
+ value: str = commit.Id
57
+ class ObjectExpr132(IEncodable):
58
+ def Encode[_A](self, helpers: IEncoderHelpers_1[_A]) -> _A:
59
+ return helpers.encode_string(value)
60
+
61
+ return ObjectExpr132()
62
+
63
+ def _arrow135(commit: Any=commit) -> IEncodable:
64
+ value_1: str = commit.ShortId
65
+ class ObjectExpr134(IEncodable):
66
+ def Encode[_A](self, helpers_1: IEncoderHelpers_1[_A]) -> _A:
67
+ return helpers_1.encode_string(value_1)
68
+
69
+ return ObjectExpr134()
70
+
71
+ def _arrow139(commit: Any=commit) -> IEncodable:
72
+ value_2: str = commit.Title
73
+ class ObjectExpr138(IEncodable):
74
+ def Encode[_A](self, helpers_2: IEncoderHelpers_1[_A]) -> _A:
75
+ return helpers_2.encode_string(value_2)
76
+
77
+ return ObjectExpr138()
78
+
79
+ def _arrow145(commit: Any=commit) -> IEncodable:
80
+ value_3: str = commit.Message
81
+ class ObjectExpr144(IEncodable):
82
+ def Encode[_A](self, helpers_3: IEncoderHelpers_1[_A]) -> _A:
83
+ return helpers_3.encode_string(value_3)
84
+
85
+ return ObjectExpr144()
86
+
87
+ def _arrow149(commit: Any=commit) -> IEncodable:
88
+ value_4: str = commit.AuthorName
89
+ class ObjectExpr148(IEncodable):
90
+ def Encode[_A](self, helpers_4: IEncoderHelpers_1[_A]) -> _A:
91
+ return helpers_4.encode_string(value_4)
92
+
93
+ return ObjectExpr148()
94
+
95
+ def _arrow151(commit: Any=commit) -> IEncodable:
96
+ value_5: str = commit.AuthorEmail
97
+ class ObjectExpr150(IEncodable):
98
+ def Encode[_A](self, helpers_5: IEncoderHelpers_1[_A]) -> _A:
99
+ return helpers_5.encode_string(value_5)
100
+
101
+ return ObjectExpr150()
102
+
103
+ def _arrow153(commit: Any=commit) -> IEncodable:
104
+ value_6: str = commit.CreatedAt
105
+ class ObjectExpr152(IEncodable):
106
+ def Encode[_A](self, helpers_6: IEncoderHelpers_1[_A]) -> _A:
107
+ return helpers_6.encode_string(value_6)
108
+
109
+ return ObjectExpr152()
110
+
111
+ def _arrow156(value_7: str) -> IEncodable:
112
+ class ObjectExpr155(IEncodable):
113
+ def Encode[_A](self, helpers_7: IEncoderHelpers_1[_A]) -> _A:
114
+ return helpers_7.encode_string(value_7)
115
+
116
+ return ObjectExpr155()
117
+
118
+ values: IEnumerable_1[tuple[str, IEncodable]] = to_enumerable([("id", _arrow133()), ("short_id", _arrow135()), ("title", _arrow139()), ("message", _arrow145()), ("author_name", _arrow149()), ("author_email", _arrow151()), ("created_at", _arrow153()), ("web_url", encode_option(_arrow156, commit.WebUrl))])
119
+ class ObjectExpr157(IEncodable):
120
+ def Encode[_A](self, helpers_8: IEncoderHelpers_1[_A]) -> _A:
121
+ def mapping(tupled_arg: tuple[str, IEncodable]) -> tuple[str, _A]:
122
+ return (tupled_arg[0], tupled_arg[1].Encode(helpers_8))
123
+
124
+ arg: IEnumerable_1[tuple[str, Any]] = map(mapping, values)
125
+ return helpers_8.encode_object(arg)
126
+
127
+ return ObjectExpr157()
128
+
129
+
130
+ __all__ = ["decoder", "encoder"]
131
+
Json/issue.py ADDED
@@ -0,0 +1,193 @@
1
+ """JSON encoder and decoder for <see cref="T:DataHubClient.Issue"/>.
2
+ """
3
+ from __future__ import annotations
4
+ from typing import Any
5
+ from fable_library.array_ import map
6
+ from fable_library.array_ import Array
7
+ from fable_library.core import int32
8
+ from fable_library.option import erase
9
+ from fable_library.protocols import IEnumerable_1
10
+ from fable_library.seq import map as map_1
11
+ from fable_library.util import (UNIT, Unit, to_enumerable)
12
+ from ..fable_modules.thoth_json_core.decode import (object, IRequiredGetter, int_1, string, array as array_2, IOptionalGetter, IGetters)
13
+ from ..fable_modules.thoth_json_core.types import (Decoder_1, IEncodable, IEncoderHelpers_1)
14
+ from ..Models.issue import Issue
15
+ from ..Models.user import User
16
+ from .thoth_extensions import encode_option
17
+ from .user import (decoder as decoder_1, encoder as encoder_1)
18
+
19
+ def _arrow271(get: IGetters) -> Issue:
20
+ def _arrow257(__unit: Unit=UNIT) -> int32:
21
+ object_arg: IRequiredGetter = get.Required
22
+ return object_arg.Field("id", int_1)
23
+
24
+ def _arrow258(__unit: Unit=UNIT) -> int32:
25
+ object_arg_1: IRequiredGetter = get.Required
26
+ return object_arg_1.Field("iid", int_1)
27
+
28
+ def _arrow260(__unit: Unit=UNIT) -> int32:
29
+ object_arg_2: IRequiredGetter = get.Required
30
+ return object_arg_2.Field("project_id", int_1)
31
+
32
+ def _arrow261(__unit: Unit=UNIT) -> str:
33
+ object_arg_3: IRequiredGetter = get.Required
34
+ return object_arg_3.Field("title", string)
35
+
36
+ def _arrow262(__unit: Unit=UNIT) -> str:
37
+ object_arg_4: IRequiredGetter = get.Required
38
+ return object_arg_4.Field("state", string)
39
+
40
+ def _arrow263(__unit: Unit=UNIT) -> User:
41
+ object_arg_5: IRequiredGetter = get.Required
42
+ return object_arg_5.Field("author", decoder_1)
43
+
44
+ def _arrow264(__unit: Unit=UNIT) -> Array[User]:
45
+ arg_13: Decoder_1[Array[User]] = array_2(decoder_1)
46
+ object_arg_6: IRequiredGetter = get.Required
47
+ return object_arg_6.Field("assignees", arg_13)
48
+
49
+ def _arrow266(__unit: Unit=UNIT) -> Array[str]:
50
+ arg_15: Decoder_1[Array[str]] = array_2(string)
51
+ object_arg_7: IRequiredGetter = get.Required
52
+ return object_arg_7.Field("labels", arg_15)
53
+
54
+ def _arrow267(__unit: Unit=UNIT) -> str:
55
+ object_arg_8: IRequiredGetter = get.Required
56
+ return object_arg_8.Field("web_url", string)
57
+
58
+ def _arrow268(__unit: Unit=UNIT) -> str:
59
+ object_arg_9: IRequiredGetter = get.Required
60
+ return object_arg_9.Field("created_at", string)
61
+
62
+ def _arrow269(__unit: Unit=UNIT) -> str:
63
+ object_arg_10: IRequiredGetter = get.Required
64
+ return object_arg_10.Field("updated_at", string)
65
+
66
+ def _arrow270(__unit: Unit=UNIT) -> str | None:
67
+ object_arg_11: IOptionalGetter = get.Optional
68
+ return erase(object_arg_11.Field("description", string))
69
+
70
+ return Issue(id = _arrow257(), iid = _arrow258(), project_id = _arrow260(), title = _arrow261(), state = _arrow262(), author = _arrow263(), assignees = _arrow264(), labels = _arrow266(), web_url = _arrow267(), created_at = _arrow268(), updated_at = _arrow269(), description = _arrow270())
71
+
72
+
73
+ decoder: Decoder_1[Issue] = object(_arrow271)
74
+
75
+ def encoder(issue: Issue) -> IEncodable:
76
+ """Encodes an <see cref="T:DataHubClient.Issue"/> to its GitLab JSON representation.
77
+ """
78
+ def _arrow274(issue: Any=issue) -> IEncodable:
79
+ value: int32 = issue.Id
80
+ class ObjectExpr273(IEncodable):
81
+ def Encode[_A](self, helpers: IEncoderHelpers_1[_A]) -> _A:
82
+ return helpers.encode_signed_integral_number(value)
83
+
84
+ return ObjectExpr273()
85
+
86
+ def _arrow276(issue: Any=issue) -> IEncodable:
87
+ value_1: int32 = issue.Iid
88
+ class ObjectExpr275(IEncodable):
89
+ def Encode[_A](self, helpers_1: IEncoderHelpers_1[_A]) -> _A:
90
+ return helpers_1.encode_signed_integral_number(value_1)
91
+
92
+ return ObjectExpr275()
93
+
94
+ def _arrow278(issue: Any=issue) -> IEncodable:
95
+ value_2: int32 = issue.ProjectId
96
+ class ObjectExpr277(IEncodable):
97
+ def Encode[_A](self, helpers_2: IEncoderHelpers_1[_A]) -> _A:
98
+ return helpers_2.encode_signed_integral_number(value_2)
99
+
100
+ return ObjectExpr277()
101
+
102
+ def _arrow281(issue: Any=issue) -> IEncodable:
103
+ value_3: str = issue.Title
104
+ class ObjectExpr280(IEncodable):
105
+ def Encode[_A](self, helpers_3: IEncoderHelpers_1[_A]) -> _A:
106
+ return helpers_3.encode_string(value_3)
107
+
108
+ return ObjectExpr280()
109
+
110
+ def _arrow283(issue: Any=issue) -> IEncodable:
111
+ value_4: str = issue.State
112
+ class ObjectExpr282(IEncodable):
113
+ def Encode[_A](self, helpers_4: IEncoderHelpers_1[_A]) -> _A:
114
+ return helpers_4.encode_string(value_4)
115
+
116
+ return ObjectExpr282()
117
+
118
+ def _arrow286(issue: Any=issue) -> IEncodable:
119
+ values: Array[IEncodable] = map(encoder_1, issue.Assignees, None)
120
+ class ObjectExpr285(IEncodable):
121
+ def Encode[_A](self, helpers_5: IEncoderHelpers_1[_A]) -> _A:
122
+ def mapping(v: IEncodable) -> _A:
123
+ return v.Encode(helpers_5)
124
+
125
+ arg: Array[Any] = map(mapping, values, None)
126
+ return helpers_5.encode_array(arg)
127
+
128
+ return ObjectExpr285()
129
+
130
+ def _arrow290(issue: Any=issue) -> IEncodable:
131
+ def _arrow288(value_5: str) -> IEncodable:
132
+ class ObjectExpr287(IEncodable):
133
+ def Encode[_A](self, helpers_6: IEncoderHelpers_1[_A]) -> _A:
134
+ return helpers_6.encode_string(value_5)
135
+
136
+ return ObjectExpr287()
137
+
138
+ values_1: Array[IEncodable] = map(_arrow288, issue.Labels, None)
139
+ class ObjectExpr289(IEncodable):
140
+ def Encode[_A](self, helpers_7: IEncoderHelpers_1[_A]) -> _A:
141
+ def mapping_1(v_1: IEncodable) -> _A:
142
+ return v_1.Encode(helpers_7)
143
+
144
+ arg_1: Array[Any] = map(mapping_1, values_1, None)
145
+ return helpers_7.encode_array(arg_1)
146
+
147
+ return ObjectExpr289()
148
+
149
+ def _arrow294(issue: Any=issue) -> IEncodable:
150
+ value_7: str = issue.WebUrl
151
+ class ObjectExpr293(IEncodable):
152
+ def Encode[_A](self, helpers_8: IEncoderHelpers_1[_A]) -> _A:
153
+ return helpers_8.encode_string(value_7)
154
+
155
+ return ObjectExpr293()
156
+
157
+ def _arrow296(issue: Any=issue) -> IEncodable:
158
+ value_8: str = issue.CreatedAt
159
+ class ObjectExpr295(IEncodable):
160
+ def Encode[_A](self, helpers_9: IEncoderHelpers_1[_A]) -> _A:
161
+ return helpers_9.encode_string(value_8)
162
+
163
+ return ObjectExpr295()
164
+
165
+ def _arrow298(issue: Any=issue) -> IEncodable:
166
+ value_9: str = issue.UpdatedAt
167
+ class ObjectExpr297(IEncodable):
168
+ def Encode[_A](self, helpers_10: IEncoderHelpers_1[_A]) -> _A:
169
+ return helpers_10.encode_string(value_9)
170
+
171
+ return ObjectExpr297()
172
+
173
+ def _arrow302(value_10: str) -> IEncodable:
174
+ class ObjectExpr301(IEncodable):
175
+ def Encode[_A](self, helpers_11: IEncoderHelpers_1[_A]) -> _A:
176
+ return helpers_11.encode_string(value_10)
177
+
178
+ return ObjectExpr301()
179
+
180
+ values_2: IEnumerable_1[tuple[str, IEncodable]] = to_enumerable([("id", _arrow274()), ("iid", _arrow276()), ("project_id", _arrow278()), ("title", _arrow281()), ("state", _arrow283()), ("author", encoder_1(issue.Author)), ("assignees", _arrow286()), ("labels", _arrow290()), ("web_url", _arrow294()), ("created_at", _arrow296()), ("updated_at", _arrow298()), ("description", encode_option(_arrow302, issue.Description))])
181
+ class ObjectExpr303(IEncodable):
182
+ def Encode[_A](self, helpers_12: IEncoderHelpers_1[_A]) -> _A:
183
+ def mapping_2(tupled_arg: tuple[str, IEncodable]) -> tuple[str, _A]:
184
+ return (tupled_arg[0], tupled_arg[1].Encode(helpers_12))
185
+
186
+ arg_2: IEnumerable_1[tuple[str, Any]] = map_1(mapping_2, values_2)
187
+ return helpers_12.encode_object(arg_2)
188
+
189
+ return ObjectExpr303()
190
+
191
+
192
+ __all__ = ["decoder", "encoder"]
193
+