Skip to content

Commit

Permalink
more omitempty
Browse files Browse the repository at this point in the history
  • Loading branch information
tokuhirom committed Oct 25, 2023
1 parent 8732446 commit f4193ae
Show file tree
Hide file tree
Showing 106 changed files with 231 additions and 227 deletions.
8 changes: 4 additions & 4 deletions examples/kitchensink/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ type KitchenSink struct {

// NewKitchenSink function
func NewKitchenSink(channelSecret, channelToken, appBaseURL string) (*KitchenSink, error) {
if appBaseURL == "" {
return nil, fmt.Errorf("missing appBaseURL")
}
bot, err := messaging_api.NewMessagingApiAPI(
channelToken,
)
Expand Down Expand Up @@ -199,10 +202,7 @@ func (app *KitchenSink) handleText(message *webhook.TextMessageContent, replyTok
template := &messaging_api.ButtonsTemplate{
ThumbnailImageUrl: imageURL,
Title: "My button sample",
DefaultAction: &messaging_api.UriAction{
Label: "Go to line.me",
Uri: "https://line.me",
},
Text: "Hello",
Actions: []messaging_api.ActionInterface{
&messaging_api.UriAction{
Label: "Go to line.me",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationC
// As a result, the default value is empty string.
return true;
}
if (var.isString) {
// such as imageBackgroundColor in ButtonsTemplate.
return true;
}
if (var.isPrimitiveType) {
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions linebot/channel_access_token/model_error_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ type ErrorResponse struct {
/**
* Error summary
*/
Error string `json:"error"`
Error string `json:"error,omitempty"`

/**
* Details of the error. Not returned in certain situations.
*/
ErrorDescription string `json:"error_description"`
ErrorDescription string `json:"error_description,omitempty"`
}

func NewErrorResponse() *ErrorResponse {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type VerifyChannelAccessTokenResponse struct {
/**
* Permissions granted to the channel access token.
*/
Scope string `json:"scope"`
Scope string `json:"scope,omitempty"`
}

func NewVerifyChannelAccessTokenResponse(
Expand Down
2 changes: 1 addition & 1 deletion linebot/insight/model_area_tile.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type AreaTile struct {
/**
* users&#39; country and region
*/
Area string `json:"area"`
Area string `json:"area,omitempty"`

/**
* Percentage
Expand Down
4 changes: 2 additions & 2 deletions linebot/insight/model_error_detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ type ErrorDetail struct {
/**
* Details of the error. Not included in the response under certain situations.
*/
Message string `json:"message"`
Message string `json:"message,omitempty"`

/**
* Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations.
*/
Property string `json:"property"`
Property string `json:"property,omitempty"`
}

func NewErrorDetail() *ErrorDetail {
Expand Down
2 changes: 1 addition & 1 deletion linebot/insight/model_get_message_event_response_click.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type GetMessageEventResponseClick struct {
/**
* URL.
*/
Url string `json:"url"`
Url string `json:"url,omitempty"`

/**
* Number of times the URL was opened.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type GetMessageEventResponseOverview struct {
/**
* Request ID.
*/
RequestId string `json:"requestId"`
RequestId string `json:"requestId,omitempty"`

/**
* UNIX timestamp for message delivery time in seconds.
Expand Down
4 changes: 2 additions & 2 deletions linebot/liff/model_add_liff_app_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type AddLiffAppRequest struct {
/**
* Name of the LIFF app. The LIFF app name can&#39;t include \&quot;LINE\&quot; or similar strings, or inappropriate strings.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* Get Features
Expand All @@ -43,7 +43,7 @@ type AddLiffAppRequest struct {
/**
* How additional information in LIFF URLs is handled. Specify `concat`.
*/
PermanentLinkPattern string `json:"permanentLinkPattern"`
PermanentLinkPattern string `json:"permanentLinkPattern,omitempty"`

/**
* Get Scope
Expand Down
6 changes: 3 additions & 3 deletions linebot/liff/model_liff_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type LiffApp struct {
/**
* LIFF app ID
*/
LiffId string `json:"liffId"`
LiffId string `json:"liffId,omitempty"`

/**
* Get View
Expand All @@ -38,7 +38,7 @@ type LiffApp struct {
/**
* Name of the LIFF app
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* Get Features
Expand All @@ -48,7 +48,7 @@ type LiffApp struct {
/**
* How additional information in LIFF URLs is handled. concat is returned.
*/
PermanentLinkPattern string `json:"permanentLinkPattern"`
PermanentLinkPattern string `json:"permanentLinkPattern,omitempty"`

/**
* Get Scope
Expand Down
4 changes: 2 additions & 2 deletions linebot/liff/model_update_liff_app_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type UpdateLiffAppRequest struct {
/**
* Name of the LIFF app. The LIFF app name can&#39;t include \&quot;LINE\&quot; or similar strings, or inappropriate strings.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* Get Features
Expand All @@ -43,7 +43,7 @@ type UpdateLiffAppRequest struct {
/**
* How additional information in LIFF URLs is handled. Specify `concat`.
*/
PermanentLinkPattern string `json:"permanentLinkPattern"`
PermanentLinkPattern string `json:"permanentLinkPattern,omitempty"`

/**
* Get Scope
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type AddAudienceToAudienceGroupRequest struct {
/**
* The audience&#39;s name.
*/
UploadDescription string `json:"uploadDescription"`
UploadDescription string `json:"uploadDescription,omitempty"`

/**
* An array of up to 10,000 user IDs or IFAs.
Expand Down
2 changes: 1 addition & 1 deletion linebot/manage_audience/model_audience.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type Audience struct {
/**
* A user ID or IFA. You can specify an empty array.
*/
Id string `json:"id"`
Id string `json:"id,omitempty"`
}

func NewAudience() *Audience {
Expand Down
6 changes: 3 additions & 3 deletions linebot/manage_audience/model_audience_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AudienceGroup struct {
/**
* The audience&#39;s name.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* Get Status
Expand All @@ -63,12 +63,12 @@ type AudienceGroup struct {
/**
* The request ID that was specified when the audience was created. This is only included when `audienceGroup.type` is CLICK or IMP.
*/
RequestId string `json:"requestId"`
RequestId string `json:"requestId,omitempty"`

/**
* The URL that was specified when the audience was created. This is only included when `audienceGroup.type` is CLICK and link URL is specified.
*/
ClickUrl string `json:"clickUrl"`
ClickUrl string `json:"clickUrl,omitempty"`

/**
* The value indicating the type of account to be sent, as specified when creating the audience for uploading user IDs.
Expand Down
2 changes: 1 addition & 1 deletion linebot/manage_audience/model_audience_group_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type AudienceGroupJob struct {
/**
* The job&#39;s description.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* Get Type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type CreateAudienceGroupRequest struct {
/**
* The audience&#39;s name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* To specify recipients by IFAs: set true. To specify recipients by user IDs: set false or omit isIfaAudience property.
Expand All @@ -38,7 +38,7 @@ type CreateAudienceGroupRequest struct {
/**
* The description to register for the job (in jobs[].description).
*/
UploadDescription string `json:"uploadDescription"`
UploadDescription string `json:"uploadDescription,omitempty"`

/**
* An array of user IDs or IFAs. Max number: 10,000
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type CreateAudienceGroupResponse struct {
/**
* The audience&#39;s name.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* When the audience was created (in UNIX time).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@ type CreateClickBasedAudienceGroupRequest struct {
/**
* The audience&#39;s name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* The request ID of a broadcast or narrowcast message sent in the past 60 days. Each Messaging API request has a request ID.
*/
RequestId string `json:"requestId"`
RequestId string `json:"requestId,omitempty"`

/**
* The URL clicked by the user. If empty, users who clicked any URL in the message are added to the list of recipients. Max character limit: 2,000
*/
ClickUrl string `json:"clickUrl"`
ClickUrl string `json:"clickUrl,omitempty"`
}

func NewCreateClickBasedAudienceGroupRequest() *CreateClickBasedAudienceGroupRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type CreateClickBasedAudienceGroupResponse struct {
/**
* The audience&#39;s name.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* When the audience was created (in UNIX time).
Expand All @@ -48,12 +48,12 @@ type CreateClickBasedAudienceGroupResponse struct {
/**
* The request ID that was specified when the audience was created.
*/
RequestId string `json:"requestId"`
RequestId string `json:"requestId,omitempty"`

/**
* The URL that was specified when the audience was created.
*/
ClickUrl string `json:"clickUrl"`
ClickUrl string `json:"clickUrl,omitempty"`

/**
* How the audience was created. `MESSAGING_API`: An audience created with Messaging API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ type CreateImpBasedAudienceGroupRequest struct {
/**
* The audience&#39;s name. This is case-insensitive, meaning `AUDIENCE` and `audience` are considered identical. Max character limit: 120
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* The request ID of a broadcast or narrowcast message sent in the past 60 days. Each Messaging API request has a request ID.
*/
RequestId string `json:"requestId"`
RequestId string `json:"requestId,omitempty"`
}

func NewCreateImpBasedAudienceGroupRequest() *CreateImpBasedAudienceGroupRequest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type CreateImpBasedAudienceGroupResponse struct {
/**
* The audience&#39;s name.
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`

/**
* When the audience was created (in UNIX time).
Expand All @@ -48,7 +48,7 @@ type CreateImpBasedAudienceGroupResponse struct {
/**
* The request ID that was specified when the audience was created.
*/
RequestId string `json:"requestId"`
RequestId string `json:"requestId,omitempty"`
}

func NewCreateImpBasedAudienceGroupResponse() *CreateImpBasedAudienceGroupResponse {
Expand Down
4 changes: 2 additions & 2 deletions linebot/manage_audience/model_error_detail.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ type ErrorDetail struct {
/**
* Details of the error. Not included in the response under certain situations.
*/
Message string `json:"message"`
Message string `json:"message,omitempty"`

/**
* Location of where the error occurred. Returns the JSON field name or query parameter name of the request. Not included in the response under certain situations.
*/
Property string `json:"property"`
Property string `json:"property,omitempty"`
}

func NewErrorDetail() *ErrorDetail {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type UpdateAudienceGroupDescriptionRequest struct {
/**
* The audience&#39;s name. This is case-insensitive, meaning AUDIENCE and audience are considered identical. Max character limit: 120
*/
Description string `json:"description"`
Description string `json:"description,omitempty"`
}

func NewUpdateAudienceGroupDescriptionRequest() *UpdateAudienceGroupDescriptionRequest {
Expand Down
4 changes: 2 additions & 2 deletions linebot/messaging_api/model_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ func setDiscriminatorPropertyAction(r ActionInterface) ActionInterface {
type Action struct {
// Type of action

Type string `json:"type"`
Type string `json:"type,omitempty"`
// Label for the action.

Label string `json:"label"`
Label string `json:"label,omitempty"`
}

func UnmarshalAction(data []byte) (ActionInterface, error) {
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_alt_uri.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type AltUri struct {
/**
* Get Desktop
*/
Desktop string `json:"desktop"`
Desktop string `json:"desktop,omitempty"`
}

func NewAltUri() *AltUri {
Expand Down
2 changes: 1 addition & 1 deletion linebot/messaging_api/model_audio_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type AudioMessage struct {
/**
* Get OriginalContentUrl
*/
OriginalContentUrl string `json:"originalContentUrl"`
OriginalContentUrl string `json:"originalContentUrl,omitempty"`

/**
* Get Duration
Expand Down
4 changes: 2 additions & 2 deletions linebot/messaging_api/model_bot_info_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type BotInfoResponse struct {
/**
* Bot&#39;s premium ID. Not included in the response if the premium ID isn&#39;t set.
*/
PremiumId string `json:"premiumId"`
PremiumId string `json:"premiumId,omitempty"`

/**
* Bot&#39;s display name (Required)
Expand All @@ -48,7 +48,7 @@ type BotInfoResponse struct {
/**
* Profile image URL. `https` image URL. Not included in the response if the bot doesn&#39;t have a profile image.
*/
PictureUrl string `json:"pictureUrl"`
PictureUrl string `json:"pictureUrl,omitempty"`

/**
* Chat settings set in the LINE Official Account Manager. One of: `chat`: Chat is set to \&quot;On\&quot;. `bot`: Chat is set to \&quot;Off\&quot;. (Required)
Expand Down
Loading

0 comments on commit f4193ae

Please sign in to comment.