UNPKG

@ibge/calendario

Version:

## Instalação

110 lines (104 loc) 3.57 kB
(function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/http'), require('rxjs/add/operator/map')) : typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', '@angular/http', 'rxjs/add/operator/map'], factory) : (factory((global.calendario = global.calendario || {}),global._angular_core,global._angular_common,global._angular_http)); }(this, (function (exports,_angular_core,_angular_common,_angular_http) { 'use strict'; var CalendarioService = (function () { /** * @param {?} _http */ function CalendarioService(_http) { this._http = _http; this._headers = new _angular_http.Headers(); this._headers.append('Accept', 'application/json; charset=utf-8'); } /** * @param {?} query * @return {?} */ CalendarioService.prototype.getDivulgacoes = function (query) { var /** @type {?} */ params = new _angular_http.URLSearchParams(); if (query.qtd) { params.append('qtd', query.qtd.toString()); } if (query.de) { params.append('de', query.de.toString()); } if (query.ate) { params.append('ate', query.ate.toString()); } var /** @type {?} */ options = new _angular_http.RequestOptions({ headers: this._headers, search: params }); return this._http.get("http://servicodados.ibge.gov.br/api/v3/calendario", options) .map(function (res) { return (res.json()); }); }; /** * @param {?} pesquisa * @param {?} query * @return {?} */ CalendarioService.prototype.getDivulgacoesPorPesquisa = function (pesquisa, query) { var /** @type {?} */ params = new _angular_http.URLSearchParams(); if (query.qtd) { params.append('qtd', query.qtd.toString()); } if (query.de) { params.append('de', query.de.toString()); } if (query.ate) { params.append('ate', query.ate.toString()); } var /** @type {?} */ options = new _angular_http.RequestOptions({ headers: this._headers, search: params }); return this._http.get("http://servicodados.ibge.gov.br/api/v3/calendario/" + pesquisa, options) .map(function (res) { return (res.json()); }); }; return CalendarioService; }()); CalendarioService.decorators = [ { type: _angular_core.Injectable }, ]; /** * @nocollapse */ CalendarioService.ctorParameters = function () { return [ { type: _angular_http.Http, }, ]; }; var CalendarioModule = (function () { function CalendarioModule() { } /** * @return {?} */ CalendarioModule.forRoot = function () { return { ngModule: CalendarioModule, providers: [CalendarioService] }; }; return CalendarioModule; }()); CalendarioModule.decorators = [ { type: _angular_core.NgModule, args: [{ imports: [ _angular_common.CommonModule, _angular_http.HttpModule ] },] }, ]; /** * @nocollapse */ CalendarioModule.ctorParameters = function () { return []; }; exports.CalendarioModule = CalendarioModule; exports.CalendarioService = CalendarioService; Object.defineProperty(exports, '__esModule', { value: true }); })));