| 1 | package dnsimplescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.21 context/" |
| 5 | "fmtscip-go gomod github.com/golang/go/src go1.21 fmt/" |
| 6 | ) |
| 7 | |
| 8 | // Collaborator represents a Collaborator in DNSimple. |
| 9 | type Collaboratorscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator# struct { |
| 10 | IDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#ID. int64 `json:"id,omitempty"` |
| 11 | DomainIDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#DomainID. int64 `json:"domain_id,omitempty"` |
| 12 | DomainNamescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#DomainName. string `json:"domain_name,omitempty"` |
| 13 | UserIDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#UserID. int64 `json:"user_id,omitempty"` |
| 14 | UserEmailscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#UserEmail. string `json:"user_email,omitempty"` |
| 15 | Invitationscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#Invitation. bool `json:"invitation,omitempty"` |
| 16 | CreatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#CreatedAt. string `json:"created_at,omitempty"` |
| 17 | UpdatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#UpdatedAt. string `json:"updated_at,omitempty"` |
| 18 | AcceptedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator#AcceptedAt. string `json:"accepted_at,omitempty"` |
| 19 | } |
| 20 | |
| 21 | func collaboratorPathscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/collaboratorPath().(accountID, domainIdentifier string, collaboratorID int64) (path string) { |
| 22 | path = fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("%v/collaborators", domainPathscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/domainPath().(accountID, domainIdentifier)) |
| 23 | if collaboratorID != 0 { |
| 24 | path += fmtscip-go gomod github.com/golang/go/src go1.21 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.21 fmt/Sprintf().("/%v", collaboratorID) |
| 25 | } |
| 26 | return |
| 27 | } |
| 28 | |
| 29 | // CollaboratorAttributes represents Collaborator attributes for AddCollaborator operation. |
| 30 | type CollaboratorAttributesscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorAttributes# struct { |
| 31 | Emailscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorAttributes#Email. string `json:"email,omitempty"` |
| 32 | } |
| 33 | |
| 34 | // CollaboratorResponse represents a response from an API method that returns a Collaborator struct. |
| 35 | type CollaboratorResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse# struct { |
| 36 | Responsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse#Response. |
| 37 | Datascip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse#Data. *Collaboratorscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator# `json:"data"` |
| 38 | } |
| 39 | |
| 40 | // CollaboratorsResponse represents a response from an API method that returns a collection of Collaborator struct. |
| 41 | type CollaboratorsResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorsResponse# struct { |
| 42 | Responsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorsResponse#Response. |
| 43 | Datascip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorsResponse#Data. []Collaboratorscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Collaborator# `json:"data"` |
| 44 | } |
| 45 | |
| 46 | // ListCollaborators list the collaborators for a domain. |
| 47 | // |
| 48 | // See https://developer.dnsimple.com/v2/domains/collaborators#list |
| 49 | func (s *DomainsServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#) ListCollaboratorsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#ListCollaborators().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID, domainIdentifier string, options *ListOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ListOptions#) (*CollaboratorsResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorsResponse#, error) { |
| 50 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(collaboratorPathscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/collaboratorPath().(accountID, domainIdentifier, 0)) |
| 51 | collaboratorsResponse := &CollaboratorsResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorsResponse#{} |
| 52 | |
| 53 | path, err := addURLQueryOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/addURLQueryOptions().(path, options) |
| 54 | if err != nil { |
| 55 | return nil, err |
| 56 | } |
| 57 | |
| 58 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#client..getscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#get().(ctx, path, collaboratorsResponse) |
| 59 | if err != nil { |
| 60 | return collaboratorsResponse, err |
| 61 | } |
| 62 | |
| 63 | collaboratorsResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 64 | return collaboratorsResponse, nil |
| 65 | } |
| 66 | |
| 67 | // AddCollaborator adds a new collaborator to the domain in the account. |
| 68 | // |
| 69 | // See https://developer.dnsimple.com/v2/domains/collaborators#add |
| 70 | func (s *DomainsServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#) AddCollaboratorscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#AddCollaborator().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, domainIdentifier string, attributes CollaboratorAttributesscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorAttributes#) (*CollaboratorResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse#, error) { |
| 71 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(collaboratorPathscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/collaboratorPath().(accountID, domainIdentifier, 0)) |
| 72 | collaboratorResponse := &CollaboratorResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse#{} |
| 73 | |
| 74 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#client..postscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#post().(ctx, path, attributes, collaboratorResponse) |
| 75 | if err != nil { |
| 76 | return nil, err |
| 77 | } |
| 78 | |
| 79 | collaboratorResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 80 | return collaboratorResponse, nil |
| 81 | } |
| 82 | |
| 83 | // RemoveCollaborator PERMANENTLY deletes a domain from the account. |
| 84 | // |
| 85 | // See https://developer.dnsimple.com/v2/domains/collaborators#remove |
| 86 | func (s *DomainsServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#) RemoveCollaboratorscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#RemoveCollaborator().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, accountID string, domainIdentifier string, collaboratorID int64) (*CollaboratorResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse#, error) { |
| 87 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().(collaboratorPathscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/collaboratorPath().(accountID, domainIdentifier, collaboratorID)) |
| 88 | collaboratorResponse := &CollaboratorResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/CollaboratorResponse#{} |
| 89 | |
| 90 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/DomainsService#client..deletescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#delete().(ctx, path, nil, nil) |
| 91 | if err != nil { |
| 92 | return nil, err |
| 93 | } |
| 94 | |
| 95 | collaboratorResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 96 | return collaboratorResponse, nil |
| 97 | } |