-
Notifications
You must be signed in to change notification settings - Fork 0
/
api_poly.go
27 lines (24 loc) · 972 Bytes
/
api_poly.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package polysdk
import (
"github.com/quanxiang-cloud/go-polysdk/internal/apipath"
)
// PolyAPIRequest request poly api from polyapi
// fullNamespace is the full namespace of poly api. eg: /system/poly/sample_poly_api
func (c *PolyClient) PolyAPIRequest(fullNamespace string, method string, header Header, data interface{}) (*HTTPResponse, error) {
uri := apipath.Join(apipath.APIPolyRequest, fullNamespace)
return c.DoRequestAPI(uri, method, header, data)
}
// PolyAPIDoc request poly api from polyapi
// fullNamespace is the full namespace of poly api. eg: /system/poly/sample_poly_api
func (c *PolyClient) PolyAPIDoc(fullNamespace string, docType string, titleFirst bool) (*HTTPResponse, error) {
d := apiDocReq{
BodyBase: BodyBase{},
DocType: docType,
TitleFirst: titleFirst,
}
header := Header{
HeaderContentType: []string{MIMEJSON},
}
uri := apipath.Join(apipath.APIPolyDoc, fullNamespace)
return c.DoRequestAPI(uri, MethodPost, header, d)
}