1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
// Copyright 2022 Rigetti Computing
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! This crate provides an autogenerated gRPC client for the QCS API, along with helper utilities for automatically loading
//! credentials from a user's QCS config and keeping authentication tokens refreshed.
//!
//! - [`get_channel`]: create a [`Channel`](tonic::transport::Channel) to the given gRPC endpoint with QCS authentication automatically set up.
//! - [`wrap_channel`]: wrap an existing [`Channel`](tonic::transport::Channel) with QCS authentication.
//!
//! ## Quick Start
//!
//! ```rust
//! use qcs_api_client_grpc::get_channel;
//! use qcs_api_client_grpc::services::controller::controller_client::ControllerClient;
//! use qcs_api_client_grpc::services::translation::translation_client::TranslationClient;
//!
//! async fn controller_request() {
//! let uri = "example.per-qpu.rigetti.com:50000".parse().unwrap();
//! let channel = get_channel(uri);
//! let mut client = ControllerClient::new(channel);
//! // Use the client
//! }
//!
//! fn translation_request() {
//! let uri = "example.translation.rigetti.com:50000".parse().unwrap();
//! let channel = get_channel(uri);
//! let mut client = TranslationClient::new(channel);
//! // Use the client
//! }
//! ```
//!
//! # Crate features
//!
//! * `server`: include the generated server code for both Controller Service
//! and Translation Service
//! * `regen`: regenerate the protobuf code and store it in `./src/gen`
//!
//! By default, both features are disabled.
/// This module contains helper code for wrapping a [`Channel`](tonic::transport::Channel) so that QCS credentials are
/// automatically used and refreshed as necessary.
///
/// Most users will want to use [`get_channel`], [`get_wrapped_channel`], or [`wrap_channel`].
pub mod channel;
pub use channel::{get_channel, get_wrapped_channel, wrap_channel};
pub use qcs_api_client_common::configuration as client_configuration;
#[allow(clippy::derive_partial_eq_without_eq)]
pub mod models {
pub mod controller {
include!("gen/models.controller.rs");
include!("gen/models.controller.serde.rs");
}
pub mod translation {
include!("gen/models.translation.rs");
include!("gen/models.translation.serde.rs");
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
pub mod services {
pub mod controller {
include!("gen/services.controller.rs");
include!("gen/services.controller.serde.rs");
}
pub mod translation {
include!("gen/services.translation.rs");
include!("gen/services.translation.serde.rs");
}
}