Documentation ¶
Index ¶
- Constants
- func AppendFrame(p []byte, version string) []byte
- func AppendFrameButton1(p []byte, label string) []byte
- func AppendFrameButton1Action(p []byte, action string) []byte
- func AppendFrameButton1Target(p []byte, target string) []byte
- func AppendFrameButton2(p []byte, label string) []byte
- func AppendFrameButton2Action(p []byte, action string) []byte
- func AppendFrameButton2Target(p []byte, target string) []byte
- func AppendFrameButton3(p []byte, label string) []byte
- func AppendFrameButton3Action(p []byte, action string) []byte
- func AppendFrameButton3Target(p []byte, target string) []byte
- func AppendFrameButton4(p []byte, label string) []byte
- func AppendFrameButton4Action(p []byte, action string) []byte
- func AppendFrameButton4Target(p []byte, target string) []byte
- func AppendFrameImage(p []byte, url string) []byte
- func AppendFrameImageAspectRatio(p []byte, label string) []byte
- func AppendFrameInputText(p []byte, label string) []byte
- func AppendFramePostURL(p []byte, url string) []byte
- func StringFrame(version string) string
- func StringFrameButton1(label string) string
- func StringFrameButton1Action(action string) string
- func StringFrameButton1Target(target string) string
- func StringFrameButton2(label string) string
- func StringFrameButton2Action(action string) string
- func StringFrameButton2Target(target string) string
- func StringFrameButton3(label string) string
- func StringFrameButton3Action(action string) string
- func StringFrameButton3Target(target string) string
- func StringFrameButton4(label string) string
- func StringFrameButton4Action(action string) string
- func StringFrameButton4Target(target string) string
- func StringFrameImage(url string) string
- func StringFrameImageAspectRatio(label string) string
- func StringFrameInputText(label string) string
- func StringFramePostURL(url string) string
- func WriteFrame(writer io.Writer, version string) error
- func WriteFrameButton1(writer io.Writer, label string) error
- func WriteFrameButton1Action(writer io.Writer, action string) error
- func WriteFrameButton1Target(writer io.Writer, target string) error
- func WriteFrameButton2(writer io.Writer, label string) error
- func WriteFrameButton2Action(writer io.Writer, action string) error
- func WriteFrameButton2Target(writer io.Writer, target string) error
- func WriteFrameButton3(writer io.Writer, label string) error
- func WriteFrameButton3Action(writer io.Writer, action string) error
- func WriteFrameButton3Target(writer io.Writer, target string) error
- func WriteFrameButton4(writer io.Writer, label string) error
- func WriteFrameButton4Action(writer io.Writer, action string) error
- func WriteFrameButton4Target(writer io.Writer, target string) error
- func WriteFrameImage(writer io.Writer, url string) error
- func WriteFrameImageAspectRatio(writer io.Writer, label string) error
- func WriteFrameInputText(writer io.Writer, label string) error
- func WriteFramePostURL(writer io.Writer, url string) error
- func WriteSkeleFrame(writer io.Writer, frameWriterFunc func(io.Writer) error) error
- type ActionBody
- type ActionBodyCastID
- type ActionBodyTrustedData
- type ActionBodyUntrustedData
- type FrameWriter
Constants ¶
const ( ButtonActionLink = "link" ButtonActionMint = "mint" ButtonActionPost = "post" ButtonActionPostRedirect = "post_redirect" )
These constants are 'values' in name-value pairs used with HTML <meta /> elements by the frame-protocol, when the name is of the form "fc:frame:button:*:action". I.e., when the name is: "fc:frame:button:1:action", "fc:frame:button:2:action", "fc:frame:button:3:action", or "fc:frame:button:4:action".
For example:
<meta property="fc:frame:button:1:action" content="post" /> <meta property="fc:frame:button:2:action" content="post_redirect" /> <meta property="fc:frame:button:3:action" content="mint" /> <meta property="fc:frame:button:4:action" content="link" />
The way these would be used are:
frameproto.WriteFrameButton1Action(writer, frameproto.ButtonActionLink)
And:
p = frameproto.AppendFrameButton2Action(p, frameproto.ButtonActionMint)
And:
s = frameproto.FrameButton3Action(p, frameproto.ButtonActionPost)
Etc.
const ( MetaPropertyFrame = "fc:frame" MetaPropertyFrameButton1 = "fc:frame:button:1" MetaPropertyFrameButton1Action = "fc:frame:button:1:action" MetaPropertyFrameButton1Target = "fc:frame:button:1:target" MetaPropertyFrameButton2 = "fc:frame:button:2" MetaPropertyFrameButton2Action = "fc:frame:button:2:action" MetaPropertyFrameButton2Target = "fc:frame:button:2:target" MetaPropertyFrameButton3 = "fc:frame:button:3" MetaPropertyFrameButton3Action = "fc:frame:button:3:action" MetaPropertyFrameButton3Target = "fc:frame:button:3:target" MetaPropertyFrameButton4 = "fc:frame:button:4" MetaPropertyFrameButton4Action = "fc:frame:button:4:action" MetaPropertyFrameButton4Target = "fc:frame:button:4:target" MetaPropertyFrameImage = "fc:frame:image" MetaPropertyFrameImageAspectRatio = "fc:frame:image:aspect_ratio" MetaPropertyFrameInputText = "fc:frame:input:text" MetaPropertyFramePostURL = "fc:frame:post_url" )
These constants are 'names' in name-value pairs used with HTML <meta /> elements by the frame-protocol.
For example:
<meta property="fc:frame" content="vNext" /> <meta property="fc:frame:image" content="https://example.com/path/to/image.png" /> <meta property="og:image" content="https://example.com/path/to/image.png" />
const AspectRatioOnePointNineOneToOne = "1.91:1"
const AspectRatioOneToOne = "1:1"
const (
VersionVNext = "vNext"
)
Variables ¶
This section is empty.
Functions ¶
func AppendFrame ¶
AppendFrame will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame" name-value pair.
For example, this call:
var p []byte // ... var version string = "vNext" p = frameproto.AppendFrame(p, version)
Would append this HTML <meta/> element:
<meta property="fc:frame" content="vNext" />
Note that this package provides some constants to use with AppendFrame. Namely: VersionVNext (for "vNext").
Which in code would be used as:
p = frameproto.AppendFrame(p, frameproto.VersionVNext)
func AppendFrameButton1 ¶
AppendFrameButton1 will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1" name-value pair.
For example, this call:
var p []byte // ... var label string = "go forward" p = frameproto.AppendFrameButton1(p, label)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:1" content="go forward" />
func AppendFrameButton1Action ¶
AppendFrameButton1Action will append 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 p []byte // .. var buttonAction string = "post" p = frameproto.AppendFrameButton1Action(p, buttonAction)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:1:action" content="post" />
Note that this package provides some constants to use with AppendFrameButton1Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:1:action" content="link" /> p = frameproto.AppendFrameButton1Action(p, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:1:action" content="mint" /> p = frameproto.AppendFrameButton1Action(p, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:1:action" content="post" /> str :+ frameproto.AppendFrameButton1Action(p, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:1:action" content="post_redirect" /> p = frameproto.AppendFrameButton1Action(p, frameproto.ButtonActionPostRedirect)
func AppendFrameButton1Target ¶
AppendFrameButton1Target will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1:target" name-value pair.
For example, this call:
var p []byte // ... var target string = "https://example.com/thing/do-it" p = frameproto.AppendFrameButton1Target(p, target)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:1:target" content="https://example.com/thing/do-it" />
func AppendFrameButton2 ¶
AppendFrameButton2 will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2" name-value pair.
For example, this call:
var p []byte // ... var label string = "go forward" p = frameproto.AppendFrameButton2(p, label)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:2" content="go forward" />
func AppendFrameButton2Action ¶
AppendFrameButton2Action will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:action" name-value pair.
For example, this call:
var p []byte // .. var buttonAction string = "post" p = frameproto.AppendFrameButton2Action(p, buttonAction)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:2:action" content="post" />
Note that this package provides some constants to use with AppendFrameButton2Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:2:action" content="link" /> p = frameproto.AppendFrameButton2Action(p, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:2:action" content="mint" /> p = frameproto.AppendFrameButton2Action(p, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:2:action" content="post" /> str :+ frameproto.AppendFrameButton2Action(p, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:2:action" content="post_redirect" /> p = frameproto.AppendFrameButton2Action(p, frameproto.ButtonActionPostRedirect)
func AppendFrameButton2Target ¶
AppendFrameButton2Target will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:target" name-value pair.
For example, this call:
var p []byte // ... var target string = "https://example.com/thing/do-it" p = frameproto.AppendFrameButton2Target(p, target)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:2:target" content="https://example.com/thing/do-it" />
func AppendFrameButton3 ¶
AppendFrameButton3 will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3" name-value pair.
For example, this call:
var p []byte // ... var label string = "go forward" p = frameproto.AppendFrameButton3(p, label)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:3" content="go forward" />
func AppendFrameButton3Action ¶
AppendFrameButton3Action will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:action" name-value pair.
For example, this call:
var p []byte // .. var buttonAction string = "post" p = frameproto.AppendFrameButton3Action(p, buttonAction)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:3:action" content="post" />
Note that this package provides some constants to use with AppendFrameButton3Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:3:action" content="link" /> p = frameproto.AppendFrameButton3Action(p, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:3:action" content="mint" /> p = frameproto.AppendFrameButton3Action(p, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:3:action" content="post" /> str :+ frameproto.AppendFrameButton3Action(p, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:3:action" content="post_redirect" /> p = frameproto.AppendFrameButton3Action(p, frameproto.ButtonActionPostRedirect)
func AppendFrameButton3Target ¶
AppendFrameButton3Target will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:target" name-value pair.
For example, this call:
var p []byte // ... var target string = "https://example.com/thing/do-it" p = frameproto.AppendFrameButton3Target(p, target)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:3:target" content="https://example.com/thing/do-it" />
func AppendFrameButton4 ¶
AppendFrameButton4 will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4" name-value pair.
For example, this call:
var p []byte // ... var label string = "go forward" p = frameproto.AppendFrameButton4(p, label)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:4" content="go forward" />
func AppendFrameButton4Action ¶
AppendFrameButton4Action will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:action" name-value pair.
For example, this call:
var p []byte // .. var buttonAction string = "post" p = frameproto.AppendFrameButton4Action(p, buttonAction)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:4:action" content="post" />
Note that this package provides some constants to use with AppendFrameButton4Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:4:action" content="link" /> p = frameproto.AppendFrameButton4Action(p, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:4:action" content="mint" /> p = frameproto.AppendFrameButton4Action(p, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:4:action" content="post" /> str :+ frameproto.AppendFrameButton4Action(p, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:4:action" content="post_redirect" /> p = frameproto.AppendFrameButton4Action(p, frameproto.ButtonActionPostRedirect)
func AppendFrameButton4Target ¶
AppendFrameButton4Target will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:target" name-value pair.
For example, this call:
var p []byte // ... var target string = "https://example.com/thing/do-it" p = frameproto.AppendFrameButton4Target(p, target)
Would append this HTML <meta/> element:
<meta property="fc:frame:button:4:target" content="https://example.com/thing/do-it" />
func AppendFrameImage ¶
AppendFrameImage will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:image" name-value pair.
For example, this call:
var p []byte // ... var url string = "https://example.com/images/screen.png" p = frameproto.AppendFrameImage(p, url)
Would append this HTML <meta/> element:
<meta property="fc:frame:image" content="https://example.com/images/screen.png" />
func AppendFrameImageAspectRatio ¶
AppendFrameImageAspectRatio will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:image:aspect_ratio" name-value pair.
For example, this call:
var p []byte // .. var aspectRatio string = "1.91:1" p = frameproto.AppendFrameImageAspectRatio(p, aspectRatio)
Would append this HTML <meta/> element:
<meta property="fc:frame:image:aspect_ratio" content="1.91:1" />
Note that this package provides some constants to use with AppendFrameImageAspectRatio. Namely: AspectRatioOnePointNineOneToOne (for "1.91:1") and AspectRatioOneToOne (for "1:1").
Which in code would be used at:
p = frameproto.AppendFrameImageAspectRatio(p, frameproto.AspectRatioOnePointNineOneToOne)
And:
p = frameproto.AppendFrameImageAspectRatio(p, frameproto.AspectRatioOneToOne)
func AppendFrameInputText ¶
AppendFrameInputText will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:input:text" name-value pair.
For example, this call:
var p []byte // ... var label string = "enter your username p = frameproto.AppendFrameInputText(p, label)
Would append this HTML <meta/> element:
<meta property="fc:frame:input:text" content="enter your username" />
func AppendFramePostURL ¶
AppendFramePostURL will append the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:post_url" name-value pair.
For example, this call:
var p []byte // ... var url string = "https://example.com/my/post/path.php" p = frameproto.AppendFramePostURL(p, url)
Would append this HTML <meta/> element:
<meta property="fc:frame:post_url" content="https://example.com/my/post/path.php" />
func StringFrame ¶
StringFrame will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame" name-value pair.
For example, this call:
var version string = "vNext" s = frameproto.StringFrame(version)
Would return this HTML <meta/> element:
<meta property="fc:frame" content="vNext" />
Note that this package provides some constants to use with StringFrame. Namely: VersionVNext (for "vNext").
Which in code would be used as:
p = frameproto.StringFrame(p, frameproto.VersionVNext)
func StringFrameButton1 ¶
StringFrameButton1 will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1" name-value pair.
For example, this call:
var label string = "go forward" str := frameproto.StringFrameButton1(label)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:1" content="go forward" />
func StringFrameButton1Action ¶
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" str := frameproto.StringFrameButton1Action(buttonAction)
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:
// <meta property="fc:frame:button:1:action" content="link" /> str := frameproto.StringFrameButton1Action(frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:1:action" content="mint" /> str := frameproto.StringFrameButton1Action(frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:1:action" content="post" /> str :+ frameproto.StringFrameButton1Action(frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:1:action" content="post_redirect" /> str := frameproto.StringFrameButton1Action(frameproto.ButtonActionPostRedirect)
func StringFrameButton1Target ¶
StringFrameButton1Target will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" str := frameproto.StringFrameButton1Target(target)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:1:target" content="https://example.com/thing/do-it" />
func StringFrameButton2 ¶
StringFrameButton2 will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2" name-value pair.
For example, this call:
var label string = "go forward" str := frameproto.StringFrameButton2(label)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:2" content="go forward" />
func StringFrameButton2Action ¶
StringFrameButton2Action will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:action" name-value pair.
For example, this call:
var buttonAction string = "post" str := frameproto.StringFrameButton2Action(buttonAction)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:2:action" content="post" />
Note that this package provides some constants to use with StringFrameButton2Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:2:action" content="link" /> str := frameproto.StringFrameButton2Action(frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:2:action" content="mint" /> str := frameproto.StringFrameButton2Action(frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:2:action" content="post" /> str :+ frameproto.StringFrameButton2Action(frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:2:action" content="post_redirect" /> str := frameproto.StringFrameButton2Action(frameproto.ButtonActionPostRedirect)
func StringFrameButton2Target ¶
StringFrameButton2Target will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" str := frameproto.StringFrameButton2Target(target)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:2:target" content="https://example.com/thing/do-it" />
func StringFrameButton3 ¶
StringFrameButton3 will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3" name-value pair.
For example, this call:
var label string = "go forward" str := frameproto.StringFrameButton3(label)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:3" content="go forward" />
func StringFrameButton3Action ¶
StringFrameButton3Action will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:action" name-value pair.
For example, this call:
var buttonAction string = "post" str := frameproto.StringFrameButton3Action(buttonAction)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:3:action" content="post" />
Note that this package provides some constants to use with StringFrameButton3Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:3:action" content="link" /> str := frameproto.StringFrameButton3Action(frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:3:action" content="mint" /> str := frameproto.StringFrameButton3Action(frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:3:action" content="post" /> str :+ frameproto.StringFrameButton3Action(frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:3:action" content="post_redirect" /> str := frameproto.StringFrameButton3Action(frameproto.ButtonActionPostRedirect)
func StringFrameButton3Target ¶
StringFrameButton3Target will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" str := frameproto.StringFrameButton3Target(target)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:3:target" content="https://example.com/thing/do-it" />
func StringFrameButton4 ¶
StringFrameButton4 will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4" name-value pair.
For example, this call:
var label string = "go forward" str := frameproto.StringFrameButton4(label)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:4" content="go forward" />
func StringFrameButton4Action ¶
StringFrameButton4Action will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:action" name-value pair.
For example, this call:
var buttonAction string = "post" str := frameproto.StringFrameButton4Action(buttonAction)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:4:action" content="post" />
Note that this package provides some constants to use with StringFrameButton4Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:4:action" content="link" /> str := frameproto.StringFrameButton4Action(frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:4:action" content="mint" /> str := frameproto.StringFrameButton4Action(frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:4:action" content="post" /> str :+ frameproto.StringFrameButton4Action(frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:4:action" content="post_redirect" /> str := frameproto.StringFrameButton4Action(frameproto.ButtonActionPostRedirect)
func StringFrameButton4Target ¶
StringFrameButton4Target will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" str := frameproto.StringFrameButton4Target(target)
Would return this HTML <meta/> element:
<meta property="fc:frame:button:4:target" content="https://example.com/thing/do-it" />
func StringFrameImage ¶
StringFrameImage will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:image" name-value pair.
For example, this call:
var url string = "https://example.com/images/screen.png" str := frameproto.StringFrameImage(url)
Would return this HTML <meta/> element:
<meta property="fc:frame:image" content="https://example.com/images/screen.png" />
func StringFrameImageAspectRatio ¶
StringFrameImageAspectRatio will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:image:aspect_ratio" name-value pair.
For example, this call:
var aspectRatio string = "1.91:1" str := frameproto.StringFrameImageAspectRatio(aspectRatio)
Would return this HTML <meta/> element:
<meta property="fc:frame:image:aspect_ratio" content="1.91:1" />
Note that this package provides some constants to use with StringFrameImageAspectRatio. Namely: AspectRatioOnePointNineOneToOne (for "1.91:1") and AspectRatioOneToOne (for "1:1").
Which in code would be used at:
str := frameproto.StringFrameImageAspectRatio(frameproto.AspectRatioOnePointNineOneToOne)
And:
str := frameproto.StringFrameImageAspectRatio(frameproto.AspectRatioOneToOne)
func StringFrameInputText ¶
StringFrameInputText will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:input:text" name-value pair.
For example, this call:
var label string = "enter your username" str := frameproto.StringFrameInputText(label)
Would return this HTML <meta/> element:
<meta property="fc:frame:input:text" content="enter your username" />
func StringFramePostURL ¶
StringFramePostURL will return the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:post_url" name-value pair.
For example, this call:
var url string = "https://example.com/my/post/path.php" str := frameproto.StringFramePostURL(url)
Would return this HTML <meta/> element:
<meta property="fc:frame:post_url" content="https://example.com/my/post/path.php" />
func WriteFrame ¶
WriteFrame will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame" name-value pair.
For example, this call:
var version string = "vNext" str := frameproto.WriteFrame(writer, version)
Would write this HTML <meta/> element:
<meta property="fc:frame" content="vNext" />
Note that this package provides some constants to use with WriteFrame. Namely: VersionVNext (for "vNext").
Which in code would be used as:
str := frameproto.WriteFrame(writer, frameproto.VersionVNext)
func WriteFrameButton1 ¶
WriteFrameButton1 will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1" name-value pair.
For example, this call:
var label string = "go forward" frameproto.WriteFrameButton1(writer, label)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:1" content="go forward" />
func WriteFrameButton1Action ¶
WriteFrameButton1Action will write 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" frameproto.WriteFrameButton1Action(writer, buttonAction)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:1:action" content="post" />
Note that this package provides some constants to use with WriteFrameButton1Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:1:action" content="link" /> frameproto.WriteFrameButton1Action(writer, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:1:action" content="mint" /> frameproto.WriteFrameButton1Action(writer, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:1:action" content="post" /> frameproto.WriteFrameButton1Action(writer, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:1:action" content="post_redirect" /> frameproto.WriteFrameButton1Action(writer, frameproto.ButtonActionPostRedirect)
func WriteFrameButton1Target ¶
WriteFrameButton1Target will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:1:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" frameproto.WriteFrameButton1Target(writer, target)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:1:target" content="https://example.com/thing/do-it" />
func WriteFrameButton2 ¶
WriteFrameButton2 will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2" name-value pair.
For example, this call:
var label string = "go forward" frameproto.WriteFrameButton2(writer, label)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:2" content="go forward" />
func WriteFrameButton2Action ¶
WriteFrameButton2Action will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:action" name-value pair.
For example, this call:
var buttonAction string = "post" frameproto.WriteFrameButton2Action(writer, buttonAction)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:2:action" content="post" />
Note that this package provides some constants to use with WriteFrameButton2Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:2:action" content="link" /> frameproto.WriteFrameButton2Action(writer, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:2:action" content="mint" /> frameproto.WriteFrameButton2Action(writer, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:2:action" content="post" /> frameproto.WriteFrameButton2Action(writer, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:2:action" content="post_redirect" /> frameproto.WriteFrameButton2Action(writer, frameproto.ButtonActionPostRedirect)
func WriteFrameButton2Target ¶
WriteFrameButton2Target will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:2:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" frameproto.WriteFrameButton2Target(writer, target)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:2:target" content="https://example.com/thing/do-it" />
func WriteFrameButton3 ¶
WriteFrameButton3 will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3" name-value pair.
For example, this call:
var label string = "go forward" frameproto.WriteFrameButton3(writer, label)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:3" content="go forward" />
func WriteFrameButton3Action ¶
WriteFrameButton3Action will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:action" name-value pair.
For example, this call:
var buttonAction string = "post" frameproto.WriteFrameButton3Action(writer, buttonAction)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:3:action" content="post" />
Note that this package provides some constants to use with WriteFrameButton3Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:3:action" content="link" /> frameproto.WriteFrameButton3Action(writer, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:3:action" content="mint" /> frameproto.WriteFrameButton3Action(writer, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:3:action" content="post" /> frameproto.WriteFrameButton3Action(writer, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:3:action" content="post_redirect" /> frameproto.WriteFrameButton3Action(writer, frameproto.ButtonActionPostRedirect)
func WriteFrameButton3Target ¶
WriteFrameButton3Target will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:3:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" frameproto.WriteFrameButton3Target(writer, target)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:3:target" content="https://example.com/thing/do-it" />
func WriteFrameButton4 ¶
WriteFrameButton4 will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4" name-value pair.
For example, this call:
var label string = "go forward" frameproto.WriteFrameButton4(writer, label)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:4" content="go forward" />
func WriteFrameButton4Action ¶
WriteFrameButton4Action will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:action" name-value pair.
For example, this call:
var buttonAction string = "post" frameproto.WriteFrameButton4Action(writer, buttonAction)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:4:action" content="post" />
Note that this package provides some constants to use with WriteFrameButton4Action. Namely: ButtonActionLink (for "link"), ButtonActionMint (for "mint"), ButtonActionPost (for "post"), and ButtonActionPostRedirect (for "post_redirect").
Which in code would be used as:
// <meta property="fc:frame:button:4:action" content="link" /> frameproto.WriteFrameButton4Action(writer, frameproto.ButtonActionLink)
And:
// <meta property="fc:frame:button:4:action" content="mint" /> frameproto.WriteFrameButton4Action(writer, frameproto.ButtonActionMint)
And:
// <meta property="fc:frame:button:4:action" content="post" /> frameproto.WriteFrameButton4Action(writer, frameproto.ButtonActionPost)
And:
// <meta property="fc:frame:button:4:action" content="post_redirect" /> frameproto.WriteFrameButton4Action(writer, frameproto.ButtonActionPostRedirect)
func WriteFrameButton4Target ¶
WriteFrameButton4Target will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:button:4:target" name-value pair.
For example, this call:
var target string = "https://example.com/thing/do-it" frameproto.WriteFrameButton4Target(writer, target)
Would write this HTML <meta/> element:
<meta property="fc:frame:button:4:target" content="https://example.com/thing/do-it" />
func WriteFrameImage ¶
WriteFrameImage will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:image" name-value pair.
For example, this call:
var url string = "https://example.com/images/screen.png" frameproto.WriteFrameImage(writer, url)
Would write this HTML <meta/> element:
<meta property="fc:frame:image" content="https://example.com/images/screen.png" />
func WriteFrameImageAspectRatio ¶
WriteFrameImageAspectRatio will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:image:aspect_ratio" name-value pair.
For example, this call:
var aspectRatio string = "1.91:1" frameproto.WriteFrameImageAspectRatio(writer, aspectRatio)
Would write this HTML <meta/> element:
<meta property="fc:frame:image:aspect_ratio" content="1.91:1" />
Note that this package provides some constants to use with WriteFrameImageAspectRatio. Namely: AspectRatioOnePointNineOneToOne (for "1.91:1") and AspectRatioOneToOne (for "1:1").
Which in code would be used at:
frameproto.WriteFrameImageAspectRatio(writer, frameproto.AspectRatioOnePointNineOneToOne)
And:
frameproto.WriteFrameImageAspectRatio(writer, frameproto.AspectRatioOneToOne)
func WriteFrameInputText ¶
WriteFrameInputText will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:input:text" name-value pair.
For example, this call:
var label string = "enter your username" frameproto.WriteFrameInputText(writer, label)
Would write this HTML <meta/> element:
<meta property="fc:frame:input:text" content="enter your username" />
func WriteFramePostURL ¶
WriteFramePostURL will write the HTML <meta/> element for the Frame-Protocol's (i.e., Farcaster Frame's) "fc:frame:post_url" name-value pair.
For example, this call:
var url string = "https://example.com/my/post/path.php" frameproto.WriteFramePostURL(writer, url)
Would write this HTML <meta/> element:
<meta property="fc:frame:post_url" content="https://example.com/my/post/path.php" />
func WriteSkeleFrame ¶
WriteSkeleFrame takes care of creating a skeleton-HTML-page that the Frame-Protocol's (i.e., Farcaster Frame's) tags are included in.
For example, this:
frameproto.WriteSkeleFrame(w, func(writer io.Writer){ // This will write: // <meta property="fc:frame" content="vNext" /> frameproto.WriteFrame(writer, frameproto.VersionVNext) // This will write: // <meta property="fc:frame:image" content="https://example.com/path/to/img.png" /> var imgURL string = "https://example.com/path/to/img.png" frameproto.WriteFrameImage(writer, imgURL) })
Would write this:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" / <meta property="fc:frame" content="vNext" /> <meta property="fc:frame:image" content="https://example.com/path/to/img.png" /> </head> <body> </body> </html>
Note that http.ResponseWriter is an io.Writer. So this function can be used to write to http.ResponseWriter.
Types ¶
type ActionBody ¶
type ActionBody struct { UntrustedData ActionBodyUntrustedData `json:"untrustedData"` TrustedData ActionBodyTrustedData `json:"trustedData"` }
ActionBody represents the data sent to a Frame-Protocol's (i.e., Farcaster Frame's) application when it is POSTed to.
Example usage:
p, err := io.ReadAll(request.Body) if nil != err { return err } var actionBody frameproto.ActionBody err := json.Unmarshal(p, &actionBody) if nil != err { return err }
type ActionBodyCastID ¶
type ActionBodyTrustedData ¶
type ActionBodyTrustedData struct {
MessageBytes opt.Optional[string] `json:"messageBytes"`
}
type ActionBodyUntrustedData ¶
type ActionBodyUntrustedData struct { FID opt.Optional[uint64] `json:"fid"` URL opt.Optional[string] `json:"url"` MessageHash opt.Optional[string] `json:"messageHash"` Timestamp opt.Optional[int64] `json:"timestamp"` Network opt.Optional[uint64] `json:"network"` ButtonIndex opt.Optional[uint64] `json:"buttonIndex"` InputText opt.Optional[string] `json:"inputText"` CastID ActionBodyCastID `json:"castId"` }
type FrameWriter ¶
type FrameWriter interface { // <meta property="fc:frame" content="{{version}}" /> WriteFrame(version string) error // <meta property="fc:frame:button:1" content="{{label}}" /> WriteFrameButton1(label string) error // <meta property="fc:frame:button:1:action" content="{{action}}" /> WriteFrameButton1Action(action string) error // <meta property="fc:frame:button:1:target" content="{{target}}" /> WriteFrameButton1Target(buttonTarget string) error // <meta property="fc:frame:button:2" content="{{label}}" /> WriteFrameButton2(label string) error // <meta property="fc:frame:button:2:action" content="{{action}}" /> WriteFrameButton2Action(action string) error // <meta property="fc:frame:button:2:target" content="{{target}}" /> WriteFrameButton2Target(target string) error // <meta property="fc:frame:button:3" content="{{label}}" /> WriteFrameButton3(label string) error // <meta property="fc:frame:button:3:action" content="{{action}}" /> WriteFrameButton3Action(buttonAction string) error // <meta property="fc:frame:button:3:target" content="{{target}}" /> WriteFrameButton3Target(buttonTarget string) error // <meta property="fc:frame:button:4" content="{{label}}" /> WriteFrameButton4(label string) error // <meta property="fc:frame:button:4:action" content="{{action}}" /> WriteFrameButton4Action(action string) error // <meta property="fc:frame:button:4:target" content="{{target}}" /> WriteFrameButton4Target(target string) error // <meta property="fc:frame:image" content="{{url}}" /> WriteFrameImage(url string) error // <meta property="fc:frame:image:aspect_ratio" content="{{aspectRatio}}" /> WriteFrameImageAspectRatio(aspectRatio string) error // <meta property="fc:frame:input:text" content="{{label}}" /> WriteFrameInputText(label string) error // <meta property="fc:frame:post_url" content="{{url}}" /> WriteFramePostURL(url string) error }
func CreateFrameWriter ¶
func CreateFrameWriter(writer io.Writer) FrameWriter
CreateFrameWriter returns a FrameWriter that writers to an io.Writer.
For example:
func ServeHTTP(responseWriter http.ResponseWriter, request *http.Request) { // ... var frameWriter frameproto.FrameWriter = frameproto.CreateFrameWriter(responseWriter) // ... frameWriter.WriteFrame(frameproto.VersionVNext) frameWriter.WriteFrameImage(imageURL) // ... }
Source Files ¶
- actionbody.go
- appendframe.go
- appendframebutton1.go
- appendframebutton1action.go
- appendframebutton1target.go
- appendframebutton2.go
- appendframebutton2action.go
- appendframebutton2target.go
- appendframebutton3.go
- appendframebutton3action.go
- appendframebutton3target.go
- appendframebutton4.go
- appendframebutton4action.go
- appendframebutton4target.go
- appendframeimage.go
- appendframeimageaspectratio.go
- appendframeinputtext.go
- appendframeposturl.go
- appendmetapropertycontent.go
- aspectratios.go
- buffersize.go
- buttonactions.go
- errors.go
- framewriter.go
- framewriter_internal.go
- metaproperties.go
- stringframe.go
- stringframebutton1.go
- stringframebutton1action.go
- stringframebutton1target.go
- stringframebutton2.go
- stringframebutton2action.go
- stringframebutton2target.go
- stringframebutton3.go
- stringframebutton3action.go
- stringframebutton3target.go
- stringframebutton4.go
- stringframebutton4action.go
- stringframebutton4target.go
- stringframeimage.go
- stringframeimageaspectratio.go
- stringframeinputtext.go
- stringframeposturl.go
- stringmetapropertycontent.go
- versions.go
- writeframe.go
- writeframebutton1.go
- writeframebutton1action.go
- writeframebutton1target.go
- writeframebutton2.go
- writeframebutton2action.go
- writeframebutton2target.go
- writeframebutton3.go
- writeframebutton3action.go
- writeframebutton3target.go
- writeframebutton4.go
- writeframebutton4action.go
- writeframebutton4target.go
- writeframeimage.go
- writeframeimageaspectratio.go
- writeframeinputtext.go
- writeframeposturl.go
- writemetapropertycontent.go
- writeskeleframe.go