Skip to main content

Crate cirrus_metadata

Crate cirrus_metadata 

Source
Expand description

§cirrus-metadata

A Rust client for the Salesforce Metadata API (SOAP). Built on top of cirrus_auth for credentials, so any AuthSession configured for the REST client (cirrus) works here too.

Covered surface: the file-based deploy/retrieve flow, synchronous CRUD (createMetadata / readMetadata / updateMetadata / upsertMetadata / deleteMetadata / renameMetadata), the utility surface (listMetadata / describeMetadata / describeValueType), and a typed PackageManifest builder.

§Why SOAP?

The Metadata API’s REST surface only covers four deployRequest endpoints. Everything else — retrieve, listMetadata, describeMetadata, createMetadata, readMetadata, etc. — is SOAP-only. SOAP is not deprecated; it’s the canonical surface.

§Design principles

  • No user-facing types. The 200+ concrete metadata types (CustomObject, ApexClass, …) are caller-supplied XML or serde_json::Value. Only platform-contract envelopes are typed.
  • No legacy surface. Operations Salesforce labels deprecated (create(), update(), delete() pre-API-31) are not exposed.
  • Auth is pluggable. Any cirrus_auth::AuthSession works.
  • Same credentials as cirrus. Both crates wrap the same AuthSession trait; one SharedAuth drives both clients.

§Quick start

use cirrus_metadata::{MetadataClient, auth::StaticTokenAuth};
use std::sync::Arc;

let auth = Arc::new(StaticTokenAuth::new(
    "00D...!AQ...",
    "https://my-org.my.salesforce.com",
));

let md = MetadataClient::builder()
    .auth(auth)
    .build()?;

Re-exports§

pub use handlers::file_based::WaitConfig;
pub use result::AsyncRequestState;
pub use result::AsyncResult;
pub use result::CancelDeployResult;
pub use result::CodeCoverageResult;
pub use result::CodeCoverageWarning;
pub use result::DeleteResult;
pub use result::DeployDetails;
pub use result::DeployMessage;
pub use result::DeployOptions;
pub use result::DeployProblemType;
pub use result::DeployResult;
pub use result::DeployStatus;
pub use result::DescribeMetadataObject;
pub use result::DescribeMetadataResult;
pub use result::DescribeValueTypeResult;
pub use result::FileProperties;
pub use result::ListMetadataQuery;
pub use result::ManageableState;
pub use result::MetadataApiError;
pub use result::PicklistEntry;
pub use result::RetrieveMessage;
pub use result::RetrieveRequest;
pub use result::RetrieveResult;
pub use result::RetrieveStatus;
pub use result::RunTestFailure;
pub use result::RunTestSuccess;
pub use result::RunTestsResult;
pub use result::SaveResult;
pub use result::TestLevel;
pub use result::UpsertResult;
pub use result::ValueTypeField;
pub use retry::RetryPolicy;
pub use cirrus_auth as auth;

Modules§

handlers
Typed handlers for Metadata API operations.
result
Typed wire envelopes for the file-based Metadata API operations.
retry
Retry policy and backoff machinery for transient HTTP failures.

Structs§

MetadataClient
The Metadata API client.
MetadataClientBuilder
Builder for MetadataClient.
MetadataType
Identifier for a metadata type — the xml_name value that goes in <types><name> and as the SOAP type parameter.
PackageManifest
Builder for package.xml and the SOAP unpackaged retrieve parameter.
SoapFault
A parsed SOAP 1.1 <Fault> element.

Enums§

AuthError
Errors produced while acquiring or refreshing a Salesforce OAuth session.
MetadataError
Errors produced by the cirrus-metadata client.

Constants§

DEFAULT_API_VERSION
Default Metadata API version when the caller doesn’t override it.

Traits§

AuthSession
Abstraction over a Salesforce authentication session.
SoapOperation
A typed SOAP operation against the Metadata API.

Type Aliases§

MetadataResult
Specialized Result type for cirrus-metadata operations.
SharedAuth
Arc<dyn AuthSession> — the shape stored inside the client.