ionic-coreo
Ionic2 module for integration with Coreo
Last updated 3 years ago by joewoodhouse .
ISC · Repository · Original npm · Tarball · package.json
$ cnpm install ionic-coreo 
SYNC missed versions from official npm registry.

ionic-coreo

Ionic2 module for integrating with Coreo

Installation

npm install ionic-coreo --save

Update your Ionic app.module.ts:

import { CoreoModule } from 'ionic-coreo';
...
@NgModule({
    imports: [CoreoModule]
    ...
})
export class AppModule {}

With Configuration

Currently not working!

import { CoreoModule, CoreoConfig } from 'ionic-coreo';
...
const coreoConfig = new CoreoConfig({
    baseUrl: 'https://coreo-dev.herokuapp.com'
});


@NgModule({
    imports: [
        CoreoModule.forRoot(coreoConfig)
    ]
    ...
})
export class AppModule {}

API

The following services are provided as @Injectable()s

CoreoAuth - Authentication

A thin wrapper around Ionic Native's GooglePlus and Facebook authentication. Ensure you have installed the relevant plugins and followed the configuration steps in the following documentation:

NOTE You must configure your OAuth credentials within Coreo. Go to Surveys > Your Survey > Credentials and add the relevant data.

import { CoreoAuth, CoreoAuthResult } from 'ionic-coreo';

@Component({
...
})
export class MyLoginComponent {
    constructor(
        private auth: CoreoAuth
    ) {}

    login(): Promise<CoreoAuthResult> {
        return this.auth.login('basic', { email: 'bob@mail.com', password: 'bob});
        // OR
        // const surveyId = 12;
        // return this.auth.login('google', surveyId);
    }
}

Methods:

  • login(method: 'basic' | 'google' | 'facebook', params: CoreoAuthLoginOptions)
  • logout(): void

Types:

  • CoreoAuthLoginOptions - If the method is 'basic' then this is an {email, password} object, else it is the surveyId you are logging in to.

CoreoUser - User

Properties:

  • isLoggedIn: boolean - Flag indicating whether the user is logged in or not.
  • id: number - User ID
  • email: string - Email
  • role: string - Role
  • displayName: string - Display Name
  • imageUrl: string - Users' profile image URL

Client

An HTTP client for sending queries and posting data to Coreo. Handles all authentication (if the user is logged in)

import { CoreoClient } from 'ionic-coreo';

@Injectable()
export class MyDataService {
    constructor(
        private client: CoreoClient
    ) {}

    getData(): Observable<any> {
        return this.client.request('/records?q=surveyId:12');
    }
}

Methods:

  • request(path: string, options: CoreoClientRequestOptions = {}) : Observable<any>
  • post(path: string, body?: FormData | any, options: CoreoClientRequestOptions = {}) : Observable<any>

Types:

  • CoreoClientRequestOptions
    • method: string - HTTP method. Defaults to 'get'
    • headers?: any - An Object of HTTP headers
    • body?: string | FormData | null
    • authentication?: CoreoAuthToken | false - If false, then no authentication header is set (even if the user is logged in). If set to a CoreoAuthToken, this token will be used again regardless of the user's logged in token. If authentication is not supplied then the user's logged in token will be used, if logged in.

Current Tags

  • 2.1.2                                ...           latest (3 years ago)
  • 3.0.0-beta.12                                ...           next (3 years ago)

41 Versions

  • 3.0.0-beta.12                                ...           3 years ago
  • 3.0.0-beta.11                                ...           3 years ago
  • 3.0.0-beta.10                                ...           3 years ago
  • 3.0.0-beta.9                                ...           3 years ago
  • 3.0.0-beta.8                                ...           3 years ago
  • 3.0.0-beta.7                                ...           3 years ago
  • 3.0.0-beta.6                                ...           3 years ago
  • 3.0.0-beta.5                                ...           3 years ago
  • 3.0.0-beta.4                                ...           3 years ago
  • 3.0.0-beta.3                                ...           3 years ago
  • 3.0.0-beta.2                                ...           3 years ago
  • 3.0.0-beta.1                                ...           3 years ago
  • 2.1.2                                ...           3 years ago
  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 2.0.0                                ...           3 years ago
  • 2.0.0-beta.2                                ...           3 years ago
  • 2.0.0-beta.1                                ...           3 years ago
  • 1.3.15                                ...           3 years ago
  • 1.3.14                                ...           3 years ago
  • 1.3.13                                ...           3 years ago
  • 1.3.12                                ...           3 years ago
  • 1.3.11                                ...           3 years ago
  • 1.3.10                                ...           3 years ago
  • 1.3.9                                ...           3 years ago
  • 1.3.8                                ...           3 years ago
  • 1.3.7                                ...           3 years ago
  • 1.3.6                                ...           3 years ago
  • 1.3.5                                ...           3 years ago
  • 1.3.4                                ...           3 years ago
  • 1.3.3                                ...           3 years ago
  • 1.3.2                                ...           3 years ago
  • 1.3.1                                ...           3 years ago
  • 1.2.1                                ...           3 years ago
  • 1.2.1-beta.1                                ...           3 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.2                                ...           4 years ago
  • 1.1.1                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Downloads
Today 0
This Week 1
This Month 1
Last Day 1
Last Week 0
Last Month 1
Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |