Skip to content

Commit

Permalink
Restored legacy PagedResponse structs and added deprecation notice
Browse files Browse the repository at this point in the history
  • Loading branch information
ezilber-akamai committed Jul 2, 2024
1 parent 87439ea commit c8fa872
Show file tree
Hide file tree
Showing 16 changed files with 59 additions and 0 deletions.
3 changes: 3 additions & 0 deletions account_availability.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type AccountAvailability struct {
Available []string `json:"available"`
}

// Deprecated: AccountAvailabilityPagedResponse exists for historical compatibility and should not be used.
type AccountAvailabilityPagedResponse legacyPagedResponse[AccountAvailability]

// ListAccountAvailabilities lists all regions and the resource availabilities to the account.
func (c *Client) ListAccountAvailabilities(ctx context.Context, opts *ListOptions) ([]AccountAvailability, error) {
response, err := getPaginatedResults[AccountAvailability](ctx, c, "account/availability", opts)
Expand Down
3 changes: 3 additions & 0 deletions account_betas.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type AccountBetaProgram struct {
Enrolled *time.Time `json:"-"`
}

// Deprecated: AccountBetasPagedResponse exists for historical compatibility and should not be used.
type AccountBetasPagedResponse legacyPagedResponse[AccountBetaProgram]

// AccountBetaProgramCreateOpts fields are those accepted by JoinBetaProgram
type AccountBetaProgramCreateOpts struct {
ID string `json:"id"`
Expand Down
3 changes: 3 additions & 0 deletions account_events.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ type Event struct {
Created *time.Time `json:"-"`
}

// Deprecated: EventsPagedResponse exists for historical compatibility and should not be used.
type EventsPagedResponse legacyPagedResponse[Event]

// EventAction constants start with Action and include all known Linode API Event Actions.
type EventAction string

Expand Down
6 changes: 6 additions & 0 deletions account_invoices.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ type Invoice struct {
Date *time.Time `json:"-"`
}

// Deprecated: InvoicesPagedResponse exists for historical compatibility and should not be used.
type InvoicesPagedResponse legacyPagedResponse[Invoice]

// Deprecated: InvoiceItemsPagedResponse exists for historical compatibility and should not be used.
type InvoiceItemsPagedResponse legacyPagedResponse[InvoiceItem]

// InvoiceItem structs reflect a single billable activity associate with an Invoice
type InvoiceItem struct {
Label string `json:"label"`
Expand Down
3 changes: 3 additions & 0 deletions account_logins.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ type Login struct {
Status string `json:"status"`
}

// Deprecated: LoginsPagedResponse exists for historical compatibility and should not be used.
type LoginsPagedResponse legacyPagedResponse[Login]

func (c *Client) ListLogins(ctx context.Context, opts *ListOptions) ([]Login, error) {
response, err := getPaginatedResults[Login](ctx, c, "account/logins", opts)
if err != nil {
Expand Down
3 changes: 3 additions & 0 deletions account_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type Notification struct {
When *time.Time `json:"-"`
}

// Deprecated: NotificationsPagedResponse exists for historical compatibility and should not be used.
type NotificationsPagedResponse legacyPagedResponse[Notification]

// NotificationEntity adds detailed information about the Notification.
// This could refer to the ticket that triggered the notification, for example.
type NotificationEntity struct {
Expand Down
3 changes: 3 additions & 0 deletions account_oauth_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type OAuthClient struct {
ThumbnailURL *string `json:"thumbnail_url"`
}

// Deprecated: OAuthClientsPagedResponse exists for historical compatibility and should not be used.
type OAuthClientsPagedResponse legacyPagedResponse[OAuthClient]

// OAuthClientCreateOptions fields are those accepted by CreateOAuthClient
type OAuthClientCreateOptions struct {
// The location a successful log in from https://login.linode.com should be redirected to for this client. The receiver of this redirect should be ready to accept an OAuth exchange code and finish the OAuth exchange.
Expand Down
3 changes: 3 additions & 0 deletions account_payments.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ type Payment struct {
Date *time.Time `json:"-"`
}

// Deprecated: PaymentsPagedResponse exists for historical compatibility and should not be used.
type PaymentsPagedResponse legacyPagedResponse[Payment]

// PaymentCreateOptions fields are those accepted by CreatePayment
type PaymentCreateOptions struct {
// CVV (Card Verification Value) of the credit card to be used for the Payment
Expand Down
3 changes: 3 additions & 0 deletions account_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type User struct {
VerifiedPhoneNumber *string `json:"verified_phone_number"`
}

// Deprecated: UsersPagedResponse exists for historical compatibility and should not be used.
type UsersPagedResponse legacyPagedResponse[User]

// UserCreateOptions fields are those accepted by CreateUser
type UserCreateOptions struct {
Username string `json:"username"`
Expand Down
3 changes: 3 additions & 0 deletions betas.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type BetaProgram struct {
MoreInfo string `json:"more_info"`
}

// Deprecated: BetaProgramPagedResponse exists for historical compatibility and should not be used.
type BetaProgramPagedResponse legacyPagedResponse[BetaProgram]

// UnmarshalJSON implements the json.Unmarshaler interface
func (beta *BetaProgram) UnmarshalJSON(b []byte) error {
type Mask BetaProgram
Expand Down
9 changes: 9 additions & 0 deletions databases.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ type Database struct {
Updated *time.Time `json:"-"`
}

// Deprecated: DatabasesPagedResponse exists for historical compatibility and should not be used.
type DatabasesPagedResponse legacyPagedResponse[Database]

// Deprecated: DatabaseEnginesPagedResponse exists for historical compatibility and should not be used.
type DatabaseEnginesPagedResponse legacyPagedResponse[DatabaseEngine]

// Deprecated: DatabaseTypesPagedResponse exists for historical compatibility and should not be used.
type DatabaseTypesPagedResponse legacyPagedResponse[DatabaseType]

// DatabaseHost for Primary/Secondary of Database
type DatabaseHost struct {
Primary string `json:"primary"`
Expand Down
3 changes: 3 additions & 0 deletions domain_records.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ type DomainRecord struct {
Tag *string `json:"tag"`
}

// Deprecated: DomainRecordsPagedResponse exists for historical compatibility and should not be used.
type DomainRecordsPagedResponse legacyPagedResponse[DomainRecord]

// DomainRecordCreateOptions fields are those accepted by CreateDomainRecord
type DomainRecordCreateOptions struct {
Type DomainRecordType `json:"type"`
Expand Down
3 changes: 3 additions & 0 deletions domains.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type Domain struct {
TTLSec int `json:"ttl_sec"`
}

// Deprecated: DomainsPagedResponse exists for historical compatibility and should not be used.
type DomainsPagedResponse legacyPagedResponse[Domain]

// DomainZoneFile represents the Zone File of a Domain
type DomainZoneFile struct {
ZoneFile []string `json:"zone_file"`
Expand Down
3 changes: 3 additions & 0 deletions firewall_devices.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ import (
// FirewallDeviceType represents the different kinds of devices governable by a Firewall
type FirewallDeviceType string

// Deprecated: FirewallDevicesPagedResponse exists for historical compatibility and should not be used.
type FirewallDevicesPagedResponse legacyPagedResponse[FirewallDevice]

// FirewallDeviceType constants start with FirewallDevice
const (
FirewallDeviceLinode FirewallDeviceType = "linode"
Expand Down
3 changes: 3 additions & 0 deletions images.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type Image struct {
EOL *time.Time `json:"-"`
}

// Deprecated: ImagesPagedResponse exists for historical compatibility and should not be used.
type ImagesPagedResponse legacyPagedResponse[Image]

// ImageCreateOptions fields are those accepted by CreateImage
type ImageCreateOptions struct {
DiskID int `json:"disk_id"`
Expand Down
5 changes: 5 additions & 0 deletions pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,8 @@ func queryFieldToString(value reflect.Value) (string, error) {
return "", fmt.Errorf("unsupported query param type: %s", value.Type().Name())
}
}

type legacyPagedResponse[T any] struct {
*PageOptions
Data []T `json:"data"`
}

0 comments on commit c8fa872

Please sign in to comment.