images

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const AuditLogActorTypeAdmin = shared.AuditLogActorTypeAdmin

This is an alias to an internal value.

View Source
const AuditLogActorTypeCloudflare = shared.AuditLogActorTypeCloudflare

This is an alias to an internal value.

View Source
const AuditLogActorTypeUser = shared.AuditLogActorTypeUser

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeCNI = shared.CloudflareTunnelTunTypeCNI

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeCfdTunnel = shared.CloudflareTunnelTunTypeCfdTunnel

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeGRE = shared.CloudflareTunnelTunTypeGRE

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeIPSec = shared.CloudflareTunnelTunTypeIPSec

This is an alias to an internal value.

View Source
const CloudflareTunnelTunTypeWARPConnector = shared.CloudflareTunnelTunTypeWARPConnector

This is an alias to an internal value.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASN added in v2.1.0

type ASN = shared.ASN

This is an alias to an internal type.

type ASNParam added in v2.1.0

type ASNParam = shared.ASNParam

This is an alias to an internal type.

type AuditLog

type AuditLog = shared.AuditLog

This is an alias to an internal type.

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 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 CloudflareTunnelTunType

type CloudflareTunnelTunType = shared.CloudflareTunnelTunType

The type of tunnel.

This is an alias to an internal type.

type Error

type Error = apierror.Error

type ErrorData

type ErrorData = shared.ErrorData

This is an alias to an internal type.

type Image

type Image struct {
	// Image unique identifier.
	ID string `json:"id"`
	// Image file name.
	Filename string `json:"filename"`
	// User modifiable key-value store. Can be used for keeping references to another
	// system of record for managing images. Metadata must not exceed 1024 bytes.
	Meta interface{} `json:"meta"`
	// Indicates whether the image can be a accessed only using it's UID. If set to
	// true, a signed token needs to be generated with a signing key to view the image.
	RequireSignedURLs bool `json:"requireSignedURLs"`
	// When the media item was uploaded.
	Uploaded time.Time `json:"uploaded" format:"date-time"`
	// Object specifying available variants for an image.
	Variants []ImageVariantsUnion `json:"variants" format:"uri"`
	JSON     imageJSON            `json:"-"`
}

func (*Image) UnmarshalJSON

func (r *Image) UnmarshalJSON(data []byte) (err error)

type ImageService

type ImageService struct {
	Options []option.RequestOption
	V1      *V1Service
	V2      *V2Service
}

ImageService 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 NewImageService method instead.

func NewImageService

func NewImageService(opts ...option.RequestOption) (r *ImageService)

NewImageService 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 ImageVariantsUnion

type ImageVariantsUnion interface {
	ImplementsImagesImageVariantsUnion()
}

URI to thumbnail variant for an image.

Union satisfied by shared.UnionString, shared.UnionString or shared.UnionString.

type Key

type Key struct {
	// Key name.
	Name string `json:"name"`
	// Key value.
	Value string  `json:"value"`
	JSON  keyJSON `json:"-"`
}

func (*Key) UnmarshalJSON

func (r *Key) UnmarshalJSON(data []byte) (err error)

type Member added in v2.1.0

type Member = shared.Member

This is an alias to an internal type.

type MemberParam added in v2.1.0

type MemberParam = shared.MemberParam

This is an alias to an internal type.

type MemberRole added in v2.1.0

type MemberRole = shared.MemberRole

This is an alias to an internal type.

type MemberRoleParam added in v2.1.0

type MemberRoleParam = shared.MemberRoleParam

This is an alias to an internal type.

type MemberRolesPermissions added in v2.1.0

type MemberRolesPermissions = shared.MemberRolesPermissions

This is an alias to an internal type.

type MemberRolesPermissionsParam added in v2.1.0

type MemberRolesPermissionsParam = shared.MemberRolesPermissionsParam

This is an alias to an internal type.

type MemberUser added in v2.1.0

type MemberUser = shared.MemberUser

This is an alias to an internal type.

type MemberUserParam added in v2.1.0

type MemberUserParam = shared.MemberUserParam

This is an alias to an internal type.

type Permission

type Permission = shared.Permission

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 ResponseInfo

type ResponseInfo = shared.ResponseInfo

This is an alias to an internal type.

type Role

type Role = shared.Role

This is an alias to an internal type.

type Stat

type Stat struct {
	Count StatCount `json:"count"`
	JSON  statJSON  `json:"-"`
}

func (*Stat) UnmarshalJSON

func (r *Stat) UnmarshalJSON(data []byte) (err error)

type StatCount

type StatCount struct {
	// Cloudflare Images allowed usage.
	Allowed float64 `json:"allowed"`
	// Cloudflare Images current usage.
	Current float64       `json:"current"`
	JSON    statCountJSON `json:"-"`
}

func (*StatCount) UnmarshalJSON

func (r *StatCount) UnmarshalJSON(data []byte) (err error)

type V1BlobGetParams

type V1BlobGetParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1BlobService

type V1BlobService struct {
	Options []option.RequestOption
}

V1BlobService 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 NewV1BlobService method instead.

func NewV1BlobService

func NewV1BlobService(opts ...option.RequestOption) (r *V1BlobService)

NewV1BlobService 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 (*V1BlobService) Get

func (r *V1BlobService) Get(ctx context.Context, imageID string, query V1BlobGetParams, opts ...option.RequestOption) (res *http.Response, err error)

Fetch base image. For most images this will be the originally uploaded file. For larger images it can be a near-lossless version of the original.

type V1DeleteParams

type V1DeleteParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	Body      interface{}         `json:"body,required"`
}

func (V1DeleteParams) MarshalJSON

func (r V1DeleteParams) MarshalJSON() (data []byte, err error)

type V1DeleteResponseEnvelope

type V1DeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1DeleteResponseUnion `json:"result,required"`
	// Whether the API call was successful
	Success V1DeleteResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1DeleteResponseEnvelopeJSON    `json:"-"`
}

func (*V1DeleteResponseEnvelope) UnmarshalJSON

