Keywords

These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

This appendix reproduces material found on the TouchDevelop website at https://www.touchdevelop.com/docs/api . This appendix provides descriptions of the datatypes implemented in TouchDevelop. Appendix B covers services (also called resources).

C.1 Appointment

A value of this type describes one calendar appointment.

attendees : Contact Collection

Gets the list of attendees. Each contact contains a name and email address.

details : String

Gets the details

end time : DateTime

Gets the end time

is all day event : Boolean

Indicates if this is an all day event

is invalid : Boolean

Returns true if the current instance is useless

is private : Boolean

Indicates if this appointment is private

location : String

Gets the location

organizer : Contact

Gets the organizer

post to wall

Posts the appointment to the wall

source : String

Gets the source of this appointment (Facebook, etc…)

start time : DateTime

Gets the location

status : String

Gets your status (free, tentative, busy, outofoffice)

subject : String

Gets the subject

C.2 Appointment Collection

A value of this type represents a collection of appointments.

at(index : Number) : Appointment

Gets the appointment at index

count : Number

Gets the number of appointments

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the appointments on the wall

C.3 Board

An instance of the Board is a 2D image containing sprites and other graphic objects displayed by a games program.

at(i : Number) : Sprite

Gets the sprite indexed by i

clear background camera

Clears the background camera

clear background picture

Clear the background picture

clear events

Clear all queued events related to this board

count : Number

Gets the sprite count

create anchor(width : Number, height : Number) : Sprite

Create an anchor sprite

create boundary(distance : Number)

Create walls around the board at the given distance

create ellipse(width : Number, height : Number) : Sprite

Create a new ellipse sprite

create obstacle(x : Number, y : Number, x segment : Number, y segment : Number, elasticity : Number)

Create a line obstacle with given start point, and given extent. Elasticity is 0 for sticky, 1 for complete bounce.

create picture(picture : Picture) : Sprite

Create a new picture sprite.

create rectangle(width : Number, height : Number) : Sprite

Create a new rectangle sprite

create spring(sprite1 : Sprite, sprite2 : Sprite, stiffness : Number)

Create a spring between the two sprites

create sprite set : Sprite Set

Create a new collection for sprites

create text(width : Number, height : Number, fontSize : Number, text : String) : Sprite

Create a new text sprite.

evolve

Update positions of sprites on board.

height : Number

Gets the height in pixels

is invalid : Boolean

Returns true if the current instance is useless

is landscape : Boolean

Gets a value indicating if the board is designed to be viewed in landscape mode

post to wall

Shows the board on the wall.

set background(color : Color)

Sets the background color

set background camera(camera : Camera)

Sets the background camera

set background picture(picture : Picture)

Sets the background picture

set debug mode(debug : Boolean)

In debug mode, board displays speed and other info of sprites

set friction(friction : Number)

Sets the default friction for sprites to a fraction of speed loss between 0 and 1

set gravity(x : Number, y : Number)

Sets the uniform acceleration vector for objects on the board to pixels/sec2

touch current : Vector3

Current touch point

touch end : Vector3

Last touch end point

touch start : Vector3

Last touch start point

touch velocity : Vector3

Final touch velocity after touch ended

touched : Boolean

True if board has been touched

update on wall

Make updates visible.

width : Number

Gets the width in pixels

C.4 Boolean

The datatype which has true or false as its two values.

and(right : Boolean) : Boolean

Builds conjunction

equals(right : Boolean) : Boolean

Indicates that the two values are equal

is invalid : Boolean

Returns true if the current instance is useless

not : Boolean

Negates the Boolean expression

or(right : Boolean) : Boolean

Builds disjunction

post to wall

Displays the value on the wall

to json : Json Object

Converts the value into a json data structure

to number : Number

Converts true to 1 and false to 0

to string : String

Converts a Boolean to a string

C.5 Camera

The front or back camera.

height : Number

Gets the height of the camera image in pixels

is front : Boolean

Returns false if this is the primary camera, and true otherwise

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the camera video stream in full screen

preview : Picture

Takes a low quality picture from the camera

width : Number

Gets the width of the camera image in pixels

C.6 Color

An argb color (alpha, red, green, blue)

A : Number

Gets the alpha value (0.0-1.0)

B : Number

Gets the blue value (0.0-1.0)

blend(other : Color) : Color

Composes a new color using alpha blending

brightness : Number

Gets the brightness component of the color

darken(delta : Number) : Color

Makes a darker color by a delta between 0 and 1

equals(other : Color) : Boolean

Checks if the color is equal to the other

G : Number

Gets the green value (0.0-1.0)

hue : Number

Gets the hue component of the color

is invalid : Boolean

Returns true if the current instance is useless

lighten(delta : Number) : Color

Makes a lighter color by a delta between 0 and 1

make transparent(alpha : Number) : Color

Creates a new color by changing the alpha channel from 0 (transparent) to 1 (opaque)

post to wall

Prints the value to the wall

R : Number

Gets the red value (0.0-1.0)

saturation : Number

Gets the saturation component of the color

C.7 Contact

An instance of this type represents a personal contact. The list of methods has been divided into three sections: get methods (which retrieve a single attribute of a contact), set methods (which set or update a single attribute), and other methods.

Get Methods of Contact Type

birthday : DateTime

Gets the birth date if any.

company : String

Gets the company name if any.

email : Link

Gets the work or personal email if any

first name : String

Gets the first name if any.

home address : String

Gets the work address if any

home phone : Link

Gets the home phone number if any

job title : String

Gets the job title at the company if any.

last name : String

Gets the last name if any

middle name : String

Gets the middle name if any

mobile phone : Link

Gets the cell phone number if any

name : String

Gets the display name (not used when saving contact)

nick name : String

Gets the nickname if any

office : String

Gets the office location at the company if any

personal email : Link

Gets the personal email if any

phone number : Link

Gets the cell or work or home phone number if any

picture : Picture

