@@ -2138,7 +2138,7 @@ def views_open(
21382138 kwargs .update ({"view" : view })
21392139 return self .api_call ("views.open" , json = kwargs )
21402140
2141- def views_push (self , * , trigger_id : str , view : dict , ** kwargs ) -> SlackResponse :
2141+ def views_push (self , * , trigger_id : str , view : Union [ dict , View ] , ** kwargs ) -> SlackResponse :
21422142 """Push a view onto the stack of a root view.
21432143
21442144 Push a new view onto the existing view stack by passing a view
@@ -2151,13 +2151,17 @@ def views_push(self, *, trigger_id: str, view: dict, **kwargs) -> SlackResponse:
21512151 Args:
21522152 trigger_id (str): Exchange a trigger to post to the user.
21532153 e.g. '12345.98765.abcd2358fdea'
2154- view (dict): The view payload.
2154+ view (dict or View ): The view payload.
21552155 """
21562156 kwargs .update ({"trigger_id" : trigger_id , "view" : view })
2157+ if isinstance (view , View ):
2158+ kwargs .update ({"view" : view .to_dict ()})
2159+ else :
2160+ kwargs .update ({"view" : view })
21572161 return self .api_call ("views.push" , json = kwargs )
21582162
21592163 def views_update (
2160- self , * , view : dict , external_id : str = None , view_id : str = None , ** kwargs
2164+ self , * , view : Union [ dict , View ] , external_id : str = None , view_id : str = None , ** kwargs
21612165 ) -> SlackResponse :
21622166 """Update an existing view.
21632167
@@ -2168,15 +2172,18 @@ def views_update(
21682172 to learn more about updating views and avoiding race conditions with the hash argument.
21692173
21702174 Args:
2171- view (dict): The view payload.
2175+ view (dict or View ): The view payload.
21722176 external_id (str): A unique identifier of the view set by the developer.
21732177 e.g. 'bmarley_view2'
21742178 view_id (str): A unique identifier of the view to be updated.
21752179 e.g. 'VMM512F2U'
21762180 Raises:
21772181 SlackRequestError: Either view_id or external_id is required.
21782182 """
2179- kwargs .update ({"view" : view })
2183+ if isinstance (view , View ):
2184+ kwargs .update ({"view" : view .to_dict ()})
2185+ else :
2186+ kwargs .update ({"view" : view })
21802187 if external_id :
21812188 kwargs .update ({"external_id" : external_id })
21822189 elif view_id :
@@ -2186,17 +2193,21 @@ def views_update(
21862193
21872194 return self .api_call ("views.update" , json = kwargs )
21882195
2189- def views_publish (self , * , user_id : str , view : dict , ** kwargs ) -> SlackResponse :
2196+ def views_publish (self , * , user_id : str , view : Union [ dict , View ] , ** kwargs ) -> SlackResponse :
21902197 """Publish a static view for a User.
21912198 Create or update the view that comprises an
21922199 app's Home tab (https://api.slack.com/surfaces/tabs)
21932200 for a specific user.
21942201 Args:
21952202 user_id (str): id of the user you want publish a view to.
21962203 e.g. 'U0BPQUNTA'
2197- view (dict): The view payload.
2204+ view (dict or View ): The view payload.
21982205 """
2199- kwargs .update ({"user_id" : user_id , "view" : view })
2206+ kwargs .update ({"user_id" : user_id })
2207+ if isinstance (view , View ):
2208+ kwargs .update ({"view" : view .to_dict ()})
2209+ else :
2210+ kwargs .update ({"view" : view })
22002211 return self .api_call ("views.publish" , json = kwargs )
22012212
22022213 def workflows_stepCompleted (
0 commit comments