func (r *V1DeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1DeleteResponseEnvelopeSuccess

type V1DeleteResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1DeleteResponseEnvelopeSuccessTrue V1DeleteResponseEnvelopeSuccess = true
)

func (V1DeleteResponseEnvelopeSuccess) IsKnown

type V1DeleteResponseUnion

type V1DeleteResponseUnion interface {
	ImplementsImagesV1DeleteResponseUnion()
}

Union satisfied by images.V1DeleteResponseUnknown or shared.UnionString.

type V1EditParams

type V1EditParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	// User modifiable key-value store. Can be used for keeping references to another
	// system of record for managing images. No change if not specified.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Indicates whether the image can be accessed using only its UID. If set to
	// `true`, a signed token needs to be generated with a signing key to view the
	// image. Returns a new UID on a change. No change if not specified.
	RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"`
}

func (V1EditParams) MarshalJSON

func (r V1EditParams) MarshalJSON() (data []byte, err error)

type V1EditResponseEnvelope

type V1EditResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   Image                 `json:"result,required"`
	// Whether the API call was successful
	Success V1EditResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1EditResponseEnvelopeJSON    `json:"-"`
}

func (*V1EditResponseEnvelope) UnmarshalJSON

func (r *V1EditResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1EditResponseEnvelopeSuccess

type V1EditResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1EditResponseEnvelopeSuccessTrue V1EditResponseEnvelopeSuccess = true
)

func (V1EditResponseEnvelopeSuccess) IsKnown

func (r V1EditResponseEnvelopeSuccess) IsKnown() bool

type V1GetParams

type V1GetParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1GetResponseEnvelope

type V1GetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   Image                 `json:"result,required"`
	// Whether the API call was successful
	Success V1GetResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1GetResponseEnvelopeJSON    `json:"-"`
}

func (*V1GetResponseEnvelope) UnmarshalJSON

func (r *V1GetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1GetResponseEnvelopeSuccess

type V1GetResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1GetResponseEnvelopeSuccessTrue V1GetResponseEnvelopeSuccess = true
)

func (V1GetResponseEnvelopeSuccess) IsKnown

func (r V1GetResponseEnvelopeSuccess) IsKnown() bool

type V1KeyDeleteParams

type V1KeyDeleteParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1KeyDeleteResponse added in v2.1.0

type V1KeyDeleteResponse struct {
	Keys []Key                   `json:"keys"`
	JSON v1KeyDeleteResponseJSON `json:"-"`
}

func (*V1KeyDeleteResponse) UnmarshalJSON added in v2.1.0

func (r *V1KeyDeleteResponse) UnmarshalJSON(data []byte) (err error)

type V1KeyDeleteResponseEnvelope

type V1KeyDeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1KeyDeleteResponse   `json:"result,required"`
	// Whether the API call was successful
	Success V1KeyDeleteResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1KeyDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*V1KeyDeleteResponseEnvelope) UnmarshalJSON

func (r *V1KeyDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1KeyDeleteResponseEnvelopeSuccess

type V1KeyDeleteResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1KeyDeleteResponseEnvelopeSuccessTrue V1KeyDeleteResponseEnvelopeSuccess = true
)

func (V1KeyDeleteResponseEnvelopeSuccess) IsKnown

type V1KeyListParams

type V1KeyListParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1KeyListResponse added in v2.1.0

type V1KeyListResponse struct {
	Keys []Key                 `json:"keys"`
	JSON v1KeyListResponseJSON `json:"-"`
}

func (*V1KeyListResponse) UnmarshalJSON added in v2.1.0

func (r *V1KeyListResponse) UnmarshalJSON(data []byte) (err error)

type V1KeyListResponseEnvelope

type V1KeyListResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1KeyListResponse     `json:"result,required"`
	// Whether the API call was successful
	Success V1KeyListResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1KeyListResponseEnvelopeJSON    `json:"-"`
}

func (*V1KeyListResponseEnvelope) UnmarshalJSON

func (r *V1KeyListResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1KeyListResponseEnvelopeSuccess

type V1KeyListResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1KeyListResponseEnvelopeSuccessTrue V1KeyListResponseEnvelopeSuccess = true
)

func (V1KeyListResponseEnvelopeSuccess) IsKnown

type V1KeyService

type V1KeyService struct {
	Options []option.RequestOption
}

V1KeyService 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 NewV1KeyService method instead.

func NewV1KeyService

func NewV1KeyService(opts ...option.RequestOption) (r *V1KeyService)

NewV1KeyService 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 (*V1KeyService) Delete

func (r *V1KeyService) Delete(ctx context.Context, signingKeyName string, body V1KeyDeleteParams, opts ...option.RequestOption) (res *V1KeyDeleteResponse, err error)

Delete signing key with specified name. Returns all keys available. When last key is removed, a new default signing key will be generated.

func (*V1KeyService) List

func (r *V1KeyService) List(ctx context.Context, query V1KeyListParams, opts ...option.RequestOption) (res *V1KeyListResponse, err error)

Lists your signing keys. These can be found on your Cloudflare Images dashboard.

func (*V1KeyService) Update

func (r *V1KeyService) Update(ctx context.Context, signingKeyName string, body V1KeyUpdateParams, opts ...option.RequestOption) (res *V1KeyUpdateResponse, err error)

Create a new signing key with specified name. Returns all keys available.

type V1KeyUpdateParams

type V1KeyUpdateParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1KeyUpdateResponse added in v2.1.0

type V1KeyUpdateResponse struct {
	Keys []Key                   `json:"keys"`
	JSON v1KeyUpdateResponseJSON `json:"-"`
}

func (*V1KeyUpdateResponse) UnmarshalJSON added in v2.1.0

func (r *V1KeyUpdateResponse) UnmarshalJSON(data []byte) (err error)

type V1KeyUpdateResponseEnvelope

type V1KeyUpdateResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1KeyUpdateResponse   `json:"result,required"`
	// Whether the API call was successful
	Success V1KeyUpdateResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1KeyUpdateResponseEnvelopeJSON    `json:"-"`
}