Gets the picture of the contact if any

source : String

Gets the source of this contact (phone, etc…)

suffix : String

Gets the name suffix if any

title : String

Gets the name title if any

web site : Link

Gets the web site if any

work address : String

Gets the home address if any

work email : Link

Gets the work email if any

work phone : Link

Gets the work phone number if any

Set Methods of Contact Type

set company(value : String)

Sets the company

set first name(value : String)

Sets the first name

set home phone(home phone : String)

Sets the home phone

set job title(value : String)

Sets the job title

set last name(value : String)

Sets the last name

set middle name(middle name : String)

Sets the middle name

set mobile phone(value : String)

Sets the mobile phone

set personal email(value : String)

Sets the personal email

set source(value : String)

Sets the source

set suffix(value : String)

Sets the suffix

set title(value : String)

Sets the title

set web site(value : String)

Sets the web site

set work email(value : String)

Sets the work email

set work phone(work phone : String)

Sets the work phone

Other Methods of Contact Type

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the contact to the wall

C.8 Contact Collection

A collection of contacts

at(index : Number) : Contact

Gets the contact at index

count : Number

Gets the number of contacts

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the contacts on the wall

C.9 DateTime

A DateTime value is a combination of date and time. The list of methods has been separated into a table of get methods (which return a single attribute) and other methods.

Get Methods of DateTime Type

date : DateTime

Gets the date

day : Number

Gets the day of the month

hour : Number

Gets the hour

millisecond : Number

Gets the millisecond

minute : Number

Gets the minute

month : Number

Gets the month

second : Number

Gets the second

week day : Number

Gets the day of the week (sunday = 0, monday = 1, … saturday = 6)

year : Number

Gets the year

year day : Number

Gets the day of the year between 1 and 366

Other Methods of DateTime Type

add days(days : Number) : DateTime

Returns a date that adds the specified number of days to the value of this instance

add hours(hours : Number) : DateTime

Returns a date that adds the specified number of hours to the value of this instance

add milliseconds(milliseconds : Number) : DateTime

Returns a date that adds the specified number of milliseconds to the value of this instance

add minutes(minutes : Number) : DateTime

Returns a date that adds the specified number of minutes to the value of this instance

add months(months : Number) : DateTime

Returns a date that adds the specified number of months to the value of this instance

add seconds(seconds : Number) : DateTime

Returns a date that adds the specified number of seconds to the value of this instance

add years(years : Number) : DateTime

Returns a date that adds the specified number of years to the value of this instance

equals(other: DateTime): Boolean

Compares dates for equality

greater(other: DateTime): Boolean

Compares dates for greater

greater or equal(other : DateTime) : Boolean

Compares dates for greater or equal

is invalid : Boolean

Returns true if the current instance is useless

less(other : DateTime) : Boolean

Compares dates for less

less or equals(other : DateTime) : Boolean

Compares dates for less or equal

not equals(other : DateTime) : Boolean

Compares dates for inequality

post to wall

Prints the date to the wall

subtract(value: DateTime): Number

Computes difference between date-times in seconds

to local time : DateTime

Converts to the local time

to json : Json Object

Converts the value into a json data structure

to local time : DateTime

Converts to the local time

to string : String

Converts a dates to a string

to universal time : DateTime

Converts coordinated universal time

C.10 Form Builder

A builder to create HTML Form data.

add boolean(name : String, value : Boolean)

Adds a boolean value

add number(name : String, value : Number)

Adds a number value

add picture(name : String, value : Picture, picture Name : String)

Adds a picture

add string(name : String, value : String)

Adds a string value

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the form to the wall

C.11 Json Builder

A json data structure builder.

add(value : Json Object)

Adds a value to the array

add null

Adds a null value to the array

is invalid : Boolean

Returns true if the current instance is useless

set boolean(name : String, value : Boolean)

Sets the boolean value

set field(name : String, value : Json Object)

Sets the field value

set field null(name : String)

Sets the field value as null

set number(name : String, value : Number)

Sets the number value

set string(name : String, value : String)

Sets the string value

to json : Json Object

Converts the builder into a json data structure and clears the builder

C.12 Json Object

A JSON data structure

at(index : Number) : Json Object

Gets the i-th json value

boolean(key : String) : Boolean

Gets a field value as a Boolean

contains key(key: String) : Boolean

Indicates if the key exists

count : Number

Gets the number of values

field(key : String) : Json Object

Gets a value by name

is invalid : Boolean

Returns true if the current instance is useless

keys : String Collection

Gets the list of keys

kind : String

Gets json kind (string, number, object, array, boolean)

number(key : String) : Number

Gets a field value as a number

post to wall

Prints the value to the wall

string(key : String) : String

Gets a field value as a string

time(key : String) : DateTime

Gets the field value as a time

to boolean : Boolean

Converts to a Boolean (type must be boolean)

to number : Number

Converts to a number (type must be number)

to string : String

Converts to a string (type must be string)

to time : DateTime

Converts and parses to a date time (type must be string)

C.13 Link

A link to a video, image, email, or a phone number.

address : String

Gets the url

is invalid : Boolean

Returns true if the current instance is useless

kind : String

Gets the kind of asset - media, image, email, phone number, hyperlink, deep zoom link, radio

location : Location

Gets the location if any

name : String

Gets the name if any

post to wall

Displays the link on the wall

set location(location : Location)

Sets the location

set name(name : String)

Sets the name

share(network : String)

Shares the link (email, sms, Facebook, social or '' to pick from a list)

C.14 Link Collection

A list of links.

add(value : Link)

Adds a link

add many(value : Link Collection)

Adds many links at once

at(index : Number) : Link

Gets the i-th link

clear

Clears the collection

count : Number

Gets the number of elements

index of(item : Link, start : Number) : Number

Gets the index of the first occurrence of item. Returns -1 if not found or start is out of range.

insert at(index : Number, item : Link)

