diff --git a/client.gen.go b/client.gen.go index 4619846..b7e3fa7 100644 --- a/client.gen.go +++ b/client.gen.go @@ -363,6 +363,11 @@ type ClientInterface interface { CreateSyncDestination(ctx context.Context, teamName TeamName, body CreateSyncDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // TestSyncDestinationWithBody request with any body + TestSyncDestinationWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + TestSyncDestination(ctx context.Context, teamName TeamName, body TestSyncDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteSyncDestination request DeleteSyncDestination(ctx context.Context, teamName TeamName, syncDestinationName SyncDestinationName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -382,6 +387,11 @@ type ClientInterface interface { CreateSyncSource(ctx context.Context, teamName TeamName, body CreateSyncSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // TestSyncSourceWithBody request with any body + TestSyncSourceWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + TestSyncSource(ctx context.Context, teamName TeamName, body TestSyncSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteSyncSource request DeleteSyncSource(ctx context.Context, teamName TeamName, syncSourceName SyncSourceName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -401,6 +411,14 @@ type ClientInterface interface { CreateSync(ctx context.Context, teamName TeamName, body CreateSyncJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // GetSyncTestConnection request + GetSyncTestConnection(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, reqEditors ...RequestEditorFn) (*http.Response, error) + + // UpdateSyncTestConnectionWithBody request with any body + UpdateSyncTestConnectionWithBody(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + + UpdateSyncTestConnection(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, body UpdateSyncTestConnectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + // DeleteSync request DeleteSync(ctx context.Context, teamName TeamName, syncName SyncName, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -1669,6 +1687,30 @@ func (c *Client) CreateSyncDestination(ctx context.Context, teamName TeamName, b return c.Client.Do(req) } +func (c *Client) TestSyncDestinationWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewTestSyncDestinationRequestWithBody(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) TestSyncDestination(ctx context.Context, teamName TeamName, body TestSyncDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewTestSyncDestinationRequest(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) DeleteSyncDestination(ctx context.Context, teamName TeamName, syncDestinationName SyncDestinationName, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteSyncDestinationRequest(c.Server, teamName, syncDestinationName) if err != nil { @@ -1753,6 +1795,30 @@ func (c *Client) CreateSyncSource(ctx context.Context, teamName TeamName, body C return c.Client.Do(req) } +func (c *Client) TestSyncSourceWithBody(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewTestSyncSourceRequestWithBody(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) TestSyncSource(ctx context.Context, teamName TeamName, body TestSyncSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewTestSyncSourceRequest(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) DeleteSyncSource(ctx context.Context, teamName TeamName, syncSourceName SyncSourceName, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteSyncSourceRequest(c.Server, teamName, syncSourceName) if err != nil { @@ -1837,6 +1903,42 @@ func (c *Client) CreateSync(ctx context.Context, teamName TeamName, body CreateS return c.Client.Do(req) } +func (c *Client) GetSyncTestConnection(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewGetSyncTestConnectionRequest(c.Server, teamName, syncTestConnectionId) + 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) UpdateSyncTestConnectionWithBody(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateSyncTestConnectionRequestWithBody(c.Server, teamName, syncTestConnectionId, 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) UpdateSyncTestConnection(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, body UpdateSyncTestConnectionJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewUpdateSyncTestConnectionRequest(c.Server, teamName, syncTestConnectionId, 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) DeleteSync(ctx context.Context, teamName TeamName, syncName SyncName, reqEditors ...RequestEditorFn) (*http.Response, error) { req, err := NewDeleteSyncRequest(c.Server, teamName, syncName) if err != nil { @@ -6619,6 +6721,53 @@ func NewCreateSyncDestinationRequestWithBody(server string, teamName TeamName, c return req, nil } +// NewTestSyncDestinationRequest calls the generic TestSyncDestination builder with application/json body +func NewTestSyncDestinationRequest(server string, teamName TeamName, body TestSyncDestinationJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewTestSyncDestinationRequestWithBody(server, teamName, "application/json", bodyReader) +} + +// NewTestSyncDestinationRequestWithBody generates requests for TestSyncDestination with any type of body +func NewTestSyncDestinationRequestWithBody(server string, teamName TeamName, contentType string, body io.Reader) (*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/sync-destinations/test", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + // NewDeleteSyncDestinationRequest generates requests for DeleteSyncDestination func NewDeleteSyncDestinationRequest(server string, teamName TeamName, syncDestinationName SyncDestinationName) (*http.Request, error) { var err error @@ -6874,6 +7023,53 @@ func NewCreateSyncSourceRequestWithBody(server string, teamName TeamName, conten return req, nil } +// NewTestSyncSourceRequest calls the generic TestSyncSource builder with application/json body +func NewTestSyncSourceRequest(server string, teamName TeamName, body TestSyncSourceJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewTestSyncSourceRequestWithBody(server, teamName, "application/json", bodyReader) +} + +// NewTestSyncSourceRequestWithBody generates requests for TestSyncSource with any type of body +func NewTestSyncSourceRequestWithBody(server string, teamName TeamName, contentType string, body io.Reader) (*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/sync-sources/test", pathParam0) + if operationPath[0] == '/' { + operationPath = "." + operationPath + } + + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } + + req, err := http.NewRequest("POST", queryURL.String(), body) + if err != nil { + return nil, err + } + + req.Header.Add("Content-Type", contentType) + + return req, nil +} + // NewDeleteSyncSourceRequest generates requests for DeleteSyncSource func NewDeleteSyncSourceRequest(server string, teamName TeamName, syncSourceName SyncSourceName) (*http.Request, error) { var err error @@ -7129,6 +7325,101 @@ func NewCreateSyncRequestWithBody(server string, teamName TeamName, contentType return req, nil } +// NewGetSyncTestConnectionRequest generates requests for GetSyncTestConnection +func NewGetSyncTestConnectionRequest(server string, teamName TeamName, syncTestConnectionId SyncTestConnectionId) (*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 + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sync_test_connection_id", runtime.ParamLocationPath, syncTestConnectionId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/syncs/test-connections/%s", pathParam0, pathParam1) + 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 +} + +// NewUpdateSyncTestConnectionRequest calls the generic UpdateSyncTestConnection builder with application/json body +func NewUpdateSyncTestConnectionRequest(server string, teamName TeamName, syncTestConnectionId SyncTestConnectionId, body UpdateSyncTestConnectionJSONRequestBody) (*http.Request, error) { + var bodyReader io.Reader + buf, err := json.Marshal(body) + if err != nil { + return nil, err + } + bodyReader = bytes.NewReader(buf) + return NewUpdateSyncTestConnectionRequestWithBody(server, teamName, syncTestConnectionId, "application/json", bodyReader) +} + +// NewUpdateSyncTestConnectionRequestWithBody generates requests for UpdateSyncTestConnection with any type of body +func NewUpdateSyncTestConnectionRequestWithBody(server string, teamName TeamName, syncTestConnectionId SyncTestConnectionId, contentType string, body io.Reader) (*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 + } + + var pathParam1 string + + pathParam1, err = runtime.StyleParamWithLocation("simple", false, "sync_test_connection_id", runtime.ParamLocationPath, syncTestConnectionId) + if err != nil { + return nil, err + } + + serverURL, err := url.Parse(server) + if err != nil { + return nil, err + } + + operationPath := fmt.Sprintf("/teams/%s/syncs/test-connections/%s", pathParam0, pathParam1) + 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 +} + // NewDeleteSyncRequest generates requests for DeleteSync func NewDeleteSyncRequest(server string, teamName TeamName, syncName SyncName) (*http.Request, error) { var err error @@ -8439,6 +8730,11 @@ type ClientWithResponsesInterface interface { CreateSyncDestinationWithResponse(ctx context.Context, teamName TeamName, body CreateSyncDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSyncDestinationResponse, error) + // TestSyncDestinationWithBodyWithResponse request with any body + TestSyncDestinationWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestSyncDestinationResponse, error) + + TestSyncDestinationWithResponse(ctx context.Context, teamName TeamName, body TestSyncDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*TestSyncDestinationResponse, error) + // DeleteSyncDestinationWithResponse request DeleteSyncDestinationWithResponse(ctx context.Context, teamName TeamName, syncDestinationName SyncDestinationName, reqEditors ...RequestEditorFn) (*DeleteSyncDestinationResponse, error) @@ -8458,6 +8754,11 @@ type ClientWithResponsesInterface interface { CreateSyncSourceWithResponse(ctx context.Context, teamName TeamName, body CreateSyncSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSyncSourceResponse, error) + // TestSyncSourceWithBodyWithResponse request with any body + TestSyncSourceWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestSyncSourceResponse, error) + + TestSyncSourceWithResponse(ctx context.Context, teamName TeamName, body TestSyncSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*TestSyncSourceResponse, error) + // DeleteSyncSourceWithResponse request DeleteSyncSourceWithResponse(ctx context.Context, teamName TeamName, syncSourceName SyncSourceName, reqEditors ...RequestEditorFn) (*DeleteSyncSourceResponse, error) @@ -8477,6 +8778,14 @@ type ClientWithResponsesInterface interface { CreateSyncWithResponse(ctx context.Context, teamName TeamName, body CreateSyncJSONRequestBody, reqEditors ...RequestEditorFn) (*CreateSyncResponse, error) + // GetSyncTestConnectionWithResponse request + GetSyncTestConnectionWithResponse(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, reqEditors ...RequestEditorFn) (*GetSyncTestConnectionResponse, error) + + // UpdateSyncTestConnectionWithBodyWithResponse request with any body + UpdateSyncTestConnectionWithBodyWithResponse(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSyncTestConnectionResponse, error) + + UpdateSyncTestConnectionWithResponse(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, body UpdateSyncTestConnectionJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSyncTestConnectionResponse, error) + // DeleteSyncWithResponse request DeleteSyncWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, reqEditors ...RequestEditorFn) (*DeleteSyncResponse, error) @@ -10539,9 +10848,11 @@ func (r CreateSyncDestinationResponse) StatusCode() int { return 0 } -type DeleteSyncDestinationResponse struct { +type TestSyncDestinationResponse struct { Body []byte HTTPResponse *http.Response + JSON201 *SyncTestConnection + JSON400 *BadRequest JSON401 *RequiresAuthentication JSON404 *NotFound JSON422 *UnprocessableEntity @@ -10549,7 +10860,7 @@ type DeleteSyncDestinationResponse struct { } // Status returns HTTPResponse.Status -func (r DeleteSyncDestinationResponse) Status() string { +func (r TestSyncDestinationResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -10557,14 +10868,39 @@ func (r DeleteSyncDestinationResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r DeleteSyncDestinationResponse) StatusCode() int { +func (r TestSyncDestinationResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } return 0 } -type GetSyncDestinationResponse struct { +type DeleteSyncDestinationResponse struct { + Body []byte + HTTPResponse *http.Response + JSON401 *RequiresAuthentication + JSON404 *NotFound + JSON422 *UnprocessableEntity + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r DeleteSyncDestinationResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r DeleteSyncDestinationResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type GetSyncDestinationResponse struct { Body []byte HTTPResponse *http.Response JSON200 *SyncDestination @@ -10671,6 +11007,33 @@ func (r CreateSyncSourceResponse) StatusCode() int { return 0 } +type TestSyncSourceResponse struct { + Body []byte + HTTPResponse *http.Response + JSON201 *SyncTestConnection + JSON400 *BadRequest + JSON401 *RequiresAuthentication + JSON404 *NotFound + JSON422 *UnprocessableEntity + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r TestSyncSourceResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r TestSyncSourceResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type DeleteSyncSourceResponse struct { Body []byte HTTPResponse *http.Response @@ -10802,6 +11165,58 @@ func (r CreateSyncResponse) StatusCode() int { return 0 } +type GetSyncTestConnectionResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SyncTestConnection + JSON401 *RequiresAuthentication + JSON404 *NotFound + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r GetSyncTestConnectionResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r GetSyncTestConnectionResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + +type UpdateSyncTestConnectionResponse struct { + Body []byte + HTTPResponse *http.Response + JSON200 *SyncTestConnection + JSON400 *BadRequest + JSON403 *Forbidden + JSON404 *NotFound + JSON422 *UnprocessableEntity + JSON500 *InternalError +} + +// Status returns HTTPResponse.Status +func (r UpdateSyncTestConnectionResponse) Status() string { + if r.HTTPResponse != nil { + return r.HTTPResponse.Status + } + return http.StatusText(0) +} + +// StatusCode returns HTTPResponse.StatusCode +func (r UpdateSyncTestConnectionResponse) StatusCode() int { + if r.HTTPResponse != nil { + return r.HTTPResponse.StatusCode + } + return 0 +} + type DeleteSyncResponse struct { Body []byte HTTPResponse *http.Response @@ -12184,6 +12599,23 @@ func (c *ClientWithResponses) CreateSyncDestinationWithResponse(ctx context.Cont return ParseCreateSyncDestinationResponse(rsp) } +// TestSyncDestinationWithBodyWithResponse request with arbitrary body returning *TestSyncDestinationResponse +func (c *ClientWithResponses) TestSyncDestinationWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestSyncDestinationResponse, error) { + rsp, err := c.TestSyncDestinationWithBody(ctx, teamName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseTestSyncDestinationResponse(rsp) +} + +func (c *ClientWithResponses) TestSyncDestinationWithResponse(ctx context.Context, teamName TeamName, body TestSyncDestinationJSONRequestBody, reqEditors ...RequestEditorFn) (*TestSyncDestinationResponse, error) { + rsp, err := c.TestSyncDestination(ctx, teamName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseTestSyncDestinationResponse(rsp) +} + // DeleteSyncDestinationWithResponse request returning *DeleteSyncDestinationResponse func (c *ClientWithResponses) DeleteSyncDestinationWithResponse(ctx context.Context, teamName TeamName, syncDestinationName SyncDestinationName, reqEditors ...RequestEditorFn) (*DeleteSyncDestinationResponse, error) { rsp, err := c.DeleteSyncDestination(ctx, teamName, syncDestinationName, reqEditors...) @@ -12245,6 +12677,23 @@ func (c *ClientWithResponses) CreateSyncSourceWithResponse(ctx context.Context, return ParseCreateSyncSourceResponse(rsp) } +// TestSyncSourceWithBodyWithResponse request with arbitrary body returning *TestSyncSourceResponse +func (c *ClientWithResponses) TestSyncSourceWithBodyWithResponse(ctx context.Context, teamName TeamName, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*TestSyncSourceResponse, error) { + rsp, err := c.TestSyncSourceWithBody(ctx, teamName, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseTestSyncSourceResponse(rsp) +} + +func (c *ClientWithResponses) TestSyncSourceWithResponse(ctx context.Context, teamName TeamName, body TestSyncSourceJSONRequestBody, reqEditors ...RequestEditorFn) (*TestSyncSourceResponse, error) { + rsp, err := c.TestSyncSource(ctx, teamName, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseTestSyncSourceResponse(rsp) +} + // DeleteSyncSourceWithResponse request returning *DeleteSyncSourceResponse func (c *ClientWithResponses) DeleteSyncSourceWithResponse(ctx context.Context, teamName TeamName, syncSourceName SyncSourceName, reqEditors ...RequestEditorFn) (*DeleteSyncSourceResponse, error) { rsp, err := c.DeleteSyncSource(ctx, teamName, syncSourceName, reqEditors...) @@ -12306,6 +12755,32 @@ func (c *ClientWithResponses) CreateSyncWithResponse(ctx context.Context, teamNa return ParseCreateSyncResponse(rsp) } +// GetSyncTestConnectionWithResponse request returning *GetSyncTestConnectionResponse +func (c *ClientWithResponses) GetSyncTestConnectionWithResponse(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, reqEditors ...RequestEditorFn) (*GetSyncTestConnectionResponse, error) { + rsp, err := c.GetSyncTestConnection(ctx, teamName, syncTestConnectionId, reqEditors...) + if err != nil { + return nil, err + } + return ParseGetSyncTestConnectionResponse(rsp) +} + +// UpdateSyncTestConnectionWithBodyWithResponse request with arbitrary body returning *UpdateSyncTestConnectionResponse +func (c *ClientWithResponses) UpdateSyncTestConnectionWithBodyWithResponse(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*UpdateSyncTestConnectionResponse, error) { + rsp, err := c.UpdateSyncTestConnectionWithBody(ctx, teamName, syncTestConnectionId, contentType, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateSyncTestConnectionResponse(rsp) +} + +func (c *ClientWithResponses) UpdateSyncTestConnectionWithResponse(ctx context.Context, teamName TeamName, syncTestConnectionId SyncTestConnectionId, body UpdateSyncTestConnectionJSONRequestBody, reqEditors ...RequestEditorFn) (*UpdateSyncTestConnectionResponse, error) { + rsp, err := c.UpdateSyncTestConnection(ctx, teamName, syncTestConnectionId, body, reqEditors...) + if err != nil { + return nil, err + } + return ParseUpdateSyncTestConnectionResponse(rsp) +} + // DeleteSyncWithResponse request returning *DeleteSyncResponse func (c *ClientWithResponses) DeleteSyncWithResponse(ctx context.Context, teamName TeamName, syncName SyncName, reqEditors ...RequestEditorFn) (*DeleteSyncResponse, error) { rsp, err := c.DeleteSync(ctx, teamName, syncName, reqEditors...) @@ -16586,6 +17061,67 @@ func ParseCreateSyncDestinationResponse(rsp *http.Response) (*CreateSyncDestinat return response, nil } +// ParseTestSyncDestinationResponse parses an HTTP response from a TestSyncDestinationWithResponse call +func ParseTestSyncDestinationResponse(rsp *http.Response) (*TestSyncDestinationResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &TestSyncDestinationResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest SyncTestConnection + 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 == 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 { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + // ParseDeleteSyncDestinationResponse parses an HTTP response from a DeleteSyncDestinationWithResponse call func ParseDeleteSyncDestinationResponse(rsp *http.Response) (*DeleteSyncDestinationResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -16852,6 +17388,67 @@ func ParseCreateSyncSourceResponse(rsp *http.Response) (*CreateSyncSourceRespons return response, nil } +// ParseTestSyncSourceResponse parses an HTTP response from a TestSyncSourceWithResponse call +func ParseTestSyncSourceResponse(rsp *http.Response) (*TestSyncSourceResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &TestSyncSourceResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: + var dest SyncTestConnection + 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 == 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 { + return nil, err + } + response.JSON500 = &dest + + } + + return response, nil +} + // ParseDeleteSyncSourceResponse parses an HTTP response from a DeleteSyncSourceWithResponse call func ParseDeleteSyncSourceResponse(rsp *http.Response) (*DeleteSyncSourceResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) @@ -17111,6 +17708,114 @@ func ParseCreateSyncResponse(rsp *http.Response) (*CreateSyncResponse, error) { return response, nil } +// ParseGetSyncTestConnectionResponse parses an HTTP response from a GetSyncTestConnectionWithResponse call +func ParseGetSyncTestConnectionResponse(rsp *http.Response) (*GetSyncTestConnectionResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &GetSyncTestConnectionResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SyncTestConnection + 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 == 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 +} + +// ParseUpdateSyncTestConnectionResponse parses an HTTP response from a UpdateSyncTestConnectionWithResponse call +func ParseUpdateSyncTestConnectionResponse(rsp *http.Response) (*UpdateSyncTestConnectionResponse, error) { + bodyBytes, err := io.ReadAll(rsp.Body) + defer func() { _ = rsp.Body.Close() }() + if err != nil { + return nil, err + } + + response := &UpdateSyncTestConnectionResponse{ + Body: bodyBytes, + HTTPResponse: rsp, + } + + switch { + case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 200: + var dest SyncTestConnection + 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 == 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 == 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 +} + // ParseDeleteSyncResponse parses an HTTP response from a DeleteSyncWithResponse call func ParseDeleteSyncResponse(rsp *http.Response) (*DeleteSyncResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) diff --git a/models.gen.go b/models.gen.go index 3cc551a..b464ca8 100644 --- a/models.gen.go +++ b/models.gen.go @@ -138,6 +138,14 @@ const ( SyncRunStatusStarted SyncRunStatus = "started" ) +// Defines values for SyncTestConnectionStatus. +const ( + SyncTestConnectionStatusCompleted SyncTestConnectionStatus = "completed" + SyncTestConnectionStatusCreated SyncTestConnectionStatus = "created" + SyncTestConnectionStatusFailed SyncTestConnectionStatus = "failed" + SyncTestConnectionStatusStarted SyncTestConnectionStatus = "started" +) + // Defines values for TeamPlan. const ( Free TeamPlan = "free" @@ -146,9 +154,9 @@ const ( // Defines values for TeamSubscriptionOrderStatus. const ( - TeamSubscriptionOrderStatusCancelled TeamSubscriptionOrderStatus = "cancelled" - TeamSubscriptionOrderStatusCompleted TeamSubscriptionOrderStatus = "completed" - TeamSubscriptionOrderStatusPending TeamSubscriptionOrderStatus = "pending" + Cancelled TeamSubscriptionOrderStatus = "cancelled" + Completed TeamSubscriptionOrderStatus = "completed" + Pending TeamSubscriptionOrderStatus = "pending" ) // Defines values for AddonSortBy. @@ -1443,6 +1451,27 @@ type SyncSourceUpdate struct { Version *string `json:"version,omitempty"` } +// SyncTestConnection defines model for SyncTestConnection. +type SyncTestConnection struct { + // CompletedAt Cron schedule for the sync + CompletedAt *time.Time `json:"completed_at,omitempty"` + + // CreatedAt Whether the sync is disabled + CreatedAt time.Time `json:"created_at"` + + // Id unique ID of the test connection + ID ID `json:"id"` + + // Status The status of the sync run + Status SyncTestConnectionStatus `json:"status"` +} + +// ID unique ID of the test connection +type ID = openapi_types.UUID + +// SyncTestConnectionStatus The status of the sync run +type SyncTestConnectionStatus string + // SyncUpdate Managed Sync definition type SyncUpdate struct { // Cpu CPU quota for the sync @@ -1650,6 +1679,9 @@ type SyncRunId = SyncRunID // SyncSourceName Unique name of the sync source type SyncSourceName = string +// SyncTestConnectionId unique ID of the test connection +type SyncTestConnectionId = ID + // TargetName defines model for target_name. type TargetName = string @@ -2050,6 +2082,12 @@ type ListSyncsParams struct { Page *Page `form:"page,omitempty" json:"page,omitempty"` } +// UpdateSyncTestConnectionJSONBody defines parameters for UpdateSyncTestConnection. +type UpdateSyncTestConnectionJSONBody struct { + // Status The status of the sync run + Status SyncTestConnectionStatus `json:"status"` +} + // ListSyncRunsParams defines parameters for ListSyncRuns. type ListSyncRunsParams struct { // PerPage The number of results per page (max 1000). @@ -2205,18 +2243,27 @@ type CreateSubscriptionOrderForTeamJSONRequestBody = TeamSubscriptionOrderCreate // CreateSyncDestinationJSONRequestBody defines body for CreateSyncDestination for application/json ContentType. type CreateSyncDestinationJSONRequestBody = SyncDestinationCreate +// TestSyncDestinationJSONRequestBody defines body for TestSyncDestination for application/json ContentType. +type TestSyncDestinationJSONRequestBody = SyncDestinationCreate + // UpdateSyncDestinationJSONRequestBody defines body for UpdateSyncDestination for application/json ContentType. type UpdateSyncDestinationJSONRequestBody = SyncDestinationUpdate // CreateSyncSourceJSONRequestBody defines body for CreateSyncSource for application/json ContentType. type CreateSyncSourceJSONRequestBody = SyncSourceCreate +// TestSyncSourceJSONRequestBody defines body for TestSyncSource for application/json ContentType. +type TestSyncSourceJSONRequestBody = SyncSourceCreate + // UpdateSyncSourceJSONRequestBody defines body for UpdateSyncSource for application/json ContentType. type UpdateSyncSourceJSONRequestBody = SyncSourceUpdate // CreateSyncJSONRequestBody defines body for CreateSync for application/json ContentType. type CreateSyncJSONRequestBody = SyncCreate +// UpdateSyncTestConnectionJSONRequestBody defines body for UpdateSyncTestConnection for application/json ContentType. +type UpdateSyncTestConnectionJSONRequestBody UpdateSyncTestConnectionJSONBody + // UpdateSyncJSONRequestBody defines body for UpdateSync for application/json ContentType. type UpdateSyncJSONRequestBody = SyncUpdate diff --git a/spec.json b/spec.json index 3d65ada..8ac824d 100644 --- a/spec.json +++ b/spec.json @@ -4651,6 +4651,57 @@ } } }, + "/teams/{team_name}/sync-sources/test": { + "post": { + "description": "Test a Sync Source definition.", + "operationId": "TestSyncSource", + "tags": [ + "syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SyncSourceCreate" + } + } + } + }, + "responses": { + "201": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SyncTestConnection" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "422": { + "$ref": "#/components/responses/UnprocessableEntity" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + } + } + }, "/teams/{team_name}/sync-sources/{sync_source_name}": { "get": { "description": "Get a single sync source definition.", @@ -4877,6 +4928,57 @@ } } }, + "/teams/{team_name}/sync-destinations/test": { + "post": { + "description": "Test a Sync Destination definition.", + "operationId": "TestSyncDestination", + "tags": [ + "syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SyncDestinationCreate" + } + } + } + }, + "responses": { + "201": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SyncTestConnection" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "422": { + "$ref": "#/components/responses/UnprocessableEntity" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + } + } + }, "/teams/{team_name}/sync-destinations/{sync_destination_name}": { "get": { "description": "Get a single sync destination definition.", @@ -5580,6 +5682,103 @@ } } } + }, + "/teams/{team_name}/syncs/test-connections/{sync_test_connection_id}": { + "get": { + "description": "Get a Sync Test Connection", + "operationId": "GetSyncTestConnection", + "tags": [ + "syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/sync_test_connection_id" + } + ], + "responses": { + "200": { + "description": "Response", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SyncTestConnection" + } + } + } + }, + "401": { + "$ref": "#/components/responses/RequiresAuthentication" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + } + }, + "patch": { + "description": "Update a Sync Test Connection", + "operationId": "UpdateSyncTestConnection", + "tags": [ + "syncs" + ], + "parameters": [ + { + "$ref": "#/components/parameters/team_name" + }, + { + "$ref": "#/components/parameters/sync_test_connection_id" + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "status" + ], + "properties": { + "status": { + "$ref": "#/components/schemas/SyncTestConnectionStatus" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Updated", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SyncTestConnection" + } + } + } + }, + "400": { + "$ref": "#/components/responses/BadRequest" + }, + "403": { + "$ref": "#/components/responses/Forbidden" + }, + "404": { + "$ref": "#/components/responses/NotFound" + }, + "422": { + "$ref": "#/components/responses/UnprocessableEntity" + }, + "500": { + "$ref": "#/components/responses/InternalError" + } + } + } } }, "components": { @@ -7882,6 +8081,52 @@ } ] }, + "SyncTestConnectionID": { + "type": "string", + "format": "uuid", + "example": "12345678-1234-1234-1234-1234567890ab", + "description": "unique ID of the test connection", + "x-go-name": "ID" + }, + "SyncTestConnectionStatus": { + "description": "The status of the sync run", + "type": "string", + "enum": [ + "completed", + "failed", + "started", + "created" + ] + }, + "SyncTestConnection": { + "type": "object", + "required": [ + "id", + "created_at", + "status" + ], + "properties": { + "id": { + "$ref": "#/components/schemas/SyncTestConnectionID" + }, + "status": { + "$ref": "#/components/schemas/SyncTestConnectionStatus", + "description": "Status of the sync test connection" + }, + "created_at": { + "example": "2017-07-14T16:53:42Z", + "format": "date-time", + "type": "string", + "description": "Whether the sync is disabled" + }, + "completed_at": { + "example": "2017-07-14T16:53:42Z", + "format": "date-time", + "type": "string", + "description": "Cron schedule for the sync" + } + } + }, "SyncSourceUpdate": { "title": "Sync Source definition for creating a new source", "description": "Sync Source Update Definition", @@ -8656,6 +8901,14 @@ "schema": { "$ref": "#/components/schemas/SyncRunID" } + }, + "sync_test_connection_id": { + "name": "sync_test_connection_id", + "in": "path", + "required": true, + "schema": { + "$ref": "#/components/schemas/SyncTestConnectionID" + } } } }