Skip to content

Commit 77487e5

Browse files
committed
export correct d.ts files
1 parent a26e72d commit 77487e5

21 files changed

+261
-57
lines changed

README.md

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,36 @@
1-
wp-api-angularjs
1+
wp-api-angular
22
================
33

4-
[![Join the chat at https://gitter.im/shprink/wp-api-angularjs](https://badges.gitter.im/shprink/wp-api-angularjs.svg)](https://gitter.im/shprink/wp-api-angularjs?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4+
[![Join the chat at https://gitter.im/shprink/wp-api-angular](https://badges.gitter.im/shprink/wp-api-angular.svg)](https://gitter.im/shprink/wp-api-angular?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
55

6-
Angular2 services to consume [WP-API v2](http://v2.wp-api.org/) (< 2.5kb gziped)
6+
Angular2 services to consume [WP-API v2](http://v2.wp-api.org/)
77

88
[Live Demo](https://plnkr.co/edit/hqE4bvbM6HXql5Insjx8?p=preview)
99

10-
If you want to use AngularJS v1, here is the latest version: [v2.0.0-rc3](https://github.com/shprink/wp-api-angularjs/tree/v2.0.0-rc3)
10+
If you want to use AngularJS v1, here is the latest version: [v2.0.0-rc3](https://github.com/shprink/wp-api-angular/tree/v2.0.0-rc3)
1111

1212
## Installation
1313

1414
```shell
15-
npm install wp-api-angularjs
15+
npm install wp-api-angular
1616
```
1717

18+
### TypeScript
19+
20+
Nothing special if you use TS
21+
22+
### UMD
23+
24+
UMD files are available `wp-api-angular.umd.js` and `wp-api-angular.umd.min.js`, the [Live Demo](https://plnkr.co/edit/hqE4bvbM6HXql5Insjx8?p=preview) uses them with systemJS
25+
1826
## Bootstrap
1927

2028

2129
```js
2230
import {
2331
WPAPI_PROVIDERS,
2432
defaultWpApi
25-
} from 'wp-api-angularjs';
33+
} from 'wp-api-angular';
2634

2735
import {App} from './app';
2836

demo/app.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
WpApiStatuses,
1111
WpApiTerms,
1212
WpApiCustom
13-
} from 'wp-api-angularjs';
13+
} from '../dist/wp-api-angular';
1414
let config = require('../config.json');
1515

1616
@Component({

demo/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import 'rxjs/add/operator/toPromise';
44
import {
55
WPAPI_PROVIDERS,
66
defaultWpApi
7-
} from 'wp-api-angularjs'
7+
} from '../dist/wp-api-angular'
88
let config = require('../config.json');
99

1010
import {App} from './app';

package.json

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
{
2-
"name": "wp-api-angularjs",
3-
"version": "3.0.0-alpha2",
2+
"name": "wp-api-angular",
3+
"version": "3.0.0-alpha7",
44
"description": "WordPress WP-API v2 client for Angular2",
5-
"main": "dist/wp-api-angularjs.js",
5+
"main": "wp-api-angular.js",
6+
"typings": "wp-api-angular.d.ts",
67
"scripts": {
78
"start": "webpack-dev-server --port 8080 --json --progress --config webpack.config.js",
8-
"build": "npm run dumpdev && npm run dumpprod",
9+
"prebuild": "rm -rf dist",
10+
"build": "tsc && npm run dumpdev && npm run dumpprod",
11+
"postbuild": "cp package.json README.md dist/",
12+
"watch": "rm -rf dist && tsc -w",
13+
"publish": "npm run build && npm publish dist",
914
"dumpdev": "ENV=dev webpack --progress --colors --config webpack.config.dist.js -d",
1015
"dumpprod": "ENV=prod webpack --progress --colors --config webpack.config.dist.js -p",
11-
"watch": "ENV=dev webpack --watch --progress --colors --config webpack.config.dist.js -d",
1216
"postinstall": "typings install",
1317
"typings": "typings"
1418
},
1519
"repository": {
1620
"type": "git",
17-
"url": "https://github.com/shprink/wp-api-angularjs"
21+
"url": "https://github.com/shprink/wp-api-angular"
1822
},
1923
"keywords": [
2024
"wp-api",
@@ -27,9 +31,9 @@
2731
"author": "shprink <[email protected]>",
2832
"license": "MIT",
2933
"bugs": {
30-
"url": "https://github.com/shprink/wp-api-angularjs/issues"
34+
"url": "https://github.com/shprink/wp-api-angular/issues"
3135
},
32-
"homepage": "https://github.com/shprink/wp-api-angularjs",
36+
"homepage": "https://github.com/shprink/wp-api-angular",
3337
"devDependencies": {
3438
"@angular/common": "^2.0.0-rc.4",
3539
"@angular/compiler": "^2.0.0-rc.4",
@@ -45,7 +49,7 @@
4549
"path": "^0.4.9",
4650
"reflect-metadata": "^0.1.3",
4751
"rxjs": "5.0.0-beta.6",
48-
"ts-loader": "^0.8.2",
52+
"ts-loader": "0.8.1",
4953
"typescript": "~1.8.10",
5054
"util": "^0.10.3",
5155
"webpack": "~1.13.1",

src/Comments.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
import { Injectable } from '@angular/core';
2-
import { WpApiParent } from './parent.ts';
3-
import { IWpApiComments } from './interfaces';
2+
3+
// Need to import interfaces dependencies
4+
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
5+
import { Observable } from 'rxjs/Observable.d.ts';
6+
import { RequestOptionsArgs } from '@angular/http/src/interfaces.d.ts';
7+
import { Response } from '@angular/http/src/static_response.d.ts';
8+
9+
import { WpApiParent } from './Parent';
10+
11+
export interface IWpApiComments {
12+
getList(options?: RequestOptionsArgs): Observable<Response>;
13+
get(commentId: number, options?: RequestOptionsArgs): Observable<Response>;
14+
create(body: any, options?: RequestOptionsArgs): Observable<Response>;
15+
update(commentId: number, body: any, options?: RequestOptionsArgs): Observable<Response>;
16+
delete(commentId: number, options?: RequestOptionsArgs): Observable<Response>;
17+
}
418

519
@Injectable()
620
export class WpApiComments extends WpApiParent implements IWpApiComments {

src/Custom.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
import { Injectable } from '@angular/core';
2-
import { WpApiParent } from './parent.ts';
3-
import { IWpApiCustom } from './interfaces';
2+
3+
// Need to import interfaces dependencies
4+
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
5+
import { Observable } from 'rxjs/Observable.d.ts';
6+
import { RequestOptionsArgs } from '@angular/http/src/interfaces.d.ts';
7+
import { Response } from '@angular/http/src/static_response.d.ts';
8+
9+
import { WpApiParent } from './Parent';
10+
11+
export interface IWpApiCustom {
12+
getList(options?: RequestOptionsArgs): Observable<Response>;
13+
get(customId: number, options?: RequestOptionsArgs): Observable<Response>;
14+
create(body: any, options?: RequestOptionsArgs): Observable<Response>;
15+
update(customId: number, body: any, options?: RequestOptionsArgs): Observable<Response>;
16+
delete(customId: number, options?: RequestOptionsArgs): Observable<Response>;
17+
}
418

519
@Injectable()
620
export class WpApiCustom extends WpApiParent {

src/Media.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,20 @@
11
import { Injectable } from '@angular/core';
2-
import { WpApiParent } from './parent.ts';
3-
import { IWpApiMedia } from './interfaces';
2+
3+
// Need to import interfaces dependencies
4+
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
5+
import { Observable } from 'rxjs/Observable.d.ts';
6+
import { RequestOptionsArgs } from '@angular/http/src/interfaces.d.ts';
7+
import { Response } from '@angular/http/src/static_response.d.ts';
8+
9+
import { WpApiParent } from './Parent';
10+
11+
export interface IWpApiMedia {
12+
getList(options?: RequestOptionsArgs): Observable<Response>;
13+
get(mediaId: number, options?: RequestOptionsArgs): Observable<Response>;
14+
create(body: any, options?: RequestOptionsArgs): Observable<Response>;
15+
update(mediaId: number, body: any, options?: RequestOptionsArgs): Observable<Response>;
16+
delete(mediaId: number, options?: RequestOptionsArgs): Observable<Response>;
17+
}
418

519
@Injectable()
620
export class WpApiMedia extends WpApiParent implements IWpApiMedia {

src/Pages.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,24 @@
11
import { Injectable } from '@angular/core';
2-
import { WpApiParent } from './parent.ts';
3-
import { IWpApiPages } from './interfaces';
2+
3+
// Need to import interfaces dependencies
4+
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
5+
import { Observable } from 'rxjs/Observable.d.ts';
6+
import { RequestOptionsArgs } from '@angular/http/src/interfaces.d.ts';
7+
import { Response } from '@angular/http/src/static_response.d.ts';
8+
9+
import { WpApiParent } from './Parent';
10+
11+
export interface IWpApiPages {
12+
getList(options?: RequestOptionsArgs): Observable<Response>;
13+
get(pageId: number, options?: RequestOptionsArgs): Observable<Response>;
14+
create(body: any, options?: RequestOptionsArgs): Observable<Response>;
15+
update(pageId: number, body: any, options?: RequestOptionsArgs): Observable<Response>;
16+
delete(pageId: number, options?: RequestOptionsArgs): Observable<Response>;
17+
getMetaList(pageId: number, options?: RequestOptionsArgs): Observable<Response>;
18+
getMeta(pageId: number, metaId: number, options?: RequestOptionsArgs): Observable<Response>;
19+
getRevisionList(pageId: number, options?: RequestOptionsArgs): Observable<Response>;
20+
getRevision(pageId: number, revisionId: number, options?: RequestOptionsArgs): Observable<Response>;
21+
}
422

523
@Injectable()
624
export class WpApiPages extends WpApiParent implements IWpApiPages {

src/Parent.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
import { Injectable } from '@angular/core';
22
import { Http } from '@angular/http';
33

4-
import { WpApiAppConfig, IParent } from './interfaces';
4+
// Need to import interfaces dependencies
5+
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
6+
import { Observable } from 'rxjs/Observable.d.ts';
7+
import { RequestOptionsArgs } from '@angular/http/src/interfaces.d.ts';
8+
import { Response } from '@angular/http/src/static_response.d.ts';
9+
10+
import { WpApiAppConfig } from './wp-api-angular';
11+
12+
export interface IParent {
13+
httpGet(url: string, options?: RequestOptionsArgs): Observable<Response>;
14+
httpHead(url: string, options?: RequestOptionsArgs): Observable<Response>;
15+
httpDelete(url: string, options?: RequestOptionsArgs): Observable<Response>;
16+
httpPost(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
17+
httpPut(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
18+
httpPatch(url: string, body: any, options?: RequestOptionsArgs): Observable<Response>;
19+
}
520

621
@Injectable()
722
export class WpApiParent implements IParent {

src/Posts.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
import { Injectable } from '@angular/core';
2-
import { WpApiParent } from './parent.ts';
3-
import { IWpApiPosts } from './interfaces';
2+
3+
// Need to import interfaces dependencies
4+
// Bug TypeScript https://github.com/Microsoft/TypeScript/issues/5938
5+
import { Observable } from 'rxjs/Observable.d.ts';
6+
import { RequestOptionsArgs } from '@angular/http/src/interfaces.d.ts';
7+
import { Response } from '@angular/http/src/static_response.d.ts';
8+
9+
import { WpApiParent } from './Parent';
10+
11+
export interface IWpApiPosts {
12+
getList(options?: RequestOptionsArgs): Observable<Response>;
13+
get(postId: number, options?: RequestOptionsArgs): Observable<Response>;
14+
create(body: any, options?: RequestOptionsArgs): Observable<Response>;
15+
update(postId: number, body: any, options?: RequestOptionsArgs): Observable<Response>;
16+
delete(postId: number, options?: RequestOptionsArgs): Observable<Response>;
17+
getMetaList(postId: number, options?: RequestOptionsArgs): Observable<Response>;
18+
getMeta(postId: number, metaId: number, options?: RequestOptionsArgs): Observable<Response>;
19+
getRevisionList(postId: number, options?: RequestOptionsArgs): Observable<Response>;
20+
getRevision(postId: number, revisionId: number, options?: RequestOptionsArgs): Observable<Response>;
21+
getCategoryList(postId: number, options?: RequestOptionsArgs): Observable<Response>;
22+
getCategory(postId: number, categoryId, options?: RequestOptionsArgs): Observable<Response>;
23+
getTagList(postId: number, options?: RequestOptionsArgs): Observable<Response>;
24+
getTag(postId: number, tagId, options?: RequestOptionsArgs): Observable<Response>;
25+
}
426

527
@Injectable()
628
export class WpApiPosts extends WpApiParent implements IWpApiPosts {

0 commit comments

Comments
 (0)