gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/im/v1/ext_event.go (about)

     1  /*
     2   * MIT License
     3   *
     4   * Copyright (c) 2022 Lark Technologies Pte. Ltd.
     5   *
     6   * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
     7   *
     8   * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
     9   *
    10   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
    11   */
    12  
    13  package larkim
    14  
    15  import "context"
    16  
    17  // protocol v1 的 message_read
    18  type P1MessageReadV1Handler struct {
    19  	handler func(context.Context, *P1MessageReadV1) error
    20  }
    21  
    22  func NewP1MessageReadV1Handler(handler func(context.Context, *P1MessageReadV1) error) *P1MessageReadV1Handler {
    23  	h := &P1MessageReadV1Handler{handler: handler}
    24  	return h
    25  }
    26  
    27  func (h *P1MessageReadV1Handler) Event() interface{} {
    28  	return &P1MessageReadV1{}
    29  }
    30  
    31  func (h *P1MessageReadV1Handler) Handle(ctx context.Context, event interface{}) error {
    32  	return h.handler(ctx, event.(*P1MessageReadV1))
    33  }
    34  
    35  // protocol v1 的 message
    36  type P1MessageReceiveV1Handler struct {
    37  	handler func(context.Context, *P1MessageReceiveV1) error
    38  }
    39  
    40  func NewP1MessageReceiveV1Handler(handler func(context.Context, *P1MessageReceiveV1) error) *P1MessageReceiveV1Handler {
    41  	h := &P1MessageReceiveV1Handler{handler: handler}
    42  	return h
    43  }
    44  
    45  func (h *P1MessageReceiveV1Handler) Event() interface{} {
    46  	return &P1MessageReceiveV1{}
    47  }
    48  
    49  func (h *P1MessageReceiveV1Handler) Handle(ctx context.Context, event interface{}) error {
    50  	return h.handler(ctx, event.(*P1MessageReceiveV1))
    51  }
    52  
    53  type P1AddBotV1Handler struct {
    54  	handler func(context.Context, *P1AddBotV1) error
    55  }
    56  
    57  func NewP1AddBotV1Handler(handler func(context.Context, *P1AddBotV1) error) *P1AddBotV1Handler {
    58  	h := &P1AddBotV1Handler{handler: handler}
    59  	return h
    60  }
    61  
    62  func (h *P1AddBotV1Handler) Event() interface{} {
    63  	return &P1AddBotV1{}
    64  }
    65  
    66  func (h *P1AddBotV1Handler) Handle(ctx context.Context, event interface{}) error {
    67  	return h.handler(ctx, event.(*P1AddBotV1))
    68  }
    69  
    70  type P1RemoveBotV1Handler struct {
    71  	handler func(context.Context, *P1RemoveBotV1) error
    72  }
    73  
    74  func NewP1RemoveBotV1Handler(handler func(context.Context, *P1RemoveBotV1) error) *P1RemoveBotV1Handler {
    75  	h := &P1RemoveBotV1Handler{handler: handler}
    76  	return h
    77  }
    78  
    79  func (h *P1RemoveBotV1Handler) Event() interface{} {
    80  	return &P1RemoveBotV1{}
    81  }
    82  
    83  func (h *P1RemoveBotV1Handler) Handle(ctx context.Context, event interface{}) error {
    84  	return h.handler(ctx, event.(*P1RemoveBotV1))
    85  }
    86  
    87  type P1UserInOutChatV1Handler struct {
    88  	handler func(context.Context, *P1UserInOutChatV1) error
    89  }
    90  
    91  func NewP1UserInOutChatV1Handler(handler func(context.Context, *P1UserInOutChatV1) error) *P1UserInOutChatV1Handler {
    92  	h := &P1UserInOutChatV1Handler{handler: handler}
    93  	return h
    94  }
    95  
    96  func (h *P1UserInOutChatV1Handler) Event() interface{} {
    97  	return &P1UserInOutChatV1{}
    98  }
    99  
   100  func (h *P1UserInOutChatV1Handler) Handle(ctx context.Context, event interface{}) error {
   101  	return h.handler(ctx, event.(*P1UserInOutChatV1))
   102  }
   103  
   104  type P1ChatDisbandV1Handler struct {
   105  	handler func(context.Context, *P1ChatDisbandV1) error
   106  }
   107  
   108  func NewP1DisbandChatV1Handler(handler func(context.Context, *P1ChatDisbandV1) error) *P1ChatDisbandV1Handler {
   109  	h := &P1ChatDisbandV1Handler{handler: handler}
   110  	return h
   111  }
   112  
   113  func (h *P1ChatDisbandV1Handler) Event() interface{} {
   114  	return &P1ChatDisbandV1{}
   115  }
   116  
   117  func (h *P1ChatDisbandV1Handler) Handle(ctx context.Context, event interface{}) error {
   118  	return h.handler(ctx, event.(*P1ChatDisbandV1))
   119  }
   120  
   121  type P1GroupSettingUpdatedV1Handler struct {
   122  	handler func(context.Context, *P1GroupSettingUpdatedV1) error
   123  }
   124  
   125  func NewP1GroupSettingUpdatedV1Handler(handler func(context.Context, *P1GroupSettingUpdatedV1) error) *P1GroupSettingUpdatedV1Handler {
   126  	h := &P1GroupSettingUpdatedV1Handler{handler: handler}
   127  	return h
   128  }
   129  
   130  func (h *P1GroupSettingUpdatedV1Handler) Event() interface{} {
   131  	return &P1GroupSettingUpdatedV1{}
   132  }
   133  
   134  func (h *P1GroupSettingUpdatedV1Handler) Handle(ctx context.Context, event interface{}) error {
   135  	return h.handler(ctx, event.(*P1GroupSettingUpdatedV1))
   136  }
   137  
   138  type P1P2PChatCreatedV1Handler struct {
   139  	handler func(context.Context, *P1P2PChatCreatedV1) error
   140  }
   141  
   142  func NewP1P2PChatCreatedV1Handler(handler func(context.Context, *P1P2PChatCreatedV1) error) *P1P2PChatCreatedV1Handler {
   143  	h := &P1P2PChatCreatedV1Handler{handler: handler}
   144  	return h
   145  }
   146  
   147  func (h *P1P2PChatCreatedV1Handler) Event() interface{} {
   148  	return &P1P2PChatCreatedV1{}
   149  }
   150  
   151  func (h *P1P2PChatCreatedV1Handler) Handle(ctx context.Context, event interface{}) error {
   152  	return h.handler(ctx, event.(*P1P2PChatCreatedV1))
   153  }