diff --git a/client.gen.go b/client.gen.go index 8e75e96..a92178e 100644 --- a/client.gen.go +++ b/client.gen.go @@ -208,6 +208,25 @@ type ClientInterface interface { // GetTeamMemberships request GetTeamMemberships(ctx context.Context, teamName TeamName, params *GetTeamMembershipsParams, reqEditors ...RequestEditorFn) (*http.Response, error) + // ListMonthlyLimitsByTeam request + ListMonthlyLimitsByTeam(ctx context.Context, teamName TeamName, params *ListMonthlyLimitsByTeamParams, reqEditors ...RequestEditorFn) (*http.Response, error) + + // CreateMonthlyLimitWithBody request with any body + CreateMonthlyLimitWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + CreateMonthlyLimit(ctx context.Context, teamName TeamName, body CreateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + + // DeleteMonthlyLimit request + DeleteMonthlyLimit(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*http.Response, error) + + // GetMonthlyLimit request + GetMonthlyLimit(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateMonthlyLimitWithBody request with any body + UpdateMonthlyLimitWithBody(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateMonthlyLimit(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, body UpdateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeletePluginsByTeam request DeletePluginsByTeam(ctx context.Context, teamName TeamName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -763,6 +782,90 @@ func (c *Client) GetTeamMemberships(ctx context.Context, teamName TeamName, para return c.Client.Do(req) } +func (c *Client) ListMonthlyLimitsByTeam(ctx context.Context, teamName TeamName, params *ListMonthlyLimitsByTeamParams, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewListMonthlyLimitsByTeamRequest(c.Server, teamName, params) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateMonthlyLimitWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateMonthlyLimitRequestWithBody(c.Server, teamName, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) CreateMonthlyLimit(ctx context.Context, teamName TeamName, body CreateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewCreateMonthlyLimitRequest(c.Server, teamName, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) DeleteMonthlyLimit(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewDeleteMonthlyLimitRequest(c.Server, teamName, pluginTeam, pluginKind, pluginName) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) GetMonthlyLimit(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetMonthlyLimitRequest(c.Server, teamName, pluginTeam, pluginKind, pluginName) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateMonthlyLimitWithBody(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateMonthlyLimitRequestWithBody(c.Server, teamName, pluginTeam, pluginKind, pluginName, contentType, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + +func (c *Client) UpdateMonthlyLimit(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, body UpdateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateMonthlyLimitRequest(c.Server, teamName, pluginTeam, pluginKind, pluginName, body) + if err != nil { + return nil, err + } + req = req.WithContext(ctx) + if err := c.applyEditors(ctx, req, reqEditors); err != nil { + return nil, err + } + return c.Client.Do(req) +} + func (c *Client) DeletePluginsByTeam(ctx context.Context, teamName TeamName, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeletePluginsByTeamRequest(c.Server, teamName) if err != nil { @@ -2754,42 +2857,8 @@ func NewGetTeamMembershipsRequest(server string, teamName TeamName, params *GetT return req, nil } -// NewDeletePluginsByTeamRequest generates requests for DeletePluginsByTeam -func NewDeletePluginsByTeamRequest(server string, teamName TeamName) (*http.Request, error) { - var err error - - var pathParam0 string - - pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) - if err != nil { - return nil, err - } - - serverURL, err := url.Parse(server) - if err != nil { - return nil, err - } - - operationPath := fmt.Sprintf("/teams/%s/plugins", pathParam0) - if operationPath[0] == '/' { - operationPath = "." + operationPath - } - - queryURL, err := serverURL.Parse(operationPath) - if err != nil { - return nil, err - } - - req, err := http.NewRequest("DELETE", queryURL.String(), nil) - if err != nil { - return nil, err - } - - return req, nil -} - -// NewListPluginsByTeamRequest generates requests for ListPluginsByTeam -func NewListPluginsByTeamRequest(server string, teamName TeamName, params *ListPluginsByTeamParams) (*http.Request, error) { +// NewListMonthlyLimitsByTeamRequest generates requests for ListMonthlyLimitsByTeam +func NewListMonthlyLimitsByTeamRequest(server string, teamName TeamName, params *ListMonthlyLimitsByTeamParams) (*http.Request, error) { var err error var pathParam0 string @@ -2804,7 +2873,7 @@ func NewListPluginsByTeamRequest(server string, teamName TeamName, params *ListP return nil, err } - operationPath := fmt.Sprintf("/teams/%s/plugins", pathParam0) + operationPath := fmt.Sprintf("/teams/%s/monthly-limits", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -2849,22 +2918,6 @@ func NewListPluginsByTeamRequest(server string, teamName TeamName, params *ListP } - if params.IncludePrivate != nil { - - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "include_private", runtime.ParamLocationQuery, *params.IncludePrivate); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } - - } - queryURL.RawQuery = queryValues.Encode() } @@ -2876,8 +2929,19 @@ func NewListPluginsByTeamRequest(server string, teamName TeamName, params *ListP return req, nil } -// NewListUsersByTeamRequest generates requests for ListUsersByTeam -func NewListUsersByTeamRequest(server string, teamName TeamName, params *ListUsersByTeamParams) (*http.Request, error) { +// NewCreateMonthlyLimitRequest calls the generic CreateMonthlyLimit builder with application/json body +func NewCreateMonthlyLimitRequest(server string, teamName TeamName, body CreateMonthlyLimitJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewCreateMonthlyLimitRequestWithBody(server, teamName, "application/json", bodyReader) +} + +// NewCreateMonthlyLimitRequestWithBody generates requests for CreateMonthlyLimit with any type of body +func NewCreateMonthlyLimitRequestWithBody(server string, teamName TeamName, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -2892,7 +2956,7 @@ func NewListUsersByTeamRequest(server string, teamName TeamName, params *ListUse return nil, err } - operationPath := fmt.Sprintf("/teams/%s/users", pathParam0) + operationPath := fmt.Sprintf("/teams/%s/monthly-limits", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -2902,62 +2966,54 @@ func NewListUsersByTeamRequest(server string, teamName TeamName, params *ListUse return nil, err } - if params != nil { - queryValues := queryURL.Query() + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } - if params.PerPage != nil { + req.Header.Add("Content-Type", contentType) - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "per_page", runtime.ParamLocationQuery, *params.PerPage); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } + return req, nil +} - } +// NewDeleteMonthlyLimitRequest generates requests for DeleteMonthlyLimit +func NewDeleteMonthlyLimitRequest(server string, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName) (*http.Request, error) { + var err error - if params.Page != nil { + var pathParam0 string - if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { - return nil, err - } else if parsed, err := url.ParseQuery(queryFrag); err != nil { - return nil, err - } else { - for k, v := range parsed { - for _, v2 := range v { - queryValues.Add(k, v2) - } - } - } + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } - } + var pathParam1 string - queryURL.RawQuery = queryValues.Encode() + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "plugin_team", runtime.ParamLocationPath, pluginTeam) + if err != nil { + return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "plugin_kind", runtime.ParamLocationPath, pluginKind) if err != nil { return nil, err } - return req, nil -} + var pathParam3 string -// NewUploadImageRequest generates requests for UploadImage -func NewUploadImageRequest(server string) (*http.Request, error) { - var err error + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "plugin_name", runtime.ParamLocationPath, pluginName) + if err != nil { + return nil, err + } serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/upload/image") + operationPath := fmt.Sprintf("/teams/%s/monthly-limits/%s/%s/%s", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -2967,7 +3023,7 @@ func NewUploadImageRequest(server string) (*http.Request, error) { return nil, err } - req, err := http.NewRequest("POST", queryURL.String(), nil) + req, err := http.NewRequest("DELETE", queryURL.String(), nil) if err != nil { return nil, err } @@ -2975,54 +3031,44 @@ func NewUploadImageRequest(server string) (*http.Request, error) { return req, nil } -// NewGetCurrentUserRequest generates requests for GetCurrentUser -func NewGetCurrentUserRequest(server string) (*http.Request, error) { +// NewGetMonthlyLimitRequest generates requests for GetMonthlyLimit +func NewGetMonthlyLimitRequest(server string, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName) (*http.Request, error) { var err error - serverURL, err := url.Parse(server) + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/user") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + var pathParam1 string - queryURL, err := serverURL.Parse(operationPath) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "plugin_team", runtime.ParamLocationPath, pluginTeam) if err != nil { return nil, err } - req, err := http.NewRequest("GET", queryURL.String(), nil) + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "plugin_kind", runtime.ParamLocationPath, pluginKind) if err != nil { return nil, err } - return req, nil -} + var pathParam3 string -// NewUpdateCurrentUserRequest calls the generic UpdateCurrentUser builder with application/json body -func NewUpdateCurrentUserRequest(server string, body UpdateCurrentUserJSONRequestBody) (*http.Request, error) { - var bodyReader io.Reader - buf, err := json.Marshal(body) + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "plugin_name", runtime.ParamLocationPath, pluginName) if err != nil { return nil, err } - bodyReader = bytes.NewReader(buf) - return NewUpdateCurrentUserRequestWithBody(server, "application/json", bodyReader) -} - -// NewUpdateCurrentUserRequestWithBody generates requests for UpdateCurrentUser with any type of body -func NewUpdateCurrentUserRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { - var err error serverURL, err := url.Parse(server) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/user") + operationPath := fmt.Sprintf("/teams/%s/monthly-limits/%s/%s/%s", pathParam0, pathParam1, pathParam2, pathParam3) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -3032,36 +3078,390 @@ func NewUpdateCurrentUserRequestWithBody(server string, contentType string, body return nil, err } - req, err := http.NewRequest("PATCH", queryURL.String(), body) + req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { return nil, err } - req.Header.Add("Content-Type", contentType) - return req, nil } -// NewListCurrentUserInvitationsRequest generates requests for ListCurrentUserInvitations -func NewListCurrentUserInvitationsRequest(server string, params *ListCurrentUserInvitationsParams) (*http.Request, error) { +// NewUpdateMonthlyLimitRequest calls the generic UpdateMonthlyLimit builder with application/json body +func NewUpdateMonthlyLimitRequest(server string, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, body UpdateMonthlyLimitJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateMonthlyLimitRequestWithBody(server, teamName, pluginTeam, pluginKind, pluginName, "application/json", bodyReader) +} + +// NewUpdateMonthlyLimitRequestWithBody generates requests for UpdateMonthlyLimit with any type of body +func NewUpdateMonthlyLimitRequestWithBody(server string, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, contentType string, body io.Reader) (*http.Request, error) { var err error - serverURL, err := url.Parse(server) + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) if err != nil { return nil, err } - operationPath := fmt.Sprintf("/user/invitations") - if operationPath[0] == '/' { - operationPath = "." + operationPath - } + var pathParam1 string - queryURL, err := serverURL.Parse(operationPath) + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "plugin_team", runtime.ParamLocationPath, pluginTeam) if err != nil { return nil, err } - if params != nil { + var pathParam2 string + + pathParam2, err = runtime.StyleParamWithLocation("simple", false, "plugin_kind", runtime.ParamLocationPath, pluginKind) + if err != nil { + return nil, err + } + + var pathParam3 string + + pathParam3, err = runtime.StyleParamWithLocation("simple", false, "plugin_name", runtime.ParamLocationPath, pluginName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/monthly-limits/%s/%s/%s", pathParam0, pathParam1, pathParam2, pathParam3) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PUT", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewDeletePluginsByTeamRequest generates requests for DeletePluginsByTeam +func NewDeletePluginsByTeamRequest(server string, teamName TeamName) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/plugins", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("DELETE", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListPluginsByTeamRequest generates requests for ListPluginsByTeam +func NewListPluginsByTeamRequest(server string, teamName TeamName, params *ListPluginsByTeamParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/plugins", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.PerPage != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "per_page", runtime.ParamLocationQuery, *params.PerPage); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.IncludePrivate != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "include_private", runtime.ParamLocationQuery, *params.IncludePrivate); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewListUsersByTeamRequest generates requests for ListUsersByTeam +func NewListUsersByTeamRequest(server string, teamName TeamName, params *ListUsersByTeamParams) (*http.Request, error) { + var err error + + var pathParam0 string + + pathParam0, err = runtime.StyleParamWithLocation("simple", false, "team_name", runtime.ParamLocationPath, teamName) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/users", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { + queryValues := queryURL.Query() + + if params.PerPage != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "per_page", runtime.ParamLocationQuery, *params.PerPage); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + if params.Page != nil { + + if queryFrag, err := runtime.StyleParamWithLocation("form", true, "page", runtime.ParamLocationQuery, *params.Page); err != nil { + return nil, err + } else if parsed, err := url.ParseQuery(queryFrag); err != nil { + return nil, err + } else { + for k, v := range parsed { + for _, v2 := range v { + queryValues.Add(k, v2) + } + } + } + + } + + queryURL.RawQuery = queryValues.Encode() + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUploadImageRequest generates requests for UploadImage +func NewUploadImageRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/upload/image") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewGetCurrentUserRequest generates requests for GetCurrentUser +func NewGetCurrentUserRequest(server string) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/user") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("GET", queryURL.String(), nil) + if err != nil { + return nil, err + } + + return req, nil +} + +// NewUpdateCurrentUserRequest calls the generic UpdateCurrentUser builder with application/json body +func NewUpdateCurrentUserRequest(server string, body UpdateCurrentUserJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateCurrentUserRequestWithBody(server, "application/json", bodyReader) +} + +// NewUpdateCurrentUserRequestWithBody generates requests for UpdateCurrentUser with any type of body +func NewUpdateCurrentUserRequestWithBody(server string, contentType string, body io.Reader) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/user") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("PATCH", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + +// NewListCurrentUserInvitationsRequest generates requests for ListCurrentUserInvitations +func NewListCurrentUserInvitationsRequest(server string, params *ListCurrentUserInvitationsParams) (*http.Request, error) { + var err error + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/user/invitations") + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + if params != nil { queryValues := queryURL.Query() if params.Page != nil { @@ -3334,6 +3734,25 @@ type ClientWithResponsesInterface interface { // GetTeamMembershipsWithResponse request GetTeamMembershipsWithResponse(ctx context.Context, teamName TeamName, params *GetTeamMembershipsParams, reqEditors ...RequestEditorFn) (*GetTeamMembershipsResponse, error) + // ListMonthlyLimitsByTeamWithResponse request + ListMonthlyLimitsByTeamWithResponse(ctx context.Context, teamName TeamName, params *ListMonthlyLimitsByTeamParams, reqEditors ...RequestEditorFn) (*ListMonthlyLimitsByTeamResponse, error) + + // CreateMonthlyLimitWithBodyWithResponse request with any body + CreateMonthlyLimitWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMonthlyLimitResponse, error) + + CreateMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, body CreateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMonthlyLimitResponse, error) + + // DeleteMonthlyLimitWithResponse request + DeleteMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*DeleteMonthlyLimitResponse, error) + + // GetMonthlyLimitWithResponse request + GetMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*GetMonthlyLimitResponse, error) + + // UpdateMonthlyLimitWithBodyWithResponse request with any body + UpdateMonthlyLimitWithBodyWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateMonthlyLimitResponse, error) + + UpdateMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, body UpdateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateMonthlyLimitResponse, error) + // DeletePluginsByTeamWithResponse request DeletePluginsByTeamWithResponse(ctx context.Context, teamName TeamName, reqEditors ...RequestEditorFn) (*DeletePluginsByTeamResponse, error) @@ -4107,8 +4526,8 @@ func (r EmailTeamInvitationResponse) StatusCode() int { type AcceptTeamInvitationResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *Membership - JSON303 *Membership + JSON201 *MembershipWithTeam + JSON303 *MembershipWithTeam JSON403 *Forbidden JSON500 *InternalError } @@ -4159,8 +4578,8 @@ type GetTeamMembershipsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { - Items []Membership `json:"items"` - Metadata ListMetadata `json:"metadata"` + Items []MembershipWithUser `json:"items"` + Metadata ListMetadata `json:"metadata"` } JSON400 *BadRequest JSON401 *RequiresAuthentication @@ -4185,6 +4604,140 @@ func (r GetTeamMembershipsResponse) StatusCode() int { return 0 } +type ListMonthlyLimitsByTeamResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *struct { + Items []MonthlyLimit `json:"items"` + Metadata ListMetadata `json:"metadata"` + } + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r ListMonthlyLimitsByTeamResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r ListMonthlyLimitsByTeamResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type CreateMonthlyLimitResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *MonthlyLimit + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON422 *UnprocessableEntity + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r CreateMonthlyLimitResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r CreateMonthlyLimitResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type DeleteMonthlyLimitResponse struct { + Body []byte + HTTPResponse *http.Response + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r DeleteMonthlyLimitResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteMonthlyLimitResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetMonthlyLimitResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *MonthlyLimit + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r GetMonthlyLimitResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetMonthlyLimitResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type UpdateMonthlyLimitResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *MonthlyLimit + JSON400 *BadRequest + JSON401 *RequiresAuthentication + JSON403 *Forbidden + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r UpdateMonthlyLimitResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateMonthlyLimitResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type DeletePluginsByTeamResponse struct { Body []byte HTTPResponse *http.Response @@ -4220,6 +4773,7 @@ type ListPluginsByTeamResponse struct { } JSON401 *RequiresAuthentication JSON403 *Forbidden + JSON404 *NotFound JSON500 *InternalError } @@ -4374,8 +4928,8 @@ type GetCurrentUserMembershipsResponse struct { Body []byte HTTPResponse *http.Response JSON200 *struct { - Items []Membership `json:"items"` - Metadata ListMetadata `json:"metadata"` + Items []MembershipWithTeam `json:"items"` + Metadata ListMetadata `json:"metadata"` } JSON401 *RequiresAuthentication JSON403 *Forbidden @@ -4781,6 +5335,67 @@ func (c *ClientWithResponses) GetTeamMembershipsWithResponse(ctx context.Context return ParseGetTeamMembershipsResponse(rsp) } +// ListMonthlyLimitsByTeamWithResponse request returning *ListMonthlyLimitsByTeamResponse +func (c *ClientWithResponses) ListMonthlyLimitsByTeamWithResponse(ctx context.Context, teamName TeamName, params *ListMonthlyLimitsByTeamParams, reqEditors ...RequestEditorFn) (*ListMonthlyLimitsByTeamResponse, error) { + rsp, err := c.ListMonthlyLimitsByTeam(ctx, teamName, params, reqEditors...) + if err != nil { + return nil, err + } + return ParseListMonthlyLimitsByTeamResponse(rsp) +} + +// CreateMonthlyLimitWithBodyWithResponse request with arbitrary body returning *CreateMonthlyLimitResponse +func (c *ClientWithResponses) CreateMonthlyLimitWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*CreateMonthlyLimitResponse, error) { + rsp, err := c.CreateMonthlyLimitWithBody(ctx, teamName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateMonthlyLimitResponse(rsp) +} + +func (c *ClientWithResponses) CreateMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, body CreateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateMonthlyLimitResponse, error) { + rsp, err := c.CreateMonthlyLimit(ctx, teamName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseCreateMonthlyLimitResponse(rsp) +} + +// DeleteMonthlyLimitWithResponse request returning *DeleteMonthlyLimitResponse +func (c *ClientWithResponses) DeleteMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*DeleteMonthlyLimitResponse, error) { + rsp, err := c.DeleteMonthlyLimit(ctx, teamName, pluginTeam, pluginKind, pluginName, reqEditors...) + if err != nil { + return nil, err + } + return ParseDeleteMonthlyLimitResponse(rsp) +} + +// GetMonthlyLimitWithResponse request returning *GetMonthlyLimitResponse +func (c *ClientWithResponses) GetMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, reqEditors ...RequestEditorFn) (*GetMonthlyLimitResponse, error) { + rsp, err := c.GetMonthlyLimit(ctx, teamName, pluginTeam, pluginKind, pluginName, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetMonthlyLimitResponse(rsp) +} + +// UpdateMonthlyLimitWithBodyWithResponse request with arbitrary body returning *UpdateMonthlyLimitResponse +func (c *ClientWithResponses) UpdateMonthlyLimitWithBodyWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateMonthlyLimitResponse, error) { + rsp, err := c.UpdateMonthlyLimitWithBody(ctx, teamName, pluginTeam, pluginKind, pluginName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateMonthlyLimitResponse(rsp) +} + +func (c *ClientWithResponses) UpdateMonthlyLimitWithResponse(ctx context.Context, teamName TeamName, pluginTeam PluginTeam, pluginKind PluginKind, pluginName PluginName, body UpdateMonthlyLimitJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateMonthlyLimitResponse, error) { + rsp, err := c.UpdateMonthlyLimit(ctx, teamName, pluginTeam, pluginKind, pluginName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateMonthlyLimitResponse(rsp) +} + // DeletePluginsByTeamWithResponse request returning *DeletePluginsByTeamResponse func (c *ClientWithResponses) DeletePluginsByTeamWithResponse(ctx context.Context, teamName TeamName, reqEditors ...RequestEditorFn) (*DeletePluginsByTeamResponse, error) { rsp, err := c.DeletePluginsByTeam(ctx, teamName, reqEditors...) @@ -5894,14 +6509,233 @@ func ParseListTeamsResponse(rsp *http.Response) (*ListTeamsResponse, error) { if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON403 = &dest + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseCreateTeamResponse parses an HTTP response from a CreateTeamWithResponse call +func ParseCreateTeamResponse(rsp *http.Response) (*CreateTeamResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &CreateTeamResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest Team + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest UnprocessableEntity + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON422 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseGetTeamByNameResponse parses an HTTP response from a GetTeamByNameWithResponse call +func ParseGetTeamByNameResponse(rsp *http.Response) (*GetTeamByNameResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetTeamByNameResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Team + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseUpdateTeamResponse parses an HTTP response from a UpdateTeamWithResponse call +func ParseUpdateTeamResponse(rsp *http.Response) (*UpdateTeamResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdateTeamResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Team + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + +// ParseListTeamAPIKeysResponse parses an HTTP response from a ListTeamAPIKeysWithResponse call +func ParseListTeamAPIKeysResponse(rsp *http.Response) (*ListTeamAPIKeysResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &ListTeamAPIKeysResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Items []APIKey `json:"items"` + Metadata ListMetadata `json:"metadata"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest NotFound + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON404 = &dest + response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError @@ -5915,22 +6749,22 @@ func ParseListTeamsResponse(rsp *http.Response) (*ListTeamsResponse, error) { return response, nil } -// ParseCreateTeamResponse parses an HTTP response from a CreateTeamWithResponse call -func ParseCreateTeamResponse(rsp *http.Response) (*CreateTeamResponse, error) { +// ParseCreateTeamAPIKeyResponse parses an HTTP response from a CreateTeamAPIKeyWithResponse call +func ParseCreateTeamAPIKeyResponse(rsp *http.Response) (*CreateTeamAPIKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateTeamResponse{ + response := &CreateTeamAPIKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Team + var dest APIKey if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -5969,27 +6803,20 @@ func ParseCreateTeamResponse(rsp *http.Response) (*CreateTeamResponse, error) { return response, nil } -// ParseGetTeamByNameResponse parses an HTTP response from a GetTeamByNameWithResponse call -func ParseGetTeamByNameResponse(rsp *http.Response) (*GetTeamByNameResponse, error) { +// ParseDeleteTeamAPIKeyResponse parses an HTTP response from a DeleteTeamAPIKeyWithResponse call +func ParseDeleteTeamAPIKeyResponse(rsp *http.Response) (*DeleteTeamAPIKeyResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetTeamByNameResponse{ + response := &DeleteTeamAPIKeyResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Team - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6004,13 +6831,6 @@ func ParseGetTeamByNameResponse(rsp *http.Response) (*GetTeamByNameResponse, err } response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Forbidden - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6030,54 +6850,83 @@ func ParseGetTeamByNameResponse(rsp *http.Response) (*GetTeamByNameResponse, err return response, nil } -// ParseUpdateTeamResponse parses an HTTP response from a UpdateTeamWithResponse call -func ParseUpdateTeamResponse(rsp *http.Response) (*UpdateTeamResponse, error) { +// ParseListTeamInvitationsResponse parses an HTTP response from a ListTeamInvitationsWithResponse call +func ParseListTeamInvitationsResponse(rsp *http.Response) (*ListTeamInvitationsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &UpdateTeamResponse{ + response := &ListTeamInvitationsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Team + var dest struct { + Items []Invitation `json:"items"` + Metadata ListMetadata `json:"metadata"` + } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest BadRequest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON400 = &dest + response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest RequiresAuthentication + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: + var dest InternalError if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON500 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Forbidden + } + + return response, nil +} + +// ParseEmailTeamInvitationResponse parses an HTTP response from a EmailTeamInvitationWithResponse call +func ParseEmailTeamInvitationResponse(rsp *http.Response) (*EmailTeamInvitationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &EmailTeamInvitationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest Invitation if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON403 = &dest + response.JSON200 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: - var dest NotFound + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: + var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON404 = &dest + response.JSON400 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError @@ -6091,36 +6940,40 @@ func ParseUpdateTeamResponse(rsp *http.Response) (*UpdateTeamResponse, error) { return response, nil } -// ParseListTeamAPIKeysResponse parses an HTTP response from a ListTeamAPIKeysWithResponse call -func ParseListTeamAPIKeysResponse(rsp *http.Response) (*ListTeamAPIKeysResponse, error) { +// ParseAcceptTeamInvitationResponse parses an HTTP response from a AcceptTeamInvitationWithResponse call +func ParseAcceptTeamInvitationResponse(rsp *http.Response) (*AcceptTeamInvitationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListTeamAPIKeysResponse{ + response := &AcceptTeamInvitationResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Items []APIKey `json:"items"` - Metadata ListMetadata `json:"metadata"` + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest MembershipWithTeam + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err } + response.JSON201 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 303: + var dest MembershipWithTeam if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON303 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: - var dest RequiresAuthentication + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON401 = &dest + response.JSON403 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError @@ -6134,27 +6987,20 @@ func ParseListTeamAPIKeysResponse(rsp *http.Response) (*ListTeamAPIKeysResponse, return response, nil } -// ParseCreateTeamAPIKeyResponse parses an HTTP response from a CreateTeamAPIKeyWithResponse call -func ParseCreateTeamAPIKeyResponse(rsp *http.Response) (*CreateTeamAPIKeyResponse, error) { +// ParseCancelTeamInvitationResponse parses an HTTP response from a CancelTeamInvitationWithResponse call +func ParseCancelTeamInvitationResponse(rsp *http.Response) (*CancelTeamInvitationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CreateTeamAPIKeyResponse{ + response := &CancelTeamInvitationResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest APIKey - if err := json.Unmarshal(bodyBytes, &dest); err != nil { - return nil, err - } - response.JSON201 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6169,12 +7015,19 @@ func ParseCreateTeamAPIKeyResponse(rsp *http.Response) (*CreateTeamAPIKeyRespons } response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: - var dest UnprocessableEntity + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON422 = &dest + response.JSON403 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError @@ -6188,20 +7041,30 @@ func ParseCreateTeamAPIKeyResponse(rsp *http.Response) (*CreateTeamAPIKeyRespons return response, nil } -// ParseDeleteTeamAPIKeyResponse parses an HTTP response from a DeleteTeamAPIKeyWithResponse call -func ParseDeleteTeamAPIKeyResponse(rsp *http.Response) (*DeleteTeamAPIKeyResponse, error) { +// ParseGetTeamMembershipsResponse parses an HTTP response from a GetTeamMembershipsWithResponse call +func ParseGetTeamMembershipsResponse(rsp *http.Response) (*GetTeamMembershipsResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &DeleteTeamAPIKeyResponse{ + response := &GetTeamMembershipsResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest struct { + Items []MembershipWithUser `json:"items"` + Metadata ListMetadata `json:"metadata"` + } + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: var dest BadRequest if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6216,6 +7079,13 @@ func ParseDeleteTeamAPIKeyResponse(rsp *http.Response) (*DeleteTeamAPIKeyRespons } response.JSON401 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6235,15 +7105,15 @@ func ParseDeleteTeamAPIKeyResponse(rsp *http.Response) (*DeleteTeamAPIKeyRespons return response, nil } -// ParseListTeamInvitationsResponse parses an HTTP response from a ListTeamInvitationsWithResponse call -func ParseListTeamInvitationsResponse(rsp *http.Response) (*ListTeamInvitationsResponse, error) { +// ParseListMonthlyLimitsByTeamResponse parses an HTTP response from a ListMonthlyLimitsByTeamWithResponse call +func ParseListMonthlyLimitsByTeamResponse(rsp *http.Response) (*ListMonthlyLimitsByTeamResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &ListTeamInvitationsResponse{ + response := &ListMonthlyLimitsByTeamResponse{ Body: bodyBytes, HTTPResponse: rsp, } @@ -6251,14 +7121,21 @@ func ParseListTeamInvitationsResponse(rsp *http.Response) (*ListTeamInvitationsR switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { - Items []Invitation `json:"items"` - Metadata ListMetadata `json:"metadata"` + Items []MonthlyLimit `json:"items"` + Metadata ListMetadata `json:"metadata"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } response.JSON200 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON401 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest Forbidden if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6266,6 +7143,13 @@ func ParseListTeamInvitationsResponse(rsp *http.Response) (*ListTeamInvitationsR } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6278,33 +7162,33 @@ func ParseListTeamInvitationsResponse(rsp *http.Response) (*ListTeamInvitationsR return response, nil } -// ParseEmailTeamInvitationResponse parses an HTTP response from a EmailTeamInvitationWithResponse call -func ParseEmailTeamInvitationResponse(rsp *http.Response) (*EmailTeamInvitationResponse, error) { +// ParseCreateMonthlyLimitResponse parses an HTTP response from a CreateMonthlyLimitWithResponse call +func ParseCreateMonthlyLimitResponse(rsp *http.Response) (*CreateMonthlyLimitResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &EmailTeamInvitationResponse{ + response := &CreateMonthlyLimitResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest Invitation + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest MonthlyLimit if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON200 = &dest + response.JSON201 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest BadRequest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON400 = &dest + response.JSON401 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: var dest Forbidden @@ -6313,6 +7197,20 @@ func ParseEmailTeamInvitationResponse(rsp *http.Response) (*EmailTeamInvitationR } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 422: + var dest UnprocessableEntity + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON422 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6325,40 +7223,40 @@ func ParseEmailTeamInvitationResponse(rsp *http.Response) (*EmailTeamInvitationR return response, nil } -// ParseAcceptTeamInvitationResponse parses an HTTP response from a AcceptTeamInvitationWithResponse call -func ParseAcceptTeamInvitationResponse(rsp *http.Response) (*AcceptTeamInvitationResponse, error) { +// ParseDeleteMonthlyLimitResponse parses an HTTP response from a DeleteMonthlyLimitWithResponse call +func ParseDeleteMonthlyLimitResponse(rsp *http.Response) (*DeleteMonthlyLimitResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &AcceptTeamInvitationResponse{ + response := &DeleteMonthlyLimitResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest Membership + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: + var dest RequiresAuthentication if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON201 = &dest + response.JSON401 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 303: - var dest Membership + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: + var dest Forbidden if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON303 = &dest + response.JSON403 = &dest - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 403: - var dest Forbidden + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON403 = &dest + response.JSON404 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError @@ -6372,26 +7270,26 @@ func ParseAcceptTeamInvitationResponse(rsp *http.Response) (*AcceptTeamInvitatio return response, nil } -// ParseCancelTeamInvitationResponse parses an HTTP response from a CancelTeamInvitationWithResponse call -func ParseCancelTeamInvitationResponse(rsp *http.Response) (*CancelTeamInvitationResponse, error) { +// ParseGetMonthlyLimitResponse parses an HTTP response from a GetMonthlyLimitWithResponse call +func ParseGetMonthlyLimitResponse(rsp *http.Response) (*GetMonthlyLimitResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &CancelTeamInvitationResponse{ + response := &GetMonthlyLimitResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { - case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 400: - var dest BadRequest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest MonthlyLimit if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } - response.JSON400 = &dest + response.JSON200 = &dest case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 401: var dest RequiresAuthentication @@ -6426,25 +7324,22 @@ func ParseCancelTeamInvitationResponse(rsp *http.Response) (*CancelTeamInvitatio return response, nil } -// ParseGetTeamMembershipsResponse parses an HTTP response from a GetTeamMembershipsWithResponse call -func ParseGetTeamMembershipsResponse(rsp *http.Response) (*GetTeamMembershipsResponse, error) { +// ParseUpdateMonthlyLimitResponse parses an HTTP response from a UpdateMonthlyLimitWithResponse call +func ParseUpdateMonthlyLimitResponse(rsp *http.Response) (*UpdateMonthlyLimitResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &GetTeamMembershipsResponse{ + response := &UpdateMonthlyLimitResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: - var dest struct { - Items []Membership `json:"items"` - Metadata ListMetadata `json:"metadata"` - } + var dest MonthlyLimit if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -6582,6 +7477,13 @@ func ParseListPluginsByTeamResponse(rsp *http.Response) (*ListPluginsByTeamRespo } response.JSON403 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 404: + var dest NotFound + if err := json.Unmarshal(bodyBytes, &dest); err != nil { + return nil, err + } + response.JSON404 = &dest + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 500: var dest InternalError if err := json.Unmarshal(bodyBytes, &dest); err != nil { @@ -6851,8 +7753,8 @@ func ParseGetCurrentUserMembershipsResponse(rsp *http.Response) (*GetCurrentUser switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: var dest struct { - Items []Membership `json:"items"` - Metadata ListMetadata `json:"metadata"` + Items []MembershipWithTeam `json:"items"` + Metadata ListMetadata `json:"metadata"` } if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err diff --git a/models.gen.go b/models.gen.go index 1ca6e27..dcefc16 100644 --- a/models.gen.go +++ b/models.gen.go @@ -107,14 +107,6 @@ type APIKeyName = string // APIKeyScope Scope of permissions for the API key. API keys are used for creating new plugin versions and downloading existing plugins type APIKeyScope string -// BadRequestError defines model for BadRequestError. -type BadRequestError struct { - Errors *[]string `json:"errors,omitempty"` - FieldErrors *map[string]string `json:"field_errors,omitempty"` - Message string `json:"message"` - Status int `json:"status"` -} - // BasicError Basic Error type BasicError struct { Message string `json:"message"` @@ -124,6 +116,14 @@ type BasicError struct { // Email defines model for Email. type Email = openapi_types.Email +// FieldError defines model for FieldError. +type FieldError struct { + Errors *[]string `json:"errors,omitempty"` + FieldErrors *map[string]string `json:"field_errors,omitempty"` + Message string `json:"message"` + Status int `json:"status"` +} + // ImageURL defines model for ImageURL. type ImageURL struct { DownloadUrl string `json:"download_url"` @@ -159,17 +159,64 @@ type ListMetadata struct { TotalCount *int `json:"total_count,omitempty"` } -// Membership defines model for Membership. -type Membership struct { +// MembershipWithTeam defines model for MembershipWithTeam. +type MembershipWithTeam struct { Role string `json:"role"` // Team CloudQuery Team Team *Team `json:"team,omitempty"` +} + +// MembershipWithUser defines model for MembershipWithUser. +type MembershipWithUser struct { + Role string `json:"role"` // User CloudQuery User User *User `json:"user,omitempty"` } +// MonthlyLimit A configurable monthly limit for plugin usage. +type MonthlyLimit struct { + // CreatedAt The date and time the plugin limit was created. + CreatedAt time.Time `json:"created_at"` + + // PluginKind The kind of plugin, ie. source or destination. + PluginKind PluginKind `json:"plugin_kind"` + + // PluginName The unique name for the plugin. + PluginName PluginName `json:"plugin_name"` + + // PluginTeam The unique name for the team. + PluginTeam TeamName `json:"plugin_team"` + + // UpdatedAt The date and time the plugin limit was last updated. + UpdatedAt time.Time `json:"updated_at"` + + // Usd The maximum USD amount the plugin is allowed to use within a calendar month. + USD int `json:"usd"` +} + +// MonthlyLimitCreate A configurable monthly limit for plugin usage. +type MonthlyLimitCreate struct { + // PluginKind The kind of plugin, ie. source or destination. + PluginKind PluginKind `json:"plugin_kind"` + + // PluginName The unique name for the plugin. + PluginName PluginName `json:"plugin_name"` + + // PluginTeam The unique name for the team. + PluginTeam TeamName `json:"plugin_team"` + + // Usd The maximum USD amount the plugin is allowed to use within a calendar month. + USD int `json:"usd"` +} + +// MonthlyLimitUpdate A configurable monthly limit for plugin usage. +type MonthlyLimitUpdate struct { + // Usd The maximum USD amount the plugin is allowed to use within a calendar month. + USD int `json:"usd"` +} + // Plugin CloudQuery Plugin type Plugin struct { // Category Supported categories for plugins @@ -472,14 +519,6 @@ type Team struct { // TeamName The unique name for the team. type TeamName = string -// UnprocessableEntityError defines model for UnprocessableEntityError. -type UnprocessableEntityError struct { - Errors *[]string `json:"errors,omitempty"` - FieldErrors *map[string]string `json:"field_errors,omitempty"` - Message string `json:"message"` - Status int `json:"status"` -} - // User CloudQuery User type User struct { CreatedAt *time.Time `json:"created_at,omitempty"` @@ -514,6 +553,9 @@ type PerPage = int64 // PluginSortBy defines model for plugin_sort_by. type PluginSortBy string +// PluginTeam The unique name for the team. +type PluginTeam = TeamName + // TargetName defines model for target_name. type TargetName = string @@ -521,10 +563,10 @@ type TargetName = string type VersionSortBy string // BadRequest defines model for BadRequest. -type BadRequest = BadRequestError +type BadRequest = FieldError -// Forbidden Basic Error -type Forbidden = BasicError +// Forbidden defines model for Forbidden. +type Forbidden = FieldError // InternalError Basic Error type InternalError = BasicError @@ -542,7 +584,7 @@ type RequiresAuthentication = BasicError type TooManyRequests = BasicError // UnprocessableEntity defines model for UnprocessableEntity. -type UnprocessableEntity = UnprocessableEntityError +type UnprocessableEntity = FieldError // ListPluginsParams defines parameters for ListPlugins. type ListPluginsParams struct { @@ -712,6 +754,15 @@ type GetTeamMembershipsParams struct { PerPage *PerPage `form:"per_page,omitempty" json:"per_page,omitempty"` } +// ListMonthlyLimitsByTeamParams defines parameters for ListMonthlyLimitsByTeam. +type ListMonthlyLimitsByTeamParams struct { + // Page Page number of the results to fetch + Page *Page `form:"page,omitempty" json:"page,omitempty"` + + // PerPage The number of results per page (max 1000). + PerPage *PerPage `form:"per_page,omitempty" json:"per_page,omitempty"` +} + // ListPluginsByTeamParams defines parameters for ListPluginsByTeam. type ListPluginsByTeamParams struct { // Page Page number of the results to fetch @@ -796,5 +847,11 @@ type EmailTeamInvitationJSONRequestBody EmailTeamInvitationJSONBody // AcceptTeamInvitationJSONRequestBody defines body for AcceptTeamInvitation for application/json ContentType. type AcceptTeamInvitationJSONRequestBody AcceptTeamInvitationJSONBody +// CreateMonthlyLimitJSONRequestBody defines body for CreateMonthlyLimit for application/json ContentType. +type CreateMonthlyLimitJSONRequestBody = MonthlyLimitCreate + +// UpdateMonthlyLimitJSONRequestBody defines body for UpdateMonthlyLimit for application/json ContentType. +type UpdateMonthlyLimitJSONRequestBody = MonthlyLimitUpdate + // UpdateCurrentUserJSONRequestBody defines body for UpdateCurrentUser for application/json ContentType. type UpdateCurrentUserJSONRequestBody UpdateCurrentUserJSONBody diff --git a/spec.json b/spec.json index 8bce0f2..62ec924 100644 --- a/spec.json +++ b/spec.json @@ -43,6 +43,9 @@ }, { "name": "healthcheck" + }, + { + "name": "limits" } ], "paths": { @@ -1458,6 +1461,9 @@ "403": { "$ref": "#/components/responses/Forbidden" }, + "404": { + "$ref": "#/components/responses/NotFound" + }, "500": { "$ref": "#/components/responses/InternalError" } @@ -1527,17 +1533,12 @@ "properties": { "items": { "items": { - "$ref": "#/components/schemas/Membership" + "$ref": "#/components/schemas/MembershipWithUser" }, "type": "array", "example": [ { "role": "admin", - "team": { - "created_at": "2017-07-14T16:53:42Z", - "name": "cloudquery", - "display_name": "CloudQuery" - }, "user": { "created_at": "2017-07-14T16:53:42Z", "email": "user@clouduery.io", @@ -1578,6 +1579,264 @@ ] } }, + "/teams/{team_name}/monthly-limits": { + "get": { + "description": "List all monthly limits for the team.", + "operationId": "ListMonthlyLimitsByTeam", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/per_page" + } + ], + "responses": { + "200": { + "description": "List of monthly limits for the team.", + "content": { + "application/json": { + "schema": { + "required": [ + "items", + "metadata" + ], + "properties": { + "items": { + "items": { + "$ref": "#/components/schemas/MonthlyLimit" + }, + "type": "array" + }, + "metadata": { + "$ref": "#/components/schemas/ListMetadata" + } + } + } + } + } + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams", + "plugins", + "limits" + ] + }, + "post": { + "description": "Create a monthly limit for a plugin", + "operationId": "CreateMonthlyLimit", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MonthlyLimitCreate" + } + } + } + }, + "responses": { + "201": { + "description": "New monthly limit created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MonthlyLimit" + } + } + } + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "422": { + "$ref": "#/components/responses/UnprocessableEntity" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams", + "plugins", + "limits" + ] + } + }, + "/teams/{team_name}/monthly-limits/{plugin_team}/{plugin_kind}/{plugin_name}": { + "get": { + "description": "Get a monthly limit for a plugin", + "operationId": "GetMonthlyLimit", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/plugin_team" + }, + { + "$ref": "#/components/parameters/plugin_kind" + }, + { + "$ref": "#/components/parameters/plugin_name" + } + ], + "responses": { + "200": { + "description": "Monthly limit retrieved.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MonthlyLimit" + } + } + } + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams", + "plugins", + "limits" + ] + }, + "put": { + "description": "Update a monthly limit for a plugin", + "operationId": "UpdateMonthlyLimit", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/plugin_team" + }, + { + "$ref": "#/components/parameters/plugin_kind" + }, + { + "$ref": "#/components/parameters/plugin_name" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MonthlyLimitUpdate" + } + } + } + }, + "responses": { + "200": { + "description": "Monthly limit updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/MonthlyLimit" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams", + "plugins", + "limits" + ] + }, + "delete": { + "description": "Delete a monthly limit for a plugin", + "operationId": "DeleteMonthlyLimit", + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/plugin_team" + }, + { + "$ref": "#/components/parameters/plugin_kind" + }, + { + "$ref": "#/components/parameters/plugin_name" + } + ], + "responses": { + "204": { + "description": "Monthly limit deleted." + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + }, + "tags": [ + "teams", + "plugins", + "limits" + ] + } + }, "/teams/{team_name}/invitations": { "get": { "operationId": "ListTeamInvitations", @@ -1728,7 +1987,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Membership" + "$ref": "#/components/schemas/MembershipWithTeam" } } } @@ -1738,7 +1997,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/Membership" + "$ref": "#/components/schemas/MembershipWithTeam" } } } @@ -2008,7 +2267,7 @@ "properties": { "items": { "items": { - "$ref": "#/components/schemas/Membership" + "$ref": "#/components/schemas/MembershipWithTeam" }, "type": "array", "example": [ @@ -2018,12 +2277,6 @@ "created_at": "2017-07-14T16:53:42Z", "name": "cloudquery", "display_name": "CloudQuery" - }, - "user": { - "created_at": "2017-07-14T16:53:42Z", - "email": "user@clouduery.io", - "name": "user", - "updated_at": "2017-07-14T16:53:42Z" } } ] @@ -2433,31 +2686,7 @@ } } }, - "BadRequestError": { - "allOf": [ - { - "$ref": "#/components/schemas/BasicError" - }, - { - "properties": { - "errors": { - "items": { - "type": "string" - }, - "type": "array" - }, - "field_errors": { - "additionalProperties": { - "type": "string" - }, - "type": "object" - } - }, - "type": "object" - } - ] - }, - "UnprocessableEntityError": { + "FieldError": { "allOf": [ { "$ref": "#/components/schemas/BasicError" @@ -2993,16 +3222,13 @@ "title": "CloudQuery User", "type": "object" }, - "Membership": { + "MembershipWithUser": { "additionalProperties": false, "properties": { "role": { "type": "string", "example": "admin" }, - "team": { - "$ref": "#/components/schemas/Team" - }, "user": { "$ref": "#/components/schemas/User" } @@ -3010,9 +3236,104 @@ "required": [ "role" ], - "title": "CloudQuery Team Membership", + "title": "CloudQuery User Membership", "type": "object" }, + "MonthlyLimit": { + "title": "CloudQuery Plugin Monthly Limit", + "description": "A configurable monthly limit for plugin usage.", + "type": "object", + "additionalProperties": false, + "required": [ + "created_at", + "updated_at", + "plugin_team", + "plugin_kind", + "plugin_name", + "usd" + ], + "properties": { + "created_at": { + "example": "2017-07-14T16:53:42Z", + "format": "date-time", + "type": "string", + "description": "The date and time the plugin limit was created." + }, + "updated_at": { + "example": "2017-07-14T16:53:42Z", + "format": "date-time", + "type": "string", + "description": "The date and time the plugin limit was last updated." + }, + "plugin_team": { + "$ref": "#/components/schemas/TeamName" + }, + "plugin_kind": { + "$ref": "#/components/schemas/PluginKind" + }, + "plugin_name": { + "$ref": "#/components/schemas/PluginName" + }, + "usd": { + "example": 1000, + "type": "integer", + "minimum": 0, + "maximum": 1000000000, + "description": "The maximum USD amount the plugin is allowed to use within a calendar month.", + "x-go-name": "USD" + } + } + }, + "MonthlyLimitCreate": { + "title": "CloudQuery Plugin Monthly Limit", + "description": "A configurable monthly limit for plugin usage.", + "type": "object", + "additionalProperties": false, + "required": [ + "plugin_team", + "plugin_kind", + "plugin_name", + "usd" + ], + "properties": { + "plugin_team": { + "$ref": "#/components/schemas/TeamName" + }, + "plugin_kind": { + "$ref": "#/components/schemas/PluginKind" + }, + "plugin_name": { + "$ref": "#/components/schemas/PluginName" + }, + "usd": { + "example": 1000, + "type": "integer", + "minimum": 0, + "maximum": 1000000000, + "description": "The maximum USD amount the plugin is allowed to use within a calendar month.", + "x-go-name": "USD" + } + } + }, + "MonthlyLimitUpdate": { + "title": "CloudQuery Plugin Monthly Limit", + "description": "A configurable monthly limit for plugin usage.", + "type": "object", + "additionalProperties": false, + "required": [ + "usd" + ], + "properties": { + "usd": { + "example": 1000, + "type": "integer", + "minimum": 0, + "maximum": 1000000000, + "description": "The maximum USD amount the plugin is allowed to use within a calendar month.", + "x-go-name": "USD" + } + } + }, "Invitation": { "additionalProperties": false, "required": [ @@ -3039,6 +3360,23 @@ } } }, + "MembershipWithTeam": { + "additionalProperties": false, + "properties": { + "role": { + "type": "string", + "example": "admin" + }, + "team": { + "$ref": "#/components/schemas/Team" + } + }, + "required": [ + "role" + ], + "title": "CloudQuery Team Membership", + "type": "object" + }, "InvitationWithToken": { "additionalProperties": false, "allOf": [ @@ -3138,7 +3476,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BadRequestError" + "$ref": "#/components/schemas/FieldError" } } }, @@ -3148,7 +3486,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/BasicError" + "$ref": "#/components/schemas/FieldError" } } }, @@ -3158,7 +3496,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/UnprocessableEntityError" + "$ref": "#/components/schemas/FieldError" } } }, @@ -3306,6 +3644,14 @@ "type": "boolean" } }, + "plugin_team": { + "in": "path", + "name": "plugin_team", + "required": true, + "schema": { + "$ref": "#/components/schemas/TeamName" + } + }, "email": { "in": "path", "name": "email",