Skip to content

Commit

Permalink
Update protobuf definitions
Browse files Browse the repository at this point in the history
Update the protobuf definitons to the latest version and implement the
new request and response message.
  • Loading branch information
diegobernardes committed Nov 21, 2023
1 parent b925611 commit 594376a
Show file tree
Hide file tree
Showing 6 changed files with 2,102 additions and 1,716 deletions.
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ compile-proto:
&& apt-get install --yes --no-install-recommends protobuf-compiler=3.* \
&& rm -rf /var/lib/apt/lists/* \
&& go install google.golang.org/protobuf/cmd/[email protected]
GIT CLONE --branch 86 https://github.com/spotware/openapi-proto-messages.git openapi-proto-messages
GIT CLONE --branch 88 https://github.com/spotware/openapi-proto-messages.git openapi-proto-messages
RUN cd openapi-proto-messages \
&& protoc --go_out=. --go_opt=paths=source_relative *.proto \
&& find . ! \( -name '*.go' \) -delete
Expand Down
4 changes: 4 additions & 0 deletions ctrader.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ func mappingResponse(payloadType uint32) (proto.Message, error) {
response = &openapi.ProtoOAGetDynamicLeverageByIDRes{}
case uint32(openapi.ProtoOAPayloadType_PROTO_OA_DEAL_LIST_BY_POSITION_ID_RES):
response = &openapi.ProtoOADealListByPositionIdRes{}
case uint32(openapi.ProtoOAPayloadType_PROTO_OA_GET_POSITION_UNREALIZED_PNL_RES):
response = &openapi.ProtoOAGetPositionUnrealizedPnLRes{}
default:
return nil, undefinedProtobufResourceError[uint32]{Value: payloadType}
}
Expand Down Expand Up @@ -226,6 +228,8 @@ func mappingPayloadType(t proto.Message) (openapi.ProtoOAPayloadType, error) {
return openapi.ProtoOAPayloadType_PROTO_OA_ORDER_LIST_BY_POSITION_ID_REQ, nil
case *openapi.ProtoOADealOffsetListReq:
return openapi.ProtoOAPayloadType_PROTO_OA_DEAL_OFFSET_LIST_REQ, nil
case *openapi.ProtoOAGetPositionUnrealizedPnLReq:
return openapi.ProtoOAPayloadType_PROTO_OA_GET_POSITION_UNREALIZED_PNL_REQ, nil
default:
return 0, undefinedProtobufResourceError[string]{Value: reflect.TypeOf(t).String()}
}
Expand Down
16 changes: 9 additions & 7 deletions openapi/OpenApiCommonMessages.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion openapi/OpenApiCommonModelMessages.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 594376a

Please sign in to comment.