config_source.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. export declare abstract class ConfigSource {
  2. ostype: string;
  3. osarch: string;
  4. out_dir: string;
  5. abstract getUrl(version: string): Promise<{
  6. url: string;
  7. version: string;
  8. }>;
  9. abstract getVersionList(): Promise<string[]>;
  10. }
  11. export declare abstract class XmlConfigSource extends ConfigSource {
  12. name: string;
  13. xmlUrl: string;
  14. constructor(name: string, xmlUrl: string);
  15. protected getFileName(): string;
  16. protected getXml(): Promise<any>;
  17. private readResponse();
  18. private requestXml();
  19. private convertXml2js(xml);
  20. }
  21. export declare abstract class JsonConfigSource extends ConfigSource {
  22. name: string;
  23. jsonUrl: string;
  24. constructor(name: string, jsonUrl: string);
  25. protected getFileName(): string;
  26. protected abstract getJson(): Promise<string>;
  27. }
  28. export declare abstract class GithubApiConfigSource extends JsonConfigSource {
  29. constructor(name: string, url: string);
  30. /**
  31. * This is an unauthenticated request and since Github limits the rate, we will cache this
  32. * to a file. { timestamp: number, response: response }. We will check the timestamp and renew
  33. * this request if the file is older than an hour.
  34. */
  35. getJson(): Promise<any>;
  36. private requestJson();
  37. private readResponse();
  38. }