Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GO-4351 Membership v2 API WiP: cart, store #1736

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
996 changes: 672 additions & 324 deletions clientlibrary/service/service.pb.go

Large diffs are not rendered by default.

971 changes: 948 additions & 23 deletions docs/proto.md

Large diffs are not rendered by default.

73,274 changes: 40,304 additions & 32,970 deletions pb/commands.pb.go

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pb/events.pb.go

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

251 changes: 250 additions & 1 deletion pb/protos/commands.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6866,7 +6866,7 @@ message Rpc {
// will feature current billing ID
// stripe.com/?client_reference_id=1234
string paymentUrl = 2;
// billingID is only needed for mobile clients
// billingId is only needed for mobile clients
string billingId = 3;

message Error {
Expand Down Expand Up @@ -7564,6 +7564,255 @@ message Rpc {
}
}
}

message MembershipV2 {
message GetStatus {
message Request {
}

message Response {
Error error = 1;
repeated anytype.model.MembershipV2.PurchasedProduct products = 2;
anytype.model.MembershipV2.Invoice nextInvoice = 3;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
}
}
}
}

// Some products require extra allocation step
message ProductAllocateToSpace {
message Request {
string spaceId = 1;
// index in the list of products (from Store.ProductsEnumerate)
uint32 productIndex = 2;
// some additional data
string context = 3;
}

message Response {
Error error = 1;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}

message ProductSetSettings {
message Request {
// index in the list of products (from Store.ProductsEnumerate)
uint32 productIndex = 1;
// renew from next period
bool isRenewalEnabled = 2;
}

message Response {
Error error = 1;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}
}

message Store {
message ProductsEnumerate {
message Request {
}

message Response {
Error error = 1;
repeated anytype.model.MembershipV2.StoreProduct products = 2;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}

message Cart {
message Get {
message Request {
}

message Response {
Error error = 1;
anytype.model.MembershipV2.Cart cart = 2;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}

message ProductAdd {
message Request {
string productId = 1;
// if "isAttachedToSpace" was true for that product
string spaceId = 2;
// some additional context (extra)
string context = 3;
}

message Response {
Error error = 1;
anytype.model.MembershipV2.Cart cart = 2;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}

message ProductRemove {
message Request {
// each product instance has a unique index
// each product instance can have a different "context" attached (like spaceId)
string index = 1;
}

message Response {
Error error = 1;
anytype.model.MembershipV2.Cart cart = 2;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}

message PromocodeApply {
message Request {
string promocode = 1;
}

message Response {
Error error = 1;
anytype.model.MembershipV2.Cart cart = 2;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}

// redirect user to the payment page
message Checkout {
message Request {
}

message Response {
Error error = 1;
string paymentUrl = 2;

message Error {
Code code = 1;
string description = 2;

enum Code {
NULL = 0;
UNKNOWN_ERROR = 1;
BAD_INPUT = 2;
NOT_LOGGED_IN = 3;
PAYMENT_NODE_ERROR = 4;
CACHE_ERROR = 5;
CAN_NOT_CONNECT = 6;
}
}
}
}
}
}
}


Expand Down
12 changes: 12 additions & 0 deletions pb/protos/service/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -372,4 +372,16 @@ service ClientCommands {
rpc ChatUnsubscribe (anytype.Rpc.Chat.Unsubscribe.Request) returns (anytype.Rpc.Chat.Unsubscribe.Response);
rpc ObjectChatAdd (anytype.Rpc.Object.ChatAdd.Request) returns (anytype.Rpc.Object.ChatAdd.Response);

// Store
rpc StoreProductsEnumerate (anytype.Rpc.Store.ProductsEnumerate.Request) returns (anytype.Rpc.Store.ProductsEnumerate.Response);
rpc StoreCartGet (anytype.Rpc.Store.Cart.Get.Request) returns (anytype.Rpc.Store.Cart.Get.Response);
rpc StoreCartProductAdd (anytype.Rpc.Store.Cart.ProductAdd.Request) returns (anytype.Rpc.Store.Cart.ProductAdd.Response);
rpc StoreCartProductRemove (anytype.Rpc.Store.Cart.ProductRemove.Request) returns (anytype.Rpc.Store.Cart.ProductRemove.Response);
rpc StoreCartPromocodeApply (anytype.Rpc.Store.Cart.PromocodeApply.Request) returns (anytype.Rpc.Store.Cart.PromocodeApply.Response);
rpc StoreCartCheckout (anytype.Rpc.Store.Cart.Checkout.Request) returns (anytype.Rpc.Store.Cart.Checkout.Response);

// MembershipV2
rpc MembershipV2GetStatus (anytype.Rpc.MembershipV2.GetStatus.Request) returns (anytype.Rpc.MembershipV2.GetStatus.Response);
rpc MembershipV2ProductAllocateToSpace (anytype.Rpc.MembershipV2.ProductAllocateToSpace.Request) returns (anytype.Rpc.MembershipV2.ProductAllocateToSpace.Response);
rpc MembershipV2ProductSetSettings (anytype.Rpc.MembershipV2.ProductSetSettings.Request) returns (anytype.Rpc.MembershipV2.ProductSetSettings.Response);
}
Loading
Loading