C# Class PhotoSharingApp.Universal.Services.ServiceClient

The service client that hits the real service via HTTP(S).
Inheritance: IPhotoService
Mostrar archivo Open project: Microsoft/Appsample-Photosharing Class Usage Examples

Public Methods

Method Description
CreateCategory ( string categoryName ) : Task

Creates a new category.

DeletePhoto ( Photo photo ) : System.Threading.Tasks.Task

Deletes the photo.

FulfillGold ( string productReceipt ) : Task

Fulfills gold on the service.

GetAvailableAuthenticationProviders ( ) : List

Gets the available authentication providers.

GetCategories ( ) : Task>

Retrieves all categories without thumbnails.

GetConfig ( ) : Task

Gets the configuration data.

GetCurrentUser ( ) : Task

Gets the current user.

GetHeroImages ( int count ) : Task>

Retrieves hero images.

GetLeaderboardData ( int mostGoldCategoriesCount, int mostGoldPhotosCount, int mostGoldUsersCount, int mostGivingUsersCount ) : Task

Gets the leaderboard statistical data

GetPhotoDetails ( string photoId ) : Task

Gets the photo details for the given photo id.

GetPhotosForCategoryId ( string categoryId, string continuationToken = null ) : Task>

Gets photos for the given category id.

GetPhotosForCurrentUser ( string continuationToken = null ) : Task>

Gets photos uploaded by the current user.

GetPhotosForUser ( User user, string continuationToken = null ) : Task>

Gets photos uploaded by the specified user.

GetSasUrls ( ) : Task>

Retrieves SAS Urls for uploading photos.

GetTopCategories ( int categoryThumbnailsCount, string continuationToken = null ) : Task>

Retrieves top categories with thumbnails.

PostAnnotation ( Photo photo, string annotationText, int goldCount ) : Task

Posts the annotation.

RemoveAnnotation ( Annotation annotation ) : System.Threading.Tasks.Task

Removes the Annotation.

ReportAnnotation ( Annotation annotation ) : System.Threading.Tasks.Task

Reports the Annotation as inappropriate.

ReportPhoto ( Photo photo, ReportReason reportReason ) : System.Threading.Tasks.Task

Reports the photo as inappropriate.

RestoreSignInStatusAsync ( ) : System.Threading.Tasks.Task

Checks if credentials are available and not expired, which are then used to restore the sign in status. Registers the user for Push notifications. The user is not actively taken to a login page.

ServiceClient ( IAuthenticationHandler authenticationHandler ) : System

Initializes a new instance of the ServiceClient class.

SignInAsync ( MobileServiceAuthenticationProvider provider ) : System.Threading.Tasks.Task

Signs the user in and registers the user for Push notifications.

SignOutAsync ( ) : System.Threading.Tasks.Task

Signs out user and deletes push notification registration.

UpdatePhoto ( Photo photo ) : System.Threading.Tasks.Task

Updates the photo.

UpdateUserProfilePhoto ( Photo photo ) : Task

Updates the current user's profile photo

UploadPhoto ( Stream stream, string localPath, string caption, string categoryId ) : Task

Uploads the photo.

Private Methods

Method Description
RegisterForNotifications ( ) : void

Registers the signed in user on the device for push notifications

TryGetServiceFault ( string serializedContent ) : ServiceFaultContract

Method Details

CreateCategory() public method

Creates a new category.
public CreateCategory ( string categoryName ) : Task
categoryName string The category name.
return Task

DeletePhoto() public method

Deletes the photo.
public DeletePhoto ( Photo photo ) : System.Threading.Tasks.Task
photo PhotoSharingApp.Universal.Models.Photo The photo.
return System.Threading.Tasks.Task

FulfillGold() public method

Fulfills gold on the service.
public FulfillGold ( string productReceipt ) : Task
productReceipt string The product receipt.
return Task

GetAvailableAuthenticationProviders() public method

Gets the available authentication providers.
public GetAvailableAuthenticationProviders ( ) : List
return List

GetCategories() public method

Retrieves all categories without thumbnails.
public GetCategories ( ) : Task>
return Task>

GetConfig() public method

Gets the configuration data.
public GetConfig ( ) : Task
return Task

GetCurrentUser() public method

Gets the current user.
public GetCurrentUser ( ) : Task
return Task

GetHeroImages() public method

Retrieves hero images.
public GetHeroImages ( int count ) : Task>
count int Number of hero images.
return Task>

GetLeaderboardData() public method

