66require_relative "../types/updated_user"
77require_relative "../types/user_preferences_response"
88require_relative "../types/notification_preferences"
9+ require_relative "../types/streak_preferences"
910require_relative "../types/metric_response"
1011require "json"
1112require_relative "types/users_metric_event_summary_request_aggregation"
@@ -211,14 +212,18 @@ def get_preferences(id:, request_options: nil)
211212 TrophyApiClient ::UserPreferencesResponse . from_json ( json_object : response . body )
212213 end
213214
214- # Update a user's notification preferences.
215+ # Update a user's notification and streak preferences. Streak preferences require
216+ # streak customization to be enabled in your Trophy dashboard settings.
215217 #
216218 # @param id [String] The user's ID in your database.
217219 # @param notifications [Hash] Request of type TrophyApiClient::NotificationPreferences, as a Hash
218220 # * :achievement_completed (Array<TrophyApiClient::NotificationChannel>)
219221 # * :recap (Array<TrophyApiClient::NotificationChannel>)
220222 # * :reactivation (Array<TrophyApiClient::NotificationChannel>)
221223 # * :streak_reminder (Array<TrophyApiClient::NotificationChannel>)
224+ # @param streak [Hash] Request of type TrophyApiClient::StreakPreferences, as a Hash
225+ # * :evaluation_mode (TrophyApiClient::StreakEvaluationModePreference)
226+ # * :metrics (Array<TrophyApiClient::StreakMetricPreference>)
222227 # @param request_options [TrophyApiClient::RequestOptions]
223228 # @return [TrophyApiClient::UserPreferencesResponse]
224229 # @example
@@ -228,7 +233,7 @@ def get_preferences(id:, request_options: nil)
228233 # api_key: "YOUR_API_KEY"
229234 # )
230235 # api.users.update_preferences(id: "user-123", notifications: { streak_reminder: [EMAIL] })
231- def update_preferences ( id :, notifications : nil , request_options : nil )
236+ def update_preferences ( id :, notifications : nil , streak : nil , request_options : nil )
232237 response = @request_client . conn . patch do |req |
233238 req . options . timeout = request_options . timeout_in_seconds unless request_options &.timeout_in_seconds . nil?
234239 req . headers [ "X-API-KEY" ] = request_options . api_key unless request_options &.api_key . nil?
@@ -241,7 +246,11 @@ def update_preferences(id:, notifications: nil, request_options: nil)
241246 unless request_options . nil? || request_options &.additional_query_parameters . nil?
242247 req . params = { **( request_options &.additional_query_parameters || { } ) } . compact
243248 end
244- req . body = { **( request_options &.additional_body_parameters || { } ) , notifications : notifications } . compact
249+ req . body = {
250+ **( request_options &.additional_body_parameters || { } ) ,
251+ notifications : notifications ,
252+ streak : streak
253+ } . compact
245254 req . url "#{ @request_client . get_url ( environment : api , request_options : request_options ) } /users/#{ id } /preferences"
246255 end
247256 TrophyApiClient ::UserPreferencesResponse . from_json ( json_object : response . body )
@@ -862,14 +871,18 @@ def get_preferences(id:, request_options: nil)
862871 end
863872 end
864873
865- # Update a user's notification preferences.
874+ # Update a user's notification and streak preferences. Streak preferences require
875+ # streak customization to be enabled in your Trophy dashboard settings.
866876 #
867877 # @param id [String] The user's ID in your database.
868878 # @param notifications [Hash] Request of type TrophyApiClient::NotificationPreferences, as a Hash
869879 # * :achievement_completed (Array<TrophyApiClient::NotificationChannel>)
870880 # * :recap (Array<TrophyApiClient::NotificationChannel>)
871881 # * :reactivation (Array<TrophyApiClient::NotificationChannel>)
872882 # * :streak_reminder (Array<TrophyApiClient::NotificationChannel>)
883+ # @param streak [Hash] Request of type TrophyApiClient::StreakPreferences, as a Hash
884+ # * :evaluation_mode (TrophyApiClient::StreakEvaluationModePreference)
885+ # * :metrics (Array<TrophyApiClient::StreakMetricPreference>)
873886 # @param request_options [TrophyApiClient::RequestOptions]
874887 # @return [TrophyApiClient::UserPreferencesResponse]
875888 # @example
@@ -879,7 +892,7 @@ def get_preferences(id:, request_options: nil)
879892 # api_key: "YOUR_API_KEY"
880893 # )
881894 # api.users.update_preferences(id: "user-123", notifications: { streak_reminder: [EMAIL] })
882- def update_preferences ( id :, notifications : nil , request_options : nil )
895+ def update_preferences ( id :, notifications : nil , streak : nil , request_options : nil )
883896 Async do
884897 response = @request_client . conn . patch do |req |
885898 req . options . timeout = request_options . timeout_in_seconds unless request_options &.timeout_in_seconds . nil?
@@ -893,7 +906,11 @@ def update_preferences(id:, notifications: nil, request_options: nil)
893906 unless request_options . nil? || request_options &.additional_query_parameters . nil?
894907 req . params = { **( request_options &.additional_query_parameters || { } ) } . compact
895908 end
896- req . body = { **( request_options &.additional_body_parameters || { } ) , notifications : notifications } . compact
909+ req . body = {
910+ **( request_options &.additional_body_parameters || { } ) ,
911+ notifications : notifications ,
912+ streak : streak
913+ } . compact
897914 req . url "#{ @request_client . get_url ( environment : api ,
898915 request_options : request_options ) } /users/#{ id } /preferences"
899916 end
0 commit comments