Skip to content

Commit

Permalink
feat(override-plan): Ability to fetch a single subscription (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
rsempe authored Oct 5, 2023
1 parent 6a228c6 commit fd93b99
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,27 @@ func (sr *SubscriptionRequest) Terminate(ctx context.Context, subscriptionTermin
return subscriptionResult.Subscription, nil
}

func (sr *SubscriptionRequest) Get(ctx context.Context, subscriptionExternalId string) (*Subscription, *Error) {
subPath := fmt.Sprintf("%s/%s", "subscriptions", subscriptionExternalId)

clientRequest := &ClientRequest{
Path: subPath,
Result: &SubscriptionResult{},
}

result, err := sr.client.Get(ctx, clientRequest)
if err != nil {
return nil, err
}

subscriptionResult, ok := result.(*SubscriptionResult)
if !ok {
return nil, &ErrorTypeAssert
}

return subscriptionResult.Subscription, nil
}

func (sr *SubscriptionRequest) GetList(ctx context.Context, subscriptionListInput SubscriptionListInput) (*SubscriptionResult, *Error) {
jsonQueryParams, err := json.Marshal(subscriptionListInput)
if err != nil {
Expand Down

0 comments on commit fd93b99

Please sign in to comment.