package frameproto import ( "io" ) const skeleFrameTop = ``+"\n"+ ``+"\n"+ ``+"\n"+ ``+"\n" const skeleFrameBotton = ``+"\n"+ ``+"\n"+ ``+"\n"+ ``+"\n" // 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: // // // frameproto.WriteFrame(writer, frameproto.VersionVNext) // // // This will write: // // var imgURL string = "https://example.com/path/to/img.png" // frameproto.WriteFrameImage(writer, imgURL) // }) // // Would write this: // // // // // // // // // // // // Note that http.ResponseWriter is an io.Writer. So this function can be used to write to http.ResponseWriter. func WriteSkeleFrame(writer io.Writer, frameWriterFunc func(io.Writer)error) error { var err error _, err = io.WriteString(writer, skeleFrameTop) if nil != err { return err } err = frameWriterFunc(writer) if nil != err { return err } _, err = io.WriteString(writer, skeleFrameBotton) if nil != err { return err } return nil }