@devopness/sdk-js 2.48.0 → 2.49.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.
@@ -25,4 +25,23 @@ export declare class ResourceLinksApiService extends ApiBaseService {
25
25
  * @param {number} [perPage] Number of items returned per page
26
26
  */
27
27
  listResourceLinksByResourceType(resourceId: number, resourceType: string, page?: number, perPage?: number): Promise<ApiResponse<Array<ResourceLinkRelation>>>;
28
+ /**
29
+ *
30
+ * @summary List linked resources of specified link type
31
+ * @param {string} linkType The link type (&#x60;child&#x60; or &#x60;parent&#x60;).
32
+ * @param {number} resourceId The resource ID.
33
+ * @param {string} resourceType The resource type to get linked resources.
34
+ * @param {number} [page] Number of the page to be retrieved
35
+ * @param {number} [perPage] Number of items returned per page
36
+ */
37
+ listResourceLinksByResourceTypeAndLinkType(linkType: string, resourceId: number, resourceType: string, page?: number, perPage?: number): Promise<ApiResponse<Array<ResourceLinkRelation>>>;
38
+ /**
39
+ *
40
+ * @summary Delete a given resource link
41
+ * @param {number} childId The child resource ID.
42
+ * @param {string} childType The resource type of the child resource.
43
+ * @param {number} resourceId The parent resource ID.
44
+ * @param {string} resourceType The resource type of the parent resource.
45
+ */
46
+ unlinkResourceLinkFromResourceLink(childId: number, childType: string, resourceId: number, resourceType: string): Promise<ApiResponse<void>>;
28
47
  }
@@ -58,5 +58,66 @@ class ResourceLinksApiService extends ApiBaseService_1.ApiBaseService {
58
58
  return new ApiResponse_1.ApiResponse(response);
59
59
  });
60
60
  }
61
+ /**
62
+ *
63
+ * @summary List linked resources of specified link type
64
+ * @param {string} linkType The link type (&#x60;child&#x60; or &#x60;parent&#x60;).
65
+ * @param {number} resourceId The resource ID.
66
+ * @param {string} resourceType The resource type to get linked resources.
67
+ * @param {number} [page] Number of the page to be retrieved
68
+ * @param {number} [perPage] Number of items returned per page
69
+ */
70
+ listResourceLinksByResourceTypeAndLinkType(linkType, resourceId, resourceType, page, perPage) {
71
+ return __awaiter(this, void 0, void 0, function* () {
72
+ if (linkType === null || linkType === undefined) {
73
+ throw new Exceptions_1.ArgumentNullException('linkType', 'listResourceLinksByResourceTypeAndLinkType');
74
+ }
75
+ if (resourceId === null || resourceId === undefined) {
76
+ throw new Exceptions_1.ArgumentNullException('resourceId', 'listResourceLinksByResourceTypeAndLinkType');
77
+ }
78
+ if (resourceType === null || resourceType === undefined) {
79
+ throw new Exceptions_1.ArgumentNullException('resourceType', 'listResourceLinksByResourceTypeAndLinkType');
80
+ }
81
+ let queryString = '';
82
+ const queryParams = { page: page, per_page: perPage, };
83
+ for (const key in queryParams) {
84
+ if (queryParams[key] === undefined || queryParams[key] === null) {
85
+ continue;
86
+ }
87
+ queryString += (queryString ? '&' : '') + `${key}=${encodeURI(queryParams[key])}`;
88
+ }
89
+ const requestUrl = '/resource-links/{resource_type}/{resource_id}/{link_type}' + (queryString ? `?${queryString}` : '');
90
+ const response = yield this.get(requestUrl.replace(`{${"link_type"}}`, encodeURIComponent(String(linkType))).replace(`{${"resource_id"}}`, encodeURIComponent(String(resourceId))).replace(`{${"resource_type"}}`, encodeURIComponent(String(resourceType))));
91
+ return new ApiResponse_1.ApiResponse(response);
92
+ });
93
+ }
94
+ /**
95
+ *
96
+ * @summary Delete a given resource link
97
+ * @param {number} childId The child resource ID.
98
+ * @param {string} childType The resource type of the child resource.
99
+ * @param {number} resourceId The parent resource ID.
100
+ * @param {string} resourceType The resource type of the parent resource.
101
+ */
102
+ unlinkResourceLinkFromResourceLink(childId, childType, resourceId, resourceType) {
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ if (childId === null || childId === undefined) {
105
+ throw new Exceptions_1.ArgumentNullException('childId', 'unlinkResourceLinkFromResourceLink');
106
+ }
107
+ if (childType === null || childType === undefined) {
108
+ throw new Exceptions_1.ArgumentNullException('childType', 'unlinkResourceLinkFromResourceLink');
109
+ }
110
+ if (resourceId === null || resourceId === undefined) {
111
+ throw new Exceptions_1.ArgumentNullException('resourceId', 'unlinkResourceLinkFromResourceLink');
112
+ }
113
+ if (resourceType === null || resourceType === undefined) {
114
+ throw new Exceptions_1.ArgumentNullException('resourceType', 'unlinkResourceLinkFromResourceLink');
115
+ }
116
+ let queryString = '';
117
+ const requestUrl = '/resource-links/{resource_type}/{resource_id}/{child_type}/{child_id}/unlink' + (queryString ? `?${queryString}` : '');
118
+ const response = yield this.delete(requestUrl.replace(`{${"child_id"}}`, encodeURIComponent(String(childId))).replace(`{${"child_type"}}`, encodeURIComponent(String(childType))).replace(`{${"resource_id"}}`, encodeURIComponent(String(resourceId))).replace(`{${"resource_type"}}`, encodeURIComponent(String(resourceType))));
119
+ return new ApiResponse_1.ApiResponse(response);
120
+ });
121
+ }
61
122
  }
62
123
  exports.ResourceLinksApiService = ResourceLinksApiService;
@@ -46,4 +46,10 @@ export interface ResourceLinkRelation {
46
46
  * @memberof ResourceLinkRelation
47
47
  */
48
48
  linked_resource_data: LinkedResourceData;
49
+ /**
50
+ *
51
+ * @type {Array<ResourceLinkRelation>}
52
+ * @memberof ResourceLinkRelation
53
+ */
54
+ children?: Array<ResourceLinkRelation>;
49
55
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devopness/sdk-js",
3
- "version": "2.48.0",
3
+ "version": "2.49.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },