| | | 1 | | using Microsoft.Azure.CognitiveServices.Personalizer.Models; |
| | | 2 | | using System.Threading; |
| | | 3 | | using System.Threading.Tasks; |
| | | 4 | | |
| | | 5 | | namespace Microsoft.Azure.CognitiveServices.Personalizer |
| | | 6 | | { |
| | | 7 | | /// <summary> |
| | | 8 | | /// Extension methods for Events. |
| | | 9 | | /// </summary> |
| | | 10 | | public static partial class PersonalizerClientExtensions |
| | | 11 | | { |
| | | 12 | | /// <summary> |
| | | 13 | | /// Report reward to allocate to the top ranked action for the specified event. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name='client'> |
| | | 16 | | /// The PersonalizerClient for this extension method. |
| | | 17 | | /// </param> |
| | | 18 | | /// <param name='eventId'> |
| | | 19 | | /// The event id this reward applies to. |
| | | 20 | | /// </param> |
| | | 21 | | /// <param name='reward'> |
| | | 22 | | /// The reward should be a floating point number. |
| | | 23 | | /// </param> |
| | | 24 | | public static void Reward(this IPersonalizerClient client, string eventId, RewardRequest reward) |
| | | 25 | | { |
| | 0 | 26 | | client.Events.Reward(eventId, reward); |
| | 0 | 27 | | } |
| | | 28 | | |
| | | 29 | | /// <summary> |
| | | 30 | | /// Report reward to allocate to the top ranked action for the specified event. |
| | | 31 | | /// </summary> |
| | | 32 | | /// <param name='client'> |
| | | 33 | | /// The PersonalizerClient for this extension method. |
| | | 34 | | /// </param> |
| | | 35 | | /// <param name='eventId'> |
| | | 36 | | /// The event id this reward applies to. |
| | | 37 | | /// </param> |
| | | 38 | | /// <param name='reward'> |
| | | 39 | | /// The reward to be assigned to an action. Value must be |
| | 0 | 40 | | /// between -1 and 1 inclusive. |
| | | 41 | | /// </param> |
| | | 42 | | public static void Reward(this IPersonalizerClient client, string eventId, double reward) |
| | | 43 | | { |
| | 0 | 44 | | client.Events.Reward(eventId, new RewardRequest { Value = reward }); |
| | 0 | 45 | | } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// Report reward to allocate to the top ranked action for the specified event. |
| | | 49 | | /// </summary> |
| | | 50 | | /// <param name='client'> |
| | | 51 | | /// The PersonalizerClient for this extension method. |
| | | 52 | | /// </param> |
| | | 53 | | /// <param name='eventId'> |
| | | 54 | | /// The event id this reward applies to. |
| | | 55 | | /// </param> |
| | | 56 | | /// <param name='reward'> |
| | | 57 | | /// The reward should be a floating point number. |
| | | 58 | | /// </param> |
| | | 59 | | /// <param name='cancellationToken'> |
| | | 60 | | /// The cancellation token. |
| | 2 | 61 | | /// </param> |
| | | 62 | | public static Task RewardAsync(this IPersonalizerClient client, string eventId, RewardRequest reward, Cancellati |
| | 2 | 63 | | { |
| | 2 | 64 | | return client.Events.RewardAsync(eventId, reward, cancellationToken); |
| | 2 | 65 | | } |
| | | 66 | | |
| | | 67 | | /// <summary> |
| | | 68 | | /// Report reward to allocate to the top ranked action for the specified event. |
| | | 69 | | /// </summary> |
| | | 70 | | /// <param name='client'> |
| | | 71 | | /// The PersonalizerClient for this extension method. |
| | | 72 | | /// </param> |
| | | 73 | | /// <param name='eventId'> |
| | | 74 | | /// The event id this reward applies to. |
| | | 75 | | /// </param> |
| | | 76 | | /// <param name='reward'> |
| | | 77 | | /// The reward to be assigned to an action. Value must be |
| | | 78 | | /// between -1 and 1 inclusive. |
| | | 79 | | /// </param> |
| | | 80 | | /// <param name='cancellationToken'> |
| | | 81 | | /// The cancellation token. |
| | | 82 | | /// </param> |
| | | 83 | | public static Task RewardAsync(this IPersonalizerClient client, string eventId, double reward, CancellationToken |
| | | 84 | | { |
| | 0 | 85 | | return client.Events.RewardAsync(eventId, new RewardRequest { Value = reward }, cancellationToken); |
| | | 86 | | } |
| | | 87 | | } |
| | | 88 | | } |