def create_get_unspent_transaction_outputs_for_multiple_addresses(self,
                                                                      addrs):
        """Does a POST request to /api/defcoin/api/utxo.

        TODO: type endpoint description here.

        Args:
            addrs (string): TODO: type description here.

        Returns:
            list of UTXO: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        # The base uri for api requests
        query_builder = Configuration.BASE_URI
 
        # Prepare query string for API call
        query_builder += "/api/defcoin/api/utxo"

        # Process optional query parameters
        query_builder = APIHelper.append_url_with_query_parameters(query_builder, {
            "addrs": addrs
        })

        # Validate and preprocess url
        query_url = APIHelper.clean_url(query_builder)

        # Prepare headers
        headers = {
            "user-agent": "APIMATIC 2.0",
            "accept": "application/json"
        }

        # Prepare and invoke the API call request to fetch the response
        response = unirest.post(query_url, headers=headers)

        # Error handling using HTTP status codes
        if response.code < 200 or response.code > 206:  # 200 = HTTP OK
            raise APIException("HTTP Response Not OK", response.code, response.body) 
    
        #try to cast response to list of desired type
        if isinstance(response.body, list):
            # Response is already in a list, return the list of objects 
            value = list()
            for item in response.body:
                value.append(UTXO(**item))

            return value
        
        # If we got here then an error occured while trying to parse the response
        raise APIException("Invalid JSON returned", response.code, response.body) 
    def get_address_total_sent(self,
                               address):
        """Does a GET request to /api/defcoin/api/addr.

        TODO: type endpoint description here.

        Args:
            address (string): TODO: type description here.

        Returns:
            GetAddressTotalSentResponse: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        # The base uri for api requests
        query_builder = Configuration.BASE_URI
 
        # Prepare query string for API call
        query_builder += "/api/defcoin/api/addr"

        # Process optional query parameters
        query_builder = APIHelper.append_url_with_query_parameters(query_builder, {
            "address": address
        })

        # Validate and preprocess url
        query_url = APIHelper.clean_url(query_builder)

        # Prepare headers
        headers = {
            "user-agent": "APIMATIC 2.0",
            "accept": "application/json"
        }

        # Prepare and invoke the API call request to fetch the response
        response = unirest.get(query_url, headers=headers)

        # Error handling using HTTP status codes
        if response.code < 200 or response.code > 206:  # 200 = HTTP OK
            raise APIException("HTTP Response Not OK", response.code, response.body) 
    
        # Try to cast response to desired type
        if isinstance(response.body, dict):
            # Response is already in a dictionary, return the object 
            return GetAddressTotalSentResponse(**response.body)
        
        # If we got here then an error occured while trying to parse the response
        raise APIException("Invalid JSON returned", response.code, response.body) 
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "blockhash": "blockhash",
            "blocktime": "blocktime",
            "confirmations": "confirmations",
            "is_coin_base": "isCoinBase",
            "locktime": "locktime",
            "size": "size",
            "time": "time",
            "txid": "txid",
            "value_out": "valueOut",
            "version": "version",
            "vin": "vin",
            "vout": "vout",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
Exemple #4
0
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "coinbase": "coinbase",
            "confirmations": "confirmations",
            "is_confirmed": "isConfirmed",
            "n": "n",
            "sequence": "sequence",
            "unconfirmed_input": "unconfirmedInput",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "bestblock": "bestblock",
            "bytes_serialized": "bytes_serialized",
            "hash_serialized": "hash_serialized",
            "height": "height",
            "total_amount": "total_amount",
            "transactions": "transactions",
            "txouts": "txouts",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
