Documentation
¶
Index ¶
- Constants
- func ConfigurePreviewURL(response *PreviewResponse, options *PreviewURLConfigOptions) (string, error)
- type Asset
- type BaseClient
- func (client *BaseClient) Create(ctx context.Context, request CreateRequest) (*CreateResponse, error)
- func (client *BaseClient) Delete(ctx context.Context, id string) (*SuccessResponse, error)
- func (client *BaseClient) Deprecate(ctx context.Context, id string) (*SuccessResponse, error)
- func (client *BaseClient) GeneratePreview(ctx context.Context, request *PreviewRequest) (*PreviewResponse, error)
- func (client *BaseClient) Get(ctx context.Context, request *GetRequest) (*SingleFlowResponse, error)
- func (client *BaseClient) GetFlowMetrics(ctx context.Context, request *MetricsRequest) (*MetricsAPIResponse, error)
- func (client *BaseClient) ListAll(ctx context.Context) (*ListResponse, error)
- func (client *BaseClient) ListAssets(ctx context.Context, id string) (*RetrieveAssetsResponse, error)
- func (client *BaseClient) Publish(ctx context.Context, id string) (*SuccessResponse, error)
- func (client *BaseClient) Send(ctx context.Context, conf *config.Config, req *BaseRequest) (*BaseResponse, error)
- func (client *BaseClient) Update(ctx context.Context, id string, request UpdateRequest) (*UpdateResponse, error)
- func (client *BaseClient) UpdateFlowJSON(ctx context.Context, request *UpdateFlowJSONRequest) (*UpdateFlowJSONResponse, error)
- type BaseRequest
- type BaseResponse
- type BaseResponseData
- type CreateRequest
- type CreateResponse
- type DataExchangeHandler
- type DataExchangeHandlerFunc
- type DataExchangeHandlerImpl
- func (h *DataExchangeHandlerImpl) DecryptRequest(ctx context.Context, request *Request) (*DecryptedRequest, error)
- func (h *DataExchangeHandlerImpl) EncryptResponse(response *Response, request *DecryptedRequest) (string, error)
- func (h *DataExchangeHandlerImpl) Handle(w http.ResponseWriter, request *http.Request)
- type DataExchangeRequest
- type DataExchangeRequestHandlerMiddleware
- type DataPoint
- type DecryptedRequest
- type EntityError
- type Event
- type FinalScreenResponseData
- type Flow
- type GetRequest
- type HealthStatus
- type HealthStatusEntity
- type ListResponse
- type Metric
- type MetricData
- type MetricsAPIResponse
- type MetricsRequest
- type NextScreenResponseData
- type Preview
- type PreviewRequest
- type PreviewResponse
- type PreviewURLConfigOptions
- type Request
- type Response
- type RetrieveAssetsResponse
- type Sender
- type SenderFunc
- type SenderMiddleware
- type Service
- type SingleFlowResponse
- type SuccessResponse
- type UpdateFlowJSONRequest
- type UpdateFlowJSONResponse
- type UpdateRequest
- type UpdateResponse
- type ValidationError
Constants ¶
View Source
const ( CategorySignUp = "SIGN_UP" CategorySignIn = "SIGN_IN" CategoryAppointmentBooking = "APPOINTMENT_BOOKING" CategoryLeadGeneration = "LEAD_GENERATION" CategoryContactUs = "CONTACT_US" CategoryCustomerSupport = "CUSTOMER_SUPPORT" CategorySurvey = "SURVEY" CategoryOther = "OTHER" StatusDraft = "DRAFT" StatusPublished = "PUBLISHED" StatusDeprecated = "DEPRECATED" StatusBlocked = "BLOCKED" StatusThrottled = "THROTTLED" HealthStatusAvailable = "AVAILABLE" HealthStatusLimited = "LIMITED" HealthStatusBlocked = "BLOCKED" )
View Source
const ( MetricEndpointRequestCount metricEndpoint = "ENDPOINT_REQUEST_COUNT" MetricEndpointRequestError metricEndpoint = "ENDPOINT_REQUEST_ERROR" MetricEndpointRequestErrorRate metricEndpoint = "ENDPOINT_REQUEST_ERROR_RATE" MetricEndpointRequestLatencySecondsCeil metricEndpoint = "ENDPOINT_REQUEST_LATENCY_SECONDS_CEIL" MetricEndpointAvailability metricEndpoint = "ENDPOINT_AVAILABILITY" )
View Source
const ( GranularityDay granularity = "DAY" GranularityHour granularity = "HOUR" GranularityLifetime granularity = "LIFETIME" )
Variables ¶
This section is empty.
Functions ¶
func ConfigurePreviewURL ¶
func ConfigurePreviewURL(response *PreviewResponse, options *PreviewURLConfigOptions) (string, error)
Types ¶
type BaseClient ¶
func NewBaseClient ¶
func NewBaseClient(reader config.Reader, sender whttp.AnySender) *BaseClient
func (*BaseClient) Create ¶
func (client *BaseClient) Create(ctx context.Context, request CreateRequest) (*CreateResponse, error)
func (*BaseClient) Delete ¶
func (client *BaseClient) Delete(ctx context.Context, id string) (*SuccessResponse, error)
func (*BaseClient) Deprecate ¶
func (client *BaseClient) Deprecate(ctx context.Context, id string) (*SuccessResponse, error)
func (*BaseClient) GeneratePreview ¶
func (client *BaseClient) GeneratePreview(ctx context.Context, request *PreviewRequest) (*PreviewResponse, error)
func (*BaseClient) Get ¶
func (client *BaseClient) Get(ctx context.Context, request *GetRequest) (*SingleFlowResponse, error)
func (*BaseClient) GetFlowMetrics ¶
func (client *BaseClient) GetFlowMetrics(ctx context.Context, request *MetricsRequest) (*MetricsAPIResponse, error)
func (*BaseClient) ListAll ¶
func (client *BaseClient) ListAll(ctx context.Context) (*ListResponse, error)
func (*BaseClient) ListAssets ¶
func (client *BaseClient) ListAssets(ctx context.Context, id string) (*RetrieveAssetsResponse, error)
func (*BaseClient) Publish ¶
func (client *BaseClient) Publish(ctx context.Context, id string) (*SuccessResponse, error)
func (*BaseClient) Send ¶
func (client *BaseClient) Send(ctx context.Context, conf *config.Config, req *BaseRequest) (*BaseResponse, error)
func (*BaseClient) Update ¶
func (client *BaseClient) Update(ctx context.Context, id string, request UpdateRequest) (*UpdateResponse, error)
func (*BaseClient) UpdateFlowJSON ¶
func (client *BaseClient) UpdateFlowJSON(ctx context.Context, request *UpdateFlowJSONRequest, ) (*UpdateFlowJSONResponse, error)
type BaseRequest ¶
type BaseResponse ¶
type BaseResponse struct {
ID string `json:"id,omitempty"`
Success bool `json:"success,omitempty"`
Data []*BaseResponseData `json:"data,omitempty"`
Paging *whttp.Paging `json:"paging,omitempty"`
ValidationErrors []ValidationError `json:"validation_errors,omitempty"`
PreviewURL string `json:"preview_url,omitempty"`
ExpiresAt string `json:"expires_at,omitempty"`
Name string `json:"name,omitempty"`
Status string `json:"status,omitempty"`
Categories []string `json:"categories,omitempty"`
JSONVersion string `json:"json_version,omitempty"`
DataAPIVersion string `json:"data_api_version,omitempty"`
EndpointURI string `json:"endpoint_uri,omitempty"`
Preview Preview `json:"preview,omitempty"`
WhatsAppBusinessAccount map[string]interface{} `json:"whatsapp_business_account,omitempty"` // Optional
Application map[string]interface{} `json:"application,omitempty"` // Optional
HealthStatus HealthStatus `json:"health_status,omitempty"`
}
func (*BaseResponse) FlowDetails ¶
func (baseResp *BaseResponse) FlowDetails() *SingleFlowResponse
FlowDetails converts BaseResponse into a SingleFlowResponse.
func (*BaseResponse) ListAssetsResponse ¶
func (baseResp *BaseResponse) ListAssetsResponse() *RetrieveAssetsResponse
func (*BaseResponse) ListResponse ¶
func (baseResp *BaseResponse) ListResponse() *ListResponse
type BaseResponseData ¶
type BaseResponseData struct {
Name string `json:"name,omitempty"`
AssetType string `json:"asset_type,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
ID string `json:"id,omitempty"`
Status string `json:"status,omitempty"`
Categories []string `json:"categories,omitempty"`
ValidationErrors []ValidationError `json:"validation_errors,omitempty"`
}
type CreateRequest ¶
type CreateResponse ¶
type CreateResponse struct {
ID string `json:"id"`
}
type DataExchangeHandler ¶
type DataExchangeHandler interface {
Handle(ctx context.Context, request *DataExchangeRequest) (*Response, error)
}
type DataExchangeHandlerFunc ¶
type DataExchangeHandlerFunc func(ctx context.Context, request *DataExchangeRequest) (*Response, error)
func (DataExchangeHandlerFunc) Handle ¶
func (f DataExchangeHandlerFunc) Handle(ctx context.Context, request *DataExchangeRequest) (*Response, error)
type DataExchangeHandlerImpl ¶
type DataExchangeHandlerImpl struct {
Handler DataExchangeHandler
PrivateKeyLoader func(ctx context.Context) (*rsa.PrivateKey, error)
}
func NewDataExchangeHandler ¶
func NewDataExchangeHandler(loader func(ctx context.Context) (*rsa.PrivateKey, error), baseHandler DataExchangeHandler, mws ...DataExchangeRequestHandlerMiddleware, ) *DataExchangeHandlerImpl
func (*DataExchangeHandlerImpl) DecryptRequest ¶
func (h *DataExchangeHandlerImpl) DecryptRequest(ctx context.Context, request *Request) (*DecryptedRequest, error)
func (*DataExchangeHandlerImpl) EncryptResponse ¶
func (h *DataExchangeHandlerImpl) EncryptResponse(response *Response, request *DecryptedRequest) (string, error)
func (*DataExchangeHandlerImpl) Handle ¶
func (h *DataExchangeHandlerImpl) Handle(w http.ResponseWriter, request *http.Request)
type DataExchangeRequest ¶
type DataExchangeRequestHandlerMiddleware ¶
type DataExchangeRequestHandlerMiddleware func(handlerFunc DataExchangeHandlerFunc) DataExchangeHandlerFunc
type DataPoint ¶
type DataPoint struct {
Timestamp string `json:"timestamp"`
Data []*MetricData `json:"data"`
}
type DecryptedRequest ¶
type EntityError ¶
type FinalScreenResponseData ¶
type Flow ¶
type Flow struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Categories []string `json:"categories"`
ValidationErrors []ValidationError `json:"validation_errors"`
}
type GetRequest ¶
type HealthStatus ¶
type HealthStatus struct {
CanSendMessage string `json:"can_send_message"`
Entities []HealthStatusEntity `json:"entities"`
}
type HealthStatusEntity ¶
type HealthStatusEntity struct {
EntityType string `json:"entity_type"`
ID string `json:"id"`
CanSendMessage string `json:"can_send_message"`
Errors []EntityError `json:"errors,omitempty"`
AdditionalInfo []string `json:"additional_info,omitempty"`
}
type ListResponse ¶
type MetricData ¶
type MetricsAPIResponse ¶
type MetricsRequest ¶
type MetricsRequest struct {
FlowID string `json:"flow_id"` // Flow ID to get metrics for
MetricName metricEndpoint `json:"name"` // Metric name (e.g., ENDPOINT_REQUEST_ERROR)
Granularity granularity `json:"granularity"` // Time granularity (DAY, HOUR, LIFETIME)
Since time.Time `json:"since,omitempty"` // Start of the time period (optional, YYYY-MM-DD)
Until time.Time `json:"until,omitempty"` // End of the time period (optional, YYYY-MM-DD)
}
type NextScreenResponseData ¶
type PreviewRequest ¶
type PreviewResponse ¶
type PreviewResponse struct {
PreviewURL string `json:"preview_url"` // The URL to visualize the Flow.
ExpiresAt string `json:"expires_at"` // The expiration time of the preview URL.
ID string `json:"id"` // The ID of the flow.
}
PreviewResponse represents the response from the API when generating a preview URL for a Flow.
type PreviewURLConfigOptions ¶
type PreviewURLConfigOptions struct {
Interactive bool // If true, the preview will run in interactive mode.
FlowToken string // Token sent with requests for Flows with an endpoint.
FlowAction string // The initial action: "navigate" or "data_exchange".
FlowActionPayload string // JSON-encoded initial screen data.
PhoneNumber string // Phone number used for sending the Flow (used for encryption).
Debug bool // Show actions in a separate panel while interacting with the preview.
}
type Response ¶
type Response struct {
Screen string `json:"screen,omitempty"`
Data map[string]interface{} `json:"data"`
}
func CreateFinalScreenResponse ¶
func CreateFinalScreenResponse(finalScreenData FinalScreenResponseData) *Response
func CreateNextScreenResponse ¶
func CreateNextScreenResponse(nextScreenData NextScreenResponseData) *Response
type RetrieveAssetsResponse ¶
type Sender ¶
type Sender interface {
Send(ctx context.Context, conf *config.Config, req *BaseRequest) (*BaseResponse, error)
}
type SenderFunc ¶
type SenderFunc func(ctx context.Context, conf *config.Config, req *BaseRequest) (*BaseResponse, error)
func (SenderFunc) Send ¶
func (fn SenderFunc) Send(ctx context.Context, conf *config.Config, req *BaseRequest) (*BaseResponse, error)
type SenderMiddleware ¶
type SenderMiddleware func(sender SenderFunc) SenderFunc
type Service ¶
type Service interface {
Create(ctx context.Context, request CreateRequest) (*CreateResponse, error)
Update(ctx context.Context, id string, request UpdateRequest) (*UpdateResponse, error)
UpdateFlowJSON(ctx context.Context, request *UpdateFlowJSONRequest) (*UpdateFlowJSONResponse, error)
ListAll(ctx context.Context) (*ListResponse, error)
ListAssets(ctx context.Context, id string) (*RetrieveAssetsResponse, error)
Publish(ctx context.Context, id string) (*SuccessResponse, error)
Delete(ctx context.Context, id string) (*SuccessResponse, error)
Deprecate(ctx context.Context, id string) (*SuccessResponse, error)
GeneratePreview(ctx context.Context, request *PreviewRequest) (*PreviewResponse, error)
Get(ctx context.Context, request *GetRequest) (*SingleFlowResponse, error)
GetFlowMetrics(ctx context.Context, request *MetricsRequest) (*MetricsAPIResponse, error)
}
type SingleFlowResponse ¶
type SingleFlowResponse struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
Categories []string `json:"categories"`
ValidationErrors []ValidationError `json:"validation_errors"`
JSONVersion string `json:"json_version"`
DataAPIVersion string `json:"data_api_version"`
EndpointURI string `json:"endpoint_uri"`
Preview Preview `json:"preview"`
WhatsAppBusinessAccount map[string]interface{} `json:"whatsapp_business_account,omitempty"` // Optional
Application map[string]interface{} `json:"application,omitempty"` // Optional
HealthStatus HealthStatus `json:"health_status"`
}
type SuccessResponse ¶
type SuccessResponse struct {
Success bool `json:"success"`
}
type UpdateFlowJSONRequest ¶
type UpdateFlowJSONResponse ¶
type UpdateFlowJSONResponse struct {
Success bool `json:"success"`
ValidationErrors []ValidationError `json:"validation_errors"`
}
type UpdateRequest ¶
type UpdateResponse ¶
type UpdateResponse struct {
Success bool `json:"success"`
}
Click to show internal directories.
Click to hide internal directories.