apigen/test/goapi/test.go

67 lines
1.1 KiB
Go
Raw Normal View History

package goapi
import (
"context"
2021-03-22 02:08:04 +00:00
"crypto"
2021-01-30 09:53:34 +00:00
"time"
)
2021-01-30 09:53:34 +00:00
/*@API*/
type AStr struct {
Country string
City string
HouseNumber int64
IsCondo bool
SomeWeirdTest string `json:"SUPERCALIFRAGILISPEALIDOUX"`
2021-03-22 02:08:04 +00:00
Recursive map[string]AStr
Arrofpstr []string `json:"arrofpstr,omitempty"`
When time.Time
Some crypto.Decrypter
}
/*
@API
2020-11-06 23:16:52 +00:00
@PATH: /someapi
2021-01-30 09:53:34 +00:00
@PERM: ASD
2021-03-22 02:08:04 +00:00
@VERB: POST
2021-01-30 09:53:34 +00:00
*/
2021-03-22 02:08:04 +00:00
func SomeAPI(ctx context.Context, s string) (out string, err error) {
print("Got:" + s)
out = time.Now().String() + " - Hey Ya!"
return
2021-01-30 09:53:34 +00:00
}
/*
@API
@PATH: /someapi
2021-03-22 02:08:04 +00:00
@PERM: ASD
2021-04-02 14:40:28 +00:00
@VERB: GET
2021-01-30 09:53:34 +00:00
*/
2021-04-02 14:40:28 +00:00
func SomeGET(ctx context.Context, s string) (out string, err error) {
print("Got:" + s)
out = time.Now().String() + " - Hey Ya!"
return
}
2021-01-30 09:53:34 +00:00
/*
@API
2021-03-22 02:08:04 +00:00
@PATH: /someapi
@PERM: ASD
@VERB: PUT
*/
2021-04-02 14:40:28 +00:00
func SomePUT(ctx context.Context, s string) (out string, err error) {
print("Got:" + s)
out = time.Now().String() + " - Hey Ya!"
return
}
/*
@API
@PATH: /someapi
@PERM: ASD
@VERB: DELETE
*/
func SomeAPI2(ctx context.Context, s *crypto.Hash) ([]string, error) {
return nil, nil
}