diff --git a/go.mod b/go.mod index 79d7441..a830e74 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.25 require ( github.com/ardanlabs/conf v1.5.0 + github.com/google/gnostic v0.7.1 github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.3 github.com/pkg/errors v0.9.1 github.com/qubic/go-node-connector v0.15.0 @@ -19,10 +20,12 @@ require ( github.com/cloudflare/circl v1.6.1 // indirect github.com/consensys/gnark-crypto v0.19.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/google/gnostic-models v0.7.0 // indirect github.com/linckode/circl v1.3.71 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/silenceper/pool v1.0.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/crypto v0.45.0 // indirect golang.org/x/net v0.47.0 // indirect golang.org/x/sys v0.38.0 // indirect diff --git a/go.sum b/go.sum index 63bf7fb..9123c09 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,10 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/gnostic v0.7.1 h1:t5Kc7j/8kYr8t2u11rykRrPPovlEMG4+xdc/SpekATs= +github.com/google/gnostic v0.7.1/go.mod h1:KSw6sxnxEBFM8jLPfJd46xZP+yQcfE8XkiqfZx5zR28= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= @@ -68,6 +72,8 @@ go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6 go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= diff --git a/protobuff/Makefile b/protobuff/Makefile index 66bcd1a..bee159e 100644 --- a/protobuff/Makefile +++ b/protobuff/Makefile @@ -21,7 +21,7 @@ PB = $(wildcard *.proto) GO = $(PB:.proto=.pb.go) PWD = $(pwd) -all: $(GO) openapi +all: $(GO) openapi-v3 %.pb.go: %.proto protoc -I=. --go-grpc_out=paths=source_relative:. \ @@ -31,10 +31,8 @@ all: $(GO) openapi --grpc-gateway_opt generate_unbound_methods=true $(OPT_ARGS) \ --go_out=paths=source_relative:. *.proto -openapi: *.proto - protoc --openapiv2_out=logtostderr=true:. \ - *.proto -# --proto_path=.:/opt/homebrew/Cellar/protobuf/25.3_1/include \ +openapi-v3: + protoc -I=. --openapi_out=output_mode=source_relative,default_response=false:. *.proto clean: rm -f *.pb.go diff --git a/protobuff/installGoPlugins.sh b/protobuff/installGoPlugins.sh index 13a4660..19e968b 100755 --- a/protobuff/installGoPlugins.sh +++ b/protobuff/installGoPlugins.sh @@ -1,4 +1,4 @@ go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@v2.19.1 -go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@v2.19.1 -go install google.golang.org/protobuf/cmd/protoc-gen-go -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc \ No newline at end of file +go install github.com/google/gnostic/cmd/protoc-gen-openapi@latest +go install google.golang.org/protobuf/cmd/protoc-gen-go@latest +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest \ No newline at end of file diff --git a/protobuff/openapiv3/OpenAPIv3.proto b/protobuff/openapiv3/OpenAPIv3.proto new file mode 100644 index 0000000..aaa2581 --- /dev/null +++ b/protobuff/openapiv3/OpenAPIv3.proto @@ -0,0 +1,671 @@ +// Copyright 2020 Google LLC. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// THIS FILE IS AUTOMATICALLY GENERATED. + +syntax = "proto3"; + +package openapi.v3; + +import "google/protobuf/any.proto"; + +// This option lets the proto compiler generate Java code inside the package +// name (see below) instead of inside an outer class. It creates a simpler +// developer experience by reducing one-level of name nesting and be +// consistent with most programming languages that don't support outer classes. +option java_multiple_files = true; + +// The Java outer classname should be the filename in UpperCamelCase. This +// class is only used to hold proto descriptor, so developers don't need to +// work with it directly. +option java_outer_classname = "OpenAPIProto"; + +// The Java package name must be proto package name with proper prefix. +option java_package = "org.openapi_v3"; + +// A reasonable prefix for the Objective-C symbols generated from the package. +// It should at a minimum be 3 characters long, all uppercase, and convention +// is to use an abbreviation of the package name. Something short, but +// hopefully unique enough to not conflict with things that may come along in +// the future. 'GPB' is reserved for the protocol buffer implementation itself. +option objc_class_prefix = "OAS"; + +// The Go package name. +option go_package = "github.com/google/gnostic/openapiv3;openapi_v3"; + +message AdditionalPropertiesItem { + oneof oneof { + SchemaOrReference schema_or_reference = 1; + bool boolean = 2; + } +} + +message Any { + google.protobuf.Any value = 1; + string yaml = 2; +} + +message AnyOrExpression { + oneof oneof { + Any any = 1; + Expression expression = 2; + } +} + +// A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation. +message Callback { + repeated NamedPathItem path = 1; + repeated NamedAny specification_extension = 2; +} + +message CallbackOrReference { + oneof oneof { + Callback callback = 1; + Reference reference = 2; + } +} + +message CallbacksOrReferences { + repeated NamedCallbackOrReference additional_properties = 1; +} + +// Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object. +message Components { + SchemasOrReferences schemas = 1; + ResponsesOrReferences responses = 2; + ParametersOrReferences parameters = 3; + ExamplesOrReferences examples = 4; + RequestBodiesOrReferences request_bodies = 5; + HeadersOrReferences headers = 6; + SecuritySchemesOrReferences security_schemes = 7; + LinksOrReferences links = 8; + CallbacksOrReferences callbacks = 9; + repeated NamedAny specification_extension = 10; +} + +// Contact information for the exposed API. +message Contact { + string name = 1; + string url = 2; + string email = 3; + repeated NamedAny specification_extension = 4; +} + +message DefaultType { + oneof oneof { + double number = 1; + bool boolean = 2; + string string = 3; + } +} + +// When request bodies or response payloads may be one of a number of different schemas, a `discriminator` object can be used to aid in serialization, deserialization, and validation. The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it. When using the discriminator, _inline_ schemas will not be considered. +message Discriminator { + string property_name = 1; + Strings mapping = 2; + repeated NamedAny specification_extension = 3; +} + +message Document { + string openapi = 1; + Info info = 2; + repeated Server servers = 3; + Paths paths = 4; + Components components = 5; + repeated SecurityRequirement security = 6; + repeated Tag tags = 7; + ExternalDocs external_docs = 8; + repeated NamedAny specification_extension = 9; +} + +// A single encoding definition applied to a single schema property. +message Encoding { + string content_type = 1; + HeadersOrReferences headers = 2; + string style = 3; + bool explode = 4; + bool allow_reserved = 5; + repeated NamedAny specification_extension = 6; +} + +message Encodings { + repeated NamedEncoding additional_properties = 1; +} + +message Example { + string summary = 1; + string description = 2; + Any value = 3; + string external_value = 4; + repeated NamedAny specification_extension = 5; +} + +message ExampleOrReference { + oneof oneof { + Example example = 1; + Reference reference = 2; + } +} + +message ExamplesOrReferences { + repeated NamedExampleOrReference additional_properties = 1; +} + +message Expression { + repeated NamedAny additional_properties = 1; +} + +// Allows referencing an external resource for extended documentation. +message ExternalDocs { + string description = 1; + string url = 2; + repeated NamedAny specification_extension = 3; +} + +// The Header Object follows the structure of the Parameter Object with the following changes: 1. `name` MUST NOT be specified, it is given in the corresponding `headers` map. 1. `in` MUST NOT be specified, it is implicitly in `header`. 1. All traits that are affected by the location MUST be applicable to a location of `header` (for example, `style`). +message Header { + string description = 1; + bool required = 2; + bool deprecated = 3; + bool allow_empty_value = 4; + string style = 5; + bool explode = 6; + bool allow_reserved = 7; + SchemaOrReference schema = 8; + Any example = 9; + ExamplesOrReferences examples = 10; + MediaTypes content = 11; + repeated NamedAny specification_extension = 12; +} + +message HeaderOrReference { + oneof oneof { + Header header = 1; + Reference reference = 2; + } +} + +message HeadersOrReferences { + repeated NamedHeaderOrReference additional_properties = 1; +} + +// The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience. +message Info { + string title = 1; + string description = 2; + string terms_of_service = 3; + Contact contact = 4; + License license = 5; + string version = 6; + repeated NamedAny specification_extension = 7; + string summary = 8; +} + +message ItemsItem { + repeated SchemaOrReference schema_or_reference = 1; +} + +// License information for the exposed API. +message License { + string name = 1; + string url = 2; + repeated NamedAny specification_extension = 3; +} + +// The `Link object` represents a possible design-time link for a response. The presence of a link does not guarantee the caller's ability to successfully invoke it, rather it provides a known relationship and traversal mechanism between responses and other operations. Unlike _dynamic_ links (i.e. links provided **in** the response payload), the OAS linking mechanism does not require link information in the runtime response. For computing links, and providing instructions to execute them, a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation. +message Link { + string operation_ref = 1; + string operation_id = 2; + AnyOrExpression parameters = 3; + AnyOrExpression request_body = 4; + string description = 5; + Server server = 6; + repeated NamedAny specification_extension = 7; +} + +message LinkOrReference { + oneof oneof { + Link link = 1; + Reference reference = 2; + } +} + +message LinksOrReferences { + repeated NamedLinkOrReference additional_properties = 1; +} + +// Each Media Type Object provides schema and examples for the media type identified by its key. +message MediaType { + SchemaOrReference schema = 1; + Any example = 2; + ExamplesOrReferences examples = 3; + Encodings encoding = 4; + repeated NamedAny specification_extension = 5; +} + +message MediaTypes { + repeated NamedMediaType additional_properties = 1; +} + +// Automatically-generated message used to represent maps of Any as ordered (name,value) pairs. +message NamedAny { + // Map key + string name = 1; + // Mapped value + Any value = 2; +} + +// Automatically-generated message used to represent maps of CallbackOrReference as ordered (name,value) pairs. +message NamedCallbackOrReference { + // Map key + string name = 1; + // Mapped value + CallbackOrReference value = 2; +} + +// Automatically-generated message used to represent maps of Encoding as ordered (name,value) pairs. +message NamedEncoding { + // Map key + string name = 1; + // Mapped value + Encoding value = 2; +} + +// Automatically-generated message used to represent maps of ExampleOrReference as ordered (name,value) pairs. +message NamedExampleOrReference { + // Map key + string name = 1; + // Mapped value + ExampleOrReference value = 2; +} + +// Automatically-generated message used to represent maps of HeaderOrReference as ordered (name,value) pairs. +message NamedHeaderOrReference { + // Map key + string name = 1; + // Mapped value + HeaderOrReference value = 2; +} + +// Automatically-generated message used to represent maps of LinkOrReference as ordered (name,value) pairs. +message NamedLinkOrReference { + // Map key + string name = 1; + // Mapped value + LinkOrReference value = 2; +} + +// Automatically-generated message used to represent maps of MediaType as ordered (name,value) pairs. +message NamedMediaType { + // Map key + string name = 1; + // Mapped value + MediaType value = 2; +} + +// Automatically-generated message used to represent maps of ParameterOrReference as ordered (name,value) pairs. +message NamedParameterOrReference { + // Map key + string name = 1; + // Mapped value + ParameterOrReference value = 2; +} + +// Automatically-generated message used to represent maps of PathItem as ordered (name,value) pairs. +message NamedPathItem { + // Map key + string name = 1; + // Mapped value + PathItem value = 2; +} + +// Automatically-generated message used to represent maps of RequestBodyOrReference as ordered (name,value) pairs. +message NamedRequestBodyOrReference { + // Map key + string name = 1; + // Mapped value + RequestBodyOrReference value = 2; +} + +// Automatically-generated message used to represent maps of ResponseOrReference as ordered (name,value) pairs. +message NamedResponseOrReference { + // Map key + string name = 1; + // Mapped value + ResponseOrReference value = 2; +} + +// Automatically-generated message used to represent maps of SchemaOrReference as ordered (name,value) pairs. +message NamedSchemaOrReference { + // Map key + string name = 1; + // Mapped value + SchemaOrReference value = 2; +} + +// Automatically-generated message used to represent maps of SecuritySchemeOrReference as ordered (name,value) pairs. +message NamedSecuritySchemeOrReference { + // Map key + string name = 1; + // Mapped value + SecuritySchemeOrReference value = 2; +} + +// Automatically-generated message used to represent maps of ServerVariable as ordered (name,value) pairs. +message NamedServerVariable { + // Map key + string name = 1; + // Mapped value + ServerVariable value = 2; +} + +// Automatically-generated message used to represent maps of string as ordered (name,value) pairs. +message NamedString { + // Map key + string name = 1; + // Mapped value + string value = 2; +} + +// Automatically-generated message used to represent maps of StringArray as ordered (name,value) pairs. +message NamedStringArray { + // Map key + string name = 1; + // Mapped value + StringArray value = 2; +} + +// Configuration details for a supported OAuth Flow +message OauthFlow { + string authorization_url = 1; + string token_url = 2; + string refresh_url = 3; + Strings scopes = 4; + repeated NamedAny specification_extension = 5; +} + +// Allows configuration of the supported OAuth Flows. +message OauthFlows { + OauthFlow implicit = 1; + OauthFlow password = 2; + OauthFlow client_credentials = 3; + OauthFlow authorization_code = 4; + repeated NamedAny specification_extension = 5; +} + +message Object { + repeated NamedAny additional_properties = 1; +} + +// Describes a single API operation on a path. +message Operation { + repeated string tags = 1; + string summary = 2; + string description = 3; + ExternalDocs external_docs = 4; + string operation_id = 5; + repeated ParameterOrReference parameters = 6; + RequestBodyOrReference request_body = 7; + Responses responses = 8; + CallbacksOrReferences callbacks = 9; + bool deprecated = 10; + repeated SecurityRequirement security = 11; + repeated Server servers = 12; + repeated NamedAny specification_extension = 13; +} + +// Describes a single operation parameter. A unique parameter is defined by a combination of a name and location. +message Parameter { + string name = 1; + string in = 2; + string description = 3; + bool required = 4; + bool deprecated = 5; + bool allow_empty_value = 6; + string style = 7; + bool explode = 8; + bool allow_reserved = 9; + SchemaOrReference schema = 10; + Any example = 11; + ExamplesOrReferences examples = 12; + MediaTypes content = 13; + repeated NamedAny specification_extension = 14; +} + +message ParameterOrReference { + oneof oneof { + Parameter parameter = 1; + Reference reference = 2; + } +} + +message ParametersOrReferences { + repeated NamedParameterOrReference additional_properties = 1; +} + +// Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available. +message PathItem { + string _ref = 1; + string summary = 2; + string description = 3; + Operation get = 4; + Operation put = 5; + Operation post = 6; + Operation delete = 7; + Operation options = 8; + Operation head = 9; + Operation patch = 10; + Operation trace = 11; + repeated Server servers = 12; + repeated ParameterOrReference parameters = 13; + repeated NamedAny specification_extension = 14; +} + +// Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints. +message Paths { + repeated NamedPathItem path = 1; + repeated NamedAny specification_extension = 2; +} + +message Properties { + repeated NamedSchemaOrReference additional_properties = 1; +} + +// A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification. +message Reference { + string _ref = 1; + string summary = 2; + string description = 3; +} + +message RequestBodiesOrReferences { + repeated NamedRequestBodyOrReference additional_properties = 1; +} + +// Describes a single request body. +message RequestBody { + string description = 1; + MediaTypes content = 2; + bool required = 3; + repeated NamedAny specification_extension = 4; +} + +message RequestBodyOrReference { + oneof oneof { + RequestBody request_body = 1; + Reference reference = 2; + } +} + +// Describes a single response from an API Operation, including design-time, static `links` to operations based on the response. +message Response { + string description = 1; + HeadersOrReferences headers = 2; + MediaTypes content = 3; + LinksOrReferences links = 4; + repeated NamedAny specification_extension = 5; +} + +message ResponseOrReference { + oneof oneof { + Response response = 1; + Reference reference = 2; + } +} + +// A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call. +message Responses { + ResponseOrReference default = 1; + repeated NamedResponseOrReference response_or_reference = 2; + repeated NamedAny specification_extension = 3; +} + +message ResponsesOrReferences { + repeated NamedResponseOrReference additional_properties = 1; +} + +// The Schema Object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. This object is an extended subset of the JSON Schema Specification Wright Draft 00. For more information about the properties, see JSON Schema Core and JSON Schema Validation. Unless stated otherwise, the property definitions follow the JSON Schema. +message Schema { + bool nullable = 1; + Discriminator discriminator = 2; + bool read_only = 3; + bool write_only = 4; + Xml xml = 5; + ExternalDocs external_docs = 6; + Any example = 7; + bool deprecated = 8; + string title = 9; + double multiple_of = 10; + double maximum = 11; + bool exclusive_maximum = 12; + double minimum = 13; + bool exclusive_minimum = 14; + int64 max_length = 15; + int64 min_length = 16; + string pattern = 17; + int64 max_items = 18; + int64 min_items = 19; + bool unique_items = 20; + int64 max_properties = 21; + int64 min_properties = 22; + repeated string required = 23; + repeated Any enum = 24; + string type = 25; + repeated SchemaOrReference all_of = 26; + repeated SchemaOrReference one_of = 27; + repeated SchemaOrReference any_of = 28; + Schema not = 29; + ItemsItem items = 30; + Properties properties = 31; + AdditionalPropertiesItem additional_properties = 32; + DefaultType default = 33; + string description = 34; + string format = 35; + repeated NamedAny specification_extension = 36; +} + +message SchemaOrReference { + oneof oneof { + Schema schema = 1; + Reference reference = 2; + } +} + +message SchemasOrReferences { + repeated NamedSchemaOrReference additional_properties = 1; +} + +// Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the OpenAPI Object or Operation Object, only one of the Security Requirement Objects in the list needs to be satisfied to authorize the request. +message SecurityRequirement { + repeated NamedStringArray additional_properties = 1; +} + +// Defines a security scheme that can be used by the operations. Supported schemes are HTTP authentication, an API key (either as a header, a cookie parameter or as a query parameter), mutual TLS (use of a client certificate), OAuth2's common flows (implicit, password, application and access code) as defined in RFC6749, and OpenID Connect. Please note that currently (2019) the implicit flow is about to be deprecated OAuth 2.0 Security Best Current Practice. Recommended for most use case is Authorization Code Grant flow with PKCE. +message SecurityScheme { + string type = 1; + string description = 2; + string name = 3; + string in = 4; + string scheme = 5; + string bearer_format = 6; + OauthFlows flows = 7; + string open_id_connect_url = 8; + repeated NamedAny specification_extension = 9; +} + +message SecuritySchemeOrReference { + oneof oneof { + SecurityScheme security_scheme = 1; + Reference reference = 2; + } +} + +message SecuritySchemesOrReferences { + repeated NamedSecuritySchemeOrReference additional_properties = 1; +} + +// An object representing a Server. +message Server { + string url = 1; + string description = 2; + ServerVariables variables = 3; + repeated NamedAny specification_extension = 4; +} + +// An object representing a Server Variable for server URL template substitution. +message ServerVariable { + repeated string enum = 1; + string default = 2; + string description = 3; + repeated NamedAny specification_extension = 4; +} + +message ServerVariables { + repeated NamedServerVariable additional_properties = 1; +} + +// Any property starting with x- is valid. +message SpecificationExtension { + oneof oneof { + double number = 1; + bool boolean = 2; + string string = 3; + } +} + +message StringArray { + repeated string value = 1; +} + +message Strings { + repeated NamedString additional_properties = 1; +} + +// Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances. +message Tag { + string name = 1; + string description = 2; + ExternalDocs external_docs = 3; + repeated NamedAny specification_extension = 4; +} + +// A metadata object that allows for more fine-tuned XML model definitions. When using arrays, XML element names are *not* inferred (for singular/plural forms) and the `name` property SHOULD be used to add that information. See examples for expected behavior. +message Xml { + string name = 1; + string namespace = 2; + string prefix = 3; + bool attribute = 4; + bool wrapped = 5; + repeated NamedAny specification_extension = 6; +} \ No newline at end of file diff --git a/protobuff/openapiv3/annotations.proto b/protobuff/openapiv3/annotations.proto new file mode 100644 index 0000000..0bd8781 --- /dev/null +++ b/protobuff/openapiv3/annotations.proto @@ -0,0 +1,60 @@ +// Copyright 2022 Google LLC. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package openapi.v3; + +import "openapiv3/OpenAPIv3.proto"; +import "google/protobuf/descriptor.proto"; + +// This option lets the proto compiler generate Java code inside the package +// name (see below) instead of inside an outer class. It creates a simpler +// developer experience by reducing one-level of name nesting and be +// consistent with most programming languages that don't support outer classes. +option java_multiple_files = true; + +// The Java outer classname should be the filename in UpperCamelCase. This +// class is only used to hold proto descriptor, so developers don't need to +// work with it directly. +option java_outer_classname = "AnnotationsProto"; + +// The Java package name must be proto package name with proper prefix. +option java_package = "org.openapi_v3"; + +// A reasonable prefix for the Objective-C symbols generated from the package. +// It should at a minimum be 3 characters long, all uppercase, and convention +// is to use an abbreviation of the package name. Something short, but +// hopefully unique enough to not conflict with things that may come along in +// the future. 'GPB' is reserved for the protocol buffer implementation itself. +option objc_class_prefix = "OAS"; + +// The Go package name. +option go_package = "github.com/google/gnostic/openapiv3;openapi_v3"; + +extend google.protobuf.FileOptions { + Document document = 1143; +} + +extend google.protobuf.MethodOptions { + Operation operation = 1143; +} + +extend google.protobuf.MessageOptions { + Schema schema = 1143; +} + +extend google.protobuf.FieldOptions { + Schema property = 1143; +} \ No newline at end of file diff --git a/protobuff/protoc_gen_openapiv2/options/annotations.proto b/protobuff/protoc_gen_openapiv2/options/annotations.proto deleted file mode 100644 index 6c9a7f7..0000000 --- a/protobuff/protoc_gen_openapiv2/options/annotations.proto +++ /dev/null @@ -1,52 +0,0 @@ -syntax = "proto3"; - -package grpc.gateway.protoc_gen_openapiv2.options; - -import "google/protobuf/descriptor.proto"; -import "protoc_gen_openapiv2/options/openapiv2.proto"; -option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; - -// see https://github.com/grpc-ecosystem/grpc-gateway/blob/main/protoc-gen-openapiv2/options/annotations.proto - -extend google.protobuf.FileOptions { - // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Swagger openapiv2_swagger = 1042; -} -extend google.protobuf.MethodOptions { - // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Operation openapiv2_operation = 1042; -} -extend google.protobuf.MessageOptions { - // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Schema openapiv2_schema = 1042; -} -extend google.protobuf.EnumOptions { - // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - EnumSchema openapiv2_enum = 1042; -} -extend google.protobuf.ServiceOptions { - // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - Tag openapiv2_tag = 1042; -} -extend google.protobuf.FieldOptions { - // ID assigned by protobuf-global-extension-registry@google.com for gRPC-Gateway project. - // - // All IDs are the same, as assigned. It is okay that they are the same, as they extend - // different descriptor messages. - JSONSchema openapiv2_field = 1042; -} diff --git a/protobuff/protoc_gen_openapiv2/options/openapiv2.proto b/protobuff/protoc_gen_openapiv2/options/openapiv2.proto deleted file mode 100644 index 12422b7..0000000 --- a/protobuff/protoc_gen_openapiv2/options/openapiv2.proto +++ /dev/null @@ -1,293 +0,0 @@ -syntax = "proto3"; - -package grpc.gateway.protoc_gen_openapiv2.options; - -import "google/protobuf/struct.proto"; - -option go_package = "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"; - -// see https://github.com/grpc-ecosystem/grpc-gateway/blob/main/protoc-gen-openapiv2/options/openapiv2.proto - -// Scheme describes the schemes supported by the OpenAPI Swagger -// and Operation objects. -enum Scheme { - UNKNOWN = 0; - HTTP = 1; - HTTPS = 2; - WS = 3; - WSS = 4; -} - -// `Swagger` is a representation of OpenAPI v2 specification's Swagger object. -// -// See: https://github.com/OAI/OpenAPI-Specification/blob/3.0.0/versions/2.0.md#swaggerObject -// -message Swagger { - string swagger = 1; - Info info = 2; - string host = 3; - string base_path = 4; - repeated Scheme schemes = 5; - repeated string consumes = 6; - repeated string produces = 7; - reserved 8; - reserved 9; - map responses = 10; - SecurityDefinitions security_definitions = 11; - repeated SecurityRequirement security = 12; - repeated Tag tags = 13; - ExternalDocumentation external_docs = 14; - map extensions = 15; -} - -// `Operation` is a representation of OpenAPI v2 specification's Operation object. -message Operation { - repeated string tags = 1; - string summary = 2; - string description = 3; - ExternalDocumentation external_docs = 4; - string operation_id = 5; - repeated string consumes = 6; - repeated string produces = 7; - reserved 8; - map responses = 9; - repeated Scheme schemes = 10; - bool deprecated = 11; - repeated SecurityRequirement security = 12; - map extensions = 13; - Parameters parameters = 14; -} - -// `Parameters` is a representation of OpenAPI v2 specification's parameters object. -message Parameters { - repeated HeaderParameter headers = 1; -} - -// `HeaderParameter` a HTTP header parameter. -message HeaderParameter { - enum Type { - UNKNOWN = 0; - STRING = 1; - NUMBER = 2; - INTEGER = 3; - BOOLEAN = 4; - } - - string name = 1; - string description = 2; - Type type = 3; - string format = 4; - bool required = 5; - reserved 6; - reserved 7; -} - -// `Header` is a representation of OpenAPI v2 specification's Header object. -message Header { - string description = 1; - string type = 2; - string format = 3; - reserved 4; - reserved 5; - string default = 6; - reserved 7; - reserved 8; - reserved 9; - reserved 10; - reserved 11; - reserved 12; - string pattern = 13; - reserved 14; - reserved 15; - reserved 16; - reserved 17; - reserved 18; -} - -// `Response` is a representation of OpenAPI v2 specification's Response object. -message Response { - string description = 1; - Schema schema = 2; - map headers = 3; - map examples = 4; - map extensions = 5; -} - -// `Info` is a representation of OpenAPI v2 specification's Info object. -message Info { - string title = 1; - string description = 2; - string terms_of_service = 3; - Contact contact = 4; - License license = 5; - string version = 6; - map extensions = 7; -} - -// `Contact` is a representation of OpenAPI v2 specification's Contact object. -message Contact { - string name = 1; - string url = 2; - string email = 3; -} - -// `License` is a representation of OpenAPI v2 specification's License object. -message License { - string name = 1; - string url = 2; -} - -// `ExternalDocumentation` is a representation of OpenAPI v2 specification's -// ExternalDocumentation object. -message ExternalDocumentation { - string description = 1; - string url = 2; -} - -// `Schema` is a representation of OpenAPI v2 specification's Schema object. -message Schema { - JSONSchema json_schema = 1; - string discriminator = 2; - bool read_only = 3; - reserved 4; - ExternalDocumentation external_docs = 5; - string example = 6; -} - -// `EnumSchema` is subset of fields from the OpenAPI v2 specification's Schema object. -message EnumSchema { - string description = 1; - string default = 2; - string title = 3; - bool required = 4; - bool read_only = 5; - ExternalDocumentation external_docs = 6; - string example = 7; - string ref = 8; - map extensions = 9; -} - -// `JSONSchema` represents properties from JSON Schema taken, and as used, in -// the OpenAPI v2 spec. -message JSONSchema { - reserved 1; - reserved 2; - string ref = 3; - reserved 4; - string title = 5; - string description = 6; - string default = 7; - bool read_only = 8; - string example = 9; - double multiple_of = 10; - double maximum = 11; - bool exclusive_maximum = 12; - double minimum = 13; - bool exclusive_minimum = 14; - uint64 max_length = 15; - uint64 min_length = 16; - string pattern = 17; - reserved 18; - reserved 19; - uint64 max_items = 20; - uint64 min_items = 21; - bool unique_items = 22; - reserved 23; - uint64 max_properties = 24; - uint64 min_properties = 25; - repeated string required = 26; - reserved 27; - reserved 28; - reserved 29; - reserved 30 to 33; - repeated string array = 34; - - enum JSONSchemaSimpleTypes { - UNKNOWN = 0; - ARRAY = 1; - BOOLEAN = 2; - INTEGER = 3; - NULL = 4; - NUMBER = 5; - OBJECT = 6; - STRING = 7; - } - - repeated JSONSchemaSimpleTypes type = 35; - string format = 36; - reserved 37 to 41; - reserved 42; - reserved 43 to 45; - repeated string enum = 46; - - FieldConfiguration field_configuration = 1001; - - message FieldConfiguration { - string path_param_name = 47; - bool deprecated = 49; - } - map extensions = 48; -} - -// `Tag` is a representation of OpenAPI v2 specification's Tag object. -message Tag { - string name = 1; - string description = 2; - ExternalDocumentation external_docs = 3; - map extensions = 4; -} - -// `SecurityDefinitions` is a representation of OpenAPI v2 specification's -// Security Definitions object. -message SecurityDefinitions { - map security = 1; -} - -// `SecurityScheme` is a representation of OpenAPI v2 specification's -// Security Scheme object. -message SecurityScheme { - enum Type { - TYPE_INVALID = 0; - TYPE_BASIC = 1; - TYPE_API_KEY = 2; - TYPE_OAUTH2 = 3; - } - - enum In { - IN_INVALID = 0; - IN_QUERY = 1; - IN_HEADER = 2; - } - - enum Flow { - FLOW_INVALID = 0; - FLOW_IMPLICIT = 1; - FLOW_PASSWORD = 2; - FLOW_APPLICATION = 3; - FLOW_ACCESS_CODE = 4; - } - - Type type = 1; - string description = 2; - string name = 3; - In in = 4; - Flow flow = 5; - string authorization_url = 6; - string token_url = 7; - Scopes scopes = 8; - map extensions = 9; -} - -// `SecurityRequirement` is a representation of OpenAPI v2 specification's -// Security Requirement object. -message SecurityRequirement { - message SecurityRequirementValue { - repeated string scope = 1; - } - map security_requirement = 1; -} - -// `Scopes` is a representation of OpenAPI v2 specification's Scopes object. -message Scopes { - map scope = 1; -} diff --git a/protobuff/qubic.openapi.yaml b/protobuff/qubic.openapi.yaml new file mode 100644 index 0000000..066b47d --- /dev/null +++ b/protobuff/qubic.openapi.yaml @@ -0,0 +1,729 @@ +# Generated with protoc-gen-openapi +# https://github.com/google/gnostic/tree/master/cmd/protoc-gen-openapi + +openapi: 3.0.3 +info: + title: Qubic HTTP API + description: Bridge service for Qubic network operations. + version: 1.0.0 +servers: + - url: https://rpc.qubic.org/live/v1 +paths: + /assets/issuances: + get: + tags: + - QubicLiveService + summary: Search Asset Issuances + description: Returns a list of issued assets filtered by issuer identity and asset name. + operationId: QubicLiveService_GetIssuedAssetsByFilter + parameters: + - name: issuerIdentity + in: query + schema: + type: string + - name: assetName + in: query + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssetIssuances' + /assets/issuances/{index}: + get: + tags: + - QubicLiveService + summary: Get Asset Issuance By Index + description: Returns an asset issuance by universe index. + operationId: QubicLiveService_GetIssuedAssetByUniverseIndex + parameters: + - name: index + in: path + required: true + schema: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssetIssuance' + /assets/ownerships: + get: + tags: + - QubicLiveService + summary: Search Asset Ownerships + description: Returns a list of asset ownerships filtered by issuer, asset name, owner and managing contract. + operationId: QubicLiveService_GetOwnedAssetsByFilter + parameters: + - name: issuerIdentity + in: query + description: Identity of the issuer. Defaults to the zero address (smart contract shares). + schema: + type: string + - name: assetName + in: query + description: Name of the asset (required). + schema: + type: string + - name: ownerIdentity + in: query + description: Identity of the owner of the asset (optional). + schema: + type: string + - name: ownershipManagingContract + in: query + description: Index of the contract that manages the ownership (optional). + schema: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssetOwnerships' + /assets/ownerships/{index}: + get: + tags: + - QubicLiveService + summary: Get Asset Ownership By Index + description: Returns an asset ownership by universe index. + operationId: QubicLiveService_GetOwnedAssetByUniverseIndex + parameters: + - name: index + in: path + required: true + schema: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssetOwnership' + /assets/possessions: + get: + tags: + - QubicLiveService + summary: Search Asset Possessions + description: Returns a list of asset possessions filtered by issuer, asset name, owner, possessor and managing contracts. + operationId: QubicLiveService_GetPossessedAssetsByFilter + parameters: + - name: issuerIdentity + in: query + description: Identity of the issuer (required). Defaults to the zero address (smart contract shares). + schema: + type: string + - name: assetName + in: query + description: Name of the asset (required). + schema: + type: string + - name: ownerIdentity + in: query + description: Identity of the owner of the asset (optional). + schema: + type: string + - name: possessorIdentity + in: query + description: Identity of the possessor of the asset (optional). + schema: + type: string + - name: ownershipManagingContract + in: query + description: Index of the contract that manages the ownership (optional). + schema: + type: integer + format: uint32 + - name: possessionManagingContract + in: query + description: Index of the contract that manages the possession (optional). + schema: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssetPossessions' + /assets/possessions/{index}: + get: + tags: + - QubicLiveService + summary: Get Asset Possession By Index + description: Returns an asset possession by universe index. + operationId: QubicLiveService_GetPossessedAssetByUniverseIndex + parameters: + - name: index + in: path + required: true + schema: + type: integer + format: uint32 + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/AssetPossession' + /assets/{identity}/issued: + get: + tags: + - QubicLiveService + summary: List Issued Assets + description: Gets assets issued by the specified identity. + operationId: QubicLiveService_GetIssuedAssets + parameters: + - name: identity + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/IssuedAssetsResponse' + /assets/{identity}/owned: + get: + tags: + - QubicLiveService + summary: List Owned Assets + description: Gets assets that are owned by the specified identity. + operationId: QubicLiveService_GetOwnedAssets + parameters: + - name: identity + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/OwnedAssetsResponse' + /assets/{identity}/possessed: + get: + tags: + - QubicLiveService + summary: List Possessed Assets + description: Gets assets that are possessed by the specified identity. + operationId: QubicLiveService_GetPossessedAssets + parameters: + - name: identity + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PossessedAssetsResponse' + /balances/{id}: + get: + tags: + - QubicLiveService + summary: Get Balance + description: Gets the balance of the specified identity. + operationId: QubicLiveService_GetBalance + parameters: + - name: id + in: path + required: true + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetBalanceResponse' + /block-height: + get: + tags: + - QubicLiveService + summary: Get Block Height + description: 'Deprecated: use /tick-info instead.' + operationId: QubicLiveService_GetBlockHeight + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetBlockHeightResponse' + deprecated: true + /broadcast-transaction: + post: + tags: + - QubicLiveService + summary: Broadcast Transaction + description: Broadcasts a transaction to the network. + operationId: QubicLiveService_BroadcastTransaction + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/BroadcastTransactionRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/BroadcastTransactionResponse' + /ipos/active: + get: + tags: + - QubicLiveService + summary: Get Active IPOs + description: Returns a list of IPOs that are active in the current epoch. + operationId: QubicLiveService_GetActiveIpos + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetActiveIposResponse' + /querySmartContract: + post: + tags: + - QubicLiveService + summary: Query Smart Contract + description: Queries a smart contract function. + operationId: QubicLiveService_QuerySmartContract + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/QuerySmartContractRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/QuerySmartContractResponse' + /tick-info: + get: + tags: + - QubicLiveService + summary: Get Tick Info + description: Gets the current tick information. + operationId: QubicLiveService_GetTickInfo + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetTickInfoResponse' +components: + schemas: + AssetInfo: + type: object + properties: + tick: + type: integer + format: uint32 + universeIndex: + type: integer + format: uint32 + description: AssetInfo + AssetIssuance: + type: object + properties: + data: + $ref: '#/components/schemas/AssetIssuanceData' + tick: + type: integer + format: uint32 + universeIndex: + type: integer + format: uint32 + description: AssetIssuance + AssetIssuanceData: + type: object + properties: + issuerIdentity: + type: string + type: + type: integer + format: uint32 + name: + type: string + numberOfDecimalPlaces: + type: integer + format: int32 + unitOfMeasurement: + type: array + items: + type: integer + format: int32 + description: AssetIssuanceData + AssetIssuances: + type: object + properties: + assets: + type: array + items: + $ref: '#/components/schemas/AssetIssuance' + description: AssetIssuances + AssetOwnership: + type: object + properties: + data: + $ref: '#/components/schemas/AssetOwnershipData' + tick: + type: integer + format: uint32 + universeIndex: + type: integer + format: uint32 + description: AssetOwnership + AssetOwnershipData: + type: object + properties: + ownerIdentity: + type: string + type: + type: integer + format: uint32 + managingContractIndex: + type: integer + format: uint32 + issuanceIndex: + type: integer + format: uint32 + numberOfUnits: + type: string + description: AssetOwnershipData + AssetOwnerships: + type: object + properties: + assets: + type: array + items: + $ref: '#/components/schemas/AssetOwnership' + description: AssetOwnerships + AssetPossession: + type: object + properties: + data: + $ref: '#/components/schemas/AssetPossessionData' + tick: + type: integer + format: uint32 + universeIndex: + type: integer + format: uint32 + description: AssetPossession + AssetPossessionData: + type: object + properties: + possessorIdentity: + type: string + type: + type: integer + format: uint32 + managingContractIndex: + type: integer + format: uint32 + ownershipIndex: + type: integer + format: uint32 + numberOfUnits: + type: string + description: AssetPossessionData + AssetPossessions: + type: object + properties: + assets: + type: array + items: + $ref: '#/components/schemas/AssetPossession' + description: AssetPossessions + Balance: + type: object + properties: + id: + type: string + description: The identity relevant to this balance. + balance: + type: string + description: The amount of funds the identity holds. + validForTick: + type: integer + description: The tick that this balance is valid for. + format: uint32 + latestIncomingTransferTick: + type: integer + description: The last tick when this identity received funds through a transfer. + format: uint32 + latestOutgoingTransferTick: + type: integer + description: The last tick when this identity sent funds through a transfer. + format: uint32 + incomingAmount: + type: string + description: The total sum of received funds over time. + outgoingAmount: + type: string + description: The total sum of sent funds over time. + numberOfIncomingTransfers: + type: integer + description: The number of incoming transfers. + format: uint32 + numberOfOutgoingTransfers: + type: integer + description: The number of outgoing transfers. + format: uint32 + description: Balance + BroadcastTransactionRequest: + type: object + properties: + encodedTransaction: + type: string + description: Base64 encoded binary transaction data. + description: BroadcastTransactionRequest + BroadcastTransactionResponse: + type: object + properties: + peersBroadcasted: + type: integer + description: The number of Qubic node peers this transactions has been broadcast to. + format: int32 + encodedTransaction: + type: string + description: The Base 64 encoded binary transaction from the request. + transactionId: + type: string + description: The id / hash of the transaction. + description: BroadcastTransactionResponse + GetActiveIposResponse: + type: object + properties: + ipos: + type: array + items: + $ref: '#/components/schemas/Ipo' + description: GetActiveIposResponse + GetBalanceResponse: + type: object + properties: + balance: + $ref: '#/components/schemas/Balance' + description: GetBalanceResponse + GetBlockHeightResponse: + type: object + properties: + blockHeight: + $ref: '#/components/schemas/TickInfo' + description: GetBlockHeightResponse + GetTickInfoResponse: + type: object + properties: + tickInfo: + $ref: '#/components/schemas/TickInfo' + description: GetTickInfoResponse + Ipo: + type: object + properties: + contractIndex: + type: integer + description: The index of the related contract (contract address). + format: uint32 + assetName: + type: string + description: The name of the related asset. + description: IPO + IssuedAsset: + type: object + properties: + data: + $ref: '#/components/schemas/IssuedAssetData' + info: + $ref: '#/components/schemas/AssetInfo' + description: IssuedAsset + IssuedAssetData: + type: object + properties: + issuerIdentity: + type: string + type: + type: integer + format: uint32 + name: + type: string + numberOfDecimalPlaces: + type: integer + format: int32 + unitOfMeasurement: + type: array + items: + type: integer + format: int32 + description: IssuedAssetData + IssuedAssetsResponse: + type: object + properties: + issuedAssets: + type: array + items: + $ref: '#/components/schemas/IssuedAsset' + description: IssuedAssetsResponse + OwnedAsset: + type: object + properties: + data: + $ref: '#/components/schemas/OwnedAssetData' + info: + $ref: '#/components/schemas/AssetInfo' + description: OwnedAsset + OwnedAssetData: + type: object + properties: + ownerIdentity: + type: string + type: + type: integer + format: uint32 + padding: + type: integer + format: int32 + managingContractIndex: + type: integer + format: uint32 + issuanceIndex: + type: integer + format: uint32 + numberOfUnits: + type: string + issuedAsset: + $ref: '#/components/schemas/IssuedAssetData' + description: OwnedAssetData + OwnedAssetsResponse: + type: object + properties: + ownedAssets: + type: array + items: + $ref: '#/components/schemas/OwnedAsset' + description: OwnedAssetsResponse + PossessedAsset: + type: object + properties: + data: + $ref: '#/components/schemas/PossessedAssetData' + info: + $ref: '#/components/schemas/AssetInfo' + description: PossessedAsset + PossessedAssetData: + type: object + properties: + possessorIdentity: + type: string + type: + type: integer + format: uint32 + padding: + type: integer + format: int32 + managingContractIndex: + type: integer + format: uint32 + issuanceIndex: + type: integer + format: uint32 + numberOfUnits: + type: string + ownedAsset: + $ref: '#/components/schemas/OwnedAssetData' + description: PossessedAssetData + PossessedAssetsResponse: + type: object + properties: + possessedAssets: + type: array + items: + $ref: '#/components/schemas/PossessedAsset' + description: PossessedAssetsResponse + QuerySmartContractRequest: + type: object + properties: + contractIndex: + type: integer + description: identifies the smart contract + format: uint32 + inputType: + type: integer + description: identifies the function to be queried + format: uint32 + inputSize: + type: integer + description: the size of the input data (request data) + format: uint32 + requestData: + type: string + description: base64 encoded input data + description: QuerySmartContractRequest + QuerySmartContractResponse: + type: object + properties: + responseData: + type: string + description: Binary data encoded as Base64. This data is returned directly from the called SC function. + description: QuerySmartContractResponse + TickInfo: + type: object + properties: + tick: + type: integer + description: current network tick + format: uint32 + duration: + type: integer + format: uint32 + epoch: + type: integer + description: current epoch + format: uint32 + initialTick: + type: integer + description: initial tick of epoch + format: uint32 + description: TickInfo +tags: + - name: QubicLiveService + description: Query live data from the Qubic network + externalDocs: + description: GitHub repository + url: https://github.com/qubic/qubic-http/ + x-displayName: Live API + - name: QubicLiveService +externalDocs: + description: GitHub + url: https://github.com/qubic/qubic-http diff --git a/protobuff/qubic.pb.go b/protobuff/qubic.pb.go index 23fe6e7..dee0418 100644 --- a/protobuff/qubic.pb.go +++ b/protobuff/qubic.pb.go @@ -1,12 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.36.6 -// protoc v3.21.12 +// protoc-gen-go v1.36.11 +// protoc v6.33.1 // source: qubic.proto package protobuff import ( + _ "github.com/google/gnostic/openapiv3" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" @@ -224,9 +225,8 @@ func (x *GetBalanceResponse) GetBalance() *Balance { // BroadcastTransactionRequest type BroadcastTransactionRequest struct { - state protoimpl.MessageState `protogen:"open.v1"` - // base64 encoded binary transaction data - EncodedTransaction string `protobuf:"bytes,1,opt,name=encoded_transaction,json=encodedTransaction,proto3" json:"encoded_transaction,omitempty"` + state protoimpl.MessageState `protogen:"open.v1"` + EncodedTransaction string `protobuf:"bytes,1,opt,name=encoded_transaction,json=encodedTransaction,proto3" json:"encoded_transaction,omitempty"` unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } @@ -2004,7 +2004,7 @@ func (x *GetIssuedAssetsByFilterRequest) GetAssetName() string { // GetOwnedAssetsByFilterRequest type GetOwnedAssetsByFilterRequest struct { state protoimpl.MessageState `protogen:"open.v1"` - // Identity of the issuer (required). Defaults to the zero address (smart contract shares). + // Identity of the issuer. Defaults to the zero address (smart contract shares). IssuerIdentity string `protobuf:"bytes,1,opt,name=issuer_identity,json=issuerIdentity,proto3" json:"issuer_identity,omitempty"` // Name of the asset (required). AssetName string `protobuf:"bytes,2,opt,name=asset_name,json=assetName,proto3" json:"asset_name,omitempty"` @@ -2269,27 +2269,27 @@ var File_qubic_proto protoreflect.FileDescriptor const file_qubic_proto_rawDesc = "" + "\n" + - "\vqubic.proto\x12\x13qubic.http.qubic.pb\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\"\xb3\x03\n" + - "\aBalance\x12\x0e\n" + - "\x02id\x18\x01 \x01(\tR\x02id\x12\x18\n" + - "\abalance\x18\x02 \x01(\x03R\abalance\x12$\n" + - "\x0evalid_for_tick\x18\x03 \x01(\rR\fvalidForTick\x12A\n" + - "\x1dlatest_incoming_transfer_tick\x18\x04 \x01(\rR\x1alatestIncomingTransferTick\x12A\n" + - "\x1dlatest_outgoing_transfer_tick\x18\x05 \x01(\rR\x1alatestOutgoingTransferTick\x12'\n" + - "\x0fincoming_amount\x18\x06 \x01(\x03R\x0eincomingAmount\x12'\n" + - "\x0foutgoing_amount\x18\a \x01(\x03R\x0eoutgoingAmount\x12?\n" + - "\x1cnumber_of_incoming_transfers\x18\b \x01(\rR\x19numberOfIncomingTransfers\x12?\n" + - "\x1cnumber_of_outgoing_transfers\x18\t \x01(\rR\x19numberOfOutgoingTransfers\"#\n" + + "\vqubic.proto\x12\x13qubic.http.qubic.pb\x1a\x1cgoogle/api/annotations.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1bopenapiv3/annotations.proto\"\x86\a\n" + + "\aBalance\x12<\n" + + "\x02id\x18\x01 \x01(\tB,\xbaG)\x92\x02&The identity relevant to this balance.R\x02id\x12G\n" + + "\abalance\x18\x02 \x01(\x03B-\xbaG*\x92\x02'The amount of funds the identity holds.R\abalance\x12T\n" + + "\x0evalid_for_tick\x18\x03 \x01(\rB.\xbaG+\x92\x02(The tick that this balance is valid for.R\fvalidForTick\x12\x8c\x01\n" + + "\x1dlatest_incoming_transfer_tick\x18\x04 \x01(\rBI\xbaGF\x92\x02CThe last tick when this identity received funds through a transfer.R\x1alatestIncomingTransferTick\x12\x88\x01\n" + + "\x1dlatest_outgoing_transfer_tick\x18\x05 \x01(\rBE\xbaGB\x92\x02?The last tick when this identity sent funds through a transfer.R\x1alatestOutgoingTransferTick\x12Y\n" + + "\x0fincoming_amount\x18\x06 \x01(\x03B0\xbaG-\x92\x02*The total sum of received funds over time.R\x0eincomingAmount\x12U\n" + + "\x0foutgoing_amount\x18\a \x01(\x03B,\xbaG)\x92\x02&The total sum of sent funds over time.R\x0eoutgoingAmount\x12h\n" + + "\x1cnumber_of_incoming_transfers\x18\b \x01(\rB'\xbaG$\x92\x02!The number of incoming transfers.R\x19numberOfIncomingTransfers\x12h\n" + + "\x1cnumber_of_outgoing_transfers\x18\t \x01(\rB'\xbaG$\x92\x02!The number of outgoing transfers.R\x19numberOfOutgoingTransfers\"#\n" + "\x11GetBalanceRequest\x12\x0e\n" + "\x02id\x18\x01 \x01(\tR\x02id\"L\n" + "\x12GetBalanceResponse\x126\n" + - "\abalance\x18\x01 \x01(\v2\x1c.qubic.http.qubic.pb.BalanceR\abalance\"N\n" + - "\x1bBroadcastTransactionRequest\x12/\n" + - "\x13encoded_transaction\x18\x01 \x01(\tR\x12encodedTransaction\"\xa3\x01\n" + - "\x1cBroadcastTransactionResponse\x12+\n" + - "\x11peers_broadcasted\x18\x01 \x01(\x05R\x10peersBroadcasted\x12/\n" + - "\x13encoded_transaction\x18\x02 \x01(\tR\x12encodedTransaction\x12%\n" + - "\x0etransaction_id\x18\x03 \x01(\tR\rtransactionId\"s\n" + + "\abalance\x18\x01 \x01(\v2\x1c.qubic.http.qubic.pb.BalanceR\abalance\"}\n" + + "\x1bBroadcastTransactionRequest\x12^\n" + + "\x13encoded_transaction\x18\x01 \x01(\tB-\xbaG*\x92\x02'Base64 encoded binary transaction data.R\x12encodedTransaction\"\xdb\x02\n" + + "\x1cBroadcastTransactionResponse\x12z\n" + + "\x11peers_broadcasted\x18\x01 \x01(\x05BM\xbaGJ\x92\x02GThe number of Qubic node peers this transactions has been broadcast to.R\x10peersBroadcasted\x12o\n" + + "\x13encoded_transaction\x18\x02 \x01(\tB>\xbaG;\x92\x028The Base 64 encoded binary transaction from the request.R\x12encodedTransaction\x12N\n" + + "\x0etransaction_id\x18\x03 \x01(\tB'\xbaG$\x92\x02!The id / hash of the transaction.R\rtransactionId\"s\n" + "\bTickInfo\x12\x12\n" + "\x04tick\x18\x01 \x01(\rR\x04tick\x12\x1a\n" + "\bduration\x18\x02 \x01(\rR\bduration\x12\x14\n" + @@ -2353,9 +2353,9 @@ const file_qubic_proto_rawDesc = "" + "input_type\x18\x02 \x01(\rR\tinputType\x12\x1d\n" + "\n" + "input_size\x18\x03 \x01(\rR\tinputSize\x12!\n" + - "\frequest_data\x18\x04 \x01(\tR\vrequestData\"A\n" + - "\x1aQuerySmartContractResponse\x12#\n" + - "\rresponse_data\x18\x05 \x01(\tR\fresponseData\"\xcd\x01\n" + + "\frequest_data\x18\x04 \x01(\tR\vrequestData\"\xa4\x01\n" + + "\x1aQuerySmartContractResponse\x12\x85\x01\n" + + "\rresponse_data\x18\x05 \x01(\tB`\xbaG]\x92\x02ZBinary data encoded as Base64. This data is returned directly from the called SC function.R\fresponseData\"\xcd\x01\n" + "\x11AssetIssuanceData\x12'\n" + "\x0fissuer_identity\x18\x01 \x01(\tR\x0eissuerIdentity\x12\x12\n" + "\x04type\x18\x02 \x01(\rR\x04type\x12\x12\n" + @@ -2417,25 +2417,32 @@ const file_qubic_proto_rawDesc = "" + "\n" + "asset_name\x18\x02 \x01(\tR\tassetName\"E\n" + "\x15GetActiveIposResponse\x12,\n" + - "\x04ipos\x18\x01 \x03(\v2\x18.qubic.http.qubic.pb.IpoR\x04ipos2\xbc\x10\n" + - "\x10QubicLiveService\x12u\n" + + "\x04ipos\x18\x01 \x03(\v2\x18.qubic.http.qubic.pb.IpoR\x04ipos2\x8e\x1a\n" + + "\x10QubicLiveService\x12\xb2\x01\n" + "\n" + - "GetBalance\x12&.qubic.http.qubic.pb.GetBalanceRequest\x1a'.qubic.http.qubic.pb.GetBalanceResponse\"\x16\x82\xd3\xe4\x93\x02\x10\x12\x0e/balances/{id}\x12\x95\x01\n" + - "\x12QuerySmartContract\x12..qubic.http.qubic.pb.QuerySmartContractRequest\x1a/.qubic.http.qubic.pb.QuerySmartContractResponse\"\x1e\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/querySmartContract\x12\x9e\x01\n" + - "\x14BroadcastTransaction\x120.qubic.http.qubic.pb.BroadcastTransactionRequest\x1a1.qubic.http.qubic.pb.BroadcastTransactionResponse\"!\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/broadcast-transaction\x12c\n" + - "\vGetTickInfo\x12\x16.google.protobuf.Empty\x1a(.qubic.http.qubic.pb.GetTickInfoResponse\"\x12\x82\xd3\xe4\x93\x02\f\x12\n" + - "/tick-info\x12l\n" + - "\x0eGetBlockHeight\x12\x16.google.protobuf.Empty\x1a+.qubic.http.qubic.pb.GetBlockHeightResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/block-height\x12\x89\x01\n" + - "\x0fGetIssuedAssets\x12(.qubic.http.qubic.pb.IssuedAssetsRequest\x1a).qubic.http.qubic.pb.IssuedAssetsResponse\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/assets/{identity}/issued\x12\x85\x01\n" + - "\x0eGetOwnedAssets\x12'.qubic.http.qubic.pb.OwnedAssetsRequest\x1a(.qubic.http.qubic.pb.OwnedAssetsResponse\" \x82\xd3\xe4\x93\x02\x1a\x12\x18/assets/{identity}/owned\x12\x95\x01\n" + - "\x12GetPossessedAssets\x12+.qubic.http.qubic.pb.PossessedAssetsRequest\x1a,.qubic.http.qubic.pb.PossessedAssetsResponse\"$\x82\xd3\xe4\x93\x02\x1e\x12\x1c/assets/{identity}/possessed\x12\x8e\x01\n" + - "\x17GetIssuedAssetsByFilter\x123.qubic.http.qubic.pb.GetIssuedAssetsByFilterRequest\x1a#.qubic.http.qubic.pb.AssetIssuances\"\x19\x82\xd3\xe4\x93\x02\x13\x12\x11/assets/issuances\x12\x96\x01\n" + - "\x1dGetIssuedAssetByUniverseIndex\x12..qubic.http.qubic.pb.GetByUniverseIndexRequest\x1a\".qubic.http.qubic.pb.AssetIssuance\"!\x82\xd3\xe4\x93\x02\x1b\x12\x19/assets/issuances/{index}\x12\x8e\x01\n" + - "\x16GetOwnedAssetsByFilter\x122.qubic.http.qubic.pb.GetOwnedAssetsByFilterRequest\x1a$.qubic.http.qubic.pb.AssetOwnerships\"\x1a\x82\xd3\xe4\x93\x02\x14\x12\x12/assets/ownerships\x12\x97\x01\n" + - "\x1cGetOwnedAssetByUniverseIndex\x12..qubic.http.qubic.pb.GetByUniverseIndexRequest\x1a#.qubic.http.qubic.pb.AssetOwnership\"\"\x82\xd3\xe4\x93\x02\x1c\x12\x1a/assets/ownerships/{index}\x12\x98\x01\n" + - "\x1aGetPossessedAssetsByFilter\x126.qubic.http.qubic.pb.GetPossessedAssetsByFilterRequest\x1a%.qubic.http.qubic.pb.AssetPossessions\"\x1b\x82\xd3\xe4\x93\x02\x15\x12\x13/assets/possessions\x12\x9d\x01\n" + - " GetPossessedAssetByUniverseIndex\x12..qubic.http.qubic.pb.GetByUniverseIndexRequest\x1a$.qubic.http.qubic.pb.AssetPossession\"#\x82\xd3\xe4\x93\x02\x1d\x12\x1b/assets/possessions/{index}\x12i\n" + - "\rGetActiveIpos\x12\x16.google.protobuf.Empty\x1a*.qubic.http.qubic.pb.GetActiveIposResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\f/ipos/activeB(Z&github.com/qubic/qubic-http/protobuff/b\x06proto3" + "GetBalance\x12&.qubic.http.qubic.pb.GetBalanceRequest\x1a'.qubic.http.qubic.pb.GetBalanceResponse\"S\xbaG:\x12\vGet Balance\x1a+Gets the balance of the specified identity.\x82\xd3\xe4\x93\x02\x10\x12\x0e/balances/{id}\x12\xd2\x01\n" + + "\x12QuerySmartContract\x12..qubic.http.qubic.pb.QuerySmartContractRequest\x1a/.qubic.http.qubic.pb.QuerySmartContractResponse\"[\xbaG:\x12\x14Query Smart Contract\x1a\"Queries a smart contract function.\x82\xd3\xe4\x93\x02\x18:\x01*\"\x13/querySmartContract\x12\xe2\x01\n" + + "\x14BroadcastTransaction\x120.qubic.http.qubic.pb.BroadcastTransactionRequest\x1a1.qubic.http.qubic.pb.BroadcastTransactionResponse\"e\xbaGA\x12\x15Broadcast Transaction\x1a(Broadcasts a transaction to the network.\x82\xd3\xe4\x93\x02\x1b:\x01*\"\x16/broadcast-transaction\x12\x99\x01\n" + + "\vGetTickInfo\x12\x16.google.protobuf.Empty\x1a(.qubic.http.qubic.pb.GetTickInfoResponse\"H\xbaG3\x12\rGet Tick Info\x1a\"Gets the current tick information.\x82\xd3\xe4\x93\x02\f\x12\n" + + "/tick-info\x12\xa8\x01\n" + + "\x0eGetBlockHeight\x12\x16.google.protobuf.Empty\x1a+.qubic.http.qubic.pb.GetBlockHeightResponse\"Q\xbaG9\x12\x10Get Block Height\x1a#Deprecated: use /tick-info instead.P\x01\x82\xd3\xe4\x93\x02\x0f\x12\r/block-height\x12\xcf\x01\n" + + "\x0fGetIssuedAssets\x12(.qubic.http.qubic.pb.IssuedAssetsRequest\x1a).qubic.http.qubic.pb.IssuedAssetsResponse\"g\xbaGC\x12\x12List Issued Assets\x1a-Gets assets issued by the specified identity.\x82\xd3\xe4\x93\x02\x1b\x12\x19/assets/{identity}/issued\x12\xd2\x01\n" + + "\x0eGetOwnedAssets\x12'.qubic.http.qubic.pb.OwnedAssetsRequest\x1a(.qubic.http.qubic.pb.OwnedAssetsResponse\"m\xbaGJ\x12\x11List Owned Assets\x1a5Gets assets that are owned by the specified identity.\x82\xd3\xe4\x93\x02\x1a\x12\x18/assets/{identity}/owned\x12\xea\x01\n" + + "\x12GetPossessedAssets\x12+.qubic.http.qubic.pb.PossessedAssetsRequest\x1a,.qubic.http.qubic.pb.PossessedAssetsResponse\"y\xbaGR\x12\x15List Possessed Assets\x1a9Gets assets that are possessed by the specified identity.\x82\xd3\xe4\x93\x02\x1e\x12\x1c/assets/{identity}/possessed\x12\xf7\x01\n" + + "\x17GetIssuedAssetsByFilter\x123.qubic.http.qubic.pb.GetIssuedAssetsByFilterRequest\x1a#.qubic.http.qubic.pb.AssetIssuances\"\x81\x01\xbaGe\x12\x16Search Asset Issuances\x1aKReturns a list of issued assets filtered by issuer identity and asset name.\x82\xd3\xe4\x93\x02\x13\x12\x11/assets/issuances\x12\xe4\x01\n" + + "\x1dGetIssuedAssetByUniverseIndex\x12..qubic.http.qubic.pb.GetByUniverseIndexRequest\x1a\".qubic.http.qubic.pb.AssetIssuance\"o\xbaGK\x12\x1bGet Asset Issuance By Index\x1a,Returns an asset issuance by universe index.\x82\xd3\xe4\x93\x02\x1b\x12\x19/assets/issuances/{index}\x12\x8c\x02\n" + + "\x16GetOwnedAssetsByFilter\x122.qubic.http.qubic.pb.GetOwnedAssetsByFilterRequest\x1a$.qubic.http.qubic.pb.AssetOwnerships\"\x97\x01\xbaGz\x12\x17Search Asset Ownerships\x1a_Returns a list of asset ownerships filtered by issuer, asset name, owner and managing contract.\x82\xd3\xe4\x93\x02\x14\x12\x12/assets/ownerships\x12\xe7\x01\n" + + "\x1cGetOwnedAssetByUniverseIndex\x12..qubic.http.qubic.pb.GetByUniverseIndexRequest\x1a#.qubic.http.qubic.pb.AssetOwnership\"r\xbaGM\x12\x1cGet Asset Ownership By Index\x1a-Returns an asset ownership by universe index.\x82\xd3\xe4\x93\x02\x1c\x12\x1a/assets/ownerships/{index}\x12\xa5\x02\n" + + "\x1aGetPossessedAssetsByFilter\x126.qubic.http.qubic.pb.GetPossessedAssetsByFilterRequest\x1a%.qubic.http.qubic.pb.AssetPossessions\"\xa7\x01\xbaG\x88\x01\x12\x18Search Asset Possessions\x1alReturns a list of asset possessions filtered by issuer, asset name, owner, possessor and managing contracts.\x82\xd3\xe4\x93\x02\x15\x12\x13/assets/possessions\x12\xef\x01\n" + + " GetPossessedAssetByUniverseIndex\x12..qubic.http.qubic.pb.GetByUniverseIndexRequest\x1a$.qubic.http.qubic.pb.AssetPossession\"u\xbaGO\x12\x1dGet Asset Possession By Index\x1a.Returns an asset possession by universe index.\x82\xd3\xe4\x93\x02\x1d\x12\x1b/assets/possessions/{index}\x12\xbb\x01\n" + + "\rGetActiveIpos\x12\x16.google.protobuf.Empty\x1a*.qubic.http.qubic.pb.GetActiveIposResponse\"f\xbaGO\x12\x0fGet Active IPOs\x1a