Skip to content

Commit d4c7cc8

Browse files
committed
Merge branch 'release/2.0.0-alpha1'
2 parents e0840fc + de4d4d6 commit d4c7cc8

75 files changed

Lines changed: 16711 additions & 994 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ node_modules
2828
.lock-wscript
2929

3030
www/
31+
config.json

README.md

Lines changed: 26 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,52 @@
11
wp-api-angularjs
22
================
33

4-
wp-api-angularjs is under development and will only cover GET methods of the [WP-API](https://github.com/WP-API/WP-API) master branch.
4+
AngularJS services to consume [WP-API v2](http://v2.wp-api.org/)
55

6-
## Install
6+
## Documentation
77

8-
include the bundled version ```wp-api-angularjs.bundle.js``` (Contains underscore and Restangular) and add the library to your dependencies:
8+
<http://shprink.github.io/wp-api-angularjs/>
99

10-
```
11-
angular.module('myApp', ['wp-api-angularjs']);
12-
```
13-
14-
## Services
15-
16-
### WpApiProvider
17-
18-
wp-api-angularjs is based on Restangular therefore you can use any of the [Restangular Provider methods](https://github.com/mgonto/restangular/tree/1.4.0#configuring-in-the-config)
10+
## oAuth1
1911

20-
```
21-
.config(function(WpApiProvider) {
22-
var RestangularProvider = WpApiProvider.getRestangularProvider();
23-
RestangularProvider.setBaseUrl('/api/v1');
24-
});
25-
```
26-
27-
wp-api-angularjs always returns promises:
28-
29-
```
30-
$wpApiPosts.$get(id).then(function(post) {
31-
// OK
32-
}).catch(function() {
33-
// KO
34-
});
35-
```
12+
<http://v2.wp-api.org/guide/authentication/>
3613

37-
### Posts ```$wpApiPosts```
14+
### Install OAuth1 plugin
3815

39-
```
40-
// Get latests posts
41-
$wpApiPosts.$getList();
42-
43-
// Get filtered posts
44-
$wpApiPosts.$getList({
45-
"page" : 2,
46-
"filter[category_name]": "uncategorized",
47-
"filter[posts_per_page]": 5,
48-
"filter[orderby]": "date",
49-
"filter[order]": "desc",
50-
"filter[post_status]": "publish"
51-
});
52-
53-
$wpApiPosts.$get(id);
54-
55-
# DOES NOT WORK FOR NOW
56-
$wpApiPosts.$create();
57-
```
16+
Export <https://github.com/WP-API/OAuth1> zip and upload it into your WP instance.
5817

59-
### Media ```$wpApiMedia```
18+
### Install WP-CLI
6019

6120
```
62-
$wpApiMedia.$getList();
63-
$wpApiMedia.$get(id);
64-
65-
# DOES NOT WORK FOR NOW
66-
$wpApiMedia.$create();
21+
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
22+
chmod +x wp-cli.phar
23+
sudo mv wp-cli.phar /usr/local/bin/wp
6724
```
6825

69-
### Users ```$wpApiUsers```
70-
71-
Requires [authentication](http://wp-api.org/guides/authentication.html)
26+
More info: <http://wp-cli.org/>
7227

73-
```
74-
$wpApiUsers.$getList();
75-
$wpApiUsers.$get(id);
76-
$wpApiUsers.$getMe();
28+
### Create a consumer:
7729

78-
# DOES NOT WORK FOR NOW
79-
$wpApiMedia.$create();
8030
```
31+
$ wp oauth1 add
8132
82-
### Taxonomies ```$wpApiTaxonomies```
83-
84-
```
85-
$wpApiTaxonomies.$getList();
86-
$wpApiTaxonomies.$get(taxonomy);
87-
$wpApiTaxonomies.$getTermList(taxonomy);
88-
$wpApiTaxonomies.$getTerm(taxonomy, id);
33+
ID: 4
34+
Key: sDc51JgH2mFu
35+
Secret: LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW
8936
```
9037

9138
## Contribute
9239

9340
```
94-
sudo npm install webpack webpack-dev-server -g
9541
npm install
96-
webpack-dev-server
42+
cp config.dist.json config.json
43+
44+
# Open two terminals
45+
# and run watch to build on the lib files changes
46+
npm run watch
47+
48+
# in the other terminal run following to build the test page and the doc
49+
npm run devserver
9750
```
9851

99-
Open ```http://localhost:8080/test.html```
52+
Open ```http://localhost:8080```

config.dist.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"baseUrl": "http://sandbox.YourDomain.com/wp-json",
3+
"oauth1": {
4+
"enabled": false,
5+
"ID": "4",
6+
"Key": "sDc51JgH2mFu",
7+
"Secret": "LnUdIsyhPFnURkatekRIAUfYV7nmP4iF3AVxkS5PRHPXxgOW"
8+
}
9+
}

dist/wp-api-angularjs.bundle.js

Lines changed: 0 additions & 225 deletions
This file was deleted.

dist/wp-api-angularjs.bundle.min.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)