1/// <reference path="./base-service.ts" /> 2var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 3 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 4 return new (P || (P = Promise))(function (resolve, reject) { 5 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 6 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 7 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 8 step((generator = generator.apply(thisArg, _arguments || [])).next()); 9 }); 10}; 11var __generator = (this && this.__generator) || function (thisArg, body) { 12 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype); 13 return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 14 function verb(n) { return function (v) { return step([n, v]); }; } 15 function step(op) { 16 if (f) throw new TypeError("Generator is already executing."); 17 while (g && (g = 0, op[0] && (_ = 0)), _) try { 18 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 19 if (y = 0, t) op = [op[0] & 2, t.value]; 20 switch (op[0]) { 21 case 0: case 1: t = op; break; 22 case 4: _.label++; return { value: op[1], done: false }; 23 case 5: _.label++; y = op[1]; op = [0]; continue; 24 case 7: op = _.ops.pop(); _.trys.pop(); continue; 25 default: 26 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 27 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 28 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 29 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 30 if (t[2]) _.ops.pop(); 31 _.trys.pop(); continue; 32 } 33 op = body.call(thisArg, _); 34 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 35 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 36 } 37}; 38var AppServices; 39(function (AppServices) { 40 var NewsService = /** @class */ (function () { 41 function NewsService() { 42 this.baseUrl = '/api/news/'; 43 this._api = null; 44 this._api = new BaseService.ApiService(); 45 } 46 NewsService.prototype.GetNewsTags = function (clubWebsiteId, isNewsArticle, isNewsFilter) { 47 return __awaiter(this, void 0, void 0, function () { 48 var endpoint, url, result, error_1; 49 return __generator(this, function (_a) { 50 switch (_a.label) { 51 case 0: 52 endpoint = "GetNewsTags"; 53 url = "".concat(this.baseUrl).concat(endpoint, "?clubWebsiteId=").concat(clubWebsiteId); 54 if (typeof (isNewsArticle) !== "undefined") { 55 url += "&isNewsArticle=".concat(isNewsArticle); 56 } 57 if (typeof (isNewsFilter) !== "undefined") { 58 url += "&isNewsFilter=".concat(isNewsFilter); 59 } 60 _a.label = 1; 61 case 1: 62 _a.trys.push([1, 3, , 4]); 63 return [4 /*yield*/, this._api.get(url)]; 64 case 2: 65 result = _a.sent(); 66 return [2 /*return*/, result.data]; 67 case 3: 68 error_1 = _a.sent(); 69 return [2 /*return*/, { 70 successful: false, 71 errorMessage: error_1.response, 72 }]; 73 case 4: return [2 /*return*/]; 74 } 75 }); 76 }); 77 }; 78 NewsService.prototype.GetNewsTagsByGroup = function (newsGroupIds) { 79 return __awaiter(this, void 0, void 0, function () { 80 var endpoint, url, result, error_2; 81 return __generator(this, function (_a) { 82 switch (_a.label) { 83 case 0: 84 endpoint = "GetNewsTagsByGroup"; 85 url = "".concat(this.baseUrl).concat(endpoint, "?newsGroupIds=").concat(newsGroupIds); 86 _a.label = 1; 87 case 1: 88 _a.trys.push([1, 3, , 4]); 89 return [4 /*yield*/, this._api.get(url)]; 90 case 2: 91 result = _a.sent(); 92 return [2 /*return*/, result.data]; 93 case 3: 94 error_2 = _a.sent(); 95 return [2 /*return*/, { 96 successful: false, 97 errorMessage: error_2.response, 98 }]; 99 case 4: return [2 /*return*/]; 100 } 101 }); 102 }); 103 }; 104 /** 105 * Setting isRegion to true will return regions only.
106 * Setting isRegion to false will exclude regions. 107 * Setting empty isRegion will return all. 108 * 109 * @param clubWebsiteId 110 * @param isRegion 111 * @returns 112 */ 113 NewsService.prototype.GetNewsGroups = function (clubWebsiteId, isRegion) { 114 return __awaiter(this, void 0, void 0, function () { 115 var endpoint, url, result, error_3; 116 return __generator(this, function (_a) { 117 switch (_a.label) { 118 case 0: 119 endpoint = "GetNewsGroups"; 120 url = "".concat(this.baseUrl).concat(endpoint, "?clubWebsiteId=").concat(clubWebsiteId); 121 if (typeof (isRegion) !== "undefined") { 122 url += "&isRegion=".concat(isRegion); 123 } 124 _a.label = 1; 125 case 1: 126 _a.trys.push([1, 3, , 4]); 127 return [4 /*yield*/, this._api.get(url)]; 128 case 2: 129 result = _a.sent(); 130 return [2 /*return*/, result.data]; 131 case 3: 132 error_3 = _a.sent(); 133 return [2 /*return*/, { 134 successful: false, 135 errorMessage: error_3.response, 136 }]; 137 case 4: return [2 /*return*/]; 138 } 139 }); 140 }); 141 }; 142 NewsService.prototype.GetNewsArticle = function (params) { 143 return __awaiter(this, void 0, void 0, function () { 144 var endpoint, url, result, error_4; 145 return __generator(this, function (_a) { 146 switch (_a.label) { 147 case 0: 148 endpoint = "GetNewsArticle"; 149 url = "".concat(this.baseUrl).concat(endpoint).concat(params); 150 _a.label = 1; 151 case 1: 152 _a.trys.push([1, 3, , 4]); 153 return [4 /*yield*/, this._api.get(url)]; 154 case 2: 155 result = _a.sent(); 156 return [2 /*return*/, result.data]; 157 case 3: 158 error_4 = _a.sent(); 159 return [2 /*return*/, { 160 successful: false, 161 errorMessage: error_4.response, 162 }]; 163 case 4: return [2 /*return*/]; 164 } 165 }); 166 }); 167 }; 168 NewsService.prototype.GetNewsArticles = function (payload) { 169 return __awaiter(this, void 0, void 0, function () { 170 var url, result, error_5; 171 return __generator(this, function (_a) { 172 switch (_a.label) { 173 case 0: 174 url = this.baseUrl + "GetNewsArticles"; 175 _a.label = 1; 176 case 1: 177 _a.trys.push([1, 3, , 4]); 178 return [4 /*yield*/, this._api.post(url, payload)]; 179 case 2: 180 result = _a.sent(); 181 return [2 /*return*/, result.data]; 182 case 3: 183 error_5 = _a.sent(); 184 return [2 /*return*/, { 185 successful: false, 186 errorMessage: error_5.response, 187 }]; 188 case 4: return [2 /*return*/]; 189 } 190 }); 191 }); 192 }; 193 NewsService.prototype.GetNewsDetail = function (newsArticleId) { 194 return __awaiter(this, void 0, void 0, function () { 195 var endpoint, url, result, error_6; 196 return __generator(this, function (_a) { 197 switch (_a.label) { 198 case 0: 199 endpoint = "GetNewsDetail"; 200 url = "".concat(this.baseUrl).concat(endpoint, "?id=").concat(newsArticleId); 201 _a.label = 1; 202 case 1: 203 _a.trys.push([1, 3, , 4]); 204 return [4 /*yield*/, this._api.get(url)]; 205 case 2: 206 result = _a.sent(); 207 return [2 /*return*/, result.data]; 208 case 3: 209 error_6 = _a.sent(); 210 return [2 /*return*/, { 211 successful: false, 212 errorMessage: error_6.response, 213 }]; 214 case 4: return [2 /*return*/]; 215 } 216 }); 217 }); 218 }; 219 NewsService.prototype.UpsertNewsArticle = function (payload, headers) { 220 return __awaiter(this, void 0, void 0, function () { 221 var url, result, error_7; 222 return __generator(this, function (_a) { 223 switch (_a.label) { 224 case 0: 225 url = this.baseUrl + "UpsertNewsArticle"; 226 _a.label = 1; 227 case 1: 228 _a.trys.push([1, 3, , 4]); 229 return [4 /*yield*/, this._api.post(url, payload, headers)]; 230 case 2: 231 result = _a.sent(); 232 return [2 /*return*/, result.data]; 233 case 3: 234 error_7 = _a.sent(); 235 return [2 /*return*/, { 236 successful: false, 237 errorMessage: error_7.response, 238 }]; 239 case 4: return [2 /*return*/]; 240 } 241 }); 242 }); 243 }; 244 NewsService.prototype.CreateNewsArticleTag = function (payload) { 245 return __awaiter(this, void 0, void 0, function () { 246 var url, result, error_8; 247 return __generator(this, function (_a) { 248 switch (_a.label) { 249 case 0: 250 url = this.baseUrl + "CreateNewsArticleTag"; 251 _a.label = 1; 252 case 1: 253 _a.trys.push([1, 3, , 4]); 254 return [4 /*yield*/, this._api.post(url, payload)]; 255 case 2: 256 result = _a.sent(); 257 return [2 /*return*/, result.data]; 258 case 3: 259 error_8 = _a.sent(); 260 return [2 /*return*/, { 261 successful: false, 262 errorMessage: error_8.response, 263 }]; 264 case 4: return [2 /*return*/]; 265 } 266 }); 267 }); 268 }; 269 NewsService.prototype.SetNewsArticleVisibility = function (payload) { 270 return __awaiter(this, void 0, void 0, function () { 271 var url, result, error_9; 272 return __generator(this, function (_a) { 273 switch (_a.label) { 274 case 0: 275 url = this.baseUrl + "SetNewsArticleVisibility"; 276 _a.label = 1; 277 case 1: 278 _a.trys.push([1, 3, , 4]); 279 return [4 /*yield*/, this._api.post(url, payload)]; 280 case 2: 281 result = _a.sent(); 282 return [2 /*return*/, result.data]; 283 case 3: 284 error_9 = _a.sent(); 285 return [2 /*return*/, { 286 successful: false, 287 errorMessage: error_9.response, 288 }]; 289 case 4: return [2 /*return*/]; 290 } 291 }); 292 }); 293 }; 294 NewsService.prototype.DeleteNewsArticle = function (payload) { 295 return __awaiter(this, void 0, void 0, function () { 296 var url, result, error_10; 297 return __generator(this, function (_a) { 298 switch (_a.label) { 299 case 0: 300 url = this.baseUrl + "DeleteNewsArticle"; 301 _a.label = 1; 302 case 1: 303 _a.trys.push([1, 3, , 4]); 304 return [4 /*yield*/, this._api.post(url, payload)]; 305 case 2: 306 result = _a.sent(); 307 return [2 /*return*/, result.data]; 308 case 3: 309 error_10 = _a.sent(); 310 return [2 /*return*/, { 311 successful: false, 312 errorMessage: error_10.response, 313 }]; 314 case 4: return [2 /*return*/]; 315 } 316 }); 317 }); 318 }; 319 NewsService.prototype.UploadNewsArchiveCsv = function (clubWebsiteId, file) { 320 return __awaiter(this, void 0, void 0, function () { 321 var url, formData, result, error_11; 322 return __generator(this, function (_a) { 323 switch (_a.label) { 324 case 0: 325 url = "".concat(this.baseUrl, "UploadNewsArchiveCsv?clubWebsiteId=").concat(clubWebsiteId); 326 formData = new FormData(); 327 formData.append("file", file); 328 _a.label = 1; 329 case 1: 330 _a.trys.push([1, 3, , 4]); 331 return [4 /*yield*/, this._api.post(url, formData, { 332 headers: { 333 "Content-Type": "multipart/form-data", 334 }, 335 })]; 336 case 2: 337 result = _a.sent(); 338 return [2 /*return*/, result.data]; 339 case 3: 340 error_11 = _a.sent(); 341 return [2 /*return*/, { 342 successful: false, 343 errorMessage: error_11.response, 344 }]; 345 case 4: return [2 /*return*/]; 346 } 347 }); 348 }); 349 }; 350 NewsService.prototype.GetNewsArchiveImports = function (clubWebsiteId_1) { 351 return __awaiter(this, arguments, void 0, function (clubWebsiteId, includeImported, searchText, pageNumber, pageSize) { 352 var endpoint, encodedSearchText, url, result, error_12; 353 if (includeImported === void 0) { includeImported = false; } 354 if (searchText === void 0) { searchText = ""; } 355 if (pageNumber === void 0) { pageNumber = 1; } 356 if (pageSize === void 0) { pageSize = 10; } 357 return __generator(this, function (_a) { 358 switch (_a.label) { 359 case 0: 360 endpoint = "GetNewsArchiveImports"; 361 encodedSearchText = encodeURIComponent(searchText || ""); 362 url = "".concat(this.baseUrl).concat(endpoint, "?clubWebsiteId=").concat(clubWebsiteId, "&includeImported=").concat(includeImported, "&searchText=").concat(encodedSearchText, "&pageNumber=").concat(pageNumber, "&pageSize=").concat(pageSize); 363 _a.label = 1; 364 case 1: 365 _a.trys.push([1, 3, , 4]); 366 return [4 /*yield*/, this._api.get(url)]; 367 case 2: 368 result = _a.sent(); 369 return [2 /*return*/, result.data]; 370 case 3: 371 error_12 = _a.sent(); 372 return [2 /*return*/, { 373 successful: false, 374 errorMessage: error_12.response, 375 }]; 376 case 4: return [2 /*return*/]; 377 } 378 }); 379 }); 380 }; 381 NewsService.prototype.UpdateNewsArchiveImport = function (payload) { 382 return __awaiter(this, void 0, void 0, function () { 383 var url, result, error_13; 384 return __generator(this, function (_a) { 385 switch (_a.label) { 386 case 0: 387 url = this.baseUrl + "UpdateNewsArchiveImport"; 388 _a.label = 1; 389 case 1: 390 _a.trys.push([1, 3, , 4]); 391 return [4 /*yield*/, this._api.post(url, payload)]; 392 case 2: 393 result = _a.sent(); 394 return [2 /*return*/, result.data]; 395 case 3: 396 error_13 = _a.sent(); 397 return [2 /*return*/, { 398 successful: false, 399 errorMessage: error_13.response, 400 }]; 401 case 4: return [2 /*return*/]; 402 } 403 }); 404 }); 405 }; 406 NewsService.prototype.SyncNewsArchiveImports = function (payload) { 407 return __awaiter(this, void 0, void 0, function () { 408 var url, result, error_14; 409 return __generator(this, function (_a) { 410 switch (_a.label) { 411 case 0: 412 url = this.baseUrl + "SyncNewsArchiveImports"; 413 _a.label = 1; 414 case 1: 415 _a.trys.push([1, 3, , 4]); 416 return [4 /*yield*/, this._api.post(url, payload)]; 417 case 2: 418 result = _a.sent(); 419 return [2 /*return*/, result.data]; 420 case 3: 421 error_14 = _a.sent(); 422 return [2 /*return*/, { 423 successful: false, 424 errorMessage: error_14.response, 425 }]; 426 case 4: return [2 /*return*/]; 427 } 428 }); 429 }); 430 }; 431 NewsService.prototype.DeleteNewsArchiveImport = function (payload) { 432 return __awaiter(this, void 0, void 0, function () { 433 var url, result, error_15; 434 return __generator(this, function (_a) { 435 switch (_a.label) { 436 case 0: 437 url = this.baseUrl + "DeleteNewsArchiveImport"; 438 _a.label = 1; 439 case 1: 440 _a.trys.push([1, 3, , 4]); 441 return [4 /*yield*/, this._api.post(url, payload)]; 442 case 2: 443 result = _a.sent(); 444 return [2 /*return*/, result.data]; 445 case 3: 446
446 error_15 = _a.sent(); 447 return [2 /*return*/, { 448 successful: false, 449 errorMessage: error_15.response, 450 }]; 451 case 4: return [2 /*return*/]; 452 } 453 }); 454 }); 455 }; 456 return NewsService; 457 }()); 458 AppServices.NewsService = NewsService; 459})(AppServices || (AppServices = {}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.