C# Класс 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.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
CurrentBook Book.Book
CurrentCollectionSettings Bloom.Collection.CollectionSettings
Parameters System.Collections.Specialized.NameValueCollection

Открытые методы

Метод Описание
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

Описание методов

ApiRequest() публичный Метод

public ApiRequest ( IRequestInfo requestinfo, CollectionSettings currentCollectionSettings, Book currentBook ) : System
requestinfo IRequestInfo
currentCollectionSettings Bloom.Collection.CollectionSettings
currentBook Book
Результат System

Failed() публичный Метод

public Failed ( string text ) : void
text string
Результат void

Handle() публичный статический Метод

public static Handle ( EndpointRegistration endpointRegistration, IRequestInfo info, CollectionSettings collectionSettings, Book currentBook ) : bool
endpointRegistration EndpointRegistration
info IRequestInfo
collectionSettings Bloom.Collection.CollectionSettings
currentBook Book
Результат bool

LocalPath() публичный Метод

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
Результат string

ReplyWithImage() публичный Метод

public ReplyWithImage ( string localPath ) : void
localPath string
Результат void

ReplyWithJson() публичный Метод

public ReplyWithJson ( object objectToMakeJson ) : void
objectToMakeJson object
Результат void

ReplyWithJson() публичный Метод

public ReplyWithJson ( string json ) : void
json string
Результат void

ReplyWithText() публичный Метод

public ReplyWithText ( string text ) : void
text string
Результат void

RequiredFileNameOrPath() публичный Метод

public RequiredFileNameOrPath ( string name ) : UrlPathString
name string
Результат UrlPathString

RequiredParam() публичный Метод

public RequiredParam ( string name ) : string
name string
Результат string

RequiredPostJson() публичный Метод

public RequiredPostJson ( ) : string
Результат string

RequiredPostString() публичный Метод

public RequiredPostString ( ) : string
Результат string

RequiredPostValue() публичный Метод

public RequiredPostValue ( string key ) : string
key string
Результат string

Succeeded() публичный Метод

public Succeeded ( ) : void
Результат void

SucceededDoNotNavigate() публичный Метод

public SucceededDoNotNavigate ( ) : void
Результат void

Описание свойств

CurrentBook публичное свойство

public Book.Book CurrentBook
Результат Book.Book

CurrentCollectionSettings публичное свойство

public CollectionSettings,Bloom.Collection CurrentCollectionSettings
Результат Bloom.Collection.CollectionSettings

Parameters публичное свойство

public NameValueCollection,System.Collections.Specialized Parameters
Результат System.Collections.Specialized.NameValueCollection