| 119 | } |
| 120 | |
| 121 | func (c *Client) GroupByOrgAndName(ctx context.Context, orgID uuid.UUID, name string) (Group, error) { |
| 122 | res, err := c.Request(ctx, http.MethodGet, |
| 123 | fmt.Sprintf("/api/v2/organizations/%s/groups/%s", orgID.String(), name), |
| 124 | nil, |
| 125 | ) |
| 126 | if err != nil { |
| 127 | return Group{}, xerrors.Errorf("make request: %w", err) |
| 128 | } |
| 129 | defer res.Body.Close() |
| 130 | |
| 131 | if res.StatusCode != http.StatusOK { |
| 132 | return Group{}, ReadBodyAsError(res) |
| 133 | } |
| 134 | var resp Group |
| 135 | return resp, json.NewDecoder(res.Body).Decode(&resp) |
| 136 | } |
| 137 | |
| 138 | type GroupRequest struct { |
| 139 | ExcludeMembers bool `json:"exclude_members"` |