Skip to content

Commit

Permalink
Code are generated by openapi generator
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Dec 22, 2023
1 parent 193197e commit f3d0c29
Show file tree
Hide file tree
Showing 14 changed files with 214 additions and 10 deletions.
2 changes: 1 addition & 1 deletion linebot/liff/api_liff.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_add_liff_app_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_add_liff_app_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_get_all_liff_apps_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_liff_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_liff_bot_prompt.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_liff_features.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_liff_scope.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_liff_view.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 1 addition & 1 deletion linebot/liff/model_update_liff_app_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* LIFF server API
* LIFF Server API.
*
* The version of the OpenAPI document: 1.0
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
Expand Down
2 changes: 2 additions & 0 deletions linebot/webhook/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ model_message_content.go
model_message_event.go
model_module_content.go
model_module_event.go
model_pnp_delivery.go
model_pnp_delivery_completion_event.go
model_postback_content.go
model_postback_event.go
model_room_source.go
Expand Down
16 changes: 16 additions & 0 deletions linebot/webhook/model_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ func setDiscriminatorPropertyEvent(r EventInterface) EventInterface {
v.Type = "deactivated"
}
return v
case *PnpDeliveryCompletionEvent:
if v.Type == "" {
v.Type = "delivery"
}
return v
case PnpDeliveryCompletionEvent:
if v.Type == "" {
v.Type = "delivery"
}
return v
case *FollowEvent:
if v.Type == "" {
v.Type = "follow"
Expand Down Expand Up @@ -301,6 +311,12 @@ func UnmarshalEvent(data []byte) (EventInterface, error) {
return nil, fmt.Errorf("UnmarshalEvent: Cannot read deactivated: %w", err)
}
return deactivated, nil
case "delivery":
var delivery PnpDeliveryCompletionEvent
if err := json.Unmarshal(data, &delivery); err != nil {
return nil, fmt.Errorf("UnmarshalEvent: Cannot read delivery: %w", err)
}
return delivery, nil
case "follow":
var follow FollowEvent
if err := json.Unmarshal(data, &follow); err != nil {
Expand Down
31 changes: 31 additions & 0 deletions linebot/webhook/model_pnp_delivery.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/**
* Webhook Type Definition
* Webhook event definition of the LINE Messaging API
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

//go:generate python3 ../../generate-code.py
package webhook

// PnpDelivery
// A delivery object containing a hashed phone number string or a string specified by `X-Line-Delivery-Tag` header

type PnpDelivery struct {

/**
* A hashed phone number string or a string specified by `X-Line-Delivery-Tag` header (Required)
*/
Data string `json:"data"`
}
155 changes: 155 additions & 0 deletions linebot/webhook/model_pnp_delivery_completion_event.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
/**
* Webhook Type Definition
* Webhook event definition of the LINE Messaging API
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/

//go:generate python3 ../../generate-code.py
package webhook

import (
"encoding/json"
"fmt"
)

// PnpDeliveryCompletionEvent
// When a request is made to the LINE notification messages API and delivery of the LINE notification message to the user is completed, a dedicated webhook event (delivery completion event) is sent from the LINE Platform to the webhook URL of the bot server.

type PnpDeliveryCompletionEvent struct {
Event

/**
* Get Source
*/
Source SourceInterface `json:"source,omitempty"`

/**
* Time of the event in milliseconds. (Required)
*/
Timestamp int64 `json:"timestamp"`

/**
* Get Mode
*/
Mode EventMode `json:"mode"`

/**
* Webhook Event ID. An ID that uniquely identifies a webhook event. This is a string in ULID format. (Required)
*/
WebhookEventId string `json:"webhookEventId"`

/**
* Get DeliveryContext
*/
DeliveryContext *DeliveryContext `json:"deliveryContext"`

/**
* Get Delivery
*/
Delivery *PnpDelivery `json:"delivery"`
}

func (cr *PnpDeliveryCompletionEvent) UnmarshalJSON(data []byte) error {
var raw map[string]json.RawMessage
err := json.Unmarshal(data, &raw)
if err != nil {
return fmt.Errorf("JSON parse error in map: %w", err)
}

if raw["type"] != nil {

err = json.Unmarshal(raw["type"], &cr.Type)
if err != nil {
return fmt.Errorf("JSON parse error in string(Type): %w", err)
}

}

if raw["source"] != nil {

if rawsource, ok := raw["source"]; ok && rawsource != nil {
Source, err := UnmarshalSource(rawsource)
if err != nil {
return fmt.Errorf("JSON parse error in Source(discriminator): %w", err)
}
cr.Source = Source
}

}

if raw["timestamp"] != nil {

err = json.Unmarshal(raw["timestamp"], &cr.Timestamp)
if err != nil {
return fmt.Errorf("JSON parse error in int64(Timestamp): %w", err)
}

}

if raw["mode"] != nil {

err = json.Unmarshal(raw["mode"], &cr.Mode)
if err != nil {
return fmt.Errorf("JSON parse error in EventMode(Mode): %w", err)
}

}

if raw["webhookEventId"] != nil {

err = json.Unmarshal(raw["webhookEventId"], &cr.WebhookEventId)
if err != nil {
return fmt.Errorf("JSON parse error in string(WebhookEventId): %w", err)
}

}

if raw["deliveryContext"] != nil {

err = json.Unmarshal(raw["deliveryContext"], &cr.DeliveryContext)
if err != nil {
return fmt.Errorf("JSON parse error in DeliveryContext(DeliveryContext): %w", err)
}

}

if raw["delivery"] != nil {

err = json.Unmarshal(raw["delivery"], &cr.Delivery)
if err != nil {
return fmt.Errorf("JSON parse error in PnpDelivery(Delivery): %w", err)
}

}

return nil
}

// MarshalJSON customizes the JSON serialization of the PnpDeliveryCompletionEvent struct.
func (r *PnpDeliveryCompletionEvent) MarshalJSON() ([]byte, error) {

r.Source = setDiscriminatorPropertySource(r.Source)

type Alias PnpDeliveryCompletionEvent
return json.Marshal(&struct {
*Alias

Type string `json:"type"`
}{
Alias: (*Alias)(r),

Type: "delivery",
})
}

0 comments on commit f3d0c29

Please sign in to comment.