diff --git a/README.md b/README.md
index 31e84e6..1b369ed 100644
--- a/README.md
+++ b/README.md
@@ -104,6 +104,9 @@ Note: If something went wrong, see *Error management* section
$api->getAnalyses('project uuid');
+ // for a specific branch
+ $api->getAnalyses('project uuid', 'branch name');
+
### Get an analysis
$api->getAnalysis('project uuid', 'analysis id');
diff --git a/Sdk/Api.php b/Sdk/Api.php
index 6aa7251..368a9cf 100644
--- a/Sdk/Api.php
+++ b/Sdk/Api.php
@@ -146,10 +146,16 @@ public function createProject(Project $project)
*
* @return Analyses
*/
- public function getAnalyses($projectUuid)
+ public function getAnalyses($projectUuid, $branch = null)
{
+ $url = sprintf('/api/projects/%s/analyses', $projectUuid);
+
+ if ($branch) {
+ $url .= '?branch='.$branch;
+ }
+
return $this->serializer->deserialize(
- $this->send('GET', sprintf('/api/projects/%s/analyses', $projectUuid)),
+ $this->send('GET', $url),
Analyses::class,
'xml'
);
diff --git a/Sdk/Model/Analysis.php b/Sdk/Model/Analysis.php
index f11dae5..3b1c18c 100644
--- a/Sdk/Model/Analysis.php
+++ b/Sdk/Model/Analysis.php
@@ -110,6 +110,18 @@ class Analysis
/** @Type("SensioLabs\Insight\Sdk\Model\Violations") */
private $violations;
+ /**
+ * @Type("string")
+ * @SerializedName("branch")
+ */
+ private $branch;
+
+ /**
+ * @Type("string")
+ * @SerializedName("reference")
+ */
+ private $reference;
+
/**
* @return Link[]
*/
diff --git a/Sdk/Tests/fixtures/analyses.xml b/Sdk/Tests/fixtures/analyses.xml
index ea7800c..f38ba88 100644
--- a/Sdk/Tests/fixtures/analyses.xml
+++ b/Sdk/Tests/fixtures/analyses.xml
@@ -26,6 +26,8 @@
181.75
55.5
250
+
+
@@ -62,5 +64,7 @@ insight:analyze:wax [--feedback="..."] [--artefacts="..."] [--measure="..."] [--
0
0
0
+
+