@esri/hub-common 14.105.0 → 14.106.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/esm/events/api/events.js +1 -1
  2. package/dist/esm/events/api/utils/authenticate-request.js +1 -1
  3. package/dist/esm/newsletters/api/index.js +4 -0
  4. package/dist/esm/newsletters/api/index.js.map +1 -0
  5. package/dist/esm/newsletters/api/orval/api/orval-newsletters.js +107 -0
  6. package/dist/esm/newsletters/api/orval/api/orval-newsletters.js.map +1 -0
  7. package/dist/esm/newsletters/api/orval/awaited-type.js +1 -0
  8. package/dist/esm/newsletters/api/orval/awaited-type.js.map +1 -0
  9. package/dist/esm/newsletters/api/orval/custom-client.js +44 -0
  10. package/dist/esm/newsletters/api/orval/custom-client.js.map +1 -0
  11. package/dist/esm/newsletters/api/subscriptions.js +53 -0
  12. package/dist/esm/newsletters/api/subscriptions.js.map +1 -0
  13. package/dist/esm/newsletters/api/types.js +2 -0
  14. package/dist/esm/newsletters/api/types.js.map +1 -0
  15. package/dist/esm/newsletters/api/users.js +43 -0
  16. package/dist/esm/newsletters/api/users.js.map +1 -0
  17. package/dist/esm/newsletters/api/utils/authenticate-request.js +15 -0
  18. package/dist/esm/newsletters/api/utils/authenticate-request.js.map +1 -0
  19. package/dist/esm/newsletters/index.js +2 -0
  20. package/dist/esm/newsletters/index.js.map +1 -0
  21. package/dist/node/events/api/events.js +1 -1
  22. package/dist/node/events/api/utils/authenticate-request.js +1 -1
  23. package/dist/node/newsletters/api/index.js +7 -0
  24. package/dist/node/newsletters/api/index.js.map +1 -0
  25. package/dist/node/newsletters/api/orval/api/orval-newsletters.js +110 -0
  26. package/dist/node/newsletters/api/orval/api/orval-newsletters.js.map +1 -0
  27. package/dist/node/newsletters/api/orval/awaited-type.js +3 -0
  28. package/dist/node/newsletters/api/orval/awaited-type.js.map +1 -0
  29. package/dist/node/newsletters/api/orval/custom-client.js +48 -0
  30. package/dist/node/newsletters/api/orval/custom-client.js.map +1 -0
  31. package/dist/node/newsletters/api/subscriptions.js +61 -0
  32. package/dist/node/newsletters/api/subscriptions.js.map +1 -0
  33. package/dist/node/newsletters/api/types.js +7 -0
  34. package/dist/node/newsletters/api/types.js.map +1 -0
  35. package/dist/node/newsletters/api/users.js +50 -0
  36. package/dist/node/newsletters/api/users.js.map +1 -0
  37. package/dist/node/newsletters/api/utils/authenticate-request.js +19 -0
  38. package/dist/node/newsletters/api/utils/authenticate-request.js.map +1 -0
  39. package/dist/node/newsletters/index.js +5 -0
  40. package/dist/node/newsletters/index.js.map +1 -0
  41. package/dist/types/events/api/events.d.ts +1 -1
  42. package/dist/types/events/api/utils/authenticate-request.d.ts +1 -1
  43. package/dist/types/newsletters/api/index.d.ts +3 -0
  44. package/dist/types/newsletters/api/orval/api/orval-newsletters.d.ts +215 -0
  45. package/dist/types/newsletters/api/orval/awaited-type.d.ts +5 -0
  46. package/dist/types/newsletters/api/orval/custom-client.d.ts +22 -0
  47. package/dist/types/newsletters/api/subscriptions.d.ts +36 -0
  48. package/dist/types/newsletters/api/types.d.ts +47 -0
  49. package/dist/types/newsletters/api/users.d.ts +29 -0
  50. package/dist/types/newsletters/api/utils/authenticate-request.d.ts +9 -0
  51. package/dist/types/newsletters/index.d.ts +1 -0
  52. package/package.json +1 -1
