Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/BitbucketPharoAPI-Tests/BitbucketTagsTest.class.st
Original file line number Diff line number Diff line change
@@ -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
]
6 changes: 6 additions & 0 deletions src/BitbucketPharoAPI/BitbucketApi.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion src/BitbucketPharoAPI/BitbucketBranches.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
20 changes: 20 additions & 0 deletions src/BitbucketPharoAPI/BitbucketTags.class.st
Original file line number Diff line number Diff line change
@@ -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
]