Inserts a link at position index. Does nothing if index is out of range.

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the links on the wall

random : Link

Gets a random element from the collection. Returns invalid if the collection is empty.

remove(item : Link) : Boolean

Removes the first occurrence of the link. Returns true if removed.

remove at(index : Number)

Removes the link at position index.

reverse

Reverses the order of the elements.

set at(index : Number, value : Link)

Sets the i-th link

C.15 Location

A geo coordinate (latitude, longitude, …)

altitude : Number

Gets the altitude of the coordinate

course : Number

Gets the course of the coordinate

distance(other : Location) : Number

Calculates the distance in meters

equals(other : Location) : Boolean

Indicates if this instance is equal to the other

hor accuracy : Number

Gets the horizontal accuracy of the coordinate

is invalid : Boolean

Returns true if the current instance is useless

latitude : Number

Gets the latitude of the coordinate

longitude : Number

Gets the longitude of the coordinate

post to wall

Displays the location in a map using Bing

share(network : String, message : String)

Shares the location (email, sms, Facebook, social or '' to pick from a list)

speed : Number

Gets the speed of the coordinate

to string : String

Converts to a string lat,long

vert accuracy : Number

Gets the vertical accuracy of the coordinate

C.16 Location Collection

add(value : Location)

Adds a location

add many(value : Location Collection)

Adds many locations at once

at(index : Number) : Location

Gets the i-th geo coordinate

clear

Clears the collection

count : Number

Gets the number of elements

index of(item : Location, start : Number) : Number

Gets the index of the first occurrence of item. Returns -1 if not found or start is out of range.

insert at(index : Number, item : Location) : Nothing

Inserts a location at position index. Does nothing if index is out of range.

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the locations in a map using Bing

random : Location

Gets a random element from the collection. Returns invalid if the collection is empty.

remove(item : Location) : Boolean

Removes the first occurrence of the location. Returns true if removed.

remove at(index: Number)

Removes the location at position index

reverse

Reverses the order of the elements

set at(index : Number, value : Location)

Sets the i-th geo coordinate

sort by distance(loc : Location)

Sorts by distance to the location

C.17 Map

A Bing map.

add line(locations : Location Collection, color : Color, thickness : Number)

Adds a polyline that passes through various geo coordinates

add link(link : Link, background : Color, foreground : Color)

Adds a link pushpin on the map (ignored if the location if not set)

add message(msg : Message, background : Color, foreground : Color)

Adds a message pushpin on the map (ignored if the location is not set)

add picture(location : Location, picture : Picture, background : Color)

Adds a picture pushpin on the map

add place(place : Place, background : Color, foreground : Color)

Adds a place pushpin on the map (ignored if the location is not set)

add text(location : Location, text : String, background : Color, foreground : Color)

Adds a text pushpin on the map

center : Location

Gets the map center location

clear

Clears the lines, regions and pushpins

fill region(locations : Location Collection, fill : Color, stroke : Color, thickness : Number)

Fills a region with a color

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the map in the wall using Bing

set center(center : Location)

Sets the map center location

set zoom(level : Number)

Sets the zoom level from 1 (earth) to 21 (street)

view pushpins

Changes the current zoom and center so that all the pushpins are visible. This method has no effect if the map is not posted on the wall yet.

zoom : Number

Gets the zoom level

C.18 Matrix

A two-dimensional matrix of numbers.

add(b : Matrix) : Matrix

Returns a matrix resulting from adding this matrix to b. The sizes of both matrices must match.

at(index : Number) : Number

Gets the value at a given index. Elements are ordered line by line starting top left.

clear(value : Number)

Sets all the element of the matrix to the value.

clone : Matrix

Creates a deep copy of the matrix.

column count : Number

Gets the number of columns

count : Number

Gets the total number of elements

is invalid : Boolean

Returns true if the current instance is useless

item(row : Number, column : Number) : Number

Gets the value at a given location. Returns invalid if outside the array dimensions.

max : Number

Computes the maximum of the values

min : Number

Computes the minimum of the values

multiply(b : Matrix) : Matrix

Returns a matrix resulting from multiplying each element in the matrices. The sizes of both matrices must match.

negate : Matrix

Returns the matrix negated.

post to wall

Displays the map in the wall using Bing

random : Number

Gets a random element. Returns invalid if the matrix is empty.

row count : Number

Gets the number of rows

scale(factor : Number) : Matrix

Returns a copy of the matrix scaled by factor

set at(index : Number, value : Number)

Sets the value at a given index. Elements are ordered line by line starting top left.

set item(row : Number, column : Number, value : Number)

Sets the value at a particular position. The matrix will be expanded with zero values if the position falls outside the boundaries.

subtract(b : Matrix) : Matrix

Returns a matrix resulting from subtracting b from this matrix. The sizes of both matrices must match.

to string : String

Gets the string representation of the matrix

transpose : Matrix

Returns the transposed matrix

C.19 Message

A Message value contains the details of a posting on a message board. The list of methods is separated into get methods (which retrieve a single attribute of a message), set methods (which assign or update an attribute value), and other methods.

Get Methods of Message Type

from : String

Gets the author

id : String

Gets the message identifier

link : String

Gets the link associated with the message

location : Location

Gets the geo coordinates

media link : String

Gets a url to the media

message : String

Gets the message text

picture link : String

Gets a url for the picture

source : String

Gets the source of this message (Facebook, Twitter, etc…)

time : DateTime

Gets the time

title : String

Gets the title text

to : String

Gets the recipient

values : String Map

Gets additional values stored in the message

Set Methods of Message Type

set from(author : String)

Sets the author

set id(value : String)

Sets the message identifier

set link(url : String)

Sets the link associated to the message

set location(location : Location)

Sets the geo coordinates

set media link(url : String)

Sets the url to the media

set message(message : String)

Sets the message text

set picture link(url : String)

Sets the url to the picture

set source(source : String)

Sets the source of this message

set time(time : DateTime)

