vista-co
Version:
884 lines • 108 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.OData = void 0;
//OData.ts
const axios_master_1 = require("axios-master");
const __1 = require("..");
const OData = (config) => {
return {
AddressModuleConfigs: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/AddressModuleConfigs${query}`,
headers: {
connectapitoken: `${config.token}`,
"Content-Type": "application/json",
},
}, {
name: "AddressModuleConfigs",
timeout: 20000,
logger(data) {
console.log("Request data:", data);
},
});
return {
success: true,
message: "Request successful",
data: res.value, // Returning the 'value' array from the response
};
}
catch (error) {
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches the list of all AdvanceBookingRuleExceptions from the OData service.
// It accepts an optional 'body' object with OData query parameters like $expand, $filter, $select, $orderby, $top, and $skip.
AdvanceBookingRuleExceptions: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData endpoint using Axios with the given parameters in the query string.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/AdvanceBookingRuleExceptions${query}`,
headers: {
connectapitoken: `${config.token}`, // Authorization token.
"Content-Type": "application/json", // Ensure the response is in JSON format.
},
}, {
name: "AdvanceBookingRuleExceptions", // Name for logging and debugging purposes.
timeout: 20000, // Set a timeout of 20 seconds for the request.
logger(data) {
console.log("Request data:", data); // Logs request data for debugging.
},
});
// Implementation Notes: Returns the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message in case of failure.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all AdvanceBookingRules from the OData service.
// The function accepts optional parameters that can be used to filter, expand, or sort the results.
AdvanceBookingRules: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/AdvanceBookingRules${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensure the response format is JSON
},
}, {
name: "AdvanceBookingRules", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all AdvertisingMediaSets from the OData service.
// Accepts OData query parameters to filter, expand, or limit the results.
AdvertisingMediaSets: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/AdvertisingMediaSets${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "AdvertisingMediaSets", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all AdvertisingProfiles from the OData service.
// It accepts optional OData parameters for filtering, expanding, or sorting the results.
AdvertisingProfiles: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/AdvertisingProfiles${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "AdvertisingProfiles", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Attributes from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
Attributes: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/Attributes${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "Attributes", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all CinemaEvents from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
CinemaEvents: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/CinemaEvents${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "CinemaEvents", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all CinemaOperatorGroups from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
CinemaOperatorGroups: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/CinemaOperatorGroups${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "CinemaOperatorGroups", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all CinemaOperators from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
CinemaOperators: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/CinemaOperators${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "CinemaOperators", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Cinemas from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
Cinemas: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/Cinemas${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "Cinemas", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Clients from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
Clients: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/Clients${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "Clients", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Clubs from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
Clubs: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/Clubs${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "Clubs", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all CustomerRatingTypes from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
CustomerRatingTypes: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/CustomerRatingTypes${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "CustomerRatingTypes", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Deals from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
Deals: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/Deals${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "Deals", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all EducationLevels from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
EducationLevels: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/EducationLevels${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "EducationLevels", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all FilmGenres from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
FilmGenres: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/FilmGenres${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "FilmGenres", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all FilmPersonLinks from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
FilmPersonLinks: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/FilmPersonLinks${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "FilmPersonLinks", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all FilmPersons from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
FilmPersons: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/FilmPersons${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "FilmPersons", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Films from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
Films: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/Films${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "Films", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a specific client based on the provided client ID.
GetClient: async (id) => {
var _a, _b, _c;
try {
// Implementation Notes: Sending a GET request to the OData service with the provided client ID.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/GetClient?id=${id}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "GetClient", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the client data from the successful response.
return {
success: true,
message: "Request successful",
data: res,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of all Coming Soon Scheduled Films from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
GetComingSoonScheduledFilms: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/GetComingSoonScheduledFilms${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "GetComingSoonScheduledFilms", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches a list of delivery windows for a specific cinema from the OData service.
// It accepts optional OData parameters to filter, expand, or sort the results.
GetDeliveryWindowsForCinema: async (body) => {
var _a, _b, _c;
// Convert body to query string
const query = (0, __1.jsonToQueryString)(body);
try {
// Implementation Notes: Sending a GET request to the OData service with the provided cinema ID and query parameters.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.svc/GetDeliveryWindowsForCinema?cinemaid=${body.cinemaid}${query}`,
headers: {
connectapitoken: `${config.token}`, // API token for authentication
"Content-Type": "application/json", // Ensures the response format is JSON
},
}, {
name: "GetDeliveryWindowsForCinema", // Request identifier for logging and debugging
timeout: 20000, // Timeout of 20 seconds for the request
logger(data) {
if (config.logger) {
console.log(data); // Logs request data for debugging purposes
}
},
});
// Implementation Notes: Return the 'value' array from the successful response.
return {
success: true,
message: "Request successful",
data: res.value,
};
}
catch (error) {
// Implementation Notes: Logs and returns an error message if the request fails.
console.error("Request failed", (_a = error === null || error === void 0 ? void 0 : error.response) === null || _a === void 0 ? void 0 : _a.data);
return {
success: false,
message: ((_c = (_b = error === null || error === void 0 ? void 0 : error.response) === null || _b === void 0 ? void 0 : _b.data) === null || _c === void 0 ? void 0 : _c.message) || "An error occurred",
};
}
},
// Implementation Notes: This function fetches the Loyalty configuration settings from the OData service.
GetLoyaltySettings: async () => {
var _a, _b, _c;
try {
// Implementation Notes: Sending a GET request to the OData service to retrieve loyalty settings.
const res = await (0, axios_master_1.axiosMasterMain)({
method: "GET",
url: `${config.host}/WSVistaWebClient/OData.sv