gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/event/dispatcher/helpdesk_event_dispatch.go (about)

     1  // Package dispatcher code generated by oapi sdk gen
     2  /*
     3   * MIT License
     4   *
     5   * Copyright (c) 2022 Lark Technologies Pte. Ltd.
     6   *
     7   * 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:
     8   *
     9   * The above copyright notice and this permission notice, shall be included in all copies or substantial portions of the Software.
    10   *
    11   * 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.
    12   */
    13  
    14  package dispatcher
    15  
    16  import (
    17  	"context"
    18  	"gitee.com/larksuite/oapi-sdk-go/v3/service/helpdesk/v1"
    19  )
    20  
    21  // 审核事件
    22  //
    23  // - Push审核状态通知事件
    24  //
    25  // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/notification/events/approve
    26  func (dispatcher *EventDispatcher) OnP2NotificationApproveV1(handler func(ctx context.Context, event *larkhelpdesk.P2NotificationApproveV1) error) *EventDispatcher {
    27  	_, existed := dispatcher.eventType2EventHandler["helpdesk.notification.approve_v1"]
    28  	if existed {
    29  		panic("event: multiple handler registrations for " + "helpdesk.notification.approve_v1")
    30  	}
    31  	dispatcher.eventType2EventHandler["helpdesk.notification.approve_v1"] = larkhelpdesk.NewP2NotificationApproveV1Handler(handler)
    32  	return dispatcher
    33  }
    34  
    35  // 工单创建事件
    36  //
    37  // - 可监听服务台的工单创建事件。需使用订阅接口订阅:[事件订阅](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/overview)
    38  //
    39  // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/events/created
    40  func (dispatcher *EventDispatcher) OnP2TicketCreatedV1(handler func(ctx context.Context, event *larkhelpdesk.P2TicketCreatedV1) error) *EventDispatcher {
    41  	_, existed := dispatcher.eventType2EventHandler["helpdesk.ticket.created_v1"]
    42  	if existed {
    43  		panic("event: multiple handler registrations for " + "helpdesk.ticket.created_v1")
    44  	}
    45  	dispatcher.eventType2EventHandler["helpdesk.ticket.created_v1"] = larkhelpdesk.NewP2TicketCreatedV1Handler(handler)
    46  	return dispatcher
    47  }
    48  
    49  // 工单状态变更事件
    50  //
    51  // - 可监听工单状态和阶段变更事件。需使用订阅接口订阅:[事件订阅](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/overview)
    52  //
    53  // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket/events/updated
    54  func (dispatcher *EventDispatcher) OnP2TicketUpdatedV1(handler func(ctx context.Context, event *larkhelpdesk.P2TicketUpdatedV1) error) *EventDispatcher {
    55  	_, existed := dispatcher.eventType2EventHandler["helpdesk.ticket.updated_v1"]
    56  	if existed {
    57  		panic("event: multiple handler registrations for " + "helpdesk.ticket.updated_v1")
    58  	}
    59  	dispatcher.eventType2EventHandler["helpdesk.ticket.updated_v1"] = larkhelpdesk.NewP2TicketUpdatedV1Handler(handler)
    60  	return dispatcher
    61  }
    62  
    63  // 工单消息事件
    64  //
    65  // - 该消息事件属于工单消息事件。需使用订阅接口订阅:[事件订阅](/ssl:ttdoc/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/event/overview)
    66  //
    67  // - 事件描述文档链接:https://open.feishu.cn/document/uAjLw4CM/ukTMukTMukTM/helpdesk-v1/ticket_message/events/created
    68  func (dispatcher *EventDispatcher) OnP2TicketMessageCreatedV1(handler func(ctx context.Context, event *larkhelpdesk.P2TicketMessageCreatedV1) error) *EventDispatcher {
    69  	_, existed := dispatcher.eventType2EventHandler["helpdesk.ticket_message.created_v1"]
    70  	if existed {
    71  		panic("event: multiple handler registrations for " + "helpdesk.ticket_message.created_v1")
    72  	}
    73  	dispatcher.eventType2EventHandler["helpdesk.ticket_message.created_v1"] = larkhelpdesk.NewP2TicketMessageCreatedV1Handler(handler)
    74  	return dispatcher
    75  }