Exemple #6
0
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "address": "address",
            "amount": "amount",
            "confirmation": "confirmation",
            "confirmations_from_cache": "confirmationsFromCache",
            "script_pub_key": "scriptPubKey",
            "ts": "ts",
            "txid": "txid",
            "vout": "vout",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "alias": "alias",
            "dns_seeds": "dnsSeeds",
            "genesis_block": "genesisBlock",
            "name": "name",
            "network_magic": "networkMagic",
            "port": "port",
            "privatekey": "privatekey",
            "protocol_version": "protocolVersion",
            "pubkeyhash": "pubkeyhash",
            "scripthash": "scripthash",
            "xprivkey": "xprivkey",
            "xpubkey": "xpubkey",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "addr_str": "addrStr",
            "balance": "balance",
            "balance_sat": "balanceSat",
            "total_received": "totalReceived",
            "total_received_sat": "totalReceivedSat",
            "total_sent": "totalSent",
            "total_sent_sat": "totalSentSat",
            "transactions": "transactions",
            "tx_apperances": "txApperances",
            "unconfirmed_balance": "unconfirmedBalance",
            "unconfirmed_balance_sat": "unconfirmedBalanceSat",
            "unconfirmed_tx_apperances": "unconfirmedTxApperances",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
Exemple #9
0
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "balance": "balance",
            "blocks": "blocks",
            "connections": "connections",
            "difficulty": "difficulty",
            "errors": "errors",
            "keypoololdest": "keypoololdest",
            "keypoolsize": "keypoolsize",
            "paytxfee": "paytxfee",
            "protocolversion": "protocolversion",
            "proxy": "proxy",
            "relayfee": "relayfee",
            "testnet": "testnet",
            "timeoffset": "timeoffset",
            "version": "version",
            "walletversion": "walletversion",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {"total_received": "totalReceived"}

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
    def get_stats_for_specified_chain(self):
        """Does a GET request to /api/ethereum/api/.

        TODO: type endpoint description here.

        Returns:
            GetStatsForSpecifiedChainResponse366: Response from the API. 

        Raises:
            APIException: When an error occurs while fetching the data from
                the remote API. This exception includes the HTTP Response
                code, an error message, and the HTTP body that was received in
                the request.

        """
        # The base uri for api requests
        query_builder = Configuration.BASE_URI
 
        # Prepare query string for API call
        query_builder += "/api/ethereum/api/"

        # Validate and preprocess url
        query_url = APIHelper.clean_url(query_builder)

        # Prepare headers
        headers = {
            "user-agent": "APIMATIC 2.0",
            "accept": "application/json"
        }

        # Prepare and invoke the API call request to fetch the response
        response = unirest.get(query_url, headers=headers)

        # Error handling using HTTP status codes
        if response.code < 200 or response.code > 206:  # 200 = HTTP OK
            raise APIException("HTTP Response Not OK", response.code, response.body) 
    
        # Try to cast response to desired type
        if isinstance(response.body, dict):
            # Response is already in a dictionary, return the object 
            return GetStatsForSpecifiedChainResponse366(**response.body)
        
        # If we got here then an error occured while trying to parse the response
        raise APIException("Invalid JSON returned", response.code, response.body) 
Exemple #12
0
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "n": "n",
            "script_pub_key": "scriptPubKey",
            "value_24_34567111": "value 24.34567111",
        }

        retval = dict()

        return APIHelper.resolve_names(self, replace_names, retval)
    def resolve_names(self):
        """Creates a dictionary representation of this object.
        
        This method converts an object to a dictionary that represents the
        format that the model should be in when passed into an API Request.
        Because of this, the generated dictionary may have different
        property names to that of the model itself.
        
        Returns:
            dict: The dictionary representing the object.
        
        """
        # Create a mapping from Model property names to API property names
        replace_names = {
            "bits": "bits",
            "chainwork": "chainwork",
            "confirmations": "confirmations",
            "difficulty": "difficulty",
            "hash": "hash",
            "height": "height",
            "is_main_chain": "isMainChain",
            "merkleroot": "merkleroot",
            "nextblockhash": "nextblockhash",
            "nonce": "nonce",
            "previousblockhash": "previousblockhash",
            "reward": "reward",
            "size": "size",
            "time": "time",
            "tx": "tx",
            "version": "version",
            "pool_info": "poolInfo",
        }

        # Start from the base class
        retval = super(GetBlockByHashResponse, self).resolve_names()

        return APIHelper.resolve_names(self, replace_names, retval)