This commit is contained in:
George Fleury 2023-08-30 13:56:55 +02:00
parent 0f2067afb7
commit e0ef906417
2 changed files with 16 additions and 15 deletions

View File

@ -3057,8 +3057,8 @@ func (a *DefaultApiService) ForkRepository(projectKey, repositorySlug string,
}
defer localVarHTTPResponse.Body.Close()
if localVarHTTPResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %s, Url: %s, Body: %s", localVarHTTPResponse.Status, localVarPath, bodyBytes))
bodyBytes, _ := io.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, bodyBytes, reportError("Status: %s, Url: %s, Body: %s", localVarHTTPResponse.Status, localVarPath, bodyBytes))
}
return NewBitbucketAPIResponse(localVarHTTPResponse)
@ -5304,8 +5304,8 @@ func (a *DefaultApiService) SetRepositoryPermissionGroups(projectKey, repository
}
defer localVarHTTPResponse.Body.Close()
if localVarHTTPResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
bodyBytes, _ := io.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, bodyBytes, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
}
if localVarHTTPResponse.StatusCode == 204 {
return nil, nil
@ -8419,8 +8419,8 @@ func (a *DefaultApiService) CreateRepoSSHKey(projectKey, repositorySlug, sshPubK
}
defer localVarHTTPResponse.Body.Close()
if localVarHTTPResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
bodyBytes, _ := io.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, bodyBytes, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
}
return NewBitbucketAPIResponse(localVarHTTPResponse)
@ -11226,8 +11226,8 @@ func (a *DefaultApiService) CreateAccessToken(userSlug, tokenName string, repoAd
}
defer localVarHTTPResponse.Body.Close()
if localVarHTTPResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
bodyBytes, _ := io.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, bodyBytes, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
}
return NewBitbucketAPIResponse(localVarHTTPResponse)
@ -14686,7 +14686,6 @@ func (a *DefaultApiService) SearchCode(query SearchQuery) (*APIResponse, error)
return NewBitbucketAPIResponse(localVarHTTPResponse)
}
// "http://<ourstashurl>/stash/rest/api/latest/projects/<projectname>/repos/<reponame>/commits?at=refs/heads/deploy&start=0&limit=0"
func (a *DefaultApiService) GetHeadCommit(project, repository, branch string, localVarOptionals map[string]interface{}) (*APIResponse, error) {
var (
localVarHTTPMethod = strings.ToUpper("Get")
@ -14694,6 +14693,7 @@ func (a *DefaultApiService) GetHeadCommit(project, repository, branch string, lo
localVarFileName string
localVarFileBytes []byte
)
// create path and map variables
if err := typeCheckParameter(localVarOptionals["apibasepath"], "string", "apibasepath"); err != nil {
return nil, err
@ -14740,8 +14740,8 @@ func (a *DefaultApiService) GetHeadCommit(project, repository, branch string, lo
}
defer localVarHTTPResponse.Body.Close()
if localVarHTTPResponse.StatusCode >= 300 {
bodyBytes, _ := ioutil.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
bodyBytes, _ := io.ReadAll(localVarHTTPResponse.Body)
return NewAPIResponseWithError(localVarHTTPResponse, bodyBytes, reportError("Status: %v, Body: %s", localVarHTTPResponse.Status, bodyBytes))
}
return NewBitbucketAPIResponse(localVarHTTPResponse)

View File

@ -2282,6 +2282,7 @@ func TestDefaultApiService_GetArchive(t *testing.T) {
project string
repository string
localVarOptionals map[string]interface{}
writer io.Writer
}
tests := []struct {
name string
@ -2300,7 +2301,7 @@ func TestDefaultApiService_GetArchive(t *testing.T) {
a := &DefaultApiService{
client: tt.fields.client,
}
got, err := a.GetArchive(tt.args.project, tt.args.repository, tt.args.localVarOptionals)
got, err := a.GetArchive(tt.args.project, tt.args.repository, tt.args.localVarOptionals, tt.args.writer)
if (err != nil) != tt.wantErr {
t.Errorf("DefaultApiService.GetArchive() error = %v, wantErr %v", err, tt.wantErr)
return
@ -2963,13 +2964,13 @@ func TestDefaultApiService_GetContent_11(t *testing.T) {
a := &DefaultApiService{
client: tt.fields.client,
}
got, err := a.GetContent_11(tt.args.projectKey, tt.args.repositorySlug, tt.args.path, tt.args.localVarOptionals)
got, err := a.GetRawContent(tt.args.projectKey, tt.args.repositorySlug, tt.args.path, tt.args.localVarOptionals)
if (err != nil) != tt.wantErr {
t.Errorf("DefaultApiService.GetContent_11() error = %v, wantErr %v", err, tt.wantErr)
t.Errorf("DefaultApiService.GetRawContent() error = %v, wantErr %v", err, tt.wantErr)
return
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("DefaultApiService.GetContent_11() = %v, want %v", got, tt.want)
t.Errorf("DefaultApiService.GetRawContent() = %v, want %v", got, tt.want)
}
})
}