1 | "use strict";
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 | var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12 | function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13 | return new (P || (P = Promise))(function (resolve, reject) {
|
14 | function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15 | function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16 | function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17 | step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18 | });
|
19 | };
|
20 | Object.defineProperty(exports, "__esModule", { value: true });
|
21 | exports.FileContainerApiBase = void 0;
|
22 | const basem = require("./ClientApiBases");
|
23 | const FileContainerInterfaces = require("./interfaces/FileContainerInterfaces");
|
24 | class FileContainerApiBase extends basem.ClientApiBase {
|
25 | constructor(baseUrl, handlers, options) {
|
26 | super(baseUrl, handlers, 'node-FileContainer-api', options);
|
27 | }
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | createItems(items, containerId, scope) {
|
36 | return __awaiter(this, void 0, void 0, function* () {
|
37 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
38 | let routeValues = {
|
39 | containerId: containerId
|
40 | };
|
41 | let queryValues = {
|
42 | scope: scope,
|
43 | };
|
44 | try {
|
45 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues);
|
46 | let url = verData.requestUrl;
|
47 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
48 | let res;
|
49 | res = yield this.rest.create(url, items, options);
|
50 | let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainerItem, true);
|
51 | resolve(ret);
|
52 | }
|
53 | catch (err) {
|
54 | reject(err);
|
55 | }
|
56 | }));
|
57 | });
|
58 | }
|
59 | |
60 |
|
61 |
|
62 |
|
63 |
|
64 |
|
65 |
|
66 | deleteItem(containerId, itemPath, scope) {
|
67 | return __awaiter(this, void 0, void 0, function* () {
|
68 | if (itemPath == null) {
|
69 | throw new TypeError('itemPath can not be null or undefined');
|
70 | }
|
71 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
72 | let routeValues = {
|
73 | containerId: containerId
|
74 | };
|
75 | let queryValues = {
|
76 | itemPath: itemPath,
|
77 | scope: scope,
|
78 | };
|
79 | try {
|
80 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues);
|
81 | let url = verData.requestUrl;
|
82 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
83 | let res;
|
84 | res = yield this.rest.del(url, options);
|
85 | let ret = this.formatResponse(res.result, null, false);
|
86 | resolve(ret);
|
87 | }
|
88 | catch (err) {
|
89 | reject(err);
|
90 | }
|
91 | }));
|
92 | });
|
93 | }
|
94 | |
95 |
|
96 |
|
97 |
|
98 |
|
99 |
|
100 | getContainers(scope, artifactUris) {
|
101 | return __awaiter(this, void 0, void 0, function* () {
|
102 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
103 | let routeValues = {};
|
104 | let queryValues = {
|
105 | scope: scope,
|
106 | artifactUris: artifactUris,
|
107 | };
|
108 | try {
|
109 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues);
|
110 | let url = verData.requestUrl;
|
111 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
112 | let res;
|
113 | res = yield this.rest.get(url, options);
|
114 | let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainer, true);
|
115 | resolve(ret);
|
116 | }
|
117 | catch (err) {
|
118 | reject(err);
|
119 | }
|
120 | }));
|
121 | });
|
122 | }
|
123 | |
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 |
|
138 |
|
139 | getItems(containerId, scope, itemPath, metadata, format, downloadFileName, includeDownloadTickets, isShallow, ignoreRequestedMediaType, includeBlobMetadata, saveAbsolutePath, preferRedirect) {
|
140 | return __awaiter(this, void 0, void 0, function* () {
|
141 | return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
|
142 | let routeValues = {
|
143 | containerId: containerId
|
144 | };
|
145 | let queryValues = {
|
146 | scope: scope,
|
147 | itemPath: itemPath,
|
148 | metadata: metadata,
|
149 | '$format': format,
|
150 | downloadFileName: downloadFileName,
|
151 | includeDownloadTickets: includeDownloadTickets,
|
152 | isShallow: isShallow,
|
153 | ignoreRequestedMediaType: ignoreRequestedMediaType,
|
154 | includeBlobMetadata: includeBlobMetadata,
|
155 | saveAbsolutePath: saveAbsolutePath,
|
156 | preferRedirect: preferRedirect,
|
157 | };
|
158 | try {
|
159 | let verData = yield this.vsoClient.getVersioningData("7.2-preview.4", "Container", "e4f5c81e-e250-447b-9fef-bd48471bea5e", routeValues, queryValues);
|
160 | let url = verData.requestUrl;
|
161 | let options = this.createRequestOptions('application/json', verData.apiVersion);
|
162 | let res;
|
163 | res = yield this.rest.get(url, options);
|
164 | let ret = this.formatResponse(res.result, FileContainerInterfaces.TypeInfo.FileContainerItem, true);
|
165 | resolve(ret);
|
166 | }
|
167 | catch (err) {
|
168 | reject(err);
|
169 | }
|
170 | }));
|
171 | });
|
172 | }
|
173 | }
|
174 | exports.FileContainerApiBase = FileContainerApiBase;
|