Documentation ¶
Index ¶
- type ChallengeService
- type Error
- type NcChallengesAdminWidgetDetail
- type NcChallengesAdminWidgetDetailClearanceLevel
- type NcChallengesAdminWidgetDetailMode
- type NcChallengesAdminWidgetDetailRegion
- type NcChallengesAdminWidgetList
- type NcChallengesAdminWidgetListClearanceLevel
- type NcChallengesAdminWidgetListMode
- type NcChallengesAdminWidgetListRegion
- type WidgetDeleteParams
- type WidgetDeleteResponseEnvelope
- type WidgetDeleteResponseEnvelopeErrors
- type WidgetDeleteResponseEnvelopeMessages
- type WidgetGetParams
- type WidgetGetResponseEnvelope
- type WidgetGetResponseEnvelopeErrors
- type WidgetGetResponseEnvelopeMessages
- type WidgetListParams
- type WidgetListParamsDirection
- type WidgetListParamsOrder
- type WidgetNewParams
- type WidgetNewParamsClearanceLevel
- type WidgetNewParamsDirection
- type WidgetNewParamsMode
- type WidgetNewParamsOrder
- type WidgetNewParamsRegion
- type WidgetNewResponseEnvelope
- type WidgetNewResponseEnvelopeErrors
- type WidgetNewResponseEnvelopeMessages
- type WidgetNewResponseEnvelopeResultInfo
- type WidgetRotateSecretParams
- type WidgetRotateSecretResponseEnvelope
- type WidgetRotateSecretResponseEnvelopeErrors
- type WidgetRotateSecretResponseEnvelopeMessages
- type WidgetService
- func (r *WidgetService) Delete(ctx context.Context, sitekey string, body WidgetDeleteParams, ...) (res *NcChallengesAdminWidgetDetail, err error)
- func (r *WidgetService) Get(ctx context.Context, sitekey string, query WidgetGetParams, ...) (res *NcChallengesAdminWidgetDetail, err error)
- func (r *WidgetService) List(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[NcChallengesAdminWidgetList], err error)
- func (r *WidgetService) ListAutoPaging(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[NcChallengesAdminWidgetList]
- func (r *WidgetService) New(ctx context.Context, params WidgetNewParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error)
- func (r *WidgetService) RotateSecret(ctx context.Context, sitekey string, params WidgetRotateSecretParams, ...) (res *NcChallengesAdminWidgetDetail, err error)
- func (r *WidgetService) Update(ctx context.Context, sitekey string, params WidgetUpdateParams, ...) (res *NcChallengesAdminWidgetDetail, err error)
- type WidgetUpdateParams
- type WidgetUpdateParamsClearanceLevel
- type WidgetUpdateParamsMode
- type WidgetUpdateResponseEnvelope
- type WidgetUpdateResponseEnvelopeErrors
- type WidgetUpdateResponseEnvelopeMessages
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChallengeService ¶
type ChallengeService struct { Options []option.RequestOption Widgets *WidgetService }
ChallengeService 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 NewChallengeService method instead.
func NewChallengeService ¶
func NewChallengeService(opts ...option.RequestOption) (r *ChallengeService)
NewChallengeService 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 NcChallengesAdminWidgetDetail ¶
type NcChallengesAdminWidgetDetail 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 NcChallengesAdminWidgetDetailClearanceLevel `json:"clearance_level,required"` // When the widget was created. CreatedOn time.Time `json:"created_on,required" format:"date-time"` Domains []string `json:"domains,required"` // Widget Mode Mode NcChallengesAdminWidgetDetailMode `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 NcChallengesAdminWidgetDetailRegion `json:"region,required"` // Secret key for this widget. Secret string `json:"secret,required"` // Widget item identifier tag. Sitekey string `json:"sitekey,required"` JSON ncChallengesAdminWidgetDetailJSON `json:"-"` }
A Turnstile widget's detailed configuration
func (*NcChallengesAdminWidgetDetail) UnmarshalJSON ¶
func (r *NcChallengesAdminWidgetDetail) UnmarshalJSON(data []byte) (err error)
type NcChallengesAdminWidgetDetailClearanceLevel ¶
type NcChallengesAdminWidgetDetailClearanceLevel 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 ( NcChallengesAdminWidgetDetailClearanceLevelNoClearance NcChallengesAdminWidgetDetailClearanceLevel = "no_clearance" NcChallengesAdminWidgetDetailClearanceLevelJschallenge NcChallengesAdminWidgetDetailClearanceLevel = "jschallenge" NcChallengesAdminWidgetDetailClearanceLevelManaged NcChallengesAdminWidgetDetailClearanceLevel = "managed" NcChallengesAdminWidgetDetailClearanceLevelInteractive NcChallengesAdminWidgetDetailClearanceLevel = "interactive" )
func (NcChallengesAdminWidgetDetailClearanceLevel) IsKnown ¶
func (r NcChallengesAdminWidgetDetailClearanceLevel) IsKnown() bool
type NcChallengesAdminWidgetDetailMode ¶
type NcChallengesAdminWidgetDetailMode string
Widget Mode
const ( NcChallengesAdminWidgetDetailModeNonInteractive NcChallengesAdminWidgetDetailMode = "non-interactive" NcChallengesAdminWidgetDetailModeInvisible NcChallengesAdminWidgetDetailMode = "invisible" NcChallengesAdminWidgetDetailModeManaged NcChallengesAdminWidgetDetailMode = "managed" )
func (NcChallengesAdminWidgetDetailMode) IsKnown ¶
func (r NcChallengesAdminWidgetDetailMode) IsKnown() bool
type NcChallengesAdminWidgetDetailRegion ¶
type NcChallengesAdminWidgetDetailRegion string
Region where this widget can be used.
const (
NcChallengesAdminWidgetDetailRegionWorld NcChallengesAdminWidgetDetailRegion = "world"
)
func (NcChallengesAdminWidgetDetailRegion) IsKnown ¶
func (r NcChallengesAdminWidgetDetailRegion) IsKnown() bool
type NcChallengesAdminWidgetList ¶
type NcChallengesAdminWidgetList 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 NcChallengesAdminWidgetListClearanceLevel `json:"clearance_level,required"` // When the widget was created. CreatedOn time.Time `json:"created_on,required" format:"date-time"` Domains []string `json:"domains,required"` // Widget Mode Mode NcChallengesAdminWidgetListMode `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 NcChallengesAdminWidgetListRegion `json:"region,required"` // Widget item identifier tag. Sitekey string `json:"sitekey,required"` JSON ncChallengesAdminWidgetListJSON `json:"-"` }
A Turnstile Widgets configuration as it appears in listings
func (*NcChallengesAdminWidgetList) UnmarshalJSON ¶
func (r *NcChallengesAdminWidgetList) UnmarshalJSON(data []byte) (err error)
type NcChallengesAdminWidgetListClearanceLevel ¶
type NcChallengesAdminWidgetListClearanceLevel 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 ( NcChallengesAdminWidgetListClearanceLevelNoClearance NcChallengesAdminWidgetListClearanceLevel = "no_clearance" NcChallengesAdminWidgetListClearanceLevelJschallenge NcChallengesAdminWidgetListClearanceLevel = "jschallenge" NcChallengesAdminWidgetListClearanceLevelManaged NcChallengesAdminWidgetListClearanceLevel = "managed" NcChallengesAdminWidgetListClearanceLevelInteractive NcChallengesAdminWidgetListClearanceLevel = "interactive" )
func (NcChallengesAdminWidgetListClearanceLevel) IsKnown ¶
func (r NcChallengesAdminWidgetListClearanceLevel) IsKnown() bool
type NcChallengesAdminWidgetListMode ¶
type NcChallengesAdminWidgetListMode string
Widget Mode
const ( NcChallengesAdminWidgetListModeNonInteractive NcChallengesAdminWidgetListMode = "non-interactive" NcChallengesAdminWidgetListModeInvisible NcChallengesAdminWidgetListMode = "invisible" NcChallengesAdminWidgetListModeManaged NcChallengesAdminWidgetListMode = "managed" )
func (NcChallengesAdminWidgetListMode) IsKnown ¶
func (r NcChallengesAdminWidgetListMode) IsKnown() bool
type NcChallengesAdminWidgetListRegion ¶
type NcChallengesAdminWidgetListRegion string
Region where this widget can be used.
const (
NcChallengesAdminWidgetListRegionWorld NcChallengesAdminWidgetListRegion = "world"
)
func (NcChallengesAdminWidgetListRegion) IsKnown ¶
func (r NcChallengesAdminWidgetListRegion) IsKnown() bool
type WidgetDeleteParams ¶
type WidgetDeleteResponseEnvelope ¶
type WidgetDeleteResponseEnvelope struct { Errors []WidgetDeleteResponseEnvelopeErrors `json:"errors,required"` Messages []WidgetDeleteResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result NcChallengesAdminWidgetDetail `json:"result"` JSON widgetDeleteResponseEnvelopeJSON `json:"-"` }
func (*WidgetDeleteResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetDeleteResponseEnvelopeErrors ¶
type WidgetDeleteResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetDeleteResponseEnvelopeErrorsJSON `json:"-"` }
func (*WidgetDeleteResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *WidgetDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type WidgetDeleteResponseEnvelopeMessages ¶
type WidgetDeleteResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetDeleteResponseEnvelopeMessagesJSON `json:"-"` }
func (*WidgetDeleteResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *WidgetDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type WidgetGetParams ¶
type WidgetGetResponseEnvelope ¶
type WidgetGetResponseEnvelope struct { Errors []WidgetGetResponseEnvelopeErrors `json:"errors,required"` Messages []WidgetGetResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result NcChallengesAdminWidgetDetail `json:"result"` JSON widgetGetResponseEnvelopeJSON `json:"-"` }
func (*WidgetGetResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetGetResponseEnvelopeErrors ¶
type WidgetGetResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetGetResponseEnvelopeErrorsJSON `json:"-"` }
func (*WidgetGetResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *WidgetGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type WidgetGetResponseEnvelopeMessages ¶
type WidgetGetResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetGetResponseEnvelopeMessagesJSON `json:"-"` }
func (*WidgetGetResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *WidgetGetResponseEnvelopeMessages) 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 WidgetNewParams ¶
type WidgetNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Domains param.Field[[]string] `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 []WidgetNewResponseEnvelopeErrors `json:"errors,required"` Messages []WidgetNewResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result NcChallengesAdminWidgetDetail `json:"result"` ResultInfo WidgetNewResponseEnvelopeResultInfo `json:"result_info"` JSON widgetNewResponseEnvelopeJSON `json:"-"` }
func (*WidgetNewResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetNewResponseEnvelopeErrors ¶
type WidgetNewResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetNewResponseEnvelopeErrorsJSON `json:"-"` }
func (*WidgetNewResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *WidgetNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type WidgetNewResponseEnvelopeMessages ¶
type WidgetNewResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetNewResponseEnvelopeMessagesJSON `json:"-"` }
func (*WidgetNewResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *WidgetNewResponseEnvelopeMessages) 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 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 []WidgetRotateSecretResponseEnvelopeErrors `json:"errors,required"` Messages []WidgetRotateSecretResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result NcChallengesAdminWidgetDetail `json:"result"` JSON widgetRotateSecretResponseEnvelopeJSON `json:"-"` }
func (*WidgetRotateSecretResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetRotateSecretResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetRotateSecretResponseEnvelopeErrors ¶
type WidgetRotateSecretResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetRotateSecretResponseEnvelopeErrorsJSON `json:"-"` }
func (*WidgetRotateSecretResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *WidgetRotateSecretResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type WidgetRotateSecretResponseEnvelopeMessages ¶
type WidgetRotateSecretResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetRotateSecretResponseEnvelopeMessagesJSON `json:"-"` }
func (*WidgetRotateSecretResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *WidgetRotateSecretResponseEnvelopeMessages) 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 *NcChallengesAdminWidgetDetail, err error)
Destroy a Turnstile Widget.
func (*WidgetService) Get ¶
func (r *WidgetService) Get(ctx context.Context, sitekey string, query WidgetGetParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error)
Show a single challenge widget configuration.
func (*WidgetService) List ¶
func (r *WidgetService) List(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[NcChallengesAdminWidgetList], err error)
Lists all turnstile widgets of an account.
func (*WidgetService) ListAutoPaging ¶
func (r *WidgetService) ListAutoPaging(ctx context.Context, params WidgetListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[NcChallengesAdminWidgetList]
Lists all turnstile widgets of an account.
func (*WidgetService) New ¶
func (r *WidgetService) New(ctx context.Context, params WidgetNewParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, err error)
Lists challenge widgets.
func (*WidgetService) RotateSecret ¶
func (r *WidgetService) RotateSecret(ctx context.Context, sitekey string, params WidgetRotateSecretParams, opts ...option.RequestOption) (res *NcChallengesAdminWidgetDetail, 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 *NcChallengesAdminWidgetDetail, 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[[]string] `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 []WidgetUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []WidgetUpdateResponseEnvelopeMessages `json:"messages,required"` // Whether the API call was successful Success bool `json:"success,required"` // A Turnstile widget's detailed configuration Result NcChallengesAdminWidgetDetail `json:"result"` JSON widgetUpdateResponseEnvelopeJSON `json:"-"` }
func (*WidgetUpdateResponseEnvelope) UnmarshalJSON ¶
func (r *WidgetUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type WidgetUpdateResponseEnvelopeErrors ¶
type WidgetUpdateResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetUpdateResponseEnvelopeErrorsJSON `json:"-"` }
func (*WidgetUpdateResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *WidgetUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type WidgetUpdateResponseEnvelopeMessages ¶
type WidgetUpdateResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON widgetUpdateResponseEnvelopeMessagesJSON `json:"-"` }
func (*WidgetUpdateResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *WidgetUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)