/** * NymOS API 1.9.21 * * The contents of this file are subject to the NymOS License, version 1.0. * It is forbidden the use of the codes included on this file, even partially, * for third parties, such as its copy, without express authorization of the * intelectual property and commercial rights owners. A copy of the license * may be obtained at http://nymos.io/source-license. The intelectual * property and comercial rights of this file and codes belong to NymOS S.A. * * Copyright (c) 2017. All rights reserved. * */ /* tslint:disable:no-unused-variable member-ordering */ import { Inject, Injectable, Optional } from '@angular/core'; import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; import { CustomHttpUrlEncodingCodec } from '../internal/encoder'; import { AppEvents } from '../models/app-events.model'; @Injectable() export class EventsService { constructor(protected httpClient: HttpClient) { } /** * Track app events * This `endpoint` lets you track multiple app events in a single shot. The bellow event types are supported: Type | Description ------------ | ------------- `logged_in` | Must be fired when user logs in `logged_out` | Must be fired when user logs out `activated_app` | Track this event when app was brought back to the foreground `deactivated_app` | Track this event when app has gone to background `custom` | Track any custom event you want. For custom events, `event.name` is required. Events must be cached and flushed out to the `NymOS` servers in a number of situations: - when an event count threshold is passed (currently 100 logged events) - when a time threshold is passed (currently 15 seconds). - when an app has gone to background and is then brought back to the foreground. * @param app * @param observe set whether or not to return the data Observable as the body, response or events. defaults to returning the body. * @param reportProgress flag to report request and response progress. */ public track(app: AppEvents): Observable { if (app === null || app === undefined) { throw new Error('Required parameter app was null or undefined when calling track.'); } let headers = new HttpHeaders(); headers = headers.set("Content-Type", "application/json"); return this.httpClient.post(`https://events-dot-nymos-dev.appspot.com/v1/events`, app, { headers: headers, } ); } }