Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added support for missing Account-related fields #612

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is technically a breaking change, granted I can't imagine anyone is using it given the JSON tag was previously wrong 👍

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