-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCredentials.php
65 lines (56 loc) · 1.77 KB
/
Credentials.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* (c) Packagist Conductors GmbH <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace PrivatePackagist\ApiClient\Api;
class Credentials extends AbstractApi
{
const TYPE_BITBUCKET_APP_PW = 'bitbucket-app-pw';
const TYPE_GITHUB_OAUTH = 'github-oauth';
const TYPE_GITLAB_TOKEN = 'gitlab-token';
const TYPE_HTTP_BASIC = 'http-basic';
const TYPE_MAGENTO = 'magento';
const TYPE_HTTP_HEADER = 'http-header';
const TYPE_SSH_KEY = 'ssh-key';
public function all()
{
return $this->get('/credentials/');
}
public function show($credentialId)
{
return $this->get(sprintf('/credentials/%s/', $credentialId));
}
public function create($description, $type, $domain, $username, $credential)
{
return $this->post('/credentials/', [
'description' => $description,
'type' => $type,
'domain' => $domain,
'username' => $username,
'credential' => $credential,
]);
}
/**
* @deprecated Use edit instead
*/
#[\Deprecated('Use Credentials::edit instead', '1.11.0')]
public function update($credentialId, $type, $username, $credential)
{
return $this->edit($credentialId, $type, $username, $credential);
}
public function edit($credentialId, $type, $username, $credential)
{
return $this->put(sprintf('/credentials/%s/', $credentialId), [
'username' => $username,
'credential' => $credential,
'type' => $type,
]);
}
public function remove($credentialId)
{
return $this->delete(sprintf('/credentials/%s/', $credentialId));
}
}