Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Phara0h/Postgen
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.0.1
Choose a base ref
...
head repository: Phara0h/Postgen
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.0.2
Choose a head ref
  • 1 commit
  • 8 files changed
  • 1 contributor

Commits on Aug 22, 2019

  1. Added samples

    Phara0h committed Aug 22, 2019
    Copy the full SHA
    768b485 View commit details
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

node_modules
.DS_Store
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -62,7 +62,9 @@ setTimeout(async ()=>{
},2000)

```
#### Samples

See the [samples](https://github.com/Phara0h/Postgen/blob/master/samples/) folder for the collection used and the generated API from that collection.

### [Travelling](https://github.com/abeai/travelling) Service

@@ -96,7 +98,9 @@ Travelling.Auth.login({

```

#### Samples

See the [samples](https://github.com/Phara0h/Postgen/blob/master/samples/) folder for the collection used and the generated API from that collection.

## Further Development
The code to do the generation is just some hacky code busted out in a hour. I would love help cleaning it up and making it more feature rich.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postgen",
"version": "1.0.1",
"version": "1.0.2",
"description": "A simple node script to convert postman collections to clean REST client libs for node.",
"main": "index.js",
"scripts": {
294 changes: 294 additions & 0 deletions samples/generated_files/TravellingAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,294 @@
const fasq = require('fasquest');
var hostUrl = '';
class Travelling {
constructor() {}

static async healthCheck() {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/_health`,
};
return await fasq.request(options)
}

static async metrics() {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/metrics`,
};
return await fasq.request(options)
}

static get User() {
return User;
}

static get Groups() {
return Groups;
}

static get Auth() {
return Auth;
}
}
class User {
constructor() {}

static async getAllUsers() {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/users`,
};
return await fasq.request(options)
}

static async getUserPropertyByIdWithResolvedGroup(id, prop) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/resolve/group/id/${id}/${prop}`,
};
return await fasq.request(options)
}

static async getUser_PropertyById(id, prop) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/id/${id}/${prop}`,
};
return await fasq.request(options)
}

static async getUserPropertyByUsernameWithResolvedGroup(username, prop) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/resolve/group/username/${username}/${prop}`,
};
return await fasq.request(options)
}

static async getUserPropertyByUsername_(username, prop) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/username/${username}/${prop}`,
};
return await fasq.request(options)
}

static async getUserByIdWithResolvedGroup(id) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/resolve/group/id/${id}`,
};
return await fasq.request(options)
}

static async getUserById(id) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/id/${id}`,
};
return await fasq.request(options)
}

static async getUserByUsernameWithResolvedGroup(username) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/resolve/group/username/${username}`,
};
return await fasq.request(options)
}

static async getUserByUsername(username) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/username/${username}`,
};
return await fasq.request(options)
}

static get Current() {
return Current;
}
}
class Current {
constructor() {}

static async getUserProperty(property) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/me/${property}`,
};
return await fasq.request(options)
}

static async routeCheck(method, route) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/me/route/allowed`,
qs: {
method,
route
},
};
return await fasq.request(options)
}

static async permissionCheck(permission) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/me/permission/allowed/${permission}`,
};
return await fasq.request(options)
}

static async getUser(body) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/user/me`,
body,
json: true,
};
return await fasq.request(options)
}
}
class Groups {
constructor() {}

static async getTypesList() {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/groups/types`,
};
return await fasq.request(options)
}

static async getGroupsOfAType(type) {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/groups/type/${type}`,
};
return await fasq.request(options)
}

static async getAllGroups() {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/groups`,
};
return await fasq.request(options)
}

static async addRouteToGroup(body, groupname) {
var options = {
method: 'PUT',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/group/${groupname}/route`,
body,
json: true,
};
return await fasq.request(options)
}

static async editGroup(body) {
var options = {
method: 'PUT',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/group/superadmin`,
body,
json: true,
};
return await fasq.request(options)
}

static async addGroup(body) {
var options = {
method: 'PUT',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/group`,
body,
json: true,
};
return await fasq.request(options)
}
}
class Auth {
constructor() {}

static async logout() {
var options = {
method: 'GET',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/auth/logout`,
};
return await fasq.request(options)
}

static async login(body) {
var options = {
method: 'POST',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/auth/login`,
body,
json: true,
};
return await fasq.request(options)
}

static async registerUser(body) {
var options = {
method: 'POST',
resolveWithFullResponse: true,
simple: false,
uri: hostUrl + "/" + `travelling/api/v1/auth/register`,
body,
json: true,
};
return await fasq.request(options)
}
}
module.exports = function(host) {
hostUrl = host;

return Travelling;
}
Loading