func (*V1KeyUpdateResponseEnvelope) UnmarshalJSON

func (r *V1KeyUpdateResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1KeyUpdateResponseEnvelopeSuccess

type V1KeyUpdateResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1KeyUpdateResponseEnvelopeSuccessTrue V1KeyUpdateResponseEnvelopeSuccess = true
)

func (V1KeyUpdateResponseEnvelopeSuccess) IsKnown

type V1ListParams

type V1ListParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	// Page number of paginated results.
	Page param.Field[float64] `query:"page"`
	// Number of items per page.
	PerPage param.Field[float64] `query:"per_page"`
}

func (V1ListParams) URLQuery

func (r V1ListParams) URLQuery() (v url.Values)

URLQuery serializes V1ListParams's query parameters as `url.Values`.

type V1ListResponse

type V1ListResponse struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1ListResponseResult  `json:"result,required"`
	// Whether the API call was successful
	Success V1ListResponseSuccess `json:"success,required"`
	JSON    v1ListResponseJSON    `json:"-"`
}

func (*V1ListResponse) UnmarshalJSON

func (r *V1ListResponse) UnmarshalJSON(data []byte) (err error)

type V1ListResponseResult

type V1ListResponseResult struct {
	Images []Image                  `json:"images"`
	JSON   v1ListResponseResultJSON `json:"-"`
}

func (*V1ListResponseResult) UnmarshalJSON

func (r *V1ListResponseResult) UnmarshalJSON(data []byte) (err error)

type V1ListResponseSuccess

type V1ListResponseSuccess bool

Whether the API call was successful

const (
	V1ListResponseSuccessTrue V1ListResponseSuccess = true
)

func (V1ListResponseSuccess) IsKnown

func (r V1ListResponseSuccess) IsKnown() bool

type V1NewParams

type V1NewParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	// An image binary data. Only needed when type is uploading a file.
	File param.Field[interface{}] `json:"file"`
	// User modifiable key-value store. Can use used for keeping references to another
	// system of record for managing images.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Indicates whether the image requires a signature token for the access.
	RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"`
	// A URL to fetch an image from origin. Only needed when type is uploading from a
	// URL.
	URL param.Field[string] `json:"url"`
}

func (V1NewParams) MarshalJSON

func (r V1NewParams) MarshalJSON() (data []byte, err error)

type V1NewResponseEnvelope

type V1NewResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   Image                 `json:"result,required"`
	// Whether the API call was successful
	Success V1NewResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1NewResponseEnvelopeJSON    `json:"-"`
}

func (*V1NewResponseEnvelope) UnmarshalJSON

func (r *V1NewResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1NewResponseEnvelopeSuccess

type V1NewResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1NewResponseEnvelopeSuccessTrue V1NewResponseEnvelopeSuccess = true
)

func (V1NewResponseEnvelopeSuccess) IsKnown

func (r V1NewResponseEnvelopeSuccess) IsKnown() bool

type V1Service

type V1Service struct {
	Options  []option.RequestOption
	Keys     *V1KeyService
	Stats    *V1StatService
	Variants *V1VariantService
	Blobs    *V1BlobService
}

V1Service 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 NewV1Service method instead.

func NewV1Service

func NewV1Service(opts ...option.RequestOption) (r *V1Service)

NewV1Service 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 (*V1Service) Delete

func (r *V1Service) Delete(ctx context.Context, imageID string, params V1DeleteParams, opts ...option.RequestOption) (res *V1DeleteResponseUnion, err error)

Delete an image on Cloudflare Images. On success, all copies of the image are deleted and purged from cache.

func (*V1Service) Edit

func (r *V1Service) Edit(ctx context.Context, imageID string, params V1EditParams, opts ...option.RequestOption) (res *Image, err error)

Update image access control. On access control change, all copies of the image are purged from cache.

func (*V1Service) Get

func (r *V1Service) Get(ctx context.Context, imageID string, query V1GetParams, opts ...option.RequestOption) (res *Image, err error)

Fetch details for a single image.

func (*V1Service) List

List up to 100 images with one request. Use the optional parameters below to get a specific range of images.

func (*V1Service) ListAutoPaging

List up to 100 images with one request. Use the optional parameters below to get a specific range of images.

func (*V1Service) New

func (r *V1Service) New(ctx context.Context, params V1NewParams, opts ...option.RequestOption) (res *Image, err error)

Upload an image with up to 10 Megabytes using a single HTTP POST (multipart/form-data) request. An image can be uploaded by sending an image file or passing an accessible to an API url.

type V1StatGetParams

type V1StatGetParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1StatGetResponseEnvelope

type V1StatGetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   Stat                  `json:"result,required"`
	// Whether the API call was successful
	Success V1StatGetResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1StatGetResponseEnvelopeJSON    `json:"-"`
}

func (*V1StatGetResponseEnvelope) UnmarshalJSON

func (r *V1StatGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1StatGetResponseEnvelopeSuccess

type V1StatGetResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1StatGetResponseEnvelopeSuccessTrue V1StatGetResponseEnvelopeSuccess = true
)

func (V1StatGetResponseEnvelopeSuccess) IsKnown

type V1StatService

type V1StatService struct {
	Options []option.RequestOption
}

V1StatService 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 NewV1StatService method instead.

func NewV1StatService

func NewV1StatService(opts ...option.RequestOption) (r *V1StatService)

NewV1StatService 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 (*V1StatService) Get

func (r *V1StatService) Get(ctx context.Context, query V1StatGetParams, opts ...option.RequestOption) (res *Stat, err error)

Fetch usage statistics details for Cloudflare Images.

type V1VariantDeleteParams

type V1VariantDeleteParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	Body      interface{}         `json:"body,required"`
}

func (V1VariantDeleteParams) MarshalJSON

func (r V1VariantDeleteParams) MarshalJSON() (data []byte, err error)

type V1VariantDeleteResponseEnvelope

