10 defined(
'JPATH_PLATFORM') or die;
33 public function create($user, $repo, $ref, $sha)
36 $path =
'/repos/' . $user .
'/' . $repo .
'/git/refs';
47 $response = $this->client->post($this->fetchUrl($path), $data);
50 if ($response->code != 201)
53 $error = json_decode($response->body);
54 throw new DomainException($error->message, $response->code);
57 return json_decode($response->body);
73 public function edit($user, $repo, $ref, $sha, $force =
false)
76 $path =
'/repos/' . $user .
'/' . $repo .
'/git/refs/' . $ref;
90 $data = json_encode($data);
93 $response = $this->client->patch($this->fetchUrl($path), $data);
96 if ($response->code != 200)
99 $error = json_decode($response->body);
100 throw new DomainException($error->message, $response->code);
103 return json_decode($response->body);
117 public function get($user, $repo, $ref)
120 $path =
'/repos/' . $user .
'/' . $repo .
'/git/refs/' . $ref;
123 $response = $this->client->get($this->fetchUrl($path));
126 if ($response->code != 200)
129 $error = json_decode($response->body);
130 throw new DomainException($error->message, $response->code);
133 return json_decode($response->body);
149 public function getList($user, $repo, $namespace =
'', $page = 0, $limit = 0)
152 $path =
'/repos/' . $user .
'/' . $repo .
'/git/refs' . $namespace;
155 $response = $this->client->get($this->fetchUrl($path, $page, $limit));
158 if ($response->code != 200)
161 $error = json_decode($response->body);
162 throw new DomainException($error->message, $response->code);
165 return json_decode($response->body);