Skip to content

Commit

Permalink
Add two Typings
Browse files Browse the repository at this point in the history
Added Google feed api and URI.js typings.
  • Loading branch information
RodneyJT committed Feb 8, 2013
1 parent b6872de commit 481875f
Show file tree
Hide file tree
Showing 2 changed files with 262 additions and 0 deletions.
79 changes: 79 additions & 0 deletions 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;
}
183 changes: 183 additions & 0 deletions urijs/URI.d.ts
@@ -0,0 +1,183 @@
// URI.js
// Project: https://github.com/medialize/URI.js
// Definitions by: https://github.com/RodneyJT
/// <reference path="../jquery/jquery.d.ts" />

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;
}

0 comments on commit 481875f

Please sign in to comment.