diff --git a/blazy/blazy-tests.ts b/blazy/blazy-tests.ts new file mode 100644 index 000000000..6e95801e9 --- /dev/null +++ b/blazy/blazy-tests.ts @@ -0,0 +1,44 @@ +/// + +/* Constructor test */ +var tester: BlazyInstance = new Blazy({ + breakpoints: [ + { + width: 420, + src: 'data-src-small' + }, + { + width: 768, + src: 'data-src-medium' + } + ], + container: '#scrolling-container', + error: function(ele: HTMLElement, msg: string) { + if (msg === 'missing') { + console.log('missing'); + } + else if (msg === 'invalid') { + console.log('invalid'); + } + }, + errorClass: 'b-error', + loadInvisible: false, + offset: 100, + saveViewportOffsetDelay: 50, + selector: '.b-lazy', + separator: '|', + src: 'data-src', + success: function(ele: HTMLElement) { + console.log('success'); + }, + successClass: 'b-loaded', + validateDelay: 25 +}); + +/* Functions tests */ +tester.revalidate(); + +var elements = document.getElementsByTagName('img'); +tester.load(elements, true); + +tester.destroy(); diff --git a/blazy/blazy.d.ts b/blazy/blazy.d.ts new file mode 100644 index 000000000..cb4747d6f --- /dev/null +++ b/blazy/blazy.d.ts @@ -0,0 +1,72 @@ +// Type definitions for bLazy v1.5.2 +// Project: https://github.com/dinbror/blazy +// Definitions by: Julien Paroche +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/blazy +// Definitions based on: http://dinbror.dk/blog/blazy + +declare var Blazy: Blazy; + +interface Blazy { + + new (options: BlazyOptions): BlazyInstance; + +} + +interface BlazyOptions { + + breakpoints: Breakpoint[]; + + container: string; + + error: (ele: Element|HTMLElement, msg: string) => void; + + errorClass: string; + + loadInvisible: boolean; + + offset: number; + + saveViewportOffsetDelay: number; + + selector: string; + + separator: string; + + src: string; + + success: (ele: Element|HTMLElement) => void; + + successClass: string; + + validateDelay: number; + +} + +interface BlazyInstance { + + /** + * Revalidates document for visible images. Useful if you add images with scripting or ajax. + */ + revalidate(): void; + + /** + * Forces the given element(s) to load if not collapsed. If you also want to load a collapsed/hidden elements you can add true as the second parameter. + * You can pass a single element or a list of elements. Tested with getElementById, getElementsByClassName, querySelectorAll, querySelector and jQuery selector. + */ + load(elements: Element|Element[]|HTMLElement|HTMLElement[]|NodeList, force: boolean): void; + + /** + * Unbind events and resets image array. + */ + destroy(): void; + +} + +interface Breakpoint { + width: number; + src: string; +} + +declare module 'Blazy' { + export = Blazy; +} diff --git a/firebase-token-generator/firebase-token-generator-test.ts.tscparams.ts b/firebase-token-generator/firebase-token-generator-test.ts.tscparams.ts new file mode 100644 index 000000000..155c6fe9e --- /dev/null +++ b/firebase-token-generator/firebase-token-generator-test.ts.tscparams.ts @@ -0,0 +1 @@ +--module commonjs \ No newline at end of file diff --git a/firebase-token-generator/firebase-token-generator-tests.ts b/firebase-token-generator/firebase-token-generator-tests.ts new file mode 100644 index 000000000..7dc25b6a0 --- /dev/null +++ b/firebase-token-generator/firebase-token-generator-tests.ts @@ -0,0 +1,15 @@ +/// +import FirebaseTokenGenerator = require('firebase-token-generator'); + +const tokenGenerator: FirebaseTokenGenerator = new FirebaseTokenGenerator("MY_SECRET"); + +let token: string = tokenGenerator.createToken({blah: 5, uid: "blah"}); +log("Token should not be empty string", (token !== "")); +log("Token should consist of three parts", (token.split(".").length === 3)); + +token = tokenGenerator.createToken({blah: 5}, {expires : 1234, notBefore : 133234, admin : true, debug : false}); +log("Token should take valid options", (token !== "")); + +function log(description: string, statement: boolean) : void { + console.log((statement? "SUCCESS" : "FAIL") + " " + description); +} diff --git a/firebase-token-generator/firebase-token-generator.d.ts b/firebase-token-generator/firebase-token-generator.d.ts new file mode 100644 index 000000000..ed2362555 --- /dev/null +++ b/firebase-token-generator/firebase-token-generator.d.ts @@ -0,0 +1,47 @@ +// Type definitions for firebase-token-generator v2.0.0 +// Project: https://github.com/firebase/firebase-token-generator-node +// Definitions by: Hans Van den Keybus +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +interface TokenOptions { + expires?: number; + notBefore?: number; + admin?: boolean; + debug?: boolean; + simulate?: boolean; + iat?: number; +} + +declare class FirebaseTokenGenerator { + + /** + * Builds a new object that can generate Firebase authentication tokens. + * @constructor + * @param { String } secret The secret for the Firebase being used (get yours from the Firebase Admin Console). + */ + constructor(secret: string); + + /** + * Creates a token that authenticates a client with arbitrary data "data", and the specified options. + * + * @param { any } data JSON data that will be passed to the Firebase Rules API once a client authenticates. Unless the + * "admin" flag is set, it must contain a "uid" key, and if it does it must be a string of length + * 256 or less. + * @param { TokenOptions } options The developer-supplied options for this token. Supported options are: + * a) "expires" -- A timestamp (as a number of seconds since the epoch) denoting a time after which + * this token should no longer be valid. + * b) "notBefore" -- A timestamp (as a number of seconds since the epoch) denoting a time before + * which this token should be rejected by the server. + * c) "admin" -- Set to true to bypass all security rules (use this for your trusted servers). + * d) "debug" -- Set to true to enable debug mode (so you can see the results of Rules API operations) + * e) "simulate" -- (internal-only for now) Set to true to neuter all API operations (listens / puts + * will run security rules but not actually write or return data) + * f) "iat" -- (Number) (internal-only, for testing) Set the issued at time for the generated token + * @return {String} The authentication token + */ + createToken(data: any, options?: TokenOptions): string; +} + +declare module 'firebase-token-generator' { + export = FirebaseTokenGenerator; +} diff --git a/moment/moment-node.d.ts b/moment/moment-node.d.ts index 6c1810837..1382a1206 100644 --- a/moment/moment-node.d.ts +++ b/moment/moment-node.d.ts @@ -125,11 +125,11 @@ declare module moment { } interface MomentCreationData { - input?: string, - format?: string, - locale: MomentLocale, - isUTC: boolean, - strict?: boolean + input?: string; + format?: string; + locale: MomentLocale; + isUTC: boolean; + strict?: boolean; } interface Moment { diff --git a/pikaday/pikaday-tests.ts b/pikaday/pikaday-tests.ts index 28d0c33c2..78a3b378f 100644 --- a/pikaday/pikaday-tests.ts +++ b/pikaday/pikaday-tests.ts @@ -2,6 +2,8 @@ /// /// +import * as Pikaday from "pikaday"; + new Pikaday({field: document.getElementById('datepicker')}); new Pikaday({field: $('#datepicker')[0]}); @@ -46,7 +48,7 @@ new Pikaday({field: $('#datepicker')[0]}); })(); (() => { - var i18n:PikadayI18nConfig = { + var i18n: Pikaday.PikadayI18nConfig = { previousMonth: 'Previous Month', nextMonth: 'Next Month', months: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], diff --git a/pikaday/pikaday.d.ts b/pikaday/pikaday.d.ts index 21a112b8e..a0f1ab58b 100644 --- a/pikaday/pikaday.d.ts +++ b/pikaday/pikaday.d.ts @@ -5,48 +5,10 @@ /// -interface PikadayI18nConfig { - previousMonth: string; - nextMonth: string; - months: string[]; - weekdays: string[]; - weekdaysShort: string[]; -} - -interface PikadayOptions { - field?: HTMLElement; - format?: string; - trigger?: HTMLElement; - bound?: boolean; - position?: string; - reposition?: boolean; - container?: HTMLElement; - defaultDate?: Date; - setDefaultDate?: boolean; - firstDay?: number; - minDate?: Date; - maxDate?: Date; - disableWeekends?: boolean; - disableDayFn?: (date:Date) => boolean; - yearRange?: number[]; - showWeekNumber?: boolean; - isRTL?: boolean; - i18n?: PikadayI18nConfig; - yearSuffix?: string; - showMonthAfterYear?: boolean; - numberOfMonths?: number; - mainCalendar?: string; - theme?: string; - onSelect?: (date:Date) => void; - onOpen?: () => void; - onClose?: () => void; - onDraw?: () => void; -} - declare class Pikaday { el:HTMLElement; - constructor(options:PikadayOptions); + constructor(options: Pikaday.PikadayOptions); toString():string; toString(format:string):string; @@ -87,3 +49,48 @@ declare class Pikaday { destroy():void; } + +// merge the Pikaday class declaration with a module +declare module Pikaday { + interface PikadayI18nConfig { + previousMonth: string; + nextMonth: string; + months: string[]; + weekdays: string[]; + weekdaysShort: string[]; + } + + interface PikadayOptions { + field?: HTMLElement; + format?: string; + trigger?: HTMLElement; + bound?: boolean; + position?: string; + reposition?: boolean; + container?: HTMLElement; + defaultDate?: Date; + setDefaultDate?: boolean; + firstDay?: number; + minDate?: Date; + maxDate?: Date; + disableWeekends?: boolean; + disableDayFn?: (date:Date) => boolean; + yearRange?: number[]; + showWeekNumber?: boolean; + isRTL?: boolean; + i18n?: PikadayI18nConfig; + yearSuffix?: string; + showMonthAfterYear?: boolean; + numberOfMonths?: number; + mainCalendar?: string; + theme?: string; + onSelect?: (date:Date) => void; + onOpen?: () => void; + onClose?: () => void; + onDraw?: () => void; + } +} + +declare module "pikaday" { + export = Pikaday; +} diff --git a/request/request-tests.ts b/request/request-tests.ts index 1f638d864..30ca3226d 100644 --- a/request/request-tests.ts +++ b/request/request-tests.ts @@ -640,3 +640,15 @@ request({url: 'http://www.google.com', jar: j}, function () { var cookies = j.getCookies(url); // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...] }); + +request( + { method: 'GET' + , uri: 'http://www.google.com' + , gzip: true + } + ) + .on('request', function(req: http.ClientRequest) { }) + .on('response', function(resp: http.IncomingMessage) { }) + .on('data', function(data: Buffer | string) { }) + .on('error', function(e: Error) { }) + .on('complete', function(resp: http.IncomingMessage, body?: string | Buffer) { }); \ No newline at end of file diff --git a/request/request.d.ts b/request/request.d.ts index 4d51fd14b..f47a9ddaa 100644 --- a/request/request.d.ts +++ b/request/request.d.ts @@ -1,6 +1,6 @@ // Type definitions for request // Project: https://github.com/mikeal/request -// Definitions by: Carlos Ballesteros Velasco , bonnici , Bart van der Schoor , Joe Skeen +// Definitions by: Carlos Ballesteros Velasco , bonnici , Bart van der Schoor , Joe Skeen , Christopher Currens // Definitions: https://github.com/borisyankov/DefinitelyTyped // Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts @@ -180,6 +180,11 @@ declare module 'request' { jar(jar: CookieJar): Request; on(event: string, listener: Function): Request; + on(event: 'request', listener: (req: http.ClientRequest) => void): Request; + on(event: 'response', listener: (resp: http.IncomingMessage) => void): Request; + on(event: 'data', listener: (data: Buffer | string) => void): Request; + on(event: 'error', listener: (e: Error) => void): Request; + on(event: 'complete', listener: (resp: http.IncomingMessage, body?: string | Buffer) => void): Request; write(buffer: Buffer, cb?: Function): boolean; write(str: string, cb?: Function): boolean; diff --git a/riot-api-nodejs/riot-api-nodejs-tests.ts b/riot-api-nodejs/riot-api-nodejs-tests.ts new file mode 100644 index 000000000..a531f52ee --- /dev/null +++ b/riot-api-nodejs/riot-api-nodejs-tests.ts @@ -0,0 +1,6 @@ +/// + +import * as Api from "riot-api-nodejs"; + +let ClassicApi = new Api.ClassicAPI([""], Api.region_e.EUW); +let TournamentApi = new Api.TournamentAPI(""); diff --git a/riot-api-nodejs/riot-api-nodejs.d.ts b/riot-api-nodejs/riot-api-nodejs.d.ts new file mode 100644 index 000000000..40e4fba13 --- /dev/null +++ b/riot-api-nodejs/riot-api-nodejs.d.ts @@ -0,0 +1,413 @@ +// Type definitions for Riot Games API +// Project: https://developer.riotgames.com/ +// Definitions by: Luca Laissue +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// +/// + +declare module "riot-api-nodejs"{ + + export enum region_e { + BR = 0, + EUNE = 1, + EUW = 2, + KR = 3, + LAN = 4, + LAS = 5, + NA = 6, + OCE = 7, + TR = 8, + RU = 9, + PBE = 10, + } + /** + * Tournament API + */ + export class TournamentAPI { + private ApiKeys; + private ApiKey; + /** + * TournamentAPI Constructor + */ + constructor(...ApiKeys: string[]); + /** + * Change the Api Key for the next requests + */ + private switchApiKey(); + /** + * Send a request to the Riot Games Api and return a formatted json via a callback + * @param {string} url request url + * @param {string} method method(post / put / get) + * @param {[type]} data body parameters + * @param {(JSON} callback callback function with formatted JSON + */ + private getJSON(url, method, data, callback); + /** + * get tournament Codes for a given tournament + * @param {number} tournamentId the ID of the tournament + * @param {number} count Number of codes you want + * @param {RiotGamesAPI.TournamentProvider.TournamentCodeParameters} params Tournament Code parameters + * @param {number[]} callback Tournaments Codes [description] + */ + getTournamentCodes(tournamentId: number, count: number, params: RiotGamesAPI.TournamentProvider.TournamentCodeParameters, callback: (tournamentCodes: number[]) => void): any; + /** + * get tournament infos for a given tournament code + * @param {string} tournamentCode Tournament Code + * @param {RiotGamesAPI.TournamentProvider.TournamentCodeDto} callback Tournament Infos + */ + getTournamentByCode(tournamentCode: string, callback: (tournament: RiotGamesAPI.TournamentProvider.TournamentCodeDto) => void): any; + /** + * edit the tournament Code parameters for a given tournament Code + * @param {string} tournamentCode Tournament Code to update + * @param {RiotGamesAPI.TournamentProvider.TournamentCodeUpdateParameters} params parameters to edit + * @param {(} callback callback if succes + */ + editTournamentByCode(tournamentCode: string, params: RiotGamesAPI.TournamentProvider.TournamentCodeUpdateParameters, callback: () => void): any; + /** + * get the lobby envents for a given tournament Code + * @param {string} tournamentCode the tournament code to get the lobby events + * @param {RiotGamesAPI.TournamentProvider.LobbyEventDto} callback lobby events + */ + getLobbyEventByCode(tournamentCode: string, callback: (lobbyEventDto: RiotGamesAPI.TournamentProvider.LobbyEventDto) => void): any; + /** + * Register a new tournament provider + * @param {region_e} region region where you want to register the provider + * @param {string} url url of callback for the POST notifications + * @param {number} callback returns the tounament provider ID + */ + registerProvider(region: region_e, url: string, callback: (providerId: number) => void): any; + /** + * Register a new tournament + * @param {string} name Name of tournament + * @param {number} providerId Provider ID + * @param {number} callback returns the tournament ID + */ + registerTournament(name: string, providerId: number, callback: (tournamentId: number) => void): any; + } + export class ClassicAPI { + private ApiKeys; + private ApiKey; + private region; + /** + * ClassicAPI Constructor + * @param {string[]} ApiKeys API Keys for the requests + * @param {region_e} region region where you want to send requests + */ + constructor(ApiKeys: string[], region: region_e); + /** + * change the API Key for the next requests + */ + private switchApiKey(); + /** + * get the JSON response code for a given URL + * @param {string} url Request url + * @param {Function} callback JSON formatted data + */ + private getJSON(url, callback); + /** + * Edit the consts for a valid url for the riot games api + * @param {string} unparsedURL the URL to parse + * @return {string} the Parsed URL + */ + private parseURL(unparsedURL); + /** + * get the API Key that is used for the requests + * @return {string} the current API Key + */ + getCurrentApiKey(): string; + /** + * get the region where send send request + * @return {region_e} the current region + */ + getRegion(): region_e; + /** + * set the API Keys + * @param {string[]} ApiKeys the API Keys + */ + setApikeys(ApiKeys: string[]): void; + /** + * set the region where you want to send requests + * @param {region_e} region the region + */ + setRegion(region: region_e): void; + /** + * get all champions of league of legends + * @param {RiotGamesAPI.Champion.ChampionListDto} callback data callback + */ + getChampions(callback: (championListDto: RiotGamesAPI.Champion.ChampionListDto) => void): any; + /** + * get the champion for a given id + * @param {number} id the champion id + * @param {RiotGamesAPI.Champion.ChampionDto} callback data callback + */ + getChampionById(id: number, callback: (ChampionDto: RiotGamesAPI.Champion.ChampionDto) => void): any; + /** + * get the free to play champions + * @param {RiotGamesAPI.Champion.ChampionListDto} callback data callback + */ + getFreeToPlayChampions(callback: (championsListDto: RiotGamesAPI.Champion.ChampionListDto) => void): any; + /** + * get Champion mastery of a player for a given champion ID + * @param {number} summonerId summoner ID + * @param {number} championId Champion ID + * @param {RiotGamesAPI.ChampionMastery.ChampionMasteryDto} callback data callback + */ + getChampionMastery(summonerId: number, championId: number, callback: (championMastery: RiotGamesAPI.ChampionMastery.ChampionMasteryDto) => void): any; + /** + * get all champion masteries for a given summoner + * @param {number} summonerId Summoner ID + * @param {[RiotGamesAPI.ChampionMastery.ChampionMasteryDto]} callback data callback + */ + getChampionMasteryBySummoner(summonerId: number, callback: (championsMastery: [RiotGamesAPI.ChampionMastery.ChampionMasteryDto]) => void): any; + /** + * get the mastery score of a summoner + * @param {number} summonerId Summoner ID + * @param {number} callback Mastery Score + */ + getChampionMasteryScore(summonerId: number, callback: (score: number) => void): any; + /** + * get The 3 best champion masteries + * @param {[type]} summonerId Summoner ID + * @param {[RiotGamesAPI.ChampionMastery.ChampionMasteryDto]} callback data callback + */ + getTopChampionMastery(summonerId: any, callback: (championsMastery: [RiotGamesAPI.ChampionMastery.ChampionMasteryDto]) => void): any; + /** + * get the current game infos for a given summoner ID + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.CurrentGame.CurrentGameInfo} callback data callback + */ + getCurrentGame(summonerId: number, callback: (gameInfoDto: RiotGamesAPI.CurrentGame.CurrentGameInfo) => void): any; + /** + * get the featured games + * @param {RiotGamesAPI.FeaturedGames.FeaturedGames} callback data callback + */ + getFeaturedGame(callback: (featuredGamesInfos: RiotGamesAPI.FeaturedGames.FeaturedGames) => void): any; + /** + * get the recents games for a given Summoner ID + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Game.RecentGamesDto} callback data callback + */ + getRecentGames(summonerId: number, callback: (RecentGamesDto: RiotGamesAPI.Game.RecentGamesDto) => void): any; + /** + * Get League infos of a summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.League.LeagueDto[]} callback data callback + */ + getLeagueBySummonerId(summonerId: number, callback: (LeagueDto: RiotGamesAPI.League.LeagueDto[]) => void): any; + /** + * get League infos of a summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.League.LeagueDto[]} callback data callback + */ + getLeagueBySummonerIdEntry(summonerId: number, callback: (LeagueDto: RiotGamesAPI.League.LeagueDto[]) => void): any; + /** + * get league infos by team + * @param {string} teamId Team ID + * @param {RiotGamesAPI.League.LeagueDto[]} callback data callback + */ + getLeagueByTeamId(teamId: string, callback: (LeagueDto: RiotGamesAPI.League.LeagueDto[]) => void): any; + /** + * get league infos by team + * @param {string} teamId Team ID + * @param {RiotGamesAPI.League.LeagueDto[]} callback data callback + */ + getLeagueByTeamIdEntry(teamId: string, callback: (LeagueDto: RiotGamesAPI.League.LeagueDto[]) => void): any; + /** + * get Challengers in SOLO Queue + * @param {RiotGamesAPI.League.LeagueDto} callback data callback + */ + getChallengers_SOLO(callback: (League: RiotGamesAPI.League.LeagueDto) => void): any; + /** + * get Challengers Teams in 3x3 + * @param {RiotGamesAPI.League.LeagueDto} callback data callback + */ + getChallengers_3x3(callback: (League: RiotGamesAPI.League.LeagueDto) => void): any; + /** + * get Challengers Teams in 5x5 + * @param {RiotGamesAPI.League.LeagueDto} callback data callback + */ + getChallengers_5x5(callback: (League: RiotGamesAPI.League.LeagueDto) => void): any; + /** + * get Masters in Solo Queue + * @param {RiotGamesAPI.League.LeagueDto} callback data callback + */ + getMasters_SOLO(callback: (League: RiotGamesAPI.League.LeagueDto) => void): any; + /** + * get Master Teams in 3x3 + * @param {RiotGamesAPI.League.LeagueDto} callback data callback + */ + getMasters_3x3(callback: (League: RiotGamesAPI.League.LeagueDto) => void): any; + /** + * get Master Teams in 5x5 + * @param {RiotGamesAPI.League.LeagueDto} callback data callback + */ + getMasters_5x5(callback: (League: RiotGamesAPI.League.LeagueDto) => void): any; + /** + * get Champions (static data) + * @param {RiotGamesAPI.LolStaticData.ChampionListDto} callback data callback + */ + staticDataChampions(callback: (championListDto: RiotGamesAPI.LolStaticData.ChampionListDto) => void): any; + /** + * get data by champion ID + * @param {number} championsId Champion ID + * @param {RiotGamesAPI.LolStaticData.ChampionDto} callback data callback + */ + staticDataChampionById(championsId: number, callback: (championDto: RiotGamesAPI.LolStaticData.ChampionDto) => void): any; + /** + * get League of Legends Items + * @param {RiotGamesAPI.LolStaticData.ItemListDto} callback data callback + */ + staticDataItems(callback: (itemsDto: RiotGamesAPI.LolStaticData.ItemListDto) => void): any; + /** + * Get item infos by ID + * @param {number} itemId item ID + * @param {RiotGamesAPI.LolStaticData.ItemDto} callback data callback + */ + staticDataItemById(itemId: number, callback: (itemDto: RiotGamesAPI.LolStaticData.ItemDto) => void): any; + /** + * get league of legends languages + * @param {RiotGamesAPI.LolStaticData.LanguageStringsDto} callback data callback + */ + staticDataLanguagesStrings(callback: (languageStringsDto: RiotGamesAPI.LolStaticData.LanguageStringsDto) => void): any; + /** + * get league of legends languages + * @param {string[]} callback data callback + */ + staticDataLanguages(callback: (languages: string[]) => void): any; + /** + * get Map data + * @param {RiotGamesAPI.LolStaticData.MapDataDto} callback data callback + */ + staticDataMap(callback: (mapDataDto: RiotGamesAPI.LolStaticData.MapDataDto) => void): any; + /** + * get all masteries + * @param {RiotGamesAPI.LolStaticData.MasteryListDto} callback data callback + */ + staticDataMastery(callback: (masteryListDto: RiotGamesAPI.LolStaticData.MasteryListDto) => void): any; + /** + * get data by mastery ID + * @param {number} masteryId Mastery ID + * @param {RiotGamesAPI.LolStaticData.MasteryDto} callback data callback + */ + staticDataMasteryById(masteryId: number, callback: (masteryDto: RiotGamesAPI.LolStaticData.MasteryDto) => void): any; + staticDataRealm(callback: (realmDto: RiotGamesAPI.LolStaticData.RealmDto) => void): any; + /** + * get all runes + * @param {RiotGamesAPI.LolStaticData.RuneListDto} callback data callback + */ + staticDataRunes(callback: (runeListDto: RiotGamesAPI.LolStaticData.RuneListDto) => void): any; + /** + * get rune by Rune ID + * @param {number} runeId Rune ID + * @param {RiotGamesAPI.LolStaticData.RuneDto} callback data callback + */ + staticDataRuneById(runeId: number, callback: (runeDto: RiotGamesAPI.LolStaticData.RuneDto) => void): any; + /** + * get all summoner spells + * @param {RiotGamesAPI.LolStaticData.SummonerSpellListDto} callback data callback + */ + staticDataSummonerSpells(callback: (summonerSpellListDto: RiotGamesAPI.LolStaticData.SummonerSpellListDto) => void): any; + /** + * get summoner spell by summoner spell ID + * @param {number} summonerSpellId Summoner spell ID + * @param {RiotGamesAPI.LolStaticData.SummonerSpellDto} callback data callback + */ + staticDataSummonSpellById(summonerSpellId: number, callback: (runeDto: RiotGamesAPI.LolStaticData.SummonerSpellDto) => void): any; + /** + * get league of legends versions + * @param {string[]} callback data callback + */ + staticDataVersion(callback: (versions: string[]) => void): any; + /** + * get league of legends status + * @param {RiotGamesAPI.LolStatus.Shard[]} callback data callback + */ + getSatus(callback: (shardList: RiotGamesAPI.LolStatus.Shard[]) => void): any; + /** + * get status for a given region + * @param {region_e} region region + * @param {RiotGamesAPI.LolStatus.Shard} callback data callback + */ + getSatusByRegion(region: region_e, callback: (shard: RiotGamesAPI.LolStatus.Shard) => void): any; + /** + * get match infos for a given match ID + * @param {number} matchId Match ID + * @param {RiotGamesAPI.Match.MatchDetail} callback data callback + */ + getMatch(matchId: number, callback: (matchDetails: RiotGamesAPI.Match.MatchDetail) => void): any; + /** + * get all matches for a given tournament code + * @param {string} tournamentCode Tournament Code + * @param {number[]} callback data callback + */ + getMatchIdsByTournamentCode(tournamentCode: string, callback: (matchIds: number[]) => void): any; + /** + * get match by ID in a tournament + * @param {number} matchId Match ID + * @param {RiotGamesAPI.Match.MatchDetail} callback data callback + */ + getMatchForTournament(matchId: number, callback: (matchDetails: RiotGamesAPI.Match.MatchDetail) => void): any; + /** + * get match list of a summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.MatchList.MatchList} callback data callback + */ + getMatchList(summonerId: number, callback: (matchList: RiotGamesAPI.MatchList.MatchList) => void): any; + /** + * get ranked stats of summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Stats.RankedStatsDto} callback data callback + */ + getStatsRanked(summonerId: number, callback: (rankedStatsDto: RiotGamesAPI.Stats.RankedStatsDto) => void): any; + /** + * get summary ranked stats of summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Stats.PlayerStatsSummaryListDto} callback data callback + */ + getStatsSummary(summonerId: number, callback: (playerStatsSummaryListDto: RiotGamesAPI.Stats.PlayerStatsSummaryListDto) => void): any; + /** + * get summoner infos by Summoner Name + * @param {string} summonerName Summoner Name + * @param {RiotGamesAPI.Summoner.SummonerDto} callback data callback + */ + getSummonerByName(summonerName: string, callback: (summonerDto: RiotGamesAPI.Summoner.SummonerDto) => void): any; + /** + * get summoner infos by summoner ID + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Summoner.SummonerDto} callback data callback + */ + getSummonerById(summonerId: number, callback: (summonerDto: RiotGamesAPI.Summoner.SummonerDto) => void): any; + /** + * get masteries of a summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Summoner.MasteryPagesDto} callback data callback + */ + getSummonerMasteries(summonerId: number, callback: (masteryPagesDto: RiotGamesAPI.Summoner.MasteryPagesDto) => void): any; + /** + * get the Summoner Name of a summoner ID + * @param {number} summonerId Summoner ID + * @param {string} callback data callback + */ + getSummonerName(summonerId: number, callback: (summonerName: string) => void): any; + /** + * get the runes of a summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Summoner.RunePagesDto} callback data callback + */ + getSummonerRunes(summonerId: number, callback: (runePagesDto: RiotGamesAPI.Summoner.RunePagesDto) => void): any; + /** + * get teams of a summoner + * @param {number} summonerId Summoner ID + * @param {RiotGamesAPI.Team.TeamDto[]} callback data callback + */ + getTeamsBySummoner(summonerId: number, callback: (teamsList: RiotGamesAPI.Team.TeamDto[]) => void): any; + /** + * get Team infos by Team ID + * @param {string} teamId Team ID + * @param {RiotGamesAPI.Team.TeamDto} callback data callback + */ + getTeamById(teamId: string, callback: (teamDto: RiotGamesAPI.Team.TeamDto) => void): any; + } +} diff --git a/xml2js/xml2js-tests.ts b/xml2js/xml2js-tests.ts index 45472c0aa..d0ed5e5b9 100644 --- a/xml2js/xml2js-tests.ts +++ b/xml2js/xml2js-tests.ts @@ -17,3 +17,10 @@ var outString = builder.buildObject({ }); var parser = new xml2js.Parser(); + +var v1Defaults = xml2js.defaults['0.1']; +v1Defaults.async = true; + +var v2Defaults = xml2js.defaults['0.2']; +v2Defaults.async = false; +v2Defaults.chunkSize = 20000; \ No newline at end of file diff --git a/xml2js/xml2js.d.ts b/xml2js/xml2js.d.ts index 0dc03add7..8e20ece75 100644 --- a/xml2js/xml2js.d.ts +++ b/xml2js/xml2js.d.ts @@ -1,6 +1,6 @@ // Type definitions for node-xml2js // Project: https://github.com/Leonidas-from-XIV/node-xml2js -// Definitions by: Michel Salib , Jason McNeil +// Definitions by: Michel Salib , Jason McNeil , Christopher Currens // Definitions: https://github.com/borisyankov/DefinitelyTyped declare module 'xml2js' { @@ -11,6 +11,11 @@ declare module 'xml2js' { function parseString(xml: string, callback: (err: any, result: any) => void): void; function parseString(xml: string, options: Options, callback: (err: any, result: any) => void): void; + var defaults: { + '0.1': Options; + '0.2': OptionsV2; + } + class Builder { constructor(options?: BuilderOptions); buildObject(rootObj: any): string; @@ -50,7 +55,8 @@ declare module 'xml2js' { interface Options { async?: boolean; attrkey?: string; - attrNameProcessors?: (name: string) => string; + attrNameProcessors?: [(name: string) => string]; + attrValueProcessors?: [(name: string) => string]; charkey?: string; charsAsChildren?: boolean; childkey?: string; @@ -67,7 +73,27 @@ declare module 'xml2js' { tagNameProcessors?: [(name: string) => string]; trim?: boolean; validator?: Function; + valueProcessors?: [(name: string) => string]; xmlns?: boolean; } + + interface OptionsV2 extends Options { + preserveChildrenOrder?: boolean; + rootName?: string; + xmldec?: { + version: string; + encoding?: string; + standalone?: boolean; + }; + doctype?: any; + renderOpts?: { + pretty?: boolean; + indent?: string; + newline?: string; + }; + headless?: boolean; + chunkSize?: number; + cdata?: boolean; + } } }