diff --git a/api/openapi.json b/api/openapi.json index 57331f74..55017165 100644 --- a/api/openapi.json +++ b/api/openapi.json @@ -128,6 +128,17 @@ "type": "string" } }, + "ecIDParameter": { + "description": "extra currency id", + "in": "path", + "name": "id", + "required": true, + "schema": { + "example": 239, + "format": "int32", + "type": "integer" + } + }, "eventIDParameter": { "description": "event ID or transaction hash in hex (without 0x) or base64url format", "in": "path", @@ -3265,6 +3276,20 @@ ], "type": "object" }, + "ExtraCurrencies": { + "properties": { + "extra_currencies": { + "items": { + "$ref": "#/components/schemas/EcPreview" + }, + "type": "array" + } + }, + "required": [ + "extra_currencies" + ], + "type": "object" + }, "ExtraCurrency": { "properties": { "amount": { @@ -6749,6 +6774,86 @@ ] } }, + "/v2/accounts/{account_id}/extra-currency/{id}/history": { + "get": { + "description": "Get the transfer history of extra currencies for an account.", + "operationId": "getAccountExtraCurrencyHistoryByID", + "parameters": [ + { + "$ref": "#/components/parameters/accountIDParameter" + }, + { + "$ref": "#/components/parameters/ecIDParameter" + }, + { + "$ref": "#/components/parameters/i18n" + }, + { + "description": "omit this parameter to get last events", + "in": "query", + "name": "before_lt", + "required": false, + "schema": { + "example": 25758317000002, + "format": "int64", + "type": "integer", + "x-js-format": "bigint" + } + }, + { + "in": "query", + "name": "limit", + "required": true, + "schema": { + "example": 100, + "maximum": 1000, + "minimum": 1, + "type": "integer" + } + }, + { + "in": "query", + "name": "start_date", + "required": false, + "schema": { + "example": 1668436763, + "format": "int64", + "maximum": 2114380800, + "type": "integer" + } + }, + { + "in": "query", + "name": "end_date", + "required": false, + "schema": { + "example": 1668436763, + "format": "int64", + "maximum": 2114380800, + "type": "integer" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccountEvents" + } + } + }, + "description": "account extra currency history" + }, + "default": { + "$ref": "#/components/responses/Error" + } + }, + "tags": [ + "Accounts" + ] + } + }, "/v2/accounts/{account_id}/jettons": { "get": { "description": "Get all Jettons balances by owner address", @@ -8440,6 +8545,35 @@ ] } }, + "/v2/extra-currency/{id}": { + "get": { + "description": "Get extra currency info by id", + "operationId": "getExtraCurrencyInfo", + "parameters": [ + { + "$ref": "#/components/parameters/ecIDParameter" + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EcPreview" + } + } + }, + "description": "extra currency info" + }, + "default": { + "$ref": "#/components/responses/Error" + } + }, + "tags": [ + "ExtraCurrency" + ] + } + }, "/v2/gasless/config": { "get": { "description": "Returns configuration of gasless transfers", @@ -10883,6 +11017,13 @@ "url": "https://docs.tonconsole.com/tonapi/rest-api/utilities" }, "name": "Utilities" + }, + { + "externalDocs": { + "description": "Additional documentation", + "url": "https://docs.tonconsole.com/tonapi/rest-api/extra-currency" + }, + "name": "ExtraCurrency" } ] } diff --git a/api/openapi.yml b/api/openapi.yml index ebf8dc07..264dd425 100644 --- a/api/openapi.yml +++ b/api/openapi.yml @@ -84,6 +84,10 @@ tags: externalDocs: description: Additional documentation url: https://docs.tonconsole.com/tonapi/rest-api/utilities + - name: ExtraCurrency + externalDocs: + description: Additional documentation + url: https://docs.tonconsole.com/tonapi/rest-api/extra-currency paths: /v2/openapi.json: @@ -1101,6 +1105,59 @@ paths: example: 1000000000 'default': $ref: '#/components/responses/Error' + + /v2/accounts/{account_id}/extra-currency/{id}/history: + get: + description: Get the transfer history of extra currencies for an account. + operationId: getAccountExtraCurrencyHistoryByID + tags: + - Accounts + parameters: + - $ref: '#/components/parameters/accountIDParameter' + - $ref: '#/components/parameters/ecIDParameter' + - $ref: '#/components/parameters/i18n' + - name: before_lt + in: query + description: "omit this parameter to get last events" + required: false + schema: + type: integer + format: int64 + example: 25758317000002 + x-js-format: bigint + - name: limit + in: query + required: true + schema: + type: integer + example: 100 + maximum: 1000 + minimum: 1 + - name: start_date + in: query + required: false + schema: + type: integer + format: int64 + maximum: 2114380800 + example: 1668436763 + - name: end_date + in: query + required: false + schema: + type: integer + format: int64 + maximum: 2114380800 + example: 1668436763 + responses: + '200': + description: account extra currency history + content: + application/json: + schema: + $ref: '#/components/schemas/AccountEvents' + 'default': + $ref: '#/components/responses/Error' /v2/dns/{domain_name}: get: @@ -1667,6 +1724,24 @@ paths: $ref: '#/components/schemas/Event' 'default': $ref: '#/components/responses/Error' + + /v2/extra-currency/{id}: + get: + description: Get extra currency info by id + operationId: getExtraCurrencyInfo + tags: + - ExtraCurrency + parameters: + - $ref: '#/components/parameters/ecIDParameter' + responses: + '200': + description: extra currency info + content: + application/json: + schema: + $ref: '#/components/schemas/EcPreview' + 'default': + $ref: '#/components/responses/Error' /v2/staking/nominator/{account_id}/pools: get: @@ -2955,6 +3030,15 @@ components: schema: type: string example: 97264395BD65A255A429B11326C84128B7D70FFED7949ABAE3036D506BA38621 + ecIDParameter: + in: path + name: id + required: true + description: "extra currency id" + schema: + type: integer + example: 239 + format: int32 publicKeyParameter: in: path name: public_key @@ -5887,6 +5971,15 @@ components: $ref: '#/components/schemas/EncryptedComment' refund: $ref: '#/components/schemas/Refund' + ExtraCurrencies: + type: object + required: + - extra_currencies + properties: + extra_currencies: + type: array + items: + $ref: '#/components/schemas/EcPreview' EcPreview: type: object required: diff --git a/pkg/api/account_handlers.go b/pkg/api/account_handlers.go index 4a1ca06e..92f07f7f 100644 --- a/pkg/api/account_handlers.go +++ b/pkg/api/account_handlers.go @@ -604,3 +604,7 @@ func (h *Handler) AddressParse(ctx context.Context, params oas.AddressParseParam } return &res, nil //todo: add testnet_only } + +func (h *Handler) GetAccountExtraCurrencyHistoryByID(ctx context.Context, params oas.GetAccountExtraCurrencyHistoryByIDParams) (*oas.AccountEvents, error) { + return &oas.AccountEvents{}, nil +} diff --git a/pkg/api/extra_currency_handlers.go b/pkg/api/extra_currency_handlers.go new file mode 100644 index 00000000..9353a817 --- /dev/null +++ b/pkg/api/extra_currency_handlers.go @@ -0,0 +1,11 @@ +package api + +import ( + "context" + + "github.com/tonkeeper/opentonapi/pkg/oas" +) + +func (h *Handler) GetExtraCurrencyInfo(ctx context.Context, params oas.GetExtraCurrencyInfoParams) (*oas.EcPreview, error) { + return &oas.EcPreview{}, nil +} diff --git a/pkg/oas/oas_handlers_gen.go b/pkg/oas/oas_handlers_gen.go index 7493946a..5496811a 100644 --- a/pkg/oas/oas_handlers_gen.go +++ b/pkg/oas/oas_handlers_gen.go @@ -2263,6 +2263,147 @@ func (s *Server) handleGetAccountEventsRequest(args [1]string, argsEscaped bool, } } +// handleGetAccountExtraCurrencyHistoryByIDRequest handles getAccountExtraCurrencyHistoryByID operation. +// +// Get the transfer history of extra currencies for an account. +// +// GET /v2/accounts/{account_id}/extra-currency/{id}/history +func (s *Server) handleGetAccountExtraCurrencyHistoryByIDRequest(args [2]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getAccountExtraCurrencyHistoryByID"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/v2/accounts/{account_id}/extra-currency/{id}/history"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetAccountExtraCurrencyHistoryByID", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + // Use floating point division here for higher precision (instead of Millisecond method). + s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetAccountExtraCurrencyHistoryByID", + ID: "getAccountExtraCurrencyHistoryByID", + } + ) + params, err := decodeGetAccountExtraCurrencyHistoryByIDParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response *AccountEvents + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetAccountExtraCurrencyHistoryByID", + OperationSummary: "", + OperationID: "getAccountExtraCurrencyHistoryByID", + Body: nil, + Params: middleware.Parameters{ + { + Name: "account_id", + In: "path", + }: params.AccountID, + { + Name: "id", + In: "path", + }: params.ID, + { + Name: "Accept-Language", + In: "header", + }: params.AcceptLanguage, + { + Name: "before_lt", + In: "query", + }: params.BeforeLt, + { + Name: "limit", + In: "query", + }: params.Limit, + { + Name: "start_date", + In: "query", + }: params.StartDate, + { + Name: "end_date", + In: "query", + }: params.EndDate, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetAccountExtraCurrencyHistoryByIDParams + Response = *AccountEvents + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetAccountExtraCurrencyHistoryByIDParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.GetAccountExtraCurrencyHistoryByID(ctx, params) + return response, err + }, + ) + } else { + response, err = s.h.GetAccountExtraCurrencyHistoryByID(ctx, params) + } + if err != nil { + if errRes, ok := errors.Into[*ErrorStatusCode](err); ok { + if err := encodeErrorResponse(errRes, w, span); err != nil { + recordError("Internal", err) + } + return + } + if errors.Is(err, ht.ErrNotImplemented) { + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil { + recordError("Internal", err) + } + return + } + + if err := encodeGetAccountExtraCurrencyHistoryByIDResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + // handleGetAccountInfoByStateInitRequest handles getAccountInfoByStateInit operation. // // Get account info by state init. @@ -6624,6 +6765,123 @@ func (s *Server) handleGetEventRequest(args [1]string, argsEscaped bool, w http. } } +// handleGetExtraCurrencyInfoRequest handles getExtraCurrencyInfo operation. +// +// Get extra currency info by id. +// +// GET /v2/extra-currency/{id} +func (s *Server) handleGetExtraCurrencyInfoRequest(args [1]string, argsEscaped bool, w http.ResponseWriter, r *http.Request) { + otelAttrs := []attribute.KeyValue{ + otelogen.OperationID("getExtraCurrencyInfo"), + semconv.HTTPMethodKey.String("GET"), + semconv.HTTPRouteKey.String("/v2/extra-currency/{id}"), + } + + // Start a span for this request. + ctx, span := s.cfg.Tracer.Start(r.Context(), "GetExtraCurrencyInfo", + trace.WithAttributes(otelAttrs...), + serverSpanKind, + ) + defer span.End() + + // Run stopwatch. + startTime := time.Now() + defer func() { + elapsedDuration := time.Since(startTime) + // Use floating point division here for higher precision (instead of Millisecond method). + s.duration.Record(ctx, float64(float64(elapsedDuration)/float64(time.Millisecond)), metric.WithAttributes(otelAttrs...)) + }() + + // Increment request counter. + s.requests.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) + + var ( + recordError = func(stage string, err error) { + span.RecordError(err) + span.SetStatus(codes.Error, stage) + s.errors.Add(ctx, 1, metric.WithAttributes(otelAttrs...)) + } + err error + opErrContext = ogenerrors.OperationContext{ + Name: "GetExtraCurrencyInfo", + ID: "getExtraCurrencyInfo", + } + ) + params, err := decodeGetExtraCurrencyInfoParams(args, argsEscaped, r) + if err != nil { + err = &ogenerrors.DecodeParamsError{ + OperationContext: opErrContext, + Err: err, + } + recordError("DecodeParams", err) + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + + var response *EcPreview + if m := s.cfg.Middleware; m != nil { + mreq := middleware.Request{ + Context: ctx, + OperationName: "GetExtraCurrencyInfo", + OperationSummary: "", + OperationID: "getExtraCurrencyInfo", + Body: nil, + Params: middleware.Parameters{ + { + Name: "id", + In: "path", + }: params.ID, + }, + Raw: r, + } + + type ( + Request = struct{} + Params = GetExtraCurrencyInfoParams + Response = *EcPreview + ) + response, err = middleware.HookMiddleware[ + Request, + Params, + Response, + ]( + m, + mreq, + unpackGetExtraCurrencyInfoParams, + func(ctx context.Context, request Request, params Params) (response Response, err error) { + response, err = s.h.GetExtraCurrencyInfo(ctx, params) + return response, err + }, + ) + } else { + response, err = s.h.GetExtraCurrencyInfo(ctx, params) + } + if err != nil { + if errRes, ok := errors.Into[*ErrorStatusCode](err); ok { + if err := encodeErrorResponse(errRes, w, span); err != nil { + recordError("Internal", err) + } + return + } + if errors.Is(err, ht.ErrNotImplemented) { + s.cfg.ErrorHandler(ctx, w, r, err) + return + } + if err := encodeErrorResponse(s.h.NewError(ctx, err), w, span); err != nil { + recordError("Internal", err) + } + return + } + + if err := encodeGetExtraCurrencyInfoResponse(response, w, span); err != nil { + recordError("EncodeResponse", err) + if !errors.Is(err, ht.ErrInternalServerErrorResponse) { + s.cfg.ErrorHandler(ctx, w, r, err) + } + return + } +} + // handleGetInscriptionOpTemplateRequest handles getInscriptionOpTemplate operation. // // Return comment for making operation with inscription. please don't use it if you don't know what diff --git a/pkg/oas/oas_parameters_gen.go b/pkg/oas/oas_parameters_gen.go index b47eb857..108bd843 100644 --- a/pkg/oas/oas_parameters_gen.go +++ b/pkg/oas/oas_parameters_gen.go @@ -2128,6 +2128,445 @@ func decodeGetAccountEventsParams(args [1]string, argsEscaped bool, r *http.Requ return params, nil } +// GetAccountExtraCurrencyHistoryByIDParams is parameters of getAccountExtraCurrencyHistoryByID operation. +type GetAccountExtraCurrencyHistoryByIDParams struct { + // Account ID. + AccountID string + // Extra currency id. + ID int32 + AcceptLanguage OptString + // Omit this parameter to get last events. + BeforeLt OptInt64 + Limit int + StartDate OptInt64 + EndDate OptInt64 +} + +func unpackGetAccountExtraCurrencyHistoryByIDParams(packed middleware.Parameters) (params GetAccountExtraCurrencyHistoryByIDParams) { + { + key := middleware.ParameterKey{ + Name: "account_id", + In: "path", + } + params.AccountID = packed[key].(string) + } + { + key := middleware.ParameterKey{ + Name: "id", + In: "path", + } + params.ID = packed[key].(int32) + } + { + key := middleware.ParameterKey{ + Name: "Accept-Language", + In: "header", + } + if v, ok := packed[key]; ok { + params.AcceptLanguage = v.(OptString) + } + } + { + key := middleware.ParameterKey{ + Name: "before_lt", + In: "query", + } + if v, ok := packed[key]; ok { + params.BeforeLt = v.(OptInt64) + } + } + { + key := middleware.ParameterKey{ + Name: "limit", + In: "query", + } + params.Limit = packed[key].(int) + } + { + key := middleware.ParameterKey{ + Name: "start_date", + In: "query", + } + if v, ok := packed[key]; ok { + params.StartDate = v.(OptInt64) + } + } + { + key := middleware.ParameterKey{ + Name: "end_date", + In: "query", + } + if v, ok := packed[key]; ok { + params.EndDate = v.(OptInt64) + } + } + return params +} + +func decodeGetAccountExtraCurrencyHistoryByIDParams(args [2]string, argsEscaped bool, r *http.Request) (params GetAccountExtraCurrencyHistoryByIDParams, _ error) { + q := uri.NewQueryDecoder(r.URL.Query()) + h := uri.NewHeaderDecoder(r.Header) + // Decode path: account_id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "account_id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + params.AccountID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "account_id", + In: "path", + Err: err, + } + } + // Decode path: id. + if err := func() error { + param := args[1] + if argsEscaped { + unescaped, err := url.PathUnescape(args[1]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt32(val) + if err != nil { + return err + } + + params.ID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "id", + In: "path", + Err: err, + } + } + // Set default value for header: Accept-Language. + { + val := string("en") + params.AcceptLanguage.SetTo(val) + } + // Decode header: Accept-Language. + if err := func() error { + cfg := uri.HeaderParameterDecodingConfig{ + Name: "Accept-Language", + Explode: false, + } + if err := h.HasParam(cfg); err == nil { + if err := h.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotAcceptLanguageVal string + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToString(val) + if err != nil { + return err + } + + paramsDotAcceptLanguageVal = c + return nil + }(); err != nil { + return err + } + params.AcceptLanguage.SetTo(paramsDotAcceptLanguageVal) + return nil + }); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "Accept-Language", + In: "header", + Err: err, + } + } + // Decode query: before_lt. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "before_lt", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotBeforeLtVal int64 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt64(val) + if err != nil { + return err + } + + paramsDotBeforeLtVal = c + return nil + }(); err != nil { + return err + } + params.BeforeLt.SetTo(paramsDotBeforeLtVal) + return nil + }); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "before_lt", + In: "query", + Err: err, + } + } + // Decode query: limit. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "limit", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt(val) + if err != nil { + return err + } + + params.Limit = c + return nil + }); err != nil { + return err + } + if err := func() error { + if err := (validate.Int{ + MinSet: true, + Min: 1, + MaxSet: true, + Max: 1000, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(params.Limit)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "limit", + In: "query", + Err: err, + } + } + // Decode query: start_date. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "start_date", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotStartDateVal int64 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt64(val) + if err != nil { + return err + } + + paramsDotStartDateVal = c + return nil + }(); err != nil { + return err + } + params.StartDate.SetTo(paramsDotStartDateVal) + return nil + }); err != nil { + return err + } + if err := func() error { + if value, ok := params.StartDate.Get(); ok { + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 2114380800, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "start_date", + In: "query", + Err: err, + } + } + // Decode query: end_date. + if err := func() error { + cfg := uri.QueryParameterDecodingConfig{ + Name: "end_date", + Style: uri.QueryStyleForm, + Explode: true, + } + + if err := q.HasParam(cfg); err == nil { + if err := q.DecodeParam(cfg, func(d uri.Decoder) error { + var paramsDotEndDateVal int64 + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt64(val) + if err != nil { + return err + } + + paramsDotEndDateVal = c + return nil + }(); err != nil { + return err + } + params.EndDate.SetTo(paramsDotEndDateVal) + return nil + }); err != nil { + return err + } + if err := func() error { + if value, ok := params.EndDate.Get(); ok { + if err := func() error { + if err := (validate.Int{ + MinSet: false, + Min: 0, + MaxSet: true, + Max: 2114380800, + MinExclusive: false, + MaxExclusive: false, + MultipleOfSet: false, + MultipleOf: 0, + }).Validate(int64(value)); err != nil { + return errors.Wrap(err, "int") + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return err + } + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "end_date", + In: "query", + Err: err, + } + } + return params, nil +} + // GetAccountInscriptionsParams is parameters of getAccountInscriptions operation. type GetAccountInscriptionsParams struct { // Account ID. @@ -7098,6 +7537,72 @@ func decodeGetEventParams(args [1]string, argsEscaped bool, r *http.Request) (pa return params, nil } +// GetExtraCurrencyInfoParams is parameters of getExtraCurrencyInfo operation. +type GetExtraCurrencyInfoParams struct { + // Extra currency id. + ID int32 +} + +func unpackGetExtraCurrencyInfoParams(packed middleware.Parameters) (params GetExtraCurrencyInfoParams) { + { + key := middleware.ParameterKey{ + Name: "id", + In: "path", + } + params.ID = packed[key].(int32) + } + return params +} + +func decodeGetExtraCurrencyInfoParams(args [1]string, argsEscaped bool, r *http.Request) (params GetExtraCurrencyInfoParams, _ error) { + // Decode path: id. + if err := func() error { + param := args[0] + if argsEscaped { + unescaped, err := url.PathUnescape(args[0]) + if err != nil { + return errors.Wrap(err, "unescape path") + } + param = unescaped + } + if len(param) > 0 { + d := uri.NewPathDecoder(uri.PathDecoderConfig{ + Param: "id", + Value: param, + Style: uri.PathStyleSimple, + Explode: false, + }) + + if err := func() error { + val, err := d.DecodeValue() + if err != nil { + return err + } + + c, err := conv.ToInt32(val) + if err != nil { + return err + } + + params.ID = c + return nil + }(); err != nil { + return err + } + } else { + return validate.ErrFieldRequired + } + return nil + }(); err != nil { + return params, &ogenerrors.DecodeParamError{ + Name: "id", + In: "path", + Err: err, + } + } + return params, nil +} + // GetInscriptionOpTemplateParams is parameters of getInscriptionOpTemplate operation. type GetInscriptionOpTemplateParams struct { Type GetInscriptionOpTemplateType diff --git a/pkg/oas/oas_response_encoders_gen.go b/pkg/oas/oas_response_encoders_gen.go index 9efbcf4c..e6811bb2 100644 --- a/pkg/oas/oas_response_encoders_gen.go +++ b/pkg/oas/oas_response_encoders_gen.go @@ -259,6 +259,20 @@ func encodeGetAccountEventsResponse(response *AccountEvents, w http.ResponseWrit return nil } +func encodeGetAccountExtraCurrencyHistoryByIDResponse(response *AccountEvents, w http.ResponseWriter, span trace.Span) error { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil +} + func encodeGetAccountInfoByStateInitResponse(response *AccountInfoByStateInit, w http.ResponseWriter, span trace.Span) error { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(200) @@ -763,6 +777,20 @@ func encodeGetEventResponse(response *Event, w http.ResponseWriter, span trace.S return nil } +func encodeGetExtraCurrencyInfoResponse(response *EcPreview, w http.ResponseWriter, span trace.Span) error { + w.Header().Set("Content-Type", "application/json; charset=utf-8") + w.WriteHeader(200) + span.SetStatus(codes.Ok, http.StatusText(200)) + + e := new(jx.Encoder) + response.Encode(e) + if _, err := e.WriteTo(w); err != nil { + return errors.Wrap(err, "write") + } + + return nil +} + func encodeGetInscriptionOpTemplateResponse(response *GetInscriptionOpTemplateOK, w http.ResponseWriter, span trace.Span) error { w.Header().Set("Content-Type", "application/json; charset=utf-8") w.WriteHeader(200) diff --git a/pkg/oas/oas_router_gen.go b/pkg/oas/oas_router_gen.go index 9770d744..27d219c4 100644 --- a/pkg/oas/oas_router_gen.go +++ b/pkg/oas/oas_router_gen.go @@ -261,56 +261,90 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } elem = origElem - case 'e': // Prefix: "events" + case 'e': // Prefix: "e" origElem := elem - if l := len("events"); len(elem) >= l && elem[0:l] == "events" { + if l := len("e"); len(elem) >= l && elem[0:l] == "e" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch r.Method { - case "GET": - s.handleGetAccountEventsRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "GET") - } - - return + break } switch elem[0] { - case '/': // Prefix: "/" + case 'v': // Prefix: "vents" origElem := elem - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + if l := len("vents"); len(elem) >= l && elem[0:l] == "vents" { elem = elem[l:] } else { break } if len(elem) == 0 { - break + switch r.Method { + case "GET": + s.handleGetAccountEventsRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return } switch elem[0] { - case 'e': // Prefix: "emulate" + case '/': // Prefix: "/" origElem := elem - if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { elem = elem[l:] } else { break } + if len(elem) == 0 { + break + } + switch elem[0] { + case 'e': // Prefix: "emulate" + origElem := elem + if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "POST": + s.handleEmulateMessageToAccountEventRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "POST") + } + + return + } + + elem = origElem + } + // Param: "event_id" + // Leaf parameter + args[1] = elem + elem = "" + if len(elem) == 0 { // Leaf node. switch r.Method { - case "POST": - s.handleEmulateMessageToAccountEventRequest([1]string{ + case "GET": + s.handleGetAccountEventRequest([2]string{ args[0], + args[1], }, elemIsEscaped, w, r) default: - s.notAllowed(w, r, "POST") + s.notAllowed(w, r, "GET") } return @@ -318,24 +352,53 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { elem = origElem } - // Param: "event_id" - // Leaf parameter - args[1] = elem - elem = "" + + elem = origElem + case 'x': // Prefix: "xtra-currency/" + origElem := elem + if l := len("xtra-currency/"); len(elem) >= l && elem[0:l] == "xtra-currency/" { + elem = elem[l:] + } else { + break + } + + // Param: "id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[1] = elem[:idx] + elem = elem[idx:] if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetAccountEventRequest([2]string{ - args[0], - args[1], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "GET") + break + } + switch elem[0] { + case '/': // Prefix: "/history" + origElem := elem + if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { + elem = elem[l:] + } else { + break } - return + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetAccountExtraCurrencyHistoryByIDRequest([2]string{ + args[0], + args[1], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + + elem = origElem } elem = origElem @@ -1466,9 +1529,9 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { } elem = origElem - case 'x': // Prefix: "xperimental/" + case 'x': // Prefix: "x" origElem := elem - if l := len("xperimental/"); len(elem) >= l && elem[0:l] == "xperimental/" { + if l := len("x"); len(elem) >= l && elem[0:l] == "x" { elem = elem[l:] } else { break @@ -1478,118 +1541,133 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { break } switch elem[0] { - case 'a': // Prefix: "accounts/" + case 'p': // Prefix: "perimental/" origElem := elem - if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { + if l := len("perimental/"); len(elem) >= l && elem[0:l] == "perimental/" { elem = elem[l:] } else { break } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - if len(elem) == 0 { break } switch elem[0] { - case '/': // Prefix: "/inscriptions" + case 'a': // Prefix: "accounts/" origElem := elem - if l := len("/inscriptions"); len(elem) >= l && elem[0:l] == "/inscriptions" { + if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { elem = elem[l:] } else { break } - if len(elem) == 0 { - switch r.Method { - case "GET": - s.handleGetAccountInscriptionsRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "GET") - } + // Param: "account_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] - return + if len(elem) == 0 { + break } switch elem[0] { - case '/': // Prefix: "/" + case '/': // Prefix: "/inscriptions" origElem := elem - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + if l := len("/inscriptions"); len(elem) >= l && elem[0:l] == "/inscriptions" { elem = elem[l:] } else { break } if len(elem) == 0 { - break + switch r.Method { + case "GET": + s.handleGetAccountInscriptionsRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return } switch elem[0] { - case 'h': // Prefix: "history" + case '/': // Prefix: "/" origElem := elem - if l := len("history"); len(elem) >= l && elem[0:l] == "history" { + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { elem = elem[l:] } else { break } if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetAccountInscriptionsHistoryRequest([1]string{ - args[0], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "GET") + break + } + switch elem[0] { + case 'h': // Prefix: "history" + origElem := elem + if l := len("history"); len(elem) >= l && elem[0:l] == "history" { + elem = elem[l:] + } else { + break } - return - } + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetAccountInscriptionsHistoryRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "GET") + } - elem = origElem - } - // Param: "ticker" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[1] = elem[:idx] - elem = elem[idx:] + return + } - if len(elem) == 0 { - break - } - switch elem[0] { - case '/': // Prefix: "/history" - origElem := elem - if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { - elem = elem[l:] - } else { - break + elem = origElem } + // Param: "ticker" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[1] = elem[:idx] + elem = elem[idx:] if len(elem) == 0 { - // Leaf node. - switch r.Method { - case "GET": - s.handleGetAccountInscriptionsHistoryByTickerRequest([2]string{ - args[0], - args[1], - }, elemIsEscaped, w, r) - default: - s.notAllowed(w, r, "GET") + break + } + switch elem[0] { + case '/': // Prefix: "/history" + origElem := elem + if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { + elem = elem[l:] + } else { + break } - return + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetAccountInscriptionsHistoryByTickerRequest([2]string{ + args[0], + args[1], + }, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + + elem = origElem } elem = origElem @@ -1598,23 +1676,51 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { elem = origElem } + elem = origElem + case 'i': // Prefix: "inscriptions/op-template" + origElem := elem + if l := len("inscriptions/op-template"); len(elem) >= l && elem[0:l] == "inscriptions/op-template" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + // Leaf node. + switch r.Method { + case "GET": + s.handleGetInscriptionOpTemplateRequest([0]string{}, elemIsEscaped, w, r) + default: + s.notAllowed(w, r, "GET") + } + + return + } + elem = origElem } elem = origElem - case 'i': // Prefix: "inscriptions/op-template" + case 't': // Prefix: "tra-currency/" origElem := elem - if l := len("inscriptions/op-template"); len(elem) >= l && elem[0:l] == "inscriptions/op-template" { + if l := len("tra-currency/"); len(elem) >= l && elem[0:l] == "tra-currency/" { elem = elem[l:] } else { break } + // Param: "id" + // Leaf parameter + args[0] = elem + elem = "" + if len(elem) == 0 { // Leaf node. switch r.Method { case "GET": - s.handleGetInscriptionOpTemplateRequest([0]string{}, elemIsEscaped, w, r) + s.handleGetExtraCurrencyInfoRequest([1]string{ + args[0], + }, elemIsEscaped, w, r) default: s.notAllowed(w, r, "GET") } @@ -3598,59 +3704,94 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { } elem = origElem - case 'e': // Prefix: "events" + case 'e': // Prefix: "e" origElem := elem - if l := len("events"); len(elem) >= l && elem[0:l] == "events" { + if l := len("e"); len(elem) >= l && elem[0:l] == "e" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetAccountEvents" - r.summary = "" - r.operationID = "getAccountEvents" - r.pathPattern = "/v2/accounts/{account_id}/events" - r.args = args - r.count = 1 - return r, true - default: - return - } + break } switch elem[0] { - case '/': // Prefix: "/" + case 'v': // Prefix: "vents" origElem := elem - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + if l := len("vents"); len(elem) >= l && elem[0:l] == "vents" { elem = elem[l:] } else { break } if len(elem) == 0 { - break + switch method { + case "GET": + r.name = "GetAccountEvents" + r.summary = "" + r.operationID = "getAccountEvents" + r.pathPattern = "/v2/accounts/{account_id}/events" + r.args = args + r.count = 1 + return r, true + default: + return + } } switch elem[0] { - case 'e': // Prefix: "emulate" + case '/': // Prefix: "/" origElem := elem - if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { elem = elem[l:] } else { break } + if len(elem) == 0 { + break + } + switch elem[0] { + case 'e': // Prefix: "emulate" + origElem := elem + if l := len("emulate"); len(elem) >= l && elem[0:l] == "emulate" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "POST": + // Leaf: EmulateMessageToAccountEvent + r.name = "EmulateMessageToAccountEvent" + r.summary = "" + r.operationID = "emulateMessageToAccountEvent" + r.pathPattern = "/v2/accounts/{account_id}/events/emulate" + r.args = args + r.count = 1 + return r, true + default: + return + } + } + + elem = origElem + } + // Param: "event_id" + // Leaf parameter + args[1] = elem + elem = "" + if len(elem) == 0 { switch method { - case "POST": - // Leaf: EmulateMessageToAccountEvent - r.name = "EmulateMessageToAccountEvent" + case "GET": + // Leaf: GetAccountEvent + r.name = "GetAccountEvent" r.summary = "" - r.operationID = "emulateMessageToAccountEvent" - r.pathPattern = "/v2/accounts/{account_id}/events/emulate" + r.operationID = "getAccountEvent" + r.pathPattern = "/v2/accounts/{account_id}/events/{event_id}" r.args = args - r.count = 1 + r.count = 2 return r, true default: return @@ -3659,25 +3800,54 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { elem = origElem } - // Param: "event_id" - // Leaf parameter - args[1] = elem - elem = "" + + elem = origElem + case 'x': // Prefix: "xtra-currency/" + origElem := elem + if l := len("xtra-currency/"); len(elem) >= l && elem[0:l] == "xtra-currency/" { + elem = elem[l:] + } else { + break + } + + // Param: "id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[1] = elem[:idx] + elem = elem[idx:] if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetAccountEvent - r.name = "GetAccountEvent" - r.summary = "" - r.operationID = "getAccountEvent" - r.pathPattern = "/v2/accounts/{account_id}/events/{event_id}" - r.args = args - r.count = 2 - return r, true - default: - return + break + } + switch elem[0] { + case '/': // Prefix: "/history" + origElem := elem + if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAccountExtraCurrencyHistoryByID + r.name = "GetAccountExtraCurrencyHistoryByID" + r.summary = "" + r.operationID = "getAccountExtraCurrencyHistoryByID" + r.pathPattern = "/v2/accounts/{account_id}/extra-currency/{id}/history" + r.args = args + r.count = 2 + return r, true + default: + return + } } + + elem = origElem } elem = origElem @@ -4897,9 +5067,9 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { } elem = origElem - case 'x': // Prefix: "xperimental/" + case 'x': // Prefix: "x" origElem := elem - if l := len("xperimental/"); len(elem) >= l && elem[0:l] == "xperimental/" { + if l := len("x"); len(elem) >= l && elem[0:l] == "x" { elem = elem[l:] } else { break @@ -4909,123 +5079,138 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { break } switch elem[0] { - case 'a': // Prefix: "accounts/" + case 'p': // Prefix: "perimental/" origElem := elem - if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { + if l := len("perimental/"); len(elem) >= l && elem[0:l] == "perimental/" { elem = elem[l:] } else { break } - // Param: "account_id" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[0] = elem[:idx] - elem = elem[idx:] - if len(elem) == 0 { break } switch elem[0] { - case '/': // Prefix: "/inscriptions" + case 'a': // Prefix: "accounts/" origElem := elem - if l := len("/inscriptions"); len(elem) >= l && elem[0:l] == "/inscriptions" { + if l := len("accounts/"); len(elem) >= l && elem[0:l] == "accounts/" { elem = elem[l:] } else { break } + // Param: "account_id" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[0] = elem[:idx] + elem = elem[idx:] + if len(elem) == 0 { - switch method { - case "GET": - r.name = "GetAccountInscriptions" - r.summary = "" - r.operationID = "getAccountInscriptions" - r.pathPattern = "/v2/experimental/accounts/{account_id}/inscriptions" - r.args = args - r.count = 1 - return r, true - default: - return - } + break } switch elem[0] { - case '/': // Prefix: "/" + case '/': // Prefix: "/inscriptions" origElem := elem - if l := len("/"); len(elem) >= l && elem[0:l] == "/" { + if l := len("/inscriptions"); len(elem) >= l && elem[0:l] == "/inscriptions" { elem = elem[l:] } else { break } if len(elem) == 0 { - break + switch method { + case "GET": + r.name = "GetAccountInscriptions" + r.summary = "" + r.operationID = "getAccountInscriptions" + r.pathPattern = "/v2/experimental/accounts/{account_id}/inscriptions" + r.args = args + r.count = 1 + return r, true + default: + return + } } switch elem[0] { - case 'h': // Prefix: "history" + case '/': // Prefix: "/" origElem := elem - if l := len("history"); len(elem) >= l && elem[0:l] == "history" { + if l := len("/"); len(elem) >= l && elem[0:l] == "/" { elem = elem[l:] } else { break } if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetAccountInscriptionsHistory - r.name = "GetAccountInscriptionsHistory" - r.summary = "" - r.operationID = "getAccountInscriptionsHistory" - r.pathPattern = "/v2/experimental/accounts/{account_id}/inscriptions/history" - r.args = args - r.count = 1 - return r, true - default: - return - } + break } + switch elem[0] { + case 'h': // Prefix: "history" + origElem := elem + if l := len("history"); len(elem) >= l && elem[0:l] == "history" { + elem = elem[l:] + } else { + break + } - elem = origElem - } - // Param: "ticker" - // Match until "/" - idx := strings.IndexByte(elem, '/') - if idx < 0 { - idx = len(elem) - } - args[1] = elem[:idx] - elem = elem[idx:] + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAccountInscriptionsHistory + r.name = "GetAccountInscriptionsHistory" + r.summary = "" + r.operationID = "getAccountInscriptionsHistory" + r.pathPattern = "/v2/experimental/accounts/{account_id}/inscriptions/history" + r.args = args + r.count = 1 + return r, true + default: + return + } + } - if len(elem) == 0 { - break - } - switch elem[0] { - case '/': // Prefix: "/history" - origElem := elem - if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { - elem = elem[l:] - } else { - break + elem = origElem } + // Param: "ticker" + // Match until "/" + idx := strings.IndexByte(elem, '/') + if idx < 0 { + idx = len(elem) + } + args[1] = elem[:idx] + elem = elem[idx:] if len(elem) == 0 { - switch method { - case "GET": - // Leaf: GetAccountInscriptionsHistoryByTicker - r.name = "GetAccountInscriptionsHistoryByTicker" - r.summary = "" - r.operationID = "getAccountInscriptionsHistoryByTicker" - r.pathPattern = "/v2/experimental/accounts/{account_id}/inscriptions/{ticker}/history" - r.args = args - r.count = 2 - return r, true - default: - return + break + } + switch elem[0] { + case '/': // Prefix: "/history" + origElem := elem + if l := len("/history"); len(elem) >= l && elem[0:l] == "/history" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetAccountInscriptionsHistoryByTicker + r.name = "GetAccountInscriptionsHistoryByTicker" + r.summary = "" + r.operationID = "getAccountInscriptionsHistoryByTicker" + r.pathPattern = "/v2/experimental/accounts/{account_id}/inscriptions/{ticker}/history" + r.args = args + r.count = 2 + return r, true + default: + return + } } + + elem = origElem } elem = origElem @@ -5034,28 +5219,58 @@ func (s *Server) FindPath(method string, u *url.URL) (r Route, _ bool) { elem = origElem } + elem = origElem + case 'i': // Prefix: "inscriptions/op-template" + origElem := elem + if l := len("inscriptions/op-template"); len(elem) >= l && elem[0:l] == "inscriptions/op-template" { + elem = elem[l:] + } else { + break + } + + if len(elem) == 0 { + switch method { + case "GET": + // Leaf: GetInscriptionOpTemplate + r.name = "GetInscriptionOpTemplate" + r.summary = "" + r.operationID = "getInscriptionOpTemplate" + r.pathPattern = "/v2/experimental/inscriptions/op-template" + r.args = args + r.count = 0 + return r, true + default: + return + } + } + elem = origElem } elem = origElem - case 'i': // Prefix: "inscriptions/op-template" + case 't': // Prefix: "tra-currency/" origElem := elem - if l := len("inscriptions/op-template"); len(elem) >= l && elem[0:l] == "inscriptions/op-template" { + if l := len("tra-currency/"); len(elem) >= l && elem[0:l] == "tra-currency/" { elem = elem[l:] } else { break } + // Param: "id" + // Leaf parameter + args[0] = elem + elem = "" + if len(elem) == 0 { switch method { case "GET": - // Leaf: GetInscriptionOpTemplate - r.name = "GetInscriptionOpTemplate" + // Leaf: GetExtraCurrencyInfo + r.name = "GetExtraCurrencyInfo" r.summary = "" - r.operationID = "getInscriptionOpTemplate" - r.pathPattern = "/v2/experimental/inscriptions/op-template" + r.operationID = "getExtraCurrencyInfo" + r.pathPattern = "/v2/extra-currency/{id}" r.args = args - r.count = 0 + r.count = 1 return r, true default: return diff --git a/pkg/oas/oas_server_gen.go b/pkg/oas/oas_server_gen.go index c06b8774..6947616d 100644 --- a/pkg/oas/oas_server_gen.go +++ b/pkg/oas/oas_server_gen.go @@ -122,6 +122,12 @@ type Handler interface { // // GET /v2/accounts/{account_id}/events GetAccountEvents(ctx context.Context, params GetAccountEventsParams) (*AccountEvents, error) + // GetAccountExtraCurrencyHistoryByID implements getAccountExtraCurrencyHistoryByID operation. + // + // Get the transfer history of extra currencies for an account. + // + // GET /v2/accounts/{account_id}/extra-currency/{id}/history + GetAccountExtraCurrencyHistoryByID(ctx context.Context, params GetAccountExtraCurrencyHistoryByIDParams) (*AccountEvents, error) // GetAccountInfoByStateInit implements getAccountInfoByStateInit operation. // // Get account info by state init. @@ -349,6 +355,12 @@ type Handler interface { // // GET /v2/events/{event_id} GetEvent(ctx context.Context, params GetEventParams) (*Event, error) + // GetExtraCurrencyInfo implements getExtraCurrencyInfo operation. + // + // Get extra currency info by id. + // + // GET /v2/extra-currency/{id} + GetExtraCurrencyInfo(ctx context.Context, params GetExtraCurrencyInfoParams) (*EcPreview, error) // GetInscriptionOpTemplate implements getInscriptionOpTemplate operation. // // Return comment for making operation with inscription. please don't use it if you don't know what diff --git a/pkg/oas/oas_unimplemented_gen.go b/pkg/oas/oas_unimplemented_gen.go index 659e7a0d..4d81e570 100644 --- a/pkg/oas/oas_unimplemented_gen.go +++ b/pkg/oas/oas_unimplemented_gen.go @@ -181,6 +181,15 @@ func (UnimplementedHandler) GetAccountEvents(ctx context.Context, params GetAcco return r, ht.ErrNotImplemented } +// GetAccountExtraCurrencyHistoryByID implements getAccountExtraCurrencyHistoryByID operation. +// +// Get the transfer history of extra currencies for an account. +// +// GET /v2/accounts/{account_id}/extra-currency/{id}/history +func (UnimplementedHandler) GetAccountExtraCurrencyHistoryByID(ctx context.Context, params GetAccountExtraCurrencyHistoryByIDParams) (r *AccountEvents, _ error) { + return r, ht.ErrNotImplemented +} + // GetAccountInfoByStateInit implements getAccountInfoByStateInit operation. // // Get account info by state init. @@ -516,6 +525,15 @@ func (UnimplementedHandler) GetEvent(ctx context.Context, params GetEventParams) return r, ht.ErrNotImplemented } +// GetExtraCurrencyInfo implements getExtraCurrencyInfo operation. +// +// Get extra currency info by id. +// +// GET /v2/extra-currency/{id} +func (UnimplementedHandler) GetExtraCurrencyInfo(ctx context.Context, params GetExtraCurrencyInfoParams) (r *EcPreview, _ error) { + return r, ht.ErrNotImplemented +} + // GetInscriptionOpTemplate implements getInscriptionOpTemplate operation. // // Return comment for making operation with inscription. please don't use it if you don't know what