@@ -23,7 +23,7 @@ export async function getEvents(options) {
23
23
  /**
24
24
  * get an event
25
25
  *
26
- * @param {ICreateEventParams} options
26
+ * @param {IGetEventParams} options
27
27
  * @return {Promise<IEvent>}
28
28
  */
29
29
  export async function getEvent(options) {
@@ -2,7 +2,7 @@
2
2
  * return a token created using options.authentication or set on options.token
3
3
  *
4
4
  * @export
5
- * @param {IDiscussionsRequestOptions} options
5
+ * @param {IEventsRequestOptions} options
6
6
  * @return {*} {Promise<string>}
7
7
  */
8
8
  export function authenticateRequest(options) {
@@ -0,0 +1,4 @@
1
+ export * from "./subscriptions";
2
+ export * from "./users";
3
+ export * from "./types";
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/newsletters/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * Generated by orval v6.24.0 🍺
3
+ * Do not edit manually.
4
+ * Hub Newsletters Service
5
+ * OpenAPI spec version: 0.0.1
6
+ */
7
+ import { customClient } from "../custom-client";
8
+ export var DeliveryMethod;
9
+ (function (DeliveryMethod) {
10
+ DeliveryMethod["EMAIL"] = "EMAIL";
11
+ })(DeliveryMethod || (DeliveryMethod = {}));
12
+ export var Cadence;
13
+ (function (Cadence) {
14
+ Cadence["ON_EVENT"] = "ON_EVENT";
15
+ Cadence["DAILY"] = "DAILY";
16
+ Cadence["WEEKLY"] = "WEEKLY";
17
+ Cadence["MONTHLY"] = "MONTHLY";
18
+ })(Cadence || (Cadence = {}));
19
+ export var SystemNotificationSpecNames;
20
+ (function (SystemNotificationSpecNames) {
21
+ SystemNotificationSpecNames["TELEMETRY_REPORT"] = "TELEMETRY_REPORT";
22
+ SystemNotificationSpecNames["EVENT"] = "EVENT";
23
+ })(SystemNotificationSpecNames || (SystemNotificationSpecNames = {}));
24
+ export const createSubscription = (iCreateSubscription, options) => {
25
+ return customClient({
26
+ url: `/api/newsletters/v1/subscriptions`,
27
+ method: "POST",
28
+ headers: { "Content-Type": "application/json" },
29
+ data: iCreateSubscription,
30
+ }, options);
31
+ };
32
+ export const getSubscriptions = (params, options) => {
33
+ return customClient({ url: `/api/newsletters/v1/subscriptions`, method: "GET", params }, options);
34
+ };
35
+ export const subscribe = (iSubscribe, options) => {
36
+ return customClient({
37
+ url: `/api/newsletters/v1/subscriptions/subscribe`,
38
+ method: "POST",
39
+ headers: { "Content-Type": "application/json" },
40
+ data: iSubscribe,
41
+ }, options);
42
+ };
43
+ export const getSubscription = (id, options) => {
44
+ return customClient({ url: `/api/newsletters/v1/subscriptions/${id}`, method: "GET" }, options);
45
+ };
46
+ export const updateSubscription = (id, iUpdateSubscription, options) => {
47
+ return customClient({
48
+ url: `/api/newsletters/v1/subscriptions/${id}`,
49
+ method: "PATCH",
50
+ headers: { "Content-Type": "application/json" },
51
+ data: iUpdateSubscription,
52
+ }, options);
53
+ };
54
+ export const deleteSubscription = (id, options) => {
55
+ return customClient({ url: `/api/newsletters/v1/subscriptions/${id}`, method: "DELETE" }, options);
56
+ };
57
+ export const createUser = (iCreateUser, options) => {
58
+ return customClient({
59
+ url: `/api/newsletters/v1/users`,
60
+ method: "POST",
61
+ headers: { "Content-Type": "application/json" },
62
+ data: iCreateUser,
63
+ }, options);
64
+ };
65
+ export const getUsers = (options) => {
66
+ return customClient({ url: `/api/newsletters/v1/users`, method: "GET" }, options);
67
+ };
68
+ export const getUser = (userId, options) => {
69
+ return customClient({ url: `/api/newsletters/v1/users/${userId}`, method: "GET" }, options);
70
+ };
71
+ export const updateUser = (userId, iUpdateUser, options) => {
72
+ return customClient({
73
+ url: `/api/newsletters/v1/users/${userId}`,
74
+ method: "PATCH",
75
+ headers: { "Content-Type": "application/json" },
76
+ data: iUpdateUser,
77
+ }, options);
78
+ };
79
+ export const deleteUser = (userId, options) => {
80
+ return customClient({ url: `/api/newsletters/v1/users/${userId}`, method: "DELETE" }, options);
81
+ };
82
+ export const createNotificationSpec = (iCreateNotificationSpec, options) => {
83
+ return customClient({
84
+ url: `/api/newsletters/v1/notification-specs`,
85
+ method: "POST",
86
+ headers: { "Content-Type": "application/json" },
87
+ data: iCreateNotificationSpec,
88
+ }, options);
89
+ };
90
+ export const getNotificationSpecs = (options) => {
91
+ return customClient({ url: `/api/newsletters/v1/notification-specs`, method: "GET" }, options);
92
+ };
93
+ export const getNotificationSpec = (id, options) => {
94
+ return customClient({ url: `/api/newsletters/v1/notification-specs/${id}`, method: "GET" }, options);
95
+ };
96
+ export const updateNotificationSpec = (id, iUpdateNotificationSpec, options) => {
97
+ return customClient({
98
+ url: `/api/newsletters/v1/notification-specs/${id}`,
99
+ method: "PATCH",
100
+ headers: { "Content-Type": "application/json" },
101
+ data: iUpdateNotificationSpec,
102
+ }, options);
103
+ };
104
+ export const deleteNotificationSpec = (id, options) => {
105
+ return customClient({ url: `/api/newsletters/v1/notification-specs/${id}`, method: "DELETE" }, options);
106
+ };
107
+ //# sourceMappingURL=orval-newsletters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orval-newsletters.js","sourceRoot":"","sources":["../../../../../../src/newsletters/api/orval/api/orval-newsletters.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAuGhD,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,iCAAe,CAAA;AACjB,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB;AACD,MAAM,CAAN,IAAY,OAKX;AALD,WAAY,OAAO;IACjB,gCAAqB,CAAA;IACrB,0BAAe,CAAA;IACf,4BAAiB,CAAA;IACjB,8BAAmB,CAAA;AACrB,CAAC,EALW,OAAO,KAAP,OAAO,QAKlB;AA6BD,MAAM,CAAN,IAAY,2BAGX;AAHD,WAAY,2BAA2B;IACrC,oEAAqC,CAAA;IACrC,8CAAe,CAAA;AACjB,CAAC,EAHW,2BAA2B,KAA3B,2BAA2B,QAGtC;AAmDD,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,mBAAwC,EACxC,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB;QACE,GAAG,EAAE,mCAAmC;QACxC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,mBAAmB;KAC1B,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAC9B,MAA+B,EAC/B,OAA8C,EAC9C,EAAE;IACF,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B,EAAE;QAC/C,IAAI,EAAE,uBAAuB;KAC9B,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB,EAAE,GAAG,EAAE,wCAAwC,EAAE,MAAM,EAAE,KAAK,EAAE,EAChE,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,EAAU,EACV,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB,EAAE,GAAG,EAAE,0CAA0C,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,EACtE,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,EAAU,EACV,uBAAgD,EAChD,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB;QACE,GAAG,EAAE,0CAA0C,EAAE,EAAE;QACnD,MAAM,EAAE,OAAO;QACf,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,uBAAuB;KAC9B,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,EAAU,EACV,OAA8C,EAC9C,EAAE;IACF,OAAO,YAAY,CACjB,EAAE,GAAG,EAAE,0CAA0C,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EACzE,OAAO,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=awaited-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awaited-type.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/orval/awaited-type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,44 @@
1
+ export async function customClient(orvalParams, customParams) {
2
+ const { url, method, data } = orvalParams;
3
+ const { mode, cache, credentials } = customParams;
4
+ const { headers, params } = combineParams(orvalParams, customParams);
5
+ const baseUrl = removeTrailingSlash(customParams.hubApiUrl);
6
+ const requestUrl = `${baseUrl}${url}?${new URLSearchParams(params)}`;
7
+ const requestOptions = {
8
+ headers,
9
+ method,
10
+ cache,
11
+ credentials,
12
+ mode,
13
+ };
14
+ if (data) {
15
+ requestOptions.body = JSON.stringify(data);
16
+ }
17
+ const res = await fetch(requestUrl, requestOptions);
18
+ const { statusText, status } = res;
19
+ if (res.ok) {
20
+ return res.json();
21
+ }
22
+ const error = await res.json();
23
+ throw new RemoteServerError(statusText, requestUrl, status, JSON.stringify(error.message));
24
+ }
25
+ function removeTrailingSlash(hubApiUrl = "https://hub.arcgis.com") {
26
+ return hubApiUrl.replace(/\/$/, "");
27
+ }
28
+ function combineParams(orvalParams, options) {
29
+ const headers = new Headers(Object.assign(Object.assign({}, orvalParams.headers), options.headers));
30
+ if (options.token) {
31
+ headers.set("Authorization", options.token);
32
+ }
33
+ const params = Object.assign(Object.assign({}, orvalParams.params), options.params);
34
+ return { headers, params };
35
+ }
36
+ class RemoteServerError extends Error {
37
+ constructor(message, url, status, error) {
38
+ super(message);
39
+ this.status = status;
40
+ this.url = url;
41
+ this.error = error;
42
+ }
43
+ }
44
+ //# sourceMappingURL=custom-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-client.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/orval/custom-client.ts"],"names":[],"mappings":"AAuBA,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,WAAyB,EACzB,YAA2B;IAE3B,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;IAC1C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAErE,MAAM,OAAO,GAAG,mB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,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAKnC,YAAY,OAAe,EAAE,GAAW,EAAE,MAAc,EAAE,KAAa;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,53 @@
1
+ import { authenticateRequest } from "./utils/authenticate-request";
2
+ import { subscribe as _subscribe, createSubscription as _createSubscription, getSubscriptions as _getSubscriptions, getSubscription as _getSubscription, updateSubscription as _updateSubscription, } from "./orval/api/orval-newsletters";
3
+ /**
4
+ * create a subscription for user (existing or not) to a newsletter
5
+ *
6
+ * @param {ISubscribeParams} options
7
+ * @return {Promise<ISubscription>}
8
+ */
9
+ export async function subscribe(options) {
10
+ options.token = await authenticateRequest(options);
11
+ return _subscribe(options.data, options);
12
+ }
13
+ /**
14
+ * create a subscription for user (existing) to a newsletter
15
+ *
16
+ * @param {ICreateSubscriptionParams} options
17
+ * @return {Promise<ISubscription>}
18
+ */
19
+ export async function createSubscription(options) {
20
+ options.token = await authenticateRequest(options);
21
+ return _createSubscription(options.data, options);
22
+ }
23
+ /**
24
+ * get subscriptions
25
+ *
26
+ * @param {IGetSubscriptionsParams} options
27
+ * @return {Promise<ISubscription[]>}
28
+ */
29
+ export async function getSubscriptions(options) {
30
+ options.token = await authenticateRequest(options);
31
+ return _getSubscriptions(options.data, options);
32
+ }
33
+ /**
34
+ * get a subscription
35
+ *
36
+ * @param {IGetSubscriptionParams} options
37
+ * @return {Promise<ISubscription>}
38
+ */
39
+ export async function getSubscription(options) {
40
+ options.token = await authenticateRequest(options);
41
+ return _getSubscription(options.subscriptionId, options);
42
+ }
43
+ /**
44
+ * update a subscription
45
+ *
46
+ * @param {IUpdateSubscriptionParams} options
47
+ * @return {Promise<ISubscription>}
48
+ */
49
+ export async function updateSubscription(options) {
50
+ options.token = await authenticateRequest(options);
51
+ return _updateSubscription(options.subscriptionId, options.data, options);
52
+ }
53
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../../src/newsletters/api/subscriptions.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,SAAS,IAAI,UAAU,EACvB,kBAAkB,IAAI,mBAAmB,EACzC,gBAAgB,IAAI,iBAAiB,EACrC,eAAe,IAAI,gBAAgB,EACnC,kBAAkB,IAAI,mBAAmB,GAC1C,MAAM,+BAA+B,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAyB;IAEzB,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,mBAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,OAAgC;IAEhC,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA+B;IAE/B,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,gBAAgB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,mBAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { Cadence, DeliveryMethod, SystemNotificationSpecNames, } from "./orval/api/orval-newsletters";
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/newsletters/api/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,OAAO,EACP,cAAc,EAQd,2BAA2B,GAC5B,MAAM,+BAA+B,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { authenticateRequest } from "./utils/authenticate-request";
2
+ import { createUser as _createUser, getUser as _getUser, updateUser as _updateUser, deleteUser as _deleteUser, } from "./orval/api/orval-newsletters";
3
+ /**
4
+ * create a user
5
+ *
6
+ * @param {ICreateUserParams} options
7
+ * @return {Promise<IUser>}
8
+ */
9
+ export async function createUser(options) {
10
+ options.token = await authenticateRequest(options);
11
+ return _createUser(options.data, options);
12
+ }
13
+ /**
14
+ * get a user
15
+ *
16
+ * @param {IGetUserParams} options
17
+ * @return {Promise<IUser>}
18
+ */
19
+ export async function getUser(options) {
20
+ options.token = await authenticateRequest(options);
21
+ return _getUser(options.userId, options);
22
+ }
23
+ /**
24
+ * update a user
25
+ *
26
+ * @param {IUpdateUserParams} options
27
+ * @return {Promise<IUser>}
28
+ */
29
+ export async function updateUser(options) {
30
+ options.token = await authenticateRequest(options);
31
+ return _updateUser(options.userId, options.data, options);
32
+ }
33
+ /**
34
+ * delete a user
35
+ *
36
+ * @param {IDeleteUserParams} options
37
+ * @return {Promise<IUser>}
38
+ */
39
+ export async function deleteUser(options) {
40
+ options.token = await authenticateRequest(options);
41
+ return _deleteUser(options.userId, options);
42
+ }
43
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../../../src/newsletters/api/users.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EACL,UAAU,IAAI,WAAW,EACzB,OAAO,IAAI,QAAQ,EACnB,UAAU,IAAI,WAAW,EACzB,UAAU,IAAI,WAAW,GAC1B,MAAM,+BAA+B,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA0B;IACzD,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,WAAW,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,OAAO,CAAC,OAAuB;IACnD,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA0B;IACzD,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,OAA0B;IACzD,OAAO,CAAC,KAAK,GAAG,MAAM,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,WAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * return a token created using options.authentication or set on options.token
3
+ *
4
+ * @export
5
+ * @param {INewslettersRequestOptions} options
6
+ * @return {*} {Promise<string>}
7
+ */
8
+ export function authenticateRequest(options) {
9
+ const { token, authentication } = options;
10
+ if (authentication) {
11
+ return authentication.getToken(authentication.portal);
12
+ }
13
+ return Promise.resolve(token);
14
+ }
15
+ //# sourceMappingURL=authenticate-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate-request.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/utils/authenticate-request.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAmC;IAEnC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE1C,IAAI,cAAc,EAAE;QAClB,OAAO,cAAc,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./api";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/newsletters/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
@@ -28,7 +28,7 @@ exports.getEvents = getEvents;
28
28
  /**
29
29
  * get an event
30
30
  *
31
- * @param {ICreateEventParams} options
31
+ * @param {IGetEventParams} options
32
32
  * @return {Promise<IEvent>}
33
33
  */
34
34
  async function getEvent(options) {
@@ -5,7 +5,7 @@ exports.authenticateRequest = void 0;
5
5
  * return a token created using options.authentication or set on options.token
6
6
  *
7
7
  * @export
8
- * @param {IDiscussionsRequestOptions} options
8
+ * @param {IEventsRequestOptions} options
9
9
  * @return {*} {Promise<string>}
10
10
  */
11
11
  function authenticateRequest(options) {
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./subscriptions"), exports);
5
+ tslib_1.__exportStar(require("./users"), exports);
6
+ tslib_1.__exportStar(require("./types"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/newsletters/api/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,kDAAwB;AACxB,kDAAwB"}
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteNotificationSpec = exports.updateNotificationSpec = exports.getNotificationSpec = exports.getNotificationSpecs = exports.createNotificationSpec = exports.deleteUser = exports.updateUser = exports.getUser = exports.getUsers = exports.createUser = exports.deleteSubscription = exports.updateSubscription = exports.getSubscription = exports.subscribe = exports.getSubscriptions = exports.createSubscription = exports.SystemNotificationSpecNames = exports.Cadence = exports.DeliveryMethod = void 0;
4
+ /**
5
+ * Generated by orval v6.24.0 🍺
6
+ * Do not edit manually.
7
+ * Hub Newsletters Service
8
+ * OpenAPI spec version: 0.0.1
9
+ */
10
+ const custom_client_1 = require("../custom-client");
11
+ var DeliveryMethod;
12
+ (function (DeliveryMethod) {
13
+ DeliveryMethod["EMAIL"] = "EMAIL";
14
+ })(DeliveryMethod = exports.DeliveryMethod || (exports.DeliveryMethod = {}));
15
+ var Cadence;
16
+ (function (Cadence) {
17
+ Cadence["ON_EVENT"] = "ON_EVENT";
18
+ Cadence["DAILY"] = "DAILY";
19
+ Cadence["WEEKLY"] = "WEEKLY";
20
+ Cadence["MONTHLY"] = "MONTHLY";
21
+ })(Cadence = exports.Cadence || (exports.Cadence = {}));
22
+ var SystemNotificationSpecNames;
23
+ (function (SystemNotificationSpecNames) {
24
+ SystemNotificationSpecNames["TELEMETRY_REPORT"] = "TELEMETRY_REPORT";
25
+ SystemNotificationSpecNames["EVENT"] = "EVENT";
26
+ })(SystemNotificationSpecNames = exports.SystemNotificationSpecNames || (exports.SystemNotificationSpecNames = {}));
27
+ exports.createSubscription = (iCreateSubscription, options) => {
28
+ return custom_client_1.customClient({
29
+ url: `/api/newsletters/v1/subscriptions`,
30
+ method: "POST",
31
+ headers: { "Content-Type": "application/json" },
32
+ data: iCreateSubscription,
33
+ }, options);
34
+ };
35
+ exports.getSubscriptions = (params, options) => {
36
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/subscriptions`, method: "GET", params }, options);
37
+ };
38
+ exports.subscribe = (iSubscribe, options) => {
39
+ return custom_client_1.customClient({
40
+ url: `/api/newsletters/v1/subscriptions/subscribe`,
41
+ method: "POST",
42
+ headers: { "Content-Type": "application/json" },
43
+ data: iSubscribe,
44
+ }, options);
45
+ };
46
+ exports.getSubscription = (id, options) => {
47
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/subscriptions/${id}`, method: "GET" }, options);
48
+ };
49
+ exports.updateSubscription = (id, iUpdateSubscription, options) => {
50
+ return custom_client_1.customClient({
51
+ url: `/api/newsletters/v1/subscriptions/${id}`,
52
+ method: "PATCH",
53
+ headers: { "Content-Type": "application/json" },
54
+ data: iUpdateSubscription,
55
+ }, options);
56
+ };
57
+ exports.deleteSubscription = (id, options) => {
58
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/subscriptions/${id}`, method: "DELETE" }, options);
59
+ };
60
+ exports.createUser = (iCreateUser, options) => {
61
+ return custom_client_1.customClient({
62
+ url: `/api/newsletters/v1/users`,
63
+ method: "POST",
64
+ headers: { "Content-Type": "application/json" },
65
+ data: iCreateUser,
66
+ }, options);
67
+ };
68
+ exports.getUsers = (options) => {
69
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/users`, method: "GET" }, options);
70
+ };
71
+ exports.getUser = (userId, options) => {
72
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/users/${userId}`, method: "GET" }, options);
73
+ };
74
+ exports.updateUser = (userId, iUpdateUser, options) => {
75
+ return custom_client_1.customClient({
76
+ url: `/api/newsletters/v1/users/${userId}`,
77
+ method: "PATCH",
78
+ headers: { "Content-Type": "application/json" },
79
+ data: iUpdateUser,
80
+ }, options);
81
+ };
82
+ exports.deleteUser = (userId, options) => {
83
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/users/${userId}`, method: "DELETE" }, options);
84
+ };
85
+ exports.createNotificationSpec = (iCreateNotificationSpec, options) => {
86
+ return custom_client_1.customClient({
87
+ url: `/api/newsletters/v1/notification-specs`,
88
+ method: "POST",
89
+ headers: { "Content-Type": "application/json" },
90
+ data: iCreateNotificationSpec,
91
+ }, options);
92
+ };
93
+ exports.getNotificationSpecs = (options) => {
94
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/notification-specs`, method: "GET" }, options);
95
+ };
96
+ exports.getNotificationSpec = (id, options) => {
97
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/notification-specs/${id}`, method: "GET" }, options);
98
+ };
99
+ exports.updateNotificationSpec = (id, iUpdateNotificationSpec, options) => {
100
+ return custom_client_1.customClient({
101
+ url: `/api/newsletters/v1/notification-specs/${id}`,
102
+ method: "PATCH",
103
+ headers: { "Content-Type": "application/json" },
104
+ data: iUpdateNotificationSpec,
105
+ }, options);
106
+ };
107
+ exports.deleteNotificationSpec = (id, options) => {
108
+ return custom_client_1.customClient({ url: `/api/newsletters/v1/notification-specs/${id}`, method: "DELETE" }, options);
109
+ };
110
+ //# sourceMappingURL=orval-newsletters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orval-newsletters.js","sourceRoot":"","sources":["../../../../../../src/newsletters/api/orval/api/orval-newsletters.ts"],"names":[],"mappings":";;;AAGA;;;;;GAKG;AACH,oDAAgD;AAuGhD,IAAY,cAEX;AAFD,WAAY,cAAc;IACxB,iCAAe,CAAA;AACjB,CAAC,EAFW,cAAc,GAAd,sBAAc,KAAd,sBAAc,QAEzB;AACD,IAAY,OAK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,EACD,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAEW,QAAA,sBAAsB,GAAG,CACpC,EAAU,EACV,OAA8C,EAC9C,EAAE;IACF,OAAO,4BAAY,CACjB,EAAE,GAAG,EAAE,0CAA0C,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,EACzE,OAAO,CACR,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=awaited-type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"awaited-type.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/orval/awaited-type.ts"],"names":[],"mappings":""}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.customClient = void 0;
4
+ async function customClient(orvalParams, customParams) {
5
+ const { url, method, data } = orvalParams;
6
+ const { mode, cache, credentials } = customParams;
7
+ const { headers, params } = combineParams(orvalParams, customParams);
8
+ const baseUrl = removeTrailingSlash(customParams.hubApiUrl);
9
+ const requestUrl = `${baseUrl}${url}?${new URLSearchParams(params)}`;
10
+ const requestOptions = {
11
+ headers,
12
+ method,
13
+ cache,
14
+ credentials,
15
+ mode,
16
+ };
17
+ if (data) {
18
+ requestOptions.body = JSON.stringify(data);
19
+ }
20
+ const res = await fetch(requestUrl, requestOptions);
21
+ const { statusText, status } = res;
22
+ if (res.ok) {
23
+ return res.json();
24
+ }
25
+ const error = await res.json();
26
+ throw new RemoteServerError(statusText, requestUrl, status, JSON.stringify(error.message));
27
+ }
28
+ exports.customClient = customClient;
29
+ function removeTrailingSlash(hubApiUrl = "https://hub.arcgis.com") {
30
+ return hubApiUrl.replace(/\/$/, "");
31
+ }
32
+ function combineParams(orvalParams, options) {
33
+ const headers = new Headers(Object.assign(Object.assign({}, orvalParams.headers), options.headers));
34
+ if (options.token) {
35
+ headers.set("Authorization", options.token);
36
+ }
37
+ const params = Object.assign(Object.assign({}, orvalParams.params), options.params);
38
+ return { headers, params };
39
+ }
40
+ class RemoteServerError extends Error {
41
+ constructor(message, url, status, error) {
42
+ super(message);
43
+ this.status = status;
44
+ this.url = url;
45
+ this.error = error;
46
+ }
47
+ }
48
+ //# sourceMappingURL=custom-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"custom-client.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/orval/custom-client.ts"],"names":[],"mappings":";;;AAuBO,KAAK,UAAU,YAAY,CAChC,WAAyB,EACzB,YAA2B;IAE3B,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,WAAW,CAAC;IAC1C,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,GAAG,YAAY,CAAC;IAClD,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAErE,MAAM,OAAO,GAAG,mBAAmB,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,GAAG,OAAO,GAAG,GAAG,IAAI,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAErE,MAAM,cAAc,GAAgB;QAClC,OAAO;QACP,MAAM;QACN,KAAK;QACL,WAAW;QACX,IAAI;KACL,CAAC;IACF,IAAI,IAAI,EAAE;QACR,cAAc,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAC5C;IAED,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC;IACpD,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAEnC,IAAI,GAAG,CAAC,EAAE,EAAE;QACV,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC;KACnB;IAED,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC/B,MAAM,IAAI,iBAAiB,CACzB,UAAU,EACV,UAAU,EACV,MAAM,EACN,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAC9B,CAAC;AACJ,CAAC;AApCD,oCAoCC;AAED,SAAS,mBAAmB,CAAC,SAAS,GAAG,wBAAwB;IAC/D,OAAO,SAAS,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,aAAa,CAAC,WAAyB,EAAE,OAAsB;IACtE,MAAM,OAAO,GAAG,IAAI,OAAO,iCACtB,WAAW,CAAC,OAAO,GACnB,OAAO,CAAC,OAAO,EAClB,CAAC;IACH,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC;KAC7C;IAED,MAAM,MAAM,mCACP,WAAW,CAAC,MAAM,GAClB,OAAO,CAAC,MAAM,CAClB,CAAC;IAEF,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AAC7B,CAAC;AAED,MAAM,iBAAkB,SAAQ,KAAK;IAKnC,YAAY,OAAe,EAAE,GAAW,EAAE,MAAc,EAAE,KAAa;QACrE,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;CACF"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateSubscription = exports.getSubscription = exports.getSubscriptions = exports.createSubscription = exports.subscribe = void 0;
4
+ const authenticate_request_1 = require("./utils/authenticate-request");
5
+ const orval_newsletters_1 = require("./orval/api/orval-newsletters");
6
+ /**
7
+ * create a subscription for user (existing or not) to a newsletter
8
+ *
9
+ * @param {ISubscribeParams} options
10
+ * @return {Promise<ISubscription>}
11
+ */
12
+ async function subscribe(options) {
13
+ options.token = await authenticate_request_1.authenticateRequest(options);
14
+ return orval_newsletters_1.subscribe(options.data, options);
15
+ }
16
+ exports.subscribe = subscribe;
17
+ /**
18
+ * create a subscription for user (existing) to a newsletter
19
+ *
20
+ * @param {ICreateSubscriptionParams} options
21
+ * @return {Promise<ISubscription>}
22
+ */
23
+ async function createSubscription(options) {
24
+ options.token = await authenticate_request_1.authenticateRequest(options);
25
+ return orval_newsletters_1.createSubscription(options.data, options);
26
+ }
27
+ exports.createSubscription = createSubscription;
28
+ /**
29
+ * get subscriptions
30
+ *
31
+ * @param {IGetSubscriptionsParams} options
32
+ * @return {Promise<ISubscription[]>}
33
+ */
34
+ async function getSubscriptions(options) {
35
+ options.token = await authenticate_request_1.authenticateRequest(options);
36
+ return orval_newsletters_1.getSubscriptions(options.data, options);
37
+ }
38
+ exports.getSubscriptions = getSubscriptions;
39
+ /**
40
+ * get a subscription
41
+ *
42
+ * @param {IGetSubscriptionParams} options
43
+ * @return {Promise<ISubscription>}
44
+ */
45
+ async function getSubscription(options) {
46
+ options.token = await authenticate_request_1.authenticateRequest(options);
47
+ return orval_newsletters_1.getSubscription(options.subscriptionId, options);
48
+ }
49
+ exports.getSubscription = getSubscription;
50
+ /**
51
+ * update a subscription
52
+ *
53
+ * @param {IUpdateSubscriptionParams} options
54
+ * @return {Promise<ISubscription>}
55
+ */
56
+ async function updateSubscription(options) {
57
+ options.token = await authenticate_request_1.authenticateRequest(options);
58
+ return orval_newsletters_1.updateSubscription(options.subscriptionId, options.data, options);
59
+ }
60
+ exports.updateSubscription = updateSubscription;
61
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../../../src/newsletters/api/subscriptions.ts"],"names":[],"mappings":";;;AAQA,uEAAmE;AACnE,qEAMuC;AAEvC;;;;;GAKG;AACI,KAAK,UAAU,SAAS,CAC7B,OAAyB;IAEzB,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,6BAAU,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AALD,8BAKC;AAED;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,sCAAmB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACpD,CAAC;AALD,gDAKC;AAED;;;;;GAKG;AACI,KAAK,UAAU,gBAAgB,CACpC,OAAgC;IAEhC,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,oCAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAClD,CAAC;AALD,4CAKC;AAED;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CACnC,OAA+B;IAE/B,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,mCAAgB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAC3D,CAAC;AALD,0CAKC;AAED;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CACtC,OAAkC;IAElC,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,sCAAmB,CAAC,OAAO,CAAC,cAAc,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5E,CAAC;AALD,gDAKC"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var orval_newsletters_1 = require("./orval/api/orval-newsletters");
4
+ Object.defineProperty(exports, "Cadence", { enumerable: true, get: function () { return orval_newsletters_1.Cadence; } });
5
+ Object.defineProperty(exports, "DeliveryMethod", { enumerable: true, get: function () { return orval_newsletters_1.DeliveryMethod; } });
6
+ Object.defineProperty(exports, "SystemNotificationSpecNames", { enumerable: true, get: function () { return orval_newsletters_1.SystemNotificationSpecNames; } });
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/newsletters/api/types.ts"],"names":[],"mappings":";;AAAA,mEAWuC;AAVrC,4GAAA,OAAO,OAAA;AACP,mHAAA,cAAc,OAAA;AAQd,gIAAA,2BAA2B,OAAA"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteUser = exports.updateUser = exports.getUser = exports.createUser = void 0;
4
+ const authenticate_request_1 = require("./utils/authenticate-request");
5
+ const orval_newsletters_1 = require("./orval/api/orval-newsletters");
6
+ /**
7
+ * create a user
8
+ *
9
+ * @param {ICreateUserParams} options
10
+ * @return {Promise<IUser>}
11
+ */
12
+ async function createUser(options) {
13
+ options.token = await authenticate_request_1.authenticateRequest(options);
14
+ return orval_newsletters_1.createUser(options.data, options);
15
+ }
16
+ exports.createUser = createUser;
17
+ /**
18
+ * get a user
19
+ *
20
+ * @param {IGetUserParams} options
21
+ * @return {Promise<IUser>}
22
+ */
23
+ async function getUser(options) {
24
+ options.token = await authenticate_request_1.authenticateRequest(options);
25
+ return orval_newsletters_1.getUser(options.userId, options);
26
+ }
27
+ exports.getUser = getUser;
28
+ /**
29
+ * update a user
30
+ *
31
+ * @param {IUpdateUserParams} options
32
+ * @return {Promise<IUser>}
33
+ */
34
+ async function updateUser(options) {
35
+ options.token = await authenticate_request_1.authenticateRequest(options);
36
+ return orval_newsletters_1.updateUser(options.userId, options.data, options);
37
+ }
38
+ exports.updateUser = updateUser;
39
+ /**
40
+ * delete a user
41
+ *
42
+ * @param {IDeleteUserParams} options
43
+ * @return {Promise<IUser>}
44
+ */
45
+ async function deleteUser(options) {
46
+ options.token = await authenticate_request_1.authenticateRequest(options);
47
+ return orval_newsletters_1.deleteUser(options.userId, options);
48
+ }
49
+ exports.deleteUser = deleteUser;
50
+ //# sourceMappingURL=users.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"users.js","sourceRoot":"","sources":["../../../../src/newsletters/api/users.ts"],"names":[],"mappings":";;;AAOA,uEAAmE;AACnE,qEAKuC;AAEvC;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAAC,OAA0B;IACzD,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,8BAAW,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC;AAHD,gCAGC;AAED;;;;;GAKG;AACI,KAAK,UAAU,OAAO,CAAC,OAAuB;IACnD,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,2BAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC;AAHD,0BAGC;AAED;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAAC,OAA0B;IACzD,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,8BAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC5D,CAAC;AAHD,gCAGC;AAED;;;;;GAKG;AACI,KAAK,UAAU,UAAU,CAAC,OAA0B;IACzD,OAAO,CAAC,KAAK,GAAG,MAAM,0CAAmB,CAAC,OAAO,CAAC,CAAC;IACnD,OAAO,8BAAW,CAAC,OAAO,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC;AAHD,gCAGC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.authenticateRequest = void 0;
4
+ /**
5
+ * return a token created using options.authentication or set on options.token
6
+ *
7
+ * @export
8
+ * @param {INewslettersRequestOptions} options
9
+ * @return {*} {Promise<string>}
10
+ */
11
+ function authenticateRequest(options) {
12
+ const { token, authentication } = options;
13
+ if (authentication) {
14
+ return authentication.getToken(authentication.portal);
15
+ }
16
+ return Promise.resolve(token);
17
+ }
18
+ exports.authenticateRequest = authenticateRequest;
19
+ //# sourceMappingURL=authenticate-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authenticate-request.js","sourceRoot":"","sources":["../../../../../src/newsletters/api/utils/authenticate-request.ts"],"names":[],"mappings":";;;AAEA;;;;;;GAMG;AACH,SAAgB,mBAAmB,CACjC,OAAmC;IAEnC,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC;IAE1C,IAAI,cAAc,EAAE;QAClB,OAAO,cAAc,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;KACvD;IAED,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAChC,CAAC;AAVD,kDAUC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./api"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/newsletters/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
@@ -16,7 +16,7 @@ export declare function getEvents(options: IGetEventsParams): Promise<IEvent[]>;
16
16
  /**
17
17
  * get an event
18
18
  *
19
- * @param {ICreateEventParams} options
19
+ * @param {IGetEventParams} options
20
20
  * @return {Promise<IEvent>}
21
21
  */
