Skip to content

Commit

Permalink
Merge pull request #325 from immutable/feat/update-zkevm-api-2024-10-…
Browse files Browse the repository at this point in the history
…24-00-36-15

feat: update immutable zkEVM API package
  • Loading branch information
nattb8 authored Oct 24, 2024
2 parents dc65c6e + 62bc4d3 commit eba52c0
Show file tree
Hide file tree
Showing 3 changed files with 373 additions and 0 deletions.
100 changes: 100 additions & 0 deletions src/Packages/ZkEvmApi/Documentation~/StacksApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,109 @@ All URIs are relative to *https://api.sandbox.immutable.com*

| Method | HTTP request | Description |
|--------|--------------|-------------|
| [**ListStacks**](StacksApi.md#liststacks) | **GET** /experimental/chains/{chain_name}/stacks | Experimental: List NFT stacks by stack_id |
| [**SearchNFTs**](StacksApi.md#searchnfts) | **GET** /experimental/chains/{chain_name}/search/nfts | Experimental: Search NFTs |
| [**SearchStacks**](StacksApi.md#searchstacks) | **GET** /experimental/chains/{chain_name}/search/stacks | Experimental: Search NFT stacks |

<a id="liststacks"></a>
# **ListStacks**
> List&lt;StackBundle&gt; ListStacks (string chainName, List<Guid> stackId)
Experimental: List NFT stacks by stack_id

![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks

### Example
```csharp
using System.Collections.Generic;
using System.Diagnostics;
using Immutable.Api.ZkEvm.Api;
using Immutable.Api.ZkEvm.Client;
using Immutable.Api.ZkEvm.Model;

namespace Example
{
public class ListStacksExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.sandbox.immutable.com";
var apiInstance = new StacksApi(config);
var chainName = imtbl-zkevm-testnet; // string | The name of chain
var stackId = new List<Guid>(); // List<Guid> | List of stack_id to filter by
try
{
// Experimental: List NFT stacks by stack_id
List<StackBundle> result = apiInstance.ListStacks(chainName, stackId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling StacksApi.ListStacks: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
```

#### Using the ListStacksWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.

```csharp
try
{
// Experimental: List NFT stacks by stack_id
ApiResponse<List<StackBundle>> response = apiInstance.ListStacksWithHttpInfo(chainName, stackId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling StacksApi.ListStacksWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
```

### Parameters

| Name | Type | Description | Notes |
|------|------|-------------|-------|
| **chainName** | **string** | The name of chain | |
| **stackId** | [**List&lt;Guid&gt;**](Guid.md) | List of stack_id to filter by | |

### Return type

[**List&lt;StackBundle&gt;**](StackBundle.md)

### Authorization

No authorization required

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: application/json


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | 200 response | - |
| **400** | Bad Request (400) | - |
| **401** | Unauthorised Request (401) | - |
| **403** | Forbidden Request (403) | - |
| **404** | The specified resource was not found (404) | - |
| **429** | Too Many Requests (429) | * Retry-After - <br> |
| **500** | Internal Server Error (500) | - |

[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

<a id="searchnfts"></a>
# **SearchNFTs**
> SearchNFTsResult SearchNFTs (string chainName, List<string> contractAddress, string? accountAddress = null, List<Guid>? stackId = null, bool? onlyIncludeOwnerListings = null, int? pageSize = null, string? pageCursor = null)
Expand Down
188 changes: 188 additions & 0 deletions src/Packages/ZkEvmApi/Runtime/Api/StacksApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,29 @@ public interface IStacksApiSync : IApiAccessor
{
#region Synchronous Operations
/// <summary>
/// Experimental: List NFT stacks by stack_id
/// </summary>
/// <remarks>
/// ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </remarks>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <returns>List&lt;StackBundle&gt;</returns>
List<StackBundle> ListStacks(string chainName, List<Guid> stackId);

/// <summary>
/// Experimental: List NFT stacks by stack_id
/// </summary>
/// <remarks>
/// ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </remarks>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <returns>ApiResponse of List&lt;StackBundle&gt;</returns>
ApiResponse<List<StackBundle>> ListStacksWithHttpInfo(string chainName, List<Guid> stackId);
/// <summary>
/// Experimental: Search NFTs
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -109,6 +132,31 @@ public interface IStacksApiAsync : IApiAccessor
{
#region Asynchronous Operations
/// <summary>
/// Experimental: List NFT stacks by stack_id
/// </summary>
/// <remarks>
/// ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </remarks>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of List&lt;StackBundle&gt;</returns>
System.Threading.Tasks.Task<List<StackBundle>> ListStacksAsync(string chainName, List<Guid> stackId, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));

/// <summary>
/// Experimental: List NFT stacks by stack_id
/// </summary>
/// <remarks>
/// ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </remarks>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (List&lt;StackBundle&gt;)</returns>
System.Threading.Tasks.Task<ApiResponse<List<StackBundle>>> ListStacksWithHttpInfoAsync(string chainName, List<Guid> stackId, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken));
/// <summary>
/// Experimental: Search NFTs
/// </summary>
/// <remarks>
Expand Down Expand Up @@ -328,6 +376,146 @@ public Immutable.Api.ZkEvm.Client.ExceptionFactory ExceptionFactory
set { _exceptionFactory = value; }
}

/// <summary>
/// Experimental: List NFT stacks by stack_id ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </summary>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <returns>List&lt;StackBundle&gt;</returns>
public List<StackBundle> ListStacks(string chainName, List<Guid> stackId)
{
Immutable.Api.ZkEvm.Client.ApiResponse<List<StackBundle>> localVarResponse = ListStacksWithHttpInfo(chainName, stackId);
return localVarResponse.Data;
}

/// <summary>
/// Experimental: List NFT stacks by stack_id ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </summary>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <returns>ApiResponse of List&lt;StackBundle&gt;</returns>
public Immutable.Api.ZkEvm.Client.ApiResponse<List<StackBundle>> ListStacksWithHttpInfo(string chainName, List<Guid> stackId)
{
// verify the required parameter 'chainName' is set
if (chainName == null)
throw new Immutable.Api.ZkEvm.Client.ApiException(400, "Missing required parameter 'chainName' when calling StacksApi->ListStacks");

// verify the required parameter 'stackId' is set
if (stackId == null)
throw new Immutable.Api.ZkEvm.Client.ApiException(400, "Missing required parameter 'stackId' when calling StacksApi->ListStacks");

Immutable.Api.ZkEvm.Client.RequestOptions localVarRequestOptions = new Immutable.Api.ZkEvm.Client.RequestOptions();

string[] _contentTypes = new string[] {
};

// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};

var localVarContentType = Immutable.Api.ZkEvm.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);

var localVarAccept = Immutable.Api.ZkEvm.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);

localVarRequestOptions.PathParameters.Add("chain_name", Immutable.Api.ZkEvm.Client.ClientUtils.ParameterToString(chainName)); // path parameter
localVarRequestOptions.QueryParameters.Add(Immutable.Api.ZkEvm.Client.ClientUtils.ParameterToMultiMap("multi", "stack_id", stackId));


// make the HTTP request
var localVarResponse = this.Client.Get<List<StackBundle>>("/experimental/chains/{chain_name}/stacks", localVarRequestOptions, this.Configuration);

if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ListStacks", localVarResponse);
if (_exception != null) throw _exception;
}

return localVarResponse;
}

/// <summary>
/// Experimental: List NFT stacks by stack_id ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </summary>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of List&lt;StackBundle&gt;</returns>
public async System.Threading.Tasks.Task<List<StackBundle>> ListStacksAsync(string chainName, List<Guid> stackId, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
var task = ListStacksWithHttpInfoAsync(chainName, stackId, cancellationToken);
#if UNITY_EDITOR || !UNITY_WEBGL
Immutable.Api.ZkEvm.Client.ApiResponse<List<StackBundle>> localVarResponse = await task.ConfigureAwait(false);
#else
Immutable.Api.ZkEvm.Client.ApiResponse<List<StackBundle>> localVarResponse = await task;
#endif
return localVarResponse.Data;
}

/// <summary>
/// Experimental: List NFT stacks by stack_id ![Experimental](https://img.shields.io/badge/status-experimental-yellow) NFT stacks
/// </summary>
/// <exception cref="Immutable.Api.ZkEvm.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="chainName">The name of chain</param>
/// <param name="stackId">List of stack_id to filter by</param>
/// <param name="cancellationToken">Cancellation Token to cancel the request.</param>
/// <returns>Task of ApiResponse (List&lt;StackBundle&gt;)</returns>
public async System.Threading.Tasks.Task<Immutable.Api.ZkEvm.Client.ApiResponse<List<StackBundle>>> ListStacksWithHttpInfoAsync(string chainName, List<Guid> stackId, System.Threading.CancellationToken cancellationToken = default(global::System.Threading.CancellationToken))
{
// verify the required parameter 'chainName' is set
if (chainName == null)
throw new Immutable.Api.ZkEvm.Client.ApiException(400, "Missing required parameter 'chainName' when calling StacksApi->ListStacks");

// verify the required parameter 'stackId' is set
if (stackId == null)
throw new Immutable.Api.ZkEvm.Client.ApiException(400, "Missing required parameter 'stackId' when calling StacksApi->ListStacks");


Immutable.Api.ZkEvm.Client.RequestOptions localVarRequestOptions = new Immutable.Api.ZkEvm.Client.RequestOptions();

string[] _contentTypes = new string[] {
};

// to determine the Accept header
string[] _accepts = new string[] {
"application/json"
};


var localVarContentType = Immutable.Api.ZkEvm.Client.ClientUtils.SelectHeaderContentType(_contentTypes);
if (localVarContentType != null) localVarRequestOptions.HeaderParameters.Add("Content-Type", localVarContentType);

var localVarAccept = Immutable.Api.ZkEvm.Client.ClientUtils.SelectHeaderAccept(_accepts);
if (localVarAccept != null) localVarRequestOptions.HeaderParameters.Add("Accept", localVarAccept);

localVarRequestOptions.PathParameters.Add("chain_name", Immutable.Api.ZkEvm.Client.ClientUtils.ParameterToString(chainName)); // path parameter
localVarRequestOptions.QueryParameters.Add(Immutable.Api.ZkEvm.Client.ClientUtils.ParameterToMultiMap("multi", "stack_id", stackId));


// make the HTTP request

var task = this.AsynchronousClient.GetAsync<List<StackBundle>>("/experimental/chains/{chain_name}/stacks", localVarRequestOptions, this.Configuration, cancellationToken);

#if UNITY_EDITOR || !UNITY_WEBGL
var localVarResponse = await task.ConfigureAwait(false);
#else
var localVarResponse = await task;
#endif

if (this.ExceptionFactory != null)
{
Exception _exception = this.ExceptionFactory("ListStacks", localVarResponse);
if (_exception != null) throw _exception;
}

return localVarResponse;
}

/// <summary>
/// Experimental: Search NFTs ![Experimental](https://img.shields.io/badge/status-experimental-yellow) Search NFTs
/// </summary>
Expand Down
Loading

0 comments on commit eba52c0

Please sign in to comment.