github.com/aeternity/aepp-sdk-go/v4@v4.0.1/swagguard/compiler/client/operations/operations_client.go (about)

     1  // Code generated by go-swagger; DO NOT EDIT.
     2  
     3  package operations
     4  
     5  // This file was generated by the swagger tool.
     6  // Editing this file might prove futile when you re-run the swagger generate command
     7  
     8  import (
     9  	"github.com/go-openapi/runtime"
    10  
    11  	strfmt "github.com/go-openapi/strfmt"
    12  )
    13  
    14  // New creates a new operations API client.
    15  func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client {
    16  	return &Client{transport: transport, formats: formats}
    17  }
    18  
    19  /*
    20  Client for operations API
    21  */
    22  type Client struct {
    23  	transport runtime.ClientTransport
    24  	formats   strfmt.Registry
    25  }
    26  
    27  /*
    28  APIVersion Get the version of the API
    29  */
    30  func (a *Client) APIVersion(params *APIVersionParams) (*APIVersionOK, error) {
    31  	// TODO: Validate the params before sending
    32  	if params == nil {
    33  		params = NewAPIVersionParams()
    34  	}
    35  
    36  	result, err := a.transport.Submit(&runtime.ClientOperation{
    37  		ID:                 "APIVersion",
    38  		Method:             "GET",
    39  		PathPattern:        "/api-version",
    40  		ProducesMediaTypes: []string{"application/json"},
    41  		ConsumesMediaTypes: []string{""},
    42  		Schemes:            []string{"http"},
    43  		Params:             params,
    44  		Reader:             &APIVersionReader{formats: a.formats},
    45  		Context:            params.Context,
    46  		Client:             params.HTTPClient,
    47  	})
    48  	if err != nil {
    49  		return nil, err
    50  	}
    51  	return result.(*APIVersionOK), nil
    52  
    53  }
    54  
    55  /*
    56  API Get the Api description
    57  */
    58  func (a *Client) API(params *APIParams) (*APIOK, error) {
    59  	// TODO: Validate the params before sending
    60  	if params == nil {
    61  		params = NewAPIParams()
    62  	}
    63  
    64  	result, err := a.transport.Submit(&runtime.ClientOperation{
    65  		ID:                 "Api",
    66  		Method:             "GET",
    67  		PathPattern:        "/api",
    68  		ProducesMediaTypes: []string{"application/json"},
    69  		ConsumesMediaTypes: []string{""},
    70  		Schemes:            []string{"http"},
    71  		Params:             params,
    72  		Reader:             &APIReader{formats: a.formats},
    73  		Context:            params.Context,
    74  		Client:             params.HTTPClient,
    75  	})
    76  	if err != nil {
    77  		return nil, err
    78  	}
    79  	return result.(*APIOK), nil
    80  
    81  }
    82  
    83  /*
    84  CompileContract Compile a sophia contract from source and return byte code
    85  */
    86  func (a *Client) CompileContract(params *CompileContractParams) (*CompileContractOK, error) {
    87  	// TODO: Validate the params before sending
    88  	if params == nil {
    89  		params = NewCompileContractParams()
    90  	}
    91  
    92  	result, err := a.transport.Submit(&runtime.ClientOperation{
    93  		ID:                 "CompileContract",
    94  		Method:             "POST",
    95  		PathPattern:        "/compile",
    96  		ProducesMediaTypes: []string{"application/json"},
    97  		ConsumesMediaTypes: []string{"application/json"},
    98  		Schemes:            []string{"http"},
    99  		Params:             params,
   100  		Reader:             &CompileContractReader{formats: a.formats},
   101  		Context:            params.Context,
   102  		Client:             params.HTTPClient,
   103  	})
   104  	if err != nil {
   105  		return nil, err
   106  	}
   107  	return result.(*CompileContractOK), nil
   108  
   109  }
   110  
   111  /*
   112  DecodeCallResult Decode the result of contract call
   113  */
   114  func (a *Client) DecodeCallResult(params *DecodeCallResultParams) (*DecodeCallResultOK, error) {
   115  	// TODO: Validate the params before sending
   116  	if params == nil {
   117  		params = NewDecodeCallResultParams()
   118  	}
   119  
   120  	result, err := a.transport.Submit(&runtime.ClientOperation{
   121  		ID:                 "DecodeCallResult",
   122  		Method:             "POST",
   123  		PathPattern:        "/decode-call-result",
   124  		ProducesMediaTypes: []string{"application/json"},
   125  		ConsumesMediaTypes: []string{"application/json"},
   126  		Schemes:            []string{"http"},
   127  		Params:             params,
   128  		Reader:             &DecodeCallResultReader{formats: a.formats},
   129  		Context:            params.Context,
   130  		Client:             params.HTTPClient,
   131  	})
   132  	if err != nil {
   133  		return nil, err
   134  	}
   135  	return result.(*DecodeCallResultOK), nil
   136  
   137  }
   138  
   139  /*
   140  DecodeCalldataBytecode Identify function name and arguments in Calldata for a compiled contract
   141  */
   142  func (a *Client) DecodeCalldataBytecode(params *DecodeCalldataBytecodeParams) (*DecodeCalldataBytecodeOK, error) {
   143  	// TODO: Validate the params before sending
   144  	if params == nil {
   145  		params = NewDecodeCalldataBytecodeParams()
   146  	}
   147  
   148  	result, err := a.transport.Submit(&runtime.ClientOperation{
   149  		ID:                 "DecodeCalldataBytecode",
   150  		Method:             "POST",
   151  		PathPattern:        "/decode-calldata/bytecode",
   152  		ProducesMediaTypes: []string{"application/json"},
   153  		ConsumesMediaTypes: []string{"application/json"},
   154  		Schemes:            []string{"http"},
   155  		Params:             params,
   156  		Reader:             &DecodeCalldataBytecodeReader{formats: a.formats},
   157  		Context:            params.Context,
   158  		Client:             params.HTTPClient,
   159  	})
   160  	if err != nil {
   161  		return nil, err
   162  	}
   163  	return result.(*DecodeCalldataBytecodeOK), nil
   164  
   165  }
   166  
   167  /*
   168  DecodeCalldataSource Identify function name and arguments in Calldata for a (partial) contract
   169  */
   170  func (a *Client) DecodeCalldataSource(params *DecodeCalldataSourceParams) (*DecodeCalldataSourceOK, error) {
   171  	// TODO: Validate the params before sending
   172  	if params == nil {
   173  		params = NewDecodeCalldataSourceParams()
   174  	}
   175  
   176  	result, err := a.transport.Submit(&runtime.ClientOperation{
   177  		ID:                 "DecodeCalldataSource",
   178  		Method:             "POST",
   179  		PathPattern:        "/decode-calldata/source",
   180  		ProducesMediaTypes: []string{"application/json"},
   181  		ConsumesMediaTypes: []string{"application/json"},
   182  		Schemes:            []string{"http"},
   183  		Params:             params,
   184  		Reader:             &DecodeCalldataSourceReader{formats: a.formats},
   185  		Context:            params.Context,
   186  		Client:             params.HTTPClient,
   187  	})
   188  	if err != nil {
   189  		return nil, err
   190  	}
   191  	return result.(*DecodeCalldataSourceOK), nil
   192  
   193  }
   194  
   195  /*
   196  DecodeData Decode data as retuned by a contract call. - Legacy decoding
   197  */
   198  func (a *Client) DecodeData(params *DecodeDataParams) (*DecodeDataOK, error) {
   199  	// TODO: Validate the params before sending
   200  	if params == nil {
   201  		params = NewDecodeDataParams()
   202  	}
   203  
   204  	result, err := a.transport.Submit(&runtime.ClientOperation{
   205  		ID:                 "DecodeData",
   206  		Method:             "POST",
   207  		PathPattern:        "/decode-data",
   208  		ProducesMediaTypes: []string{"application/json"},
   209  		ConsumesMediaTypes: []string{"application/json"},
   210  		Schemes:            []string{"http"},
   211  		Params:             params,
   212  		Reader:             &DecodeDataReader{formats: a.formats},
   213  		Context:            params.Context,
   214  		Client:             params.HTTPClient,
   215  	})
   216  	if err != nil {
   217  		return nil, err
   218  	}
   219  	return result.(*DecodeDataOK), nil
   220  
   221  }
   222  
   223  /*
   224  EncodeCalldata Encode Sophia function call according to sophia ABI.
   225  */
   226  func (a *Client) EncodeCalldata(params *EncodeCalldataParams) (*EncodeCalldataOK, error) {
   227  	// TODO: Validate the params before sending
   228  	if params == nil {
   229  		params = NewEncodeCalldataParams()
   230  	}
   231  
   232  	result, err := a.transport.Submit(&runtime.ClientOperation{
   233  		ID:                 "EncodeCalldata",
   234  		Method:             "POST",
   235  		PathPattern:        "/encode-calldata",
   236  		ProducesMediaTypes: []string{"application/json"},
   237  		ConsumesMediaTypes: []string{"application/json"},
   238  		Schemes:            []string{"http"},
   239  		Params:             params,
   240  		Reader:             &EncodeCalldataReader{formats: a.formats},
   241  		Context:            params.Context,
   242  		Client:             params.HTTPClient,
   243  	})
   244  	if err != nil {
   245  		return nil, err
   246  	}
   247  	return result.(*EncodeCalldataOK), nil
   248  
   249  }
   250  
   251  /*
   252  GenerateACI Generate an Aeternity Contract Interface (ACI) for contract
   253  */
   254  func (a *Client) GenerateACI(params *GenerateACIParams) (*GenerateACIOK, error) {
   255  	// TODO: Validate the params before sending
   256  	if params == nil {
   257  		params = NewGenerateACIParams()
   258  	}
   259  
   260  	result, err := a.transport.Submit(&runtime.ClientOperation{
   261  		ID:                 "GenerateACI",
   262  		Method:             "POST",
   263  		PathPattern:        "/aci",
   264  		ProducesMediaTypes: []string{"application/json"},
   265  		ConsumesMediaTypes: []string{"application/json"},
   266  		Schemes:            []string{"http"},
   267  		Params:             params,
   268  		Reader:             &GenerateACIReader{formats: a.formats},
   269  		Context:            params.Context,
   270  		Client:             params.HTTPClient,
   271  	})
   272  	if err != nil {
   273  		return nil, err
   274  	}
   275  	return result.(*GenerateACIOK), nil
   276  
   277  }
   278  
   279  /*
   280  Version Get the version of the underlying Sophia compiler version
   281  */
   282  func (a *Client) Version(params *VersionParams) (*VersionOK, error) {
   283  	// TODO: Validate the params before sending
   284  	if params == nil {
   285  		params = NewVersionParams()
   286  	}
   287  
   288  	result, err := a.transport.Submit(&runtime.ClientOperation{
   289  		ID:                 "Version",
   290  		Method:             "GET",
   291  		PathPattern:        "/version",
   292  		ProducesMediaTypes: []string{"application/json"},
   293  		ConsumesMediaTypes: []string{""},
   294  		Schemes:            []string{"http"},
   295  		Params:             params,
   296  		Reader:             &VersionReader{formats: a.formats},
   297  		Context:            params.Context,
   298  		Client:             params.HTTPClient,
   299  	})
   300  	if err != nil {
   301  		return nil, err
   302  	}
   303  	return result.(*VersionOK), nil
   304  
   305  }
   306  
   307  // SetTransport changes the transport on the client
   308  func (a *Client) SetTransport(transport runtime.ClientTransport) {
   309  	a.transport = transport
   310  }