Class: Whop_sdk::Users::Preferences::Notifications::Topics::Client
- Inherits:
-
Object
- Object
- Whop_sdk::Users::Preferences::Notifications::Topics::Client
- Defined in:
- lib/whop_sdk/users/preferences/notifications/topics/client.rb
Instance Method Summary collapse
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Whop_sdk::Users::Preferences::Notifications::Topics::Types::ListTopicsResponse
Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform defaults.
Constructor Details
#initialize(client:) ⇒ void
12 13 14 |
# File 'lib/whop_sdk/users/preferences/notifications/topics/client.rb', line 12 def initialize(client:) @client = client end |
Instance Method Details
#list(request_options: {}, **params) ⇒ Whop_sdk::Users::Preferences::Notifications::Topics::Types::ListTopicsResponse
Lists the authenticated user's topic-scoped notification preferences, plus user-agnostic platform
defaults. Each filter matches preferences scoped to its value or not narrowed on that dimension.
Per-experience levels are listed separately, by GET /users/me/preferences/notifications/experiences.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/whop_sdk/users/preferences/notifications/topics/client.rb', line 39 def list(request_options: {}, **params) params = Whop_sdk::Internal::Types::Utils.normalize_keys(params) query_params = {} query_params["channel"] = params[:channel] if params.key?(:channel) query_params["account_id"] = params[:account_id] if params.key?(:account_id) query_params["team_account_id"] = params[:team_account_id] if params.key?(:team_account_id) query_params["experience_id"] = params[:experience_id] if params.key?(:experience_id) query_params["topic_id"] = params[:topic_id] if params.key?(:topic_id) query_params["first"] = params[:first] if params.key?(:first) query_params["after"] = params[:after] if params.key?(:after) Whop_sdk::Internal::CursorItemIterator.new( cursor_field: :end_cursor, item_field: :data, initial_cursor: query_params["after"] ) do |next_cursor| query_params["after"] = next_cursor request = Whop_sdk::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "users/me/preferences/notifications/topics", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Whop_sdk::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) parsed_response = Whop_sdk::Users::Preferences::Notifications::Topics::Types::ListTopicsResponse.load(response.body) [parsed_response, response] else error_class = Whop_sdk::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end end |