autogen some http functions

This commit is contained in:
Jeff Carr 2025-09-08 04:03:30 -05:00
parent 18796d1a47
commit 556c549265
2 changed files with 10 additions and 4 deletions

View File

@ -13,11 +13,12 @@ import (
"go.wit.com/log"
)
func (p *Patches) HttpPostVerbose(baseURL string, route string) (*Patches, error) {
func (p *Patches) HttpPostVerbose(baseURL string, route string) (*Patches, *httppb.HttpRequest, error) {
p.PrintTable()
return p.HttpPost(baseURL, route)
}
/*
func (p *Patches) HttpPost(baseURL string, route string) (*Patches, error) {
if p == nil {
log.Info("can't post a nil PB")
@ -60,6 +61,7 @@ func (p *Patches) HttpPost(baseURL string, route string) (*Patches, error) {
}
return newpb, err
}
*/
func (p *Patchset) HttpPost(baseURL string, route string) (*Patchset, error) {
// if you ever have "http://www.wit.com//" GO will regect the server recieving it.
@ -93,6 +95,7 @@ func (p *Patchset) HttpPost(baseURL string, route string) (*Patchset, error) {
return newpb, err
}
/*
func (p *Patches) SendReply(w http.ResponseWriter, reqPB *httppb.HttpRequest) error {
data, err := p.Marshal()
if err != nil {
@ -126,12 +129,14 @@ func (p *Patchsets) SendReply(w http.ResponseWriter, reqPB *httppb.HttpRequest)
}
return err
}
*/
func (p *Patchsets) HttpPostVerbose(baseURL string, route string) (*Patchsets, error) {
func (p *Patchsets) HttpPostVerbose(baseURL string, route string) (*Patchsets, *httppb.HttpRequest, error) {
p.PrintTable()
return p.HttpPost(baseURL, route)
}
/*
func (p *Patchsets) HttpPost(baseURL string, route string) (*Patchsets, error) {
// if you ever have "http://www.wit.com//" GO will regect the server recieving it.
// Even though the linux kernel gets the network payload
@ -163,3 +168,4 @@ func (p *Patchsets) HttpPost(baseURL string, route string) (*Patchsets, error) {
log.Infof("patchset PB HttpPost %s sent len(%d) got len(%d)\n", finalURL.String(), p.Len(), newpb.Len())
return newpb, err
}
*/

View File

@ -59,7 +59,7 @@ message Patch {
}
// this is a "PATCH: [1/x]" series
message Patches { // `autogenpb:marshal` `autogenpb:gui:Patch`
message Patches { // `autogenpb:marshal` `autogenpb:gui:Patch` `autogenpb:http`
string uuid = 1; // `autogenpb:uuid:2679065e-c81d-4a00-aca4-03c158a834fb`
string version = 2; // `autogenpb:version:v2.0.0`
repeated Patch Patches = 3;
@ -82,7 +82,7 @@ message Patchset { // `autogenpb:mars
string hostname = 14; //
}
message Patchsets { // `autogenpb:marshal` `autogenpb:gui` `autogenpb:nomutex`
message Patchsets { // `autogenpb:marshal` `autogenpb:gui` `autogenpb:nomutex` `autogenpb:http`
string uuid = 1; // `autogenpb:uuid:be926ad9-f07f-484c-adf2-d96eeabf3079`
string version = 2; // `autogenpb:version:v0.0.45`
repeated Patchset Patchsets = 3;