Gets the leaderboard statistical data
public GetLeaderboardData ( int mostGoldCategoriesCount, int mostGoldPhotosCount, int mostGoldUsersCount, int mostGivingUsersCount ) : Task
mostGoldCategoriesCount int
mostGoldPhotosCount int
mostGoldUsersCount int
mostGivingUsersCount int
return Task

GetPhotoDetails() public method

Gets the photo details for the given photo id.
public GetPhotoDetails ( string photoId ) : Task
photoId string The photo identifier.
return Task

GetPhotosForCategoryId() public method

Gets photos for the given category id.
public GetPhotosForCategoryId ( string categoryId, string continuationToken = null ) : Task>
categoryId string The identifier.
continuationToken string Optional. The continuation token. By default, null.
return Task>

GetPhotosForCurrentUser() public method

Gets photos uploaded by the current user.
public GetPhotosForCurrentUser ( string continuationToken = null ) : Task>
continuationToken string Optional. The continuation token. By default, null.
return Task>

GetPhotosForUser() public method

Gets photos uploaded by the specified user.
public GetPhotosForUser ( User user, string continuationToken = null ) : Task>
user PhotoSharingApp.Universal.Models.User The user.
continuationToken string Optional. The continuation token. By default, null.
return Task>

GetSasUrls() public method

Retrieves SAS Urls for uploading photos.
public GetSasUrls ( ) : Task>
return Task>

GetTopCategories() public method

Retrieves top categories with thumbnails.
public GetTopCategories ( int categoryThumbnailsCount, string continuationToken = null ) : Task>
categoryThumbnailsCount int The number of thumbnails per each category.
continuationToken string Optional. The continuation token. By default, null.
return Task>

PostAnnotation() public method

Posts the annotation.
public PostAnnotation ( Photo photo, string annotationText, int goldCount ) : Task
photo PhotoSharingApp.Universal.Models.Photo The photo.
annotationText string The text.
goldCount int The amount of gold being given.
return Task

RemoveAnnotation() public method

Removes the Annotation.
public RemoveAnnotation ( Annotation annotation ) : System.Threading.Tasks.Task
annotation PhotoSharingApp.Universal.Models.Annotation The Annotation.
return System.Threading.Tasks.Task

ReportAnnotation() public method

Reports the Annotation as inappropriate.
public ReportAnnotation ( Annotation annotation ) : System.Threading.Tasks.Task
annotation PhotoSharingApp.Universal.Models.Annotation The annotation to report.
return System.Threading.Tasks.Task

ReportPhoto() public method

Reports the photo as inappropriate.
public ReportPhoto ( Photo photo, ReportReason reportReason ) : System.Threading.Tasks.Task
photo PhotoSharingApp.Universal.Models.Photo The photo to report.
reportReason ReportReason The reason for the report.
return System.Threading.Tasks.Task

RestoreSignInStatusAsync() public method

Checks if credentials are available and not expired, which are then used to restore the sign in status. Registers the user for Push notifications. The user is not actively taken to a login page.
public RestoreSignInStatusAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

ServiceClient() public method

Initializes a new instance of the ServiceClient class.
public ServiceClient ( IAuthenticationHandler authenticationHandler ) : System
authenticationHandler IAuthenticationHandler The authentication handler.
return System

SignInAsync() public method

Signs the user in and registers the user for Push notifications.
public SignInAsync ( MobileServiceAuthenticationProvider provider ) : System.Threading.Tasks.Task
provider MobileServiceAuthenticationProvider The provider.
return System.Threading.Tasks.Task

SignOutAsync() public method

Signs out user and deletes push notification registration.
public SignOutAsync ( ) : System.Threading.Tasks.Task
return System.Threading.Tasks.Task

UpdatePhoto() public method

Updates the photo.
public UpdatePhoto ( Photo photo ) : System.Threading.Tasks.Task
photo PhotoSharingApp.Universal.Models.Photo The photo.
return System.Threading.Tasks.Task

UpdateUserProfilePhoto() public method

Updates the current user's profile photo
public UpdateUserProfilePhoto ( Photo photo ) : Task
photo PhotoSharingApp.Universal.Models.Photo The new profile photo
return Task

UploadPhoto() public method

Uploads the photo.
public UploadPhoto ( Stream stream, string localPath, string caption, string categoryId ) : Task
stream Stream The memory stream.
localPath string The local path.
caption string The caption.
categoryId string The id of the assocaited category.
return Task