Skip to content

Commit

Permalink
feat: implemented free company search
Browse files Browse the repository at this point in the history
  • Loading branch information
Supamiu committed Oct 17, 2018
1 parent af76415 commit 77fcd1b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/xivapi.service.ts
Expand Up @@ -3,6 +3,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
import { Observable } from 'rxjs';
import {
CharacterSearchResult,
Pagination,
PvpTeam,
XivapiCharacterOptions,
XivapiEndpoint,
Expand Down Expand Up @@ -109,6 +110,30 @@ export class XivapiService {
return this.request<CharacterSearchResult>(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.
*
Expand Down

0 comments on commit 77fcd1b

Please sign in to comment.