Skip to content

Commit

Permalink
Added missing paged response structs
Browse files Browse the repository at this point in the history
  • Loading branch information
ezilber-akamai committed Jul 3, 2024
1 parent c853bab commit b335d2d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 29 deletions.
6 changes: 0 additions & 6 deletions lke_clusters.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,6 @@ func (c *Client) GetLKEVersion(ctx context.Context, version string) (*LKEVersion
return response, nil
}

// LKEClusterAPIEndpointsPagedResponse represents a paginated LKEClusterAPIEndpoints API response
type LKEClusterAPIEndpointsPagedResponse struct {
*PageOptions
Data []LKEClusterAPIEndpoint `json:"data"`
}

// ListLKEClusterAPIEndpoints gets the API Endpoint for the LKE Cluster specified
func (c *Client) ListLKEClusterAPIEndpoints(ctx context.Context, clusterID int, opts *ListOptions) ([]LKEClusterAPIEndpoint, error) {
response, err := getPaginatedResults[LKEClusterAPIEndpoint](ctx, c, formatAPIPath("lke/clusters/%d/api-endpoints", clusterID), opts)
Expand Down
23 changes: 0 additions & 23 deletions longview_subscriptions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package linodego

import (
"context"

"github.com/go-resty/resty/v2"
)

// LongviewSubscription represents a LongviewSubscription object
Expand All @@ -16,27 +14,6 @@ type LongviewSubscription struct {
// Updated *time.Time `json:"-"`
}

// LongviewSubscriptionsPagedResponse represents a paginated LongviewSubscription API response
type LongviewSubscriptionsPagedResponse struct {
*PageOptions
Data []LongviewSubscription `json:"data"`
}

// endpoint gets the endpoint URL for LongviewSubscription
func (LongviewSubscriptionsPagedResponse) endpoint(_ ...any) string {
return "longview/subscriptions"
}

func (resp *LongviewSubscriptionsPagedResponse) castResult(r *resty.Request, e string) (int, int, error) {
res, err := coupleAPIErrors(r.SetResult(LongviewSubscriptionsPagedResponse{}).Get(e))
if err != nil {
return 0, 0, err
}
castedRes := res.Result().(*LongviewSubscriptionsPagedResponse)
resp.Data = append(resp.Data, castedRes.Data...)
return castedRes.Pages, castedRes.Results, nil
}

// ListLongviewSubscriptions lists LongviewSubscriptions
func (c *Client) ListLongviewSubscriptions(ctx context.Context, opts *ListOptions) ([]LongviewSubscription, error) {
response, err := getPaginatedResults[LongviewSubscription](ctx, c, "longview/subscriptions", opts)
Expand Down
28 changes: 28 additions & 0 deletions paged_response_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,37 @@ type InvoiceItemsPagedResponse legacyPagedResponse[InvoiceItem]
// Deprecated: InvoicesPagedResponse exists for historical compatibility and should not be used.
type InvoicesPagedResponse legacyPagedResponse[Invoice]

// Deprecated: LKEClusterPoolsPagedResponse exists for historical compatibility and should not be used.
// LKEClusterPoolsPagedResponse represents a paginated LKEClusterPool API response.
type LKEClusterPoolsPagedResponse LKENodePoolsPagedResponse

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

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

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

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

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

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

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

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

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

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

Expand Down

0 comments on commit b335d2d

Please sign in to comment.