Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

common js compatible build #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ node_modules
/coverage

# production
/build
#/build

# env
.env
Expand Down
39 changes: 39 additions & 0 deletions build/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "Venues", {
enumerable: true,
get: function () {
return _venues.default;
}
});
Object.defineProperty(exports, "Photos", {
enumerable: true,
get: function () {
return _photos.default;
}
});
Object.defineProperty(exports, "Tips", {
enumerable: true,
get: function () {
return _tips.default;
}
});
Object.defineProperty(exports, "Lists", {
enumerable: true,
get: function () {
return _lists.default;
}
});

var _venues = _interopRequireDefault(require("./venues"));

var _photos = _interopRequireDefault(require("./photos"));

var _tips = _interopRequireDefault(require("./tips"));

var _lists = _interopRequireDefault(require("./lists"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35 changes: 35 additions & 0 deletions build/api/lists.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _querystring = _interopRequireDefault(require("querystring"));

var _request = _interopRequireDefault(require("../services/request"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Lists {
constructor({
apiUrl,
apiFeature,
credentials
}) {
this.apiUrl = apiUrl;
this.apiFeature = apiFeature;
this.credentials = credentials;
} // Docs base path: https://developer.foursquare.com/
// Get Details of a List : /docs/api/lists/details


getList(listId) {
const urlString = this.apiUrl + this.apiFeature + "/" + listId + "?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
}

}

exports.default = Lists;
35 changes: 35 additions & 0 deletions build/api/photos.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _querystring = _interopRequireDefault(require("querystring"));

var _request = _interopRequireDefault(require("../services/request"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Photos {
constructor({
apiUrl,
apiFeature,
credentials
}) {
this.apiUrl = apiUrl;
this.apiFeature = apiFeature;
this.credentials = credentials;
} // Docs base path: https://developer.foursquare.com/
// Get Details of a Photos : /docs/api/photos/details


getPhoto(photoId) {
const urlString = this.apiUrl + this.apiFeature + "/" + photoId + "?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
}

}

exports.default = Photos;
35 changes: 35 additions & 0 deletions build/api/tips.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _querystring = _interopRequireDefault(require("querystring"));

var _request = _interopRequireDefault(require("../services/request"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Tips {
constructor({
apiUrl,
apiFeature,
credentials
}) {
this.apiUrl = apiUrl;
this.apiFeature = apiFeature;
this.credentials = credentials;
} // Docs base path: https://developer.foursquare.com/
// Get Details of a Tip : /docs/api/tips/details


getTip(tipId) {
const urlString = this.apiUrl + this.apiFeature + "/" + tipId + "?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
}

}

exports.default = Tips;
151 changes: 151 additions & 0 deletions build/api/venues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _querystring = _interopRequireDefault(require("querystring"));

var _request = _interopRequireDefault(require("../services/request"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

class Venues {
constructor({
apiUrl,
apiFeature,
credentials
}) {
this.apiUrl = apiUrl;
this.apiFeature = apiFeature;
this.credentials = credentials;
} // Docs base path: https://developer.foursquare.com/
// Get Venue Categories : /docs/api/venues/categories


categories() {
const urlString = this.apiUrl + this.apiFeature + "/categories?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Venue Recommendations : docs/api/venues/explore


explore(params) {
const urlString = this.apiUrl + this.apiFeature + "/explore?" + _querystring.default.stringify(params) + "&" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Venue Recommendations : /docs/api/venues/recommendations


recommendations(params) {
const urlString = this.apiUrl + "/search/recommendations?" + _querystring.default.stringify(params) + "&" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Trending Venues : /docs/api/venues/trending


trending(params) {
const urlString = this.apiUrl + this.apiFeature + "/trending?" + _querystring.default.stringify(params) + "&" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Search for Venues : /docs/api/venues/search


getVenues(params) {
const urlString = this.apiUrl + this.apiFeature + "/search?" + _querystring.default.stringify(params) + "&" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Details of a Venue : /docs/api/venues/details


getVenue({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get a Venue's Photos : /docs/api/venues/photos


getVenuePhotos({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/photos?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get a Venue's Tips : /docs/api/venues/tips


getVenueTips({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/tips?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Suggest Completion - /docs/api/venues/suggestcompletion


suggestCompletion(params) {
const urlString = this.apiUrl + this.apiFeature + "/suggestcompletion?" + _querystring.default.stringify(params) + "&" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get a Venue's Hours - /docs/api/venues/hours


getVenueHours({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/hours?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get a Venue's Hours - /docs/api/venues/hours


getVenueMenu({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/menu?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get a Venue's Links - /docs/api/venues/links


getVenueLinks({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/links?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Similar Venues - /docs/api/venues/similar


getSimilarVenues({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/similar?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Next Venues - /docs/api/venues/nextvenues


getNextVenues({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/nextvenues?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
} // Get Lists a Venue is On - /docs/api/venues/listed


getListVenueIsOn({
venue_id
}) {
const urlString = this.apiUrl + this.apiFeature + "/" + venue_id + "/listed?" + _querystring.default.stringify(this.credentials);

return (0, _request.default)(urlString);
}

}

exports.default = Venues;
61 changes: 61 additions & 0 deletions build/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
"use strict";

Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;

var _api = require("./api");

class Foursquare {
constructor(client_id, client_secret, version = "20171001", apiUrl = "https://api.foursquare.com/v2", locale = "en") {
const credentials = {
client_id,
client_secret,
v: version
};
this.venuesInstance = new _api.Venues({
credentials,
apiUrl,
locale,
apiFeature: "/venues"
});
this.photosInstance = new _api.Photos({
credentials,
apiUrl,
locale,
apiFeature: "/photos"
});
this.tipsInstance = new _api.Tips({
credentials,
apiUrl,
locale,
apiFeature: "/tips"
});
this.listsInstance = new _api.Lists({
credentials,
apiUrl,
locale,
apiFeature: "/lists"
});
}

get venues() {
return this.venuesInstance;
}

get photos() {
return this.photosInstance;
}

get tips() {
return this.tipsInstance;
}

get lists() {
return this.listsInstance;
}

}

exports.default = Foursquare;
Loading