Documentation ¶
Index ¶
- type Error
- type KVService
- type NamespaceBulkDeleteParams
- type NamespaceBulkDeleteResponse
- type NamespaceBulkDeleteResponseEnvelope
- type NamespaceBulkDeleteResponseEnvelopeErrors
- type NamespaceBulkDeleteResponseEnvelopeMessages
- type NamespaceBulkDeleteResponseEnvelopeSuccess
- type NamespaceBulkService
- func (r *NamespaceBulkService) Delete(ctx context.Context, namespaceID string, params NamespaceBulkDeleteParams, ...) (res *NamespaceBulkDeleteResponse, err error)
- func (r *NamespaceBulkService) Update(ctx context.Context, namespaceID string, params NamespaceBulkUpdateParams, ...) (res *NamespaceBulkUpdateResponse, err error)
- type NamespaceBulkUpdateParams
- type NamespaceBulkUpdateParamsBody
- type NamespaceBulkUpdateResponse
- type NamespaceBulkUpdateResponseEnvelope
- type NamespaceBulkUpdateResponseEnvelopeErrors
- type NamespaceBulkUpdateResponseEnvelopeMessages
- type NamespaceBulkUpdateResponseEnvelopeSuccess
- type NamespaceDeleteParams
- type NamespaceDeleteResponse
- type NamespaceDeleteResponseEnvelope
- type NamespaceDeleteResponseEnvelopeErrors
- type NamespaceDeleteResponseEnvelopeMessages
- type NamespaceDeleteResponseEnvelopeSuccess
- type NamespaceKeyListParams
- type NamespaceKeyService
- func (r *NamespaceKeyService) List(ctx context.Context, namespaceID string, params NamespaceKeyListParams, ...) (res *shared.CursorLimitPagination[WorkersKVKey], err error)
- func (r *NamespaceKeyService) ListAutoPaging(ctx context.Context, namespaceID string, params NamespaceKeyListParams, ...) *shared.CursorLimitPaginationAutoPager[WorkersKVKey]
- type NamespaceListParams
- type NamespaceListParamsDirection
- type NamespaceListParamsOrder
- type NamespaceMetadataGetParams
- type NamespaceMetadataGetResponse
- type NamespaceMetadataGetResponseEnvelope
- type NamespaceMetadataGetResponseEnvelopeErrors
- type NamespaceMetadataGetResponseEnvelopeMessages
- type NamespaceMetadataGetResponseEnvelopeSuccess
- type NamespaceMetadataService
- type NamespaceNewParams
- type NamespaceNewResponseEnvelope
- type NamespaceNewResponseEnvelopeErrors
- type NamespaceNewResponseEnvelopeMessages
- type NamespaceNewResponseEnvelopeSuccess
- type NamespaceService
- func (r *NamespaceService) Delete(ctx context.Context, namespaceID string, body NamespaceDeleteParams, ...) (res *NamespaceDeleteResponse, err error)
- func (r *NamespaceService) List(ctx context.Context, params NamespaceListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[WorkersKVNamespace], err error)
- func (r *NamespaceService) ListAutoPaging(ctx context.Context, params NamespaceListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[WorkersKVNamespace]
- func (r *NamespaceService) New(ctx context.Context, params NamespaceNewParams, opts ...option.RequestOption) (res *WorkersKVNamespace, err error)
- func (r *NamespaceService) Update(ctx context.Context, namespaceID string, params NamespaceUpdateParams, ...) (res *NamespaceUpdateResponse, err error)
- type NamespaceUpdateParams
- type NamespaceUpdateResponse
- type NamespaceUpdateResponseEnvelope
- type NamespaceUpdateResponseEnvelopeErrors
- type NamespaceUpdateResponseEnvelopeMessages
- type NamespaceUpdateResponseEnvelopeSuccess
- type NamespaceValueDeleteParams
- type NamespaceValueDeleteResponse
- type NamespaceValueDeleteResponseEnvelope
- type NamespaceValueDeleteResponseEnvelopeErrors
- type NamespaceValueDeleteResponseEnvelopeMessages
- type NamespaceValueDeleteResponseEnvelopeSuccess
- type NamespaceValueGetParams
- type NamespaceValueService
- func (r *NamespaceValueService) Delete(ctx context.Context, namespaceID string, keyName string, ...) (res *NamespaceValueDeleteResponse, err error)
- func (r *NamespaceValueService) Get(ctx context.Context, namespaceID string, keyName string, ...) (res *string, err error)
- func (r *NamespaceValueService) Update(ctx context.Context, namespaceID string, keyName string, ...) (res *NamespaceValueUpdateResponse, err error)
- type NamespaceValueUpdateParams
- type NamespaceValueUpdateResponse
- type NamespaceValueUpdateResponseEnvelope
- type NamespaceValueUpdateResponseEnvelopeErrors
- type NamespaceValueUpdateResponseEnvelopeMessages
- type NamespaceValueUpdateResponseEnvelopeSuccess
- type WorkersKVKey
- type WorkersKVNamespace
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KVService ¶
type KVService struct { Options []option.RequestOption Namespaces *NamespaceService }
KVService 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 NewKVService method instead.
func NewKVService ¶
func NewKVService(opts ...option.RequestOption) (r *KVService)
NewKVService 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 NamespaceBulkDeleteParams ¶
type NamespaceBulkDeleteParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Body param.Field[[]string] `json:"body,required"` }
func (NamespaceBulkDeleteParams) MarshalJSON ¶
func (r NamespaceBulkDeleteParams) MarshalJSON() (data []byte, err error)
type NamespaceBulkDeleteResponse ¶ added in v2.3.0
type NamespaceBulkDeleteResponse interface {
ImplementsKVNamespaceBulkDeleteResponse()
}
Union satisfied by kv.NamespaceBulkDeleteResponseUnknown or shared.UnionString.
type NamespaceBulkDeleteResponseEnvelope ¶
type NamespaceBulkDeleteResponseEnvelope struct { Errors []NamespaceBulkDeleteResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceBulkDeleteResponseEnvelopeMessages `json:"messages,required"` Result NamespaceBulkDeleteResponse `json:"result,required"` // Whether the API call was successful Success NamespaceBulkDeleteResponseEnvelopeSuccess `json:"success,required"` JSON namespaceBulkDeleteResponseEnvelopeJSON `json:"-"` }
func (*NamespaceBulkDeleteResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceBulkDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceBulkDeleteResponseEnvelopeErrors ¶
type NamespaceBulkDeleteResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceBulkDeleteResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceBulkDeleteResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceBulkDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceBulkDeleteResponseEnvelopeMessages ¶
type NamespaceBulkDeleteResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceBulkDeleteResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceBulkDeleteResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceBulkDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceBulkDeleteResponseEnvelopeSuccess ¶
type NamespaceBulkDeleteResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceBulkDeleteResponseEnvelopeSuccessTrue NamespaceBulkDeleteResponseEnvelopeSuccess = true
)
type NamespaceBulkService ¶
type NamespaceBulkService struct {
Options []option.RequestOption
}
NamespaceBulkService 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 NewNamespaceBulkService method instead.
func NewNamespaceBulkService ¶
func NewNamespaceBulkService(opts ...option.RequestOption) (r *NamespaceBulkService)
NewNamespaceBulkService 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 (*NamespaceBulkService) Delete ¶
func (r *NamespaceBulkService) Delete(ctx context.Context, namespaceID string, params NamespaceBulkDeleteParams, opts ...option.RequestOption) (res *NamespaceBulkDeleteResponse, err error)
Remove multiple KV pairs from the namespace. Body should be an array of up to 10,000 keys to be removed.
func (*NamespaceBulkService) Update ¶
func (r *NamespaceBulkService) Update(ctx context.Context, namespaceID string, params NamespaceBulkUpdateParams, opts ...option.RequestOption) (res *NamespaceBulkUpdateResponse, err error)
Write multiple keys and values at once. Body should be an array of up to 10,000 key-value pairs to be stored, along with optional expiration information. Existing values and expirations will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored. The entire request size must be 100 megabytes or less.
type NamespaceBulkUpdateParams ¶
type NamespaceBulkUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` Body param.Field[[]NamespaceBulkUpdateParamsBody] `json:"body,required"` }
func (NamespaceBulkUpdateParams) MarshalJSON ¶
func (r NamespaceBulkUpdateParams) MarshalJSON() (data []byte, err error)
type NamespaceBulkUpdateParamsBody ¶
type NamespaceBulkUpdateParamsBody struct { // Whether or not the server should base64 decode the value before storing it. // Useful for writing values that wouldn't otherwise be valid JSON strings, such as // images. Base64 param.Field[bool] `json:"base64"` // The time, measured in number of seconds since the UNIX epoch, at which the key // should expire. Expiration param.Field[float64] `json:"expiration"` // The number of seconds for which the key should be visible before it expires. At // least 60. ExpirationTTL param.Field[float64] `json:"expiration_ttl"` // A key's name. The name may be at most 512 bytes. All printable, non-whitespace // characters are valid. Key param.Field[string] `json:"key"` // Arbitrary JSON that is associated with a key. Metadata param.Field[interface{}] `json:"metadata"` // A UTF-8 encoded string to be stored, up to 25 MiB in length. Value param.Field[string] `json:"value"` }
func (NamespaceBulkUpdateParamsBody) MarshalJSON ¶
func (r NamespaceBulkUpdateParamsBody) MarshalJSON() (data []byte, err error)
type NamespaceBulkUpdateResponse ¶ added in v2.3.0
type NamespaceBulkUpdateResponse interface {
ImplementsKVNamespaceBulkUpdateResponse()
}
Union satisfied by kv.NamespaceBulkUpdateResponseUnknown or shared.UnionString.
type NamespaceBulkUpdateResponseEnvelope ¶
type NamespaceBulkUpdateResponseEnvelope struct { Errors []NamespaceBulkUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceBulkUpdateResponseEnvelopeMessages `json:"messages,required"` Result NamespaceBulkUpdateResponse `json:"result,required"` // Whether the API call was successful Success NamespaceBulkUpdateResponseEnvelopeSuccess `json:"success,required"` JSON namespaceBulkUpdateResponseEnvelopeJSON `json:"-"` }
func (*NamespaceBulkUpdateResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceBulkUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceBulkUpdateResponseEnvelopeErrors ¶
type NamespaceBulkUpdateResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceBulkUpdateResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceBulkUpdateResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceBulkUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceBulkUpdateResponseEnvelopeMessages ¶
type NamespaceBulkUpdateResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceBulkUpdateResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceBulkUpdateResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceBulkUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceBulkUpdateResponseEnvelopeSuccess ¶
type NamespaceBulkUpdateResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceBulkUpdateResponseEnvelopeSuccessTrue NamespaceBulkUpdateResponseEnvelopeSuccess = true
)
type NamespaceDeleteParams ¶
type NamespaceDeleteResponse ¶ added in v2.3.0
type NamespaceDeleteResponse interface {
ImplementsKVNamespaceDeleteResponse()
}
Union satisfied by kv.NamespaceDeleteResponseUnknown or shared.UnionString.
type NamespaceDeleteResponseEnvelope ¶
type NamespaceDeleteResponseEnvelope struct { Errors []NamespaceDeleteResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceDeleteResponseEnvelopeMessages `json:"messages,required"` Result NamespaceDeleteResponse `json:"result,required"` // Whether the API call was successful Success NamespaceDeleteResponseEnvelopeSuccess `json:"success,required"` JSON namespaceDeleteResponseEnvelopeJSON `json:"-"` }
func (*NamespaceDeleteResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceDeleteResponseEnvelopeErrors ¶
type NamespaceDeleteResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceDeleteResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceDeleteResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceDeleteResponseEnvelopeMessages ¶
type NamespaceDeleteResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceDeleteResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceDeleteResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceDeleteResponseEnvelopeSuccess ¶
type NamespaceDeleteResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceDeleteResponseEnvelopeSuccessTrue NamespaceDeleteResponseEnvelopeSuccess = true
)
type NamespaceKeyListParams ¶
type NamespaceKeyListParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // Opaque token indicating the position from which to continue when requesting the // next set of records if the amount of list results was limited by the limit // parameter. A valid value for the cursor can be obtained from the `cursors` // object in the `result_info` structure. Cursor param.Field[string] `query:"cursor"` // The number of keys to return. The cursor attribute may be used to iterate over // the next batch of keys if there are more than the limit. Limit param.Field[float64] `query:"limit"` // A string prefix used to filter down which keys will be returned. Exact matches // and any key names that begin with the prefix will be returned. Prefix param.Field[string] `query:"prefix"` }
func (NamespaceKeyListParams) URLQuery ¶
func (r NamespaceKeyListParams) URLQuery() (v url.Values)
URLQuery serializes NamespaceKeyListParams's query parameters as `url.Values`.
type NamespaceKeyService ¶
type NamespaceKeyService struct {
Options []option.RequestOption
}
NamespaceKeyService 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 NewNamespaceKeyService method instead.
func NewNamespaceKeyService ¶
func NewNamespaceKeyService(opts ...option.RequestOption) (r *NamespaceKeyService)
NewNamespaceKeyService 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 (*NamespaceKeyService) List ¶
func (r *NamespaceKeyService) List(ctx context.Context, namespaceID string, params NamespaceKeyListParams, opts ...option.RequestOption) (res *shared.CursorLimitPagination[WorkersKVKey], err error)
Lists a namespace's keys.
func (*NamespaceKeyService) ListAutoPaging ¶
func (r *NamespaceKeyService) ListAutoPaging(ctx context.Context, namespaceID string, params NamespaceKeyListParams, opts ...option.RequestOption) *shared.CursorLimitPaginationAutoPager[WorkersKVKey]
Lists a namespace's keys.
type NamespaceListParams ¶
type NamespaceListParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // Direction to order namespaces. Direction param.Field[NamespaceListParamsDirection] `query:"direction"` // Field to order results by. Order param.Field[NamespaceListParamsOrder] `query:"order"` // Page number of paginated results. Page param.Field[float64] `query:"page"` // Maximum number of results per page. PerPage param.Field[float64] `query:"per_page"` }
func (NamespaceListParams) URLQuery ¶
func (r NamespaceListParams) URLQuery() (v url.Values)
URLQuery serializes NamespaceListParams's query parameters as `url.Values`.
type NamespaceListParamsDirection ¶
type NamespaceListParamsDirection string
Direction to order namespaces.
const ( NamespaceListParamsDirectionAsc NamespaceListParamsDirection = "asc" NamespaceListParamsDirectionDesc NamespaceListParamsDirection = "desc" )
type NamespaceListParamsOrder ¶
type NamespaceListParamsOrder string
Field to order results by.
const ( NamespaceListParamsOrderID NamespaceListParamsOrder = "id" NamespaceListParamsOrderTitle NamespaceListParamsOrder = "title" )
type NamespaceMetadataGetResponse ¶
type NamespaceMetadataGetResponse = interface{}
type NamespaceMetadataGetResponseEnvelope ¶
type NamespaceMetadataGetResponseEnvelope struct { Errors []NamespaceMetadataGetResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceMetadataGetResponseEnvelopeMessages `json:"messages,required"` // Arbitrary JSON that is associated with a key. Result NamespaceMetadataGetResponse `json:"result,required"` // Whether the API call was successful Success NamespaceMetadataGetResponseEnvelopeSuccess `json:"success,required"` JSON namespaceMetadataGetResponseEnvelopeJSON `json:"-"` }
func (*NamespaceMetadataGetResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceMetadataGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceMetadataGetResponseEnvelopeErrors ¶
type NamespaceMetadataGetResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceMetadataGetResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceMetadataGetResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceMetadataGetResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceMetadataGetResponseEnvelopeMessages ¶
type NamespaceMetadataGetResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceMetadataGetResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceMetadataGetResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceMetadataGetResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceMetadataGetResponseEnvelopeSuccess ¶
type NamespaceMetadataGetResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceMetadataGetResponseEnvelopeSuccessTrue NamespaceMetadataGetResponseEnvelopeSuccess = true
)
type NamespaceMetadataService ¶
type NamespaceMetadataService struct {
Options []option.RequestOption
}
NamespaceMetadataService 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 NewNamespaceMetadataService method instead.
func NewNamespaceMetadataService ¶
func NewNamespaceMetadataService(opts ...option.RequestOption) (r *NamespaceMetadataService)
NewNamespaceMetadataService 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 (*NamespaceMetadataService) Get ¶
func (r *NamespaceMetadataService) Get(ctx context.Context, namespaceID string, keyName string, query NamespaceMetadataGetParams, opts ...option.RequestOption) (res *NamespaceMetadataGetResponse, err error)
Returns the metadata associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.
type NamespaceNewParams ¶
type NamespaceNewParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // A human-readable string name for a Namespace. Title param.Field[string] `json:"title,required"` }
func (NamespaceNewParams) MarshalJSON ¶
func (r NamespaceNewParams) MarshalJSON() (data []byte, err error)
type NamespaceNewResponseEnvelope ¶
type NamespaceNewResponseEnvelope struct { Errors []NamespaceNewResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceNewResponseEnvelopeMessages `json:"messages,required"` Result WorkersKVNamespace `json:"result,required"` // Whether the API call was successful Success NamespaceNewResponseEnvelopeSuccess `json:"success,required"` JSON namespaceNewResponseEnvelopeJSON `json:"-"` }
func (*NamespaceNewResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceNewResponseEnvelopeErrors ¶
type NamespaceNewResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceNewResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceNewResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceNewResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceNewResponseEnvelopeMessages ¶
type NamespaceNewResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceNewResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceNewResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceNewResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceNewResponseEnvelopeSuccess ¶
type NamespaceNewResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceNewResponseEnvelopeSuccessTrue NamespaceNewResponseEnvelopeSuccess = true
)
type NamespaceService ¶
type NamespaceService struct { Options []option.RequestOption Bulk *NamespaceBulkService Keys *NamespaceKeyService Metadata *NamespaceMetadataService Values *NamespaceValueService }
NamespaceService 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 NewNamespaceService method instead.
func NewNamespaceService ¶
func NewNamespaceService(opts ...option.RequestOption) (r *NamespaceService)
NewNamespaceService 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 (*NamespaceService) Delete ¶
func (r *NamespaceService) Delete(ctx context.Context, namespaceID string, body NamespaceDeleteParams, opts ...option.RequestOption) (res *NamespaceDeleteResponse, err error)
Deletes the namespace corresponding to the given ID.
func (*NamespaceService) List ¶
func (r *NamespaceService) List(ctx context.Context, params NamespaceListParams, opts ...option.RequestOption) (res *shared.V4PagePaginationArray[WorkersKVNamespace], err error)
Returns the namespaces owned by an account.
func (*NamespaceService) ListAutoPaging ¶
func (r *NamespaceService) ListAutoPaging(ctx context.Context, params NamespaceListParams, opts ...option.RequestOption) *shared.V4PagePaginationArrayAutoPager[WorkersKVNamespace]
Returns the namespaces owned by an account.
func (*NamespaceService) New ¶
func (r *NamespaceService) New(ctx context.Context, params NamespaceNewParams, opts ...option.RequestOption) (res *WorkersKVNamespace, err error)
Creates a namespace under the given title. A `400` is returned if the account already owns a namespace with this title. A namespace must be explicitly deleted to be replaced.
func (*NamespaceService) Update ¶
func (r *NamespaceService) Update(ctx context.Context, namespaceID string, params NamespaceUpdateParams, opts ...option.RequestOption) (res *NamespaceUpdateResponse, err error)
Modifies a namespace's title.
type NamespaceUpdateParams ¶
type NamespaceUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // A human-readable string name for a Namespace. Title param.Field[string] `json:"title,required"` }
func (NamespaceUpdateParams) MarshalJSON ¶
func (r NamespaceUpdateParams) MarshalJSON() (data []byte, err error)
type NamespaceUpdateResponse ¶ added in v2.3.0
type NamespaceUpdateResponse interface {
ImplementsKVNamespaceUpdateResponse()
}
Union satisfied by kv.NamespaceUpdateResponseUnknown or shared.UnionString.
type NamespaceUpdateResponseEnvelope ¶
type NamespaceUpdateResponseEnvelope struct { Errors []NamespaceUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceUpdateResponseEnvelopeMessages `json:"messages,required"` Result NamespaceUpdateResponse `json:"result,required"` // Whether the API call was successful Success NamespaceUpdateResponseEnvelopeSuccess `json:"success,required"` JSON namespaceUpdateResponseEnvelopeJSON `json:"-"` }
func (*NamespaceUpdateResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceUpdateResponseEnvelopeErrors ¶
type NamespaceUpdateResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceUpdateResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceUpdateResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceUpdateResponseEnvelopeMessages ¶
type NamespaceUpdateResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceUpdateResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceUpdateResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceUpdateResponseEnvelopeSuccess ¶
type NamespaceUpdateResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceUpdateResponseEnvelopeSuccessTrue NamespaceUpdateResponseEnvelopeSuccess = true
)
type NamespaceValueDeleteResponse ¶ added in v2.3.0
type NamespaceValueDeleteResponse interface {
ImplementsKVNamespaceValueDeleteResponse()
}
Union satisfied by kv.NamespaceValueDeleteResponseUnknown or shared.UnionString.
type NamespaceValueDeleteResponseEnvelope ¶
type NamespaceValueDeleteResponseEnvelope struct { Errors []NamespaceValueDeleteResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceValueDeleteResponseEnvelopeMessages `json:"messages,required"` Result NamespaceValueDeleteResponse `json:"result,required"` // Whether the API call was successful Success NamespaceValueDeleteResponseEnvelopeSuccess `json:"success,required"` JSON namespaceValueDeleteResponseEnvelopeJSON `json:"-"` }
func (*NamespaceValueDeleteResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceValueDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceValueDeleteResponseEnvelopeErrors ¶
type NamespaceValueDeleteResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceValueDeleteResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceValueDeleteResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceValueDeleteResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceValueDeleteResponseEnvelopeMessages ¶
type NamespaceValueDeleteResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceValueDeleteResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceValueDeleteResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceValueDeleteResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceValueDeleteResponseEnvelopeSuccess ¶
type NamespaceValueDeleteResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceValueDeleteResponseEnvelopeSuccessTrue NamespaceValueDeleteResponseEnvelopeSuccess = true
)
type NamespaceValueGetParams ¶
type NamespaceValueService ¶
type NamespaceValueService struct {
Options []option.RequestOption
}
NamespaceValueService 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 NewNamespaceValueService method instead.
func NewNamespaceValueService ¶
func NewNamespaceValueService(opts ...option.RequestOption) (r *NamespaceValueService)
NewNamespaceValueService 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 (*NamespaceValueService) Delete ¶
func (r *NamespaceValueService) Delete(ctx context.Context, namespaceID string, keyName string, body NamespaceValueDeleteParams, opts ...option.RequestOption) (res *NamespaceValueDeleteResponse, err error)
Remove a KV pair from the namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name.
func (*NamespaceValueService) Get ¶
func (r *NamespaceValueService) Get(ctx context.Context, namespaceID string, keyName string, query NamespaceValueGetParams, opts ...option.RequestOption) (res *string, err error)
Returns the value associated with the given key in the given namespace. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. If the KV-pair is set to expire at some point, the expiration time as measured in seconds since the UNIX epoch will be returned in the `expiration` response header.
func (*NamespaceValueService) Update ¶
func (r *NamespaceValueService) Update(ctx context.Context, namespaceID string, keyName string, params NamespaceValueUpdateParams, opts ...option.RequestOption) (res *NamespaceValueUpdateResponse, err error)
Write a value identified by a key. Use URL-encoding to use special characters (for example, `:`, `!`, `%`) in the key name. Body should be the value to be stored along with JSON metadata to be associated with the key/value pair. Existing values, expirations, and metadata will be overwritten. If neither `expiration` nor `expiration_ttl` is specified, the key-value pair will never expire. If both are set, `expiration_ttl` is used and `expiration` is ignored.
type NamespaceValueUpdateParams ¶
type NamespaceValueUpdateParams struct { // Identifier AccountID param.Field[string] `path:"account_id,required"` // Arbitrary JSON to be associated with a key/value pair. Metadata param.Field[string] `json:"metadata,required"` // A byte sequence to be stored, up to 25 MiB in length. Value param.Field[string] `json:"value,required"` }
func (NamespaceValueUpdateParams) MarshalJSON ¶
func (r NamespaceValueUpdateParams) MarshalJSON() (data []byte, err error)
type NamespaceValueUpdateResponse ¶ added in v2.3.0
type NamespaceValueUpdateResponse interface {
ImplementsKVNamespaceValueUpdateResponse()
}
Union satisfied by kv.NamespaceValueUpdateResponseUnknown or shared.UnionString.
type NamespaceValueUpdateResponseEnvelope ¶
type NamespaceValueUpdateResponseEnvelope struct { Errors []NamespaceValueUpdateResponseEnvelopeErrors `json:"errors,required"` Messages []NamespaceValueUpdateResponseEnvelopeMessages `json:"messages,required"` Result NamespaceValueUpdateResponse `json:"result,required"` // Whether the API call was successful Success NamespaceValueUpdateResponseEnvelopeSuccess `json:"success,required"` JSON namespaceValueUpdateResponseEnvelopeJSON `json:"-"` }
func (*NamespaceValueUpdateResponseEnvelope) UnmarshalJSON ¶
func (r *NamespaceValueUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)
type NamespaceValueUpdateResponseEnvelopeErrors ¶
type NamespaceValueUpdateResponseEnvelopeErrors struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceValueUpdateResponseEnvelopeErrorsJSON `json:"-"` }
func (*NamespaceValueUpdateResponseEnvelopeErrors) UnmarshalJSON ¶
func (r *NamespaceValueUpdateResponseEnvelopeErrors) UnmarshalJSON(data []byte) (err error)
type NamespaceValueUpdateResponseEnvelopeMessages ¶
type NamespaceValueUpdateResponseEnvelopeMessages struct { Code int64 `json:"code,required"` Message string `json:"message,required"` JSON namespaceValueUpdateResponseEnvelopeMessagesJSON `json:"-"` }
func (*NamespaceValueUpdateResponseEnvelopeMessages) UnmarshalJSON ¶
func (r *NamespaceValueUpdateResponseEnvelopeMessages) UnmarshalJSON(data []byte) (err error)
type NamespaceValueUpdateResponseEnvelopeSuccess ¶
type NamespaceValueUpdateResponseEnvelopeSuccess bool
Whether the API call was successful
const (
NamespaceValueUpdateResponseEnvelopeSuccessTrue NamespaceValueUpdateResponseEnvelopeSuccess = true
)
type WorkersKVKey ¶
type WorkersKVKey struct { // A key's name. The name may be at most 512 bytes. All printable, non-whitespace // characters are valid. Use percent-encoding to define key names as part of a URL. Name string `json:"name,required"` // The time, measured in number of seconds since the UNIX epoch, at which the key // will expire. This property is omitted for keys that will not expire. Expiration float64 `json:"expiration"` // Arbitrary JSON that is associated with a key. Metadata interface{} `json:"metadata"` JSON workersKVKeyJSON `json:"-"` }
A name for a value. A value stored under a given key may be retrieved via the same key.
func (*WorkersKVKey) UnmarshalJSON ¶
func (r *WorkersKVKey) UnmarshalJSON(data []byte) (err error)
type WorkersKVNamespace ¶
type WorkersKVNamespace struct { // Namespace identifier tag. ID string `json:"id,required"` // A human-readable string name for a Namespace. Title string `json:"title,required"` // True if keys written on the URL will be URL-decoded before storing. For example, // if set to "true", a key written on the URL as "%3F" will be stored as "?". SupportsURLEncoding bool `json:"supports_url_encoding"` JSON workersKVNamespaceJSON `json:"-"` }
func (*WorkersKVNamespace) UnmarshalJSON ¶
func (r *WorkersKVNamespace) UnmarshalJSON(data []byte) (err error)