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