github.com/argoproj/argo-cd@v1.8.7/ui/src/app/shared/services/accounts-service.ts (about)

     1  import {Account} from '../models';
     2  import requests from './requests';
     3  
     4  export class AccountsService {
     5      public list(): Promise<Account[]> {
     6          return requests.get('/account').then(res => (res.body.items || []) as Account[]);
     7      }
     8  
     9      public get(name: string): Promise<Account> {
    10          return requests.get(`/account/${name}`).then(res => res.body as Account);
    11      }
    12  
    13      public createToken(name: string, tokenId: string, expiresIn: number): Promise<string> {
    14          return requests
    15              .post(`/account/${name}/token`)
    16              .send({expiresIn, id: tokenId})
    17              .then(res => res.body.token as string);
    18      }
    19  
    20      public deleteToken(name: string, id: string): Promise<any> {
    21          return requests.delete(`/account/${name}/token/${id}`);
    22      }
    23  }