IEventsClient.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // <copyright file="IEventsClient.cs" company="Google Inc.">
  2. // Copyright (C) 2014 Google Inc.
  3. //
  4. // Licensed under the Apache License, Version 2.0 (the "License");
  5. // you may not use this file except in compliance with the License.
  6. // You may obtain a copy of the License at
  7. //
  8. // http://www.apache.org/licenses/LICENSE-2.0
  9. //
  10. // Unless required by applicable law or agreed to in writing, software
  11. // distributed under the License is distributed on an "AS IS" BASIS,
  12. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. // See the License for the specific language governing permissions and
  14. // limitations under the License.
  15. // </copyright>
  16. #if UNITY_ANDROID
  17. namespace GooglePlayGames.BasicApi.Events
  18. {
  19. using System;
  20. using System.Collections.Generic;
  21. /// <summary>
  22. /// An interface for interacting with events.
  23. ///
  24. /// <para>See online <a href="https://developers.google.com/games/services/common/concepts/events">
  25. /// documentation for Events</a> for more information.</para>
  26. ///
  27. /// All callbacks in this interface must be invoked on the game thread.
  28. /// </summary>
  29. public interface IEventsClient
  30. {
  31. /// <summary>
  32. /// Fetches all events defined for this game.
  33. /// </summary>
  34. /// <param name="source">The source of the event (i.e. whether we can return stale cached
  35. /// values).</param>
  36. /// <param name="callback">A callback for the results of the request. The passed list will only
  37. /// be non-empty if the request succeeded. This callback will be invoked on the game thread.
  38. /// </param>
  39. void FetchAllEvents(DataSource source, Action<ResponseStatus, List<IEvent>> callback);
  40. /// <summary>
  41. /// Fetchs the event with the specified ID.
  42. /// </summary>
  43. /// <param name="source">The source of the event (i.e. whether we can return stale cached
  44. /// values).</param>
  45. /// <param name="eventId">The ID of the event.</param>
  46. /// <param name="callback">A callback for the result of the event. If the request failed, the
  47. /// passed event will be null. This callback will be invoked on the game thread.</param>
  48. void FetchEvent(DataSource source, string eventId, Action<ResponseStatus, IEvent> callback);
  49. /// <summary>
  50. /// Increments the indicated event.
  51. /// </summary>
  52. /// <param name="eventId">The ID of the event to increment.</param>
  53. /// <param name="stepsToIncrement">The number of steps to increment by.</param>
  54. void IncrementEvent(string eventId, uint stepsToIncrement);
  55. }
  56. }
  57. #endif