BTNContext Class Reference

Inherits from BTNBaseEntity : BTNModelObject
Declared in BTNContext.h

Overview

All fields are optional and should be populated only if known.

Warning: Using the same context instance for multiple fetches is not recommended and unexpected results may occur. Please use a new instance for each fetch.

Initilization

+ context

Returns a newly instantiated context object.

+ (instancetype)context

Discussion

Returns a newly instantiated context object.

Declared In

BTNContext.h

+ contextWithUserLocation:

Returns a newly instantiated context object with a userLocation.

+ (instancetype)contextWithUserLocation:(BTNLocation *)userLocation

Parameters

userLocation

the current location of the user.

Discussion

Returns a newly instantiated context object with a userLocation.

Declared In

BTNContext.h

+ contextWithSubjectLocation:

Returns a newly instantiated context object with a subject location.

+ (instancetype)contextWithSubjectLocation:(BTNLocation *)subjectLocation

Parameters

subjectLocation

a location subject for the current activity or content.

Discussion

Returns a newly instantiated context object with a subject location.

See Also

Declared In

BTNContext.h

+ contextWithArtist:

Returns a newly instantiated context object with an artist.

+ (instancetype)contextWithArtist:(BTNMusicArtist *)artist

Parameters

artist

a music artist associated with the current context.

Discussion

Returns a newly instantiated context object with an artist.

See Also

Declared In

BTNContext.h

+ contextWithJourney:

Returns a newly instantiated context object with a journey.

+ (instancetype)contextWithJourney:(BTNJourney *)journey

Parameters

journey

a journey object which is relevant to the current user context.

Discussion

Returns a newly instantiated context object with a journey.

See Also

Declared In

BTNContext.h

+ contextWithEvent:

Returns a newly instantiated context object with an event.

+ (instancetype)contextWithEvent:(BTNEvent *)event

Parameters

event

an event object which is relevant to the current user context.

Discussion

Returns a newly instantiated context object with an event.

See Also

Declared In

BTNContext.h

+ contextWithItem:

Returns a newly instantiated context object with a single item.

+ (instancetype)contextWithItem:(BTNItem *)item

Parameters

item

An item that is the subject of the page.

Discussion

Returns a newly instantiated context object with a single item.

See Also

Declared In

BTNContext.h

+ contextWithItems:

Returns a newly instantiated context object with an array of items.

+ (instancetype)contextWithItems:(NSArray<BTNItem*> *)items

Parameters

items

one or more items that are the subject of the page.

Discussion

Returns a newly instantiated context object with an array of items.

See Also

Declared In

BTNContext.h

+ contextWithURL:

Returns a newly instantiated context object with a URL.

+ (instancetype)contextWithURL:(NSURL *)URL

Parameters

URL

a URL that specifies the current context.

Discussion

Returns a newly instantiated context object with a URL.

See Also

Declared In

BTNContext.h

Adding Additional Data

– setUserLocation:

Sets the current location of the user.

- (void)setUserLocation:(BTNLocation *)userLocation

Discussion

Sets the current location of the user.

Note: Provide whatever level of granularity makes sense for the context / that you have access to.

Declared In

BTNContext.h

– setSubjectLocation:

Sets a location subject for the current activity or content. Example: A restaurant on a venue page, point on a map or city in a travel app

- (void)setSubjectLocation:(BTNLocation *)subjectLocation

Discussion

Sets a location subject for the current activity or content. Example: A restaurant on a venue page, point on a map or city in a travel app

Note: Provide whatever level of granularity makes sense for the context.

Declared In

BTNContext.h

– setDate:

Sets a relevant date for the user’s context. Example: The time of a reservation, date of a hotel reservation etc..

- (void)setDate:(NSDate *)date

Discussion

Sets a relevant date for the user’s context. Example: The time of a reservation, date of a hotel reservation etc..

Note: If date is not relevant, do not provide it.

Declared In

BTNContext.h

– setDateRangeWithStartDate:endDate:

Sets a date range when the current context represents a discrete period of time with a beginning and an end. Example: a return flight, movie showing, sporting event etc..

- (void)setDateRangeWithStartDate:(NSDate *)startDate endDate:(NSDate *)endDate

Discussion

Sets a date range when the current context represents a discrete period of time with a beginning and an end. Example: a return flight, movie showing, sporting event etc..

Declared In

BTNContext.h

– setArtist:

Sets a music artist associated with the current context.

- (void)setArtist:(BTNMusicArtist *)artist

Discussion

Sets a music artist associated with the current context.

See Also

  • BTNMusicArtist + context object for details.

Declared In

BTNContext.h

– setJourney:

Sets a journey object which is relevant to the current user context.

- (void)setJourney:(BTNJourney *)journey

Discussion

Sets a journey object which is relevant to the current user context.

Note: Specify a BTNJourney only when the current context represents a journey. Example: itinerary for a flight, bus, train, interstellar travel etc..

Declared In

BTNContext.h

– setEvent:

Sets an event object which is relevant to the current user context. Example: A concert, art show, conference etc..

- (void)setEvent:(BTNEvent *)event

Discussion

Sets an event object which is relevant to the current user context. Example: A concert, art show, conference etc..

Declared In

BTNContext.h

– addItems:

Add one or more items that are the subject of the page. Example: a book, iPad etc..

- (void)addItems:(NSArray<BTNItem*> *)items

Discussion

Add one or more items that are the subject of the page. Example: a book, iPad etc..

Declared In

BTNContext.h

– setURL:

Sets a URL that specifies the current context. This can either be a Universal Links representation of the page or URL of the canonical crawlable web page.

- (void)setURL:(NSURL *)URL

Discussion

Sets a URL that specifies the current context. This can either be a Universal Links representation of the page or URL of the canonical crawlable web page.

Declared In

BTNContext.h

Custom Context

– addCustomValue:forContextKey:

Add custom key-value pairs to further define your users context.

- (void)addCustomValue:(id)obj forContextKey:(NSString *)key

Discussion

Add custom key-value pairs to further define your users context.

Note: you can also use object subscripting (e.g. object[key] = value) @see BTNSubscriptable

Declared In

BTNContext.h