@@ -110,6 +110,12 @@ type ModalViewRequest struct {
110110 ExternalID string `json:"external_id,omitempty"`
111111}
112112
113+ type PublishViewContextRequest struct {
114+ UserID string `json:"user_id"`
115+ View HomeTabViewRequest `json:"view"`
116+ Hash * string `json:"hash,omitempty"`
117+ }
118+
113119func (v * ModalViewRequest ) ViewType () ViewType {
114120 return v .Type
115121}
@@ -131,12 +137,6 @@ type openViewRequest struct {
131137 View ModalViewRequest `json:"view"`
132138}
133139
134- type publishViewRequest struct {
135- UserID string `json:"user_id"`
136- View HomeTabViewRequest `json:"view"`
137- Hash string `json:"hash,omitempty"`
138- }
139-
140140type pushViewRequest struct {
141141 TriggerID string `json:"trigger_id"`
142142 View ModalViewRequest `json:"view"`
@@ -212,25 +212,18 @@ func (api *Client) OpenViewContext(
212212// PublishView publishes a static view for a user.
213213// For more information see the PublishViewContext documentation.
214214func (api * Client ) PublishView (userID string , view HomeTabViewRequest , hash string ) (* ViewResponse , error ) {
215- return api .PublishViewContext (context .Background (), userID , view , hash )
215+ return api .PublishViewContext (context .Background (), PublishViewContextRequest { UserID : userID , View : view , Hash : & hash } )
216216}
217217
218218// PublishViewContext publishes a static view for a user with a custom context.
219219// Slack API docs: https://api.slack.com/methods/views.publish
220220func (api * Client ) PublishViewContext (
221221 ctx context.Context ,
222- userID string ,
223- view HomeTabViewRequest ,
224- hash string ,
222+ req PublishViewContextRequest ,
225223) (* ViewResponse , error ) {
226- if userID == "" {
224+ if req . UserID == "" {
227225 return nil , ErrParametersMissing
228226 }
229- req := publishViewRequest {
230- UserID : userID ,
231- View : view ,
232- Hash : hash ,
233- }
234227 encoded , err := json .Marshal (req )
235228 if err != nil {
236229 return nil , err
0 commit comments