Documentation ¶
Index ¶
- Constants
- type ASN
- type ASNParam
- type AuditLog
- type AuditLogAction
- type AuditLogActor
- type AuditLogActorType
- type AuditLogOwner
- type AuditLogResource
- type CertificateCA
- type CertificateRequestType
- type CloudflareTunnel
- type CloudflareTunnelConnection
- type CloudflareTunnelStatus
- type CloudflareTunnelTunType
- type Error
- type ErrorData
- type MemberParam
- type MemberRoleParam
- type MemberRolesPermissionsParam
- type MemberStatus
- type MemberUserParam
- type Permission
- type PermissionGrant
- type PermissionGrantParam
- type RatePlan
- type RatePlanParam
- type ResponseInfo
- type Role
- type SortDirection
- type Subscription
- type SubscriptionFrequency
- type SubscriptionParam
- type SubscriptionState
- type TurnstileService
- type Widget
- type WidgetClearanceLevel
- type WidgetDeleteParams
- type WidgetDeleteResponseEnvelope
- type WidgetDomain
- type WidgetDomainParam
- type WidgetGetParams
- type WidgetGetResponseEnvelope
- type WidgetListParams
- type WidgetListParamsDirection
- type WidgetListParamsOrder
- type WidgetListResponse
- type WidgetListResponseClearanceLevel
- type WidgetListResponseMode
- type WidgetListResponseRegion
- type WidgetMode
- type WidgetNewParams
- type WidgetNewParamsClearanceLevel
- type WidgetNewParamsDirection
- type WidgetNewParamsMode
- type WidgetNewParamsOrder
- type WidgetNewParamsRegion
- type WidgetNewResponseEnvelope
- type WidgetNewResponseEnvelopeResultInfo
- type WidgetRegion
- type WidgetRotateSecretParams
- type WidgetRotateSecretResponseEnvelope
- type WidgetService
- func (r *WidgetService) Delete(ctx context.Context, sitekey string, body WidgetDeleteParams, ...) (res *Widget, err error)
- func (r *WidgetService) Get(ctx context.Context, sitekey string, query WidgetGetParams, ...) (res *Widget, err error)
- func (r *WidgetService) List(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[WidgetListResponse], err error)
- func (r *WidgetService) ListAutoPaging(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[WidgetListResponse]
- func (r *WidgetService) New(ctx context.Context, params WidgetNewParams, opts ...option.RequestOption) (res *Widget, err error)
- func (r *WidgetService) RotateSecret(ctx context.Context, sitekey string, params WidgetRotateSecretParams, ...) (res *Widget, err error)
- func (r *WidgetService) Update(ctx context.Context, sitekey string, params WidgetUpdateParams, ...) (res *Widget, err error)
- type WidgetUpdateParams
- type WidgetUpdateParamsClearanceLevel
- type WidgetUpdateParamsMode
- type WidgetUpdateResponseEnvelope
Constants ¶
const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin
This is an alias to an internal value.
const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare
This is an alias to an internal value.
const AuditLogActorTypeUser = shared.AuditLogActorTypeUser
This is an alias to an internal value.
const CertificateCADigicert = shared.CertificateCADigicert
This is an alias to an internal value.
const CertificateCAGoogle = shared.CertificateCAGoogle
This is an alias to an internal value.
const CertificateCALetsEncrypt = shared.CertificateCALetsEncrypt
This is an alias to an internal value.
const CertificateCASSLCom = shared.CertificateCASSLCom
This is an alias to an internal value.
const CertificateRequestTypeKeylessCertificate = shared.CertificateRequestTypeKeylessCertificate
This is an alias to an internal value.
const CertificateRequestTypeOriginECC = shared.CertificateRequestTypeOriginECC
This is an alias to an internal value.
const CertificateRequestTypeOriginRSA = shared.CertificateRequestTypeOriginRSA
This is an alias to an internal value.
const CloudflareTunnelStatusDegraded = shared.CloudflareTunnelStatusDegraded
This is an alias to an internal value.
const CloudflareTunnelStatusDown = shared.CloudflareTunnelStatusDown
This is an alias to an internal value.
const CloudflareTunnelStatusHealthy = shared.CloudflareTunnelStatusHealthy
This is an alias to an internal value.
const CloudflareTunnelStatusInactive = shared.CloudflareTunnelStatusInactive
This is an alias to an internal value.
const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI
This is an alias to an internal value.
const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel
This is an alias to an internal value.
const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE
This is an alias to an internal value.
const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec
This is an alias to an internal value.
const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector
This is an alias to an internal value.
const MemberStatusAccepted = shared.MemberStatusAccepted
This is an alias to an internal value.
const MemberStatusPending = shared.MemberStatusPending
This is an alias to an internal value.
const SortDirectionAsc = shared.SortDirectionAsc
This is an alias to an internal value.
const SortDirectionDesc = shared.SortDirectionDesc
This is an alias to an internal value.
const SubscriptionFrequencyMonthly = shared.SubscriptionFrequencyMonthly
This is an alias to an internal value.
const SubscriptionFrequencyQuarterly = shared.SubscriptionFrequencyQuarterly
This is an alias to an internal value.
const SubscriptionFrequencyWeekly = shared.SubscriptionFrequencyWeekly
This is an alias to an internal value.
const SubscriptionFrequencyYearly = shared.SubscriptionFrequencyYearly
This is an alias to an internal value.
const SubscriptionStateAwaitingPayment = shared.SubscriptionStateAwaitingPayment
This is an alias to an internal value.
const SubscriptionStateCancelled = shared.SubscriptionStateCancelled
This is an alias to an internal value.
const SubscriptionStateExpired = shared.SubscriptionStateExpired
This is an alias to an internal value.
const SubscriptionStateFailed = shared.SubscriptionStateFailed
This is an alias to an internal value.
const SubscriptionStatePaid = shared.SubscriptionStatePaid
This is an alias to an internal value.
const SubscriptionStateProvisioned = shared.SubscriptionStateProvisioned
This is an alias to an internal value.
const SubscriptionStateTrial = shared.SubscriptionStateTrial
This is an alias to an internal value.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuditLogAction ¶
type AuditLogAction = shared.AuditLogAction
This is an alias to an internal type.
type AuditLogActor ¶
type AuditLogActor = shared.AuditLogActor
This is an alias to an internal type.
type AuditLogActorType ¶
type AuditLogActorType = shared.AuditLogActorType
The type of actor, whether a User, Cloudflare Admin, or an Automated System.
This is an alias to an internal type.
type AuditLogOwner ¶
type AuditLogOwner = shared.AuditLogOwner
This is an alias to an internal type.
type AuditLogResource ¶
type AuditLogResource = shared.AuditLogResource
This is an alias to an internal type.
type CertificateCA ¶
type CertificateCA = shared.CertificateCA
The Certificate Authority that will issue the certificate
This is an alias to an internal type.
type CertificateRequestType ¶
type CertificateRequestType = shared.CertificateRequestType
Signature type desired on certificate ("origin-rsa" (rsa), "origin-ecc" (ecdsa), or "keyless-certificate" (for Keyless SSL servers).
This is an alias to an internal type.
type CloudflareTunnel ¶
type CloudflareTunnel = shared.CloudflareTunnel
A Cloudflare Tunnel that connects your origin to Cloudflare's edge.
This is an alias to an internal type.
type CloudflareTunnelConnection ¶
type CloudflareTunnelConnection = shared.CloudflareTunnelConnection
This is an alias to an internal type.
type CloudflareTunnelStatus ¶
type CloudflareTunnelStatus = shared.CloudflareTunnelStatus
The status of the tunnel. Valid values are `inactive` (tunnel has never been run), `degraded` (tunnel is active and able to serve traffic but in an unhealthy state), `healthy` (tunnel is active and able to serve traffic), or `down` (tunnel can not serve traffic as it has no connections to the Cloudflare Edge).
This is an alias to an internal type.
type CloudflareTunnelTunType ¶
type CloudflareTunnelTunType = shared.CloudflareTunnelTunType
The type of tunnel.
This is an alias to an internal type.
type MemberRoleParam ¶
type MemberRoleParam = shared.MemberRoleParam
This is an alias to an internal type.
type MemberRolesPermissionsParam ¶
type MemberRolesPermissionsParam = shared.MemberRolesPermissionsParam
This is an alias to an internal type.
type MemberStatus ¶
type MemberStatus = shared.MemberStatus
A member's status in the account.
This is an alias to an internal type.
type MemberUserParam ¶
type MemberUserParam = shared.MemberUserParam
Details of the user associated to the membership.
This is an alias to an internal type.
type PermissionGrant ¶
type PermissionGrant = shared.PermissionGrant
This is an alias to an internal type.
type PermissionGrantParam ¶
type PermissionGrantParam = shared.PermissionGrantParam
This is an alias to an internal type.
type RatePlanParam ¶
type RatePlanParam = shared.RatePlanParam
The rate plan applied to the subscription.
This is an alias to an internal type.
type SortDirection ¶
type SortDirection = shared.SortDirection
Direction to order DNS records in.
This is an alias to an internal type.
type SubscriptionFrequency ¶
type SubscriptionFrequency = shared.SubscriptionFrequency
How often the subscription is renewed automatically.
This is an alias to an internal type.
type SubscriptionParam ¶
type SubscriptionParam = shared.SubscriptionParam
This is an alias to an internal type.
type SubscriptionState ¶
type SubscriptionState = shared.SubscriptionState
The state that the subscription is in.
This is an alias to an internal type.
type TurnstileService ¶
type TurnstileService struct { Options []option.RequestOption Widgets *WidgetService }
TurnstileService contains methods and other services that help with interacting with the cloudflare API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewTurnstileService method instead.
func NewTurnstileService ¶
func NewTurnstileService(opts ...option.RequestOption) (r *TurnstileService)
NewTurnstileService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
type Widget ¶
type Widget struct { // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive // challenges in response to malicious bots (ENT only). BotFightMode bool `json:"bot_fight_mode,required"` // If Turnstile is embedded on a Cloudflare site and the widget should grant // challenge clearance, this setting can determine the clearance level to be set ClearanceLevel WidgetClearanceLevel `json:"clearance_level,required"` // When the widget was created. CreatedOn time.Time `json:"created_on,required" format:"date-time"` Domains []WidgetDomain `json:"domains,required"` // Widget Mode Mode WidgetMode `json:"mode,required"` // When the widget was modified. ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // Human readable widget name. Not unique. Cloudflare suggests that you set this to // a meaningful string to make it easier to identify your widget, and where it is // used. Name string `json:"name,required"` // Do not show any Cloudflare branding on the widget (ENT only). Offlabel bool `json:"offlabel,required"` // Region where this widget can be used. Region WidgetRegion `json:"region,required"` // Secret key for this widget. Secret string `json:"secret,required"` // Widget item identifier tag. Sitekey string `json:"sitekey,required"` JSON widgetJSON `json:"-"` }
A Turnstile widget's detailed configuration
func (*Widget) UnmarshalJSON ¶
type WidgetClearanceLevel ¶
type WidgetClearanceLevel string
If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set
const ( WidgetClearanceLevelNoClearance WidgetClearanceLevel = "no_clearance" WidgetClearanceLevelJschallenge WidgetClearanceLevel = "jschallenge" WidgetClearanceLevelManaged WidgetClearanceLevel = "managed" WidgetClearanceLevelInteractive WidgetClearanceLevel = "interactive" )
func (WidgetClearanceLevel) IsKnown ¶
func (r WidgetClearanceLevel) IsKnown() bool
type WidgetDeleteParams ¶
type WidgetDeleteResponseEnvelope ¶
type WidgetDeleteResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result Widget `json:"result"` JSON widgetDeleteResponseEnvelopeJSON `json:"-"` }
func (*WidgetDeleteResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetDomain ¶
type WidgetDomain = string
type WidgetDomainParam ¶
type WidgetDomainParam = string
type WidgetGetParams ¶
type WidgetGetResponseEnvelope ¶
type WidgetGetResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result Widget `json:"result"` JSON widgetGetResponseEnvelopeJSON `json:"-"` }
func (*WidgetGetResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetListParams ¶
type WidgetListParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // Direction to order widgets. Direction param.Field[WidgetListParamsDirection] `query:"direction"` // Field to order widgets by. Order param.Field[WidgetListParamsOrder] `query:"order"` // Page number of paginated results. Page param.Field[float64] `query:"page"` // Number of items per page. PerPage param.Field[float64] `query:"per_page"` }
func (WidgetListParams) URLQuery ¶
func (r WidgetListParams) URLQuery() (v url.Values)
URLQuery serializes WidgetListParams's query parameters as `url.Values`.
type WidgetListParamsDirection ¶
type WidgetListParamsDirection string
Direction to order widgets.
const ( WidgetListParamsDirectionAsc WidgetListParamsDirection = "asc" WidgetListParamsDirectionDesc WidgetListParamsDirection = "desc" )
func (WidgetListParamsDirection) IsKnown ¶
func (r WidgetListParamsDirection) IsKnown() bool
type WidgetListParamsOrder ¶
type WidgetListParamsOrder string
Field to order widgets by.
const ( WidgetListParamsOrderID WidgetListParamsOrder = "id" WidgetListParamsOrderSitekey WidgetListParamsOrder = "sitekey" WidgetListParamsOrderName WidgetListParamsOrder = "name" WidgetListParamsOrderCreatedOn WidgetListParamsOrder = "created_on" WidgetListParamsOrderModifiedOn WidgetListParamsOrder = "modified_on" )
func (WidgetListParamsOrder) IsKnown ¶
func (r WidgetListParamsOrder) IsKnown() bool
type WidgetListResponse ¶
type WidgetListResponse struct { // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive // challenges in response to malicious bots (ENT only). BotFightMode bool `json:"bot_fight_mode,required"` // If Turnstile is embedded on a Cloudflare site and the widget should grant // challenge clearance, this setting can determine the clearance level to be set ClearanceLevel WidgetListResponseClearanceLevel `json:"clearance_level,required"` // When the widget was created. CreatedOn time.Time `json:"created_on,required" format:"date-time"` Domains []WidgetDomain `json:"domains,required"` // Widget Mode Mode WidgetListResponseMode `json:"mode,required"` // When the widget was modified. ModifiedOn time.Time `json:"modified_on,required" format:"date-time"` // Human readable widget name. Not unique. Cloudflare suggests that you set this to // a meaningful string to make it easier to identify your widget, and where it is // used. Name string `json:"name,required"` // Do not show any Cloudflare branding on the widget (ENT only). Offlabel bool `json:"offlabel,required"` // Region where this widget can be used. Region WidgetListResponseRegion `json:"region,required"` // Widget item identifier tag. Sitekey string `json:"sitekey,required"` JSON widgetListResponseJSON `json:"-"` }
A Turnstile Widgets configuration as it appears in listings
func (*WidgetListResponse) UnmarshalJSON ¶
func (r *WidgetListResponse) UnmarshalJSON(data []byte) (err error)
type WidgetListResponseClearanceLevel ¶
type WidgetListResponseClearanceLevel string
If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set
const ( WidgetListResponseClearanceLevelNoClearance WidgetListResponseClearanceLevel = "no_clearance" WidgetListResponseClearanceLevelJschallenge WidgetListResponseClearanceLevel = "jschallenge" WidgetListResponseClearanceLevelManaged WidgetListResponseClearanceLevel = "managed" WidgetListResponseClearanceLevelInteractive WidgetListResponseClearanceLevel = "interactive" )
func (WidgetListResponseClearanceLevel) IsKnown ¶
func (r WidgetListResponseClearanceLevel) IsKnown() bool
type WidgetListResponseMode ¶
type WidgetListResponseMode string
Widget Mode
const ( WidgetListResponseModeNonInteractive WidgetListResponseMode = "non-interactive" WidgetListResponseModeInvisible WidgetListResponseMode = "invisible" WidgetListResponseModeManaged WidgetListResponseMode = "managed" )
func (WidgetListResponseMode) IsKnown ¶
func (r WidgetListResponseMode) IsKnown() bool
type WidgetListResponseRegion ¶
type WidgetListResponseRegion string
Region where this widget can be used.
const (
WidgetListResponseRegionWorld WidgetListResponseRegion = "world"
)
func (WidgetListResponseRegion) IsKnown ¶
func (r WidgetListResponseRegion) IsKnown() bool
type WidgetMode ¶
type WidgetMode string
Widget Mode
const ( WidgetModeNonInteractive WidgetMode = "non-interactive" WidgetModeInvisible WidgetMode = "invisible" WidgetModeManaged WidgetMode = "managed" )
func (WidgetMode) IsKnown ¶
func (r WidgetMode) IsKnown() bool
type WidgetNewParams ¶
type WidgetNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Domains param.Field[[]WidgetDomainParam] `json:"domains,required"` // Widget Mode Mode param.Field[WidgetNewParamsMode] `json:"mode,required"` // Human readable widget name. Not unique. Cloudflare suggests that you set this to // a meaningful string to make it easier to identify your widget, and where it is // used. Name param.Field[string] `json:"name,required"` // Direction to order widgets. Direction param.Field[WidgetNewParamsDirection] `query:"direction"` // Field to order widgets by. Order param.Field[WidgetNewParamsOrder] `query:"order"` // Page number of paginated results. Page param.Field[float64] `query:"page"` // Number of items per page. PerPage param.Field[float64] `query:"per_page"` // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive // challenges in response to malicious bots (ENT only). BotFightMode param.Field[bool] `json:"bot_fight_mode"` // If Turnstile is embedded on a Cloudflare site and the widget should grant // challenge clearance, this setting can determine the clearance level to be set ClearanceLevel param.Field[WidgetNewParamsClearanceLevel] `json:"clearance_level"` // Do not show any Cloudflare branding on the widget (ENT only). Offlabel param.Field[bool] `json:"offlabel"` // Region where this widget can be used. Region param.Field[WidgetNewParamsRegion] `json:"region"` }
func (WidgetNewParams) MarshalJSON ¶
func (r WidgetNewParams) MarshalJSON() (data []byte, err error)
func (WidgetNewParams) URLQuery ¶
func (r WidgetNewParams) URLQuery() (v url.Values)
URLQuery serializes WidgetNewParams's query parameters as `url.Values`.
type WidgetNewParamsClearanceLevel ¶
type WidgetNewParamsClearanceLevel string
If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set
const ( WidgetNewParamsClearanceLevelNoClearance WidgetNewParamsClearanceLevel = "no_clearance" WidgetNewParamsClearanceLevelJschallenge WidgetNewParamsClearanceLevel = "jschallenge" WidgetNewParamsClearanceLevelManaged WidgetNewParamsClearanceLevel = "managed" WidgetNewParamsClearanceLevelInteractive WidgetNewParamsClearanceLevel = "interactive" )
func (WidgetNewParamsClearanceLevel) IsKnown ¶
func (r WidgetNewParamsClearanceLevel) IsKnown() bool
type WidgetNewParamsDirection ¶
type WidgetNewParamsDirection string
Direction to order widgets.
const ( WidgetNewParamsDirectionAsc WidgetNewParamsDirection = "asc" WidgetNewParamsDirectionDesc WidgetNewParamsDirection = "desc" )
func (WidgetNewParamsDirection) IsKnown ¶
func (r WidgetNewParamsDirection) IsKnown() bool
type WidgetNewParamsMode ¶
type WidgetNewParamsMode string
Widget Mode
const ( WidgetNewParamsModeNonInteractive WidgetNewParamsMode = "non-interactive" WidgetNewParamsModeInvisible WidgetNewParamsMode = "invisible" WidgetNewParamsModeManaged WidgetNewParamsMode = "managed" )
func (WidgetNewParamsMode) IsKnown ¶
func (r WidgetNewParamsMode) IsKnown() bool
type WidgetNewParamsOrder ¶
type WidgetNewParamsOrder string
Field to order widgets by.
const ( WidgetNewParamsOrderID WidgetNewParamsOrder = "id" WidgetNewParamsOrderSitekey WidgetNewParamsOrder = "sitekey" WidgetNewParamsOrderName WidgetNewParamsOrder = "name" WidgetNewParamsOrderCreatedOn WidgetNewParamsOrder = "created_on" WidgetNewParamsOrderModifiedOn WidgetNewParamsOrder = "modified_on" )
func (WidgetNewParamsOrder) IsKnown ¶
func (r WidgetNewParamsOrder) IsKnown() bool
type WidgetNewParamsRegion ¶
type WidgetNewParamsRegion string
Region where this widget can be used.
const (
WidgetNewParamsRegionWorld WidgetNewParamsRegion = "world"
)
func (WidgetNewParamsRegion) IsKnown ¶
func (r WidgetNewParamsRegion) IsKnown() bool
type WidgetNewResponseEnvelope ¶
type WidgetNewResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result Widget `json:"result"` ResultInfo WidgetNewResponseEnvelopeResultInfo `json:"result_info"` JSON widgetNewResponseEnvelopeJSON `json:"-"` }
func (*WidgetNewResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetNewResponseEnvelopeResultInfo ¶
type WidgetNewResponseEnvelopeResultInfo struct { // Total number of results for the requested service Count float64 `json:"count,required"` // Current page within paginated list of results Page float64 `json:"page,required"` // Number of results per page of results PerPage float64 `json:"per_page,required"` // Total results available without any search parameters TotalCount float64 `json:"total_count,required"` JSON widgetNewResponseEnvelopeResultInfoJSON `json:"-"` }
func (*WidgetNewResponseEnvelopeResultInfo) UnmarshalJSON ¶
func (r *WidgetNewResponseEnvelopeResultInfo) UnmarshalJSON(data []byte) (err error)
type WidgetRegion ¶
type WidgetRegion string
Region where this widget can be used.
const (
WidgetRegionWorld WidgetRegion = "world"
)
func (WidgetRegion) IsKnown ¶
func (r WidgetRegion) IsKnown() bool
type WidgetRotateSecretParams ¶
type WidgetRotateSecretParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // If `invalidate_immediately` is set to `false`, the previous secret will remain // valid for two hours. Otherwise, the secret is immediately invalidated, and // requests using it will be rejected. InvalidateImmediately param.Field[bool] `json:"invalidate_immediately"` }
func (WidgetRotateSecretParams) MarshalJSON ¶
func (r WidgetRotateSecretParams) MarshalJSON() (data []byte, err error)
type WidgetRotateSecretResponseEnvelope ¶
type WidgetRotateSecretResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result Widget `json:"result"` JSON widgetRotateSecretResponseEnvelopeJSON `json:"-"` }
func (*WidgetRotateSecretResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetRotateSecretResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetService ¶
type WidgetService struct {
Options []option.RequestOption
}
WidgetService contains methods and other services that help with interacting with the cloudflare API.
Note, unlike clients, this service does not read variables from the environment automatically. You should not instantiate this service directly, and instead use the NewWidgetService method instead.
func NewWidgetService ¶
func NewWidgetService(opts ...option.RequestOption) (r *WidgetService)
NewWidgetService generates a new service that applies the given options to each request. These options are applied after the parent client's options (if there is one), and before any request-specific options.
func (*WidgetService) Delete ¶
func (r *WidgetService) Delete(ctx context.Context, sitekey string, body WidgetDeleteParams, opts ...option.RequestOption) (res *Widget, err error)
Destroy a Turnstile Widget.
func (*WidgetService) Get ¶
func (r *WidgetService) Get(ctx context.Context, sitekey string, query WidgetGetParams, opts ...option.RequestOption) (res *Widget, err error)
Show a single challenge widget configuration.
func (*WidgetService) List ¶
func (r *WidgetService) List(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) (res *pagination.V4PagePaginationArray[WidgetListResponse], err error)
Lists all turnstile widgets of an account.
func (*WidgetService) ListAutoPaging ¶
func (r *WidgetService) ListAutoPaging(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) *pagination.V4PagePaginationArrayAutoPager[WidgetListResponse]
Lists all turnstile widgets of an account.
func (*WidgetService) New ¶
func (r *WidgetService) New(ctx context.Context, params WidgetNewParams, opts ...option.RequestOption) (res *Widget, err error)
Lists challenge widgets.
func (*WidgetService) RotateSecret ¶
func (r *WidgetService) RotateSecret(ctx context.Context, sitekey string, params WidgetRotateSecretParams, opts ...option.RequestOption) (res *Widget, err error)
Generate a new secret key for this widget. If `invalidate_immediately` is set to `false`, the previous secret remains valid for 2 hours.
Note that secrets cannot be rotated again during the grace period.
func (*WidgetService) Update ¶
func (r *WidgetService) Update(ctx context.Context, sitekey string, params WidgetUpdateParams, opts ...option.RequestOption) (res *Widget, err error)
Update the configuration of a widget.
type WidgetUpdateParams ¶
type WidgetUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Domains param.Field[[]WidgetDomainParam] `json:"domains,required"` // Widget Mode Mode param.Field[WidgetUpdateParamsMode] `json:"mode,required"` // Human readable widget name. Not unique. Cloudflare suggests that you set this to // a meaningful string to make it easier to identify your widget, and where it is // used. Name param.Field[string] `json:"name,required"` // If bot_fight_mode is set to `true`, Cloudflare issues computationally expensive // challenges in response to malicious bots (ENT only). BotFightMode param.Field[bool] `json:"bot_fight_mode"` // If Turnstile is embedded on a Cloudflare site and the widget should grant // challenge clearance, this setting can determine the clearance level to be set ClearanceLevel param.Field[WidgetUpdateParamsClearanceLevel] `json:"clearance_level"` // Do not show any Cloudflare branding on the widget (ENT only). Offlabel param.Field[bool] `json:"offlabel"` }
func (WidgetUpdateParams) MarshalJSON ¶
func (r WidgetUpdateParams) MarshalJSON() (data []byte, err error)
type WidgetUpdateParamsClearanceLevel ¶
type WidgetUpdateParamsClearanceLevel string
If Turnstile is embedded on a Cloudflare site and the widget should grant challenge clearance, this setting can determine the clearance level to be set
const ( WidgetUpdateParamsClearanceLevelNoClearance WidgetUpdateParamsClearanceLevel = "no_clearance" WidgetUpdateParamsClearanceLevelJschallenge WidgetUpdateParamsClearanceLevel = "jschallenge" WidgetUpdateParamsClearanceLevelManaged WidgetUpdateParamsClearanceLevel = "managed" WidgetUpdateParamsClearanceLevelInteractive WidgetUpdateParamsClearanceLevel = "interactive" )
func (WidgetUpdateParamsClearanceLevel) IsKnown ¶
func (r WidgetUpdateParamsClearanceLevel) IsKnown() bool
type WidgetUpdateParamsMode ¶
type WidgetUpdateParamsMode string
Widget Mode
const ( WidgetUpdateParamsModeNonInteractive WidgetUpdateParamsMode = "non-interactive" WidgetUpdateParamsModeInvisible WidgetUpdateParamsMode = "invisible" WidgetUpdateParamsModeManaged WidgetUpdateParamsMode = "managed" )
func (WidgetUpdateParamsMode) IsKnown ¶
func (r WidgetUpdateParamsMode) IsKnown() bool
type WidgetUpdateResponseEnvelope ¶
type WidgetUpdateResponseEnvelope struct { Errors []shared.ResponseInfo `json:"errors,required"` Messages []shared.ResponseInfo `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result Widget `json:"result"` JSON widgetUpdateResponseEnvelopeJSON `json:"-"` }
func (*WidgetUpdateResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)