type V1VariantDeleteResponseEnvelope struct {
	Errors   []shared.ResponseInfo        `json:"errors,required"`
	Messages []shared.ResponseInfo        `json:"messages,required"`
	Result   V1VariantDeleteResponseUnion `json:"result,required"`
	// Whether the API call was successful
	Success V1VariantDeleteResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1VariantDeleteResponseEnvelopeJSON    `json:"-"`
}

func (*V1VariantDeleteResponseEnvelope) UnmarshalJSON

func (r *V1VariantDeleteResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1VariantDeleteResponseEnvelopeSuccess

type V1VariantDeleteResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1VariantDeleteResponseEnvelopeSuccessTrue V1VariantDeleteResponseEnvelopeSuccess = true
)

func (V1VariantDeleteResponseEnvelopeSuccess) IsKnown

type V1VariantDeleteResponseUnion

type V1VariantDeleteResponseUnion interface {
	ImplementsImagesV1VariantDeleteResponseUnion()
}

Union satisfied by images.V1VariantDeleteResponseUnknown or shared.UnionString.

type V1VariantEditParams

type V1VariantEditParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	// Allows you to define image resizing sizes for different use cases.
	Options param.Field[V1VariantEditParamsOptions] `json:"options,required"`
	// Indicates whether the variant can access an image without a signature,
	// regardless of image access control.
	NeverRequireSignedURLs param.Field[bool] `json:"neverRequireSignedURLs"`
}

func (V1VariantEditParams) MarshalJSON

func (r V1VariantEditParams) MarshalJSON() (data []byte, err error)

type V1VariantEditParamsOptions

type V1VariantEditParamsOptions struct {
	// The fit property describes how the width and height dimensions should be
	// interpreted.
	Fit param.Field[V1VariantEditParamsOptionsFit] `json:"fit,required"`
	// Maximum height in image pixels.
	Height param.Field[float64] `json:"height,required"`
	// What EXIF data should be preserved in the output image.
	Metadata param.Field[V1VariantEditParamsOptionsMetadata] `json:"metadata,required"`
	// Maximum width in image pixels.
	Width param.Field[float64] `json:"width,required"`
}

Allows you to define image resizing sizes for different use cases.

func (V1VariantEditParamsOptions) MarshalJSON

func (r V1VariantEditParamsOptions) MarshalJSON() (data []byte, err error)

type V1VariantEditParamsOptionsFit

type V1VariantEditParamsOptionsFit string

The fit property describes how the width and height dimensions should be interpreted.

const (
	V1VariantEditParamsOptionsFitScaleDown V1VariantEditParamsOptionsFit = "scale-down"
	V1VariantEditParamsOptionsFitContain   V1VariantEditParamsOptionsFit = "contain"
	V1VariantEditParamsOptionsFitCover     V1VariantEditParamsOptionsFit = "cover"
	V1VariantEditParamsOptionsFitCrop      V1VariantEditParamsOptionsFit = "crop"
	V1VariantEditParamsOptionsFitPad       V1VariantEditParamsOptionsFit = "pad"
)

func (V1VariantEditParamsOptionsFit) IsKnown

func (r V1VariantEditParamsOptionsFit) IsKnown() bool

type V1VariantEditParamsOptionsMetadata

type V1VariantEditParamsOptionsMetadata string

What EXIF data should be preserved in the output image.

const (
	V1VariantEditParamsOptionsMetadataKeep      V1VariantEditParamsOptionsMetadata = "keep"
	V1VariantEditParamsOptionsMetadataCopyright V1VariantEditParamsOptionsMetadata = "copyright"
	V1VariantEditParamsOptionsMetadataNone      V1VariantEditParamsOptionsMetadata = "none"
)

func (V1VariantEditParamsOptionsMetadata) IsKnown

type V1VariantEditResponse

type V1VariantEditResponse struct {
	Variant V1VariantEditResponseVariant `json:"variant"`
	JSON    v1VariantEditResponseJSON    `json:"-"`
}

func (*V1VariantEditResponse) UnmarshalJSON

func (r *V1VariantEditResponse) UnmarshalJSON(data []byte) (err error)

type V1VariantEditResponseEnvelope

type V1VariantEditResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1VariantEditResponse `json:"result,required"`
	// Whether the API call was successful
	Success V1VariantEditResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1VariantEditResponseEnvelopeJSON    `json:"-"`
}

func (*V1VariantEditResponseEnvelope) UnmarshalJSON

func (r *V1VariantEditResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1VariantEditResponseEnvelopeSuccess

type V1VariantEditResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1VariantEditResponseEnvelopeSuccessTrue V1VariantEditResponseEnvelopeSuccess = true
)

func (V1VariantEditResponseEnvelopeSuccess) IsKnown

type V1VariantEditResponseVariant

type V1VariantEditResponseVariant struct {
	ID string `json:"id,required"`
	// Allows you to define image resizing sizes for different use cases.
	Options V1VariantEditResponseVariantOptions `json:"options,required"`
	// Indicates whether the variant can access an image without a signature,
	// regardless of image access control.
	NeverRequireSignedURLs bool                             `json:"neverRequireSignedURLs"`
	JSON                   v1VariantEditResponseVariantJSON `json:"-"`
}

func (*V1VariantEditResponseVariant) UnmarshalJSON

func (r *V1VariantEditResponseVariant) UnmarshalJSON(data []byte) (err error)

type V1VariantEditResponseVariantOptions

type V1VariantEditResponseVariantOptions struct {
	// The fit property describes how the width and height dimensions should be
	// interpreted.
	Fit V1VariantEditResponseVariantOptionsFit `json:"fit,required"`
	// Maximum height in image pixels.
	Height float64 `json:"height,required"`
	// What EXIF data should be preserved in the output image.
	Metadata V1VariantEditResponseVariantOptionsMetadata `json:"metadata,required"`
	// Maximum width in image pixels.
	Width float64                                 `json:"width,required"`
	JSON  v1VariantEditResponseVariantOptionsJSON `json:"-"`
}

