UNPKG

@xivapi/angular-client

Version:

xivapi client library (service and models) for angular applications

144 lines (143 loc) 7.09 kB
import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { CharacterSearchResult, Pagination, PvpTeam, XivapiCharacterOptions, XivapiEndpoint, XivapiList, XivapiOptions, XivapiRequestOptions, XivapiSearchOptions } from './model'; import { CharacterResponse, CharacterVerification } from './model/schema/character'; import { LoreSearchResult } from './model/lore-search-result'; import * as i0 from "@angular/core"; export declare class XivapiService { private http; private GCFUrl?; /** * Base url of xivapi. */ static readonly API_BASE_URL: string; static readonly STAGING_API_BASE_URL: string; constructor(http: HttpClient, GCFUrl?: string | undefined); /** * Makes a request on a given endpoint with an id. * * @param endpoint The endpoint to use for the request. * @param id The id of the resource for the request. * @param options The options of the request, optional. */ get<T = any>(endpoint: XivapiEndpoint, id: number, options?: XivapiRequestOptions): Observable<T>; /** * Makes a request on a given endpoint with an id. * * @param query Text to search inside the lore. * @param lang * @param allLanguages should it include Text_*? * @param dataColumns Additional data you want to fetch. * @param page data page to get * @param options Options of the request. */ searchLore(query: string, lang?: string, allLanguages?: boolean, dataColumns?: string[], page?: number, options?: XivapiOptions): Observable<LoreSearchResult>; /** * Makes a request to a given endpoint to list resources available. * * @param endpoint The endpoint to use for the request. * @param options The options of the request, optional. */ getList<T = any>(endpoint: XivapiEndpoint, options?: XivapiRequestOptions): Observable<XivapiList<T>>; /** * Searches for something in the api using the /Search endpoint. * * @param options Search options, see http://xivapi.com/docs/Search for more details. */ search(options: XivapiSearchOptions): Observable<any>; /** * Gets a character using the /Character endpoint. * * @param lodestoneId LodestoneID of the character to get. * @param options Options of the request. * @param details Specific details you want to get. */ getCharacter(lodestoneId: number | string, options?: XivapiCharacterOptions, details?: 'Friends' | 'Achievements' | 'Gearsets' | 'Record' | 'FreeCompany'): Observable<CharacterResponse>; /** * Gets character verification state using /character/<id>/verification endpoint * * @param lodestoneId LodestoneID of the character to verify. * @param options Options of the request. */ getCharacterVerification(lodestoneId: number | string, options?: XivapiCharacterOptions): Observable<CharacterVerification>; /** * Gets the current list of available servers. Useful for character search queries. */ getServerList(): Observable<string[]>; /** * Gets the current list of available servers, per DC. */ getDCList(): Observable<{ [index: string]: string[]; }>; /** * Search for a character on **The Lodestone**. This does not search XIVAPI but instead it goes directly to * lodestone so the response will be "real-time". Responses are cached for 1 hour, * it is important to know that Lodestone has a ~6 hour varnish and CDN cache. * * @param name The name of the character 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. */ searchCharacter(name: string, server?: string, page?: number): Observable<CharacterSearchResult>; /** * 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. */ searchFreeCompany(name: string, server?: string, page?: number): Observable<{ Results: any[]; Pagination: Pagination; }>; /** * Gets character verification informations based on lodestoneId. * * @param lodestoneId LodestoneID of the character to get. * @param options Options of the request. */ verifyCharacter(lodestoneId: number, options?: XivapiCharacterOptions): Observable<CharacterVerification>; /** * Gets a free company using the /FreeCompany endpoint. * * @param lodestoneId LodestoneID of the free company to get. * @param options Options of the request. * @param details Specific details you want to get. */ getFreeCompany(lodestoneId: number | string, options?: XivapiOptions, details?: 'members' | 'record'): Observable<any>; /** * Gets a linkshell using the /Linkshell endpoint. * * @param lodestoneId LodestoneID of the linkshell to get. * @param options Options of the request. * @param details Specific details you want to get. */ getLinkshell(lodestoneId: number | string, options?: XivapiOptions, details?: 'record'): Observable<any>; /** * Gets a PvP team based on its lodestone id (string) * * @param id the id of the team to get. * @param options Options of the request */ getPvPTeam(id: string, options?: XivapiOptions): Observable<PvpTeam>; /** * Gets the list of patches using the /PatchList endpoint. * @param options Options of the request. */ getPatchList(options?: XivapiOptions): Observable<any>; protected request<T>(endpoint: string, params?: XivapiOptions): Observable<T>; private prepareQueryString; private doGet; static ɵfac: i0.ɵɵFactoryDeclaration<XivapiService, never>; static ɵprov: i0.ɵɵInjectableDeclaration<XivapiService>; }