private function get_api_url($endpoint)
{
$type = $this->return_repo_type();
$segments = array('owner' => $this->type->owner, 'repo' => $this->type->repo);
foreach ($segments as $segment => $value) {
$endpoint = str_replace('/:' . sanitize_key($segment), '/' . sanitize_text_field($value), $endpoint);
}
switch ($type['repo']) {
case 'github':
$api = new GitHub_API($type['type']);
$endpoint = $api->add_endpoints($this, $endpoint);
if ($this->type->enterprise_api) {
return $endpoint;
}
break;
case 'gitlab':
$api = new GitLab_API($type['type']);
$endpoint = $api->add_endpoints($this, $endpoint);
if ($this->type->enterprise_api) {
return $endpoint;
}
break;
default:
}
return $type['base_uri'] . $endpoint;
}