Allows you to define image resizing sizes for different use cases.

func (*V1VariantEditResponseVariantOptions) UnmarshalJSON

func (r *V1VariantEditResponseVariantOptions) UnmarshalJSON(data []byte) (err error)

type V1VariantEditResponseVariantOptionsFit

type V1VariantEditResponseVariantOptionsFit string

The fit property describes how the width and height dimensions should be interpreted.

const (
	V1VariantEditResponseVariantOptionsFitScaleDown V1VariantEditResponseVariantOptionsFit = "scale-down"
	V1VariantEditResponseVariantOptionsFitContain   V1VariantEditResponseVariantOptionsFit = "contain"
	V1VariantEditResponseVariantOptionsFitCover     V1VariantEditResponseVariantOptionsFit = "cover"
	V1VariantEditResponseVariantOptionsFitCrop      V1VariantEditResponseVariantOptionsFit = "crop"
	V1VariantEditResponseVariantOptionsFitPad       V1VariantEditResponseVariantOptionsFit = "pad"
)

func (V1VariantEditResponseVariantOptionsFit) IsKnown

type V1VariantEditResponseVariantOptionsMetadata

type V1VariantEditResponseVariantOptionsMetadata string

What EXIF data should be preserved in the output image.

const (
	V1VariantEditResponseVariantOptionsMetadataKeep      V1VariantEditResponseVariantOptionsMetadata = "keep"
	V1VariantEditResponseVariantOptionsMetadataCopyright V1VariantEditResponseVariantOptionsMetadata = "copyright"
	V1VariantEditResponseVariantOptionsMetadataNone      V1VariantEditResponseVariantOptionsMetadata = "none"
)

func (V1VariantEditResponseVariantOptionsMetadata) IsKnown

type V1VariantGetParams

type V1VariantGetParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1VariantGetResponse

type V1VariantGetResponse struct {
	Variant V1VariantGetResponseVariant `json:"variant"`
	JSON    v1VariantGetResponseJSON    `json:"-"`
}

func (*V1VariantGetResponse) UnmarshalJSON

func (r *V1VariantGetResponse) UnmarshalJSON(data []byte) (err error)

type V1VariantGetResponseEnvelope

type V1VariantGetResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1VariantGetResponse  `json:"result,required"`
	// Whether the API call was successful
	Success V1VariantGetResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1VariantGetResponseEnvelopeJSON    `json:"-"`
}

func (*V1VariantGetResponseEnvelope) UnmarshalJSON

func (r *V1VariantGetResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1VariantGetResponseEnvelopeSuccess

type V1VariantGetResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1VariantGetResponseEnvelopeSuccessTrue V1VariantGetResponseEnvelopeSuccess = true
)

func (V1VariantGetResponseEnvelopeSuccess) IsKnown

type V1VariantGetResponseVariant

type V1VariantGetResponseVariant struct {
	ID string `json:"id,required"`
	// Allows you to define image resizing sizes for different use cases.
	Options V1VariantGetResponseVariantOptions `json:"options,required"`
	// Indicates whether the variant can access an image without a signature,
	// regardless of image access control.
	NeverRequireSignedURLs bool                            `json:"neverRequireSignedURLs"`
	JSON                   v1VariantGetResponseVariantJSON `json:"-"`
}

func (*V1VariantGetResponseVariant) UnmarshalJSON

func (r *V1VariantGetResponseVariant) UnmarshalJSON(data []byte) (err error)

type V1VariantGetResponseVariantOptions

type V1VariantGetResponseVariantOptions struct {
	// The fit property describes how the width and height dimensions should be
	// interpreted.
	Fit V1VariantGetResponseVariantOptionsFit `json:"fit,required"`
	// Maximum height in image pixels.
	Height float64 `json:"height,required"`
	// What EXIF data should be preserved in the output image.
	Metadata V1VariantGetResponseVariantOptionsMetadata `json:"metadata,required"`
	// Maximum width in image pixels.
	Width float64                                `json:"width,required"`
	JSON  v1VariantGetResponseVariantOptionsJSON `json:"-"`
}

Allows you to define image resizing sizes for different use cases.

func (*V1VariantGetResponseVariantOptions) UnmarshalJSON

func (r *V1VariantGetResponseVariantOptions) UnmarshalJSON(data []byte) (err error)

type V1VariantGetResponseVariantOptionsFit

type V1VariantGetResponseVariantOptionsFit string

The fit property describes how the width and height dimensions should be interpreted.

const (
	V1VariantGetResponseVariantOptionsFitScaleDown V1VariantGetResponseVariantOptionsFit = "scale-down"
	V1VariantGetResponseVariantOptionsFitContain   V1VariantGetResponseVariantOptionsFit = "contain"
	V1VariantGetResponseVariantOptionsFitCover     V1VariantGetResponseVariantOptionsFit = "cover"
	V1VariantGetResponseVariantOptionsFitCrop      V1VariantGetResponseVariantOptionsFit = "crop"
	V1VariantGetResponseVariantOptionsFitPad       V1VariantGetResponseVariantOptionsFit = "pad"
)

func (V1VariantGetResponseVariantOptionsFit) IsKnown

type V1VariantGetResponseVariantOptionsMetadata

type V1VariantGetResponseVariantOptionsMetadata string

What EXIF data should be preserved in the output image.

const (
	V1VariantGetResponseVariantOptionsMetadataKeep      V1VariantGetResponseVariantOptionsMetadata = "keep"
	V1VariantGetResponseVariantOptionsMetadataCopyright V1VariantGetResponseVariantOptionsMetadata = "copyright"
	V1VariantGetResponseVariantOptionsMetadataNone      V1VariantGetResponseVariantOptionsMetadata = "none"
)

func (V1VariantGetResponseVariantOptionsMetadata) IsKnown

type V1VariantListParams

type V1VariantListParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
}

type V1VariantListResponseEnvelope

