Skip to content

Commit 221e236

Browse files
authored
feat(tem): add domain reputation score (#339)
1 parent 7881cd8 commit 221e236

File tree

6 files changed

+172
-4
lines changed

6 files changed

+172
-4
lines changed

scaleway-async/scaleway_async/tem/v1alpha1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import DomainLastStatusRecordStatus
4+
from .types import DomainReputationStatus
45
from .types import DomainStatus
56
from .types import EmailFlag
67
from .types import EmailRcptType
@@ -13,6 +14,7 @@
1314
from .types import DomainLastStatus
1415
from .types import DomainLastStatusDkimRecord
1516
from .types import DomainLastStatusSpfRecord
17+
from .types import DomainReputation
1618
from .types import DomainStatistics
1719
from .types import Email
1820
from .types import EmailTry
@@ -25,6 +27,7 @@
2527

2628
__all__ = [
2729
"DomainLastStatusRecordStatus",
30+
"DomainReputationStatus",
2831
"DomainStatus",
2932
"EmailFlag",
3033
"EmailRcptType",
@@ -37,6 +40,7 @@
3740
"DomainLastStatus",
3841
"DomainLastStatusDkimRecord",
3942
"DomainLastStatusSpfRecord",
43+
"DomainReputation",
4044
"DomainStatistics",
4145
"Email",
4246
"EmailTry",

scaleway-async/scaleway_async/tem/v1alpha1/marshalling.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
DomainLastStatus,
1414
DomainLastStatusDkimRecord,
1515
DomainLastStatusSpfRecord,
16+
DomainReputation,
1617
DomainStatistics,
1718
Email,
1819
EmailTry,
@@ -24,6 +25,32 @@
2425
)
2526

2627

28+
def unmarshal_DomainReputation(data: Any) -> DomainReputation:
29+
if type(data) is not dict:
30+
raise TypeError(
31+
f"Unmarshalling the type 'DomainReputation' failed as data isn't a dictionary."
32+
)
33+
34+
args: Dict[str, Any] = {}
35+
36+
field = data.get("previous_score", None)
37+
args["previous_score"] = field
38+
39+
field = data.get("previous_scored_at", None)
40+
args["previous_scored_at"] = parser.isoparse(field) if type(field) is str else field
41+
42+
field = data.get("score", None)
43+
args["score"] = field
44+
45+
field = data.get("scored_at", None)
46+
args["scored_at"] = parser.isoparse(field) if type(field) is str else field
47+
48+
field = data.get("status", None)
49+
args["status"] = field
50+
51+
return DomainReputation(**args)
52+
53+
2754
def unmarshal_DomainStatistics(data: Any) -> DomainStatistics:
2855
if type(data) is not dict:
2956
raise TypeError(
@@ -108,6 +135,11 @@ def unmarshal_Domain(data: Any) -> Domain:
108135
field = data.get("region", None)
109136
args["region"] = field
110137

138+
field = data.get("reputation", None)
139+
args["reputation"] = (
140+
unmarshal_DomainReputation(field) if field is not None else None
141+
)
142+
111143
field = data.get("revoked_at", None)
112144
args["revoked_at"] = parser.isoparse(field) if type(field) is str else field
113145

scaleway-async/scaleway_async/tem/v1alpha1/types.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ def __str__(self) -> str:
2525
return str(self.value)
2626

2727

28+
class DomainReputationStatus(str, Enum, metaclass=StrEnumMeta):
29+
UNKNOWN = "unknown"
30+
EXCELLENT = "excellent"
31+
GOOD = "good"
32+
AVERAGE = "average"
33+
BAD = "bad"
34+
35+
def __str__(self) -> str:
36+
return str(self.value)
37+
38+
2839
class DomainStatus(str, Enum, metaclass=StrEnumMeta):
2940
UNKNOWN = "unknown"
3041
CHECKED = "checked"
@@ -215,6 +226,11 @@ class Domain:
215226
Domain's statistics.
216227
"""
217228

229+
reputation: Optional[DomainReputation]
230+
"""
231+
Domain's reputation, available when your domain is checked and has sent enough emails.
232+
"""
233+
218234
region: Region
219235

220236

@@ -253,7 +269,7 @@ class DomainLastStatusDkimRecord:
253269

254270
status: DomainLastStatusRecordStatus
255271
"""
256-
Status of the DKIM record's configurartion.
272+
Status of the DKIM record's configuration.
257273
"""
258274

259275
last_valid_at: Optional[datetime]
@@ -275,7 +291,7 @@ class DomainLastStatusSpfRecord:
275291

276292
status: DomainLastStatusRecordStatus
277293
"""
278-
Status of the SPF record's configurartion.
294+
Status of the SPF record's configuration.
279295
"""
280296

281297
last_valid_at: Optional[datetime]
@@ -289,6 +305,38 @@ class DomainLastStatusSpfRecord:
289305
"""
290306

291307

308+
@dataclass
309+
class DomainReputation:
310+
"""
311+
Domain. reputation.
312+
"""
313+
314+
status: DomainReputationStatus
315+
"""
316+
Status of your domain reputation.
317+
"""
318+
319+
score: int
320+
"""
321+
Represent a number between 0 and 100 of your domain reputation score.
322+
"""
323+
324+
scored_at: Optional[datetime]
325+
"""
326+
Time and date the score was calculated.
327+
"""
328+
329+
previous_score: Optional[int]
330+
"""
331+
The domain reputation score previously calculated.
332+
"""
333+
334+
previous_scored_at: Optional[datetime]
335+
"""
336+
Time and date the previous score was calculated.
337+
"""
338+
339+
292340
@dataclass
293341
class DomainStatistics:
294342
total_count: int

scaleway/scaleway/tem/v1alpha1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import DomainLastStatusRecordStatus
4+
from .types import DomainReputationStatus
45
from .types import DomainStatus
56
from .types import EmailFlag
67
from .types import EmailRcptType
@@ -13,6 +14,7 @@
1314
from .types import DomainLastStatus
1415
from .types import DomainLastStatusDkimRecord
1516
from .types import DomainLastStatusSpfRecord
17+
from .types import DomainReputation
1618
from .types import DomainStatistics
1719
from .types import Email
1820
from .types import EmailTry
@@ -25,6 +27,7 @@
2527

2628
__all__ = [
2729
"DomainLastStatusRecordStatus",
30+
"DomainReputationStatus",
2831
"DomainStatus",
2932
"EmailFlag",
3033
"EmailRcptType",
@@ -37,6 +40,7 @@
3740
"DomainLastStatus",
3841
"DomainLastStatusDkimRecord",
3942
"DomainLastStatusSpfRecord",
43+
"DomainReputation",
4044
"DomainStatistics",
4145
"Email",
4246
"EmailTry",

scaleway/scaleway/tem/v1alpha1/marshalling.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
DomainLastStatus,
1414
DomainLastStatusDkimRecord,
1515
DomainLastStatusSpfRecord,
16+
DomainReputation,
1617
DomainStatistics,
1718
Email,
1819
EmailTry,
@@ -24,6 +25,32 @@
2425
)
2526

2627

28+
def unmarshal_DomainReputation(data: Any) -> DomainReputation:
29+
if type(data) is not dict:
30+
raise TypeError(
31+
f"Unmarshalling the type 'DomainReputation' failed as data isn't a dictionary."
32+
)
33+
34+
args: Dict[str, Any] = {}
35+
36+
field = data.get("previous_score", None)
37+
args["previous_score"] = field
38+
39+
field = data.get("previous_scored_at", None)
40+
args["previous_scored_at"] = parser.isoparse(field) if type(field) is str else field
41+
42+
field = data.get("score", None)
43+
args["score"] = field
44+
45+
field = data.get("scored_at", None)
46+
args["scored_at"] = parser.isoparse(field) if type(field) is str else field
47+
48+
field = data.get("status", None)
49+
args["status"] = field
50+
51+
return DomainReputation(**args)
52+
53+
2754
def unmarshal_DomainStatistics(data: Any) -> DomainStatistics:
2855
if type(data) is not dict:
2956
raise TypeError(
@@ -108,6 +135,11 @@ def unmarshal_Domain(data: Any) -> Domain:
108135
field = data.get("region", None)
109136
args["region"] = field
110137

138+
field = data.get("reputation", None)
139+
args["reputation"] = (
140+
unmarshal_DomainReputation(field) if field is not None else None
141+
)
142+
111143
field = data.get("revoked_at", None)
112144
args["revoked_at"] = parser.isoparse(field) if type(field) is str else field
113145

scaleway/scaleway/tem/v1alpha1/types.py

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ def __str__(self) -> str:
2525
return str(self.value)
2626

2727

28+
class DomainReputationStatus(str, Enum, metaclass=StrEnumMeta):
29+
UNKNOWN = "unknown"
30+
EXCELLENT = "excellent"
31+
GOOD = "good"
32+
AVERAGE = "average"
33+
BAD = "bad"
34+
35+
def __str__(self) -> str:
36+
return str(self.value)
37+
38+
2839
class DomainStatus(str, Enum, metaclass=StrEnumMeta):
2940
UNKNOWN = "unknown"
3041
CHECKED = "checked"
@@ -215,6 +226,11 @@ class Domain:
215226
Domain's statistics.
216227
"""
217228

229+
reputation: Optional[DomainReputation]
230+
"""
231+
Domain's reputation, available when your domain is checked and has sent enough emails.
232+
"""
233+
218234
region: Region
219235

220236

@@ -253,7 +269,7 @@ class DomainLastStatusDkimRecord:
253269

254270
status: DomainLastStatusRecordStatus
255271
"""
256-
Status of the DKIM record's configurartion.
272+
Status of the DKIM record's configuration.
257273
"""
258274

259275
last_valid_at: Optional[datetime]
@@ -275,7 +291,7 @@ class DomainLastStatusSpfRecord:
275291

276292
status: DomainLastStatusRecordStatus
277293
"""
278-
Status of the SPF record's configurartion.
294+
Status of the SPF record's configuration.
279295
"""
280296

281297
last_valid_at: Optional[datetime]
@@ -289,6 +305,38 @@ class DomainLastStatusSpfRecord:
289305
"""
290306

291307

308+
@dataclass
309+
class DomainReputation:
310+
"""
311+
Domain. reputation.
312+
"""
313+
314+
status: DomainReputationStatus
315+
"""
316+
Status of your domain reputation.
317+
"""
318+
319+
score: int
320+
"""
321+
Represent a number between 0 and 100 of your domain reputation score.
322+
"""
323+
324+
scored_at: Optional[datetime]
325+
"""
326+
Time and date the score was calculated.
327+
"""
328+
329+
previous_score: Optional[int]
330+
"""
331+
The domain reputation score previously calculated.
332+
"""
333+
334+
previous_scored_at: Optional[datetime]
335+
"""
336+
Time and date the previous score was calculated.
337+
"""
338+
339+
292340
@dataclass
293341
class DomainStatistics:
294342
total_count: int

0 commit comments

Comments
 (0)