Skip to content

Latest commit

 

History

History
591 lines (383 loc) · 15.5 KB

BlockAPI.md

File metadata and controls

591 lines (383 loc) · 15.5 KB

\BlockAPI

All URIs are relative to https://api-mainnet.celenium.io/v1

Method HTTP request Description
BlockBlobsCount Get /block/{height}/blobs/count Count of blobs which was pushed by transaction
GetBlock Get /block/{height} Get block info
GetBlockBlobs Get /block/{height}/blobs List blobs which was pushed in the block
GetBlockCount Get /block/count Get count of blocks in network
GetBlockEvents Get /block/{height}/events Get events from begin and end of block
GetBlockMessages Get /block/{height}/messages Get messages contained in the block
GetBlockStats Get /block/{height}/stats Get block stats by height
ListBlock Get /block List blocks info

BlockBlobsCount

int32 BlockBlobsCount(ctx, height).Execute()

Count of blobs which was pushed by transaction

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	height := int32(56) // int32 | Block height

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.BlockBlobsCount(context.Background(), height).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.BlockBlobsCount``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `BlockBlobsCount`: int32
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.BlockBlobsCount`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
height int32 Block height

Other Parameters

Other parameters are passed through a pointer to a apiBlockBlobsCountRequest struct via the builder pattern

Name Type Description Notes

Return type

int32

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetBlock

ResponsesBlock GetBlock(ctx, height).Stats(stats).Execute()

Get block info

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	height := int32(56) // int32 | Block height
	stats := true // bool | Need join stats for block (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.GetBlock(context.Background(), height).Stats(stats).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.GetBlock``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetBlock`: ResponsesBlock
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.GetBlock`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
height int32 Block height

Other Parameters

Other parameters are passed through a pointer to a apiGetBlockRequest struct via the builder pattern

Name Type Description Notes

stats | bool | Need join stats for block |

Return type

ResponsesBlock

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetBlockBlobs

[]ResponsesBlobLog GetBlockBlobs(ctx, height).Limit(limit).Offset(offset).Sort(sort).SortBy(sortBy).Execute()

List blobs which was pushed in the block

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	height := int32(56) // int32 | Block height
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)
	sort := "sort_example" // string | Sort order. Default: desc (optional)
	sortBy := "sortBy_example" // string | Sort field. If it's empty internal id is used (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.GetBlockBlobs(context.Background(), height).Limit(limit).Offset(offset).Sort(sort).SortBy(sortBy).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.GetBlockBlobs``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetBlockBlobs`: []ResponsesBlobLog
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.GetBlockBlobs`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
height int32 Block height

Other Parameters

Other parameters are passed through a pointer to a apiGetBlockBlobsRequest struct via the builder pattern

Name Type Description Notes

limit | int32 | Count of requested entities | offset | int32 | Offset | sort | string | Sort order. Default: desc | sortBy | string | Sort field. If it's empty internal id is used |

Return type

[]ResponsesBlobLog

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetBlockCount

int32 GetBlockCount(ctx).Execute()

Get count of blocks in network

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.GetBlockCount(context.Background()).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.GetBlockCount``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetBlockCount`: int32
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.GetBlockCount`: %v\n", resp)
}

Path Parameters

This endpoint does not need any parameter.

Other Parameters

Other parameters are passed through a pointer to a apiGetBlockCountRequest struct via the builder pattern

Return type

int32

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetBlockEvents

[]ResponsesEvent GetBlockEvents(ctx, height).Limit(limit).Offset(offset).Execute()

Get events from begin and end of block

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	height := int32(56) // int32 | Block height
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.GetBlockEvents(context.Background(), height).Limit(limit).Offset(offset).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.GetBlockEvents``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetBlockEvents`: []ResponsesEvent
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.GetBlockEvents`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
height int32 Block height

Other Parameters

Other parameters are passed through a pointer to a apiGetBlockEventsRequest struct via the builder pattern

Name Type Description Notes

limit | int32 | Count of requested entities | offset | int32 | Offset |

Return type

[]ResponsesEvent

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetBlockMessages

[]ResponsesMessage GetBlockMessages(ctx, height).Limit(limit).Offset(offset).MsgType(msgType).ExcludedMsgType(excludedMsgType).Execute()

Get messages contained in the block

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	height := int32(56) // int32 | Block height
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)
	msgType := "msgType_example" // string | Comma-separated message types list (optional)
	excludedMsgType := "excludedMsgType_example" // string | Comma-separated message types which should be excluded from list (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.GetBlockMessages(context.Background(), height).Limit(limit).Offset(offset).MsgType(msgType).ExcludedMsgType(excludedMsgType).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.GetBlockMessages``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetBlockMessages`: []ResponsesMessage
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.GetBlockMessages`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
height int32 Block height

Other Parameters

Other parameters are passed through a pointer to a apiGetBlockMessagesRequest struct via the builder pattern

Name Type Description Notes

limit | int32 | Count of requested entities | offset | int32 | Offset | msgType | string | Comma-separated message types list | excludedMsgType | string | Comma-separated message types which should be excluded from list |

Return type

[]ResponsesMessage

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetBlockStats

ResponsesBlockStats GetBlockStats(ctx, height).Execute()

Get block stats by height

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	height := int32(56) // int32 | Block height

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.GetBlockStats(context.Background(), height).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.GetBlockStats``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetBlockStats`: ResponsesBlockStats
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.GetBlockStats`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
height int32 Block height

Other Parameters

Other parameters are passed through a pointer to a apiGetBlockStatsRequest struct via the builder pattern

Name Type Description Notes

Return type

ResponsesBlockStats

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]

ListBlock

[]ResponsesBlock ListBlock(ctx).Limit(limit).Offset(offset).Sort(sort).Stats(stats).Execute()

List blocks info

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/celenium-io/celenium-api-go"
)

func main() {
	limit := int32(56) // int32 | Count of requested entities (optional)
	offset := int32(56) // int32 | Offset (optional)
	sort := "sort_example" // string | Sort order (optional)
	stats := true // bool | Need join stats for block (optional)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.BlockAPI.ListBlock(context.Background()).Limit(limit).Offset(offset).Sort(sort).Stats(stats).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `BlockAPI.ListBlock``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `ListBlock`: []ResponsesBlock
	fmt.Fprintf(os.Stdout, "Response from `BlockAPI.ListBlock`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiListBlockRequest struct via the builder pattern

Name Type Description Notes
limit int32 Count of requested entities
offset int32 Offset
sort string Sort order
stats bool Need join stats for block

Return type

[]ResponsesBlock

Authorization

No authorization required

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to README]