type V1VariantListResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   Variant               `json:"result,required"`
	// Whether the API call was successful
	Success V1VariantListResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1VariantListResponseEnvelopeJSON    `json:"-"`
}

func (*V1VariantListResponseEnvelope) UnmarshalJSON

func (r *V1VariantListResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1VariantListResponseEnvelopeSuccess

type V1VariantListResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1VariantListResponseEnvelopeSuccessTrue V1VariantListResponseEnvelopeSuccess = true
)

func (V1VariantListResponseEnvelopeSuccess) IsKnown

type V1VariantNewParams

type V1VariantNewParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	ID        param.Field[string] `json:"id,required"`
	// Allows you to define image resizing sizes for different use cases.
	Options param.Field[V1VariantNewParamsOptions] `json:"options,required"`
	// Indicates whether the variant can access an image without a signature,
	// regardless of image access control.
	NeverRequireSignedURLs param.Field[bool] `json:"neverRequireSignedURLs"`
}

func (V1VariantNewParams) MarshalJSON

func (r V1VariantNewParams) MarshalJSON() (data []byte, err error)

type V1VariantNewParamsOptions

type V1VariantNewParamsOptions struct {
	// The fit property describes how the width and height dimensions should be
	// interpreted.
	Fit param.Field[V1VariantNewParamsOptionsFit] `json:"fit,required"`
	// Maximum height in image pixels.
	Height param.Field[float64] `json:"height,required"`
	// What EXIF data should be preserved in the output image.
	Metadata param.Field[V1VariantNewParamsOptionsMetadata] `json:"metadata,required"`
	// Maximum width in image pixels.
	Width param.Field[float64] `json:"width,required"`
}

Allows you to define image resizing sizes for different use cases.

func (V1VariantNewParamsOptions) MarshalJSON

func (r V1VariantNewParamsOptions) MarshalJSON() (data []byte, err error)

type V1VariantNewParamsOptionsFit

type V1VariantNewParamsOptionsFit string

The fit property describes how the width and height dimensions should be interpreted.

const (
	V1VariantNewParamsOptionsFitScaleDown V1VariantNewParamsOptionsFit = "scale-down"
	V1VariantNewParamsOptionsFitContain   V1VariantNewParamsOptionsFit = "contain"
	V1VariantNewParamsOptionsFitCover     V1VariantNewParamsOptionsFit = "cover"
	V1VariantNewParamsOptionsFitCrop      V1VariantNewParamsOptionsFit = "crop"
	V1VariantNewParamsOptionsFitPad       V1VariantNewParamsOptionsFit = "pad"
)

func (V1VariantNewParamsOptionsFit) IsKnown

func (r V1VariantNewParamsOptionsFit) IsKnown() bool

type V1VariantNewParamsOptionsMetadata

type V1VariantNewParamsOptionsMetadata string

What EXIF data should be preserved in the output image.

const (
	V1VariantNewParamsOptionsMetadataKeep      V1VariantNewParamsOptionsMetadata = "keep"
	V1VariantNewParamsOptionsMetadataCopyright V1VariantNewParamsOptionsMetadata = "copyright"
	V1VariantNewParamsOptionsMetadataNone      V1VariantNewParamsOptionsMetadata = "none"
)

func (V1VariantNewParamsOptionsMetadata) IsKnown

type V1VariantNewResponse

type V1VariantNewResponse struct {
	Variant V1VariantNewResponseVariant `json:"variant"`
	JSON    v1VariantNewResponseJSON    `json:"-"`
}

func (*V1VariantNewResponse) UnmarshalJSON

func (r *V1VariantNewResponse) UnmarshalJSON(data []byte) (err error)

type V1VariantNewResponseEnvelope

type V1VariantNewResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V1VariantNewResponse  `json:"result,required"`
	// Whether the API call was successful
	Success V1VariantNewResponseEnvelopeSuccess `json:"success,required"`
	JSON    v1VariantNewResponseEnvelopeJSON    `json:"-"`
}

func (*V1VariantNewResponseEnvelope) UnmarshalJSON

func (r *V1VariantNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V1VariantNewResponseEnvelopeSuccess

type V1VariantNewResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V1VariantNewResponseEnvelopeSuccessTrue V1VariantNewResponseEnvelopeSuccess = true
)

func (V1VariantNewResponseEnvelopeSuccess) IsKnown

type V1VariantNewResponseVariant

type V1VariantNewResponseVariant struct {
	ID string `json:"id,required"`
	// Allows you to define image resizing sizes for different use cases.
	Options V1VariantNewResponseVariantOptions `json:"options,required"`
	// Indicates whether the variant can access an image without a signature,
	// regardless of image access control.
	NeverRequireSignedURLs bool                            `json:"neverRequireSignedURLs"`
	JSON                   v1VariantNewResponseVariantJSON `json:"-"`
}

func (*V1VariantNewResponseVariant) UnmarshalJSON

func (r *V1VariantNewResponseVariant) UnmarshalJSON(data []byte) (err error)

type V1VariantNewResponseVariantOptions

type V1VariantNewResponseVariantOptions struct {
	// The fit property describes how the width and height dimensions should be
	// interpreted.
	Fit V1VariantNewResponseVariantOptionsFit `json:"fit,required"`
	// Maximum height in image pixels.
	Height float64 `json:"height,required"`
	// What EXIF data should be preserved in the output image.
	Metadata V1VariantNewResponseVariantOptionsMetadata `json:"metadata,required"`
	// Maximum width in image pixels.
	Width float64                                `json:"width,required"`
	JSON  v1VariantNewResponseVariantOptionsJSON `json:"-"`
}

Allows you to define image resizing sizes for different use cases.

func (*V1VariantNewResponseVariantOptions) UnmarshalJSON

func (r *V1VariantNewResponseVariantOptions) UnmarshalJSON(data []byte) (err error)

type V1VariantNewResponseVariantOptionsFit

type V1VariantNewResponseVariantOptionsFit string

The fit property describes how the width and height dimensions should be interpreted.

