2017 © Pedro Peláez
 

library kwapi-wrapper

kwapi Client library

image

kwri/kwapi-wrapper

kwapi Client library

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 12 Versions
  • 0 % Grown

The README.md

KWApi Client Library

This repository contains PHP and JS Library that allows you to access the KW-API Platform from your PHP app., (*1)

PHP Library

Installation

This library can be installed with Composer. Run this command:, (*2)

composer require kwri/kwapi-wrapper

Usage

// Use old method (apiKey header)
$credential = new KWApi\Models\Credential("yourApiKey");
$credential->setEndPoint("http://kw-api.dev/v1/");
$service = new KWApi\KWApi($credential);

// Use new method (OpenID connect)

// Token data
$tokenType = 'bearer';
$accessToken = md5(time());
$refreshToken = md5(time()+1);
$expiresIn = 24*3600;

// User info  data
$kwUid = '999';
$email = 'pholenkadi17@gmail.com';
$company = 'Refactory';
$appName = 'KW-CRM';

$token = new KWAPI\Models\OpenIDToken($tokenType, $accessToken, $refreshToken, $expiresIn);
$userInfo = new KWAPI\Models\OpenIDUserInfo($kwUid, $email, $company, $appName);
$credential = new KWAPI\Models\OpenIDCredential($clientId, $token, $userInfo);
$credential->setEndPoint("http://kw-api.dev/v1/");
$service = new KWApi\KWApi($credential);

$response = $service->event()->browse();

Test

  1. Start KW-Api Service on local development
  2. Copy tests/config.php.dist to tests/config.php and set your credential value
  3. The test can be executed by running
./vendor/bin/phpunit --coverage-text

JS LIbrary

Installation

To use the library, clone this repository to your local machine., (*3)

Usage

// Use old method (apiKey header)
const BasePath = 'Your/Path/lib/'

const Credential = require(BasePath + 'KWApi/Models/Credential')
const KWAPI = require(BasePath + 'KWApi/')

const credential = new Credential(apiKey)

// There are several services that can be used, please refer at Services dir
const ApiUser = new KWAPI(credential)

// Use new method (OPENID Connect)

// Token data
const tokenType = 'Bearer'
const accessToken = md5(new Date())
const refreshToken = md5(Math.floor(Date.now() / 1000) + 1)
const expiresIn = 24 * 3600

// setUpOpenID
const OpenIDToken = require(BasePath + 'KWApi/Models/OpenIDToken')
const OpenIDUserInfo = require(BasePath + 'KWApi/Models/OpenIDUserInfo')
const OpenIDCredential = require(BasePath + 'KWApi/Models/OpenIDCredential')
//  You can set the clientId as you type
const clientId = "98jjhury866"

const KWAPI = require(BasePath + 'KWApi/')

const token = new OpenIDToken(tokenType, accessToken, refreshToken, expiresIn)
const userInfo = new OpenIDUserInfo(kwUid, email, company, appName)
const credential = new OpenIDCredential(clientId, token, userInfo)

credential.setEndPoint(endPoint)

const KwApi = new KWAPI(credential)

Test

  1. Start KW-API Server on local development
  2. The test can be executed by running npm test on your terminal

The Versions

17/07 2017

dev-master

9999999-dev https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

02/05 2017

dev-payloads-support

dev-payloads-support https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

12/04 2017

dev-hotfix-gluu-id

dev-hotfix-gluu-id https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

30/03 2017

dev-google-mail-extend

dev-google-mail-extend https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

15/02 2017

v1.1.0

1.1.0.0 https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

13/02 2017

v1.0.5

1.0.5.0 https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

13/02 2017

dev-patch-latest-kwiq

dev-patch-latest-kwiq https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

18/01 2017

dev-google-api-service

dev-google-api-service https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

01/10 2016

v1.0.4

1.0.4.0 https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

12/08 2016

v1.0.3

1.0.3.0 https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

06/07 2016

v1.0.2

1.0.2.0 https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah

05/07 2016

v1.0.1

1.0.1.0 https://github.com/KWRI/kwapi-wrapper

kwapi Client library

  Sources   Download

MIT

The Requires

 

The Development Requires

by Nurcahyo al Hidayah