github.com/argoproj/argo-cd@v1.8.7/ui/src/app/shared/services/repocreds-service.ts (about) 1 import * as models from '../models'; 2 import requests from './requests'; 3 4 export class RepoCredsService { 5 public list(): Promise<models.RepoCreds[]> { 6 return requests 7 .get('/repocreds') 8 .then(res => res.body as models.RepoCredsList) 9 .then(list => list.items || []); 10 } 11 12 public createHTTPS({ 13 url, 14 username, 15 password, 16 tlsClientCertData, 17 tlsClientCertKey 18 }: { 19 url: string; 20 username: string; 21 password: string; 22 tlsClientCertData: string; 23 tlsClientCertKey: string; 24 }): Promise<models.RepoCreds> { 25 return requests 26 .post('/repocreds') 27 .send({url, username, password, tlsClientCertData, tlsClientCertKey}) 28 .then(res => res.body as models.RepoCreds); 29 } 30 31 public createSSH({url, sshPrivateKey}: {url: string; sshPrivateKey: string}): Promise<models.RepoCreds> { 32 return requests 33 .post('/repocreds') 34 .send({url, sshPrivateKey}) 35 .then(res => res.body as models.RepoCreds); 36 } 37 38 public delete(url: string): Promise<models.RepoCreds> { 39 return requests 40 .delete(`/repocreds/${encodeURIComponent(url)}`) 41 .send() 42 .then(res => res.body as models.RepoCreds); 43 } 44 }