Class AchievementPushGuard
What a push checks before it sends anything, because the storefront checks nothing: it accepts a name with spaces, a name another achievement already has, and a save for a name it lists twice.
Inherited Members
Namespace: Serenity.Achievements.Application.Sync
Assembly: Serenity.Achievements.Application.dll
Syntax
public static class AchievementPushGuard
Remarks
A push is refused as a whole, not trimmed, when any achievement it would send is in trouble — a half-sent batch is harder to reason about than none. Three things refuse it, each naming the achievements involved: a name the authoring rules do not take (IsValidStorefrontIdentifier(string)); two project achievements mapped to the same storefront name; and a name the storefront itself lists more than once, which the pulled snapshot already warned about and which makes a save ambiguous until it is renamed there.
Methods
RefusalsFor(AchievementPlatformKind, IReadOnlyList<AchievementPushWorkItem>, IReadOnlyList<AchievementSyncRecord>, AchievementStorefrontSnapshot)
The reasons a push of workItems must not be sent; empty when it may be.
Declaration
public static IReadOnlyList<string> RefusalsFor(AchievementPlatformKind platform, IReadOnlyList<AchievementPushWorkItem> workItems, IReadOnlyList<AchievementSyncRecord> authoredRecords, AchievementStorefrontSnapshot snapshot)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | platform | The storefront the push is for. |
| IReadOnlyList<AchievementPushWorkItem> | workItems | The work the push would send. |
| IReadOnlyList<AchievementSyncRecord> | authoredRecords | Every authored achievement, so a name shared with one that is not being sent still counts. |
| AchievementStorefrontSnapshot | snapshot | The storefront's list as last pulled; null when nothing was pulled. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<string> |
RefusalsForNames(AchievementPlatformKind, IEnumerable<string>, IReadOnlyList<AchievementSyncRecord>, AchievementStorefrontSnapshot)
The reasons a push of the achievements named apiNames must not be sent. Sending them over the
storefront's API and handing them to the author to type in by hand are both pushes: a walkthrough must not hand
the author a name the guard refuses.
Declaration
public static IReadOnlyList<string> RefusalsForNames(AchievementPlatformKind platform, IEnumerable<string> apiNames, IReadOnlyList<AchievementSyncRecord> authoredRecords, AchievementStorefrontSnapshot snapshot)
Parameters
| Type | Name | Description |
|---|---|---|
| AchievementPlatformKind | platform | The storefront the push is for. |
| IEnumerable<string> | apiNames | The storefront names of the achievements the push covers. |
| IReadOnlyList<AchievementSyncRecord> | authoredRecords | Every authored achievement, so a name shared with one that is not being sent still counts. |
| AchievementStorefrontSnapshot | snapshot | The storefront's list as last pulled; null when nothing was pulled. |
Returns
| Type | Description |
|---|---|
| IReadOnlyList<string> |