#![recursion_limit = "100000000"]
#![allow(bare_trait_objects)]
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, unused_crate_dependencies, clippy::all)]
pub use self::errors::*;
pub use self::types::*;
pub mod types;
#[doc(hidden)]
pub mod dependencies {
pub use common as common;
}
pub mod services {
pub mod graph_service {
#[derive(Clone, Debug)]
pub enum AuthenticateExn {
#[doc(hidden)]
Success(crate::types::AuthResponse),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<crate::errors::graph_service::AuthenticateError> for AuthenticateExn {
fn from(err: crate::errors::graph_service::AuthenticateError) -> Self {
match err {
crate::errors::graph_service::AuthenticateError::ApplicationException(aexn) => AuthenticateExn::ApplicationException(aexn),
crate::errors::graph_service::AuthenticateError::ThriftError(err) => AuthenticateExn::ApplicationException(::fbthrift::ApplicationException {
message: err.to_string(),
type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
}),
}
}
}
impl ::std::convert::From<::fbthrift::ApplicationException> for AuthenticateExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
Self::ApplicationException(exn)
}
}
impl ::fbthrift::ExceptionInfo for AuthenticateExn {
fn exn_name(&self) -> &'static str {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
Self::ApplicationException(aexn) => aexn.exn_name(),
}
}
fn exn_value(&self) -> String {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
Self::ApplicationException(aexn) => aexn.exn_value(),
}
}
fn exn_is_declared(&self) -> bool {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
Self::ApplicationException(aexn) => aexn.exn_is_declared(),
}
}
}
impl ::fbthrift::ResultInfo for AuthenticateExn {
fn result_type(&self) -> ::fbthrift::ResultType {
match self {
Self::Success(_) => ::fbthrift::ResultType::Return,
Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
}
}
}
impl ::fbthrift::GetTType for AuthenticateExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for AuthenticateExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
if let Self::ApplicationException(aexn) = self {
return aexn.write(p);
}
p.write_struct_begin("Authenticate");
match self {
Self::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
Self::ApplicationException(_aexn) => unreachable!(),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for AuthenticateExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"AuthenticateExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "AuthenticateExn"),
)
.into(),
)
}
}
#[derive(Clone, Debug)]
pub enum SignoutExn {
#[doc(hidden)]
Success(()),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<crate::errors::graph_service::SignoutError> for SignoutExn {
fn from(err: crate::errors::graph_service::SignoutError) -> Self {
match err {
crate::errors::graph_service::SignoutError::ApplicationException(aexn) => SignoutExn::ApplicationException(aexn),
crate::errors::graph_service::SignoutError::ThriftError(err) => SignoutExn::ApplicationException(::fbthrift::ApplicationException {
message: err.to_string(),
type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
}),
}
}
}
impl ::std::convert::From<::fbthrift::ApplicationException> for SignoutExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
Self::ApplicationException(exn)
}
}
impl ::fbthrift::ExceptionInfo for SignoutExn {
fn exn_name(&self) -> &'static str {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
Self::ApplicationException(aexn) => aexn.exn_name(),
}
}
fn exn_value(&self) -> String {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
Self::ApplicationException(aexn) => aexn.exn_value(),
}
}
fn exn_is_declared(&self) -> bool {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
Self::ApplicationException(aexn) => aexn.exn_is_declared(),
}
}
}
impl ::fbthrift::ResultInfo for SignoutExn {
fn result_type(&self) -> ::fbthrift::ResultType {
match self {
Self::Success(_) => ::fbthrift::ResultType::Return,
Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
}
}
}
impl ::fbthrift::GetTType for SignoutExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for SignoutExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
if let Self::ApplicationException(aexn) = self {
return aexn.write(p);
}
p.write_struct_begin("Signout");
match self {
Self::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Void,
0i16,
);
inner.write(p);
p.write_field_end();
}
Self::ApplicationException(_aexn) => unreachable!(),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for SignoutExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = Self::Success(());
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Void, 0i32), false) => {
once = true;
alt = Self::Success(::fbthrift::Deserialize::read(p)?);
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"SignoutExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(alt)
}
}
#[derive(Clone, Debug)]
pub enum ExecuteExn {
#[doc(hidden)]
Success(crate::types::ExecutionResponse),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<crate::errors::graph_service::ExecuteError> for ExecuteExn {
fn from(err: crate::errors::graph_service::ExecuteError) -> Self {
match err {
crate::errors::graph_service::ExecuteError::ApplicationException(aexn) => ExecuteExn::ApplicationException(aexn),
crate::errors::graph_service::ExecuteError::ThriftError(err) => ExecuteExn::ApplicationException(::fbthrift::ApplicationException {
message: err.to_string(),
type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
}),
}
}
}
impl ::std::convert::From<::fbthrift::ApplicationException> for ExecuteExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
Self::ApplicationException(exn)
}
}
impl ::fbthrift::ExceptionInfo for ExecuteExn {
fn exn_name(&self) -> &'static str {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
Self::ApplicationException(aexn) => aexn.exn_name(),
}
}
fn exn_value(&self) -> String {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
Self::ApplicationException(aexn) => aexn.exn_value(),
}
}
fn exn_is_declared(&self) -> bool {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
Self::ApplicationException(aexn) => aexn.exn_is_declared(),
}
}
}
impl ::fbthrift::ResultInfo for ExecuteExn {
fn result_type(&self) -> ::fbthrift::ResultType {
match self {
Self::Success(_) => ::fbthrift::ResultType::Return,
Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
}
}
}
impl ::fbthrift::GetTType for ExecuteExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for ExecuteExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
if let Self::ApplicationException(aexn) = self {
return aexn.write(p);
}
p.write_struct_begin("Execute");
match self {
Self::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
Self::ApplicationException(_aexn) => unreachable!(),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for ExecuteExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"ExecuteExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "ExecuteExn"),
)
.into(),
)
}
}
#[derive(Clone, Debug)]
pub enum ExecuteJsonExn {
#[doc(hidden)]
Success(::std::vec::Vec<::std::primitive::u8>),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<crate::errors::graph_service::ExecuteJsonError> for ExecuteJsonExn {
fn from(err: crate::errors::graph_service::ExecuteJsonError) -> Self {
match err {
crate::errors::graph_service::ExecuteJsonError::ApplicationException(aexn) => ExecuteJsonExn::ApplicationException(aexn),
crate::errors::graph_service::ExecuteJsonError::ThriftError(err) => ExecuteJsonExn::ApplicationException(::fbthrift::ApplicationException {
message: err.to_string(),
type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
}),
}
}
}
impl ::std::convert::From<::fbthrift::ApplicationException> for ExecuteJsonExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
Self::ApplicationException(exn)
}
}
impl ::fbthrift::ExceptionInfo for ExecuteJsonExn {
fn exn_name(&self) -> &'static str {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
Self::ApplicationException(aexn) => aexn.exn_name(),
}
}
fn exn_value(&self) -> String {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
Self::ApplicationException(aexn) => aexn.exn_value(),
}
}
fn exn_is_declared(&self) -> bool {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
Self::ApplicationException(aexn) => aexn.exn_is_declared(),
}
}
}
impl ::fbthrift::ResultInfo for ExecuteJsonExn {
fn result_type(&self) -> ::fbthrift::ResultType {
match self {
Self::Success(_) => ::fbthrift::ResultType::Return,
Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
}
}
}
impl ::fbthrift::GetTType for ExecuteJsonExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for ExecuteJsonExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
if let Self::ApplicationException(aexn) = self {
return aexn.write(p);
}
p.write_struct_begin("ExecuteJson");
match self {
Self::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::String,
0i16,
);
inner.write(p);
p.write_field_end();
}
Self::ApplicationException(_aexn) => unreachable!(),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for ExecuteJsonExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::String, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::String, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"ExecuteJsonExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "ExecuteJsonExn"),
)
.into(),
)
}
}
#[derive(Clone, Debug)]
pub enum VerifyClientVersionExn {
#[doc(hidden)]
Success(crate::types::VerifyClientVersionResp),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<crate::errors::graph_service::VerifyClientVersionError> for VerifyClientVersionExn {
fn from(err: crate::errors::graph_service::VerifyClientVersionError) -> Self {
match err {
crate::errors::graph_service::VerifyClientVersionError::ApplicationException(aexn) => VerifyClientVersionExn::ApplicationException(aexn),
crate::errors::graph_service::VerifyClientVersionError::ThriftError(err) => VerifyClientVersionExn::ApplicationException(::fbthrift::ApplicationException {
message: err.to_string(),
type_: ::fbthrift::ApplicationExceptionErrorCode::InternalError,
}),
}
}
}
impl ::std::convert::From<::fbthrift::ApplicationException> for VerifyClientVersionExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
Self::ApplicationException(exn)
}
}
impl ::fbthrift::ExceptionInfo for VerifyClientVersionExn {
fn exn_name(&self) -> &'static str {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_name called on Success"),
Self::ApplicationException(aexn) => aexn.exn_name(),
}
}
fn exn_value(&self) -> String {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_value called on Success"),
Self::ApplicationException(aexn) => aexn.exn_value(),
}
}
fn exn_is_declared(&self) -> bool {
match self {
Self::Success(_) => panic!("ExceptionInfo::exn_is_declared called on Success"),
Self::ApplicationException(aexn) => aexn.exn_is_declared(),
}
}
}
impl ::fbthrift::ResultInfo for VerifyClientVersionExn {
fn result_type(&self) -> ::fbthrift::ResultType {
match self {
Self::Success(_) => ::fbthrift::ResultType::Return,
Self::ApplicationException(_aexn) => ::fbthrift::ResultType::Exception,
}
}
}
impl ::fbthrift::GetTType for VerifyClientVersionExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for VerifyClientVersionExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
if let Self::ApplicationException(aexn) = self {
return aexn.write(p);
}
p.write_struct_begin("VerifyClientVersion");
match self {
Self::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
Self::ApplicationException(_aexn) => unreachable!(),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for VerifyClientVersionExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(Self::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"VerifyClientVersionExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "VerifyClientVersionExn"),
)
.into(),
)
}
}
}
}
pub mod client {
pub struct GraphServiceImpl<P, T, S = ::fbthrift::NoopSpawner> {
transport: T,
_phantom: ::std::marker::PhantomData<fn() -> (P, S)>,
}
impl<P, T, S> GraphServiceImpl<P, T, S>
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
pub fn new(
transport: T,
) -> Self {
Self {
transport,
_phantom: ::std::marker::PhantomData,
}
}
pub fn transport(&self) -> &T {
&self.transport
}
fn _authenticate_impl(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.authenticate";
}
let args = self::Args_GraphService_authenticate {
username: arg_username,
password: arg_password,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("authenticate", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", function = "GraphService.authenticate"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let (res, _de): (::std::result::Result<crate::services::graph_service::AuthenticateExn, _>, _) =
::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
let res = match res {
::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
::std::result::Result::Err(aexn) =>
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ApplicationException(aexn))
};
res
}
.instrument(::tracing::info_span!("GraphService.authenticate"))
.boxed()
}
fn _signout_impl(
&self,
arg_sessionId: ::std::primitive::i64,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.signout";
}
let args = self::Args_GraphService_signout {
sessionId: arg_sessionId,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("signout", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", function = "GraphService.signout"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let (res, _de): (::std::result::Result<crate::services::graph_service::SignoutExn, _>, _) =
::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
let res = match res {
::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
::std::result::Result::Err(aexn) =>
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ApplicationException(aexn))
};
res
}
.instrument(::tracing::info_span!("GraphService.signout"))
.boxed()
}
fn _execute_impl(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.execute";
}
let args = self::Args_GraphService_execute {
sessionId: arg_sessionId,
stmt: arg_stmt,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("execute", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", function = "GraphService.execute"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let (res, _de): (::std::result::Result<crate::services::graph_service::ExecuteExn, _>, _) =
::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
let res = match res {
::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
::std::result::Result::Err(aexn) =>
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ApplicationException(aexn))
};
res
}
.instrument(::tracing::info_span!("GraphService.execute"))
.boxed()
}
fn _executeJson_impl(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.executeJson";
}
let args = self::Args_GraphService_executeJson {
sessionId: arg_sessionId,
stmt: arg_stmt,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("executeJson", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", function = "GraphService.executeJson"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let (res, _de): (::std::result::Result<crate::services::graph_service::ExecuteJsonExn, _>, _) =
::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
let res = match res {
::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
::std::result::Result::Err(aexn) =>
::std::result::Result::Err(crate::errors::graph_service::ExecuteJsonError::ApplicationException(aexn))
};
res
}
.instrument(::tracing::info_span!("GraphService.executeJson"))
.boxed()
}
fn _verifyClientVersion_impl(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>> {
use ::const_cstr::const_cstr;
use ::tracing::Instrument as _;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.verifyClientVersion";
}
let args = self::Args_GraphService_verifyClientVersion {
req: arg_req,
_phantom: ::std::marker::PhantomData,
};
let transport = self.transport();
let request_env = match ::fbthrift::help::serialize_request_envelope::<P, _>("verifyClientVersion", &args) {
::std::result::Result::Ok(res) => res,
::std::result::Result::Err(err) => return ::futures::future::err(err.into()).boxed(),
};
let call = transport
.call(SERVICE_NAME.as_cstr(), METHOD_NAME.as_cstr(), request_env, rpc_options)
.instrument(::tracing::trace_span!("call", function = "GraphService.verifyClientVersion"));
async move {
let reply_env = call.await?;
let de = P::deserializer(reply_env);
let (res, _de): (::std::result::Result<crate::services::graph_service::VerifyClientVersionExn, _>, _) =
::fbthrift::help::async_deserialize_response_envelope::<P, _, S>(de).await?;
let res = match res {
::std::result::Result::Ok(exn) => ::std::convert::From::from(exn),
::std::result::Result::Err(aexn) =>
::std::result::Result::Err(crate::errors::graph_service::VerifyClientVersionError::ApplicationException(aexn))
};
res
}
.instrument(::tracing::info_span!("GraphService.verifyClientVersion"))
.boxed()
}
}
pub trait GraphService: ::std::marker::Send {
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>>;
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>>;
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>>;
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>>;
fn verifyClientVersion(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>>;
}
pub trait GraphServiceExt<T>: GraphService
where
T: ::fbthrift::Transport,
{
fn authenticate_with_rpc_opts(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>>;
fn signout_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>>;
fn execute_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>>;
fn executeJson_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>>;
fn verifyClientVersion_with_rpc_opts(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>>;
}
struct Args_GraphService_authenticate<'a> {
username: &'a ::std::vec::Vec<::std::primitive::u8>,
password: &'a ::std::vec::Vec<::std::primitive::u8>,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_GraphService_authenticate<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "GraphService.authenticate"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("username", ::fbthrift::TType::String, 1i16);
::fbthrift::Serialize::write(&self.username, p);
p.write_field_end();
p.write_field_begin("password", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&self.password, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_GraphService_signout<'a> {
sessionId: ::std::primitive::i64,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_GraphService_signout<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "GraphService.signout"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&self.sessionId, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_GraphService_execute<'a> {
sessionId: ::std::primitive::i64,
stmt: &'a ::std::vec::Vec<::std::primitive::u8>,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_GraphService_execute<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "GraphService.execute"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&self.sessionId, p);
p.write_field_end();
p.write_field_begin("stmt", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&self.stmt, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_GraphService_executeJson<'a> {
sessionId: ::std::primitive::i64,
stmt: &'a ::std::vec::Vec<::std::primitive::u8>,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_GraphService_executeJson<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "GraphService.executeJson"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&self.sessionId, p);
p.write_field_end();
p.write_field_begin("stmt", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&self.stmt, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
struct Args_GraphService_verifyClientVersion<'a> {
req: &'a crate::types::VerifyClientVersionReq,
_phantom: ::std::marker::PhantomData<&'a ()>,
}
impl<'a, P: ::fbthrift::ProtocolWriter> ::fbthrift::Serialize<P> for self::Args_GraphService_verifyClientVersion<'a> {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "serialize_args", fields(method = "GraphService.verifyClientVersion"))]
fn write(&self, p: &mut P) {
p.write_struct_begin("args");
p.write_field_begin("req", ::fbthrift::TType::Struct, 1i16);
::fbthrift::Serialize::write(&self.req, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P, T, S> GraphService for GraphServiceImpl<P, T, S>
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> {
let rpc_options = T::RpcOptions::default();
self._authenticate_impl(
arg_username,
arg_password,
rpc_options,
)
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>> {
let rpc_options = T::RpcOptions::default();
self._signout_impl(
arg_sessionId,
rpc_options,
)
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> {
let rpc_options = T::RpcOptions::default();
self._execute_impl(
arg_sessionId,
arg_stmt,
rpc_options,
)
}
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> {
let rpc_options = T::RpcOptions::default();
self._executeJson_impl(
arg_sessionId,
arg_stmt,
rpc_options,
)
}
fn verifyClientVersion(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>> {
let rpc_options = T::RpcOptions::default();
self._verifyClientVersion_impl(
arg_req,
rpc_options,
)
}
}
impl<P, T, S> GraphServiceExt<T> for GraphServiceImpl<P, T, S>
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
fn authenticate_with_rpc_opts(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> {
self._authenticate_impl(
arg_username,
arg_password,
rpc_options,
)
}
fn signout_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>> {
self._signout_impl(
arg_sessionId,
rpc_options,
)
}
fn execute_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> {
self._execute_impl(
arg_sessionId,
arg_stmt,
rpc_options,
)
}
fn executeJson_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> {
self._executeJson_impl(
arg_sessionId,
arg_stmt,
rpc_options,
)
}
fn verifyClientVersion_with_rpc_opts(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>> {
self._verifyClientVersion_impl(
arg_req,
rpc_options,
)
}
}
impl<'a, S> GraphService for S
where
S: ::std::convert::AsRef<dyn GraphService + 'a>,
S: ::std::marker::Send,
{
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> {
self.as_ref().authenticate(
arg_username,
arg_password,
)
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>> {
self.as_ref().signout(
arg_sessionId,
)
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> {
self.as_ref().execute(
arg_sessionId,
arg_stmt,
)
}
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> {
self.as_ref().executeJson(
arg_sessionId,
arg_stmt,
)
}
fn verifyClientVersion(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>> {
self.as_ref().verifyClientVersion(
arg_req,
)
}
}
impl<'a, S, T> GraphServiceExt<T> for S
where
S: ::std::convert::AsRef<dyn GraphService + 'a>,
S: ::std::convert::AsRef<dyn GraphServiceExt<T> + 'a>,
S: ::std::marker::Send,
T: ::fbthrift::Transport,
{
fn authenticate_with_rpc_opts(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> {
<Self as ::std::convert::AsRef<dyn GraphServiceExt<T>>>::as_ref(self).authenticate_with_rpc_opts(
arg_username,
arg_password,
rpc_options,
)
}
fn signout_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>> {
<Self as ::std::convert::AsRef<dyn GraphServiceExt<T>>>::as_ref(self).signout_with_rpc_opts(
arg_sessionId,
rpc_options,
)
}
fn execute_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> {
<Self as ::std::convert::AsRef<dyn GraphServiceExt<T>>>::as_ref(self).execute_with_rpc_opts(
arg_sessionId,
arg_stmt,
rpc_options,
)
}
fn executeJson_with_rpc_opts(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> {
<Self as ::std::convert::AsRef<dyn GraphServiceExt<T>>>::as_ref(self).executeJson_with_rpc_opts(
arg_sessionId,
arg_stmt,
rpc_options,
)
}
fn verifyClientVersion_with_rpc_opts(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
rpc_options: T::RpcOptions,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>> {
<Self as ::std::convert::AsRef<dyn GraphServiceExt<T>>>::as_ref(self).verifyClientVersion_with_rpc_opts(
arg_req,
rpc_options,
)
}
}
#[derive(Clone)]
pub struct make_GraphService;
impl dyn GraphService {
pub fn new<P, T>(
protocol: P,
transport: T,
) -> ::std::sync::Arc<impl GraphService + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner<P, T, S>(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc<impl GraphService + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(GraphServiceImpl::<P, T, S>::new(transport))
}
}
impl<T> dyn GraphServiceExt<T>
where
T: ::fbthrift::Transport,
{
pub fn new<P>(
protocol: P,
transport: T,
) -> ::std::sync::Arc<impl GraphServiceExt<T> + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol<Frame = T>,
P::Deserializer: ::std::marker::Send,
{
let spawner = ::fbthrift::help::NoopSpawner;
Self::with_spawner(protocol, transport, spawner)
}
pub fn with_spawner<P, S>(
protocol: P,
transport: T,
spawner: S,
) -> ::std::sync::Arc<impl GraphServiceExt<T> + ::std::marker::Send + ::std::marker::Sync + 'static>
where
P: ::fbthrift::Protocol<Frame = T>,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
let _ = protocol;
let _ = spawner;
::std::sync::Arc::new(GraphServiceImpl::<P, T, S>::new(transport))
}
}
pub type GraphServiceDynClient = <make_GraphService as ::fbthrift::ClientFactory>::Api;
pub type GraphServiceClient = ::std::sync::Arc<GraphServiceDynClient>;
impl ::fbthrift::ClientFactory for make_GraphService {
type Api = dyn GraphService + ::std::marker::Send + ::std::marker::Sync + 'static;
fn with_spawner<P, T, S>(protocol: P, transport: T, spawner: S) -> ::std::sync::Arc<Self::Api>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport,
P::Deserializer: ::std::marker::Send,
S: ::fbthrift::help::Spawner,
{
<dyn GraphService>::with_spawner(protocol, transport, spawner)
}
}
}
pub mod server {
#[::async_trait::async_trait]
pub trait GraphService: ::std::marker::Send + ::std::marker::Sync + 'static {
async fn authenticate(
&self,
_username: ::std::vec::Vec<::std::primitive::u8>,
_password: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<crate::types::AuthResponse, crate::services::graph_service::AuthenticateExn> {
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"authenticate",
),
))
}
async fn signout(
&self,
_sessionId: ::std::primitive::i64,
) -> ::std::result::Result<(), crate::services::graph_service::SignoutExn> {
::std::result::Result::Err(crate::services::graph_service::SignoutExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"signout",
),
))
}
async fn execute(
&self,
_sessionId: ::std::primitive::i64,
_stmt: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<crate::types::ExecutionResponse, crate::services::graph_service::ExecuteExn> {
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"execute",
),
))
}
async fn executeJson(
&self,
_sessionId: ::std::primitive::i64,
_stmt: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::graph_service::ExecuteJsonExn> {
::std::result::Result::Err(crate::services::graph_service::ExecuteJsonExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"executeJson",
),
))
}
async fn verifyClientVersion(
&self,
_req: crate::types::VerifyClientVersionReq,
) -> ::std::result::Result<crate::types::VerifyClientVersionResp, crate::services::graph_service::VerifyClientVersionExn> {
::std::result::Result::Err(crate::services::graph_service::VerifyClientVersionExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"verifyClientVersion",
),
))
}
}
#[::async_trait::async_trait]
impl<T> GraphService for ::std::boxed::Box<T>
where
T: GraphService + Send + Sync + ?Sized,
{
async fn authenticate(
&self,
username: ::std::vec::Vec<::std::primitive::u8>,
password: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<crate::types::AuthResponse, crate::services::graph_service::AuthenticateExn> {
(**self).authenticate(
username,
password,
).await
}
async fn signout(
&self,
sessionId: ::std::primitive::i64,
) -> ::std::result::Result<(), crate::services::graph_service::SignoutExn> {
(**self).signout(
sessionId,
).await
}
async fn execute(
&self,
sessionId: ::std::primitive::i64,
stmt: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<crate::types::ExecutionResponse, crate::services::graph_service::ExecuteExn> {
(**self).execute(
sessionId,
stmt,
).await
}
async fn executeJson(
&self,
sessionId: ::std::primitive::i64,
stmt: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::graph_service::ExecuteJsonExn> {
(**self).executeJson(
sessionId,
stmt,
).await
}
async fn verifyClientVersion(
&self,
req: crate::types::VerifyClientVersionReq,
) -> ::std::result::Result<crate::types::VerifyClientVersionResp, crate::services::graph_service::VerifyClientVersionExn> {
(**self).verifyClientVersion(
req,
).await
}
}
#[derive(Clone, Debug)]
pub struct GraphServiceProcessor<P, H, R, RS> {
service: H,
supa: ::fbthrift::NullServiceProcessor<P, R, RS>,
_phantom: ::std::marker::PhantomData<(P, H, R, RS)>,
}
struct Args_GraphService_authenticate {
username: ::std::vec::Vec<::std::primitive::u8>,
password: ::std::vec::Vec<::std::primitive::u8>,
}
impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_GraphService_authenticate {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "GraphService.authenticate"))]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("password", ::fbthrift::TType::String, 2),
::fbthrift::Field::new("username", ::fbthrift::TType::String, 1),
];
let mut field_username = ::std::option::Option::None;
let mut field_password = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::String, 1) => field_username = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_password = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
username: field_username.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.authenticate", "username"))?,
password: field_password.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.authenticate", "password"))?,
})
}
}
struct Args_GraphService_signout {
sessionId: ::std::primitive::i64,
}
impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_GraphService_signout {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "GraphService.signout"))]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("sessionId", ::fbthrift::TType::I64, 1),
];
let mut field_sessionId = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
sessionId: field_sessionId.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.signout", "sessionId"))?,
})
}
}
struct Args_GraphService_execute {
sessionId: ::std::primitive::i64,
stmt: ::std::vec::Vec<::std::primitive::u8>,
}
impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_GraphService_execute {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "GraphService.execute"))]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("sessionId", ::fbthrift::TType::I64, 1),
::fbthrift::Field::new("stmt", ::fbthrift::TType::String, 2),
];
let mut field_sessionId = ::std::option::Option::None;
let mut field_stmt = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_stmt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
sessionId: field_sessionId.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.execute", "sessionId"))?,
stmt: field_stmt.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.execute", "stmt"))?,
})
}
}
struct Args_GraphService_executeJson {
sessionId: ::std::primitive::i64,
stmt: ::std::vec::Vec<::std::primitive::u8>,
}
impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_GraphService_executeJson {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "GraphService.executeJson"))]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("sessionId", ::fbthrift::TType::I64, 1),
::fbthrift::Field::new("stmt", ::fbthrift::TType::String, 2),
];
let mut field_sessionId = ::std::option::Option::None;
let mut field_stmt = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_stmt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
sessionId: field_sessionId.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.executeJson", "sessionId"))?,
stmt: field_stmt.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.executeJson", "stmt"))?,
})
}
}
struct Args_GraphService_verifyClientVersion {
req: crate::types::VerifyClientVersionReq,
}
impl<P: ::fbthrift::ProtocolReader> ::fbthrift::Deserialize<P> for self::Args_GraphService_verifyClientVersion {
#[inline]
#[::tracing::instrument(skip_all, level = "trace", name = "deserialize_args", fields(method = "GraphService.verifyClientVersion"))]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("req", ::fbthrift::TType::Struct, 1),
];
let mut field_req = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::Struct, 1) => field_req = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
req: field_req.ok_or_else(|| ::anyhow::anyhow!("`{}` missing arg `{}`", "GraphService.verifyClientVersion", "req"))?,
})
}
}
impl<P, H, R, RS> GraphServiceProcessor<P, H, R, RS>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Frame: ::std::marker::Send + 'static,
P::Deserializer: ::std::marker::Send,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>>
+ ::std::marker::Send + ::std::marker::Sync,
{
pub fn new(service: H) -> Self {
Self {
service,
supa: ::fbthrift::NullServiceProcessor::new(),
_phantom: ::std::marker::PhantomData,
}
}
pub fn into_inner(self) -> H {
self.service
}
#[::tracing::instrument(skip_all, name = "handler", fields(method = "GraphService.authenticate"))]
async fn handle_authenticate<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<()> {
use ::const_cstr::const_cstr;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.authenticate";
}
let mut ctx_stack = req_ctxt.get_context_stack(
SERVICE_NAME.as_cstr(),
METHOD_NAME.as_cstr(),
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
let _args: self::Args_GraphService_authenticate = ::fbthrift::Deserialize::read(p)?;
::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
protocol: P::PROTOCOL_ID,
method_name: METHOD_NAME.as_cstr(),
buffer: ::std::marker::PhantomData, })?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = ::std::panic::AssertUnwindSafe(
self.service.authenticate(
_args.username,
_args.password,
)
)
.catch_unwind()
.await;
let res = match res {
::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
::tracing::info!("success");
crate::services::graph_service::AuthenticateExn::Success(res)
}
::std::result::Result::Ok(::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::Success(_))) => {
panic!(
"{} attempted to return success via error",
"authenticate",
)
}
::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
::tracing::error!(exception = ?exn);
exn
}
::std::result::Result::Err(exn) => {
let aexn = ::fbthrift::ApplicationException::handler_panic("GraphService.authenticate", exn);
crate::services::graph_service::AuthenticateExn::ApplicationException(aexn)
}
};
let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
"authenticate",
METHOD_NAME.as_cstr(),
_seqid,
req_ctxt,
&mut ctx_stack,
res
)?;
reply_state.lock().unwrap().send_reply(env);
Ok(())
}
#[::tracing::instrument(skip_all, name = "handler", fields(method = "GraphService.signout"))]
async fn handle_signout<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<()> {
use ::const_cstr::const_cstr;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.signout";
}
let mut ctx_stack = req_ctxt.get_context_stack(
SERVICE_NAME.as_cstr(),
METHOD_NAME.as_cstr(),
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
let _args: self::Args_GraphService_signout = ::fbthrift::Deserialize::read(p)?;
::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
protocol: P::PROTOCOL_ID,
method_name: METHOD_NAME.as_cstr(),
buffer: ::std::marker::PhantomData, })?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = ::std::panic::AssertUnwindSafe(
self.service.signout(
_args.sessionId,
)
)
.catch_unwind()
.await;
let res = match res {
::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
::tracing::info!("success");
crate::services::graph_service::SignoutExn::Success(res)
}
::std::result::Result::Ok(::std::result::Result::Err(crate::services::graph_service::SignoutExn::Success(_))) => {
panic!(
"{} attempted to return success via error",
"signout",
)
}
::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
::tracing::error!(exception = ?exn);
exn
}
::std::result::Result::Err(exn) => {
let aexn = ::fbthrift::ApplicationException::handler_panic("GraphService.signout", exn);
crate::services::graph_service::SignoutExn::ApplicationException(aexn)
}
};
let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
"signout",
METHOD_NAME.as_cstr(),
_seqid,
req_ctxt,
&mut ctx_stack,
res
)?;
reply_state.lock().unwrap().send_reply(env);
Ok(())
}
#[::tracing::instrument(skip_all, name = "handler", fields(method = "GraphService.execute"))]
async fn handle_execute<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<()> {
use ::const_cstr::const_cstr;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.execute";
}
let mut ctx_stack = req_ctxt.get_context_stack(
SERVICE_NAME.as_cstr(),
METHOD_NAME.as_cstr(),
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
let _args: self::Args_GraphService_execute = ::fbthrift::Deserialize::read(p)?;
::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
protocol: P::PROTOCOL_ID,
method_name: METHOD_NAME.as_cstr(),
buffer: ::std::marker::PhantomData, })?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = ::std::panic::AssertUnwindSafe(
self.service.execute(
_args.sessionId,
_args.stmt,
)
)
.catch_unwind()
.await;
let res = match res {
::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
::tracing::info!("success");
crate::services::graph_service::ExecuteExn::Success(res)
}
::std::result::Result::Ok(::std::result::Result::Err(crate::services::graph_service::ExecuteExn::Success(_))) => {
panic!(
"{} attempted to return success via error",
"execute",
)
}
::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
::tracing::error!(exception = ?exn);
exn
}
::std::result::Result::Err(exn) => {
let aexn = ::fbthrift::ApplicationException::handler_panic("GraphService.execute", exn);
crate::services::graph_service::ExecuteExn::ApplicationException(aexn)
}
};
let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
"execute",
METHOD_NAME.as_cstr(),
_seqid,
req_ctxt,
&mut ctx_stack,
res
)?;
reply_state.lock().unwrap().send_reply(env);
Ok(())
}
#[::tracing::instrument(skip_all, name = "handler", fields(method = "GraphService.executeJson"))]
async fn handle_executeJson<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<()> {
use ::const_cstr::const_cstr;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.executeJson";
}
let mut ctx_stack = req_ctxt.get_context_stack(
SERVICE_NAME.as_cstr(),
METHOD_NAME.as_cstr(),
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
let _args: self::Args_GraphService_executeJson = ::fbthrift::Deserialize::read(p)?;
::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
protocol: P::PROTOCOL_ID,
method_name: METHOD_NAME.as_cstr(),
buffer: ::std::marker::PhantomData, })?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = ::std::panic::AssertUnwindSafe(
self.service.executeJson(
_args.sessionId,
_args.stmt,
)
)
.catch_unwind()
.await;
let res = match res {
::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
::tracing::info!("success");
crate::services::graph_service::ExecuteJsonExn::Success(res)
}
::std::result::Result::Ok(::std::result::Result::Err(crate::services::graph_service::ExecuteJsonExn::Success(_))) => {
panic!(
"{} attempted to return success via error",
"executeJson",
)
}
::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
::tracing::error!(exception = ?exn);
exn
}
::std::result::Result::Err(exn) => {
let aexn = ::fbthrift::ApplicationException::handler_panic("GraphService.executeJson", exn);
crate::services::graph_service::ExecuteJsonExn::ApplicationException(aexn)
}
};
let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
"executeJson",
METHOD_NAME.as_cstr(),
_seqid,
req_ctxt,
&mut ctx_stack,
res
)?;
reply_state.lock().unwrap().send_reply(env);
Ok(())
}
#[::tracing::instrument(skip_all, name = "handler", fields(method = "GraphService.verifyClientVersion"))]
async fn handle_verifyClientVersion<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<()> {
use ::const_cstr::const_cstr;
use ::futures::FutureExt as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.verifyClientVersion";
}
let mut ctx_stack = req_ctxt.get_context_stack(
SERVICE_NAME.as_cstr(),
METHOD_NAME.as_cstr(),
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
let _args: self::Args_GraphService_verifyClientVersion = ::fbthrift::Deserialize::read(p)?;
::fbthrift::ContextStack::on_read_data(&mut ctx_stack, &::fbthrift::SerializedMessage {
protocol: P::PROTOCOL_ID,
method_name: METHOD_NAME.as_cstr(),
buffer: ::std::marker::PhantomData, })?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = ::std::panic::AssertUnwindSafe(
self.service.verifyClientVersion(
_args.req,
)
)
.catch_unwind()
.await;
let res = match res {
::std::result::Result::Ok(::std::result::Result::Ok(res)) => {
::tracing::info!("success");
crate::services::graph_service::VerifyClientVersionExn::Success(res)
}
::std::result::Result::Ok(::std::result::Result::Err(crate::services::graph_service::VerifyClientVersionExn::Success(_))) => {
panic!(
"{} attempted to return success via error",
"verifyClientVersion",
)
}
::std::result::Result::Ok(::std::result::Result::Err(exn)) => {
::tracing::error!(exception = ?exn);
exn
}
::std::result::Result::Err(exn) => {
let aexn = ::fbthrift::ApplicationException::handler_panic("GraphService.verifyClientVersion", exn);
crate::services::graph_service::VerifyClientVersionExn::ApplicationException(aexn)
}
};
let env = ::fbthrift::help::serialize_result_envelope::<P, R, _>(
"verifyClientVersion",
METHOD_NAME.as_cstr(),
_seqid,
req_ctxt,
&mut ctx_stack,
res
)?;
reply_state.lock().unwrap().send_reply(env);
Ok(())
}
}
#[::async_trait::async_trait]
impl<P, H, R, RS> ::fbthrift::ServiceProcessor<P> for GraphServiceProcessor<P, H, R, RS>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
H: GraphService,
P::Frame: ::std::marker::Send + 'static,
R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>>
+ ::std::marker::Send + ::std::marker::Sync + 'static,
RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static
{
type RequestContext = R;
type ReplyState = RS;
#[inline]
fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> {
match name {
b"authenticate" => ::std::result::Result::Ok(0usize),
b"signout" => ::std::result::Result::Ok(1usize),
b"execute" => ::std::result::Result::Ok(2usize),
b"executeJson" => ::std::result::Result::Ok(3usize),
b"verifyClientVersion" => ::std::result::Result::Ok(4usize),
_ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()),
}
}
#[allow(clippy::match_single_binding)]
async fn handle_method(
&self,
idx: ::std::primitive::usize,
_p: &mut P::Deserializer,
_r: &R,
_reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<()> {
match idx {
0usize => {
self.handle_authenticate(_p, _r, _reply_state, _seqid).await
}
1usize => {
self.handle_signout(_p, _r, _reply_state, _seqid).await
}
2usize => {
self.handle_execute(_p, _r, _reply_state, _seqid).await
}
3usize => {
self.handle_executeJson(_p, _r, _reply_state, _seqid).await
}
4usize => {
self.handle_verifyClientVersion(_p, _r, _reply_state, _seqid).await
}
bad => panic!(
"{}: unexpected method idx {}",
"GraphServiceProcessor",
bad
),
}
}
#[allow(clippy::match_single_binding)]
#[inline]
fn create_interaction_idx(&self, name: &str) -> ::anyhow::Result<::std::primitive::usize> {
match name {
_ => ::anyhow::bail!("Unknown interaction"),
}
}
#[allow(clippy::match_single_binding)]
fn handle_create_interaction(
&self,
idx: ::std::primitive::usize,
) -> ::anyhow::Result<
::std::sync::Arc<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = Self::RequestContext, ReplyState = Self::ReplyState> + ::std::marker::Send + 'static>
> {
match idx {
bad => panic!(
"{}: unexpected method idx {}",
"GraphServiceProcessor",
bad
),
}
}
}
#[::async_trait::async_trait]
impl<P, H, R, RS> ::fbthrift::ThriftService<P::Frame> for GraphServiceProcessor<P, H, R, RS>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
P::Frame: ::std::marker::Send + 'static,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = ::fbthrift::ProtocolDecoded<P>>
+ ::std::marker::Send + ::std::marker::Sync + 'static,
RS: ::fbthrift::ReplyState<P::Frame, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static
{
type Handler = H;
type RequestContext = R;
type ReplyState = RS;
#[tracing::instrument(level="trace", skip_all, fields(service = "GraphService"))]
async fn call(
&self,
req: ::fbthrift::ProtocolDecoded<P>,
req_ctxt: &R,
reply_state: ::std::sync::Arc<::std::sync::Mutex<RS>>,
) -> ::anyhow::Result<()> {
use ::fbthrift::{BufExt as _, ProtocolReader as _, ServiceProcessor as _};
let mut p = P::deserializer(req);
let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?;
if mty != ::fbthrift::MessageType::Call {
return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType,
format!("message type {:?} not handled", mty)
)));
}
let idx = match idx {
::std::result::Result::Ok(idx) => idx,
::std::result::Result::Err(_) => {
let cur = P::into_buffer(p).reset();
return self.supa.call(cur, req_ctxt, reply_state).await;
}
};
self.handle_method(idx, &mut p, req_ctxt, reply_state, seqid).await?;
p.read_message_end()?;
Ok(())
}
fn create_interaction(
&self,
name: &str,
) -> ::anyhow::Result<
::std::sync::Arc<dyn ::fbthrift::ThriftService<P::Frame, Handler = (), RequestContext = R, ReplyState = RS> + ::std::marker::Send + 'static>
> {
use ::fbthrift::{ServiceProcessor as _};
let idx = self.create_interaction_idx(name);
let idx = match idx {
::anyhow::Result::Ok(idx) => idx,
::anyhow::Result::Err(_) => {
return self.supa.create_interaction(name);
}
};
self.handle_create_interaction(idx)
}
fn get_method_names(&self) -> &'static [&'static str] {
&[
"authenticate",
"signout",
"execute",
"executeJson",
"verifyClientVersion",
]
}
}
#[::tracing::instrument(level="debug", skip_all, fields(proto = ?proto))]
pub fn make_GraphService_server<F, H, R, RS>(
proto: ::fbthrift::ProtocolID,
handler: H,
) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R, ReplyState = RS> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException>
where
F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::std::ffi::CStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack<Name = R::Name, Buffer = F::DecBuf> + ::std::marker::Send + ::std::marker::Sync + 'static,
RS: ::fbthrift::ReplyState<F, RequestContext = R> + ::std::marker::Send + ::std::marker::Sync + 'static
{
match proto {
::fbthrift::ProtocolID::BinaryProtocol => {
::std::result::Result::Ok(::std::boxed::Box::new(GraphServiceProcessor::<::fbthrift::BinaryProtocol<F>, H, R, RS>::new(handler)))
}
::fbthrift::ProtocolID::CompactProtocol => {
::std::result::Result::Ok(::std::boxed::Box::new(GraphServiceProcessor::<::fbthrift::CompactProtocol<F>, H, R, RS>::new(handler)))
}
bad => {
::tracing::error!(method = "GraphService.", invalid_protocol = ?bad);
::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad))
}
}
}
}
pub mod mock {
pub struct GraphService<'mock> {
pub authenticate: r#impl::graph_service::authenticate<'mock>,
pub signout: r#impl::graph_service::signout<'mock>,
pub execute: r#impl::graph_service::execute<'mock>,
pub executeJson: r#impl::graph_service::executeJson<'mock>,
pub verifyClientVersion: r#impl::graph_service::verifyClientVersion<'mock>,
_marker: ::std::marker::PhantomData<&'mock ()>,
}
impl dyn super::client::GraphService {
pub fn mock<'mock>() -> GraphService<'mock> {
GraphService {
authenticate: r#impl::graph_service::authenticate::unimplemented(),
signout: r#impl::graph_service::signout::unimplemented(),
execute: r#impl::graph_service::execute::unimplemented(),
executeJson: r#impl::graph_service::executeJson::unimplemented(),
verifyClientVersion: r#impl::graph_service::verifyClientVersion::unimplemented(),
_marker: ::std::marker::PhantomData,
}
}
}
impl<'mock> super::client::GraphService for GraphService<'mock> {
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> {
let mut closure = self.authenticate.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_username.clone(), arg_password.clone())))
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<(), crate::errors::graph_service::SignoutError>> {
let mut closure = self.signout.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone())))
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> {
let mut closure = self.execute.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone(), arg_stmt.clone())))
}
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> {
let mut closure = self.executeJson.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone(), arg_stmt.clone())))
}
fn verifyClientVersion(
&self,
arg_req: &crate::types::VerifyClientVersionReq,
) -> ::futures::future::BoxFuture<'static, ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError>> {
let mut closure = self.verifyClientVersion.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(crate::types::VerifyClientVersionReq) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_req.clone())))
}
}
mod r#impl {
pub mod graph_service {
pub struct authenticate<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<
crate::types::AuthResponse,
crate::errors::graph_service::AuthenticateError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
#[allow(clippy::redundant_closure)]
impl<'mock> authenticate<'mock> {
pub fn unimplemented() -> Self {
Self {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::vec::Vec<::std::primitive::u8>, _: ::std::vec::Vec<::std::primitive::u8>| panic!(
"{}::{} is not mocked",
"GraphService",
"authenticate",
))),
}
}
pub fn ret(&self, value: crate::types::AuthResponse) {
self.mock(move |_: ::std::vec::Vec<::std::primitive::u8>, _: ::std::vec::Vec<::std::primitive::u8>| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> crate::types::AuthResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |username, password| ::std::result::Result::Ok(mock(username, password)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |username, password| mock(username, password));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::AuthenticateError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::vec::Vec<::std::primitive::u8>, _: ::std::vec::Vec<::std::primitive::u8>| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct signout<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<
(),
crate::errors::graph_service::SignoutError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
#[allow(clippy::redundant_closure)]
impl<'mock> signout<'mock> {
pub fn unimplemented() -> Self {
Self {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!(
"{}::{} is not mocked",
"GraphService",
"signout",
))),
}
}
pub fn ret(&self, value: ()) {
self.mock(move |_: ::std::primitive::i64| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId| ::std::result::Result::Ok(mock(sessionId)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<(), crate::errors::graph_service::SignoutError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId| mock(sessionId));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::SignoutError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct execute<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<
crate::types::ExecutionResponse,
crate::errors::graph_service::ExecuteError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
#[allow(clippy::redundant_closure)]
impl<'mock> execute<'mock> {
pub fn unimplemented() -> Self {
Self {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| panic!(
"{}::{} is not mocked",
"GraphService",
"execute",
))),
}
}
pub fn ret(&self, value: crate::types::ExecutionResponse) {
self.mock(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> crate::types::ExecutionResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| ::std::result::Result::Ok(mock(sessionId, stmt)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| mock(sessionId, stmt));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::ExecuteError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct executeJson<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<
::std::vec::Vec<::std::primitive::u8>,
crate::errors::graph_service::ExecuteJsonError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
#[allow(clippy::redundant_closure)]
impl<'mock> executeJson<'mock> {
pub fn unimplemented() -> Self {
Self {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| panic!(
"{}::{} is not mocked",
"GraphService",
"executeJson",
))),
}
}
pub fn ret(&self, value: ::std::vec::Vec<::std::primitive::u8>) {
self.mock(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::vec::Vec<::std::primitive::u8> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| ::std::result::Result::Ok(mock(sessionId, stmt)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| mock(sessionId, stmt));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::ExecuteJsonError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct verifyClientVersion<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(crate::types::VerifyClientVersionReq) -> ::std::result::Result<
crate::types::VerifyClientVersionResp,
crate::errors::graph_service::VerifyClientVersionError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
#[allow(clippy::redundant_closure)]
impl<'mock> verifyClientVersion<'mock> {
pub fn unimplemented() -> Self {
Self {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: crate::types::VerifyClientVersionReq| panic!(
"{}::{} is not mocked",
"GraphService",
"verifyClientVersion",
))),
}
}
pub fn ret(&self, value: crate::types::VerifyClientVersionResp) {
self.mock(move |_: crate::types::VerifyClientVersionReq| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(crate::types::VerifyClientVersionReq) -> crate::types::VerifyClientVersionResp + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |req| ::std::result::Result::Ok(mock(req)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(crate::types::VerifyClientVersionReq) -> ::std::result::Result<crate::types::VerifyClientVersionResp, crate::errors::graph_service::VerifyClientVersionError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |req| mock(req));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::VerifyClientVersionError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: crate::types::VerifyClientVersionReq| ::std::result::Result::Err(exception.clone().into()));
}
}
}
}
}
pub mod errors {
pub mod graph_service {
pub type AuthenticateError = ::fbthrift::NonthrowingFunctionError;
impl ::std::convert::From<crate::services::graph_service::AuthenticateExn> for
::std::result::Result<crate::types::AuthResponse, AuthenticateError>
{
fn from(e: crate::services::graph_service::AuthenticateExn) -> Self {
match e {
crate::services::graph_service::AuthenticateExn::Success(res) => {
::std::result::Result::Ok(res)
}
crate::services::graph_service::AuthenticateExn::ApplicationException(aexn) =>
::std::result::Result::Err(AuthenticateError::ApplicationException(aexn)),
}
}
}
pub type SignoutError = ::fbthrift::NonthrowingFunctionError;
impl ::std::convert::From<crate::services::graph_service::SignoutExn> for
::std::result::Result<(), SignoutError>
{
fn from(e: crate::services::graph_service::SignoutExn) -> Self {
match e {
crate::services::graph_service::SignoutExn::Success(res) => {
::std::result::Result::Ok(res)
}
crate::services::graph_service::SignoutExn::ApplicationException(aexn) =>
::std::result::Result::Err(SignoutError::ApplicationException(aexn)),
}
}
}
pub type ExecuteError = ::fbthrift::NonthrowingFunctionError;
impl ::std::convert::From<crate::services::graph_service::ExecuteExn> for
::std::result::Result<crate::types::ExecutionResponse, ExecuteError>
{
fn from(e: crate::services::graph_service::ExecuteExn) -> Self {
match e {
crate::services::graph_service::ExecuteExn::Success(res) => {
::std::result::Result::Ok(res)
}
crate::services::graph_service::ExecuteExn::ApplicationException(aexn) =>
::std::result::Result::Err(ExecuteError::ApplicationException(aexn)),
}
}
}
pub type ExecuteJsonError = ::fbthrift::NonthrowingFunctionError;
impl ::std::convert::From<crate::services::graph_service::ExecuteJsonExn> for
::std::result::Result<::std::vec::Vec<::std::primitive::u8>, ExecuteJsonError>
{
fn from(e: crate::services::graph_service::ExecuteJsonExn) -> Self {
match e {
crate::services::graph_service::ExecuteJsonExn::Success(res) => {
::std::result::Result::Ok(res)
}
crate::services::graph_service::ExecuteJsonExn::ApplicationException(aexn) =>
::std::result::Result::Err(ExecuteJsonError::ApplicationException(aexn)),
}
}
}
pub type VerifyClientVersionError = ::fbthrift::NonthrowingFunctionError;
impl ::std::convert::From<crate::services::graph_service::VerifyClientVersionExn> for
::std::result::Result<crate::types::VerifyClientVersionResp, VerifyClientVersionError>
{
fn from(e: crate::services::graph_service::VerifyClientVersionExn) -> Self {
match e {
crate::services::graph_service::VerifyClientVersionExn::Success(res) => {
::std::result::Result::Ok(res)
}
crate::services::graph_service::VerifyClientVersionExn::ApplicationException(aexn) =>
::std::result::Result::Err(VerifyClientVersionError::ApplicationException(aexn)),
}
}
}
}
}