| 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 | ) |
| 6 | |
| 7 | // AccountsService handles communication with the account related |
| 8 | // methods of the DNSimple API. |
| 9 | // |
| 10 | // See https://developer.dnsimple.com/v2/accounts/ |
| 11 | type AccountsServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsService# struct { |
| 12 | clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsService#client. *Clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client# |
| 13 | } |
| 14 | |
| 15 | // Account represents a DNSimple account. |
| 16 | type Accountscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account# struct { |
| 17 | IDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account#ID. int64 `json:"id,omitempty"` |
| 18 | Emailscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account#Email. string `json:"email,omitempty"` |
| 19 | PlanIdentifierscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account#PlanIdentifier. string `json:"plan_identifier,omitempty"` |
| 20 | CreatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account#CreatedAt. string `json:"created_at,omitempty"` |
| 21 | UpdatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account#UpdatedAt. string `json:"updated_at,omitempty"` |
| 22 | } |
| 23 | |
| 24 | // AccountsResponse represents a response from an API method that returns a collection of Account struct. |
| 25 | type AccountsResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsResponse# struct { |
| 26 | Responsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsResponse#Response. |
| 27 | Datascip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsResponse#Data. []Accountscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Account# `json:"data"` |
| 28 | } |
| 29 | |
| 30 | // AccountInvitation represents an invitation to a DNSimple account. |
| 31 | type AccountInvitationscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation# struct { |
| 32 | IDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#ID. int64 `json:"id,omitempty"` |
| 33 | Emailscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#Email. string `json:"email,omitempty"` |
| 34 | Tokenscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#Token. string `json:"token,omitempty"` |
| 35 | AccountIDscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#AccountID. int64 `json:"account_id,omitempty"` |
| 36 | CreatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#CreatedAt. string `json:"created_at,omitempty"` |
| 37 | UpdatedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#UpdatedAt. string `json:"updated_at,omitempty"` |
| 38 | InvitationSentAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#InvitationSentAt. string `json:"invitation_sent_at,omitempty"` |
| 39 | InvitationAcceptedAtscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountInvitation#InvitationAcceptedAt. string `json:"invitation_accepted_at,omitempty"` |
| 40 | } |
| 41 | |
| 42 | // ListAccounts list the accounts for an user. |
| 43 | // |
| 44 | // See https://developer.dnsimple.com/v2/accounts/#list |
| 45 | func (s *AccountsServicescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsService#) ListAccountsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsService#ListAccounts().(ctx contextscip-go gomod github.com/golang/go/src go1.21 context/.Contextscip-go gomod github.com/golang/go/src go1.21 context/Context#, options *ListOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/ListOptions#) (*AccountsResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsResponse#, error) { |
| 46 | path := versionedscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/versioned().("/accounts") |
| 47 | accountsResponse := &AccountsResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsResponse#{} |
| 48 | |
| 49 | path, err := addURLQueryOptionsscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/addURLQueryOptions().(path, options) |
| 50 | if err != nil { |
| 51 | return nil, err |
| 52 | } |
| 53 | |
| 54 | resp, err := s.clientscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/AccountsService#client..getscip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Client#get().(ctx, path, accountsResponse) |
| 55 | if err != nil { |
| 56 | return accountsResponse, err |
| 57 | } |
| 58 | |
| 59 | accountsResponse.HTTPResponsescip-go gomod github.com/dnsimple/dnsimple-go . `github.com/dnsimple/dnsimple-go/dnsimple`/Response#HTTPResponse. = resp |
| 60 | return accountsResponse, nil |
| 61 | } |