22
22
  export declare function getEvent(options: IGetEventParams): Promise<IEvent>;
@@ -3,7 +3,7 @@ import { IEventsRequestOptions } from "../types";
3
3
  * return a token created using options.authentication or set on options.token
4
4
  *
5
5
  * @export
6
- * @param {IDiscussionsRequestOptions} options
6
+ * @param {IEventsRequestOptions} options
7
7
  * @return {*} {Promise<string>}
8
8
  */
9
9
  export declare function authenticateRequest(options: IEventsRequestOptions): Promise<string>;
@@ -0,0 +1,3 @@
1
+ export * from "./subscriptions";
2
+ export * from "./users";
3
+ export * from "./types";
@@ -0,0 +1,215 @@
1
+ import { Awaited } from "../awaited-type";
2
+ /**
3
+ * Generated by orval v6.24.0 🍺
4
+ * Do not edit manually.
5
+ * Hub Newsletters Service
6
+ * OpenAPI spec version: 0.0.1
7
+ */
8
+ import { customClient } from "../custom-client";
9
+ export declare type GetSubscriptionsParams = {
10
+ /**
11
+ * Optional array of matching notification spec names to filter by
12
+ */
13
+ names?: string[];
14
+ /**
15
+ * Optional cadence to filter by
16
+ */
17
+ cadence?: Cadence;
18
+ /**
19
+ * Optional user id to filter by. Note this gets extracted/overridden from AGO token if provided
20
+ */
21
+ userId?: string;
22
+ /**
23
+ * Optional flag for filtering active subscriptions
24
+ */
25
+ active?: boolean;
26
+ };
27
+ export interface IUpdateNotificationSpec {
28
+ /** Description of the notification spec */
29
+ description?: string;
30
+ /** Name identifier for the notification spec */
31
+ name?: string;
32
+ }
33
+ export interface ICreateNotificationSpec {
34
+ /** Description of the notification spec */
35
+ description?: string;
36
+ /** Name identifier for the notification spec */
37
+ name: string;
38
+ }
39
+ export interface IUpdateUser {
40
+ /** Flag for deleted user */
41
+ deleted?: boolean;
42
+ /** Email for the subscriber. Will always be extracted from the token unless service token is used. */
43
+ email?: string;
44
+ /** First name for the subscriber. Will always be extracted from the token unless service token is used. */
45
+ firstName?: string;
46
+ /** Last name for the subscriber. Will always be extracted from the token unless service token is used. */
47
+ lastName?: string;
48
+ /** Flag for unsubscribed user */
49
+ optedOut?: boolean;
50
+ /** Username for the subscriber. Will always be extracted from the token unless service token is used. */
51
+ username?: string;
52
+ }
53
+ export interface ICreateUser {
54
+ /** ArcGIS Online id for a user. Will always be extracted from the token unless service token is used. */
55
+ agoId?: string;
56
+ /** Flag for deleted user */
57
+ deleted?: boolean;
58
+ /** Email for the subscriber. Will always be extracted from the token unless service token is used. */
59
+ email?: string;
60
+ /** First name for the subscriber. Will always be extracted from the token unless service token is used. */
61
+ firstName?: string;
62
+ /** Last name for the subscriber. Will always be extracted from the token unless service token is used. */
63
+ lastName?: string;
64
+ /** Flag for unsubscribed user */
65
+ optedOut?: boolean;
66
+ /** Username for the subscriber. Will always be extracted from the token unless service token is used. */
67
+ username?: string;
68
+ }
69
+ /**
70
+ * Metadata for the subscription
71
+ */
72
+ export declare type ISubscribeMetadata = ICreateEventMetadata | ICreateTelemetryReportMetadata;
73
+ export declare type ISubscriptionMetadata = {
74
+ [key: string]: any;
75
+ };
76
+ export interface IUser {
77
+ agoId: string;
78
+ createdAt: string;
79
+ deleted: boolean;
80
+ email: string;
81
+ firstName: string;
82
+ lastName: string;
83
+ optedOut: boolean;
84
+ updatedAt: string;
85
+ username: string;
86
+ }
87
+ export interface INotificationSpec {
88
+ createdAt: string;
89
+ createdById: string;
90
+ description: string;
91
+ id: number;
92
+ name: string;
93
+ updatedAt: string;
94
+ }
95
+ /**
96
+ * Metadata for the subscription
97
+ */
98
+ export declare type ICreateSubscriptionMetadata = ICreateEventMetadata | ICreateTelemetryReportMetadata;
99
+ export declare enum DeliveryMethod {
100
+ EMAIL = "EMAIL"
101
+ }
102
+ export declare enum Cadence {
103
+ ON_EVENT = "ON_EVENT",
104
+ DAILY = "DAILY",
105
+ WEEKLY = "WEEKLY",
106
+ MONTHLY = "MONTHLY"
107
+ }
108
+ export interface IUpdateSubscription {
109
+ /** Flag to opt user in or out of subscription */
110
+ active?: boolean;
111
+ /** Frequency of the subscription */
112
+ cadence?: Cadence;
113
+ /** Delivery method for subscription, ie email or text */
114
+ deliveryMethod?: DeliveryMethod;
115
+ /** Last delivered datetime string of the subscription in ISO 8601 format */
116
+ lastDelivery?: string;
117
+ /** ArcGIS Online id for a user. Will always be extracted from the token unless service token is used. */
118
+ userId?: string;
119
+ }
120
+ export interface ISubscription {
121
+ active: boolean;
122
+ cadence: Cadence;
123
+ createdAt: string;
124
+ deliveryMethod: DeliveryMethod;
125
+ id: number;
126
+ lastDelivery: string;
127
+ metadata: ISubscriptionMetadata;
128
+ notificationSpec?: INotificationSpec;
129
+ notificationSpecId: number;
130
+ updatedAt: string;
131
+ user?: IUser;
132
+ userId: string;
133
+ }
134
+ export declare enum SystemNotificationSpecNames {
135
+ TELEMETRY_REPORT = "TELEMETRY_REPORT",
136
+ EVENT = "EVENT"
137
+ }
138
+ export interface ISubscribe {
139
+ /** ArcGIS Online id for a user. Will always be extracted from the token unless service token is used. */
140
+ agoId?: string;
141
+ /** Frequency of the subscription */
142
+ cadence: Cadence;
143
+ /** Flag for deleted user */
144
+ deleted?: boolean;
145
+ /** Delivery method for subscription, ie email or text */
146
+ deliveryMethod: DeliveryMethod;
147
+ /** Email for the subscriber. Will always be extracted from the token unless service token is used. */
148
+ email?: string;
149
+ /** First name for the subscriber. Will always be extracted from the token unless service token is used. */
150
+ firstName?: string;
151
+ /** Last name for the subscriber. Will always be extracted from the token unless service token is used. */
152
+ lastName?: string;
153
+ /** Metadata for the subscription */
154
+ metadata: ISubscribeMetadata;
155
+ /** Notification spec name for the subscription */
156
+ notificationSpecName: SystemNotificationSpecNames;
157
+ /** Flag for unsubscribed user */
158
+ optedOut?: boolean;
159
+ /** Username for the subscriber. Will always be extracted from the token unless service token is used. */
160
+ username?: string;
161
+ }
162
+ export interface ICreateSubscription {
163
+ /** Frequency of the subscription */
164
+ cadence: Cadence;
165
+ /** Delivery method for subscription, ie email or text */
166
+ deliveryMethod: DeliveryMethod;
167
+ /** Metadata for the subscription */
168
+ metadata: ICreateSubscriptionMetadata;
169
+ /** Notification spec name for the subscription */
170
+ notificationSpecName: SystemNotificationSpecNames;
171
+ /** AGO id for user which subscription belongs to */
172
+ userId: string;
173
+ }
174
+ export interface ICreateEventMetadata {
175
+ /** Event id for the subscription */
176
+ eventId: string;
177
+ }
178
+ export interface ICreateTelemetryReportMetadata {
179
+ /** Hostname for telemetry report. */
180
+ hostname: string;
181
+ }
182
+ declare type SecondParameter<T extends (...args: any) => any> = Parameters<T>[1];
183
+ export declare const createSubscription: (iCreateSubscription: ICreateSubscription, options?: SecondParameter<typeof customClient>) => Promise<ISubscription>;
184
+ export declare const getSubscriptions: (params?: GetSubscriptionsParams, options?: SecondParameter<typeof customClient>) => Promise<ISubscription[]>;
185
+ export declare const subscribe: (iSubscribe: ISubscribe, options?: SecondParameter<typeof customClient>) => Promise<ISubscription>;
186
+ export declare const getSubscription: (id: number, options?: SecondParameter<typeof customClient>) => Promise<ISubscription>;
187
+ export declare const updateSubscription: (id: number, iUpdateSubscription: IUpdateSubscription, options?: SecondParameter<typeof customClient>) => Promise<ISubscription>;
188
+ export declare const deleteSubscription: (id: number, options?: SecondParameter<typeof customClient>) => Promise<ISubscription>;
189
+ export declare const createUser: (iCreateUser: ICreateUser, options?: SecondParameter<typeof customClient>) => Promise<IUser>;
190
+ export declare const getUsers: (options?: SecondParameter<typeof customClient>) => Promise<IUser[]>;
191
+ export declare const getUser: (userId: string, options?: SecondParameter<typeof customClient>) => Promise<IUser>;
192
+ export declare const updateUser: (userId: string, iUpdateUser: IUpdateUser, options?: SecondParameter<typeof customClient>) => Promise<IUser>;
193
+ export declare const deleteUser: (userId: string, options?: SecondParameter<typeof customClient>) => Promise<IUser>;
194
+ export declare const createNotificationSpec: (iCreateNotificationSpec: ICreateNotificationSpec, options?: SecondParameter<typeof customClient>) => Promise<INotificationSpec>;
195
+ export declare const getNotificationSpecs: (options?: SecondParameter<typeof customClient>) => Promise<INotificationSpec[]>;
196
+ export declare const getNotificationSpec: (id: number, options?: SecondParameter<typeof customClient>) => Promise<INotificationSpec>;
197
+ export declare const updateNotificationSpec: (id: number, iUpdateNotificationSpec: IUpdateNotificationSpec, options?: SecondParameter<typeof customClient>) => Promise<INotificationSpec>;
198
+ export declare const deleteNotificationSpec: (id: number, options?: SecondParameter<typeof customClient>) => Promise<INotificationSpec>;
199
+ export declare type CreateSubscriptionResult = NonNullable<Awaited<ReturnType<typeof createSubscription>>>;
200
+ export declare type GetSubscriptionsResult = NonNullable<Awaited<ReturnType<typeof getSubscriptions>>>;
201
+ export declare type SubscribeResult = NonNullable<Awaited<ReturnType<typeof subscribe>>>;
202
+ export declare type GetSubscriptionResult = NonNullable<Awaited<ReturnType<typeof getSubscription>>>;
203
+ export declare type UpdateSubscriptionResult = NonNullable<Awaited<ReturnType<typeof updateSubscription>>>;
204
+ export declare type DeleteSubscriptionResult = NonNullable<Awaited<ReturnType<typeof deleteSubscription>>>;
205
+ export declare type CreateUserResult = NonNullable<Awaited<ReturnType<typeof createUser>>>;
206
+ export declare type GetUsersResult = NonNullable<Awaited<ReturnType<typeof getUsers>>>;
207
+ export declare type GetUserResult = NonNullable<Awaited<ReturnType<typeof getUser>>>;
208
+ export declare type UpdateUserResult = NonNullable<Awaited<ReturnType<typeof updateUser>>>;
209
+ export declare type DeleteUserResult = NonNullable<Awaited<ReturnType<typeof deleteUser>>>;
210
+ export declare type CreateNotificationSpecResult = NonNullable<Awaited<ReturnType<typeof createNotificationSpec>>>;
211
+ export declare type GetNotificationSpecsResult = NonNullable<Awaited<ReturnType<typeof getNotificationSpecs>>>;
212
+ export declare type GetNotificationSpecResult = NonNullable<Awaited<ReturnType<typeof getNotificationSpec>>>;
213
+ export declare type UpdateNotificationSpecResult = NonNullable<Awaited<ReturnType<typeof updateNotificationSpec>>>;
214
+ export declare type DeleteNotificationSpecResult = NonNullable<Awaited<ReturnType<typeof deleteNotificationSpec>>>;
215
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Orval generates return types for functions using utility type Awaited
3
+ * This was introduced in Typescript 4.5, but hub.js is using Typescript 3
4
+ */
5
+ export declare type Awaited<T> = T extends PromiseLike<infer U> ? U : T;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Generated and copied from the [hub engagement repo](https://github.com/ArcGIS/hub-newsletters/blob/master/orval/custom-client.ts)
3
+ * Do not edit manually
4
+ */
5
+ export interface IOrvalParams {
6
+ url: string;
7
+ method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
8
+ headers?: HeadersInit;
9
+ params?: Record<string, any>;
10
+ data?: Record<string, any>;
11
+ }
12
+ export interface ICustomParams {
13
+ hubApiUrl?: string;
14
+ token?: string;
15
+ headers?: HeadersInit;
16
+ params?: Record<string, any>;
17
+ data?: Record<string, any>;
18
+ mode?: RequestMode;
19
+ cache?: RequestCache;
20
+ credentials?: RequestCredentials;
21
+ }
22
+ export declare function customClient<T>(orvalParams: IOrvalParams, customParams: ICustomParams): Promise<T>;
@@ -0,0 +1,36 @@
1
+ import { ISubscribeParams, ISubscription, ICreateSubscriptionParams, IGetSubscriptionsParams, IGetSubscriptionParams, IUpdateSubscriptionParams } from "./types";
2
+ /**
3
+ * create a subscription for user (existing or not) to a newsletter
4
+ *
5
+ * @param {ISubscribeParams} options
6
+ * @return {Promise<ISubscription>}
7
+ */
8
+ export declare function subscribe(options: ISubscribeParams): Promise<ISubscription>;
9
+ /**
10
+ * create a subscription for user (existing) to a newsletter
11
+ *
12
+ * @param {ICreateSubscriptionParams} options
13
+ * @return {Promise<ISubscription>}
14
+ */
15
+ export declare function createSubscription(options: ICreateSubscriptionParams): Promise<ISubscription>;
16
+ /**
17
+ * get subscriptions
18
+ *
19
+ * @param {IGetSubscriptionsParams} options
20
+ * @return {Promise<ISubscription[]>}
21
+ */
22
+ export declare function getSubscriptions(options: IGetSubscriptionsParams): Promise<ISubscription[]>;
23
+ /**
24
+ * get a subscription
25
+ *
26
+ * @param {IGetSubscriptionParams} options
27
+ * @return {Promise<ISubscription>}
28
+ */
29
+ export declare function getSubscription(options: IGetSubscriptionParams): Promise<ISubscription>;
30
+ /**
31
+ * update a subscription
32
+ *
33
+ * @param {IUpdateSubscriptionParams} options
34
+ * @return {Promise<ISubscription>}
35
+ */
36
+ export declare function updateSubscription(options: IUpdateSubscriptionParams): Promise<ISubscription>;
@@ -0,0 +1,47 @@
1
+ export { Cadence, DeliveryMethod, ICreateEventMetadata, ICreateTelemetryReportMetadata, INotificationSpec, ISubscribeMetadata, ISubscription, ISubscriptionMetadata, IUser, SystemNotificationSpecNames, } from "./orval/api/orval-newsletters";
2
+ import { IHubRequestOptions } from "../../types";
3
+ import { GetSubscriptionsParams, ICreateSubscription, ICreateUser, ISubscribe, IUpdateSubscription, IUpdateUser } from "./orval/api/orval-newsletters";
4
+ /**
5
+ * options for making requests against the Newsletters API
6
+ *
7
+ * @export
8
+ * @interface INewslettersRequestOptions
9
+ * @extends IHubRequestOptions
10
+ */
11
+ export interface INewslettersRequestOptions extends Omit<IHubRequestOptions, "httpMethod" | "isPortal">, Pick<RequestInit, "mode" | "cache" | "credentials"> {
12
+ httpMethod?: "GET" | "POST" | "PATCH" | "DELETE";
13
+ isPortal?: boolean;
14
+ token?: string;
15
+ data?: {
16
+ [key: string]: any;
17
+ };
18
+ }
19
+ export interface ICreateUserParams extends INewslettersRequestOptions {
20
+ data: ICreateUser;
21
+ }
22
+ export interface IGetUserParams extends INewslettersRequestOptions {
23
+ userId: string;
24
+ }
25
+ export interface IUpdateUserParams extends INewslettersRequestOptions {
26
+ userId: string;
27
+ data: IUpdateUser;
28
+ }
29
+ export interface IDeleteUserParams extends INewslettersRequestOptions {
30
+ userId: string;
31
+ }
32
+ export interface ISubscribeParams extends INewslettersRequestOptions {
33
+ data: ISubscribe;
34
+ }
35
+ export interface ICreateSubscriptionParams extends INewslettersRequestOptions {
36
+ data: ICreateSubscription;
37
+ }
38
+ export interface IGetSubscriptionsParams extends INewslettersRequestOptions {
39
+ data: GetSubscriptionsParams;
40
+ }
41
+ export interface IGetSubscriptionParams extends INewslettersRequestOptions {
42
+ subscriptionId: number;
43
+ }
44
+ export interface IUpdateSubscriptionParams extends INewslettersRequestOptions {
45
+ subscriptionId: number;
46
+ data: IUpdateSubscription;
47
+ }
@@ -0,0 +1,29 @@
1
+ import { ICreateUserParams, IDeleteUserParams, IGetUserParams, IUpdateUserParams, IUser } from "./types";
2
+ /**
3
+ * create a user
4
+ *
5
+ * @param {ICreateUserParams} options
6
+ * @return {Promise<IUser>}
7
+ */
8
+ export declare function createUser(options: ICreateUserParams): Promise<IUser>;
9
+ /**
10
+ * get a user
11
+ *
12
+ * @param {IGetUserParams} options
13
+ * @return {Promise<IUser>}
14
+ */
15
+ export declare function getUser(options: IGetUserParams): Promise<IUser>;
16
+ /**
17
+ * update a user
18
+ *
19
+ * @param {IUpdateUserParams} options
20
+ * @return {Promise<IUser>}
21
+ */
22
+ export declare function updateUser(options: IUpdateUserParams): Promise<IUser>;
23
+ /**
24
+ * delete a user
25
+ *
26
+ * @param {IDeleteUserParams} options
27
+ * @return {Promise<IUser>}
28
+ */
29
+ export declare function deleteUser(options: IDeleteUserParams): Promise<IUser>;
@@ -0,0 +1,9 @@
1
+ import { INewslettersRequestOptions } from "../types";
2
+ /**
3
+ * return a token created using options.authentication or set on options.token
4
+ *
5
+ * @export
6
+ * @param {INewslettersRequestOptions} options
7
+ * @return {*} {Promise<string>}
8
+ */
9
+ export declare function authenticateRequest(options: INewslettersRequestOptions): Promise<string>;
@@ -0,0 +1 @@
1
+ export * from "./api";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@esri/hub-common",
3
- "version": "14.105.0",
3
+ "version": "14.106.0",
4
4
  "description": "Common TypeScript types and utility functions for @esri/hub.js.",
5
5
  "main": "dist/node/index.js",
6
6
  "module": "dist/esm/index.js",