Sets the time

set title(title : String)

Sets the title text

set to(author : String) : Nothing

Sets the recipient

Other Methods of Message Type

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the message to the wall

share(where : String) : Nothing

Shares this message (email, sms, Facebook, social or '' to pick from a list)

C.20 Message Collection

A list of messages.

add(value : Message

Adds a Message

add many(value : Message Collection)

Adds a collection of Message items

at(index : Number) : Message

Gets the i-th Message

clear

Clears the collection

continuation : String

Gets the identifier of the next set of messages

count : Number

Gets the number of elements

index of(item : Message, start : Number) : Number

Gets the index of the first occurrence of item. Returns -1 if not found or start is out of range.

insert at(index : Number, item : Message)

Inserts a link at position index. Does nothing if index is out of range.

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the Messages in the wall

random : Message

Gets a random element from the collection. Returns invalid if the collection is empty.

remove(item : Message) : Boolean

Removes the first occurrence of the message. Returns true if removed.

remove at(index : Number)

Removes the message at position index

reverse

Reverses the order of the elements

set at(index : Number, value : Message)

Sets the i-th Message

set continuation(value : String)

Sets the identifier of the next set of message

sort by date

Sorts from the newest to oldest

C.21 Motion

Describes the motion of the device.

acceleration : Vector3

Gets the linear acceleration of the device, in gravitational units

gravity : Vector3

Gets the gravity vector associated with this reading

is invalid : Boolean

Returns true if the current instance is useless

pitch : Number

Gets the pitch of the attitude in degrees

post to wall

Displays the motion reading to the wall

roll : Number

Gets the roll of the attitude in degrees

rotation speed : Vector3

Gets the device rotation speed in degrees per second

time : DateTime

Gets a timestamp indicating the time at which the reading was calculated

yaw : Number

Gets the yaw of the attitude in degrees

C.22 Number

A number (possibly negative and/or fractional)

-(right : Number) : Number

Subtracts numbers

*(right : Number) : Number

Multiplies numbers

/(right : Number) : Number

Divides numbers

+(right : Number) : Number

Adds numbers

<(right : Number) : Boolean

Compares numbers for less

=(right : Number) : Boolean

Compares numbers for equality

≠(right : Number) : Boolean

Compares numbers for inequality

>(right : Number) : Boolean

Compares numbers for more

≤(right : Number) : Boolean

Compares numbers for less or equal

≥(right : Number) : Boolean

Compares numbers for more or equal

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Prints the number to the wall

to character : String

Interprets a number as a unicode value and converts it to a single character string

to color : Color

Interprets the number as a ARGB (alpha, red, green, blue) color

to json : Json Object

Converts the value into a json data structure

to string : String

Converts a number to a string

C.23 Number Collection

A collection of numbers

add(item : Number)

Adds a number at the end of the collection

add many(items : Number Collection)

Adds many numbers at once

at(index : Number) : Number

Gets the number at position index. Returns invalid if index is out of range

avg : Number

Computes the average of the values

clear

Clears the numbers

contains(item : Number) : Boolean

Indicates if the collection contains the item

count : Number

Gets the number of items

index of(item : Number, start : Number) : Number

Gets the index of the first occurrence of a number. Returns

-1 if not found or start is out of range.

insert at(index : Number, item : Number)

Inserts a double at position index. Does nothing if index is out of range.

is invalid : Boolean

Returns true if the current instance is useless

max : Number

Computes the maximum of the values

min : Number

Computes the minimum of the values

post to wall

Displays the numbers on the wall

random : Number

Gets a random element from the collection. Returns invalid if the collection is empty.

remove(item : Number) : Boolean

Removes the first occurrence of a number. Returns true if removed.

remove at(index : Number)

Removes the number at position index

reverse

Reverses the items

set at(index : Number, item : Number)

Sets the number at position index. Does nothing if the index is out of range.

sort

Sorts the numbers in this collection

sum : Number

Computes the sum of the values

C.24 Number Map

A map of numbers to numbers

at(index : Number) : Number

Gets the element at index. Index may be any floating-point value

avg : Number

Computes the average of the values

clear

Clears the number map

count : Number

Gets the number of elements

is invalid : Boolean

Returns true if the current instance is useless

max : Number

Computes the maximum of the values

min : Number

Computes the minimum of the values

post to wall

Displays the map in a line chart; you need to call 'update on wall' later if you want changes to be reflected

remove(index : Number)

Removes the value at a given index

set at(index : Number, value : Number)

Sets the element at index. Index may be any floating-point value

set many(numbers : Number Map)

Sets many elements at once

slice(start : Number, end : Number) : Number Map

Extracts the elements at indices between start (inclusive) and end (non-inclusive)

sum : Number

Computes the sum of the values

update on wall

Updates any display of this map

C.25 OAuth Response

OAuth 2.0 Access Token or Error.

access token : String

The access token issued by the authorization server

error : String

A single ASCII [USASCII] error code

error description : String

(Optional) A human readable error code

error uri : String

(Optional) A URI identifying a human-readable web page with information about the error, used to provide the client developer with additional information about the error.

expires in : Number

(Optional) The lifetime in seconds of the access token

is error : Boolean

Indicates if this response is an error

is expiring(lookup : Number) : Boolean

(Optional) Indicates if the token might expire within the next seconds

is invalid : Boolean

Returns true if the current instance is useless

others : String Map

(Optional) Additional key-value pairs not covered by the OAuth 2.0 specification

post to wall

Displays the response

set at(index : Number, item : Number)

Sets the number at position index. Does nothing if the index is out of range.

sort

Sorts the numbers in this collection

scope : String

(Optional) Optional if if identical to the scope requested by the client; otherwise, the scope of the access token as described by Section 3.3

C.26 Page

A page on a wall

equals(other : Page) : Boolean

Gets a value indicating if the page is equal to the other

is invalid : Boolean

Returns true if the current instance is useless

C.27 Page Button

A page button on the wall

equals(page button : Page) : Boolean

Gets a value indicating if both instances are equal

icon : String

Gets the icon name

is invalid : Boolean

Returns true if the current instance is useless

page : Page

Gets the page hosting this button

post to wall

Pushes this button on the wall

text : String

Gets the text

C.28 Page Collection

A collection of pages

at(index : Number) : Page

Gets the pages at index

count : Number

Gets the number of pages

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the pages on the wall

C.29 Picture

A Picture value is an image which can be displayed. The list of methods has been separated into get methods (which return a single property of a picture) and other methods.

Get Methods of Picture Type

at(index : Number) : Color

Gets the pixel color at the given linear index

count : Number

Gets the number of pixels

date : DateTime

Gets the date and time where the picture was taken; if any

height : Number

Gets the height in pixels

location : Location

Gets the location where the picture was taken; if any.

pixel(left : Number, top : Number) : Color

Gets the color of a pixel

width : Number

Gets the width in pixels

Other Methods of Picture Type

blend(other : Picture, left : Number, top : Number, angle : Number, opacity : Number)

Writes another picture at a given location. The opacity ranges from 0 (transparent) to 1 (opaque).

blend svg(markup : String,

left : Number, top : Number, width : Number, height : Number, angle : Number)

Writes a Scalable Vector Graphics (SVG) document at a given location. By default, this action uses the viewport size provided in the SVG document when width or height are negative.

brightness(factor : Number)

Changes the brightness of the picture. Factor in [-1, 1].

clear(color : Color)

Clears the picture to a given color

clone : Picture

Returns a copy of the image

colorize(background : Color, foreground : Color, threshold : Number)

Recolors the picture with the background and foreground color, based on a color threshold between 0.0 and 1.0

contrast(factor : Number)

Changes the contrast of the picture. Factor in [-1, 1].

crop(left : Number, top : Number, width : Number, height : Number)

Crops a sub-image

desaturate

Makes the picture gray

draw ellipse(left : Number, top : Number, width : Number, height : Number, angle : Number, c : Color, thickness : Number)

Draws an elliptic border with a given color

draw line(x1 : Number, y1 : Number, x2 : Number, y2 : Number, color : Color, thickness : Number)

Draws a line between two points

draw rect(left : Number, top : Number, width : Number, height : Number, angle : Number, c : Color, thickness : Number)

Draws a rectangle border with a given color

draw text(left : Number, top : Number, text : String, font size : Number, angle : Number, color : Color)

Draws some text border with a given color and font size

fill ellipse(left : Number, top : Number, width : Number, height : Number, angle : Number, color : Color)

Fills a ellipse with a given color

fill rect(left : Number, top : Number, width : Number, height : Number, angle : Number, color : Color)

Fills a rectangle with a given color

flip horizontal

Flips the picture horizontally

flip vertical

Flips the picture vertically

invert

Inverts the red, blue and green channels

is invalid : Boolean

Returns true if the current instance is useless

is panorama : Boolean

Indicates if the picture width is greater than its height

post to wall

Displays the image to the wall; you need to call 'update on wall' later if you want changes to be reflected

resize(width : Number, height : Number)

Resizes the picture to the given size in pixels

save to library : String

Saves the picture to the 'saved pictures' album. Returns the file name.

set pixel(left : Number, top : Number, color : Color)

Sets the pixel color at a given pixel

share(where : String, message : String)

Shares this message ('' to pick from a list)

tint(color : Color)

Converts every pixel to gray and tints it with the given color.

update on wall

Refreshes the picture on the wall

C.30 Picture Album

A picture album

albums : Picture Albums

Gets the children albums

is invalid : Boolean

Returns true if the current instance is useless

name : String

Gets the name of the album

pictures : Pictures

Gets the pictures

post to wall

Displays the album to the wall

C.31 Picture Albums

A collection of picture albums

at(index : Number) : Picture Album

Gets the item at position 'index'; invalid if index is out of bounds

count : Number

Gets the number of elements in the collection

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the value to the wall

random : Picture Album

Gets random item; invalid if collection is empty

C.32 Pictures

A collection of pictures

at(index : Number) : Picture

Gets the item at position 'index'; invalid if index is out of bounds

count : Number

Gets the number of elements in the collection

find(name : String) : Number

Finds a picture by name and returns the index. Returns -1 if not found.

full(index : Number) : Picture

Gets the full resolution version of i-th picture

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the picture thumbnails to the wall

random : Picture

Gets a random item; invalid if collection is empty

thumbnail(index : Number) : Picture

Gets the thumbnail of i-th picture

C.33 Place

Attaches or uses information for a named location. The list of methods has been separate into three tables: get methods which access attributes of a Place, set methods which update or replace attributes, and other methods.

Get Methods of Place Type

category : String

Gets the category of the place

id : String

Gets the identifier of this place

link : String

Gets the link associated to the message

location : Location

Gets the location of the place

name : String

Gets the name of the place

picture link : String

Gets a url to the picture

source : String

Gets the source of this place (Facebook, TouchDevelop)

Set Methods of Place Type

set category(category : String)

Sets the category of the place

set id(id : String)

Sets the identifier of this place

set link(url : String)

Sets the link associated with the message

set location(location : Location)

Sets the location of the place

set name(name : String)

Sets the name of the place

set picture link(url : String)

Sets the url for the picture

set source(source : String)

Sets the source of this place

Other Methods of Place Type

is invalid : Boolean

Returns true if the current instance is useless

post to wall : Nothing

Posts the place to the wall

to string : String

Converts to a string name, plus latitude and longitude

C.34 Place Collection

A collection of places

add(value : Place)

Adds a place

add many(value : Place Collection)

Adds many places at once

at(index : Number) : Place

Gets the i-th place

clear

Clears the collection

continuation : String

Gets the identifier of the next set of messages

count : Number

Gets the number of elements

index of(item : Place, start : Number) : Number

Gets the index of the first occurrence of item. Returns -1 if not found or start is out of range.

insert at(index : Number, item : Place)

Inserts a place at position index. Does nothing if index is out of range.

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Posts the places on the wall

random : Place

Gets a random element from the collection. Returns invalid if the collection is empty.

remove(item : Place) : Boolean

Removes the first occurrence of a place. Returns true if removed.

remove at(index : Number)

Removes the location at position index

reverse

Reverses the order of the elements

set at(index : Number, value : Place)

Sets the i-th place

set continuation(value : String)

Sets the identifier of the next set of messages

sort by distance(loc : Location)

Sorts the places by distance to the location

C.35 Playlist

A song playlist

duration : Number

Gets the duration in seconds

is invalid : Boolean

Returns true if the current instance is useless

name : String

Gets the name of the song

play

Plays the songs in the playlist

post to wall

Displays the playlist to the wall

songs : Songs

Gets the songs

C.36 Playlists

A collection of playlists

at(index : Number) : Playlist

Gets i-th playlist

count : Number

Gets the number of playlists

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the value to the wall

C.37 Song

A song

album : Song Album

Gets the song album containing the song

artist : String

Gets the name of the artist

duration : Number

Gets the duration in seconds

genre : String

Gets the genre of the song

is invalid : Boolean

Returns true if the current instance is useless

name : String

Gets the name of the song

play

Plays the song

play count : Number

Gets the play count

post to wall

Displays the song on the wall

protected : Boolean

Gets a value indicating whether the song is DRM protected

rating : Number

Gets the users rating; -1 if not rated

track : Number

Gets the track number in the album

C.38 Songs

A collection of songs

at(index : Number) : Song

Gets the item at position 'index'; invalid if index is out of bounds

count : Number

Gets the number of elements in the collection

is invalid : Boolean

Returns true if the current instance is useless

play

Plays the song

post to wall

Displays the songs on the wall

random : Song

Gets random item; invalid if collection is empty

C.39 Song Album

A song album

art : Picture

Gets album art picture

artist : String

Gets the name of the artist

duration : Number

Gets the duration in seconds

genre : String

Gets the genre of the song

has art : Boolean

Indicates if the album has art

is invalid : Boolean

Returns true if the current instance is useless

name : String

Gets the name of the album

play

Plays the songs of the album

post to wall

Displays the song album on the wall

songs : Songs

Gets the songs

thumbnail : Picture

Gets the thumbnail picture

C.40 Song Albums

A collection of albums

at(index : Number) : Song Album

Gets the item at position 'index'; invalid if index is out of bounds

count : Number

Gets the number of elements in the collection

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the value to the wall

random : Song Album

Gets random item; invalid if collection is empty

C.41 Songs

A collection of songs.

at(index : Number) : Song

Gets the item at position 'index'; invalid if index is out of bounds

count : Number

Gets the number of elements in the collection

is invalid : Boolean

Returns true if the current instance is useless

play

Plays the song

post to wall

Displays the songs on the wall

random : Song

Gets random item; invalid if collection is empty

C.42 Sound

A sound effect

duration : Number

Gets the duration in seconds

is invalid : Boolean

Returns true if the current instance is useless

pan : Number

Gets the panning, ranging from -1.0 (full left) to 1.0 (full right)

pitch : Number

Gets the pitch adjustment, ranging from -1 (down one octave) to 1 (up one octave)

play

Plays the sound effect

play special(volume : Number, pitch : Number, pan : Number)

Plays the song with different volume (0 to 1), pitch (-1 to 1) and pan (-1 to 1)

post to wall

Displays a player on the wall

set pan(pan : Number)

Sets the panning, ranging from -1.0 (full left) to 1.0 (full right)

set pitch(pitch : Number)

Sets the pitch adjustment, ranging from -1 (down one octave) to 1 (up one octave)

set volume(v : Number)

Sets the volume from 0 (silent) to 1 (full volume)

volume : Number

Gets the volume from 0 (silent) to 1 (full volume)

C.43 Sprite

A sprite is a graphical object which can be displayed on a Board instance. The list of methods of the Sprite type has been separated into get methods (which return a single attribute), set methods (which assign or update an attribute), and other methods.

Get Methods of Sprite Type

acceleration x : Number

Gets the acceleration along x in pixels/sec2

acceleration y : Number

Gets the acceleration along y in pixels/sec2

angle : Number

Gets the angle of the sprite in degrees

angular speed : Number

Gets the rotation speed in degrees/sec

color : Color

Gets the sprite color

elasticity : Number

Gets the sprite elasticity as a fraction of speed preservation per bounce (0-1)

friction : Number

Gets the fraction of speed loss between 0 and 1

height : Number

Gets the height in pixels

location : Location

Gets the geo location assigned to the sprite

mass : Number

Gets the mass

opacity : Number

Gets the opacity (between 0 transparent and 1 opaque)

picture : Picture

Gets the picture on a picture sprite (if it is a picture sprite)

speed x : Number

Gets the speed along x in pixels/sec

speed y : Number

Gets the speed along y in pixels/sec

text : String

The text on a text sprite (if it is a text sprite)

width : Number

Gets the width in pixels

x : Number

Gets the x position in pixels

y : Number

Gets the y position in pixels

z index : Number

Gets the z-index of the sprite

Set Methods of Sprite Type

set acceleration(vx : Number, vy : Number)

Sets the acceleration in pixels/sec^2

set acceleration x(vx : Number)

Sets the x acceleration in pixels/sec^2

set acceleration y(vy : Number)

Sets the y acceleration in pixels/sec^2

set angle(angle : Number)

Sets the angle of the sprite in degrees

set angular speed(speed : Number)

Sets the rotation speed in degrees/sec

set clip(left : Number, top : Number, width : Number, height : Number)

Sets the clipping area for an image sprite (if it is an image sprite)

set elasticity(elasticity : Number)

Sets the sprite elasticity as a fraction of speed preservation per bounce (0-1)

set friction(friction : Number)

Sets the friction to a fraction of speed loss between 0 and 1

set height(height : Number)

Sets the height in pixels

set location(location : Location)

Sets the geo location of the sprite

set mass(mass : Number)

Sets the sprite mass

set opacity(opacity : Number)

Sets the sprite opacity (between 0 transparent and 1 opaque)

set picture(pic : Picture) : Nothing

Updates picture on a picture sprite (if it is a picture sprite)

set pos(x : Number, y : Number)

Sets the position in pixels

set speed(vx : Number, vy : Number)

Sets the speed in pixels/sec

set speed x(vx : Number)

Sets the x speed in pixels/sec

set speed y(vy : Number)

Sets the y speed in pixels/sec

set text(text : String)

Updates text on a text sprite (if it is a text sprite)

set width(width : Number)

Sets the width in pixels

set x(x : Number)

Sets the x position in pixels

set y(y : Number) : Nothing

Sets the y position in pixels

set z index(zindex : Number)

Sets the z-index of the sprite

speed towards(other : Sprite, magnitude : Number)

Sets sprite speed direction towards other sprite with given magnitude

Other Methods of Sprite Type

delete

Delete sprite

equals(other : Sprite) : Boolean

Are these the same sprite?

hide

Hide the sprite

is invalid : Boolean

Returns true if the current instance is useless

is visible : Boolean

Returns true if sprite is not hidden

move(delta x : Number, delta y : Number)

Moves sprite

move clip(x : Number, y : Number)

Moves the clipping area and wraps around the image if needed (if it is an image sprite)

move towards(other : Sprite, fraction : Number)

Moves sprite towards other sprite

overlap with(sprites : Sprite Set) : Sprite Set

Returns the subset of sprites in the given set that overlap with sprite

overlaps with(other : Sprite) : Boolean

Do the sprites overlap?

show

Show the sprite

C.44 Sprite Set

A collection of sprites. Unlike the other collection types, a Sprite Set does not allow duplicate items, and the items in the set are ordered.

add(sprite : Sprite) : Boolean

Add sprite to set. Returns true if sprite was not already in set.

add from(old set : Sprite Set, sprite : Sprite) : Boolean

Add sprite to set and remove from old set. Returns true if sprite was in old set and not in new set.

at(index : Number) : Sprite

Return sprite at given index

clear

Removes all sprites from the set

contains(sprite : Sprite) : Boolean

Returns true if sprite is in set

count : Number

Returns the number of sprites in the set

index of(sprite : Sprite) : Number

Returns index of sprite in this set or -1 if not in set

is invalid : Boolean

Returns true if the current instance is useless

remove(sprite : Sprite) : Boolean

Remove sprite from set. Returns true if sprite was in set

remove first : Sprite

Remove sprite that was added to set first

C.45 String

A piece of text.

∥(right : String) : String

Concatenates two pieces of text

at(index : Number) : String

Gets the character at a specified index

compare(other : String) : Number

Compares two pieces of text

concat(other : String) : String

Concatenates two pieces of text

contains(value : String) : Boolean

Returns a value indicating if the second string is contained

copy to clipboard

Stores text in the clipboard

count : Number

Returns the number of characters

ends with(value : String) : Boolean

Determines whether the ending matches the specified string

equals(other : String) : Boolean

Checks if two strings are the same

index of(value : String, start : Number) : Number

Returns the index of the first occurrence if found starting at a given position

insert(start : Number, value : String) : String

Inserts a string at a given position

is empty : Boolean

Indicates if the string is empty

is invalid : Boolean

Returns true if the current instance is useless

is match regex(pattern : String) : Boolean

Indicates if the string matches a regular expression

last index of(value : String, start : Number) : Number

Returns the index of the last occurrence if found starting at a given position

matches(pattern : String) : String Collection

Gets the strings matching the regex expression (pattern)

post to wall

Displays string on the wall

remove(start : Number) : String

Returns all character from a string starting at a given index

replace(old : String, new : String) : String

Returns a given string with a replacement

replace regex(pattern : String, replace : String) : String

Replace every match of the regex according to the replacement string

share(network : String)

Shares the string (email, sms, Facebook, social or '' to pick from a list)

split(separator : String) : String Collection

Returns a string collection that contains the substrings in this string that are delimited by elements of a specified string

starts with(value : String) : Boolean

Determines whether the beginning matches the specified string

substring(start : Number, length : Number) : String

Returns a substring given a start index and a length

to boolean : Boolean

Parses the string as a boolean

to color : Color

Parses the string as a color

to datetime : DateTime

Parses the string as a date and time

to json : Json Object

Converts the value into a json data structure

to location : Location

Parses the string as a geo coordinate

to lower case : String

Returns a copy of this string converted to lowercase, using the casing rules of the current culture

to number : Number

Parses the string as a number

to time : Number

Parses the string as a time (12:30:12) and returns the number of seconds

to unicode : Number

Converts a single character string into its unicode number

to upper case : String

Returns a copy of this string converted to uppercase, using the casing rules of the current culture

trim(chars : String) : String

Removes all leading and trailing occurrences of a set of characters specified in a string from the current string

trim end(chars : String) : String

Removes all trailing occurrences of a set of characters specified in a string from the current string

trim start(chars : String) : String

Removes all leading occurrences of a set of characters specified in a string from the current string

C.46 String Collection

A collection of strings

add(item : String)

Adds a string

add many(items : String Collection)

Adds many strings at once

at(index : Number) : String

Gets the string at position index. Returns invalid if index is out of range.

clear

Clears the strings

contains(item : String) : Boolean

Indicates if the collection contains the item

count : Number

Gets the number of strings

index of(item : String, start : Number) : Number

Gets index of the first occurrence of a string. Returns -1 if not found or start is out of range.

insert at(index : Number, item : String) : Nothing

Inserts a string at position index. Does nothing if index is out of range.

is invalid : Boolean

Returns true if the current instance is useless

join(separator : String) : String

Concatenates separator and items into a string

post to wall

Displays the string on the wall

random : String

Gets a random element from the collection. Returns invalid if the collection is empty.

remove(item : String) : Boolean

Removes the first occurrence of a string. Returns true if removed.

remove at(index : Number) : Nothing

Removes the string at position index

reverse

Reverses the items

set at(index : Number, item : String)

Sets the string at position index. Does nothing if the index is out of range.

sort

Sorts the strings in this collection

C.47 String Map

A map from strings to strings

at(key : String) : String

Gets the value at a given key; invalid if not found

clear

Clears the values from the map

count : Number

Gets the number of elements in the map

is invalid : Boolean

Returns true if the current instance is useless

keys : String Collection

Gets the keys in the map

post to wall

Displays the list of key,value pairs in a table

remove(key : String)

Removes the value at a given key

set at(key : String, value : String) : Nothing

Sets the value at a given key; invalid if not found

set many(other : String Map) : Nothing

Sets many elements at once

C.48 TextBox

A text box

background : Color

Gets the background color

border : Color

Gets the border color

font size : Number

Gets the font size

foreground : Color

Gets the foreground color

icon : Picture

Gets the icon picture (max 173x173)

is invalid : Boolean

Returns true if current instance is useless

post to wall

Posts the textbox to the wall

set background(color : Color)

Sets the background color

set border(color : Color)

Sets the border color

set font size(size: Number)

Sets font size (small = 14, normal = 15, medium = 17, medium large = 19, large = 24, extra large = 32, extra extra large = 54, huge = 140

set foreground(color : Color)

Sets the foreground color

set icon(pic : Picture)

Sets the icon picture (max 96 x 96)

set text(text : String)

Sets the text

text : String

Gets the text

C.49 Vector3

A 3D vector

add(other : Vector3) : Vector3

Adds a vector

clamp(min : Vector3, max : Vector3) : Vector3

Restricts the vector in the specified range

cross(other : Vector3) : Vector3

Calculates the cross product with the other vector

distance(other : Vector3) : Number

Gets the distance between the two vectors

is invalid : Boolean

Returns true if the current instance is useless

length : Number

Gets the length of the vector

linear interpolation(other : Vector3, amount : Number) : Vector3

Linear interpolation between two vectors

multiply(other : Vector3) : Vector3

Multiplies component-wise with a vector

negate : Vector3

Returns a vector pointing in the opposite direction

normalize : Vector3

Returns a vector of one unit pointing in the same direction as the original vector

post to wall

Displays the vector on the wall

scale(scalar : Number) : Vector3

Multiplies with a scaling factor

subtract(other : Vector3) : Vector3

Subtracts another vector

to string : String

Turns the vector into a string

x : Number

Gets the x-component

y : Number

Gets the y-component

z : Number

Gets the z-component

C.50 Web Request

An HTTP web request

equals(other : Web Request) : Boolean

Indicates if both requests are the same instance

header(name : String) : String

Gets the value of a given header

header names : String Collection

Gets the names of the headers

is invalid : Boolean

Returns true if the current instance is useless

method : String

Determines whether it was a 'get' or a 'post'

on response received(handler : Web Response Action)

Set what happens whenever the response comes back from 'send async'

post to wall

Displays the request on the wall

send : Web Response

Performs the request synchronously

set accept(type : String)

Sets the Accept header type ('text/xml' for XML, 'application/json' for JSON)

set compress(value : Boolean)

Compresses the request content with gzip and sets the Content-Encoding header

set content(content : String)

Sets the content of a 'post' request

set content as form(form : Form Builder)

Sets the content as multipart/form-data

set content as json(json : Json Object)

Sets the content of a 'post' request as the JSON tree

set content as picture(picture : Picture, quality : Number)

Sets the content of a 'post' request as a JPEG encoded image. Quality from 0 (worse) to 1 (best).

set content as xml(xml : Xml Object)

Sets the content of a 'post' request as the XML tree

set credentials(name : String, password : String)

Sets the name and password for basic authentication. Requires an HTTPS URL, empty string clears.

set header(name : String, value : String)

Sets an HTML header value. An empty string clears the value

set method(method : String)

Sets the method as 'get' or 'post'. Default value is 'get'

set url(url : String)

Sets the url of the request. Must be a valid internet address.

url : String

Gets the url of the request

C.51 Web Response

An HTTP web response

content : String

Reads the response body as a string

content as json : Json Object

Reads the response body as a JSON tree

content as picture : Picture

Reads the response body as a picture

content as sound : Sound

Reads the response body as a wave sound

content as xml : Xml Object

Reads the response body as a XML tree

header(name : String) : String

Gets the value of a given header

header names : String Collection

Gets the names of the headers

is invalid : Boolean

Returns true if the current instance is useless

post to wall

Displays the response to the wall

request : Web Request

Gets the request associated to this response

status code : Number

Gets the HTTP Status code of the request if any

C.52 Xml Object

An xml element or collection of elements.

at(index : Number) : Xml Object

Gets the i-th child element in the collection

attr(name : String) : String

Gets the value of the attribute

attr names : String Collection

Gets the list of attribute names

child(name : String) : Xml Object

Gets a first child element matching the fully qualified name

children(name : String) : Xml Object

Gets a collection of child element matching the fully qualified name

count : Number

Gets the number of child element

create name(local name : String, namespace uri : String) : String

Creates a qualified full name from the namespace and local name

is element : Boolean

Indicates if this instance is an element or a filtered collection

is invalid : Boolean

Returns true if the current instance is useless

local name : String

Gets the local name of this element

name : String

Gets the full name of this element

namespace : String

Gets the namespace of this element

post to wall

Display the xml content on the wall

to string : String

Gets an xml string

value : String

Gets the concatenated text contents of this element