@@ -17,8 +17,6 @@ signal channel_ownership_transferred(channel: TaloChannel, new_owner_player_alia
1717signal channel_deleted (channel : TaloChannel )
1818## Emitted when a channel is updated.
1919signal channel_updated (channel : TaloChannel , changed_properties : Array [String ])
20- ## Emitted when one or more props are rejected during a channel create or update.
21- signal channel_props_rejected (rejected_props : Array [TaloRejectedProp ])
2220## Emitted when channel storage props are updated or deleted.
2321signal channel_storage_props_updated (channel : TaloChannel , upserted_props : Array [TaloChannelStorageProp ], deleted_props : Array [TaloChannelStorageProp ])
2422## Emitted when one or more storage props were not successfully set.
@@ -118,9 +116,9 @@ func get_subscribed_channels(options: GetSubscribedChannelsOptions = GetSubscrib
118116 return []
119117
120118## Create a new channel. The player who creates this channel will automatically become the owner. If auto cleanup is enabled, the channel will be deleted when the owner or the last member leaves. Private channels can only be joined by players who have been invited to the channel. Channels with temporary membership will remove players at the end of their session.
121- func create (options : CreateChannelOptions = CreateChannelOptions .new ()) -> TaloChannel :
119+ func create (options : CreateChannelOptions = CreateChannelOptions .new ()) -> ChannelUpsertResult :
122120 if Talo .identity_check () != OK :
123- return
121+ return ChannelUpsertResult . new ( false , null )
124122
125123 var props_to_send := options .props \
126124 .keys () \
@@ -136,15 +134,12 @@ func create(options: CreateChannelOptions = CreateChannelOptions.new()) -> TaloC
136134
137135 match res .status :
138136 200 :
139- return TaloChannel .new (res .body .channel )
137+ return ChannelUpsertResult . new ( true , TaloChannel .new (res .body .channel ) )
140138 400 :
141139 var rejected_props := TaloRejectedProp .from_response (res .body )
142- if rejected_props .size () > 0 :
143- channel_props_rejected .emit (rejected_props )
144-
145- return null
140+ return ChannelUpsertResult .new (false , null , rejected_props )
146141 _ :
147- return null
142+ return ChannelUpsertResult . new ( false , null )
148143
149144## Join an existing channel.
150145func join (channel_id : int ) -> TaloChannel :
@@ -167,9 +162,9 @@ func leave(channel_id: int) -> void:
167162 await client .make_request (HTTPClient .METHOD_POST , "/%s /leave" % channel_id )
168163
169164## Update a channel. This will only work if the current player is the owner of the channel.
170- func update (channel_id : int , options : UpdateChannelOptions = UpdateChannelOptions .new ()) -> TaloChannel :
165+ func update (channel_id : int , options : UpdateChannelOptions = UpdateChannelOptions .new ()) -> ChannelUpsertResult :
171166 if Talo .identity_check () != OK :
172- return
167+ return ChannelUpsertResult . new ( false , null )
173168
174169 var data := {}
175170 if not options .name .is_empty ():
@@ -189,18 +184,15 @@ func update(channel_id: int, options: UpdateChannelOptions = UpdateChannelOption
189184
190185 match res .status :
191186 200 :
192- return TaloChannel .new (res .body .channel )
187+ return ChannelUpsertResult . new ( true , TaloChannel .new (res .body .channel ) )
193188 400 :
194189 var rejected_props := TaloRejectedProp .from_response (res .body )
195- if rejected_props .size () > 0 :
196- channel_props_rejected .emit (rejected_props )
197-
198- return null
190+ return ChannelUpsertResult .new (false , null , rejected_props )
199191 403 :
200192 push_error ("Player does not have permissions to update channel %s ." % channel_id )
201- return null
193+ return ChannelUpsertResult . new ( false , null )
202194 _ :
203- return null
195+ return ChannelUpsertResult . new ( false , null )
204196
205197## Delete a channel. This will only work if the current player is the owner of the channel.
206198func delete (channel_id : int ) -> void :
@@ -433,3 +425,13 @@ class MembersPage:
433425 self .count = count
434426 self .items_per_page = items_per_page
435427 self .is_last_page = is_last_page
428+
429+ class ChannelUpsertResult :
430+ var success : bool
431+ var channel : TaloChannel
432+ var rejected_props : Array [TaloRejectedProp ]
433+
434+ func _init (success : bool , channel : TaloChannel , rejected_props : Array [TaloRejectedProp ] = []) -> void :
435+ self .success = success
436+ self .channel = channel
437+ self .rejected_props = rejected_props
0 commit comments