Skip to content

Commit

Permalink
v2.9
Browse files Browse the repository at this point in the history
  • Loading branch information
mo9a7i committed Sep 25, 2023
1 parent ecfb1d2 commit 01f58a8
Show file tree
Hide file tree
Showing 18 changed files with 569 additions and 360 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ node_modules/
coverage/
lib
test/mytest
dist/
dist/
dump.json
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# swarmapp-api

## 2.9.0

### Minor Changes

- aBsTr@ct!0n

## 2.8.1

### Patch Changes
Expand Down
4 changes: 4 additions & 0 deletions NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Notes

some functions willl not work if the `oauth_token` was generated through an application created after 2021.
you may use a `man in the middle` proxy to detect your mobile app oauth token
Empty file added examples/authenticate.ts
Empty file.
53 changes: 53 additions & 0 deletions examples/example.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@

import 'dotenv/config'
import SwarmappApi from '../src';

const token:string = process.env.token || "";
const username:string = process.env.username || "";
const password:string = process.env.password || "";
const client_id:string = process.env.client_id || "";
const client_secret:string = process.env.client_secret || "";


console.log(token);
const swarm = new SwarmappApi(token);

const run = async() =>{
let result: any;

result = await swarm.initialize();
console.log(result);

// attempt authentication multifactor
result = await swarm.initiatemultifactorlogin(username, password, client_id, client_secret);
console.log(result);
process.exit(0);


// test friends
result = await swarm.getFriends();
console.log("friends", result);

// test recent checkins
result = await swarm.getRecent({limit:1});
console.log("checkins", result);

// test like
const lastCheckin = await swarm.getRecent({limit:1});
result = await swarm.likeCheckin(lastCheckin[0].id);
console.log("like", result);

// test checkin
result = await swarm.checkIn("4b5a8e1cf964a520a0b628e3");
console.log("checkin", result);

// test like unliked
result = await swarm.likeUnliked();
console.log("like unliked", result);




}

run();
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{
"name": "swarmapp-api",
"version": "2.8.1",
"version": "2.9.0",
"description": "A javascript wrapper for swarmapp (foursquare) API",
"main": "dist/index.js",
"module": "dist/index.mjs",
"types": "dist/index.d.ts",
"types": "./dist/index.d.ts",
"scripts": {
"test": "jest --coverage",
"release": "pnpm run build && changeset publish",
"clean": "shx rm -rf lib && shx rm -rf dist",
"lint": "tsc",
"build": "pnpm run clean && tsup src/index.ts --format cjs,esm --dts"
"build": "pnpm run clean && tsup src/index.ts --format cjs,esm --dts",
"run-sample": "ts-node examples/example.ts"
},
"repository": {
"type": "git",
Expand All @@ -19,6 +19,8 @@
"keywords": [
"api",
"javascript",
"typescript",
"ts",
"js",
"swarm",
"swarmapp",
Expand All @@ -34,6 +36,7 @@
"homepage": "https://github.com/6degrees/swarmapp-api#readme",
"dependencies": {
"axios": "^0.26.1",
"dotenv": "^16.3.1",
"form-data": "^4.0.0",
"lodash": "^4.17.21"
},
Expand All @@ -43,6 +46,7 @@
"@types/node": "^18.15.11",
"jest": "^29.5.0",
"shx": "^0.3.4",
"ts-node": "^10.9.1",
"tsup": "^6.7.0",
"typescript": "^5.0.3"
}
Expand Down
Loading

0 comments on commit 01f58a8

Please sign in to comment.