C# Class Bloom.Api.ApiRequest

When the Bloom UI makes an API call, a method that has been registered to handle that endpoint is called and given one of these. That method uses this class to get information on the request, and also to reply to the caller.
The goal here is to reduce code while increasing clarity and error catching.
Afficher le fichier Open project: BloomBooks/BloomDesktop Class Usage Examples

Méthodes publiques

Свойство Type Description
CurrentBook Book.Book
CurrentCollectionSettings Bloom.Collection.CollectionSettings
Parameters System.Collections.Specialized.NameValueCollection

Méthodes publiques

Méthode Description
ApiRequest ( IRequestInfo requestinfo, CollectionSettings currentCollectionSettings, Book currentBook ) : System
Failed ( string text ) : void
Handle ( EndpointRegistration endpointRegistration, IRequestInfo info, CollectionSettings collectionSettings, Book currentBook ) : bool
LocalPath ( ) : string

Get the actual local path that the server would retrieve given a Bloom URL that ends up at a local file. For now it is mainly useful for things in the book folder; it doesn't have all the smarts to locate files shipped with the application, it is just concerned with reversing the various tricks we use to encode paths as URLs.

ReplyWithImage ( string localPath ) : void
ReplyWithJson ( object objectToMakeJson ) : void
ReplyWithJson ( string json ) : void
ReplyWithText ( string text ) : void
RequiredFileNameOrPath ( string name ) : UrlPathString
RequiredParam ( string name ) : string
RequiredPostJson ( ) : string
RequiredPostString ( ) : string
RequiredPostValue ( string key ) : string
Succeeded ( ) : void
SucceededDoNotNavigate ( ) : void

Method Details

ApiRequest() public méthode

public ApiRequest ( IRequestInfo requestinfo, CollectionSettings currentCollectionSettings, Book currentBook ) : System
requestinfo IRequestInfo
currentCollectionSettings Bloom.Collection.CollectionSettings
currentBook Book
Résultat System

Failed() public méthode

public Failed ( string text ) : void
text string
Résultat void

Handle() public static méthode

public static Handle ( EndpointRegistration endpointRegistration, IRequestInfo info, CollectionSettings collectionSettings, Book currentBook ) : bool
endpointRegistration EndpointRegistration
info IRequestInfo
collectionSettings Bloom.Collection.CollectionSettings
currentBook Book
Résultat bool

LocalPath() public méthode

Get the actual local path that the server would retrieve given a Bloom URL that ends up at a local file. For now it is mainly useful for things in the book folder; it doesn't have all the smarts to locate files shipped with the application, it is just concerned with reversing the various tricks we use to encode paths as URLs.
public LocalPath ( ) : string
Résultat string

ReplyWithImage() public méthode

public ReplyWithImage ( string localPath ) : void
localPath string
Résultat void

ReplyWithJson() public méthode

public ReplyWithJson ( object objectToMakeJson ) : void
objectToMakeJson object
Résultat void

ReplyWithJson() public méthode

public ReplyWithJson ( string json ) : void
json string
Résultat void

ReplyWithText() public méthode

public ReplyWithText ( string text ) : void
text string
Résultat void

RequiredFileNameOrPath() public méthode

public RequiredFileNameOrPath ( string name ) : UrlPathString
name string
Résultat UrlPathString

RequiredParam() public méthode

public RequiredParam ( string name ) : string
name string
Résultat string

RequiredPostJson() public méthode

public RequiredPostJson ( ) : string
Résultat string

RequiredPostString() public méthode

public RequiredPostString ( ) : string
Résultat string

RequiredPostValue() public méthode

public RequiredPostValue ( string key ) : string
key string
Résultat string

Succeeded() public méthode

public Succeeded ( ) : void
Résultat void

SucceededDoNotNavigate() public méthode

public SucceededDoNotNavigate ( ) : void
Résultat void

Property Details

CurrentBook public_oe property

public Book.Book CurrentBook
Résultat Book.Book

CurrentCollectionSettings public_oe property

public CollectionSettings,Bloom.Collection CurrentCollectionSettings
Résultat Bloom.Collection.CollectionSettings

Parameters public_oe property

public NameValueCollection,System.Collections.Specialized Parameters
Résultat System.Collections.Specialized.NameValueCollection