From 0b056dd3db080934dc32811464325661fa587503 Mon Sep 17 00:00:00 2001 From: PanayotCankov Date: Tue, 27 May 2014 12:54:11 +0300 Subject: [PATCH] Updated the API reference. --- BCL.csproj | 4 +-- camera/camera.d.ts | 45 +++++++++++++++++++++++++++++++--- http/http.d.ts | 37 +++++++++++++++++----------- image-source/image-source.d.ts | 7 ++++++ location/location.d.ts | 26 +++++++++++++------- 5 files changed, 90 insertions(+), 29 deletions(-) diff --git a/BCL.csproj b/BCL.csproj index 9659eb746..a6a600b72 100644 --- a/BCL.csproj +++ b/BCL.csproj @@ -335,9 +335,7 @@ - - - + diff --git a/camera/camera.d.ts b/camera/camera.d.ts index 9929ae801..d399f6a56 100644 --- a/camera/camera.d.ts +++ b/camera/camera.d.ts @@ -4,17 +4,41 @@ declare module "camera" { import promises = require("promises"); import imageSource = require("image-source"); + /** + * Specifies a camera position on a device. + */ enum CameraPosition { + /** + * The camera is located at the front of the device, facing the user. + */ FRONT = 0, + /** + * The camera is located at the back of the device. + */ BACK = 1, } + /** + * Specifies a camera flash mode. + */ enum FlashMode { - AUTO = 0, // default + /** + * Flash will be fired automatically when required. + */ + AUTO = 0, + /** + * The camera flash is enabled. + */ ON = 1, + /** + * The camera flash is disabled. + */ OFF = 2 } + /** + * Camera options for capture an image. + */ interface Options { /** * Specifies which Camera to use. @@ -28,12 +52,27 @@ declare module "camera" { } // TODO most of hardware related parts need to handle onPause and onResume of the calling activities + + /** + * This class provides access to the device camera and photo libraries. + */ class CameraManager { + /** + * Take a photo using the camera. + */ takePicture(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any); - // options { useSavedPhotos: true } + // TODO: Create an interface with the pictrue from library options: { useSavedPhotos: true } + + /** + * Requests an image from the user. + * The result may be a new photo taken or an existing image from the library. + */ pictureFromLibrary(params: any, onSuccess: (imageData: any) => any, onError?: (error: any) => any); } - var takePicture: (options?: Options) => promises.Promise; + /** + * Take a photo using the camera. + */ + function takePicture(options?: Options): promises.Promise; } diff --git a/http/http.d.ts b/http/http.d.ts index 025a064b9..7896172fa 100644 --- a/http/http.d.ts +++ b/http/http.d.ts @@ -44,6 +44,9 @@ */ function request(options: HttpRequestOptions): promises.Promise; + /** + * Provides options for the http requests. + */ interface HttpRequestOptions { /** * Gets or sets the request url. @@ -71,42 +74,48 @@ timeout?: number; } + /** + * Encapsulates HTTP-response information from an HTTP-request. + */ interface HttpResponse { /** - * Gets the response status code. - */ + * Gets the response status code. + */ statusCode: number; /** - * Gets the response headers. - */ + * Gets the response headers. + */ headers: any; /** - * Gets the response content. - */ + * Gets the response content. + */ content?: HttpContent; } + /** + * Encapsulates the content of an HttpResponse. + */ interface HttpContent { /** - * Gets the response body as raw data. - */ + * Gets the response body as raw data. + */ raw: any; /** - * Gets the response body as string. - */ + * Gets the response body as string. + */ toString: () => string; /** - * Gets the response body as JSON object. - */ + * Gets the response body as JSON object. + */ toJSON: () => any; /** - * Gets the response body as ImageSource. - */ + * Gets the response body as ImageSource. + */ toImage: () => image.ImageSource; } } \ No newline at end of file diff --git a/image-source/image-source.d.ts b/image-source/image-source.d.ts index f41e6db14..253ce21dd 100644 --- a/image-source/image-source.d.ts +++ b/image-source/image-source.d.ts @@ -6,7 +6,14 @@ declare module "image-source" { * Defines the recognized image formats. */ export enum ImageFormat { + /** + * The W3C Portable Network Graphics (PNG) image format. + */ PNG, + + /** + * The Joint Photographic Experts Group (JPEG) image format. + */ JPEG, } diff --git a/location/location.d.ts b/location/location.d.ts index ab4b6e200..701daae63 100644 --- a/location/location.d.ts +++ b/location/location.d.ts @@ -2,10 +2,19 @@ declare module "location" { import promises = require("promises"); + /** + * Specifies common accuracy values. + */ enum Accuracy { - // in meters - ANY, - HIGH, + /** + * The default accuracy. About 300 meters. + */ + ANY = 300, + + /** + * High accuracy. About 3 meters. + */ + HIGH = 3, } // For future usage @@ -71,6 +80,9 @@ declare module "location" { ios: CoreLocation.CLLocation; } + /** + * Provides options for location monitoring. + */ export interface Options { /** * Specifies desired accuracy in meters. Defaults to DesiredAccuracy.HIGH @@ -134,8 +146,6 @@ declare module "location" { */ isStarted: boolean; - // monitoring - /** * Starts location monitoring. * @param onLocation A function that will be called upon every location update received. @@ -145,14 +155,12 @@ declare module "location" { startLocationMonitoring(onLocation: (location: Location) => any, onError?: (error: Error) => any, options?: Options); /** - * Stops location monitoring + * Stops location monitoring. */ stopLocationMonitoring(); - // other - /** - * Returns last known location from device's location services or null of no known last location + * Returns last known location from device's location services or null of no known last location. */ lastKnownLocation: Location; }