gitee.com/larksuite/oapi-sdk-go/v3@v3.0.3/service/approval/v4/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 larkapproval 14 15 import "context" 16 17 type P1LeaveApprovalV4Handler struct { 18 handler func(context.Context, *P1LeaveApprovalV4) error 19 } 20 21 func NewP1LeaveApprovalV4Handler(handler func(context.Context, *P1LeaveApprovalV4) error) *P1LeaveApprovalV4Handler { 22 h := &P1LeaveApprovalV4Handler{handler: handler} 23 return h 24 } 25 26 func (h *P1LeaveApprovalV4Handler) Event() interface{} { 27 return &P1LeaveApprovalV4{} 28 } 29 30 func (h *P1LeaveApprovalV4Handler) Handle(ctx context.Context, event interface{}) error { 31 return h.handler(ctx, event.(*P1LeaveApprovalV4)) 32 } 33 34 type P1WorkApprovalV4Handler struct { 35 handler func(context.Context, *P1WorkApprovalV4) error 36 } 37 38 func NewP1WorkApprovalV4Handler(handler func(context.Context, *P1WorkApprovalV4) error) *P1WorkApprovalV4Handler { 39 h := &P1WorkApprovalV4Handler{handler: handler} 40 return h 41 } 42 43 func (h *P1WorkApprovalV4Handler) Event() interface{} { 44 return &P1WorkApprovalV4{} 45 } 46 47 func (h *P1WorkApprovalV4Handler) Handle(ctx context.Context, event interface{}) error { 48 return h.handler(ctx, event.(*P1WorkApprovalV4)) 49 } 50 51 type P1ShiftApprovalV4Handler struct { 52 handler func(context.Context, *P1ShiftApprovalV4) error 53 } 54 55 func NewP1ShiftApprovalV4Handler(handler func(context.Context, *P1ShiftApprovalV4) error) *P1ShiftApprovalV4Handler { 56 h := &P1ShiftApprovalV4Handler{handler: handler} 57 return h 58 } 59 60 func (h *P1ShiftApprovalV4Handler) Event() interface{} { 61 return &P1ShiftApprovalV4{} 62 } 63 64 func (h *P1ShiftApprovalV4Handler) Handle(ctx context.Context, event interface{}) error { 65 return h.handler(ctx, event.(*P1ShiftApprovalV4)) 66 } 67 68 type P1RemedyApprovalV4Handler struct { 69 handler func(context.Context, *P1RemedyApprovalV4) error 70 } 71 72 func NewP1RemedyApprovalV4Handler(handler func(context.Context, *P1RemedyApprovalV4) error) *P1RemedyApprovalV4Handler { 73 h := &P1RemedyApprovalV4Handler{handler: handler} 74 return h 75 } 76 77 func (h *P1RemedyApprovalV4Handler) Event() interface{} { 78 return &P1RemedyApprovalV4{} 79 } 80 81 func (h *P1RemedyApprovalV4Handler) Handle(ctx context.Context, event interface{}) error { 82 return h.handler(ctx, event.(*P1RemedyApprovalV4)) 83 } 84 85 type P1TripApprovalV4Handler struct { 86 handler func(context.Context, *P1TripApprovalV4) error 87 } 88 89 func NewP1TripApprovalV4Handler(handler func(context.Context, *P1TripApprovalV4) error) *P1TripApprovalV4Handler { 90 h := &P1TripApprovalV4Handler{handler: handler} 91 return h 92 } 93 94 func (h *P1TripApprovalV4Handler) Event() interface{} { 95 return &P1TripApprovalV4{} 96 } 97 98 func (h *P1TripApprovalV4Handler) Handle(ctx context.Context, event interface{}) error { 99 return h.handler(ctx, event.(*P1TripApprovalV4)) 100 } 101 102 type P1OutApprovalV4Handler struct { 103 handler func(context.Context, *P1OutApprovalV4) error 104 } 105 106 func NewP1OutApprovalV4Handler(handler func(context.Context, *P1OutApprovalV4) error) *P1OutApprovalV4Handler { 107 h := &P1OutApprovalV4Handler{handler: handler} 108 return h 109 } 110 111 func (h *P1OutApprovalV4Handler) Event() interface{} { 112 return &P1OutApprovalV4{} 113 } 114 115 func (h *P1OutApprovalV4Handler) Handle(ctx context.Context, event interface{}) error { 116 return h.handler(ctx, event.(*P1OutApprovalV4)) 117 }