From 77fcd1bfbb615e2e2f7430a1b889721e3d9f2d65 Mon Sep 17 00:00:00 2001 From: supamiu Date: Wed, 17 Oct 2018 15:24:50 +0200 Subject: [PATCH] feat: implemented free company search --- src/xivapi.service.ts | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/xivapi.service.ts b/src/xivapi.service.ts index 431343e..0ee5f90 100644 --- a/src/xivapi.service.ts +++ b/src/xivapi.service.ts @@ -3,6 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http'; import { Observable } from 'rxjs'; import { CharacterSearchResult, + Pagination, PvpTeam, XivapiCharacterOptions, XivapiEndpoint, @@ -109,6 +110,30 @@ export class XivapiService { return this.request(url); } + /** + * Search for free companies on The Lodestone. This parses the lodestone in real time so it will be slow for non-cached responses. + * All search queries are cached for 1 hour, it is important to know that Lodestone has a ~6 hour varnish and CDN cache. + * This does not search XIVAPI so free companies found may not be on + * the service and will be added when requested by their specified lodestone ID. + * + * @param name The name of the company to search, you can use + for spaces or let the API handle it for you. + * If you search very short names you will get lots of responses. + * This is an issue with The Lodestone and not much XIVAPI can do about it at this time. + * @param server (optional) The server to search against, this is case sensitive. + * You can obtain a list of valid servers via getServerList method. + * @param page Search or move to a specific page. + */ + public searchFreeCompany(name: string, server?: string, page?: number): Observable<{ Results: any[], Pagination: Pagination }> { + let url: string = `/freecompany/search?name=${name}`; + if (server !== undefined) { + url += `&server=${server}`; + } + if (page !== undefined) { + url += `&page=${page}`; + } + return this.request<{ Results: any[], Pagination: Pagination }>(url); + } + /** * Gets character verification informations based on lodestoneId. *