MCPcopy Create free account
hub / github.com/OverloadBlitz/cloudcent-cli / post

Method post

internal/api/client.go:110–125  ·  view source on GitHub ↗
(endpoint string, payload any, requireAuth bool)

Source from the content-addressed store, hash-verified

108}
109
110func (c *Client) post(endpoint string, payload any, requireAuth bool) (int, []byte, error) {
111 var (
112 body io.Reader
113 contentType string
114 )
115 if payload != nil {
116 bodyBytes, err := json.Marshal(payload)
117 if err != nil {
118 return 0, nil, fmt.Errorf("failed to marshal POST request body: %w", err)
119 }
120 body = bytes.NewReader(bodyBytes)
121 contentType = "application/json"
122 }
123
124 return c.doRequest(http.MethodPost, endpoint, body, contentType, requireAuth)
125}
126
127// FetchPricing calls POST /pricing with the given filters.
128func (c *Client) FetchPricing(products, regions []string, attrs map[string]string, prices []string) (*PricingAPIResponse, error) {

Callers 5

FetchPricingMethod · 0.95
FetchPricingBatchMethod · 0.95
GenerateTokenMethod · 0.95
ExchangeTokenMethod · 0.95

Calls 1

doRequestMethod · 0.95

Tested by 1