Skip to content

Commit

Permalink
Added missing account struct fields and added unit tests (linode#612)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezilber-akamai authored Nov 12, 2024
1 parent 86d1af4 commit 400777a
Show file tree
Hide file tree
Showing 31 changed files with 891 additions and 467 deletions.
1 change: 1 addition & 0 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type Account struct {
BillingSource string `json:"billing_source"`
Capabilities []string `json:"capabilities"`
ActiveSince *time.Time `json:"active_since"`
ActivePromotions []Promotion `json:"active_promotions"`
}

// AccountUpdateOptions fields are those accepted by UpdateAccount
Expand Down
6 changes: 6 additions & 0 deletions account_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ type Event struct {

// When this Event was created.
Created *time.Time `json:"-"`

// Provides additional information about the event.
Message string `json:"message"`

// The total duration in seconds that it takes for the Event to complete.
Duration float64 `json:"duration"`
}

// EventAction constants start with Action and include all known Linode API Event Actions.
Expand Down
20 changes: 15 additions & 5 deletions account_invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,33 @@ import (

// Invoice structs reflect an invoice for billable activity on the account.
type Invoice struct {
ID int `json:"id"`
Label string `json:"label"`
Total float32 `json:"total"`
Date *time.Time `json:"-"`
ID int `json:"id"`
Label string `json:"label"`
Total float32 `json:"total"`
Date *time.Time `json:"-"`
Tax float32 `json:"tax"`
Subtotal float32 `json:"subtotal"`
BillingSource string `json:"billing_source"`
TaxSummary []InvoiceTaxSummary `json:"tax_summary"`
}

type InvoiceTaxSummary struct {
Tax float32 `json:"tax"`
Name string `json:"name"`
}

// InvoiceItem structs reflect a single billable activity associate with an Invoice
type InvoiceItem struct {
Label string `json:"label"`
Type string `json:"type"`
UnitPrice int `json:"unitprice"`
UnitPrice float32 `json:"unit_price"`
Quantity int `json:"quantity"`
Amount float32 `json:"amount"`
Tax float32 `json:"tax"`
Region *string `json:"region"`
From *time.Time `json:"-"`
To *time.Time `json:"-"`
Total float32 `json:"total"`
}

// ListInvoices gets a paginated list of Invoices against the Account
Expand Down
24 changes: 13 additions & 11 deletions profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,19 @@ type ProfileReferrals struct {

// Profile represents a Profile object
type Profile struct {
UID int `json:"uid"`
Username string `json:"username"`
Email string `json:"email"`
Timezone string `json:"timezone"`
EmailNotifications bool `json:"email_notifications"`
IPWhitelistEnabled bool `json:"ip_whitelist_enabled"`
TwoFactorAuth bool `json:"two_factor_auth"`
Restricted bool `json:"restricted"`
LishAuthMethod LishAuthMethod `json:"lish_auth_method"`
Referrals ProfileReferrals `json:"referrals"`
AuthorizedKeys []string `json:"authorized_keys"`
UID int `json:"uid"`
Username string `json:"username"`
Email string `json:"email"`
Timezone string `json:"timezone"`
EmailNotifications bool `json:"email_notifications"`
IPWhitelistEnabled bool `json:"ip_whitelist_enabled"`
TwoFactorAuth bool `json:"two_factor_auth"`
Restricted bool `json:"restricted"`
LishAuthMethod LishAuthMethod `json:"lish_auth_method"`
Referrals ProfileReferrals `json:"referrals"`
AuthorizedKeys []string `json:"authorized_keys"`
AuthenticationType string `json:"authentication_type"`
VerifiedPhoneNumber string `json:"verified_phone_number,omitempty"`
}

// ProfileUpdateOptions fields are those accepted by UpdateProfile
Expand Down
1 change: 1 addition & 0 deletions support.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ type Ticket struct {
Summary string `json:"summary"`
Updated *time.Time `json:"-"`
UpdatedBy string `json:"updated_by"`
Closeable bool `json:"closeable"`
}

// TicketEntity refers a ticket to a specific entity
Expand Down
44 changes: 0 additions & 44 deletions test/integration/account_invoice_test.go

This file was deleted.

Loading

0 comments on commit 400777a

Please sign in to comment.