trophy_api_client 1.14.0 → 1.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.fern/metadata.json +9 -0
- data/.rubocop.yml +103 -0
- data/CONTRIBUTING.md +120 -0
- data/LICENSE +21 -0
- data/README.md +50 -0
- data/Rakefile +13 -0
- data/custom.gemspec.rb +5 -0
- data/lib/gemconfig.rb +1 -1
- data/lib/trophy/achievements/client.rb +93 -0
- data/lib/trophy/achievements/types/achievements_all_request.rb +11 -0
- data/lib/trophy/achievements/types/achievements_complete_request.rb +13 -0
- data/lib/trophy/admin/achievements/client.rb +201 -0
- data/lib/trophy/admin/achievements/types/achievements_delete_request.rb +13 -0
- data/lib/trophy/admin/achievements/types/achievements_list_request.rb +15 -0
- data/lib/trophy/admin/application_api_keys/client.rb +93 -0
- data/lib/trophy/admin/application_api_keys/types/application_api_keys_delete_request.rb +13 -0
- data/lib/trophy/admin/attributes/client.rb +200 -0
- data/lib/trophy/admin/attributes/types/attributes_delete_request.rb +13 -0
- data/lib/trophy/admin/attributes/types/attributes_list_request.rb +15 -0
- data/lib/trophy/admin/client.rb +68 -0
- data/lib/trophy/admin/environments/client.rb +52 -0
- data/lib/trophy/admin/leaderboards/client.rb +201 -0
- data/lib/trophy/admin/leaderboards/types/leaderboards_delete_request.rb +13 -0
- data/lib/trophy/admin/leaderboards/types/leaderboards_list_request.rb +15 -0
- data/lib/trophy/admin/metrics/client.rb +234 -0
- data/lib/trophy/admin/metrics/types/metrics_delete_request.rb +13 -0
- data/lib/trophy/admin/metrics/types/metrics_list_request.rb +15 -0
- data/lib/trophy/admin/points/boosts/client.rb +207 -0
- data/lib/trophy/admin/points/boosts/types/boosts_delete_request.rb +17 -0
- data/lib/trophy/admin/points/boosts/types/boosts_list_request.rb +19 -0
- data/lib/trophy/admin/points/client.rb +40 -0
- data/lib/trophy/admin/points/levels/client.rb +207 -0
- data/lib/trophy/admin/points/levels/types/levels_delete_request.rb +17 -0
- data/lib/trophy/admin/points/levels/types/levels_list_request.rb +19 -0
- data/lib/trophy/admin/points/systems/client.rb +203 -0
- data/lib/trophy/admin/points/systems/types/systems_delete_request.rb +15 -0
- data/lib/trophy/admin/points/systems/types/systems_list_request.rb +17 -0
- data/lib/trophy/admin/points/triggers/client.rb +208 -0
- data/lib/trophy/admin/points/triggers/types/triggers_delete_request.rb +17 -0
- data/lib/trophy/admin/points/triggers/types/triggers_list_request.rb +19 -0
- data/lib/trophy/admin/settings/client.rb +86 -0
- data/lib/trophy/admin/settings/types/update_admin_settings_request.rb +17 -0
- data/lib/trophy/admin/streaks/client.rb +106 -0
- data/lib/trophy/admin/streaks/freezes/client.rb +56 -0
- data/lib/trophy/admin/streaks/freezes/types/create_streak_freezes_request.rb +15 -0
- data/lib/trophy/admin/streaks/freezes/types/create_streak_freezes_request_freezes_item.rb +15 -0
- data/lib/trophy/admin/streaks/pauses/client.rb +95 -0
- data/lib/trophy/admin/streaks/pauses/types/create_streak_pauses_request.rb +15 -0
- data/lib/trophy/admin/streaks/pauses/types/create_streak_pauses_request_pauses_item.rb +19 -0
- data/lib/trophy/admin/streaks/pauses/types/pauses_delete_request.rb +15 -0
- data/lib/trophy/admin/streaks/settings/client.rb +88 -0
- data/lib/trophy/admin/streaks/settings/types/update_streak_settings_request.rb +25 -0
- data/lib/trophy/admin/streaks/types/reset_streaks_request.rb +13 -0
- data/lib/trophy/admin/streaks/types/reset_streaks_request_users_item.rb +13 -0
- data/lib/trophy/admin/streaks/types/restore_streaks_request.rb +13 -0
- data/lib/trophy/admin/streaks/types/restore_streaks_request_users_item.rb +13 -0
- data/lib/trophy/admin/tenants/client.rb +200 -0
- data/lib/trophy/admin/tenants/types/tenants_delete_request.rb +13 -0
- data/lib/trophy/admin/tenants/types/tenants_list_request.rb +15 -0
- data/lib/trophy/client.rb +62 -0
- data/lib/{environment.rb → trophy/environment.rb} +1 -1
- data/lib/trophy/errors/api_error.rb +8 -0
- data/lib/trophy/errors/client_error.rb +17 -0
- data/lib/trophy/errors/redirect_error.rb +8 -0
- data/lib/trophy/errors/response_error.rb +42 -0
- data/lib/trophy/errors/server_error.rb +11 -0
- data/lib/trophy/errors/timeout_error.rb +8 -0
- data/lib/trophy/internal/errors/constraint_error.rb +10 -0
- data/lib/trophy/internal/errors/type_error.rb +10 -0
- data/lib/trophy/internal/http/base_request.rb +51 -0
- data/lib/trophy/internal/http/raw_client.rb +215 -0
- data/lib/trophy/internal/iterators/cursor_item_iterator.rb +28 -0
- data/lib/trophy/internal/iterators/cursor_page_iterator.rb +63 -0
- data/lib/trophy/internal/iterators/item_iterator.rb +65 -0
- data/lib/trophy/internal/iterators/offset_item_iterator.rb +30 -0
- data/lib/trophy/internal/iterators/offset_page_iterator.rb +103 -0
- data/lib/trophy/internal/json/request.rb +41 -0
- data/lib/trophy/internal/json/serializable.rb +25 -0
- data/lib/trophy/internal/multipart/multipart_encoder.rb +141 -0
- data/lib/trophy/internal/multipart/multipart_form_data.rb +78 -0
- data/lib/trophy/internal/multipart/multipart_form_data_part.rb +51 -0
- data/lib/trophy/internal/multipart/multipart_request.rb +40 -0
- data/lib/trophy/internal/types/array.rb +47 -0
- data/lib/trophy/internal/types/boolean.rb +34 -0
- data/lib/trophy/internal/types/enum.rb +56 -0
- data/lib/trophy/internal/types/hash.rb +36 -0
- data/lib/trophy/internal/types/model/field.rb +38 -0
- data/lib/trophy/internal/types/model.rb +208 -0
- data/lib/trophy/internal/types/type.rb +35 -0
- data/lib/trophy/internal/types/union.rb +161 -0
- data/lib/trophy/internal/types/unknown.rb +15 -0
- data/lib/trophy/internal/types/utils.rb +116 -0
- data/lib/trophy/leaderboards/client.rb +101 -0
- data/lib/trophy/leaderboards/types/leaderboards_all_request.rb +11 -0
- data/lib/trophy/leaderboards/types/leaderboards_all_response_item.rb +47 -0
- data/lib/trophy/leaderboards/types/leaderboards_all_response_item_status.rb +15 -0
- data/lib/trophy/leaderboards/types/leaderboards_get_request.rb +21 -0
- data/lib/trophy/metrics/client.rb +62 -0
- data/lib/trophy/metrics/types/metrics_event_request.rb +19 -0
- data/lib/trophy/points/client.rb +194 -0
- data/lib/trophy/points/types/points_boosts_request.rb +13 -0
- data/lib/trophy/points/types/points_summary_request.rb +13 -0
- data/lib/trophy/streaks/client.rb +56 -0
- data/lib/trophy/streaks/types/streaks_list_request.rb +11 -0
- data/lib/trophy/types/achievement_completion_response.rb +13 -0
- data/lib/trophy/types/achievement_response.rb +37 -0
- data/lib/trophy/types/achievement_response_event_attribute.rb +13 -0
- data/lib/trophy/types/achievement_response_event_attributes_item.rb +11 -0
- data/lib/trophy/types/achievement_response_trigger.rb +15 -0
- data/lib/trophy/types/achievement_response_user_attributes_item.rb +11 -0
- data/lib/trophy/types/achievement_with_stats_response.rb +41 -0
- data/lib/trophy/types/admin_achievement.rb +37 -0
- data/lib/trophy/types/admin_achievement_badge.rb +9 -0
- data/lib/trophy/types/admin_achievement_event_attributes_item.rb +11 -0
- data/lib/trophy/types/admin_achievement_status.rb +13 -0
- data/lib/trophy/types/admin_achievement_trigger.rb +15 -0
- data/lib/trophy/types/admin_achievement_user_attributes_item.rb +11 -0
- data/lib/trophy/types/admin_aggregation_period.rb +12 -0
- data/lib/trophy/types/admin_attribute.rb +16 -0
- data/lib/trophy/types/admin_attribute_type.rb +12 -0
- data/lib/trophy/types/admin_environment.rb +14 -0
- data/lib/trophy/types/admin_error_body.rb +9 -0
- data/lib/trophy/types/admin_font_family.rb +19 -0
- data/lib/trophy/types/admin_issue.rb +20 -0
- data/lib/trophy/types/admin_issue_severity.rb +12 -0
- data/lib/trophy/types/admin_leaderboard.rb +40 -0
- data/lib/trophy/types/admin_leaderboard_rank_by.rb +13 -0
- data/lib/trophy/types/admin_leaderboard_run_unit.rb +13 -0
- data/lib/trophy/types/admin_leaderboard_status.rb +14 -0
- data/lib/trophy/types/admin_points_boost.rb +26 -0
- data/lib/trophy/types/admin_points_boost_rounding.rb +13 -0
- data/lib/{trophy_api_client/leaderboards/types/leaderboards_all_response_item_status.rb → trophy/types/admin_points_boost_status.rb} +5 -4
- data/lib/trophy/types/admin_points_boost_user_attributes_item.rb +11 -0
- data/lib/trophy/types/admin_points_level.rb +20 -0
- data/lib/trophy/types/admin_points_level_badge.rb +9 -0
- data/lib/trophy/types/admin_points_system.rb +22 -0
- data/lib/trophy/types/admin_points_system_badge.rb +9 -0
- data/lib/trophy/types/admin_points_system_status.rb +12 -0
- data/lib/trophy/types/admin_points_trigger.rb +34 -0
- data/lib/trophy/types/admin_points_trigger_event_attributes_item.rb +11 -0
- data/lib/trophy/types/admin_points_trigger_status.rb +12 -0
- data/lib/trophy/types/admin_points_trigger_time_unit.rb +12 -0
- data/lib/trophy/types/admin_points_trigger_type.rb +15 -0
- data/lib/trophy/types/admin_points_trigger_user_attributes_item.rb +11 -0
- data/lib/trophy/types/admin_settings.rb +14 -0
- data/lib/trophy/types/admin_settings_branding.rb +20 -0
- data/lib/trophy/types/admin_settings_branding_app_icon.rb +9 -0
- data/lib/trophy/types/admin_settings_branding_logo.rb +9 -0
- data/lib/trophy/types/admin_settings_experimentation.rb +12 -0
- data/lib/trophy/types/admin_streak_evaluation_mode.rb +12 -0
- data/lib/{trophy_api_client/users/types/users_points_event_summary_request_aggregation.rb → trophy/types/admin_streak_frequency.rb} +5 -3
- data/lib/trophy/types/admin_streak_pause.rb +18 -0
- data/lib/trophy/types/admin_streak_pause_status.rb +12 -0
- data/lib/trophy/types/admin_tenant.rb +20 -0
- data/lib/trophy/types/admin_tenant_status.rb +12 -0
- data/lib/trophy/types/base_streak_response.rb +27 -0
- data/lib/trophy/types/batch_events_response.rb +10 -0
- data/lib/trophy/types/batch_metric_event.rb +19 -0
- data/lib/trophy/types/batch_metric_event_user.rb +22 -0
- data/lib/trophy/types/bulk_streak_response.rb +23 -0
- data/lib/trophy/types/bulk_streak_response_item.rb +13 -0
- data/lib/trophy/types/create_achievement_request_item.rb +35 -0
- data/lib/trophy/types/create_achievement_request_item_badge.rb +10 -0
- data/lib/trophy/types/create_achievement_request_item_event_attributes_item.rb +11 -0
- data/lib/trophy/types/create_achievement_request_item_status.rb +13 -0
- data/lib/trophy/types/create_achievement_request_item_trigger.rb +15 -0
- data/lib/trophy/types/create_achievement_request_item_user_attributes_item.rb +11 -0
- data/lib/trophy/types/create_achievements_request.rb +23 -0
- data/lib/trophy/types/create_achievements_response.rb +12 -0
- data/lib/trophy/types/create_application_key_request_item.rb +10 -0
- data/lib/trophy/types/create_application_keys_request.rb +23 -0
- data/lib/trophy/types/create_application_keys_response.rb +12 -0
- data/lib/trophy/types/create_attribute_request_item.rb +14 -0
- data/lib/trophy/types/create_attribute_request_item_type.rb +12 -0
- data/lib/trophy/types/create_attributes_request.rb +23 -0
- data/lib/trophy/types/create_attributes_response.rb +12 -0
- data/lib/trophy/types/create_leaderboard_request_item.rb +38 -0
- data/lib/trophy/types/create_leaderboard_request_item_rank_by.rb +13 -0
- data/lib/trophy/types/create_leaderboard_request_item_run_unit.rb +13 -0
- data/lib/trophy/types/create_leaderboard_request_item_status.rb +14 -0
- data/lib/trophy/types/create_leaderboards_request.rb +23 -0
- data/lib/trophy/types/create_leaderboards_response.rb +12 -0
- data/lib/trophy/types/create_metric_request_item.rb +16 -0
- data/lib/trophy/types/create_metric_request_item_unit_type.rb +12 -0
- data/lib/trophy/types/create_metrics_request.rb +23 -0
- data/lib/trophy/types/create_metrics_response.rb +12 -0
- data/lib/trophy/types/create_points_boost_request_item.rb +23 -0
- data/lib/trophy/types/create_points_boost_request_item_rounding.rb +13 -0
- data/lib/trophy/types/create_points_boost_request_item_user_attributes_item.rb +11 -0
- data/lib/trophy/types/create_points_boosts_request.rb +23 -0
- data/lib/trophy/types/create_points_boosts_response.rb +12 -0
- data/lib/trophy/types/create_points_level_request_item.rb +18 -0
- data/lib/trophy/types/create_points_level_request_item_badge.rb +10 -0
- data/lib/trophy/types/create_points_levels_request.rb +23 -0
- data/lib/trophy/types/create_points_levels_response.rb +12 -0
- data/lib/trophy/types/create_points_system_request_item.rb +24 -0
- data/lib/trophy/types/create_points_system_request_item_badge.rb +9 -0
- data/lib/trophy/types/create_points_systems_request.rb +23 -0
- data/lib/trophy/types/create_points_systems_response.rb +12 -0
- data/lib/trophy/types/create_points_trigger_request_item.rb +32 -0
- data/lib/trophy/types/create_points_trigger_request_item_event_attributes_item.rb +11 -0
- data/lib/trophy/types/create_points_trigger_request_item_status.rb +12 -0
- data/lib/trophy/types/create_points_trigger_request_item_time_unit.rb +12 -0
- data/lib/trophy/types/create_points_trigger_request_item_type.rb +15 -0
- data/lib/trophy/types/create_points_trigger_request_item_user_attributes_item.rb +11 -0
- data/lib/trophy/types/create_points_triggers_request.rb +23 -0
- data/lib/trophy/types/create_points_triggers_response.rb +12 -0
- data/lib/trophy/types/create_streak_freezes_response.rb +10 -0
- data/lib/trophy/types/create_streak_pauses_response.rb +12 -0
- data/lib/trophy/types/create_tenant_request_item.rb +12 -0
- data/lib/trophy/types/create_tenants_request.rb +23 -0
- data/lib/trophy/types/create_tenants_response.rb +12 -0
- data/lib/trophy/types/created_admin_points_system.rb +29 -0
- data/lib/trophy/types/created_application_key.rb +16 -0
- data/lib/trophy/types/created_metric.rb +18 -0
- data/lib/trophy/types/created_metric_unit_type.rb +12 -0
- data/lib/trophy/types/delete_achievements_response.rb +13 -0
- data/lib/trophy/types/delete_application_keys_response.rb +12 -0
- data/lib/trophy/types/delete_attributes_response.rb +13 -0
- data/lib/trophy/types/delete_leaderboards_response.rb +12 -0
- data/lib/trophy/types/delete_metrics_response.rb +13 -0
- data/lib/trophy/types/delete_points_boosts_response.rb +12 -0
- data/lib/trophy/types/delete_points_levels_response.rb +12 -0
- data/lib/trophy/types/delete_points_systems_response.rb +12 -0
- data/lib/trophy/types/delete_points_triggers_response.rb +12 -0
- data/lib/trophy/types/delete_streak_pauses_response.rb +12 -0
- data/lib/trophy/types/delete_tenants_response.rb +12 -0
- data/lib/trophy/types/deleted_resource.rb +10 -0
- data/lib/trophy/types/error_body.rb +9 -0
- data/lib/trophy/types/event_response.rb +25 -0
- data/lib/trophy/types/get_user_points_response.rb +25 -0
- data/lib/trophy/types/leaderboard_event.rb +20 -0
- data/lib/trophy/types/leaderboard_ranking.rb +16 -0
- data/lib/trophy/types/leaderboard_response.rb +44 -0
- data/lib/trophy/types/leaderboard_response_rank_by.rb +13 -0
- data/lib/trophy/types/leaderboard_response_run_unit.rb +13 -0
- data/lib/trophy/types/leaderboard_response_with_rankings.rb +47 -0
- data/lib/trophy/types/leaderboard_response_with_rankings_status.rb +13 -0
- data/lib/trophy/types/list_achievements_response.rb +23 -0
- data/lib/trophy/types/list_attributes_response.rb +23 -0
- data/lib/trophy/types/list_environments_response.rb +23 -0
- data/lib/trophy/types/list_leaderboards_response.rb +23 -0
- data/lib/trophy/types/list_metrics_response.rb +23 -0
- data/lib/trophy/types/list_points_boosts_response.rb +23 -0
- data/lib/trophy/types/list_points_levels_response.rb +23 -0
- data/lib/trophy/types/list_points_systems_response.rb +23 -0
- data/lib/trophy/types/list_points_triggers_response.rb +23 -0
- data/lib/trophy/types/list_tenants_response.rb +23 -0
- data/lib/trophy/types/metric_event_leaderboard_response.rb +53 -0
- data/lib/trophy/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +11 -0
- data/lib/trophy/types/metric_event_points_response.rb +28 -0
- data/lib/trophy/types/metric_event_streak_response.rb +30 -0
- data/lib/trophy/types/metric_response.rb +17 -0
- data/lib/trophy/types/notification_channel.rb +12 -0
- data/lib/trophy/types/notification_preferences.rb +16 -0
- data/lib/trophy/types/patch_points_boosts_request.rb +23 -0
- data/lib/trophy/types/patch_points_boosts_request_item.rb +21 -0
- data/lib/trophy/types/patch_points_boosts_request_item_rounding.rb +13 -0
- data/lib/trophy/types/patch_points_boosts_request_item_user_attributes_item.rb +11 -0
- data/lib/trophy/types/patch_points_boosts_response.rb +12 -0
- data/lib/trophy/types/patch_points_levels_request.rb +23 -0
- data/lib/trophy/types/patch_points_levels_request_item.rb +17 -0
- data/lib/trophy/types/patch_points_levels_request_item_badge.rb +9 -0
- data/lib/trophy/types/patch_points_levels_response.rb +12 -0
- data/lib/trophy/types/patch_points_triggers_request.rb +23 -0
- data/lib/trophy/types/patch_points_triggers_request_item.rb +33 -0
- data/lib/trophy/types/patch_points_triggers_request_item_event_attributes_item.rb +11 -0
- data/lib/trophy/types/patch_points_triggers_request_item_status.rb +12 -0
- data/lib/trophy/types/patch_points_triggers_request_item_time_unit.rb +12 -0
- data/lib/trophy/types/patch_points_triggers_request_item_type.rb +15 -0
- data/lib/trophy/types/patch_points_triggers_request_item_user_attributes_item.rb +11 -0
- data/lib/trophy/types/patch_points_triggers_response.rb +12 -0
- data/lib/trophy/types/points_award.rb +19 -0
- data/lib/trophy/types/points_boost.rb +21 -0
- data/lib/trophy/types/points_boost_rounding.rb +13 -0
- data/lib/trophy/types/points_boost_status.rb +13 -0
- data/lib/trophy/types/points_boost_webhook_payload.rb +30 -0
- data/lib/trophy/types/points_boost_webhook_payload_rounding.rb +13 -0
- data/lib/trophy/types/points_boost_webhook_payload_status.rb +12 -0
- data/lib/trophy/types/points_level.rb +20 -0
- data/lib/trophy/types/points_level_summary_response.rb +23 -0
- data/lib/trophy/types/points_level_summary_response_item.rb +11 -0
- data/lib/trophy/types/points_range.rb +13 -0
- data/lib/trophy/types/points_response.rb +20 -0
- data/lib/trophy/types/points_summary_response.rb +23 -0
- data/lib/trophy/types/points_system_response.rb +19 -0
- data/lib/trophy/types/points_trigger.rb +41 -0
- data/lib/trophy/types/points_trigger_event_attribute.rb +13 -0
- data/lib/trophy/types/points_trigger_event_attributes_item.rb +11 -0
- data/lib/trophy/types/points_trigger_status.rb +13 -0
- data/lib/trophy/types/points_trigger_time_unit.rb +12 -0
- data/lib/trophy/types/points_trigger_type.rb +15 -0
- data/lib/trophy/types/points_trigger_user_attributes_item.rb +11 -0
- data/lib/trophy/types/reset_streaks_response.rb +12 -0
- data/lib/trophy/types/restore_streaks_response.rb +12 -0
- data/lib/trophy/types/streak_evaluation_mode_preference.rb +12 -0
- data/lib/{trophy_api_client/users/types/users_metric_event_summary_request_aggregation.rb → trophy/types/streak_frequency.rb} +5 -3
- data/lib/trophy/types/streak_metric_preference.rb +12 -0
- data/lib/trophy/types/streak_preferences.rb +17 -0
- data/lib/trophy/types/streak_response.rb +34 -0
- data/lib/trophy/types/streak_response_pauses_item.rb +14 -0
- data/lib/trophy/types/streak_response_streak_history_item.rb +20 -0
- data/lib/trophy/types/streak_settings.rb +20 -0
- data/lib/trophy/types/streak_settings_freezes.rb +16 -0
- data/lib/trophy/types/streak_settings_metric.rb +12 -0
- data/lib/trophy/types/update_achievement_request_item.rb +37 -0
- data/lib/trophy/types/update_achievement_request_item_badge.rb +9 -0
- data/lib/trophy/types/update_achievement_request_item_event_attributes_item.rb +11 -0
- data/lib/trophy/types/update_achievement_request_item_status.rb +13 -0
- data/lib/trophy/types/update_achievement_request_item_trigger.rb +15 -0
- data/lib/trophy/types/update_achievement_request_item_user_attributes_item.rb +11 -0
- data/lib/trophy/types/update_achievements_request.rb +23 -0
- data/lib/trophy/types/update_achievements_response.rb +12 -0
- data/lib/trophy/types/update_admin_settings_branding.rb +20 -0
- data/lib/trophy/types/update_admin_settings_branding_app_icon.rb +9 -0
- data/lib/trophy/types/update_admin_settings_branding_logo.rb +9 -0
- data/lib/trophy/types/update_admin_settings_experimentation.rb +12 -0
- data/lib/trophy/types/update_attribute_request_item.rb +13 -0
- data/lib/trophy/types/update_attributes_request.rb +23 -0
- data/lib/trophy/types/update_attributes_response.rb +12 -0
- data/lib/trophy/types/update_leaderboard_request_item.rb +41 -0
- data/lib/trophy/types/update_leaderboard_request_item_rank_by.rb +13 -0
- data/lib/trophy/types/update_leaderboard_request_item_run_unit.rb +13 -0
- data/lib/trophy/types/update_leaderboard_request_item_status.rb +14 -0
- data/lib/trophy/types/update_leaderboards_request.rb +23 -0
- data/lib/trophy/types/update_leaderboards_response.rb +12 -0
- data/lib/trophy/types/update_metric_request_item.rb +17 -0
- data/lib/trophy/types/update_metric_request_item_unit_type.rb +12 -0
- data/lib/trophy/types/update_metrics_request.rb +23 -0
- data/lib/trophy/types/update_metrics_response.rb +12 -0
- data/lib/trophy/types/update_points_system_request_item.rb +18 -0
- data/lib/trophy/types/update_points_system_request_item_badge.rb +9 -0
- data/lib/trophy/types/update_points_systems_request.rb +23 -0
- data/lib/trophy/types/update_points_systems_response.rb +12 -0
- data/lib/trophy/types/update_streak_settings_freezes.rb +17 -0
- data/lib/trophy/types/update_tenant_request_item.rb +14 -0
- data/lib/trophy/types/update_tenants_request.rb +23 -0
- data/lib/trophy/types/update_tenants_response.rb +12 -0
- data/lib/trophy/types/updated_user.rb +22 -0
- data/lib/trophy/types/upserted_user.rb +24 -0
- data/lib/trophy/types/user.rb +30 -0
- data/lib/trophy/types/user_achievement_response.rb +39 -0
- data/lib/trophy/types/user_achievement_with_stats_response.rb +43 -0
- data/lib/trophy/types/user_leaderboard_response.rb +48 -0
- data/lib/trophy/types/user_leaderboard_response_with_history.rb +50 -0
- data/lib/trophy/types/user_preferences_response.rb +12 -0
- data/lib/trophy/types/webhook_user_leaderboard_response.rb +52 -0
- data/lib/trophy/types/webhooks_achievement_completed_payload.rb +13 -0
- data/lib/trophy/types/webhooks_emails_achievement_due_payload.rb +15 -0
- data/lib/trophy/types/webhooks_emails_reactivation_due_payload.rb +15 -0
- data/lib/trophy/types/webhooks_emails_reactivation_due_payload_reactivation.rb +12 -0
- data/lib/trophy/types/webhooks_emails_recap_due_payload.rb +15 -0
- data/lib/trophy/types/webhooks_emails_recap_due_payload_recap.rb +12 -0
- data/lib/trophy/types/webhooks_emails_streak_reminder_due_payload.rb +15 -0
- data/lib/trophy/types/webhooks_leaderboard_changed_payload.rb +11 -0
- data/lib/trophy/types/webhooks_leaderboard_finished_payload.rb +11 -0
- data/lib/trophy/types/webhooks_leaderboard_rank_changed_payload.rb +13 -0
- data/lib/trophy/types/webhooks_leaderboard_started_payload.rb +11 -0
- data/lib/trophy/types/webhooks_points_boost_finished_payload.rb +13 -0
- data/lib/trophy/types/webhooks_points_boost_started_payload.rb +13 -0
- data/lib/trophy/types/webhooks_points_changed_payload.rb +13 -0
- data/lib/trophy/types/webhooks_points_level_changed_payload.rb +17 -0
- data/lib/trophy/types/webhooks_points_level_changed_payload_points.rb +22 -0
- data/lib/trophy/types/webhooks_streak_extended_payload.rb +13 -0
- data/lib/trophy/types/webhooks_streak_freeze_consumed_payload.rb +15 -0
- data/lib/trophy/types/webhooks_streak_freeze_earned_payload.rb +15 -0
- data/lib/trophy/types/webhooks_streak_lost_payload.rb +13 -0
- data/lib/trophy/types/webhooks_streak_started_payload.rb +13 -0
- data/lib/trophy/types/wrapped_activity.rb +22 -0
- data/lib/trophy/types/wrapped_activity_period.rb +16 -0
- data/lib/trophy/types/wrapped_entire_year.rb +18 -0
- data/lib/trophy/types/wrapped_metric.rb +22 -0
- data/lib/trophy/types/wrapped_metric_by_attribute_value_value.rb +19 -0
- data/lib/trophy/types/wrapped_most_active_day.rb +18 -0
- data/lib/trophy/types/wrapped_most_active_month.rb +18 -0
- data/lib/trophy/types/wrapped_most_active_week.rb +20 -0
- data/lib/trophy/types/wrapped_points.rb +20 -0
- data/lib/trophy/types/wrapped_response.rb +13 -0
- data/lib/trophy/types/wrapped_streak.rb +18 -0
- data/lib/trophy/users/client.rb +612 -0
- data/lib/trophy/users/types/update_user_preferences_request.rb +15 -0
- data/lib/trophy/users/types/users_achievements_request.rb +13 -0
- data/lib/trophy/users/types/users_leaderboard_request.rb +17 -0
- data/lib/trophy/users/types/users_metric_event_summary_request.rb +19 -0
- data/lib/trophy/users/types/users_metric_event_summary_request_aggregation.rb +15 -0
- data/lib/trophy/users/types/users_metric_event_summary_response_item.rb +15 -0
- data/lib/trophy/users/types/users_points_event_summary_request.rb +19 -0
- data/lib/trophy/users/types/users_points_event_summary_request_aggregation.rb +15 -0
- data/lib/trophy/users/types/users_points_event_summary_response_item.rb +15 -0
- data/lib/trophy/users/types/users_points_request.rb +15 -0
- data/lib/trophy/users/types/users_streak_request.rb +13 -0
- data/lib/trophy/users/types/users_wrapped_request.rb +13 -0
- data/lib/trophy/version.rb +5 -0
- data/lib/trophy.rb +390 -0
- data/lib/trophy_api_client.rb +4 -101
- data/reference.md +6128 -0
- metadata +403 -333
- data/lib/requests.rb +0 -189
- data/lib/trophy_api_client/achievements/client.rb +0 -196
- data/lib/trophy_api_client/admin/attributes/client.rb +0 -378
- data/lib/trophy_api_client/admin/client.rb +0 -65
- data/lib/trophy_api_client/admin/leaderboards/client.rb +0 -381
- data/lib/trophy_api_client/admin/metrics/client.rb +0 -376
- data/lib/trophy_api_client/admin/points/boosts/client.rb +0 -410
- data/lib/trophy_api_client/admin/points/client.rb +0 -53
- data/lib/trophy_api_client/admin/points/levels/client.rb +0 -412
- data/lib/trophy_api_client/admin/points/systems/client.rb +0 -384
- data/lib/trophy_api_client/admin/points/triggers/client.rb +0 -412
- data/lib/trophy_api_client/admin/streaks/client.rb +0 -106
- data/lib/trophy_api_client/admin/streaks/freezes/client.rb +0 -100
- data/lib/trophy_api_client/admin/streaks/freezes/types/create_streak_freezes_request_freezes_item.rb +0 -62
- data/lib/trophy_api_client/admin/streaks/types/restore_streaks_request_users_item.rb +0 -59
- data/lib/trophy_api_client/admin/tenants/client.rb +0 -376
- data/lib/trophy_api_client/leaderboards/client.rb +0 -225
- data/lib/trophy_api_client/leaderboards/types/leaderboards_all_response_item.rb +0 -202
- data/lib/trophy_api_client/metrics/client.rb +0 -142
- data/lib/trophy_api_client/points/client.rb +0 -424
- data/lib/trophy_api_client/streaks/client.rb +0 -104
- data/lib/trophy_api_client/types/achievement_completion_response.rb +0 -83
- data/lib/trophy_api_client/types/achievement_response.rb +0 -198
- data/lib/trophy_api_client/types/achievement_response_event_attribute.rb +0 -67
- data/lib/trophy_api_client/types/achievement_response_event_attributes_item.rb +0 -66
- data/lib/trophy_api_client/types/achievement_response_trigger.rb +0 -11
- data/lib/trophy_api_client/types/achievement_response_user_attributes_item.rb +0 -66
- data/lib/trophy_api_client/types/achievement_with_stats_response.rb +0 -214
- data/lib/trophy_api_client/types/admin_attribute.rb +0 -81
- data/lib/trophy_api_client/types/admin_attribute_type.rb +0 -9
- data/lib/trophy_api_client/types/admin_issue.rb +0 -98
- data/lib/trophy_api_client/types/admin_issue_severity.rb +0 -9
- data/lib/trophy_api_client/types/admin_leaderboard.rb +0 -171
- data/lib/trophy_api_client/types/admin_leaderboard_rank_by.rb +0 -10
- data/lib/trophy_api_client/types/admin_leaderboard_run_unit.rb +0 -10
- data/lib/trophy_api_client/types/admin_leaderboard_status.rb +0 -11
- data/lib/trophy_api_client/types/admin_points_boost.rb +0 -138
- data/lib/trophy_api_client/types/admin_points_boost_rounding.rb +0 -10
- data/lib/trophy_api_client/types/admin_points_boost_status.rb +0 -10
- data/lib/trophy_api_client/types/admin_points_boost_user_attributes_item.rb +0 -65
- data/lib/trophy_api_client/types/admin_points_level.rb +0 -109
- data/lib/trophy_api_client/types/admin_points_level_badge.rb +0 -55
- data/lib/trophy_api_client/types/admin_points_system.rb +0 -118
- data/lib/trophy_api_client/types/admin_points_system_badge.rb +0 -55
- data/lib/trophy_api_client/types/admin_points_system_status.rb +0 -9
- data/lib/trophy_api_client/types/admin_points_trigger.rb +0 -175
- data/lib/trophy_api_client/types/admin_points_trigger_event_attributes_item.rb +0 -66
- data/lib/trophy_api_client/types/admin_points_trigger_status.rb +0 -9
- data/lib/trophy_api_client/types/admin_points_trigger_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/admin_points_trigger_type.rb +0 -12
- data/lib/trophy_api_client/types/admin_points_trigger_user_attributes_item.rb +0 -65
- data/lib/trophy_api_client/types/admin_tenant.rb +0 -103
- data/lib/trophy_api_client/types/admin_tenant_status.rb +0 -9
- data/lib/trophy_api_client/types/base_streak_response.rb +0 -144
- data/lib/trophy_api_client/types/bulk_streak_response.rb +0 -7
- data/lib/trophy_api_client/types/bulk_streak_response_item.rb +0 -76
- data/lib/trophy_api_client/types/create_attribute_request_item.rb +0 -76
- data/lib/trophy_api_client/types/create_attribute_request_item_type.rb +0 -9
- data/lib/trophy_api_client/types/create_attributes_request.rb +0 -7
- data/lib/trophy_api_client/types/create_attributes_response.rb +0 -74
- data/lib/trophy_api_client/types/create_leaderboard_request_item.rb +0 -171
- data/lib/trophy_api_client/types/create_leaderboard_request_item_rank_by.rb +0 -10
- data/lib/trophy_api_client/types/create_leaderboard_request_item_run_unit.rb +0 -11
- data/lib/trophy_api_client/types/create_leaderboard_request_item_status.rb +0 -13
- data/lib/trophy_api_client/types/create_leaderboards_request.rb +0 -7
- data/lib/trophy_api_client/types/create_leaderboards_response.rb +0 -74
- data/lib/trophy_api_client/types/create_metric_request_item.rb +0 -87
- data/lib/trophy_api_client/types/create_metric_request_item_unit_type.rb +0 -9
- data/lib/trophy_api_client/types/create_metrics_request.rb +0 -7
- data/lib/trophy_api_client/types/create_metrics_response.rb +0 -74
- data/lib/trophy_api_client/types/create_points_boost_request_item.rb +0 -125
- data/lib/trophy_api_client/types/create_points_boost_request_item_rounding.rb +0 -10
- data/lib/trophy_api_client/types/create_points_boost_request_item_user_attributes_item.rb +0 -67
- data/lib/trophy_api_client/types/create_points_boosts_request.rb +0 -7
- data/lib/trophy_api_client/types/create_points_boosts_response.rb +0 -75
- data/lib/trophy_api_client/types/create_points_level_request_item.rb +0 -103
- data/lib/trophy_api_client/types/create_points_level_request_item_badge.rb +0 -56
- data/lib/trophy_api_client/types/create_points_levels_request.rb +0 -7
- data/lib/trophy_api_client/types/create_points_levels_response.rb +0 -74
- data/lib/trophy_api_client/types/create_points_system_request_item.rb +0 -140
- data/lib/trophy_api_client/types/create_points_system_request_item_badge.rb +0 -55
- data/lib/trophy_api_client/types/create_points_systems_request.rb +0 -7
- data/lib/trophy_api_client/types/create_points_systems_response.rb +0 -74
- data/lib/trophy_api_client/types/create_points_trigger_request_item.rb +0 -167
- data/lib/trophy_api_client/types/create_points_trigger_request_item_event_attributes_item.rb +0 -67
- data/lib/trophy_api_client/types/create_points_trigger_request_item_status.rb +0 -9
- data/lib/trophy_api_client/types/create_points_trigger_request_item_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/create_points_trigger_request_item_type.rb +0 -12
- data/lib/trophy_api_client/types/create_points_trigger_request_item_user_attributes_item.rb +0 -67
- data/lib/trophy_api_client/types/create_points_triggers_request.rb +0 -7
- data/lib/trophy_api_client/types/create_points_triggers_response.rb +0 -74
- data/lib/trophy_api_client/types/create_streak_freezes_response.rb +0 -60
- data/lib/trophy_api_client/types/create_tenant_request_item.rb +0 -66
- data/lib/trophy_api_client/types/create_tenants_request.rb +0 -7
- data/lib/trophy_api_client/types/create_tenants_response.rb +0 -74
- data/lib/trophy_api_client/types/created_admin_points_system.rb +0 -163
- data/lib/trophy_api_client/types/created_metric.rb +0 -88
- data/lib/trophy_api_client/types/created_metric_unit_type.rb +0 -9
- data/lib/trophy_api_client/types/delete_attributes_response.rb +0 -75
- data/lib/trophy_api_client/types/delete_leaderboards_response.rb +0 -75
- data/lib/trophy_api_client/types/delete_metrics_response.rb +0 -75
- data/lib/trophy_api_client/types/delete_points_boosts_response.rb +0 -74
- data/lib/trophy_api_client/types/delete_points_levels_response.rb +0 -74
- data/lib/trophy_api_client/types/delete_points_systems_response.rb +0 -74
- data/lib/trophy_api_client/types/delete_points_triggers_response.rb +0 -75
- data/lib/trophy_api_client/types/delete_tenants_response.rb +0 -74
- data/lib/trophy_api_client/types/deleted_resource.rb +0 -56
- data/lib/trophy_api_client/types/error_body.rb +0 -55
- data/lib/trophy_api_client/types/event_response.rb +0 -147
- data/lib/trophy_api_client/types/get_user_points_response.rb +0 -139
- data/lib/trophy_api_client/types/leaderboard_event.rb +0 -110
- data/lib/trophy_api_client/types/leaderboard_ranking.rb +0 -82
- data/lib/trophy_api_client/types/leaderboard_response.rb +0 -192
- data/lib/trophy_api_client/types/leaderboard_response_rank_by.rb +0 -10
- data/lib/trophy_api_client/types/leaderboard_response_run_unit.rb +0 -11
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings.rb +0 -212
- data/lib/trophy_api_client/types/leaderboard_response_with_rankings_status.rb +0 -10
- data/lib/trophy_api_client/types/list_attributes_response.rb +0 -7
- data/lib/trophy_api_client/types/list_leaderboards_response.rb +0 -7
- data/lib/trophy_api_client/types/list_metrics_response.rb +0 -7
- data/lib/trophy_api_client/types/list_points_boosts_response.rb +0 -7
- data/lib/trophy_api_client/types/list_points_levels_response.rb +0 -7
- data/lib/trophy_api_client/types/list_points_systems_response.rb +0 -7
- data/lib/trophy_api_client/types/list_points_triggers_response.rb +0 -7
- data/lib/trophy_api_client/types/list_tenants_response.rb +0 -7
- data/lib/trophy_api_client/types/metric_event_leaderboard_response.rb +0 -245
- data/lib/trophy_api_client/types/metric_event_leaderboard_response_breakdown_attribute_values_item.rb +0 -67
- data/lib/trophy_api_client/types/metric_event_points_response.rb +0 -148
- data/lib/trophy_api_client/types/metric_event_streak_response.rb +0 -153
- data/lib/trophy_api_client/types/metric_response.rb +0 -90
- data/lib/trophy_api_client/types/notification_channel.rb +0 -9
- data/lib/trophy_api_client/types/notification_preferences.rb +0 -89
- data/lib/trophy_api_client/types/patch_points_boosts_request.rb +0 -7
- data/lib/trophy_api_client/types/patch_points_boosts_request_item.rb +0 -118
- data/lib/trophy_api_client/types/patch_points_boosts_request_item_rounding.rb +0 -10
- data/lib/trophy_api_client/types/patch_points_boosts_request_item_user_attributes_item.rb +0 -67
- data/lib/trophy_api_client/types/patch_points_boosts_response.rb +0 -74
- data/lib/trophy_api_client/types/patch_points_levels_request.rb +0 -7
- data/lib/trophy_api_client/types/patch_points_levels_request_item.rb +0 -100
- data/lib/trophy_api_client/types/patch_points_levels_request_item_badge.rb +0 -55
- data/lib/trophy_api_client/types/patch_points_levels_response.rb +0 -74
- data/lib/trophy_api_client/types/patch_points_triggers_request.rb +0 -7
- data/lib/trophy_api_client/types/patch_points_triggers_request_item.rb +0 -174
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_event_attributes_item.rb +0 -67
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_status.rb +0 -9
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_type.rb +0 -13
- data/lib/trophy_api_client/types/patch_points_triggers_request_item_user_attributes_item.rb +0 -67
- data/lib/trophy_api_client/types/patch_points_triggers_response.rb +0 -74
- data/lib/trophy_api_client/types/points_award.rb +0 -113
- data/lib/trophy_api_client/types/points_boost.rb +0 -112
- data/lib/trophy_api_client/types/points_boost_rounding.rb +0 -10
- data/lib/trophy_api_client/types/points_boost_status.rb +0 -10
- data/lib/trophy_api_client/types/points_boost_webhook_payload.rb +0 -149
- data/lib/trophy_api_client/types/points_boost_webhook_payload_rounding.rb +0 -10
- data/lib/trophy_api_client/types/points_boost_webhook_payload_status.rb +0 -9
- data/lib/trophy_api_client/types/points_level.rb +0 -103
- data/lib/trophy_api_client/types/points_level_summary_response.rb +0 -7
- data/lib/trophy_api_client/types/points_level_summary_response_item.rb +0 -71
- data/lib/trophy_api_client/types/points_range.rb +0 -72
- data/lib/trophy_api_client/types/points_response.rb +0 -103
- data/lib/trophy_api_client/types/points_summary_response.rb +0 -7
- data/lib/trophy_api_client/types/points_system_response.rb +0 -107
- data/lib/trophy_api_client/types/points_trigger.rb +0 -227
- data/lib/trophy_api_client/types/points_trigger_event_attribute.rb +0 -67
- data/lib/trophy_api_client/types/points_trigger_event_attributes_item.rb +0 -65
- data/lib/trophy_api_client/types/points_trigger_status.rb +0 -10
- data/lib/trophy_api_client/types/points_trigger_time_unit.rb +0 -9
- data/lib/trophy_api_client/types/points_trigger_type.rb +0 -12
- data/lib/trophy_api_client/types/points_trigger_user_attributes_item.rb +0 -65
- data/lib/trophy_api_client/types/restore_streaks_response.rb +0 -70
- data/lib/trophy_api_client/types/streak_evaluation_mode_preference.rb +0 -11
- data/lib/trophy_api_client/types/streak_frequency.rb +0 -9
- data/lib/trophy_api_client/types/streak_metric_preference.rb +0 -66
- data/lib/trophy_api_client/types/streak_preferences.rb +0 -83
- data/lib/trophy_api_client/types/streak_response.rb +0 -170
- data/lib/trophy_api_client/types/streak_response_streak_history_item.rb +0 -89
- data/lib/trophy_api_client/types/update_attribute_request_item.rb +0 -69
- data/lib/trophy_api_client/types/update_attributes_request.rb +0 -7
- data/lib/trophy_api_client/types/update_attributes_response.rb +0 -75
- data/lib/trophy_api_client/types/update_leaderboard_request_item.rb +0 -179
- data/lib/trophy_api_client/types/update_leaderboard_request_item_rank_by.rb +0 -11
- data/lib/trophy_api_client/types/update_leaderboard_request_item_run_unit.rb +0 -9
- data/lib/trophy_api_client/types/update_leaderboard_request_item_status.rb +0 -12
- data/lib/trophy_api_client/types/update_leaderboards_request.rb +0 -7
- data/lib/trophy_api_client/types/update_leaderboards_response.rb +0 -75
- data/lib/trophy_api_client/types/update_metric_request_item.rb +0 -86
- data/lib/trophy_api_client/types/update_metric_request_item_unit_type.rb +0 -9
- data/lib/trophy_api_client/types/update_metrics_request.rb +0 -7
- data/lib/trophy_api_client/types/update_metrics_response.rb +0 -75
- data/lib/trophy_api_client/types/update_points_system_request_item.rb +0 -102
- data/lib/trophy_api_client/types/update_points_system_request_item_badge.rb +0 -55
- data/lib/trophy_api_client/types/update_points_systems_request.rb +0 -7
- data/lib/trophy_api_client/types/update_points_systems_response.rb +0 -74
- data/lib/trophy_api_client/types/update_tenant_request_item.rb +0 -75
- data/lib/trophy_api_client/types/update_tenants_request.rb +0 -7
- data/lib/trophy_api_client/types/update_tenants_response.rb +0 -74
- data/lib/trophy_api_client/types/updated_user.rb +0 -108
- data/lib/trophy_api_client/types/upserted_user.rb +0 -116
- data/lib/trophy_api_client/types/user.rb +0 -141
- data/lib/trophy_api_client/types/user_achievement_response.rb +0 -209
- data/lib/trophy_api_client/types/user_achievement_with_stats_response.rb +0 -225
- data/lib/trophy_api_client/types/user_leaderboard_response.rb +0 -212
- data/lib/trophy_api_client/types/user_leaderboard_response_with_history.rb +0 -224
- data/lib/trophy_api_client/types/user_preferences_response.rb +0 -80
- data/lib/trophy_api_client/types/webhook_user_leaderboard_response.rb +0 -228
- data/lib/trophy_api_client/types/webhooks_achievement_completed_payload.rb +0 -84
- data/lib/trophy_api_client/types/webhooks_leaderboard_changed_payload.rb +0 -71
- data/lib/trophy_api_client/types/webhooks_leaderboard_finished_payload.rb +0 -71
- data/lib/trophy_api_client/types/webhooks_leaderboard_rank_changed_payload.rb +0 -85
- data/lib/trophy_api_client/types/webhooks_leaderboard_started_payload.rb +0 -71
- data/lib/trophy_api_client/types/webhooks_points_boost_finished_payload.rb +0 -79
- data/lib/trophy_api_client/types/webhooks_points_boost_started_payload.rb +0 -79
- data/lib/trophy_api_client/types/webhooks_points_changed_payload.rb +0 -84
- data/lib/trophy_api_client/types/webhooks_points_level_changed_payload.rb +0 -117
- data/lib/trophy_api_client/types/webhooks_points_level_changed_payload_points.rb +0 -114
- data/lib/trophy_api_client/types/webhooks_streak_extended_payload.rb +0 -84
- data/lib/trophy_api_client/types/webhooks_streak_freeze_consumed_payload.rb +0 -85
- data/lib/trophy_api_client/types/webhooks_streak_freeze_earned_payload.rb +0 -85
- data/lib/trophy_api_client/types/webhooks_streak_lost_payload.rb +0 -78
- data/lib/trophy_api_client/types/webhooks_streak_started_payload.rb +0 -84
- data/lib/trophy_api_client/types/wrapped_activity.rb +0 -134
- data/lib/trophy_api_client/types/wrapped_activity_period.rb +0 -95
- data/lib/trophy_api_client/types/wrapped_entire_year.rb +0 -114
- data/lib/trophy_api_client/types/wrapped_metric.rb +0 -119
- data/lib/trophy_api_client/types/wrapped_metric_by_attribute_value_value.rb +0 -103
- data/lib/trophy_api_client/types/wrapped_most_active_day.rb +0 -108
- data/lib/trophy_api_client/types/wrapped_most_active_month.rb +0 -108
- data/lib/trophy_api_client/types/wrapped_most_active_week.rb +0 -116
- data/lib/trophy_api_client/types/wrapped_points.rb +0 -106
- data/lib/trophy_api_client/types/wrapped_response.rb +0 -79
- data/lib/trophy_api_client/types/wrapped_streak.rb +0 -96
- data/lib/trophy_api_client/users/client.rb +0 -1356
- data/lib/trophy_api_client/users/types/users_metric_event_summary_response_item.rb +0 -76
- data/lib/trophy_api_client/users/types/users_points_event_summary_response_item.rb +0 -76
- data/lib/trophy_api_client/version.rb +0 -3
- data/lib/types_export.rb +0 -221
|
@@ -1,1356 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative "../../requests"
|
|
4
|
-
require_relative "../types/upserted_user"
|
|
5
|
-
require_relative "../types/user"
|
|
6
|
-
require_relative "../types/updated_user"
|
|
7
|
-
require_relative "../types/user_preferences_response"
|
|
8
|
-
require_relative "../types/notification_preferences"
|
|
9
|
-
require_relative "../types/streak_preferences"
|
|
10
|
-
require_relative "../types/metric_response"
|
|
11
|
-
require "json"
|
|
12
|
-
require_relative "types/users_metric_event_summary_request_aggregation"
|
|
13
|
-
require_relative "types/users_metric_event_summary_response_item"
|
|
14
|
-
require_relative "../types/user_achievement_with_stats_response"
|
|
15
|
-
require_relative "../types/streak_response"
|
|
16
|
-
require_relative "../types/get_user_points_response"
|
|
17
|
-
require_relative "../types/points_boost"
|
|
18
|
-
require_relative "types/users_points_event_summary_request_aggregation"
|
|
19
|
-
require_relative "types/users_points_event_summary_response_item"
|
|
20
|
-
require_relative "../types/user_leaderboard_response_with_history"
|
|
21
|
-
require_relative "../types/wrapped_response"
|
|
22
|
-
require "async"
|
|
23
|
-
|
|
24
|
-
module TrophyApiClient
|
|
25
|
-
class UsersClient
|
|
26
|
-
# @return [TrophyApiClient::RequestClient]
|
|
27
|
-
attr_reader :request_client
|
|
28
|
-
|
|
29
|
-
# @param request_client [TrophyApiClient::RequestClient]
|
|
30
|
-
# @return [TrophyApiClient::UsersClient]
|
|
31
|
-
def initialize(request_client:)
|
|
32
|
-
@request_client = request_client
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
# Create a new user.
|
|
36
|
-
#
|
|
37
|
-
# @param request [Hash] Request of type TrophyApiClient::UpsertedUser, as a Hash
|
|
38
|
-
# * :id (String)
|
|
39
|
-
# * :email (String)
|
|
40
|
-
# * :name (String)
|
|
41
|
-
# * :tz (String)
|
|
42
|
-
# * :device_tokens (Array<String>)
|
|
43
|
-
# * :subscribe_to_emails (Boolean)
|
|
44
|
-
# * :attributes (Hash{String => String})
|
|
45
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
46
|
-
# @return [TrophyApiClient::User]
|
|
47
|
-
# @example
|
|
48
|
-
# api = TrophyApiClient::Client.new(
|
|
49
|
-
# base_url: "https://api.example.com",
|
|
50
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
51
|
-
# api_key: "YOUR_API_KEY"
|
|
52
|
-
# )
|
|
53
|
-
# api.users.create(request: { id: "user-id" })
|
|
54
|
-
def create(request:, request_options: nil)
|
|
55
|
-
response = @request_client.conn.post do |req|
|
|
56
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
57
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
58
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
59
|
-
req.headers = {
|
|
60
|
-
**(req.headers || {}),
|
|
61
|
-
**@request_client.get_headers,
|
|
62
|
-
**(request_options&.additional_headers || {})
|
|
63
|
-
}.compact
|
|
64
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
65
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
66
|
-
end
|
|
67
|
-
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
68
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users"
|
|
69
|
-
end
|
|
70
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
# Get a single user.
|
|
74
|
-
#
|
|
75
|
-
# @param id [String] ID of the user to get.
|
|
76
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
77
|
-
# @return [TrophyApiClient::User]
|
|
78
|
-
# @example
|
|
79
|
-
# api = TrophyApiClient::Client.new(
|
|
80
|
-
# base_url: "https://api.example.com",
|
|
81
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
82
|
-
# api_key: "YOUR_API_KEY"
|
|
83
|
-
# )
|
|
84
|
-
# api.users.get(id: "userId")
|
|
85
|
-
def get(id:, request_options: nil)
|
|
86
|
-
response = @request_client.conn.get do |req|
|
|
87
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
88
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
89
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
90
|
-
req.headers = {
|
|
91
|
-
**(req.headers || {}),
|
|
92
|
-
**@request_client.get_headers,
|
|
93
|
-
**(request_options&.additional_headers || {})
|
|
94
|
-
}.compact
|
|
95
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
96
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
97
|
-
end
|
|
98
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
99
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
100
|
-
end
|
|
101
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}"
|
|
102
|
-
end
|
|
103
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
# Identify a user.
|
|
107
|
-
#
|
|
108
|
-
# @param id [String] ID of the user to identify.
|
|
109
|
-
# @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
|
|
110
|
-
# * :email (String)
|
|
111
|
-
# * :name (String)
|
|
112
|
-
# * :tz (String)
|
|
113
|
-
# * :device_tokens (Array<String>)
|
|
114
|
-
# * :subscribe_to_emails (Boolean)
|
|
115
|
-
# * :attributes (Hash{String => String})
|
|
116
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
117
|
-
# @return [TrophyApiClient::User]
|
|
118
|
-
# @example
|
|
119
|
-
# api = TrophyApiClient::Client.new(
|
|
120
|
-
# base_url: "https://api.example.com",
|
|
121
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
122
|
-
# api_key: "YOUR_API_KEY"
|
|
123
|
-
# )
|
|
124
|
-
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
125
|
-
def identify(id:, request:, request_options: nil)
|
|
126
|
-
response = @request_client.conn.put do |req|
|
|
127
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
128
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
129
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
130
|
-
req.headers = {
|
|
131
|
-
**(req.headers || {}),
|
|
132
|
-
**@request_client.get_headers,
|
|
133
|
-
**(request_options&.additional_headers || {})
|
|
134
|
-
}.compact
|
|
135
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
136
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
137
|
-
end
|
|
138
|
-
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
139
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}"
|
|
140
|
-
end
|
|
141
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# Update a user.
|
|
145
|
-
#
|
|
146
|
-
# @param id [String] ID of the user to update.
|
|
147
|
-
# @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
|
|
148
|
-
# * :email (String)
|
|
149
|
-
# * :name (String)
|
|
150
|
-
# * :tz (String)
|
|
151
|
-
# * :device_tokens (Array<String>)
|
|
152
|
-
# * :subscribe_to_emails (Boolean)
|
|
153
|
-
# * :attributes (Hash{String => String})
|
|
154
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
155
|
-
# @return [TrophyApiClient::User]
|
|
156
|
-
# @example
|
|
157
|
-
# api = TrophyApiClient::Client.new(
|
|
158
|
-
# base_url: "https://api.example.com",
|
|
159
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
160
|
-
# api_key: "YOUR_API_KEY"
|
|
161
|
-
# )
|
|
162
|
-
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
163
|
-
def update(id:, request:, request_options: nil)
|
|
164
|
-
response = @request_client.conn.patch do |req|
|
|
165
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
166
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
167
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
168
|
-
req.headers = {
|
|
169
|
-
**(req.headers || {}),
|
|
170
|
-
**@request_client.get_headers,
|
|
171
|
-
**(request_options&.additional_headers || {})
|
|
172
|
-
}.compact
|
|
173
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
174
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
175
|
-
end
|
|
176
|
-
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
177
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}"
|
|
178
|
-
end
|
|
179
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
180
|
-
end
|
|
181
|
-
|
|
182
|
-
# Get a user's notification preferences.
|
|
183
|
-
#
|
|
184
|
-
# @param id [String] The user's ID in your database.
|
|
185
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
186
|
-
# @return [TrophyApiClient::UserPreferencesResponse]
|
|
187
|
-
# @example
|
|
188
|
-
# api = TrophyApiClient::Client.new(
|
|
189
|
-
# base_url: "https://api.example.com",
|
|
190
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
191
|
-
# api_key: "YOUR_API_KEY"
|
|
192
|
-
# )
|
|
193
|
-
# api.users.get_preferences(id: "user-123")
|
|
194
|
-
def get_preferences(id:, request_options: nil)
|
|
195
|
-
response = @request_client.conn.get do |req|
|
|
196
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
197
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
198
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
199
|
-
req.headers = {
|
|
200
|
-
**(req.headers || {}),
|
|
201
|
-
**@request_client.get_headers,
|
|
202
|
-
**(request_options&.additional_headers || {})
|
|
203
|
-
}.compact
|
|
204
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
205
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
206
|
-
end
|
|
207
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
208
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
209
|
-
end
|
|
210
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/preferences"
|
|
211
|
-
end
|
|
212
|
-
TrophyApiClient::UserPreferencesResponse.from_json(json_object: response.body)
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
# Update a user's notification and streak preferences. Streak preferences require
|
|
216
|
-
# streak customization to be enabled in your Trophy dashboard settings.
|
|
217
|
-
#
|
|
218
|
-
# @param id [String] The user's ID in your database.
|
|
219
|
-
# @param notifications [Hash] Request of type TrophyApiClient::NotificationPreferences, as a Hash
|
|
220
|
-
# * :achievement_completed (Array<TrophyApiClient::NotificationChannel>)
|
|
221
|
-
# * :recap (Array<TrophyApiClient::NotificationChannel>)
|
|
222
|
-
# * :reactivation (Array<TrophyApiClient::NotificationChannel>)
|
|
223
|
-
# * :streak_reminder (Array<TrophyApiClient::NotificationChannel>)
|
|
224
|
-
# @param streak [Hash] Request of type TrophyApiClient::StreakPreferences, as a Hash
|
|
225
|
-
# * :enabled (Boolean)
|
|
226
|
-
# * :evaluation_mode (TrophyApiClient::StreakEvaluationModePreference)
|
|
227
|
-
# * :metrics (Array<TrophyApiClient::StreakMetricPreference>)
|
|
228
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
229
|
-
# @return [TrophyApiClient::UserPreferencesResponse]
|
|
230
|
-
# @example
|
|
231
|
-
# api = TrophyApiClient::Client.new(
|
|
232
|
-
# base_url: "https://api.example.com",
|
|
233
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
234
|
-
# api_key: "YOUR_API_KEY"
|
|
235
|
-
# )
|
|
236
|
-
# api.users.update_preferences(id: "user-123", notifications: { streak_reminder: [EMAIL] })
|
|
237
|
-
def update_preferences(id:, notifications: nil, streak: nil, request_options: nil)
|
|
238
|
-
response = @request_client.conn.patch do |req|
|
|
239
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
240
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
241
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
242
|
-
req.headers = {
|
|
243
|
-
**(req.headers || {}),
|
|
244
|
-
**@request_client.get_headers,
|
|
245
|
-
**(request_options&.additional_headers || {})
|
|
246
|
-
}.compact
|
|
247
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
248
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
249
|
-
end
|
|
250
|
-
req.body = {
|
|
251
|
-
**(request_options&.additional_body_parameters || {}),
|
|
252
|
-
notifications: notifications,
|
|
253
|
-
streak: streak
|
|
254
|
-
}.compact
|
|
255
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/preferences"
|
|
256
|
-
end
|
|
257
|
-
TrophyApiClient::UserPreferencesResponse.from_json(json_object: response.body)
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
# Get a single user's progress against all active metrics.
|
|
261
|
-
#
|
|
262
|
-
# @param id [String] ID of the user
|
|
263
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
264
|
-
# @return [Array<TrophyApiClient::MetricResponse>]
|
|
265
|
-
# @example
|
|
266
|
-
# api = TrophyApiClient::Client.new(
|
|
267
|
-
# base_url: "https://api.example.com",
|
|
268
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
269
|
-
# api_key: "YOUR_API_KEY"
|
|
270
|
-
# )
|
|
271
|
-
# api.users.all_metrics(id: "userId")
|
|
272
|
-
def all_metrics(id:, request_options: nil)
|
|
273
|
-
response = @request_client.conn.get do |req|
|
|
274
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
275
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
276
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
277
|
-
req.headers = {
|
|
278
|
-
**(req.headers || {}),
|
|
279
|
-
**@request_client.get_headers,
|
|
280
|
-
**(request_options&.additional_headers || {})
|
|
281
|
-
}.compact
|
|
282
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
283
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
284
|
-
end
|
|
285
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
286
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
287
|
-
end
|
|
288
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/metrics"
|
|
289
|
-
end
|
|
290
|
-
parsed_json = JSON.parse(response.body)
|
|
291
|
-
parsed_json&.map do |item|
|
|
292
|
-
item = item.to_json
|
|
293
|
-
TrophyApiClient::MetricResponse.from_json(json_object: item)
|
|
294
|
-
end
|
|
295
|
-
end
|
|
296
|
-
|
|
297
|
-
# Get a user's progress against a single active metric.
|
|
298
|
-
#
|
|
299
|
-
# @param id [String] ID of the user.
|
|
300
|
-
# @param key [String] Unique key of the metric.
|
|
301
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
302
|
-
# @return [TrophyApiClient::MetricResponse]
|
|
303
|
-
# @example
|
|
304
|
-
# api = TrophyApiClient::Client.new(
|
|
305
|
-
# base_url: "https://api.example.com",
|
|
306
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
307
|
-
# api_key: "YOUR_API_KEY"
|
|
308
|
-
# )
|
|
309
|
-
# api.users.single_metric(id: "userId", key: "key")
|
|
310
|
-
def single_metric(id:, key:, request_options: nil)
|
|
311
|
-
response = @request_client.conn.get do |req|
|
|
312
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
313
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
314
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
315
|
-
req.headers = {
|
|
316
|
-
**(req.headers || {}),
|
|
317
|
-
**@request_client.get_headers,
|
|
318
|
-
**(request_options&.additional_headers || {})
|
|
319
|
-
}.compact
|
|
320
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
321
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
322
|
-
end
|
|
323
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
324
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
325
|
-
end
|
|
326
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
327
|
-
request_options: request_options)}/users/#{id}/metrics/#{key}"
|
|
328
|
-
end
|
|
329
|
-
TrophyApiClient::MetricResponse.from_json(json_object: response.body)
|
|
330
|
-
end
|
|
331
|
-
|
|
332
|
-
# Get a summary of metric events over time for a user.
|
|
333
|
-
#
|
|
334
|
-
# @param id [String] ID of the user.
|
|
335
|
-
# @param key [String] Unique key of the metric.
|
|
336
|
-
# @param aggregation [TrophyApiClient::Users::UsersMetricEventSummaryRequestAggregation] The time period over which to aggregate the event data.
|
|
337
|
-
# @param start_date [String] The start date for the data range in YYYY-MM-DD format. The startDate must be
|
|
338
|
-
# before the endDate, and the date range must not exceed 400 days.
|
|
339
|
-
# @param end_date [String] The end date for the data range in YYYY-MM-DD format. The endDate must be after
|
|
340
|
-
# the startDate, and the date range must not exceed 400 days.
|
|
341
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
342
|
-
# @return [Array<TrophyApiClient::Users::UsersMetricEventSummaryResponseItem>]
|
|
343
|
-
# @example
|
|
344
|
-
# api = TrophyApiClient::Client.new(
|
|
345
|
-
# base_url: "https://api.example.com",
|
|
346
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
347
|
-
# api_key: "YOUR_API_KEY"
|
|
348
|
-
# )
|
|
349
|
-
# api.users.metric_event_summary(
|
|
350
|
-
# id: "userId",
|
|
351
|
-
# key: "words-written",
|
|
352
|
-
# aggregation: DAILY,
|
|
353
|
-
# start_date: "2024-01-01",
|
|
354
|
-
# end_date: "2024-01-31"
|
|
355
|
-
# )
|
|
356
|
-
def metric_event_summary(id:, key:, aggregation:, start_date:, end_date:, request_options: nil)
|
|
357
|
-
response = @request_client.conn.get do |req|
|
|
358
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
359
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
360
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
361
|
-
req.headers = {
|
|
362
|
-
**(req.headers || {}),
|
|
363
|
-
**@request_client.get_headers,
|
|
364
|
-
**(request_options&.additional_headers || {})
|
|
365
|
-
}.compact
|
|
366
|
-
req.params = {
|
|
367
|
-
**(request_options&.additional_query_parameters || {}),
|
|
368
|
-
"aggregation": aggregation,
|
|
369
|
-
"startDate": start_date,
|
|
370
|
-
"endDate": end_date
|
|
371
|
-
}.compact
|
|
372
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
373
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
374
|
-
end
|
|
375
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
376
|
-
request_options: request_options)}/users/#{id}/metrics/#{key}/event-summary"
|
|
377
|
-
end
|
|
378
|
-
parsed_json = JSON.parse(response.body)
|
|
379
|
-
parsed_json&.map do |item|
|
|
380
|
-
item = item.to_json
|
|
381
|
-
TrophyApiClient::Users::UsersMetricEventSummaryResponseItem.from_json(json_object: item)
|
|
382
|
-
end
|
|
383
|
-
end
|
|
384
|
-
|
|
385
|
-
# Get a user's achievements.
|
|
386
|
-
#
|
|
387
|
-
# @param id [String] ID of the user.
|
|
388
|
-
# @param include_incomplete [String] When set to 'true', returns both completed and incomplete achievements for the
|
|
389
|
-
# user. When omitted or set to any other value, returns only completed
|
|
390
|
-
# achievements.
|
|
391
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
392
|
-
# @return [Array<TrophyApiClient::UserAchievementWithStatsResponse>]
|
|
393
|
-
# @example
|
|
394
|
-
# api = TrophyApiClient::Client.new(
|
|
395
|
-
# base_url: "https://api.example.com",
|
|
396
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
397
|
-
# api_key: "YOUR_API_KEY"
|
|
398
|
-
# )
|
|
399
|
-
# api.users.achievements(id: "userId", include_incomplete: "true")
|
|
400
|
-
def achievements(id:, include_incomplete: nil, request_options: nil)
|
|
401
|
-
response = @request_client.conn.get do |req|
|
|
402
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
403
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
404
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
405
|
-
req.headers = {
|
|
406
|
-
**(req.headers || {}),
|
|
407
|
-
**@request_client.get_headers,
|
|
408
|
-
**(request_options&.additional_headers || {})
|
|
409
|
-
}.compact
|
|
410
|
-
req.params = {
|
|
411
|
-
**(request_options&.additional_query_parameters || {}),
|
|
412
|
-
"includeIncomplete": include_incomplete
|
|
413
|
-
}.compact
|
|
414
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
415
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
416
|
-
end
|
|
417
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
418
|
-
request_options: request_options)}/users/#{id}/achievements"
|
|
419
|
-
end
|
|
420
|
-
parsed_json = JSON.parse(response.body)
|
|
421
|
-
parsed_json&.map do |item|
|
|
422
|
-
item = item.to_json
|
|
423
|
-
TrophyApiClient::UserAchievementWithStatsResponse.from_json(json_object: item)
|
|
424
|
-
end
|
|
425
|
-
end
|
|
426
|
-
|
|
427
|
-
# Get a user's streak data.
|
|
428
|
-
#
|
|
429
|
-
# @param id [String] ID of the user.
|
|
430
|
-
# @param history_periods [Integer] The number of past streak periods to include in the streakHistory field of the
|
|
431
|
-
# response.
|
|
432
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
433
|
-
# @return [TrophyApiClient::StreakResponse]
|
|
434
|
-
# @example
|
|
435
|
-
# api = TrophyApiClient::Client.new(
|
|
436
|
-
# base_url: "https://api.example.com",
|
|
437
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
438
|
-
# api_key: "YOUR_API_KEY"
|
|
439
|
-
# )
|
|
440
|
-
# api.users.streak(id: "userId", history_periods: 1)
|
|
441
|
-
def streak(id:, history_periods: nil, request_options: nil)
|
|
442
|
-
response = @request_client.conn.get do |req|
|
|
443
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
444
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
445
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
446
|
-
req.headers = {
|
|
447
|
-
**(req.headers || {}),
|
|
448
|
-
**@request_client.get_headers,
|
|
449
|
-
**(request_options&.additional_headers || {})
|
|
450
|
-
}.compact
|
|
451
|
-
req.params = {
|
|
452
|
-
**(request_options&.additional_query_parameters || {}),
|
|
453
|
-
"historyPeriods": history_periods
|
|
454
|
-
}.compact
|
|
455
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
456
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
457
|
-
end
|
|
458
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/streak"
|
|
459
|
-
end
|
|
460
|
-
TrophyApiClient::StreakResponse.from_json(json_object: response.body)
|
|
461
|
-
end
|
|
462
|
-
|
|
463
|
-
# Get a user's points for a specific points system.
|
|
464
|
-
#
|
|
465
|
-
# @param id [String] ID of the user.
|
|
466
|
-
# @param key [String] Key of the points system.
|
|
467
|
-
# @param awards [Integer] The number of recent point awards to return.
|
|
468
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
469
|
-
# @return [TrophyApiClient::GetUserPointsResponse]
|
|
470
|
-
# @example
|
|
471
|
-
# api = TrophyApiClient::Client.new(
|
|
472
|
-
# base_url: "https://api.example.com",
|
|
473
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
474
|
-
# api_key: "YOUR_API_KEY"
|
|
475
|
-
# )
|
|
476
|
-
# api.users.points(
|
|
477
|
-
# id: "userId",
|
|
478
|
-
# key: "points-system-key",
|
|
479
|
-
# awards: 1
|
|
480
|
-
# )
|
|
481
|
-
def points(id:, key:, awards: nil, request_options: nil)
|
|
482
|
-
response = @request_client.conn.get do |req|
|
|
483
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
484
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
485
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
486
|
-
req.headers = {
|
|
487
|
-
**(req.headers || {}),
|
|
488
|
-
**@request_client.get_headers,
|
|
489
|
-
**(request_options&.additional_headers || {})
|
|
490
|
-
}.compact
|
|
491
|
-
req.params = { **(request_options&.additional_query_parameters || {}), "awards": awards }.compact
|
|
492
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
493
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
494
|
-
end
|
|
495
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
496
|
-
request_options: request_options)}/users/#{id}/points/#{key}"
|
|
497
|
-
end
|
|
498
|
-
TrophyApiClient::GetUserPointsResponse.from_json(json_object: response.body)
|
|
499
|
-
end
|
|
500
|
-
|
|
501
|
-
# Get active points boosts for a user in a specific points system. Returns both
|
|
502
|
-
# global boosts the user is eligible for and user-specific boosts.
|
|
503
|
-
#
|
|
504
|
-
# @param id [String] ID of the user.
|
|
505
|
-
# @param key [String] Key of the points system.
|
|
506
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
507
|
-
# @return [Array<TrophyApiClient::PointsBoost>]
|
|
508
|
-
# @example
|
|
509
|
-
# api = TrophyApiClient::Client.new(
|
|
510
|
-
# base_url: "https://api.example.com",
|
|
511
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
512
|
-
# api_key: "YOUR_API_KEY"
|
|
513
|
-
# )
|
|
514
|
-
# api.users.points_boosts(id: "userId", key: "points-system-key")
|
|
515
|
-
def points_boosts(id:, key:, request_options: nil)
|
|
516
|
-
response = @request_client.conn.get do |req|
|
|
517
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
518
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
519
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
520
|
-
req.headers = {
|
|
521
|
-
**(req.headers || {}),
|
|
522
|
-
**@request_client.get_headers,
|
|
523
|
-
**(request_options&.additional_headers || {})
|
|
524
|
-
}.compact
|
|
525
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
526
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
527
|
-
end
|
|
528
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
529
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
530
|
-
end
|
|
531
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
532
|
-
request_options: request_options)}/users/#{id}/points/#{key}/boosts"
|
|
533
|
-
end
|
|
534
|
-
parsed_json = JSON.parse(response.body)
|
|
535
|
-
parsed_json&.map do |item|
|
|
536
|
-
item = item.to_json
|
|
537
|
-
TrophyApiClient::PointsBoost.from_json(json_object: item)
|
|
538
|
-
end
|
|
539
|
-
end
|
|
540
|
-
|
|
541
|
-
# Get a summary of points awards over time for a user for a specific points
|
|
542
|
-
# system.
|
|
543
|
-
#
|
|
544
|
-
# @param id [String] ID of the user.
|
|
545
|
-
# @param key [String] Key of the points system.
|
|
546
|
-
# @param aggregation [TrophyApiClient::Users::UsersPointsEventSummaryRequestAggregation] The time period over which to aggregate the event data.
|
|
547
|
-
# @param start_date [String] The start date for the data range in YYYY-MM-DD format. The startDate must be
|
|
548
|
-
# before the endDate, and the date range must not exceed 400 days.
|
|
549
|
-
# @param end_date [String] The end date for the data range in YYYY-MM-DD format. The endDate must be after
|
|
550
|
-
# the startDate, and the date range must not exceed 400 days.
|
|
551
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
552
|
-
# @return [Array<TrophyApiClient::Users::UsersPointsEventSummaryResponseItem>]
|
|
553
|
-
# @example
|
|
554
|
-
# api = TrophyApiClient::Client.new(
|
|
555
|
-
# base_url: "https://api.example.com",
|
|
556
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
557
|
-
# api_key: "YOUR_API_KEY"
|
|
558
|
-
# )
|
|
559
|
-
# api.users.points_event_summary(
|
|
560
|
-
# id: "userId",
|
|
561
|
-
# key: "points-system-key",
|
|
562
|
-
# aggregation: DAILY,
|
|
563
|
-
# start_date: "2024-01-01",
|
|
564
|
-
# end_date: "2024-01-31"
|
|
565
|
-
# )
|
|
566
|
-
def points_event_summary(id:, key:, aggregation:, start_date:, end_date:, request_options: nil)
|
|
567
|
-
response = @request_client.conn.get do |req|
|
|
568
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
569
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
570
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
571
|
-
req.headers = {
|
|
572
|
-
**(req.headers || {}),
|
|
573
|
-
**@request_client.get_headers,
|
|
574
|
-
**(request_options&.additional_headers || {})
|
|
575
|
-
}.compact
|
|
576
|
-
req.params = {
|
|
577
|
-
**(request_options&.additional_query_parameters || {}),
|
|
578
|
-
"aggregation": aggregation,
|
|
579
|
-
"startDate": start_date,
|
|
580
|
-
"endDate": end_date
|
|
581
|
-
}.compact
|
|
582
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
583
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
584
|
-
end
|
|
585
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
586
|
-
request_options: request_options)}/users/#{id}/points/#{key}/event-summary"
|
|
587
|
-
end
|
|
588
|
-
parsed_json = JSON.parse(response.body)
|
|
589
|
-
parsed_json&.map do |item|
|
|
590
|
-
item = item.to_json
|
|
591
|
-
TrophyApiClient::Users::UsersPointsEventSummaryResponseItem.from_json(json_object: item)
|
|
592
|
-
end
|
|
593
|
-
end
|
|
594
|
-
|
|
595
|
-
# Get a user's rank, value, and daily ranking history for a specific leaderboard.
|
|
596
|
-
#
|
|
597
|
-
# @param id [String] The user's ID in your database.
|
|
598
|
-
# @param key [String] Unique key of the leaderboard as set when created.
|
|
599
|
-
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
|
600
|
-
# run.
|
|
601
|
-
# @param num_events [Integer] The number of days to return in the leaderboard history for the user.
|
|
602
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
603
|
-
# @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
|
|
604
|
-
# @example
|
|
605
|
-
# api = TrophyApiClient::Client.new(
|
|
606
|
-
# base_url: "https://api.example.com",
|
|
607
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
608
|
-
# api_key: "YOUR_API_KEY"
|
|
609
|
-
# )
|
|
610
|
-
# api.users.leaderboard(
|
|
611
|
-
# id: "user-123",
|
|
612
|
-
# key: "weekly-words",
|
|
613
|
-
# run: "2025-01-15",
|
|
614
|
-
# num_events: 1
|
|
615
|
-
# )
|
|
616
|
-
def leaderboard(id:, key:, run: nil, num_events: nil, request_options: nil)
|
|
617
|
-
response = @request_client.conn.get do |req|
|
|
618
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
619
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
620
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
621
|
-
req.headers = {
|
|
622
|
-
**(req.headers || {}),
|
|
623
|
-
**@request_client.get_headers,
|
|
624
|
-
**(request_options&.additional_headers || {})
|
|
625
|
-
}.compact
|
|
626
|
-
req.params = {
|
|
627
|
-
**(request_options&.additional_query_parameters || {}),
|
|
628
|
-
"run": run,
|
|
629
|
-
"numEvents": num_events
|
|
630
|
-
}.compact
|
|
631
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
632
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
633
|
-
end
|
|
634
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
635
|
-
request_options: request_options)}/users/#{id}/leaderboards/#{key}"
|
|
636
|
-
end
|
|
637
|
-
TrophyApiClient::UserLeaderboardResponseWithHistory.from_json(json_object: response.body)
|
|
638
|
-
end
|
|
639
|
-
|
|
640
|
-
# Get a user's year-in-review wrapped data.
|
|
641
|
-
#
|
|
642
|
-
# @param id [String] The user's ID in your database.
|
|
643
|
-
# @param year [Integer] The year to get wrapped data for. Defaults to the current year. Must be an
|
|
644
|
-
# integer between 1 and the current year.
|
|
645
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
646
|
-
# @return [TrophyApiClient::WrappedResponse]
|
|
647
|
-
# @example
|
|
648
|
-
# api = TrophyApiClient::Client.new(
|
|
649
|
-
# base_url: "https://api.example.com",
|
|
650
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
651
|
-
# api_key: "YOUR_API_KEY"
|
|
652
|
-
# )
|
|
653
|
-
# api.users.wrapped(id: "user-123", year: 1)
|
|
654
|
-
def wrapped(id:, year: nil, request_options: nil)
|
|
655
|
-
response = @request_client.conn.get do |req|
|
|
656
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
657
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
658
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
659
|
-
req.headers = {
|
|
660
|
-
**(req.headers || {}),
|
|
661
|
-
**@request_client.get_headers,
|
|
662
|
-
**(request_options&.additional_headers || {})
|
|
663
|
-
}.compact
|
|
664
|
-
req.params = { **(request_options&.additional_query_parameters || {}), "year": year }.compact
|
|
665
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
666
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
667
|
-
end
|
|
668
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/wrapped"
|
|
669
|
-
end
|
|
670
|
-
TrophyApiClient::WrappedResponse.from_json(json_object: response.body)
|
|
671
|
-
end
|
|
672
|
-
end
|
|
673
|
-
|
|
674
|
-
class AsyncUsersClient
|
|
675
|
-
# @return [TrophyApiClient::AsyncRequestClient]
|
|
676
|
-
attr_reader :request_client
|
|
677
|
-
|
|
678
|
-
# @param request_client [TrophyApiClient::AsyncRequestClient]
|
|
679
|
-
# @return [TrophyApiClient::AsyncUsersClient]
|
|
680
|
-
def initialize(request_client:)
|
|
681
|
-
@request_client = request_client
|
|
682
|
-
end
|
|
683
|
-
|
|
684
|
-
# Create a new user.
|
|
685
|
-
#
|
|
686
|
-
# @param request [Hash] Request of type TrophyApiClient::UpsertedUser, as a Hash
|
|
687
|
-
# * :id (String)
|
|
688
|
-
# * :email (String)
|
|
689
|
-
# * :name (String)
|
|
690
|
-
# * :tz (String)
|
|
691
|
-
# * :device_tokens (Array<String>)
|
|
692
|
-
# * :subscribe_to_emails (Boolean)
|
|
693
|
-
# * :attributes (Hash{String => String})
|
|
694
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
695
|
-
# @return [TrophyApiClient::User]
|
|
696
|
-
# @example
|
|
697
|
-
# api = TrophyApiClient::Client.new(
|
|
698
|
-
# base_url: "https://api.example.com",
|
|
699
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
700
|
-
# api_key: "YOUR_API_KEY"
|
|
701
|
-
# )
|
|
702
|
-
# api.users.create(request: { id: "user-id" })
|
|
703
|
-
def create(request:, request_options: nil)
|
|
704
|
-
Async do
|
|
705
|
-
response = @request_client.conn.post do |req|
|
|
706
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
707
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
708
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
709
|
-
req.headers = {
|
|
710
|
-
**(req.headers || {}),
|
|
711
|
-
**@request_client.get_headers,
|
|
712
|
-
**(request_options&.additional_headers || {})
|
|
713
|
-
}.compact
|
|
714
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
715
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
716
|
-
end
|
|
717
|
-
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
718
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users"
|
|
719
|
-
end
|
|
720
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
721
|
-
end
|
|
722
|
-
end
|
|
723
|
-
|
|
724
|
-
# Get a single user.
|
|
725
|
-
#
|
|
726
|
-
# @param id [String] ID of the user to get.
|
|
727
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
728
|
-
# @return [TrophyApiClient::User]
|
|
729
|
-
# @example
|
|
730
|
-
# api = TrophyApiClient::Client.new(
|
|
731
|
-
# base_url: "https://api.example.com",
|
|
732
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
733
|
-
# api_key: "YOUR_API_KEY"
|
|
734
|
-
# )
|
|
735
|
-
# api.users.get(id: "userId")
|
|
736
|
-
def get(id:, request_options: nil)
|
|
737
|
-
Async do
|
|
738
|
-
response = @request_client.conn.get do |req|
|
|
739
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
740
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
741
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
742
|
-
req.headers = {
|
|
743
|
-
**(req.headers || {}),
|
|
744
|
-
**@request_client.get_headers,
|
|
745
|
-
**(request_options&.additional_headers || {})
|
|
746
|
-
}.compact
|
|
747
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
748
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
749
|
-
end
|
|
750
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
751
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
752
|
-
end
|
|
753
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}"
|
|
754
|
-
end
|
|
755
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
756
|
-
end
|
|
757
|
-
end
|
|
758
|
-
|
|
759
|
-
# Identify a user.
|
|
760
|
-
#
|
|
761
|
-
# @param id [String] ID of the user to identify.
|
|
762
|
-
# @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
|
|
763
|
-
# * :email (String)
|
|
764
|
-
# * :name (String)
|
|
765
|
-
# * :tz (String)
|
|
766
|
-
# * :device_tokens (Array<String>)
|
|
767
|
-
# * :subscribe_to_emails (Boolean)
|
|
768
|
-
# * :attributes (Hash{String => String})
|
|
769
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
770
|
-
# @return [TrophyApiClient::User]
|
|
771
|
-
# @example
|
|
772
|
-
# api = TrophyApiClient::Client.new(
|
|
773
|
-
# base_url: "https://api.example.com",
|
|
774
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
775
|
-
# api_key: "YOUR_API_KEY"
|
|
776
|
-
# )
|
|
777
|
-
# api.users.identify(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
778
|
-
def identify(id:, request:, request_options: nil)
|
|
779
|
-
Async do
|
|
780
|
-
response = @request_client.conn.put do |req|
|
|
781
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
782
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
783
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
784
|
-
req.headers = {
|
|
785
|
-
**(req.headers || {}),
|
|
786
|
-
**@request_client.get_headers,
|
|
787
|
-
**(request_options&.additional_headers || {})
|
|
788
|
-
}.compact
|
|
789
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
790
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
791
|
-
end
|
|
792
|
-
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
793
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}"
|
|
794
|
-
end
|
|
795
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
796
|
-
end
|
|
797
|
-
end
|
|
798
|
-
|
|
799
|
-
# Update a user.
|
|
800
|
-
#
|
|
801
|
-
# @param id [String] ID of the user to update.
|
|
802
|
-
# @param request [Hash] The user object.Request of type TrophyApiClient::UpdatedUser, as a Hash
|
|
803
|
-
# * :email (String)
|
|
804
|
-
# * :name (String)
|
|
805
|
-
# * :tz (String)
|
|
806
|
-
# * :device_tokens (Array<String>)
|
|
807
|
-
# * :subscribe_to_emails (Boolean)
|
|
808
|
-
# * :attributes (Hash{String => String})
|
|
809
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
810
|
-
# @return [TrophyApiClient::User]
|
|
811
|
-
# @example
|
|
812
|
-
# api = TrophyApiClient::Client.new(
|
|
813
|
-
# base_url: "https://api.example.com",
|
|
814
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
815
|
-
# api_key: "YOUR_API_KEY"
|
|
816
|
-
# )
|
|
817
|
-
# api.users.update(id: "id", request: { email: "user@example.com", tz: "Europe/London", attributes: { "department": "engineering", "role": "developer" } })
|
|
818
|
-
def update(id:, request:, request_options: nil)
|
|
819
|
-
Async do
|
|
820
|
-
response = @request_client.conn.patch do |req|
|
|
821
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
822
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
823
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
824
|
-
req.headers = {
|
|
825
|
-
**(req.headers || {}),
|
|
826
|
-
**@request_client.get_headers,
|
|
827
|
-
**(request_options&.additional_headers || {})
|
|
828
|
-
}.compact
|
|
829
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
830
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
831
|
-
end
|
|
832
|
-
req.body = { **(request || {}), **(request_options&.additional_body_parameters || {}) }.compact
|
|
833
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}"
|
|
834
|
-
end
|
|
835
|
-
TrophyApiClient::User.from_json(json_object: response.body)
|
|
836
|
-
end
|
|
837
|
-
end
|
|
838
|
-
|
|
839
|
-
# Get a user's notification preferences.
|
|
840
|
-
#
|
|
841
|
-
# @param id [String] The user's ID in your database.
|
|
842
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
843
|
-
# @return [TrophyApiClient::UserPreferencesResponse]
|
|
844
|
-
# @example
|
|
845
|
-
# api = TrophyApiClient::Client.new(
|
|
846
|
-
# base_url: "https://api.example.com",
|
|
847
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
848
|
-
# api_key: "YOUR_API_KEY"
|
|
849
|
-
# )
|
|
850
|
-
# api.users.get_preferences(id: "user-123")
|
|
851
|
-
def get_preferences(id:, request_options: nil)
|
|
852
|
-
Async do
|
|
853
|
-
response = @request_client.conn.get do |req|
|
|
854
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
855
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
856
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
857
|
-
req.headers = {
|
|
858
|
-
**(req.headers || {}),
|
|
859
|
-
**@request_client.get_headers,
|
|
860
|
-
**(request_options&.additional_headers || {})
|
|
861
|
-
}.compact
|
|
862
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
863
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
864
|
-
end
|
|
865
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
866
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
867
|
-
end
|
|
868
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
869
|
-
request_options: request_options)}/users/#{id}/preferences"
|
|
870
|
-
end
|
|
871
|
-
TrophyApiClient::UserPreferencesResponse.from_json(json_object: response.body)
|
|
872
|
-
end
|
|
873
|
-
end
|
|
874
|
-
|
|
875
|
-
# Update a user's notification and streak preferences. Streak preferences require
|
|
876
|
-
# streak customization to be enabled in your Trophy dashboard settings.
|
|
877
|
-
#
|
|
878
|
-
# @param id [String] The user's ID in your database.
|
|
879
|
-
# @param notifications [Hash] Request of type TrophyApiClient::NotificationPreferences, as a Hash
|
|
880
|
-
# * :achievement_completed (Array<TrophyApiClient::NotificationChannel>)
|
|
881
|
-
# * :recap (Array<TrophyApiClient::NotificationChannel>)
|
|
882
|
-
# * :reactivation (Array<TrophyApiClient::NotificationChannel>)
|
|
883
|
-
# * :streak_reminder (Array<TrophyApiClient::NotificationChannel>)
|
|
884
|
-
# @param streak [Hash] Request of type TrophyApiClient::StreakPreferences, as a Hash
|
|
885
|
-
# * :enabled (Boolean)
|
|
886
|
-
# * :evaluation_mode (TrophyApiClient::StreakEvaluationModePreference)
|
|
887
|
-
# * :metrics (Array<TrophyApiClient::StreakMetricPreference>)
|
|
888
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
889
|
-
# @return [TrophyApiClient::UserPreferencesResponse]
|
|
890
|
-
# @example
|
|
891
|
-
# api = TrophyApiClient::Client.new(
|
|
892
|
-
# base_url: "https://api.example.com",
|
|
893
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
894
|
-
# api_key: "YOUR_API_KEY"
|
|
895
|
-
# )
|
|
896
|
-
# api.users.update_preferences(id: "user-123", notifications: { streak_reminder: [EMAIL] })
|
|
897
|
-
def update_preferences(id:, notifications: nil, streak: nil, request_options: nil)
|
|
898
|
-
Async do
|
|
899
|
-
response = @request_client.conn.patch do |req|
|
|
900
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
901
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
902
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
903
|
-
req.headers = {
|
|
904
|
-
**(req.headers || {}),
|
|
905
|
-
**@request_client.get_headers,
|
|
906
|
-
**(request_options&.additional_headers || {})
|
|
907
|
-
}.compact
|
|
908
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
909
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
910
|
-
end
|
|
911
|
-
req.body = {
|
|
912
|
-
**(request_options&.additional_body_parameters || {}),
|
|
913
|
-
notifications: notifications,
|
|
914
|
-
streak: streak
|
|
915
|
-
}.compact
|
|
916
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
917
|
-
request_options: request_options)}/users/#{id}/preferences"
|
|
918
|
-
end
|
|
919
|
-
TrophyApiClient::UserPreferencesResponse.from_json(json_object: response.body)
|
|
920
|
-
end
|
|
921
|
-
end
|
|
922
|
-
|
|
923
|
-
# Get a single user's progress against all active metrics.
|
|
924
|
-
#
|
|
925
|
-
# @param id [String] ID of the user
|
|
926
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
927
|
-
# @return [Array<TrophyApiClient::MetricResponse>]
|
|
928
|
-
# @example
|
|
929
|
-
# api = TrophyApiClient::Client.new(
|
|
930
|
-
# base_url: "https://api.example.com",
|
|
931
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
932
|
-
# api_key: "YOUR_API_KEY"
|
|
933
|
-
# )
|
|
934
|
-
# api.users.all_metrics(id: "userId")
|
|
935
|
-
def all_metrics(id:, request_options: nil)
|
|
936
|
-
Async do
|
|
937
|
-
response = @request_client.conn.get do |req|
|
|
938
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
939
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
940
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
941
|
-
req.headers = {
|
|
942
|
-
**(req.headers || {}),
|
|
943
|
-
**@request_client.get_headers,
|
|
944
|
-
**(request_options&.additional_headers || {})
|
|
945
|
-
}.compact
|
|
946
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
947
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
948
|
-
end
|
|
949
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
950
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
951
|
-
end
|
|
952
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/metrics"
|
|
953
|
-
end
|
|
954
|
-
parsed_json = JSON.parse(response.body)
|
|
955
|
-
parsed_json&.map do |item|
|
|
956
|
-
item = item.to_json
|
|
957
|
-
TrophyApiClient::MetricResponse.from_json(json_object: item)
|
|
958
|
-
end
|
|
959
|
-
end
|
|
960
|
-
end
|
|
961
|
-
|
|
962
|
-
# Get a user's progress against a single active metric.
|
|
963
|
-
#
|
|
964
|
-
# @param id [String] ID of the user.
|
|
965
|
-
# @param key [String] Unique key of the metric.
|
|
966
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
967
|
-
# @return [TrophyApiClient::MetricResponse]
|
|
968
|
-
# @example
|
|
969
|
-
# api = TrophyApiClient::Client.new(
|
|
970
|
-
# base_url: "https://api.example.com",
|
|
971
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
972
|
-
# api_key: "YOUR_API_KEY"
|
|
973
|
-
# )
|
|
974
|
-
# api.users.single_metric(id: "userId", key: "key")
|
|
975
|
-
def single_metric(id:, key:, request_options: nil)
|
|
976
|
-
Async do
|
|
977
|
-
response = @request_client.conn.get do |req|
|
|
978
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
979
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
980
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
981
|
-
req.headers = {
|
|
982
|
-
**(req.headers || {}),
|
|
983
|
-
**@request_client.get_headers,
|
|
984
|
-
**(request_options&.additional_headers || {})
|
|
985
|
-
}.compact
|
|
986
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
987
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
988
|
-
end
|
|
989
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
990
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
991
|
-
end
|
|
992
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
993
|
-
request_options: request_options)}/users/#{id}/metrics/#{key}"
|
|
994
|
-
end
|
|
995
|
-
TrophyApiClient::MetricResponse.from_json(json_object: response.body)
|
|
996
|
-
end
|
|
997
|
-
end
|
|
998
|
-
|
|
999
|
-
# Get a summary of metric events over time for a user.
|
|
1000
|
-
#
|
|
1001
|
-
# @param id [String] ID of the user.
|
|
1002
|
-
# @param key [String] Unique key of the metric.
|
|
1003
|
-
# @param aggregation [TrophyApiClient::Users::UsersMetricEventSummaryRequestAggregation] The time period over which to aggregate the event data.
|
|
1004
|
-
# @param start_date [String] The start date for the data range in YYYY-MM-DD format. The startDate must be
|
|
1005
|
-
# before the endDate, and the date range must not exceed 400 days.
|
|
1006
|
-
# @param end_date [String] The end date for the data range in YYYY-MM-DD format. The endDate must be after
|
|
1007
|
-
# the startDate, and the date range must not exceed 400 days.
|
|
1008
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1009
|
-
# @return [Array<TrophyApiClient::Users::UsersMetricEventSummaryResponseItem>]
|
|
1010
|
-
# @example
|
|
1011
|
-
# api = TrophyApiClient::Client.new(
|
|
1012
|
-
# base_url: "https://api.example.com",
|
|
1013
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1014
|
-
# api_key: "YOUR_API_KEY"
|
|
1015
|
-
# )
|
|
1016
|
-
# api.users.metric_event_summary(
|
|
1017
|
-
# id: "userId",
|
|
1018
|
-
# key: "words-written",
|
|
1019
|
-
# aggregation: DAILY,
|
|
1020
|
-
# start_date: "2024-01-01",
|
|
1021
|
-
# end_date: "2024-01-31"
|
|
1022
|
-
# )
|
|
1023
|
-
def metric_event_summary(id:, key:, aggregation:, start_date:, end_date:, request_options: nil)
|
|
1024
|
-
Async do
|
|
1025
|
-
response = @request_client.conn.get do |req|
|
|
1026
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1027
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1028
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1029
|
-
req.headers = {
|
|
1030
|
-
**(req.headers || {}),
|
|
1031
|
-
**@request_client.get_headers,
|
|
1032
|
-
**(request_options&.additional_headers || {})
|
|
1033
|
-
}.compact
|
|
1034
|
-
req.params = {
|
|
1035
|
-
**(request_options&.additional_query_parameters || {}),
|
|
1036
|
-
"aggregation": aggregation,
|
|
1037
|
-
"startDate": start_date,
|
|
1038
|
-
"endDate": end_date
|
|
1039
|
-
}.compact
|
|
1040
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1041
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1042
|
-
end
|
|
1043
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
1044
|
-
request_options: request_options)}/users/#{id}/metrics/#{key}/event-summary"
|
|
1045
|
-
end
|
|
1046
|
-
parsed_json = JSON.parse(response.body)
|
|
1047
|
-
parsed_json&.map do |item|
|
|
1048
|
-
item = item.to_json
|
|
1049
|
-
TrophyApiClient::Users::UsersMetricEventSummaryResponseItem.from_json(json_object: item)
|
|
1050
|
-
end
|
|
1051
|
-
end
|
|
1052
|
-
end
|
|
1053
|
-
|
|
1054
|
-
# Get a user's achievements.
|
|
1055
|
-
#
|
|
1056
|
-
# @param id [String] ID of the user.
|
|
1057
|
-
# @param include_incomplete [String] When set to 'true', returns both completed and incomplete achievements for the
|
|
1058
|
-
# user. When omitted or set to any other value, returns only completed
|
|
1059
|
-
# achievements.
|
|
1060
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1061
|
-
# @return [Array<TrophyApiClient::UserAchievementWithStatsResponse>]
|
|
1062
|
-
# @example
|
|
1063
|
-
# api = TrophyApiClient::Client.new(
|
|
1064
|
-
# base_url: "https://api.example.com",
|
|
1065
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1066
|
-
# api_key: "YOUR_API_KEY"
|
|
1067
|
-
# )
|
|
1068
|
-
# api.users.achievements(id: "userId", include_incomplete: "true")
|
|
1069
|
-
def achievements(id:, include_incomplete: nil, request_options: nil)
|
|
1070
|
-
Async do
|
|
1071
|
-
response = @request_client.conn.get do |req|
|
|
1072
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1073
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1074
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1075
|
-
req.headers = {
|
|
1076
|
-
**(req.headers || {}),
|
|
1077
|
-
**@request_client.get_headers,
|
|
1078
|
-
**(request_options&.additional_headers || {})
|
|
1079
|
-
}.compact
|
|
1080
|
-
req.params = {
|
|
1081
|
-
**(request_options&.additional_query_parameters || {}),
|
|
1082
|
-
"includeIncomplete": include_incomplete
|
|
1083
|
-
}.compact
|
|
1084
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1085
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1086
|
-
end
|
|
1087
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
1088
|
-
request_options: request_options)}/users/#{id}/achievements"
|
|
1089
|
-
end
|
|
1090
|
-
parsed_json = JSON.parse(response.body)
|
|
1091
|
-
parsed_json&.map do |item|
|
|
1092
|
-
item = item.to_json
|
|
1093
|
-
TrophyApiClient::UserAchievementWithStatsResponse.from_json(json_object: item)
|
|
1094
|
-
end
|
|
1095
|
-
end
|
|
1096
|
-
end
|
|
1097
|
-
|
|
1098
|
-
# Get a user's streak data.
|
|
1099
|
-
#
|
|
1100
|
-
# @param id [String] ID of the user.
|
|
1101
|
-
# @param history_periods [Integer] The number of past streak periods to include in the streakHistory field of the
|
|
1102
|
-
# response.
|
|
1103
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1104
|
-
# @return [TrophyApiClient::StreakResponse]
|
|
1105
|
-
# @example
|
|
1106
|
-
# api = TrophyApiClient::Client.new(
|
|
1107
|
-
# base_url: "https://api.example.com",
|
|
1108
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1109
|
-
# api_key: "YOUR_API_KEY"
|
|
1110
|
-
# )
|
|
1111
|
-
# api.users.streak(id: "userId", history_periods: 1)
|
|
1112
|
-
def streak(id:, history_periods: nil, request_options: nil)
|
|
1113
|
-
Async do
|
|
1114
|
-
response = @request_client.conn.get do |req|
|
|
1115
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1116
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1117
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1118
|
-
req.headers = {
|
|
1119
|
-
**(req.headers || {}),
|
|
1120
|
-
**@request_client.get_headers,
|
|
1121
|
-
**(request_options&.additional_headers || {})
|
|
1122
|
-
}.compact
|
|
1123
|
-
req.params = {
|
|
1124
|
-
**(request_options&.additional_query_parameters || {}),
|
|
1125
|
-
"historyPeriods": history_periods
|
|
1126
|
-
}.compact
|
|
1127
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1128
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1129
|
-
end
|
|
1130
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/streak"
|
|
1131
|
-
end
|
|
1132
|
-
TrophyApiClient::StreakResponse.from_json(json_object: response.body)
|
|
1133
|
-
end
|
|
1134
|
-
end
|
|
1135
|
-
|
|
1136
|
-
# Get a user's points for a specific points system.
|
|
1137
|
-
#
|
|
1138
|
-
# @param id [String] ID of the user.
|
|
1139
|
-
# @param key [String] Key of the points system.
|
|
1140
|
-
# @param awards [Integer] The number of recent point awards to return.
|
|
1141
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1142
|
-
# @return [TrophyApiClient::GetUserPointsResponse]
|
|
1143
|
-
# @example
|
|
1144
|
-
# api = TrophyApiClient::Client.new(
|
|
1145
|
-
# base_url: "https://api.example.com",
|
|
1146
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1147
|
-
# api_key: "YOUR_API_KEY"
|
|
1148
|
-
# )
|
|
1149
|
-
# api.users.points(
|
|
1150
|
-
# id: "userId",
|
|
1151
|
-
# key: "points-system-key",
|
|
1152
|
-
# awards: 1
|
|
1153
|
-
# )
|
|
1154
|
-
def points(id:, key:, awards: nil, request_options: nil)
|
|
1155
|
-
Async do
|
|
1156
|
-
response = @request_client.conn.get do |req|
|
|
1157
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1158
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1159
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1160
|
-
req.headers = {
|
|
1161
|
-
**(req.headers || {}),
|
|
1162
|
-
**@request_client.get_headers,
|
|
1163
|
-
**(request_options&.additional_headers || {})
|
|
1164
|
-
}.compact
|
|
1165
|
-
req.params = { **(request_options&.additional_query_parameters || {}), "awards": awards }.compact
|
|
1166
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1167
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1168
|
-
end
|
|
1169
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
1170
|
-
request_options: request_options)}/users/#{id}/points/#{key}"
|
|
1171
|
-
end
|
|
1172
|
-
TrophyApiClient::GetUserPointsResponse.from_json(json_object: response.body)
|
|
1173
|
-
end
|
|
1174
|
-
end
|
|
1175
|
-
|
|
1176
|
-
# Get active points boosts for a user in a specific points system. Returns both
|
|
1177
|
-
# global boosts the user is eligible for and user-specific boosts.
|
|
1178
|
-
#
|
|
1179
|
-
# @param id [String] ID of the user.
|
|
1180
|
-
# @param key [String] Key of the points system.
|
|
1181
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1182
|
-
# @return [Array<TrophyApiClient::PointsBoost>]
|
|
1183
|
-
# @example
|
|
1184
|
-
# api = TrophyApiClient::Client.new(
|
|
1185
|
-
# base_url: "https://api.example.com",
|
|
1186
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1187
|
-
# api_key: "YOUR_API_KEY"
|
|
1188
|
-
# )
|
|
1189
|
-
# api.users.points_boosts(id: "userId", key: "points-system-key")
|
|
1190
|
-
def points_boosts(id:, key:, request_options: nil)
|
|
1191
|
-
Async do
|
|
1192
|
-
response = @request_client.conn.get do |req|
|
|
1193
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1194
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1195
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1196
|
-
req.headers = {
|
|
1197
|
-
**(req.headers || {}),
|
|
1198
|
-
**@request_client.get_headers,
|
|
1199
|
-
**(request_options&.additional_headers || {})
|
|
1200
|
-
}.compact
|
|
1201
|
-
unless request_options.nil? || request_options&.additional_query_parameters.nil?
|
|
1202
|
-
req.params = { **(request_options&.additional_query_parameters || {}) }.compact
|
|
1203
|
-
end
|
|
1204
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1205
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1206
|
-
end
|
|
1207
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
1208
|
-
request_options: request_options)}/users/#{id}/points/#{key}/boosts"
|
|
1209
|
-
end
|
|
1210
|
-
parsed_json = JSON.parse(response.body)
|
|
1211
|
-
parsed_json&.map do |item|
|
|
1212
|
-
item = item.to_json
|
|
1213
|
-
TrophyApiClient::PointsBoost.from_json(json_object: item)
|
|
1214
|
-
end
|
|
1215
|
-
end
|
|
1216
|
-
end
|
|
1217
|
-
|
|
1218
|
-
# Get a summary of points awards over time for a user for a specific points
|
|
1219
|
-
# system.
|
|
1220
|
-
#
|
|
1221
|
-
# @param id [String] ID of the user.
|
|
1222
|
-
# @param key [String] Key of the points system.
|
|
1223
|
-
# @param aggregation [TrophyApiClient::Users::UsersPointsEventSummaryRequestAggregation] The time period over which to aggregate the event data.
|
|
1224
|
-
# @param start_date [String] The start date for the data range in YYYY-MM-DD format. The startDate must be
|
|
1225
|
-
# before the endDate, and the date range must not exceed 400 days.
|
|
1226
|
-
# @param end_date [String] The end date for the data range in YYYY-MM-DD format. The endDate must be after
|
|
1227
|
-
# the startDate, and the date range must not exceed 400 days.
|
|
1228
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1229
|
-
# @return [Array<TrophyApiClient::Users::UsersPointsEventSummaryResponseItem>]
|
|
1230
|
-
# @example
|
|
1231
|
-
# api = TrophyApiClient::Client.new(
|
|
1232
|
-
# base_url: "https://api.example.com",
|
|
1233
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1234
|
-
# api_key: "YOUR_API_KEY"
|
|
1235
|
-
# )
|
|
1236
|
-
# api.users.points_event_summary(
|
|
1237
|
-
# id: "userId",
|
|
1238
|
-
# key: "points-system-key",
|
|
1239
|
-
# aggregation: DAILY,
|
|
1240
|
-
# start_date: "2024-01-01",
|
|
1241
|
-
# end_date: "2024-01-31"
|
|
1242
|
-
# )
|
|
1243
|
-
def points_event_summary(id:, key:, aggregation:, start_date:, end_date:, request_options: nil)
|
|
1244
|
-
Async do
|
|
1245
|
-
response = @request_client.conn.get do |req|
|
|
1246
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1247
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1248
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1249
|
-
req.headers = {
|
|
1250
|
-
**(req.headers || {}),
|
|
1251
|
-
**@request_client.get_headers,
|
|
1252
|
-
**(request_options&.additional_headers || {})
|
|
1253
|
-
}.compact
|
|
1254
|
-
req.params = {
|
|
1255
|
-
**(request_options&.additional_query_parameters || {}),
|
|
1256
|
-
"aggregation": aggregation,
|
|
1257
|
-
"startDate": start_date,
|
|
1258
|
-
"endDate": end_date
|
|
1259
|
-
}.compact
|
|
1260
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1261
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1262
|
-
end
|
|
1263
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
1264
|
-
request_options: request_options)}/users/#{id}/points/#{key}/event-summary"
|
|
1265
|
-
end
|
|
1266
|
-
parsed_json = JSON.parse(response.body)
|
|
1267
|
-
parsed_json&.map do |item|
|
|
1268
|
-
item = item.to_json
|
|
1269
|
-
TrophyApiClient::Users::UsersPointsEventSummaryResponseItem.from_json(json_object: item)
|
|
1270
|
-
end
|
|
1271
|
-
end
|
|
1272
|
-
end
|
|
1273
|
-
|
|
1274
|
-
# Get a user's rank, value, and daily ranking history for a specific leaderboard.
|
|
1275
|
-
#
|
|
1276
|
-
# @param id [String] The user's ID in your database.
|
|
1277
|
-
# @param key [String] Unique key of the leaderboard as set when created.
|
|
1278
|
-
# @param run [String] Specific run date in YYYY-MM-DD format. If not provided, returns the current
|
|
1279
|
-
# run.
|
|
1280
|
-
# @param num_events [Integer] The number of days to return in the leaderboard history for the user.
|
|
1281
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1282
|
-
# @return [TrophyApiClient::UserLeaderboardResponseWithHistory]
|
|
1283
|
-
# @example
|
|
1284
|
-
# api = TrophyApiClient::Client.new(
|
|
1285
|
-
# base_url: "https://api.example.com",
|
|
1286
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1287
|
-
# api_key: "YOUR_API_KEY"
|
|
1288
|
-
# )
|
|
1289
|
-
# api.users.leaderboard(
|
|
1290
|
-
# id: "user-123",
|
|
1291
|
-
# key: "weekly-words",
|
|
1292
|
-
# run: "2025-01-15",
|
|
1293
|
-
# num_events: 1
|
|
1294
|
-
# )
|
|
1295
|
-
def leaderboard(id:, key:, run: nil, num_events: nil, request_options: nil)
|
|
1296
|
-
Async do
|
|
1297
|
-
response = @request_client.conn.get do |req|
|
|
1298
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1299
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1300
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1301
|
-
req.headers = {
|
|
1302
|
-
**(req.headers || {}),
|
|
1303
|
-
**@request_client.get_headers,
|
|
1304
|
-
**(request_options&.additional_headers || {})
|
|
1305
|
-
}.compact
|
|
1306
|
-
req.params = {
|
|
1307
|
-
**(request_options&.additional_query_parameters || {}),
|
|
1308
|
-
"run": run,
|
|
1309
|
-
"numEvents": num_events
|
|
1310
|
-
}.compact
|
|
1311
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1312
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1313
|
-
end
|
|
1314
|
-
req.url "#{@request_client.get_url(environment: api,
|
|
1315
|
-
request_options: request_options)}/users/#{id}/leaderboards/#{key}"
|
|
1316
|
-
end
|
|
1317
|
-
TrophyApiClient::UserLeaderboardResponseWithHistory.from_json(json_object: response.body)
|
|
1318
|
-
end
|
|
1319
|
-
end
|
|
1320
|
-
|
|
1321
|
-
# Get a user's year-in-review wrapped data.
|
|
1322
|
-
#
|
|
1323
|
-
# @param id [String] The user's ID in your database.
|
|
1324
|
-
# @param year [Integer] The year to get wrapped data for. Defaults to the current year. Must be an
|
|
1325
|
-
# integer between 1 and the current year.
|
|
1326
|
-
# @param request_options [TrophyApiClient::RequestOptions]
|
|
1327
|
-
# @return [TrophyApiClient::WrappedResponse]
|
|
1328
|
-
# @example
|
|
1329
|
-
# api = TrophyApiClient::Client.new(
|
|
1330
|
-
# base_url: "https://api.example.com",
|
|
1331
|
-
# environment: TrophyApiClient::Environment::PRODUCTION,
|
|
1332
|
-
# api_key: "YOUR_API_KEY"
|
|
1333
|
-
# )
|
|
1334
|
-
# api.users.wrapped(id: "user-123", year: 1)
|
|
1335
|
-
def wrapped(id:, year: nil, request_options: nil)
|
|
1336
|
-
Async do
|
|
1337
|
-
response = @request_client.conn.get do |req|
|
|
1338
|
-
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
|
|
1339
|
-
req.headers["X-API-KEY"] = request_options.api_key unless request_options&.api_key.nil?
|
|
1340
|
-
req.headers["Tenant-ID"] = request_options.tenant_id unless request_options&.tenant_id.nil?
|
|
1341
|
-
req.headers = {
|
|
1342
|
-
**(req.headers || {}),
|
|
1343
|
-
**@request_client.get_headers,
|
|
1344
|
-
**(request_options&.additional_headers || {})
|
|
1345
|
-
}.compact
|
|
1346
|
-
req.params = { **(request_options&.additional_query_parameters || {}), "year": year }.compact
|
|
1347
|
-
unless request_options.nil? || request_options&.additional_body_parameters.nil?
|
|
1348
|
-
req.body = { **(request_options&.additional_body_parameters || {}) }.compact
|
|
1349
|
-
end
|
|
1350
|
-
req.url "#{@request_client.get_url(environment: api, request_options: request_options)}/users/#{id}/wrapped"
|
|
1351
|
-
end
|
|
1352
|
-
TrophyApiClient::WrappedResponse.from_json(json_object: response.body)
|
|
1353
|
-
end
|
|
1354
|
-
end
|
|
1355
|
-
end
|
|
1356
|
-
end
|