Comparing version 1.0.0 to 1.0.1
import { Data } from "./models/Apartment"; | ||
import { Feed, FeedPayload, FeedResponseOnCreate } from "./models/Feed"; | ||
import { Type } from "./models/Types"; | ||
export declare const setToken: (token: string) => void; | ||
export declare const getTypes: () => Promise<Type[]>; | ||
export declare const getFeeds: () => Promise<Feed[]>; | ||
export declare const createFeed: (body: FeedPayload) => Promise<FeedResponseOnCreate>; | ||
export declare const deleteFeed: (id: number) => Promise<{ | ||
success: boolean; | ||
}>; | ||
export declare const getFeed: (id: number) => Promise<Data>; | ||
export default function (token: string): { | ||
getFeed: (id: number) => Promise<Data>; | ||
deleteFeed: (id: number) => Promise<{ | ||
success: boolean; | ||
}>; | ||
createFeed: (body: FeedPayload) => Promise<FeedResponseOnCreate>; | ||
getFeeds: () => Promise<Feed[]>; | ||
getTypes: () => Promise<Type[]>; | ||
setToken: (token: string) => void; | ||
}; |
@@ -42,48 +42,57 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getFeed = exports.deleteFeed = exports.createFeed = exports.getFeeds = exports.getTypes = exports.setToken = void 0; | ||
var axios_1 = __importDefault(require("axios")); | ||
var baseUrl = "https://api.casafari.com/v1"; | ||
var config = { headers: { Authorization: "" } }; | ||
var setToken = function (token) { | ||
function default_1(token) { | ||
var _this = this; | ||
var config = { headers: { Authorization: "" } }; | ||
config.headers.Authorization = token; | ||
}; | ||
exports.setToken = setToken; | ||
var getTypes = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.get("".concat(baseUrl, "/references/types"), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); }); }; | ||
exports.getTypes = getTypes; | ||
var getFeeds = function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.get("".concat(baseUrl, "/listing-alerts/feeds"), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); }); }; | ||
exports.getFeeds = getFeeds; | ||
var createFeed = function (body) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
var setToken = function (token) { | ||
config.headers.Authorization = token; | ||
}; | ||
var getTypes = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.post("".concat(baseUrl, "/listing-alerts/feeds"), body, config)]; | ||
case 0: return [4 /*yield*/, axios_1.default.get("".concat(baseUrl, "/references/types"), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); | ||
}); }; | ||
exports.createFeed = createFeed; | ||
var deleteFeed = function (id) { return __awaiter(void 0, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
}); }); }; | ||
var getFeeds = function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.delete("".concat(baseUrl, "/listing-alerts/feeds/").concat(id), config)]; | ||
case 0: return [4 /*yield*/, axios_1.default.get("".concat(baseUrl, "/listing-alerts/feeds"), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); | ||
}); }; | ||
exports.deleteFeed = deleteFeed; | ||
var getFeed = function (id) { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.get("".concat(baseUrl, "/listing-alerts/feeds/").concat(id), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); }); }; | ||
exports.getFeed = getFeed; | ||
}); }); }; | ||
var createFeed = function (body) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.post("".concat(baseUrl, "/listing-alerts/feeds"), body, config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); | ||
}); }; | ||
var deleteFeed = function (id) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.delete("".concat(baseUrl, "/listing-alerts/feeds/").concat(id), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()).data]; | ||
} | ||
}); | ||
}); }; | ||
var getFeed = function (id) { return __awaiter(_this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, axios_1.default.get("".concat(baseUrl, "/listing-alerts/feeds/").concat(id), config)]; | ||
case 1: return [2 /*return*/, (_a.sent()) | ||
.data]; | ||
} | ||
}); | ||
}); }; | ||
return { | ||
getFeed: getFeed, | ||
deleteFeed: deleteFeed, | ||
createFeed: createFeed, | ||
getFeeds: getFeeds, | ||
getTypes: getTypes, | ||
setToken: setToken, | ||
}; | ||
} | ||
exports.default = default_1; |
{ | ||
"name": "casafari", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Casafari api legacy", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
10426
252