C# Класс GoogleCloudSamples.Services.BookDetailLookup

A library for the background task of looking up a book in Google's books API.
Показать файл Открыть проект Примеры использования класса

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

Метод Описание
BookDetailLookup ( string projectId, Options options = null, ISimpleLogger logger = null ) : Google.Api.Gax
CreateTopicAndSubscription ( ) : void

Creates the topic and subscription, if they don't already exist. You should call this once at the beginning of your app.

EnqueueBook ( long bookId ) : void

Publish a message asking for a book to be processed.

ParseDate ( string dateString ) : DateTime?

Parse a date time. Return null if it can't be parsed. A single number will be interpreted as a year, and the date returned will be YEAR-01-01.

ProcessBook ( IBookStore bookStore, long bookId ) : void

Look up a book in Google's Books API. Update the book in the book store.

PullLoop ( Action callback, CancellationToken cancellationToken ) : void

Pulls books from the queue and invokes your callback for each book.

StartPullLoop ( IBookStore bookStore, CancellationToken cancellationToken ) : Task
UpdateBookFromJson ( string json, Book book ) : void

Updates book with information parsed from a json response from Google's Books API.

Приватные методы

Метод Описание
PullOnce ( Action callback, CancellationToken cancellationToken ) : void

Makes one call to PubSub.Pull to pull some books from the subscription.

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

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

public BookDetailLookup ( string projectId, Options options = null, ISimpleLogger logger = null ) : Google.Api.Gax
projectId string
options Options
logger ISimpleLogger
Результат Google.Api.Gax

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

Creates the topic and subscription, if they don't already exist. You should call this once at the beginning of your app.
public CreateTopicAndSubscription ( ) : void
Результат void

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

Publish a message asking for a book to be processed.
public EnqueueBook ( long bookId ) : void
bookId long
Результат void

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

Parse a date time. Return null if it can't be parsed. A single number will be interpreted as a year, and the date returned will be YEAR-01-01.
public static ParseDate ( string dateString ) : DateTime?
dateString string A string representation of the date.
Результат DateTime?

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

Look up a book in Google's Books API. Update the book in the book store.
public ProcessBook ( IBookStore bookStore, long bookId ) : void
bookStore IBookStore Where the book is stored.
bookId long The id of the book to look up.
Результат void

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

Pulls books from the queue and invokes your callback for each book.
public PullLoop ( Action callback, CancellationToken cancellationToken ) : void
callback Action This callback will be invoked for every book. /// Must be thread safe.
cancellationToken System.Threading.CancellationToken Stop looking by cancelling this token. /// Must not be null.
Результат void

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

public StartPullLoop ( IBookStore bookStore, CancellationToken cancellationToken ) : Task
bookStore IBookStore
cancellationToken System.Threading.CancellationToken
Результат Task

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

Updates book with information parsed from a json response from Google's Books API.
public static UpdateBookFromJson ( string json, Book book ) : void
json string A response from Google's Books API.
book GoogleCloudSamples.Models.Book Fields in book will be overwritten.
Результат void