go-frameproto/stringframebutton1action.go

41 lines
1.5 KiB
Go
Raw Normal View History

2024-02-15 14:02:52 +00:00
package frameproto
// StringFrameButton1Action will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1:action" name-value pair.
//
// For example, this call:
//
// var buttonAction string = "post"
//
2024-02-15 16:43:52 +00:00
// str := frameproto.StringFrameButton1Action(buttonAction)
2024-02-15 14:02:52 +00:00
//
// Would return this HTML <meta/> element:
//
// <meta property="fc:frame:button:1:action" content="post" />
//
// Note that this package provides some constants to use with StringFrameButton1Action.
// Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
//
// Which in code would be used as:
//
2024-02-15 16:43:52 +00:00
// // <meta property="fc:frame:button:1:action" content="link" />
2024-02-15 14:02:52 +00:00
// str := frameproto.StringFrameButton1Action(frameproto.ButtonActionLink)
//
// And:
//
2024-02-15 16:43:52 +00:00
// // <meta property="fc:frame:button:1:action" content="mint" />
2024-02-15 14:02:52 +00:00
// str := frameproto.StringFrameButton1Action(frameproto.ButtonActionMint)
//
// And:
//
2024-02-15 16:43:52 +00:00
// // <meta property="fc:frame:button:1:action" content="post" />
2024-02-15 14:02:52 +00:00
// str :+ frameproto.StringFrameButton1Action(frameproto.ButtonActionPost)
//
// And:
//
2024-02-15 16:43:52 +00:00
// // <meta property="fc:frame:button:1:action" content="post_redirect" />
2024-02-15 14:02:52 +00:00
// str := frameproto.StringFrameButton1Action(frameproto.ButtonActionPostRedirect)
func StringFrameButton1Action(action string) string {
const property string = MetaPropertyFrameButton1Action
return stringMetaPropertyContent(property, action)
}