(ctx context.Context, id string)
| 113 | } |
| 114 | |
| 115 | func (c *eventClient) GetSubscription(ctx context.Context, id string) (*Subscription, error) { |
| 116 | if !SupportedHost(c.host) { |
| 117 | return nil, ErrUnsupportedHost |
| 118 | } |
| 119 | |
| 120 | path, err := safeurl.JoinPath("event-subscriptions", id) |
| 121 | if err != nil { |
| 122 | return nil, err |
| 123 | } |
| 124 | |
| 125 | var sub Subscription |
| 126 | if err := c.api.REST(c.host, http.MethodGet, path.String(), nil, &sub); err != nil { |
| 127 | if httpErr, ok := errors.AsType[api.HTTPError](err); ok { |
| 128 | switch { |
| 129 | case httpErr.StatusCode == http.StatusNotFound: |
| 130 | return nil, fmt.Errorf("%w: %w", ErrSubscriptionNotFound, err) |
| 131 | case httpErr.StatusCode == http.StatusForbidden: |
| 132 | return nil, forbiddenError(httpErr, err) |
| 133 | } |
| 134 | } |
| 135 | return nil, err |
| 136 | } |
| 137 | return &sub, nil |
| 138 | } |
| 139 | |
| 140 | // maxPerPage is the largest page size the list endpoint accepts. |
| 141 | const maxPerPage = 100 |
nothing calls this directly
no test coverage detected