mirror of
https://github.com/fumiama/NanoBot.git
synced 2026-06-06 19:20:24 +08:00
finish half of message
This commit is contained in:
@@ -22,12 +22,11 @@ func (bot *Bot) getOpenAPIof[T any](ep string) (*[T any], error) {
|
||||
CodeMessageBase
|
||||
[T any]
|
||||
}{}
|
||||
err := bot.GetOpenAPI(ep, resp)
|
||||
err := bot.GetOpenAPI(ep, "", resp)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, getCallerFuncName())
|
||||
return nil, err
|
||||
}
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), nil
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), err
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@@ -23,12 +23,11 @@ func (bot *Bot) patchOpenAPIof[T any](ep string, body io.Reader) (*[T any], erro
|
||||
CodeMessageBase
|
||||
[T any]
|
||||
}{}
|
||||
err := bot.PatchOpenAPI(ep, resp, body)
|
||||
err := bot.PatchOpenAPI(ep, "", resp, body)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, getCallerFuncName())
|
||||
return nil, err
|
||||
}
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), nil
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), err
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@@ -18,17 +18,16 @@ import (
|
||||
`
|
||||
|
||||
const template = `
|
||||
func (bot *Bot) postOpenAPIof[T any](ep string, body io.Reader) (*[T any], error) {
|
||||
func (bot *Bot) postOpenAPIof[T any](ep, contenttype string, body io.Reader) (*[T any], error) {
|
||||
resp := &struct {
|
||||
CodeMessageBase
|
||||
[T any]
|
||||
}{}
|
||||
err := bot.PostOpenAPI(ep, resp, body)
|
||||
err := bot.PostOpenAPI(ep, contenttype, resp, body)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, getCallerFuncName())
|
||||
return nil, err
|
||||
}
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), nil
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), err
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
@@ -23,12 +23,11 @@ func (bot *Bot) putOpenAPIof[T any](ep string, body io.Reader) (*[T any], error)
|
||||
CodeMessageBase
|
||||
[T any]
|
||||
}{}
|
||||
err := bot.PutOpenAPI(ep, resp, body)
|
||||
err := bot.PutOpenAPI(ep, "", resp, body)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, getCallerFuncName())
|
||||
return nil, err
|
||||
}
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), nil
|
||||
return (*[T any])(unsafe.Add(unsafe.Pointer(resp), unsafe.Sizeof(CodeMessageBase{}))), err
|
||||
}
|
||||
`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user