New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ng2-wp-api

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng2-wp-api - npm Package Compare versions

Comparing version

to
1.2.2

2

components/collection/collection.component.d.ts

@@ -7,3 +7,3 @@ import { EventEmitter, SimpleChange } from '@angular/core';

endpoint: any;
args: {};
args: any;
/** Output for the response */

@@ -10,0 +10,0 @@ response: EventEmitter<{}>;

@@ -16,3 +16,2 @@ "use strict";

this.wpCollection = wpCollection;
this.args = {};
/** Output for the response */

@@ -26,3 +25,3 @@ this.response = new core_1.EventEmitter();

if (prevArgs != newArgs) {
setTimeout(() => this.fetch(newArgs));
this.fetch(newArgs);
}

@@ -29,0 +28,0 @@ }

@@ -15,3 +15,3 @@ import {Component, Input, Output, EventEmitter, SimpleChange} from '@angular/core';

@Input() endpoint;
@Input() args = {};
@Input() args;

@@ -31,7 +31,7 @@ /** Output for the response */

if (prevArgs != newArgs) {
setTimeout(() => this.fetch(newArgs));
this.fetch(newArgs);
}
}
/** Get collection of endpoint type */
/** Get collection of endpoint type */
fetch(args) {

@@ -54,3 +54,3 @@ this.wpCollection.Endpoint(this.endpoint).get(args).subscribe(

/** Get more collection if available */
/** Get more collection if available */
more() {

@@ -57,0 +57,0 @@ this.wpCollection.Endpoint(this.endpoint).more().subscribe(

{
"name": "ng2-wp-api",
"version": "1.2.1",
"version": "1.2.2",
"description": "WordPress API Service for Angular2",

@@ -5,0 +5,0 @@ "main": "./index.js",

@@ -40,20 +40,26 @@ # Angular2 WordPress API Service Beta

You can either use the components or services to get the data from WordPress api.
Components:
- `Collection` Component to consume WpCollection service.
- `Model` Component to consume WpModel service.
### Components:
Services:
- `WpCollection` Service to get a collection of endpoint type.
- `WpModel` Service to get a single object of endpoint type by id.
- `WpState` Global service to get and set library's configurations e.g. base address and user credentials.
- `Collection` Inputs: args, endpoint - Output: collection response.
- `Model` Inputs: id, args, endpoint - Output: model response.
Classes:
- `Post` Class for Post/Page contains helper functions (e.g. functions for accessing embedded properties).
- `User` Interface for User response.
- `QueryArgs` Class for creating query arguments
### Services:
Helper:
- `Endpoint` Default endpoints.
- `WpCollection` Service to get a collection of endpoint type.
- `WpModel` Service to get a single object of endpoint type by id.
- `WpState` Class to configure the library (e.g. wordpress base url).
### Helper Classes:
- `Post` Class for Post/Page contains helper functions (e.g. functions for accessing embedded properties).
- `User` Interface for User response.
- `QueryArgs` Class for creating query arguments
- `WpHelper` Get endpoint address.
:
**Default Endpoints** are : `Posts`, `Pages`, `Users`, `Categories`, `Tags`, `Taxonomies`, `Statuses`, `Comments`, `Media`

@@ -98,3 +104,3 @@

1 - import `WpState` service in your root component, then set the `baseUrl` to your WordPress host address
1 - import `WpState` class in your root component, then set the `baseUrl` to your WordPress host address

@@ -117,3 +123,3 @@ 2 - Inject `WORDPRESS_PROVIDERS` in the root component provider or directly in bootstrap.

```
[Initilizing the library example](/examples/Initilizing WP Service.ts)
[Initilizing the library - full example](/examples/Initilizing WP Service.ts)

@@ -128,6 +134,4 @@ `WpState` *is a global service where other services can acquire information.*

<a name="collectionCmp"/>
### **METHOD 1:** The component way
### **METHOD 1:** Using `Collection` component
The basic usage is to get to display a collection of posts
```

@@ -181,3 +185,3 @@ <collection [args]="args" [endpoint]="endpoint" (response)="postsData($event)">

<a name="collectionSrv"/>
### **METHOD 2:** The service way
### **METHOD 2:** Using `Collection` Service

@@ -236,3 +240,3 @@ ```

```
Note that contrary to what we did with `WpState`, Every component uses one of these services must has its own instance of the service, so we must inject the service within each component.
Note that contrary to what we did with `WpState`, Any component uses one of these services must has its own instance of the service, so we must inject the service within each component.

@@ -245,3 +249,3 @@ [Getting collection using the service - full example](/examples/Collection using the service.ts)

<a name="modelCmp"/>
### **METHOD 1:** The component way
### **METHOD 1:** Using `Model` component

@@ -303,3 +307,3 @@ ```

<a name="modelSrv"/>
### **METHOD 2:** The service way
### **METHOD 2:** Using `WpModel` service

@@ -374,3 +378,3 @@ ```

```
[Initilizing the library example](/examples/Initilizing WP Service.ts)
[Initilizing the library - full example](/examples/Initilizing WP Service.ts)

@@ -377,0 +381,0 @@ <a name="issues"/>

Sorry, the diff of this file is not supported yet