Skip to content

Commit

Permalink
feat(tem): add domain reputation score (#1885)
Browse files Browse the repository at this point in the history
Co-authored-by: Mia-Cross <[email protected]>
  • Loading branch information
scaleway-bot and Mia-Cross authored Oct 23, 2023
1 parent 699490e commit f99c21c
Showing 1 changed file with 57 additions and 2 deletions.
59 changes: 57 additions & 2 deletions api/tem/v1alpha1/tem_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,44 @@ func (enum *DomainLastStatusRecordStatus) UnmarshalJSON(data []byte) error {
return nil
}

type DomainReputationStatus string

const (
// If unspecified, the status of the domain reputation is unknown by default
DomainReputationStatusUnknown = DomainReputationStatus("unknown")
// The domain has an excellent reputation
DomainReputationStatusExcellent = DomainReputationStatus("excellent")
// The domain has a good reputation
DomainReputationStatusGood = DomainReputationStatus("good")
// The domain has an average reputation. Look at our documentation to find how to improving it
DomainReputationStatusAverage = DomainReputationStatus("average")
// The domain has a bad reputation. You should check your email activity tab in the Scaleway console and look at our documentation to find how to improving it
DomainReputationStatusBad = DomainReputationStatus("bad")
)

func (enum DomainReputationStatus) String() string {
if enum == "" {
// return default value if empty
return "unknown"
}
return string(enum)
}

func (enum DomainReputationStatus) MarshalJSON() ([]byte, error) {
return []byte(fmt.Sprintf(`"%s"`, enum)), nil
}

func (enum *DomainReputationStatus) UnmarshalJSON(data []byte) error {
tmp := ""

if err := json.Unmarshal(data, &tmp); err != nil {
return err
}

*enum = DomainReputationStatus(DomainReputationStatus(tmp).String())
return nil
}

type DomainStatus string

const (
Expand Down Expand Up @@ -354,6 +392,8 @@ type Domain struct {
DkimConfig string `json:"dkim_config"`
// Statistics: domain's statistics.
Statistics *DomainStatistics `json:"statistics"`
// Reputation: domain's reputation, available when your domain is checked and has sent enough emails.
Reputation *DomainReputation `json:"reputation"`

Region scw.Region `json:"region"`
}
Expand All @@ -372,7 +412,7 @@ type DomainLastStatus struct {

// DomainLastStatusDkimRecord: domain last status. dkim record.
type DomainLastStatusDkimRecord struct {
// Status: status of the DKIM record's configurartion.
// Status: status of the DKIM record's configuration.
// Default value: unknown_record_status
Status DomainLastStatusRecordStatus `json:"status"`
// LastValidAt: time and date the DKIM record was last valid.
Expand All @@ -383,7 +423,7 @@ type DomainLastStatusDkimRecord struct {

// DomainLastStatusSpfRecord: domain last status. spf record.
type DomainLastStatusSpfRecord struct {
// Status: status of the SPF record's configurartion.
// Status: status of the SPF record's configuration.
// Default value: unknown_record_status
Status DomainLastStatusRecordStatus `json:"status"`
// LastValidAt: time and date the SPF record was last valid.
Expand All @@ -392,6 +432,21 @@ type DomainLastStatusSpfRecord struct {
Error *string `json:"error"`
}

// DomainReputation: domain. reputation.
type DomainReputation struct {
// Status: status of your domain reputation.
// Default value: unknown
Status DomainReputationStatus `json:"status"`
// Score: represent a number between 0 and 100 of your domain reputation score.
Score uint32 `json:"score"`
// ScoredAt: time and date the score was calculated.
ScoredAt *time.Time `json:"scored_at"`
// PreviousScore: the domain reputation score previously calculated.
PreviousScore *uint32 `json:"previous_score"`
// PreviousScoredAt: time and date the previous score was calculated.
PreviousScoredAt *time.Time `json:"previous_scored_at"`
}

type DomainStatistics struct {
TotalCount uint32 `json:"total_count"`

Expand Down

0 comments on commit f99c21c

Please sign in to comment.