spiral-sdk 0.1.7

Rust SDK for Spiral resource and table APIs
Documentation
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Transport-independent service interface for local and remote calls."]

use async_trait::async_trait;
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::CallError;

use crate::api::catalog::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait CatalogApi: Send + Sync + 'static {
    /// Compare a base and a head commit. The response contains the exact number of commits that
    /// each side has and the other does not, and a bounded part of the graph that only the head
    /// has. When the comparison is larger than the traversal limits, the response is
    /// `CommitTraversalLimitExceeded`. You must have permission to read the project.
    async fn compare_commits(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: CompareCommitsRequest,
    ) -> Result<CompareCommitsResponse, CallError<CatalogError>>;
    /// Create a branch at the commit that the target selector identifies. The selector is resolved
    /// one time. To retry, send the same request with the same idempotency key. You must have
    /// permission to create branches.
    async fn create_branch(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: CreateBranchRequest,
    ) -> Result<Branch, CallError<CatalogError>>;
    /// Create an immutable tag at the commit that the target selector identifies. You cannot move
    /// or delete a tag. You must have permission to create tags.
    async fn create_tag(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: CreateTagRequest,
    ) -> Result<Tag, CallError<CatalogError>>;
    /// Mark a branch as deleted and return the deleted branch. The commits and the event history of
    /// the branch stay available. The service validates if you can delete the main branch. You must
    /// have permission to delete branches.
    async fn delete_branch(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        branch_id: BranchId,
        request: DeleteBranchRequest,
    ) -> Result<Branch, CallError<CatalogError>>;
    /// Return all net changes to resources and namespace bindings between two commits. The response
    /// is complete. It is not paged or truncated. When the result is too large, the response is
    /// `CatalogLimitExceeded`. You must have permission to read the project.
    async fn diff_state(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: DiffStateRequest,
    ) -> Result<DiffStateResponse, CallError<CatalogError>>;
    /// Prepare the Catalog of a project and return its main branch. You can send this request more
    /// than once. When the Catalog exists, the response contains the current main branch. You must
    /// have permission to initialize the project.
    async fn initialize(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
    ) -> Result<Branch, CallError<CatalogError>>;
    /// List the live branches of the project. To include deleted branches, set `includeDeleted`.
    /// Branches are in order of name and identity. When branches change during a listing, a branch
    /// can be skipped or repeated. Each page token keeps `includeDeleted` and the scope of the
    /// first request. You must have permission to list branches.
    async fn list_branches(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ListBranchesRequest,
    ) -> Result<ListBranchesResponse, CallError<CatalogError>>;
    /// List the bindings in a namespace scope at one immutable commit. Each page token keeps the
    /// scope and the commit of the first request. To read a newer commit, start a new listing. You
    /// must have permission to read the project state.
    async fn list_namespace(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        commit_id: CommitId,
        request: ListNamespaceRequest,
    ) -> Result<NamespacePage, CallError<CatalogError>>;
    /// List the live tags of the project in order of name. When a tag is created during a listing
    /// at a name before the current page, the listing does not include it. You must have permission
    /// to list tags.
    async fn list_tags(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ListTagsRequest,
    ) -> Result<ListTagsResponse, CallError<CatalogError>>;
    /// Do a three-way merge, or examine a merge before you do it. When `dryRun` is true, the merge
    /// is not published. Conflicts are part of the response. You must have permission to merge in
    /// the project and to change each resource that the merge changes.
    async fn merge(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: MergeRequest,
    ) -> Result<MergeResponse, CallError<CatalogError>>;
    /// Return all best common ancestors of two commits. When the history has more than one best
    /// common ancestor, the response contains all of them. An empty list means that the histories
    /// are not related. You must have permission to read the project.
    async fn merge_bases(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: MergeBasesRequest,
    ) -> Result<MergeBasesResponse, CallError<CatalogError>>;
    /// Publish a set of resource and namespace changes as one atomic commit. When an expected
    /// version or binding does not agree with the current state, nothing is published and the
    /// response contains the conflicts. A request that contains only assertions records a commit
    /// but does not change the project state. You must have permission to publish to the project
    /// and to change each resource.
    async fn publish(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: PublishRequest,
    ) -> Result<PublishResponse, CallError<CatalogError>>;
    /// Publish changes and save an operation receipt in one atomic step. When a receipt already
    /// exists for the same project operation and input, the response contains that receipt. The
    /// saved receipt applies to all later requests, from all callers. Each request is authenticated
    /// and authorized again. You must have permission to publish to the project and to change each
    /// resource.
    async fn publish_operation(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: PublishOperationRequest,
    ) -> Result<PublishOperationResponse, CallError<CatalogError>>;
    /// Read a live branch by its name. The response contains the current head commit of the branch.
    /// Use this commit identity with the operations that read one commit. You must have permission
    /// to read the project.
    async fn read_branch(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ReadBranchRequest,
    ) -> Result<Branch, CallError<CatalogError>>;
    /// Read one immutable branch event. You must have permission to read the branch history of the
    /// project.
    async fn read_branch_event(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        event_id: BranchEventId,
    ) -> Result<BranchEvent, CallError<CatalogError>>;
    /// List the events of one branch, newest first. This operation also works for a deleted branch.
    /// The first page sets the newest event of the listing. You must have permission to read the
    /// branch history of the project.
    async fn read_branch_events(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        branch_id: BranchId,
        request: ReadRefEventsRequest,
    ) -> Result<BranchEventPage, CallError<CatalogError>>;
    /// Read one immutable commit. You must have permission to read the commits of the project.
    async fn read_commit(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        commit_id: CommitId,
    ) -> Result<Commit, CallError<CatalogError>>;
    /// Read a part of the commit graph, starting from the commits in `starts`. You must supply
    /// `starts`. To start from branch heads, list the branches first. To read more of the graph,
    /// send `continuationCommitIds` from the response as `starts` in a new request, with the same
    /// exclusions. The next response can contain commits that you already have; ignore them. A
    /// response contains at most 1000 commits. You must have permission to read the commit log of
    /// the project.
    async fn read_commit_log(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ReadCommitLogRequest,
    ) -> Result<CommitLog, CallError<CatalogError>>;
    /// Read a saved operation receipt. A receipt can contain sensitive project data. An operation
    /// identity does not give access to the receipt. You must have permission to publish to the
    /// project.
    async fn read_operation(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        operation_id: OperationId,
    ) -> Result<ReadOperationResponse, CallError<CatalogError>>;
    /// List the branch events of all branches in the project, in descending order of
    /// `branchEventId`. Event timestamps do not set the order, and identity order is not commit
    /// order. This is a live listing: new events with an identity below the current page can appear
    /// in later pages. Events above the current page do not appear again. You must have permission
    /// to read the branch history of the project.
    async fn read_ref_events(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ReadRefEventsRequest,
    ) -> Result<RefEventPage, CallError<CatalogError>>;
    /// Read the identity and version of a resource at one immutable commit. When the commit does
    /// not exist, the response is `CommitNotFound`. When the resource is not live at the commit,
    /// the response is `ResourceNotFound`. You must have permission to read the project state.
    async fn read_resource(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        commit_id: CommitId,
        resource_id: ResourceId,
    ) -> Result<ResourceState, CallError<CatalogError>>;
    /// Read the resources and namespace bindings of the project at one immutable commit, one page
    /// at a time. You must have permission to read the project state.
    async fn read_state(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        commit_id: CommitId,
        request: ReadStateRequest,
    ) -> Result<StatePage, CallError<CatalogError>>;
    /// Read one immutable tag by its name. Send the name as a query parameter. A name can contain
    /// slashes. You must have permission to read the project.
    async fn read_tag(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ReadTagRequest,
    ) -> Result<Tag, CallError<CatalogError>>;
    /// Find the result of a publication when you do not know if it completed. Send the transaction
    /// identity of the publication. The search uses the project and the authenticated caller. When
    /// the response has no publication, the publication can still complete later. Thus, when you
    /// retry, use the same transaction identity and idempotency key. You must have permission to
    /// recover publications in the project.
    async fn recover_publication(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: RecoverPublicationRequest,
    ) -> Result<RecoverPublicationResponse, CallError<CatalogError>>;
    /// Change the name of a live branch. The branch keeps its identity and its head commit. The
    /// rename adds an event to the branch history. You must have permission to rename branches.
    async fn rename_branch(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        branch_id: BranchId,
        request: RenameBranchRequest,
    ) -> Result<Branch, CallError<CatalogError>>;
    /// Resolve a commit, branch, or tag selector to one commit. The selector is resolved one time.
    /// Relative expressions such as `main~3` are not supported. You must have permission to read
    /// the project.
    async fn resolve_commit(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: ResolveCommitRequest,
    ) -> Result<ResolveCommitResponse, CallError<CatalogError>>;
    /// Find the resource that a namespace path refers to at one immutable commit. When no resource
    /// has the path, the response has no resource. You must have permission to read the project
    /// state.
    async fn resolve_path(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        commit_id: CommitId,
        request: ResolvePathRequest,
    ) -> Result<ResolvePathResponse, CallError<CatalogError>>;
    /// Resolve a batch of namespace paths at one immutable commit. The response has one result for
    /// each path in the request. A request can have at most 1000 paths. You must have permission to
    /// read the project state.
    async fn resolve_paths(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        commit_id: CommitId,
        request: ResolvePathsRequest,
    ) -> Result<ResolvePathsResponse, CallError<CatalogError>>;
    /// Publish a commit that reverses the changes of a commit, or examine the revert before you do
    /// it. To revert a merge commit, you must supply `mainlineParent`. The value 1 selects the
    /// first parent. When `dryRun` is true, the revert is not published. Conflicts are part of the
    /// response. You must have permission to revert in the project and to change each resource that
    /// the revert changes.
    async fn revert(
        &self,
        auth_header: AuthHeader,
        project_id: ProjectId,
        request: RevertRequest,
    ) -> Result<RevertResponse, CallError<CatalogError>>;
}