EndpointSpec

Trait EndpointSpec 

Source
pub trait EndpointSpec {
    type JsonResponse: ApiResult;
    type ResponseType;

    const IS_RAW_BODY: bool = false;

    // Required methods
    fn method(&self) -> Method;
    fn path(&self) -> String;

    // Provided methods
    fn query(&self) -> Option<String> { ... }
    fn body(&self) -> Option<RequestBody<'_>> { ... }
    fn url(&self, environment: &Environment) -> Url { ... }
    fn content_type(&self) -> Option<Cow<'static, str>> { ... }
}
Expand description

Represents a specification for an API call that can be built into an HTTP request and sent. New endpoints should implement this trait.

If the request succeeds, the call will resolve to a ResultType.

Provided Associated Constants§

Source

const IS_RAW_BODY: bool = false

If the body of the response is raw bytes (Vec), set this to true. Defaults to false.

Required Associated Types§

Source

type JsonResponse: ApiResult

The JSON response type for this endpoint, if any.

For endpoints that return either raw bytes or nothing, this should be ().

Source

type ResponseType

The final response type for this endpoint.

For endpoints that return raw bytes, this should be Vec<u8>.

For endpoints that return JSON, this should be ApiSuccess<Self::JsonResponse>.

Required Methods§

Source

fn method(&self) -> Method

The HTTP Method used for this endpoint (e.g. GET, PATCH, DELETE)

Source

fn path(&self) -> String

The relative URL path for this endpoint

Provided Methods§

Source

fn query(&self) -> Option<String>

The url-encoded query string associated with this endpoint. Defaults to None.

Implementors should inline this.

Source

fn body(&self) -> Option<RequestBody<'_>>

The HTTP body associated with this endpoint. If not implemented, defaults to None.

Implementors should inline this.

Source

fn url(&self, environment: &Environment) -> Url

Builds and returns a formatted full URL, including query, for the endpoint.

Implementors should generally not override this.

Source

fn content_type(&self) -> Option<Cow<'static, str>>

If body is populated, indicates the body MIME type (defaults to JSON).

Implementors generally do not need to override this.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl EndpointSpec for ListAccounts

Source§

impl EndpointSpec for GetUserDetails

Source§

impl EndpointSpec for GetUserTokenStatus

Source§

impl EndpointSpec for ExecuteModel<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::argo_tunnel::create_tunnel::CreateTunnel<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::argo_tunnel::delete_tunnel::DeleteTunnel<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::argo_tunnel::list_tunnels::ListTunnels<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::argo_tunnel::route_dns::RouteTunnel<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::cfd_tunnel::create_tunnel::CreateTunnel<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::cfd_tunnel::delete_tunnel::DeleteTunnel<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::cfd_tunnel::list_tunnels::ListTunnels<'_>

Source§

impl EndpointSpec for cloudflare::endpoints::cfd_tunnel::route_dns::RouteTunnel<'_>

Source§

impl EndpointSpec for UpdateTunnel<'_>

Source§

impl EndpointSpec for CreateDnsRecord<'_>

Source§

impl EndpointSpec for DeleteDnsRecord<'_>

Source§

impl EndpointSpec for ListDnsRecords<'_>

Source§

impl EndpointSpec for UpdateDnsRecord<'_>

Source§

impl EndpointSpec for CreateLoadBalancer<'_>

Source§

impl EndpointSpec for CreatePool<'_>

Source§

impl EndpointSpec for DeleteLoadBalancer<'_>

Source§

impl EndpointSpec for DeletePool<'_>

Source§

impl EndpointSpec for ListLoadBalancers<'_>

Source§

impl EndpointSpec for PoolDetails<'_>

Source§

impl EndpointSpec for CreateBucket<'_>

Source§

impl EndpointSpec for DeleteBucket<'_>

Source§

impl EndpointSpec for ListBuckets<'_>

Source§

impl EndpointSpec for CreateRoute<'_>

Source§

impl EndpointSpec for CreateSecret<'_>

Source§

impl EndpointSpec for CreateTail<'_>

Source§

impl EndpointSpec for DeleteDurableObject<'_>

Source§

impl EndpointSpec for DeleteRoute<'_>

Source§

impl EndpointSpec for DeleteScript<'_>

Source§

impl EndpointSpec for DeleteSecret<'_>

Source§

impl EndpointSpec for DeleteTail<'_>

Source§

impl EndpointSpec for ListBindings<'_>

Source§

impl EndpointSpec for ListRoutes<'_>

Source§

impl EndpointSpec for ListSecrets<'_>

Source§

impl EndpointSpec for ListTails<'_>

Source§

impl EndpointSpec for SendTailHeartbeat<'_>

Source§

impl EndpointSpec for CreateNamespace<'_>

Source§

impl EndpointSpec for DeleteBulk<'_>

Source§

impl EndpointSpec for DeleteKey<'_>

Source§

impl EndpointSpec for GetNamespace<'_>

Source§

impl EndpointSpec for ListNamespaceKeys<'_>

Source§

impl EndpointSpec for ListNamespaces<'_>

Source§

impl EndpointSpec for ReadKey<'_>

Source§

impl EndpointSpec for ReadKeyMetadata<'_>

Source§

impl EndpointSpec for RemoveNamespace<'_>

Source§

impl EndpointSpec for RenameNamespace<'_>

Source§

impl EndpointSpec for WriteBulk<'_>

Source§

impl EndpointSpec for WriteKey<'_>

Source§

impl EndpointSpec for CreateZone<'_>

Source§

impl EndpointSpec for ListZones

Source§

impl EndpointSpec for ZoneDetails<'_>