innocode-digital/wp-innocode-community

This package is abandoned and no longer maintained. No replacement package was suggested.

Helps to integrate Innocode Community with a site.

0.3.0 2020-06-05 15:23 UTC

This package is auto-updated.

Last update: 2022-12-05 20:45:17 UTC


README

Description

Helps to integrate Innocode Community with a site.

Install

  • Preferable way is to use Composer:

    composer require innocode-digital/wp-innocode-community
    

    By default it will be installed as Must Use Plugin. But it's possible to control with extra.installer-paths in composer.json.

  • Alternate way is to clone this repo to wp-content/mu-plugins/ or wp-content/plugins/:

    cd wp-content/plugins/
    git clone git@github.com:innocode-digital/wp-innocode-community.git
    cd wp-innocode-community/
    composer install
    

If plugin was installed as regular plugin then activate Community from Plugins page or WP-CLI: wp plugin activate wp-innocode-community.

Usage

Add required constants (usually to wp-config.php):

define( 'INNOCODE_COMMUNITY_INSTANCE_URL', '' );
define( 'INNOCODE_COMMUNITY_CONSUMER_TOKEN', '' );

Documentation

Get Innocode Community API object:

innocode_community();

Note: it will trigger an error in case when required constants INNOCODE_COMMUNITY_INSTANCE_URL and/or INNOCODE_COMMUNITY_CONSUMER_TOKEN are missing.

Get a feed:

innocode_community()->get_feed( int $id, array $query_args = [], array $args = [] );
  • $id - Feed ID.
  • $query_args - Query arguments.
  • $args - Request arguments. See WP_Http::request() for more info.

Perform an HTTP request to the API:

// Performs any HTTP request
innocode_community()->request( string $method, string $path, array $query_args = [], array $args = [] );

// Performs GET HTTP request
innocode_community()->get( string $path, array $query_args = [], array $args = [] );
  • $method - Request method. Accepts GET, POST, HEAD, PUT, DELETE, TRACE, OPTIONS, or PATCH.
  • $path - Endpoint path.
  • $query_args - Query arguments.
  • $args - Request arguments. See WP_Http::request() for more details.

REST API

HTTP method Endpoint Function
GET /innocode/v1/community/feeds/<id> Retrieves a feed from Community through API.

Request Parameters

Name Type Description
id int Feed ID. Required