GSI - Employe Self Service Mobile
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
1.0 KiB

2 months ago
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.deleteTopic = exports.updateTopic = exports.getTopic = exports.createTopic = void 0;
  4. const apiv2_1 = require("../apiv2");
  5. const api_1 = require("../api");
  6. const proto = require("./proto");
  7. const API_VERSION = "v1";
  8. const client = new apiv2_1.Client({
  9. urlPrefix: api_1.pubsubOrigin,
  10. auth: true,
  11. apiVersion: API_VERSION,
  12. });
  13. async function createTopic(topic) {
  14. const result = await client.put(topic.name, topic);
  15. return result.body;
  16. }
  17. exports.createTopic = createTopic;
  18. async function getTopic(name) {
  19. const result = await client.get(name);
  20. return result.body;
  21. }
  22. exports.getTopic = getTopic;
  23. async function updateTopic(topic) {
  24. const queryParams = {
  25. updateMask: proto.fieldMasks(topic).join(","),
  26. };
  27. const result = await client.patch(topic.name, topic, { queryParams });
  28. return result.body;
  29. }
  30. exports.updateTopic = updateTopic;
  31. async function deleteTopic(name) {
  32. await client.delete(name);
  33. }
  34. exports.deleteTopic = deleteTopic;