diff --git a/src/BitbucketPharoAPI-Tests/BitbucketTagsTest.class.st b/src/BitbucketPharoAPI-Tests/BitbucketTagsTest.class.st new file mode 100644 index 0000000..11ef51a --- /dev/null +++ b/src/BitbucketPharoAPI-Tests/BitbucketTagsTest.class.st @@ -0,0 +1,46 @@ +" +A BitbucketTagsTest is a test class for testing the behavior of BitbucketTags +" +Class { + #name : 'BitbucketTagsTest', + #superclass : 'TestCase', + #category : 'BitbucketPharoAPI-Tests', + #package : 'BitbucketPharoAPI-Tests' +} + +{ #category : 'tests' } +BitbucketTagsTest >> testAllWithParamsInRepositoryOfProject [ + + | hostUrl gitlabApi result client path bitbucketTags projectKey repoSlug params tags | + "Given" + hostUrl := 'www.url.com'. + client := ZnClient new. + + gitlabApi := BitbucketApi new + bearerToken: 'token'; + host: hostUrl; + client: client. + + bitbucketTags := BitbucketTags new bitbucketApi: gitlabApi. + + projectKey := 'AAA'. + repoSlug := 'project'. + params := { (#state -> 'all') } asDictionary. + + tags := { + (#latestCommit -> #f940d1d59d4314f0c8b17d878de9b21028c68de1). + (#displayId -> #'7.4/7.4.0/milestone/M11') } asDictionary. + + path := '/projects/' , projectKey , '/repos/' , repoSlug , '/tags'. + + (bitbucketTags stub getAll: path withParams: params) willReturn: tags. + + "When" + result := bitbucketTags + allWithParams: params + inRepository: repoSlug + ofProject: projectKey. + + "Then" + self assert: result equals: tags +] diff --git a/src/BitbucketPharoAPI/BitbucketApi.class.st b/src/BitbucketPharoAPI/BitbucketApi.class.st index f1adfe5..3f2a79e 100644 --- a/src/BitbucketPharoAPI/BitbucketApi.class.st +++ b/src/BitbucketPharoAPI/BitbucketApi.class.st @@ -113,6 +113,12 @@ BitbucketApi >> repositories [ ^ BitbucketRepositories new bitbucketApi: self. ] +{ #category : 'ressources' } +BitbucketApi >> tags [ + + ^ BitbucketTags new bitbucketApi: self +] + { #category : 'ressources' } BitbucketApi >> users [ ^BitbucketUsers new bitbucketApi: self. diff --git a/src/BitbucketPharoAPI/BitbucketBranches.class.st b/src/BitbucketPharoAPI/BitbucketBranches.class.st index 5edd330..2e6f958 100644 --- a/src/BitbucketPharoAPI/BitbucketBranches.class.st +++ b/src/BitbucketPharoAPI/BitbucketBranches.class.st @@ -16,7 +16,7 @@ BitbucketBranches >> allWithParams: paramsDict inRepository: repositorySlug ofPr ^ self getAll: endpoint withParams: paramsDict ] -{ #category : 'api - post' } +{ #category : 'as yet unclassified' } BitbucketBranches >> create: branchName withStartPoint: startPoint inRepository: repositorySlug ofProject: projectKey [ "POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/branches" diff --git a/src/BitbucketPharoAPI/BitbucketTags.class.st b/src/BitbucketPharoAPI/BitbucketTags.class.st new file mode 100644 index 0000000..474442b --- /dev/null +++ b/src/BitbucketPharoAPI/BitbucketTags.class.st @@ -0,0 +1,20 @@ +" +Api for [https://docs.atlassian.com/bitbucket-server/rest/5.9.0/bitbucket-rest.html#idm29495621024](https://docs.atlassian.com/bitbucket-server/rest/5.9.0/bitbucket-rest.html#idm29495621024) +" +Class { + #name : 'BitbucketTags', + #superclass : 'BitbucketRessource', + #category : 'BitbucketPharoAPI', + #package : 'BitbucketPharoAPI' +} + +{ #category : 'api - get' } +BitbucketTags >> allWithParams: paramsDict inRepository: repositorySlug ofProject: projectKey [ + "GET /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/tags?filterText&orderBy" + + | endpoint | + endpoint := '/projects/' , projectKey , '/repos/' , repositorySlug + , '/tags'. + + ^ self getAll: endpoint withParams: paramsDict +]