Skip to content

Commit

Permalink
feat(BitbucketRepositories): all in project (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
knowbased authored Feb 5, 2025
1 parent eebd26d commit ddf4391
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/BitbucketPharoAPI-Tests/BitbucketRepositoriesTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,37 @@ Class {
#package : 'BitbucketPharoAPI-Tests'
}

{ #category : 'tests' }
BitbucketRepositoriesTest >> testAllInProject [

| hostUrl client bitbucketApi projectKey endpoint response result bitbucketRepos |
hostUrl := 'www.url.com'.
client := Mock new.

bitbucketApi := BitbucketApi new
bearerToken: 'token';
host: hostUrl;
client: client.

bitbucketRepos := BitbucketRepositories new bitbucketApi:
bitbucketApi.

projectKey := 'OOO'.

endpoint := '/projects/' , projectKey , '/repos'.

response := { (#repo -> '1') } asDictionary.

(bitbucketRepos stub getAll: endpoint withParams: Dictionary new)
willReturn: response.

"When"
result := bitbucketRepos allInProject: projectKey.

"Then"
self assert: result equals: response
]

{ #category : 'tests' }
BitbucketRepositoriesTest >> testRawFileWithParamsInRepositoryOfProject [

Expand Down
9 changes: 9 additions & 0 deletions src/BitbucketPharoAPI/BitbucketRepositories.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ Class {
#package : 'BitbucketPharoAPI'
}

{ #category : 'api - get' }
BitbucketRepositories >> allInProject: projectKey [
"GET /rest/api/1.0/projects/{projectKey}/repos"
| endpoint |
endpoint := '/projects/' , projectKey , '/repos'.

^ self getAll: endpoint withParams: Dictionary new
]

{ #category : 'api - get' }
BitbucketRepositories >> rawFile: filePath withParams: paramsDict inRepository: repositorySlug ofProject: projectKey [
"/rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/raw/{path:.*}?at&markup&hardwrap&htmlEscape"
Expand Down

0 comments on commit ddf4391

Please sign in to comment.