From a9a7dcf954330feb14282bde98c5d878a759871b Mon Sep 17 00:00:00 2001 From: Erik Zilber Date: Wed, 3 Jul 2024 14:02:56 -0400 Subject: [PATCH] Restored legacy PagedResponse structs and added deprecation notice (#539) --- paged_response_structs.go | 55 +++++++++++++++++++++++++++++++++++++++ pagination.go | 5 ++++ 2 files changed, 60 insertions(+) create mode 100644 paged_response_structs.go diff --git a/paged_response_structs.go b/paged_response_structs.go new file mode 100644 index 000000000..cee2a8d4e --- /dev/null +++ b/paged_response_structs.go @@ -0,0 +1,55 @@ +package linodego + +// Deprecated: AccountAvailabilityPagedResponse exists for historical compatibility and should not be used. +type AccountAvailabilityPagedResponse legacyPagedResponse[AccountAvailability] + +// Deprecated: AccountBetasPagedResponse exists for historical compatibility and should not be used. +type AccountBetasPagedResponse legacyPagedResponse[AccountBetaProgram] + +// Deprecated: BetaProgramPagedResponse exists for historical compatibility and should not be used. +type BetaProgramPagedResponse legacyPagedResponse[BetaProgram] + +// 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] + +// Deprecated: DatabasesPagedResponse exists for historical compatibility and should not be used. +type DatabasesPagedResponse legacyPagedResponse[Database] + +// Deprecated: DomainRecordsPagedResponse exists for historical compatibility and should not be used. +type DomainRecordsPagedResponse legacyPagedResponse[DomainRecord] + +// Deprecated: DomainsPagedResponse exists for historical compatibility and should not be used. +type DomainsPagedResponse legacyPagedResponse[Domain] + +// Deprecated: EventsPagedResponse exists for historical compatibility and should not be used. +type EventsPagedResponse legacyPagedResponse[Event] + +// Deprecated: FirewallDevicesPagedResponse exists for historical compatibility and should not be used. +type FirewallDevicesPagedResponse legacyPagedResponse[FirewallDevice] + +// Deprecated: ImagesPagedResponse exists for historical compatibility and should not be used. +type ImagesPagedResponse legacyPagedResponse[Image] + +// Deprecated: InvoiceItemsPagedResponse exists for historical compatibility and should not be used. +type InvoiceItemsPagedResponse legacyPagedResponse[InvoiceItem] + +// Deprecated: InvoicesPagedResponse exists for historical compatibility and should not be used. +type InvoicesPagedResponse legacyPagedResponse[Invoice] + +// Deprecated: LoginsPagedResponse exists for historical compatibility and should not be used. +type LoginsPagedResponse legacyPagedResponse[Login] + +// Deprecated: NotificationsPagedResponse exists for historical compatibility and should not be used. +type NotificationsPagedResponse legacyPagedResponse[Notification] + +// Deprecated: OAuthClientsPagedResponse exists for historical compatibility and should not be used. +type OAuthClientsPagedResponse legacyPagedResponse[OAuthClient] + +// Deprecated: PaymentsPagedResponse exists for historical compatibility and should not be used. +type PaymentsPagedResponse legacyPagedResponse[Payment] + +// Deprecated: UsersPagedResponse exists for historical compatibility and should not be used. +type UsersPagedResponse legacyPagedResponse[User] diff --git a/pagination.go b/pagination.go index 671ef602f..a4b49605b 100644 --- a/pagination.go +++ b/pagination.go @@ -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"` +}