Documentation
¶
Index ¶
- Constants
- type ApiRequest
- func (request *ApiRequest) AddField(field ApiRequestQueryParamField) *ApiRequestQueryParamField
- func (request *ApiRequest) AddQueryParam(key, value string)
- func (request *ApiRequest) Execute() (string, error)
- func (request *ApiRequest) SetBody(body string)
- func (request *ApiRequest) SetMethod(method string)
- type ApiRequestQueryParamField
- type RequestClient
- func (client *RequestClient) ApiAccessToken() string
- func (client *RequestClient) ApiVersion() string
- func (client *RequestClient) BaseUrl() string
- func (client *RequestClient) NewApiRequest(path, method string) *ApiRequest
- func (rc *RequestClient) RequestMultipart(method string, path string, body io.Reader, contentType string) (string, error)
- type RequestCloudApiParams
- type WhatsappApiType
Constants ¶
View Source
const ( API_VERSION = "v24.0" BASE_URL = "graph.facebook.com" REQUEST_PROTOCOL = "https" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiRequest ¶
type ApiRequest struct {
Path string
Method string
Body string
Fields []*ApiRequestQueryParamField // Changed to slice of pointers
QueryParams map[string]string
Requester *RequestClient
}
func (*ApiRequest) AddField ¶
func (request *ApiRequest) AddField(field ApiRequestQueryParamField) *ApiRequestQueryParamField
func (*ApiRequest) AddQueryParam ¶
func (request *ApiRequest) AddQueryParam(key, value string)
AddQueryParam adds a query parameter to the request.
func (*ApiRequest) Execute ¶
func (request *ApiRequest) Execute() (string, error)
Execute executes the request and returns the response.
func (*ApiRequest) SetBody ¶
func (request *ApiRequest) SetBody(body string)
SetBody sets the body for the request.
func (*ApiRequest) SetMethod ¶
func (request *ApiRequest) SetMethod(method string)
SetMethod sets the method for the request.
type ApiRequestQueryParamField ¶
func (*ApiRequestQueryParamField) AddFilter ¶
func (field *ApiRequestQueryParamField) AddFilter(key, value string)
type RequestClient ¶
type RequestClient struct {
// contains filtered or unexported fields
}
RequestClient represents a client for making requests to a cloud API.
func NewRequestClient ¶
func NewRequestClient(apiAccessToken string) *RequestClient
NewRequestClient creates a new instance of RequestClient.
func (*RequestClient) ApiAccessToken ¶ added in v0.8.1
func (client *RequestClient) ApiAccessToken() string
func (*RequestClient) ApiVersion ¶
func (client *RequestClient) ApiVersion() string
func (*RequestClient) BaseUrl ¶
func (client *RequestClient) BaseUrl() string
func (*RequestClient) NewApiRequest ¶
func (client *RequestClient) NewApiRequest(path, method string) *ApiRequest
func (*RequestClient) RequestMultipart ¶
func (rc *RequestClient) RequestMultipart( method string, path string, body io.Reader, contentType string, ) (string, error)
RequestMultipart allows sending an arbitrary body with a custom Content-Type. This is needed for file uploads (multipart/form-data).
type RequestCloudApiParams ¶
type RequestCloudApiParams struct {
Body string
Path string
Method string
QueryParam map[string]string
}
RequestCloudApiParams represents the parameters for making a request to the cloud API.
type WhatsappApiType ¶
type WhatsappApiType string
const ( WhatsappApiTypeMessaging WhatsappApiType = "messaging" WhatsappApiTypeBusiness WhatsappApiType = "business" )
Click to show internal directories.
Click to hide internal directories.