From 481875fb37a394650b15d6a63221d846a86671c8 Mon Sep 17 00:00:00 2001 From: Rodney J Thomas Date: Thu, 7 Feb 2013 21:45:59 -0600 Subject: [PATCH] Add two Typings Added Google feed api and URI.js typings. --- google.feeds/google.feed.api.d.ts | 79 +++++++++++++ urijs/URI.d.ts | 183 ++++++++++++++++++++++++++++++ 2 files changed, 262 insertions(+) create mode 100644 google.feeds/google.feed.api.d.ts create mode 100644 urijs/URI.d.ts diff --git a/google.feeds/google.feed.api.d.ts b/google.feeds/google.feed.api.d.ts new file mode 100644 index 000000000..386329f40 --- /dev/null +++ b/google.feeds/google.feed.api.d.ts @@ -0,0 +1,79 @@ +//Project Google Feed Apis +// Project: https://developers.google.com/feed/ +// Definitions by: https://github.com/RodneyJT + +declare module google.feeds { + export class feed { + constructor(); + constructor(url: string); + findFeeds(query?: string, callback?: (result: findResult) => void ): void; + getElementsByTagNameNS(node: string, ns: string, localName: string): any[]; + includeHistoricalEntries(): void; + load(callback?: (result: feedResult) => void ): void; + setNumEntries(num: number): void; + setResultFormat(format: string): void; + } +} + +interface feedResult { + error?: feedError; + xmlDocument?: string; + feed: feedJSON; +} + +interface findResult { + error?: feedError; + xmlDocument?: string; + findEntries: findEntry[]; +} + +interface feedError { + code: string; + message: string; +} + +interface feedJSON { + feedURL: string; + link: string; + author: string; + description: string; + entries: feedEntry[]; +} + +interface feedEntry { + mediaGroup: MediaGroup[]; + title: string; + link: string; + content: string; + contentSnippet: string; + publishedDate: string; + categories: string[]; +} + +interface findEntry { + title: string; + link: string; + contentSnippet: string; + url: string; +} + +interface MediaGroup { + content: MediaContent[]; +} + +interface MediaContent { + url: string; + fileSize: number; + type: string; + medium: string; + isDefault: bool; + expression: string; + bitrate: number; + framerate: number; + samplingrate: number; + channels: string; + duration: number; + height: number; + width: number; + lang: string; +} diff --git a/urijs/URI.d.ts b/urijs/URI.d.ts new file mode 100644 index 000000000..f54257f9d --- /dev/null +++ b/urijs/URI.d.ts @@ -0,0 +1,183 @@ +// URI.js +// Project: https://github.com/medialize/URI.js +// Definitions by: https://github.com/RodneyJT +/// + +interface URIOptions { + protocol?: string; + username?: string; + password?: string; + hostname?: string; + port?: string; + path?: string; + query?: string; + fragment?: string; +} + +declare class URI { + constructor(); + constructor(options: URIOptions); + clone(): URI; + href(): string; + href(url: string): void; + valueOf(): string; + scheme(): string; + protocol(): string; + scheme(protocol: string): URI; + protocol(protocol: string): URI; + username(): string; + username(uname: string): URI; + password(): string; + password(pw: string): URI; + port(): string; + port(port: string): URI; + hostname(): string; + hostname(hostname: string): URI; + host(): string; + host(host: string): URI; + userinfo(): string; + userinfo(userinfo: string): URI; + authority(): string; + authority(authority: string): URI; + domain(): string; + domain(domain: bool): string; + domain(domain: string): URI; + subdomain(): string; + subdomain(subdomain: string): URI; + tld(): string; + tld(tld: bool): string; + tld(tld: string): URI; + path(): string; + path(path: bool): string; + path(path: string): URI; + pathname(): string; + pathname(path: bool): string; + pathname(path: string): URI; + directory(): string; + directory(dir: bool): string; + directory(dir: string): URI; + filename(): string; + filename(file: bool): string; + filename(file: string): URI; + suffix(): string; + suffix(suffix: bool): string; + suffix(suffix: string): URI; + segment(): string[]; + segment(segments: string[]): string; + segment(position: number): string; + segment(position: number, level: string): string; + segment(level: string): string; + search(): string; + search(qry: string): URI; + search(qry: bool): Object; + search(qry: Object): URI; + query(): string; + query(qry: string): URI; + query(qry: bool): Object; + query(qry: Object): URI; + hash(): string; + hash(hash: string): URI; + fragment(): string; + fragment(fragment: string): URI; + resource(): string; + resource(resource: string): URI; + is(qry: string): bool; + addSearch(qry: string): URI; + addSearch(qry: Object): URI; + addQuery(qry: string): URI; + addQuery(qry: Object): URI; + removeSearch(qry: string): URI; + removeSearch(qry: Object): URI; + removeQuery(qry: string): URI; + removeQuery(qry: Object): URI; + addFragment(fragment: string): URI; + //fragmentPrefix: string; + fragmentPrefix(prefix: string); + normalize(): URI; + normalizeProtocol(): URI; + normalizeHostname(): URI; + normalizePort(): URI; + normalizePathname(): URI; + normalizePath(): URI; + normalizeSearch(): URI; + normalizeQuery(): URI; + normalizeHash(): URI; + normalizeFragment(): URI; + iso8859(): URI; + unicode(): URI; + readable(): string; + relativeTo(path: string): URI; + absoluteTo(path: string): URI; + equals(): bool; + equals(url: string): bool; + static parse(url: string): { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }; + static parseAuthority(url: string, parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + static parseUserinfo(url: string, parts: { + username?: string; + password?: string; + }): string; + static parseHost(url: string, parts: { + hostname?: string; + port?: string; + }): string; + static parseQuery(url: string): Object; + static build(parts: { + protocol: string; + username: string; + password: string; + hostname: string; + port: string; + path: string; + query: string; + fragment: string; + }): string; + static buildAuthority(parts: { + username?: string; + password?: string; + hostname?: string; + port?: string; + }): string; + static buildUserinfo(parts: { + username?: string; + password?: string; + }): string; + static buildHost(parts: { + hostname?: string; + port?: string; + }): string; + static buildQuery(qry: Object): string; + static buildQuery(qry: Object, duplicates: bool): string; + static encode(str: string): string; + static decode(str: string): string; + static encodeReserved(str: string): string; + static encodeQuery(qry: string): string; + static decodeQuery(qry: string): string; + static addQuery(data: Object, prop: string, value: string): Object; + static addQuery(data: Object, qryObj: Object): Object; + static removeQuery(data: Object, prop: string, value: string): Object; + static removeQuery(data: Object, props: string[]): Object; + static removeQuery(data: Object, props: Object): Object; + static commonPath(path1: string, path2: string): string; + static withinString(source: string, func: (url: string) => string): string; + static iso8859(): void; + static unicode(): void; + static expand(template: string, vals: Object): URI; +} + +interface JQuery { + uri(): URI; +} \ No newline at end of file