fluidattacks_gitlab_sdk 3.0.0__tar.gz → 3.0.2__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.
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/PKG-INFO +3 -3
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/__init__.py +1 -1
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_gql_client/_handlers.py +1 -1
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/_client/_get_issue.py +17 -15
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/_client/_most_recent.py +14 -12
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/_client/_updated_by.py +27 -21
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/jobs/_client.py +17 -15
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/jobs/_decode.py +17 -13
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/merge_requests/_client.py +65 -57
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/merge_requests/_decode.py +3 -3
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/milestones/_client.py +37 -33
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/mr_approvals/_client.py +13 -11
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/mr_approvals/_decode.py +7 -5
- fluidattacks_gitlab_sdk-3.0.2/fluidattacks_gitlab_sdk/users/decode.py +31 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/pyproject.toml +10 -3
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/ruff.toml +21 -9
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/members/test_client_members.py +1 -1
- fluidattacks_gitlab_sdk-3.0.2/uv.lock +1516 -0
- fluidattacks_gitlab_sdk-3.0.0/fluidattacks_gitlab_sdk/users/decode.py +0 -25
- fluidattacks_gitlab_sdk-3.0.0/uv.lock +0 -1627
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/.envrc +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/build/default.nix +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/build/filter.nix +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/flake.lock +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/flake.nix +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_decoders.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_gql_client/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_gql_client/_client.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_gql_client/_error.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_handlers.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_http_client/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_http_client/_client_1.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_http_client/_core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/_logger.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/ids.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/_client/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/_client/_decode.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/issues/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/jobs/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/jobs/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/members/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/members/_client.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/members/_decode.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/members/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/merge_requests/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/merge_requests/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/milestones/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/milestones/_decode.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/milestones/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/mr_approvals/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/mr_approvals/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/py.typed +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/users/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/fluidattacks_gitlab_sdk/users/core.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/mypy.ini +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/arch/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/arch/arch.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/arch/test_arch.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/issues/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/issues/data.json +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/issues/test_decode.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/jobs/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/jobs/data.json +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/jobs/test_decode_job.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/members/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/members/data.json +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/members/test_decode_members.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/merge_request/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/merge_request/data.json +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/merge_request/data_mr_updates.json +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/merge_request/test_decode.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/mr_approvals/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/mr_approvals/data.json +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/mr_approvals/decoder_test.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests/py.typed +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/_utils.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/issues/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/issues/test_issue_client.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/jobs/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/jobs/client_test.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/members/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/milestones/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/milestones/client_test.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/mr_approvals/__init__.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/mr_approvals/client_test.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/py.typed +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/test_gql_client.py +0 -0
- {fluidattacks_gitlab_sdk-3.0.0 → fluidattacks_gitlab_sdk-3.0.2}/tests_fx/test_mr.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fluidattacks_gitlab_sdk
|
|
3
|
-
Version: 3.0.
|
|
3
|
+
Version: 3.0.2
|
|
4
4
|
Summary: gitlab SDK
|
|
5
5
|
Author-email: Product Team <development@fluidattacks.com>
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -9,5 +9,5 @@ Requires-Dist: requests-toolbelt >=1.0.0, <2.0.0
|
|
|
9
9
|
Requires-Dist: fa-purity >=2.5.2, <3.0.0
|
|
10
10
|
Requires-Dist: pure-requests >=3.0.0, <4.0.0
|
|
11
11
|
Requires-Dist: python-dateutil >=2.8.0, <3.0.0
|
|
12
|
-
Requires-Dist: fluidattacks-etl-utils >=4.0.0, <5.
|
|
13
|
-
Requires-Dist: fluidattacks-utils-logger >=3.0.
|
|
12
|
+
Requires-Dist: fluidattacks-etl-utils >=4.0.0, <5.1.1
|
|
13
|
+
Requires-Dist: fluidattacks-utils-logger >=3.0.2, <4.0.0
|
|
@@ -55,7 +55,7 @@ def api_error_handler(cmd: Cmd[_T]) -> Cmd[Result[_T, ApiError]]:
|
|
|
55
55
|
return factory.success(unwrapper.act(cmd))
|
|
56
56
|
except TransportQueryError as err: # type: ignore[misc]
|
|
57
57
|
_errors = JsonValueFactory.from_any(err.errors).bind( # type: ignore[misc]
|
|
58
|
-
|
|
58
|
+
Unfolder.to_list,
|
|
59
59
|
)
|
|
60
60
|
errors = Bug.assume_success(
|
|
61
61
|
"decode_errors",
|
|
@@ -45,23 +45,25 @@ def _get_issue(
|
|
|
45
45
|
endpoint,
|
|
46
46
|
FrozenDict({}),
|
|
47
47
|
).map(
|
|
48
|
-
lambda r:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
c
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
48
|
+
lambda r: (
|
|
49
|
+
r.alt(
|
|
50
|
+
lambda e: e.map(handle_not_found, lambda e: Coproduct.inr(cast_exception(e))),
|
|
51
|
+
)
|
|
52
|
+
.bind(lambda i: assert_single(i).alt(Coproduct.inr))
|
|
53
|
+
.bind(lambda i: decode_issue_and_id(updated_by, i).alt(Coproduct.inr))
|
|
54
|
+
.alt(
|
|
55
|
+
lambda c: right_map(
|
|
56
|
+
c,
|
|
57
|
+
lambda e: cast_exception(
|
|
58
|
+
Bug.new(
|
|
59
|
+
"_get_issue",
|
|
60
|
+
inspect.currentframe(),
|
|
61
|
+
e,
|
|
62
|
+
(),
|
|
63
|
+
),
|
|
62
64
|
),
|
|
63
65
|
),
|
|
64
|
-
)
|
|
66
|
+
)
|
|
65
67
|
),
|
|
66
68
|
)
|
|
67
69
|
|
|
@@ -91,19 +91,21 @@ def most_recent_issue(
|
|
|
91
91
|
endpoint,
|
|
92
92
|
UnfoldedFactory.from_dict(params),
|
|
93
93
|
).map(
|
|
94
|
-
lambda r:
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
94
|
+
lambda r: (
|
|
95
|
+
r.alt(
|
|
96
|
+
lambda e: cast_exception(
|
|
97
|
+
Bug.new(
|
|
98
|
+
"most_recent_issue",
|
|
99
|
+
inspect.currentframe(),
|
|
100
|
+
e,
|
|
101
|
+
(),
|
|
102
|
+
),
|
|
101
103
|
),
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
)
|
|
105
|
+
.bind(assert_multiple)
|
|
106
|
+
.map(NewFrozenList)
|
|
107
|
+
.map(decode_maybe_single)
|
|
108
|
+
),
|
|
107
109
|
)
|
|
108
110
|
get_issue: Cmd[ResultE[Maybe[tuple[IssueFullId, Issue]]]] = get_maybe_single.bind(
|
|
109
111
|
lambda r: r.to_coproduct().map(
|
|
@@ -36,7 +36,7 @@ def _nested_key(raw: JsonObj, first_key: str, next_keys: FrozenList[str]) -> Res
|
|
|
36
36
|
lambda v: _nested_key(v, next_keys[0], next_keys[1:]),
|
|
37
37
|
),
|
|
38
38
|
)
|
|
39
|
-
return JsonUnfolder.require(raw, first_key,
|
|
39
|
+
return JsonUnfolder.require(raw, first_key, Result.success)
|
|
40
40
|
|
|
41
41
|
|
|
42
42
|
def _decode_gid(raw: str) -> ResultE[UserId]:
|
|
@@ -48,14 +48,18 @@ def decode_user_obj(raw: JsonObj) -> ResultE[UserObj]:
|
|
|
48
48
|
JsonUnfolder.require(raw, "id", DecodeUtils.to_str)
|
|
49
49
|
.bind(_decode_gid)
|
|
50
50
|
.bind(
|
|
51
|
-
lambda user_id:
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
lambda user_id: (
|
|
52
|
+
JsonUnfolder.require(raw, "username", DecodeUtils.to_str)
|
|
53
|
+
.map(User)
|
|
54
|
+
.bind(
|
|
55
|
+
lambda user: (
|
|
56
|
+
JsonUnfolder.require(raw, "name", DecodeUtils.to_str)
|
|
57
|
+
.map(UserName)
|
|
58
|
+
.map(
|
|
59
|
+
lambda name: UserObj(user_id, user, name),
|
|
60
|
+
)
|
|
61
|
+
),
|
|
62
|
+
)
|
|
59
63
|
),
|
|
60
64
|
)
|
|
61
65
|
)
|
|
@@ -78,7 +82,7 @@ def _set_not_found_if_empty(
|
|
|
78
82
|
.alt(Coproduct[NotFound, Exception].inr)
|
|
79
83
|
.bind(
|
|
80
84
|
lambda m: m.to_coproduct().map(
|
|
81
|
-
|
|
85
|
+
Result.success,
|
|
82
86
|
lambda _: Result.failure(Coproduct.inl(NotFound(ValueError("Issue not found")))),
|
|
83
87
|
),
|
|
84
88
|
)
|
|
@@ -141,17 +145,19 @@ def get_updated_by(
|
|
|
141
145
|
"issue_iid": int_to_str(issue_id.internal_id.value),
|
|
142
146
|
}
|
|
143
147
|
return client.get(query, FrozenTools.freeze(values)).map(
|
|
144
|
-
lambda r:
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
c
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
lambda r: (
|
|
149
|
+
r.alt(Coproduct[NotFound, Exception].inr)
|
|
150
|
+
.bind(_decode)
|
|
151
|
+
.alt(
|
|
152
|
+
lambda c: right_map(
|
|
153
|
+
c,
|
|
154
|
+
lambda e: Bug.new(
|
|
155
|
+
"get_updated_by",
|
|
156
|
+
inspect.currentframe(),
|
|
157
|
+
e,
|
|
158
|
+
(str(project), str(issue_id)),
|
|
159
|
+
),
|
|
154
160
|
),
|
|
155
|
-
)
|
|
161
|
+
)
|
|
156
162
|
),
|
|
157
163
|
)
|
|
@@ -40,23 +40,25 @@ def get_job(
|
|
|
40
40
|
)
|
|
41
41
|
msg = Cmd.wrap_impure(lambda: LOG.info("[API] get_job(%s, %s)", project, job_id))
|
|
42
42
|
return msg + client.get(endpoint, FrozenDict({})).map(
|
|
43
|
-
lambda r:
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
c
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
lambda r: (
|
|
44
|
+
r.alt(
|
|
45
|
+
lambda e: e.map(handle_not_found, lambda e: Coproduct.inr(cast_exception(e))),
|
|
46
|
+
)
|
|
47
|
+
.bind(lambda v: assert_single(v).alt(Coproduct.inr))
|
|
48
|
+
.bind(lambda v: decode_job_obj(v).alt(Coproduct.inr))
|
|
49
|
+
.alt(
|
|
50
|
+
lambda c: right_map(
|
|
51
|
+
c,
|
|
52
|
+
lambda e: cast_exception(
|
|
53
|
+
Bug.new(
|
|
54
|
+
"_get_job",
|
|
55
|
+
inspect.currentframe(),
|
|
56
|
+
e,
|
|
57
|
+
(),
|
|
58
|
+
),
|
|
57
59
|
),
|
|
58
60
|
),
|
|
59
|
-
)
|
|
61
|
+
)
|
|
60
62
|
),
|
|
61
63
|
)
|
|
62
64
|
|
|
@@ -29,13 +29,13 @@ def _decoder_require_list(item: JsonValue) -> ResultE[FrozenList[str]]:
|
|
|
29
29
|
return Unfolder.to_list_of(
|
|
30
30
|
item,
|
|
31
31
|
lambda v: Unfolder.to_primitive(v).bind(
|
|
32
|
-
|
|
32
|
+
JsonPrimitiveUnfolder.to_str,
|
|
33
33
|
),
|
|
34
34
|
)
|
|
35
35
|
|
|
36
36
|
|
|
37
37
|
def get_float(number: JsonValue) -> ResultE[float]:
|
|
38
|
-
return Unfolder.to_primitive(number).bind(
|
|
38
|
+
return Unfolder.to_primitive(number).bind(JsonPrimitiveUnfolder.to_float)
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
def str_to_datetime(raw: str) -> ResultE[datetime]:
|
|
@@ -46,7 +46,7 @@ def str_to_datetime(raw: str) -> ResultE[datetime]:
|
|
|
46
46
|
|
|
47
47
|
|
|
48
48
|
def decode_str(value: JsonValue) -> ResultE[str]:
|
|
49
|
-
return Unfolder.to_primitive(value).bind(
|
|
49
|
+
return Unfolder.to_primitive(value).bind(JsonPrimitiveUnfolder.to_str)
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
def decode_datetime(value: JsonValue) -> ResultE[datetime]:
|
|
@@ -62,12 +62,14 @@ def decode_user_id(raw: JsonObj) -> ResultE[Maybe[UserId]]:
|
|
|
62
62
|
return JsonUnfolder.optional(
|
|
63
63
|
raw,
|
|
64
64
|
"id",
|
|
65
|
-
lambda v:
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
lambda v: (
|
|
66
|
+
Unfolder.to_primitive(v)
|
|
67
|
+
.bind(JsonPrimitiveUnfolder.to_int)
|
|
68
|
+
.map(lambda j: UserId(NaturalOperations.absolute(j)))
|
|
69
|
+
),
|
|
68
70
|
)
|
|
69
71
|
|
|
70
|
-
maybe_user_obj = JsonUnfolder.optional(raw, "user",
|
|
72
|
+
maybe_user_obj = JsonUnfolder.optional(raw, "user", Unfolder.to_json)
|
|
71
73
|
return maybe_user_obj.bind(lambda v: decode_maybe_id(v.value_or(FrozenDict({}))))
|
|
72
74
|
|
|
73
75
|
|
|
@@ -76,18 +78,20 @@ def decode_runner_id(raw: JsonObj) -> ResultE[Maybe[RunnerId]]:
|
|
|
76
78
|
return JsonUnfolder.optional(
|
|
77
79
|
raw,
|
|
78
80
|
"id",
|
|
79
|
-
lambda v:
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
lambda v: (
|
|
82
|
+
Unfolder.to_primitive(v)
|
|
83
|
+
.bind(JsonPrimitiveUnfolder.to_int)
|
|
84
|
+
.map(lambda j: RunnerId(NaturalOperations.absolute(j)))
|
|
85
|
+
),
|
|
82
86
|
)
|
|
83
87
|
|
|
84
|
-
maybe_runner_obj = JsonUnfolder.optional(raw, "runner",
|
|
88
|
+
maybe_runner_obj = JsonUnfolder.optional(raw, "runner", Unfolder.to_json)
|
|
85
89
|
return maybe_runner_obj.bind(lambda v: decode_maybe_id(v.value_or(FrozenDict({}))))
|
|
86
90
|
|
|
87
91
|
|
|
88
92
|
def decode_commit_properties(raw: JsonObj) -> ResultE[Commit]:
|
|
89
93
|
sha_commit = JsonUnfolder.optional(raw, "id", DecodeUtils.to_opt_str).map(
|
|
90
|
-
lambda v: v.bind(lambda j: j.map(
|
|
94
|
+
lambda v: v.bind(lambda j: j.map(CommitHash)),
|
|
91
95
|
)
|
|
92
96
|
title = JsonUnfolder.optional(raw, "title", DecodeUtils.to_opt_str).map(
|
|
93
97
|
lambda v: v.bind(lambda j: j),
|
|
@@ -96,7 +100,7 @@ def decode_commit_properties(raw: JsonObj) -> ResultE[Commit]:
|
|
|
96
100
|
|
|
97
101
|
|
|
98
102
|
def decode_commit(raw: JsonObj) -> ResultE[Commit]:
|
|
99
|
-
maybe_commit_obj = JsonUnfolder.optional(raw, "commit",
|
|
103
|
+
maybe_commit_obj = JsonUnfolder.optional(raw, "commit", Unfolder.to_json)
|
|
100
104
|
return maybe_commit_obj.bind(lambda v: decode_commit_properties(v.value_or(FrozenDict({}))))
|
|
101
105
|
|
|
102
106
|
|
|
@@ -56,18 +56,20 @@ def get_mr(
|
|
|
56
56
|
endpoint,
|
|
57
57
|
FrozenDict({}),
|
|
58
58
|
).map(
|
|
59
|
-
lambda r:
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
59
|
+
lambda r: (
|
|
60
|
+
r.alt(
|
|
61
|
+
lambda e: cast_exception(
|
|
62
|
+
Bug.new(
|
|
63
|
+
"_get_mr",
|
|
64
|
+
inspect.currentframe(),
|
|
65
|
+
e,
|
|
66
|
+
(),
|
|
67
|
+
),
|
|
66
68
|
),
|
|
67
|
-
)
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
)
|
|
70
|
+
.bind(assert_single)
|
|
71
|
+
.bind(decode_mr_and_id)
|
|
72
|
+
),
|
|
71
73
|
)
|
|
72
74
|
|
|
73
75
|
|
|
@@ -92,24 +94,26 @@ def most_recent_mr_until(
|
|
|
92
94
|
endpoint,
|
|
93
95
|
UnfoldedFactory.from_dict(params),
|
|
94
96
|
).map(
|
|
95
|
-
lambda r:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
97
|
+
lambda r: (
|
|
98
|
+
r.alt(
|
|
99
|
+
lambda e: cast_exception(
|
|
100
|
+
Bug.new(
|
|
101
|
+
"most_recent_mr",
|
|
102
|
+
inspect.currentframe(),
|
|
103
|
+
e,
|
|
104
|
+
(),
|
|
105
|
+
),
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
.bind(assert_multiple)
|
|
109
|
+
.map(NewFrozenList)
|
|
110
|
+
.map(decode_maybe_single)
|
|
111
|
+
.bind(
|
|
112
|
+
lambda m: m.to_coproduct().map(
|
|
113
|
+
lambda r: decode_mr_and_id(r).map(Maybe.some),
|
|
114
|
+
lambda _: Result.success(empty),
|
|
102
115
|
),
|
|
103
|
-
)
|
|
104
|
-
)
|
|
105
|
-
.bind(assert_multiple)
|
|
106
|
-
.map(NewFrozenList)
|
|
107
|
-
.map(decode_maybe_single)
|
|
108
|
-
.bind(
|
|
109
|
-
lambda m: m.to_coproduct().map(
|
|
110
|
-
lambda r: decode_mr_and_id(r).map(Maybe.some),
|
|
111
|
-
lambda _: Result.success(empty),
|
|
112
|
-
),
|
|
116
|
+
)
|
|
113
117
|
),
|
|
114
118
|
)
|
|
115
119
|
|
|
@@ -133,24 +137,26 @@ def most_recent_mr(
|
|
|
133
137
|
endpoint,
|
|
134
138
|
UnfoldedFactory.from_dict(params),
|
|
135
139
|
).map(
|
|
136
|
-
lambda r:
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
140
|
+
lambda r: (
|
|
141
|
+
r.alt(
|
|
142
|
+
lambda e: cast_exception(
|
|
143
|
+
Bug.new(
|
|
144
|
+
"most_recent_mr",
|
|
145
|
+
inspect.currentframe(),
|
|
146
|
+
e,
|
|
147
|
+
(),
|
|
148
|
+
),
|
|
143
149
|
),
|
|
144
|
-
)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
)
|
|
150
|
+
)
|
|
151
|
+
.bind(assert_multiple)
|
|
152
|
+
.map(NewFrozenList)
|
|
153
|
+
.map(decode_maybe_single)
|
|
154
|
+
.bind(
|
|
155
|
+
lambda m: m.to_coproduct().map(
|
|
156
|
+
lambda r: decode_mr_and_id(r).map(Maybe.some),
|
|
157
|
+
lambda _: Result.success(empty),
|
|
158
|
+
),
|
|
159
|
+
)
|
|
154
160
|
),
|
|
155
161
|
)
|
|
156
162
|
|
|
@@ -189,19 +195,21 @@ def get_updated_mrs( # noqa: PLR0913
|
|
|
189
195
|
endpoint,
|
|
190
196
|
UnfoldedFactory.from_dict(params),
|
|
191
197
|
).map(
|
|
192
|
-
lambda r:
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
198
|
+
lambda r: (
|
|
199
|
+
r.alt(
|
|
200
|
+
lambda e: cast_exception(
|
|
201
|
+
Bug.new(
|
|
202
|
+
"mr_updates",
|
|
203
|
+
inspect.currentframe(),
|
|
204
|
+
e,
|
|
205
|
+
(),
|
|
206
|
+
),
|
|
199
207
|
),
|
|
200
|
-
)
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
)
|
|
209
|
+
.bind(assert_multiple)
|
|
210
|
+
.bind(decode_batch_mrs)
|
|
211
|
+
.bind(lambda items: validate_next_page(current_page, items))
|
|
212
|
+
),
|
|
205
213
|
)
|
|
206
214
|
|
|
207
215
|
|
|
@@ -79,7 +79,7 @@ def decode_people(raw: JsonObj) -> ResultE[MergeRequestPeople]:
|
|
|
79
79
|
v,
|
|
80
80
|
lambda v: Unfolder.to_json(v).bind(decode_user_obj),
|
|
81
81
|
),
|
|
82
|
-
).map(lambda m: m.bind(
|
|
82
|
+
).map(lambda m: m.bind(Maybe.from_optional)),
|
|
83
83
|
JsonUnfolder.optional(
|
|
84
84
|
raw,
|
|
85
85
|
"closed_by",
|
|
@@ -87,7 +87,7 @@ def decode_people(raw: JsonObj) -> ResultE[MergeRequestPeople]:
|
|
|
87
87
|
v,
|
|
88
88
|
lambda v: Unfolder.to_json(v).bind(decode_user_obj),
|
|
89
89
|
),
|
|
90
|
-
).map(lambda m: m.bind(
|
|
90
|
+
).map(lambda m: m.bind(Maybe.from_optional)),
|
|
91
91
|
JsonUnfolder.require(
|
|
92
92
|
raw,
|
|
93
93
|
"assignees",
|
|
@@ -230,5 +230,5 @@ def decode_batch_mrs(
|
|
|
230
230
|
if not mrs:
|
|
231
231
|
return Result.success(FrozenList[tuple[MrFullId, MergeRequest]]([]), Exception)
|
|
232
232
|
return ResultTransform.all_ok(
|
|
233
|
-
PureIterFactory.from_list(mrs).map(
|
|
233
|
+
PureIterFactory.from_list(mrs).map(decode_mr_and_id).to_list(),
|
|
234
234
|
)
|
|
@@ -53,7 +53,7 @@ def handler_empty_two(
|
|
|
53
53
|
item: ResultE[Maybe[tuple[MilestoneFullId, Milestone]]],
|
|
54
54
|
) -> Result[tuple[MilestoneFullId, Milestone], Coproduct[NotFound, Exception]]:
|
|
55
55
|
factory: CoproductFactory[NotFound, Exception] = CoproductFactory()
|
|
56
|
-
return item.alt(
|
|
56
|
+
return item.alt(factory.inr).bind(handler_empty)
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def get_milestone(
|
|
@@ -71,23 +71,25 @@ def get_milestone(
|
|
|
71
71
|
endpoint,
|
|
72
72
|
FrozenDict({}),
|
|
73
73
|
).map(
|
|
74
|
-
lambda r:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
lambda r: (
|
|
75
|
+
r.alt(
|
|
76
|
+
lambda e: e.map(handle_not_found, lambda e: Coproduct.inr(cast_exception(e))),
|
|
77
|
+
)
|
|
78
|
+
.bind(lambda v: assert_multiple(v).alt(Coproduct.inr))
|
|
79
|
+
.bind(lambda v: handler_empty_two(decode_milestone_and_id(v)))
|
|
80
|
+
.alt(
|
|
81
|
+
lambda c: c.map(
|
|
82
|
+
Coproduct.inl,
|
|
83
|
+
lambda e: Coproduct.inr(
|
|
84
|
+
Bug.new(
|
|
85
|
+
"_get_milestone",
|
|
86
|
+
inspect.currentframe(),
|
|
87
|
+
e,
|
|
88
|
+
(),
|
|
89
|
+
),
|
|
88
90
|
),
|
|
89
91
|
),
|
|
90
|
-
)
|
|
92
|
+
)
|
|
91
93
|
),
|
|
92
94
|
)
|
|
93
95
|
|
|
@@ -111,24 +113,26 @@ def most_recent_milestone(
|
|
|
111
113
|
endpoint,
|
|
112
114
|
UnfoldedFactory.from_dict(params),
|
|
113
115
|
).map(
|
|
114
|
-
lambda r:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
116
|
+
lambda r: (
|
|
117
|
+
r.alt(
|
|
118
|
+
lambda e: cast_exception(
|
|
119
|
+
Bug.new(
|
|
120
|
+
"most_recent_milestone",
|
|
121
|
+
inspect.currentframe(),
|
|
122
|
+
e,
|
|
123
|
+
(),
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
)
|
|
127
|
+
.bind(assert_multiple)
|
|
128
|
+
.map(NewFrozenList)
|
|
129
|
+
.map(decode_maybe_single)
|
|
130
|
+
.bind(
|
|
131
|
+
lambda m: m.to_coproduct().map(
|
|
132
|
+
lambda r: decode_milestone_and_id(FrozenList[JsonObj]((r,))),
|
|
133
|
+
lambda _: Result.success(empty),
|
|
121
134
|
),
|
|
122
|
-
)
|
|
123
|
-
)
|
|
124
|
-
.bind(assert_multiple)
|
|
125
|
-
.map(NewFrozenList)
|
|
126
|
-
.map(decode_maybe_single)
|
|
127
|
-
.bind(
|
|
128
|
-
lambda m: m.to_coproduct().map(
|
|
129
|
-
lambda r: decode_milestone_and_id(FrozenList[JsonObj]((r,))),
|
|
130
|
-
lambda _: Result.success(empty),
|
|
131
|
-
),
|
|
135
|
+
)
|
|
132
136
|
),
|
|
133
137
|
)
|
|
134
138
|
|
|
@@ -43,18 +43,20 @@ def _get_mr_approvals(
|
|
|
43
43
|
endpoint,
|
|
44
44
|
FrozenDict({}),
|
|
45
45
|
).map(
|
|
46
|
-
lambda r:
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
lambda r: (
|
|
47
|
+
r.alt(
|
|
48
|
+
lambda e: cast_exception(
|
|
49
|
+
Bug.new(
|
|
50
|
+
"get_mr_approvals",
|
|
51
|
+
inspect.currentframe(),
|
|
52
|
+
e,
|
|
53
|
+
(),
|
|
54
|
+
),
|
|
53
55
|
),
|
|
54
|
-
)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
)
|
|
57
|
+
.bind(assert_single)
|
|
58
|
+
.bind(decode_id_and_mr_approvals)
|
|
59
|
+
),
|
|
58
60
|
)
|
|
59
61
|
|
|
60
62
|
|
|
@@ -17,11 +17,13 @@ def decode_mr_approvals(raw: JsonObj) -> ResultE[MrApprovals]:
|
|
|
17
17
|
"approved_by",
|
|
18
18
|
lambda v: Unfolder.to_list_of(
|
|
19
19
|
v,
|
|
20
|
-
lambda x:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
lambda x: (
|
|
21
|
+
Unfolder.to_json(x)
|
|
22
|
+
.bind(lambda user_obj: JsonUnfolder.require(user_obj, "user", Unfolder.to_json))
|
|
23
|
+
.bind(decode_user_obj)
|
|
24
|
+
.map(Approver)
|
|
25
|
+
),
|
|
26
|
+
).map(tuple),
|
|
25
27
|
),
|
|
26
28
|
).map(lambda v: MrApprovals(v[0], v[1]))
|
|
27
29
|
|