sui_graphql_rpc_client/
lib.rs

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
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use async_graphql::Value;
use reqwest::header::ToStrError;
use serde_json::Number;

pub mod response;
pub mod simple_client;

#[derive(Debug, thiserror::Error)]
pub enum ClientError {
    #[error("Service version header not found")]
    ServiceVersionHeaderNotFound,
    #[error("Service version header value invalid string: {error}")]
    ServiceVersionHeaderValueInvalidString { error: ToStrError },
    #[error("Invalid usage number for {usage_name}: {usage_number}")]
    InvalidUsageNumber {
        usage_name: String,
        usage_number: Number,
    },
    #[error("Invalid usage field for {usage_name}: {usage_value}")]
    InvalidUsageValue {
        usage_name: String,
        usage_value: Value,
    },
    #[error("{item_type} at pos {idx} must not be empty")]
    InvalidEmptyItem { item_type: String, idx: usize },
    #[error(
        "Invalid variable name: `{var_name}`. Variable names must be non-empty and start with a letter or underscore, and may only contain letters, digits, and underscores."
    )]
    InvalidVariableName { var_name: String },

    #[error(
        "Conflicting type definitions for variable {var_name}: {var_type_prev} vs {var_type_curr}"
    )]
    VariableDefinitionConflict {
        var_name: String,
        var_type_prev: String,
        var_type_curr: String,
    },
    #[error("Conflicting values for variable {var_name}: {var_val_prev} vs {var_val_curr}")]
    VariableValueConflict {
        var_name: String,
        var_val_prev: serde_json::Value,
        var_val_curr: serde_json::Value,
    },
    #[error(transparent)]
    InnerClientError(#[from] reqwest::Error),
}