lokalise_api.js 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.LokaliseApi = void 0;
  4. const branches_1 = require("../collections/branches");
  5. const comments_1 = require("../collections/comments");
  6. const contributors_1 = require("../collections/contributors");
  7. const files_1 = require("../collections/files");
  8. const keys_1 = require("../collections/keys");
  9. const languages_1 = require("../collections/languages");
  10. const orders_1 = require("../collections/orders");
  11. const payment_cards_1 = require("../collections/payment_cards");
  12. const projects_1 = require("../collections/projects");
  13. const queued_processes_1 = require("../collections/queued_processes");
  14. const screenshots_1 = require("../collections/screenshots");
  15. const segments_1 = require("../collections/segments");
  16. const snapshots_1 = require("../collections/snapshots");
  17. const tasks_1 = require("../collections/tasks");
  18. const teams_1 = require("../collections/teams");
  19. const team_users_1 = require("../collections/team_users");
  20. const team_user_billing_details_1 = require("../collections/team_user_billing_details");
  21. const translations_1 = require("../collections/translations");
  22. const translation_providers_1 = require("../collections/translation_providers");
  23. const translation_statuses_1 = require("../collections/translation_statuses");
  24. const user_groups_1 = require("../collections/user_groups");
  25. const webhooks_1 = require("../collections/webhooks");
  26. class LokaliseApi {
  27. clientData = {
  28. token: "",
  29. tokenType: "",
  30. authHeader: "x-api-token",
  31. enableCompression: false,
  32. };
  33. /*
  34. * Instantiate LokaliseApi to call API methods
  35. * @param params object, mandatory
  36. * @returns LokaliseApi object to work with.
  37. */
  38. constructor(params) {
  39. const apiKey = params["apiKey"];
  40. if (apiKey === null || apiKey === undefined || apiKey.length === 0) {
  41. throw new Error("Error: Instantiation failed: Please pass an API key");
  42. }
  43. this.clientData.token = apiKey;
  44. const compression = params["enableCompression"];
  45. if (compression !== null && compression !== undefined) {
  46. this.clientData.enableCompression = compression;
  47. }
  48. this.clientData.host = params.host;
  49. }
  50. branches() {
  51. return new branches_1.Branches(this.clientData);
  52. }
  53. comments() {
  54. return new comments_1.Comments(this.clientData);
  55. }
  56. contributors() {
  57. return new contributors_1.Contributors(this.clientData);
  58. }
  59. files() {
  60. return new files_1.Files(this.clientData);
  61. }
  62. keys() {
  63. return new keys_1.Keys(this.clientData);
  64. }
  65. languages() {
  66. return new languages_1.Languages(this.clientData);
  67. }
  68. orders() {
  69. return new orders_1.Orders(this.clientData);
  70. }
  71. paymentCards() {
  72. return new payment_cards_1.PaymentCards(this.clientData);
  73. }
  74. projects() {
  75. return new projects_1.Projects(this.clientData);
  76. }
  77. queuedProcesses() {
  78. return new queued_processes_1.QueuedProcesses(this.clientData);
  79. }
  80. screenshots() {
  81. return new screenshots_1.Screenshots(this.clientData);
  82. }
  83. segments() {
  84. return new segments_1.Segments(this.clientData);
  85. }
  86. snapshots() {
  87. return new snapshots_1.Snapshots(this.clientData);
  88. }
  89. tasks() {
  90. return new tasks_1.Tasks(this.clientData);
  91. }
  92. teams() {
  93. return new teams_1.Teams(this.clientData);
  94. }
  95. teamUsers() {
  96. return new team_users_1.TeamUsers(this.clientData);
  97. }
  98. teamUserBillingDetails() {
  99. return new team_user_billing_details_1.TeamUserBillingDetails(this.clientData);
  100. }
  101. translations() {
  102. return new translations_1.Translations(this.clientData);
  103. }
  104. translationProviders() {
  105. return new translation_providers_1.TranslationProviders(this.clientData);
  106. }
  107. translationStatuses() {
  108. return new translation_statuses_1.TranslationStatuses(this.clientData);
  109. }
  110. userGroups() {
  111. return new user_groups_1.UserGroups(this.clientData);
  112. }
  113. webhooks() {
  114. return new webhooks_1.Webhooks(this.clientData);
  115. }
  116. }
  117. exports.LokaliseApi = LokaliseApi;
  118. //# sourceMappingURL=lokalise_api.js.map