const (
	V1VariantNewResponseVariantOptionsFitScaleDown V1VariantNewResponseVariantOptionsFit = "scale-down"
	V1VariantNewResponseVariantOptionsFitContain   V1VariantNewResponseVariantOptionsFit = "contain"
	V1VariantNewResponseVariantOptionsFitCover     V1VariantNewResponseVariantOptionsFit = "cover"
	V1VariantNewResponseVariantOptionsFitCrop      V1VariantNewResponseVariantOptionsFit = "crop"
	V1VariantNewResponseVariantOptionsFitPad       V1VariantNewResponseVariantOptionsFit = "pad"
)

func (V1VariantNewResponseVariantOptionsFit) IsKnown

type V1VariantNewResponseVariantOptionsMetadata

type V1VariantNewResponseVariantOptionsMetadata string

What EXIF data should be preserved in the output image.

const (
	V1VariantNewResponseVariantOptionsMetadataKeep      V1VariantNewResponseVariantOptionsMetadata = "keep"
	V1VariantNewResponseVariantOptionsMetadataCopyright V1VariantNewResponseVariantOptionsMetadata = "copyright"
	V1VariantNewResponseVariantOptionsMetadataNone      V1VariantNewResponseVariantOptionsMetadata = "none"
)

func (V1VariantNewResponseVariantOptionsMetadata) IsKnown

type V1VariantService

type V1VariantService struct {
	Options []option.RequestOption
}

V1VariantService 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 NewV1VariantService method instead.

func NewV1VariantService

func NewV1VariantService(opts ...option.RequestOption) (r *V1VariantService)

NewV1VariantService 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 (*V1VariantService) Delete

Deleting a variant purges the cache for all images associated with the variant.

func (*V1VariantService) Edit

func (r *V1VariantService) Edit(ctx context.Context, variantID string, params V1VariantEditParams, opts ...option.RequestOption) (res *V1VariantEditResponse, err error)

Updating a variant purges the cache for all images associated with the variant.

func (*V1VariantService) Get

func (r *V1VariantService) Get(ctx context.Context, variantID string, query V1VariantGetParams, opts ...option.RequestOption) (res *V1VariantGetResponse, err error)

Fetch details for a single variant.

func (*V1VariantService) List

func (r *V1VariantService) List(ctx context.Context, query V1VariantListParams, opts ...option.RequestOption) (res *Variant, err error)

Lists existing variants.

func (*V1VariantService) New

Specify variants that allow you to resize images for different use cases.

type V2DirectUploadNewParams

type V2DirectUploadNewParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	// Optional Image Custom ID. Up to 1024 chars. Can include any number of subpaths,
	// and utf8 characters. Cannot start nor end with a / (forward slash). Cannot be a
	// UUID.
	ID param.Field[string] `json:"id"`
	// The date after which the upload will not be accepted. Minimum: Now + 2 minutes.
	// Maximum: Now + 6 hours.
	Expiry param.Field[time.Time] `json:"expiry" format:"date-time"`
	// User modifiable key-value store. Can be used for keeping references to another
	// system of record, for managing images.
	Metadata param.Field[interface{}] `json:"metadata"`
	// Indicates whether the image requires a signature token to be accessed.
	RequireSignedURLs param.Field[bool] `json:"requireSignedURLs"`
}

func (V2DirectUploadNewParams) MarshalJSON

func (r V2DirectUploadNewParams) MarshalJSON() (data []byte, err error)

type V2DirectUploadNewResponse

type V2DirectUploadNewResponse struct {
	// Image unique identifier.
	ID string `json:"id"`
	// The URL the unauthenticated upload can be performed to using a single HTTP POST
	// (multipart/form-data) request.
	UploadURL string                        `json:"uploadURL"`
	JSON      v2DirectUploadNewResponseJSON `json:"-"`
}

func (*V2DirectUploadNewResponse) UnmarshalJSON

func (r *V2DirectUploadNewResponse) UnmarshalJSON(data []byte) (err error)

type V2DirectUploadNewResponseEnvelope

type V2DirectUploadNewResponseEnvelope struct {
	Errors   []shared.ResponseInfo     `json:"errors,required"`
	Messages []shared.ResponseInfo     `json:"messages,required"`
	Result   V2DirectUploadNewResponse `json:"result,required"`
	// Whether the API call was successful
	Success V2DirectUploadNewResponseEnvelopeSuccess `json:"success,required"`
	JSON    v2DirectUploadNewResponseEnvelopeJSON    `json:"-"`
}

func (*V2DirectUploadNewResponseEnvelope) UnmarshalJSON

func (r *V2DirectUploadNewResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V2DirectUploadNewResponseEnvelopeSuccess

type V2DirectUploadNewResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V2DirectUploadNewResponseEnvelopeSuccessTrue V2DirectUploadNewResponseEnvelopeSuccess = true
)

func (V2DirectUploadNewResponseEnvelopeSuccess) IsKnown

type V2DirectUploadService

type V2DirectUploadService struct {
	Options []option.RequestOption
}

V2DirectUploadService 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 NewV2DirectUploadService method instead.

func NewV2DirectUploadService

func NewV2DirectUploadService(opts ...option.RequestOption) (r *V2DirectUploadService)

NewV2DirectUploadService 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 (*V2DirectUploadService) New

Direct uploads allow users to upload images without API keys. A common use case are web apps, client-side applications, or mobile devices where users upload content directly to Cloudflare Images. This method creates a draft record for a future image. It returns an upload URL and an image identifier. To verify if the image itself has been uploaded, send an image details request (accounts/:account_identifier/images/v1/:identifier), and check that the `draft: true` property is not present.

type V2ListParams

type V2ListParams struct {
	// Account identifier tag.
	AccountID param.Field[string] `path:"account_id,required"`
	// Continuation token for a next page. List images V2 returns continuation_token
	ContinuationToken param.Field[string] `query:"continuation_token"`
	// Number of items per page.
	PerPage param.Field[float64] `query:"per_page"`
	// Sorting order by upload time.
	SortOrder param.Field[V2ListParamsSortOrder] `query:"sort_order"`
}

