Skip to content

Commit

Permalink
feat(dom): add filter to endpoint listContacts (#1799)
Browse files Browse the repository at this point in the history
  • Loading branch information
scaleway-bot authored Aug 3, 2023
1 parent 5d1fe4e commit b3f1ae9
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions api/domain/v2beta1/domain_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,41 @@ func (enum *LanguageCode) UnmarshalJSON(data []byte) error {
return nil
}

type ListContactsRequestRole string

const (
ListContactsRequestRoleUnknownRole = ListContactsRequestRole("unknown_role")
// The contact is a domain's owner.
ListContactsRequestRoleOwner = ListContactsRequestRole("owner")
// The contact is a domain's administrative contact.
ListContactsRequestRoleAdministrative = ListContactsRequestRole("administrative")
// The contact is a domain's technical contact.
ListContactsRequestRoleTechnical = ListContactsRequestRole("technical")
)

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

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

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

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

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

type ListDNSZoneRecordsRequestOrderBy string

const (
Expand Down Expand Up @@ -3145,6 +3180,10 @@ type RegistrarAPIListContactsRequest struct {
ProjectID *string `json:"-"`

OrganizationID *string `json:"-"`
// Role: default value: unknown_role
Role ListContactsRequestRole `json:"-"`
// EmailStatus: default value: email_status_unknown
EmailStatus ContactEmailStatus `json:"-"`
}

// ListContacts: list contacts.
Expand All @@ -3164,6 +3203,8 @@ func (s *RegistrarAPI) ListContacts(req *RegistrarAPIListContactsRequest, opts .
parameter.AddToQuery(query, "domain", req.Domain)
parameter.AddToQuery(query, "project_id", req.ProjectID)
parameter.AddToQuery(query, "organization_id", req.OrganizationID)
parameter.AddToQuery(query, "role", req.Role)
parameter.AddToQuery(query, "email_status", req.EmailStatus)

scwReq := &scw.ScalewayRequest{
Method: "GET",
Expand Down

0 comments on commit b3f1ae9

Please sign in to comment.