Skip to content

Commit

Permalink
#3 - Adds eslint and standardjs for coding standards
Browse files Browse the repository at this point in the history
  • Loading branch information
Polyneue committed Apr 19, 2017
1 parent 601eda2 commit b8b29c8
Show file tree
Hide file tree
Showing 10 changed files with 3,722 additions and 3,722 deletions.
130 changes: 63 additions & 67 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,18 @@ Making a request looks something like this:

```javascript
// Dependencies
const
Behance = require('behance-api'),
Be = new Behance(API_KEY),
fs = require('fs');
const Behance = require('behance-api')
const Be = new Behance(API_KEY)
const fs = require('fs')

// Get Projects Data
Be.projects({q: 'motorcycle'}, function(err, res, data) {

// Handle Errors
if (err) {
throw err;
}

// Do something with the data received from the API
fs.writeFile('projectsData.json', JSON.stringify(data, null, 4));
});
Be.projects({q: 'motorcycle'}, function (err, res, data) {
// Handle Errors
if (err) throw err

// Do something with the data received from the API
fs.writeFile('projectsData.json', JSON.stringify(data, null, 4))
})
```

The snippet above will make a request to the Behance API and receive the first page of results that match the `motorcycle` query for the `/projects/` endpoint. It then saves that data to a json file to be used. Every callback gets three arguments; an error (if there is one), the HTTP response, and a JSON object.
Expand All @@ -43,125 +39,125 @@ The snippet above will make a request to the Behance API and receive the first p
Search for projects.

```javascript
Be.projects(opts, function(err, res, data) {
console.dir(data);
});
Be.projects(opts, function (err, res, data) {
console.dir(data)
})
```

### Project Endpoints
All of the project related functions require a project `id`.

```javascript
// Get the information and content of a project.
Be.project(id, function(err, res, data) {
console.dir(data);
});
Be.project(id, function (err, res, data) {
console.dir(data)
})

// Get the comments for a project.
Be.projectComments(id, function(err, res, data) {
console.dir(data);
});
Be.projectComments(id, function (err, res, data) {
console.dir(data)
})
```

### Users Endpoint
Search for users.

```javascript
Be.users(opts, function(err, res, data) {
console.dir(data);
});
Be.users(opts, function (err, res, data) {
console.dir(data)
})
```

### User Endpoints
All of the user related functions require a user `id` or username.

```javascript
// Get basic information about a user.
Be.user(id, function(err, res, data) {
console.dir(data);
});
Be.user(id, function (err, res, data) {
console.dir(data)
})

// Get the projects published by a user.
Be.userProjects(id, opts, function(err, res, data) {
console.dir(data);
});
Be.userProjects(id, opts, function (err, res, data) {
console.dir(data)
})

// Get the works-in-progress published by a user.
Be.userWips(id, opts, function(err, res, data) {
console.dir(data);
Be.userWips(id, opts, function (err, res, data) {
console.dir(data)
})

// Get a list of user's recently appreciated projects.
Be.userApprecitations(id, opts, function(err, res, data) {
console.dir(data);
});
Be.userApprecitations(id, opts, function (err, res, data) {
console.dir(data)
})

// Get a list of a user's collections.
Be.userCollections(id, opts, function(err, res, data) {
console.dir(data);
});
Be.userCollections(id, opts, function (err, res, data) {
console.dir(data)
})

// Get statistics (all-time and today) for a specific user. Includes number of project views, appreciations, comments, and profile views.
Be.userStats(id, function(err, res, data) {
console.dir(data);
});
Be.userStats(id, function (err, res, data) {
console.dir(data)
})

// Get a list of creatives who follow the user.
Be.userFollowers(id, opts, function(err, res, data) {
console.dir(data);
});
Be.userFollowers(id, opts, function (err, res, data) {
console.dir(data)
})

// Get a list of creatives followed by the user.
Be.userFollowing(id, opts, function(err, res, data) {
console.dir(data);
});
Be.userFollowing(id, opts, function (err, res, data) {
console.dir(data)
})

// A list of the user's professional experience
Be.userWorkExperience(id, function(err, res, data) {
console.dir(data);
});
Be.userWorkExperience(id, function (err, res, data) {
console.dir(data)
})
```

### Collections Endpoint
Search for collections.

```javascript
Be.collections(opts, function(err, res, data) {
console.dir(data);
});
Be.collections(opts, function (err, res, data) {
console.dir(data)
})
```

### Collection Endpoints
All collection related functions require a collection `id`

```javascript
// Get basic information about a collection.
Be.collection(id, function(err, res, data) {
console.dir(data);
});
Be.collection(id, function (err, res, data) {
console.dir(data)
})

// Get projects from a collection.
Be.collectionProjects(id, opts, function(err, res, data) {
console.dir(data);
});
Be.collectionProjects(id, opts, function (err, res, data) {
console.dir(data)
})
```

### Creatives To Follow Endpoint
Provides a list of creatives you might be interested in following.

```javascript
Be.creativesToFollow(opts, function(err, res, data) {
console.dir(data);
});
Be.creativesToFollow(opts, function (err, res, data) {
console.dir(data)
})
```

### Creative Fields Endpoint
Retrieves all Creative Fields in two groups, all fields (in 'fields') and popular ones (in 'popular')

```javascript
Be.fields(function(err, res, data) {
console.dir(data);
});
Be.fields(function (err, res, data) {
console.dir(data)
})
```

## Tests
Expand Down
31 changes: 15 additions & 16 deletions example/index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
'use strict';
'use strict'

// Dependencies
const
Behance = require('../index.js'),
fs = require('fs');
const Behance = require('../index.js')
const fs = require('fs')

// Create an Instance of Behance with API Key
const
key = require('../api.json').key,
Be = new Behance(key);
const key = require('../api.json').key
const Be = new Behance(key)

// Get Projects Data
Be.userProjects('edmendoza3', function(err, res, data) {

// Check for errors
if (err) {
throw err;
}
Be.userProjects('edmendoza3', function (err, res, data) {
// Check for errors
if (err) {
throw err
}

// Write a JSON File with API Data
fs.writeFile('./projectsData.json', JSON.stringify(data, null, 4));
});
// Write a JSON File with API Data
fs.writeFile('./projectsData.json', JSON.stringify(data, null, 2), (err) => {
if (err) throw err
})
})

0 comments on commit b8b29c8

Please sign in to comment.