func (V2ListParams) URLQuery

func (r V2ListParams) URLQuery() (v url.Values)

URLQuery serializes V2ListParams's query parameters as `url.Values`.

type V2ListParamsSortOrder

type V2ListParamsSortOrder string

Sorting order by upload time.

const (
	V2ListParamsSortOrderAsc  V2ListParamsSortOrder = "asc"
	V2ListParamsSortOrderDesc V2ListParamsSortOrder = "desc"
)

func (V2ListParamsSortOrder) IsKnown

func (r V2ListParamsSortOrder) IsKnown() bool

type V2ListResponse

type V2ListResponse struct {
	// Continuation token to fetch next page. Passed as a query param when requesting
	// List V2 api endpoint.
	ContinuationToken string             `json:"continuation_token,nullable"`
	Images            []Image            `json:"images"`
	JSON              v2ListResponseJSON `json:"-"`
}

func (*V2ListResponse) UnmarshalJSON

func (r *V2ListResponse) UnmarshalJSON(data []byte) (err error)

type V2ListResponseEnvelope

type V2ListResponseEnvelope struct {
	Errors   []shared.ResponseInfo `json:"errors,required"`
	Messages []shared.ResponseInfo `json:"messages,required"`
	Result   V2ListResponse        `json:"result,required"`
	// Whether the API call was successful
	Success V2ListResponseEnvelopeSuccess `json:"success,required"`
	JSON    v2ListResponseEnvelopeJSON    `json:"-"`
}

func (*V2ListResponseEnvelope) UnmarshalJSON

func (r *V2ListResponseEnvelope) UnmarshalJSON(data []byte) (err error)

type V2ListResponseEnvelopeSuccess

type V2ListResponseEnvelopeSuccess bool

Whether the API call was successful

const (
	V2ListResponseEnvelopeSuccessTrue V2ListResponseEnvelopeSuccess = true
)

func (V2ListResponseEnvelopeSuccess) IsKnown

func (r V2ListResponseEnvelopeSuccess) IsKnown() bool

type V2Service

type V2Service struct {
	Options       []option.RequestOption
	DirectUploads *V2DirectUploadService
}

V2Service 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 NewV2Service method instead.

func NewV2Service

func NewV2Service(opts ...option.RequestOption) (r *V2Service)

NewV2Service 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 (*V2Service) List

func (r *V2Service) List(ctx context.Context, params V2ListParams, opts ...option.RequestOption) (res *V2ListResponse, err error)

List up to 10000 images with one request. Use the optional parameters below to get a specific range of images. Endpoint returns continuation_token if more images are present.

type Variant

type Variant struct {
	Variants VariantVariants `json:"variants"`
	JSON     variantJSON     `json:"-"`
}

func (*Variant) UnmarshalJSON

func (r *Variant) UnmarshalJSON(data []byte) (err error)

type VariantVariants

type VariantVariants struct {
	Hero VariantVariantsHero `json:"hero"`
	JSON variantVariantsJSON `json:"-"`
}

func (*VariantVariants) UnmarshalJSON

func (r *VariantVariants) UnmarshalJSON(data []byte) (err error)

type VariantVariantsHero

type VariantVariantsHero struct {
	ID string `json:"id,required"`
	// Allows you to define image resizing sizes for different use cases.
	Options VariantVariantsHeroOptions `json:"options,required"`
	// Indicates whether the variant can access an image without a signature,
	// regardless of image access control.
	NeverRequireSignedURLs bool                    `json:"neverRequireSignedURLs"`
	JSON                   variantVariantsHeroJSON `json:"-"`
}

func (*VariantVariantsHero) UnmarshalJSON

func (r *VariantVariantsHero) UnmarshalJSON(data []byte) (err error)

type VariantVariantsHeroOptions

type VariantVariantsHeroOptions struct {
	// The fit property describes how the width and height dimensions should be
	// interpreted.
	Fit VariantVariantsHeroOptionsFit `json:"fit,required"`
	// Maximum height in image pixels.
	Height float64 `json:"height,required"`
	// What EXIF data should be preserved in the output image.
	Metadata VariantVariantsHeroOptionsMetadata `json:"metadata,required"`
	// Maximum width in image pixels.
	Width float64                        `json:"width,required"`
	JSON  variantVariantsHeroOptionsJSON `json:"-"`
}

Allows you to define image resizing sizes for different use cases.

func (*VariantVariantsHeroOptions) UnmarshalJSON

func (r *VariantVariantsHeroOptions) UnmarshalJSON(data []byte) (err error)

type VariantVariantsHeroOptionsFit

type VariantVariantsHeroOptionsFit string

The fit property describes how the width and height dimensions should be interpreted.

const (
	VariantVariantsHeroOptionsFitScaleDown VariantVariantsHeroOptionsFit = "scale-down"
	VariantVariantsHeroOptionsFitContain   VariantVariantsHeroOptionsFit = "contain"
	VariantVariantsHeroOptionsFitCover     VariantVariantsHeroOptionsFit = "cover"
	VariantVariantsHeroOptionsFitCrop      VariantVariantsHeroOptionsFit = "crop"
	VariantVariantsHeroOptionsFitPad       VariantVariantsHeroOptionsFit = "pad"
)

func (VariantVariantsHeroOptionsFit) IsKnown

func (r VariantVariantsHeroOptionsFit) IsKnown() bool

type VariantVariantsHeroOptionsMetadata

type VariantVariantsHeroOptionsMetadata string

What EXIF data should be preserved in the output image.

const (
	VariantVariantsHeroOptionsMetadataKeep      VariantVariantsHeroOptionsMetadata = "keep"
	VariantVariantsHeroOptionsMetadataCopyright VariantVariantsHeroOptionsMetadata = "copyright"
	VariantVariantsHeroOptionsMetadataNone      VariantVariantsHeroOptionsMetadata = "none"
)

func (VariantVariantsHeroOptionsMetadata) IsKnown

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL