Skip to content

gRPC Protocol Documentation for APIs to serve the soul of CarryMates

Notifications You must be signed in to change notification settings

krhitesh/readme-mds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 

Repository files navigation

Protocol Documentation

Table of Contents

Top

accepted_transactions.proto

Accepted Transaction related messages

AcceptedTransactionMessage

Represents an Accepted Transaction

Field Type Label Description
item_id string
travel_plan_id string
traveller_id string
owner_id string
non_owner_id string
owner_type PersonType
non_owner_type PersonType
item_status Status
travel_plan_status Status
requested_by_traveller bool Represents if the initial request was made by traveller or not

CompletedTransactionMessage

Represents a message to complete a transaction

Field Type Label Description
item_id string
travel_plan_id string
completed_by_user_id string

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

ExpireTransactionMessage

Represents a message to expire a given transaction

Field Type Label Description
item_id string
travel_plan_id string
expire_item bool Represents if item is expired or travelplan is expired

Response

Represents a AcceptedTransactionService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

StatusChangeToNotFinalizedMessage

Represents a message to change status to NOT_FINALIZED of both item and travel plan

Field Type Label Description
item_id string
travel_plan_id string

StatusChangeToOnMoveMessage

Represents a message to change status to ON_MOVE of both item and travel plan

Field Type Label Description
item_id string
travel_plan_id string

Value

Field Type Label Description
accepted_transaction_message_value AcceptedTransactionMessage AcceptedTransactionMessage value
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

Represents a NULL value

Name Number Description
NULL_VALUE 0 NULL value

AcceptedTransactionService

Service for handling events after transaction is finalized

Method Name Request Type Response Type Description
CreateAcceptedTransaction AcceptedTransactionMessage Response Creates an accepted transaction
StatusChangeToNotFinalized StatusChangeToNotFinalizedMessage Response Sets status of item and travel plan to NOT_FINALIZED. Delete's the accepted transaction, sets item status and travel plan status to IN_REQUEST, creates a RequestPost iff both item and travel plan are not expired, updates statuses of all other request posts of that item and that travel plan.
StatusChangeToOnMove StatusChangeToOnMoveMessage Response Sets the status of accepted transaction to ON_MOVE, updates the status of ItemPost and TravelPlanPost to ON_MOVE as well and deletes all RequestPosts of Item and TravelPlan.
CompleteTransaction CompletedTransactionMessage Response Completes the ON_MOVE transaction. Creates a CompletedTransaction document (for History), gets the item's name from Item and calls createPendingRatingsForCTId from PendingRatingServiceGrpc to create 6 pendingRating documents to provided ratings for all users involved in the transaction, deletes ItemPost and TravelPlanPost
ExpireTransaction ExpireTransactionMessage Response Expires the accepted transaction to denote that the item/travel plans's time has passed. If ExpireTransactionMessage.expireItem is set true, sets itemExpired=true otherwise travelPlanExpired=true

Top

account.proto

User.Account related messages.

Account

Represents a complete Account

Field Type Label Description
number_of_authorisations int32
number_of_recommendations int32
rating double
number_of_ratings int32
personality_structure PersonalityStructure Personality Structure
rating_structure RatingStructure Rating Structure
comments DisplayComment repeated Comment from or to a given user

DisplayComment

Represents a comment from or to a given user

Field Type Label Description
from string UserId
to string UserId
given bool
rating double
timestamp int64

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

Response

Represents a UserService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

UpdateAccountMessage

Represents an User.Account update message

Field Type Label Description
user_id string
personality_structure PersonalityStructure
rating double
recommended bool

UserIdentification

Message to identify User.Account

Field Type Label Description
user_id string

Value

Represents Value

Field Type Label Description
account_value Account Account value
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

AccountService

Service for handling User.Account

Method Name Request Type Response Type Description
CreateAccount UserIdentification Response Creates an account document of a given user
GetAccountInfo UserIdentification Response Returns aggregated Account info by collecting data of a given userId from User collection and itself.
UpdateAccount UpdateAccountMessage Response Aggregates a new rating to a given user

Top

annotations.proto

File-level Extensions

Extension Type Base Number Description
http HttpRule .google.protobuf.MethodOptions 72295728 See HttpRule.

Top

basic_enums.proto

Basic enum objects.

CurrencyUnit

Represents local currency unit

Name Number Description
RS 0 Default

DimensionUnit

Represents dimension unit of length/width/height

Name Number Description
CM 0 Default
IN 1

DistanceUnit

Represents distance unit

Name Number Description
KM 0
MT 1

ModeOfTravel

Represents mode of travel of a travel plan

Name Number Description
RAIL 0
ROAD 1
AIR 2

PersonType

Represents type of person

Name Number Description
SENDER 0
RECEIVER 1
TRAVELLER 2

Status

Represents status of item/travel plan

Name Number Description
NOT_FINALIZED 0 Default
FINALIZED 1
ON_MOVE 2
IN_REQUEST 3

WeightUnit

Represents weight unit

Name Number Description
KG 0 Default
GM 1

Top

common.proto

Common messages

PersonalityStructure

Account's Personality Structure

Field Type Label Description
good_behavior int32
good_communication int32
punctual int32
reliable int32

RatingStructure

Account's RatingStructure

Field Type Label Description
disappointing int32
excellent int32
good int32
outstanding int32
poor int32

Top

completed_transaction.proto

Completed Transaction related messages

CompletedTransactionMessage

Represents a CompletedTransaction

Field Type Label Description
completed_by_user string UserId of the user who initiated the completion
completed_on int64 Date of completion of this transaction
item_id string
travel_plan_id string
traveller_id string
owner_id string
non_owner_id string
owner_type PersonType
non_owner_type PersonType
requested_by_traveller bool Represents if this transaction was initially requested by traveller or not
item_expired bool Represents if item has expired or not
travel_plan_expired bool
transit_end_date int64
transit_start_date int64
transit_start_otp string
transit_end_otp string
item_status Status
travel_plan_status Status

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

Response

Represents a CompletedTransactionService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

Value

Represents a return Value

Field Type Label Description
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

CompletedTransactionService

Service for handling CompletedTransaction

Method Name Request Type Response Type Description
CreateCompletedTransaction CompletedTransactionMessage Response Creates a new CompletedTransaction

Top

http.proto

CustomHttpPattern

A custom pattern is used for defining custom HTTP verb.

Field Type Label Description
kind string The name of this custom HTTP verb.
path string The path matched by this custom verb.

Http

Defines the HTTP configuration for an API service. It contains a list of [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method to one or more HTTP REST API methods.

Field Type Label Description
rules HttpRule repeated A list of HTTP configuration rules that apply to individual API methods.

NOTE: All service configuration rules follow "last one wins" order. | | fully_decode_reserved_expansion | bool | | When set to true, URL path parmeters will be fully URI-decoded except in cases of single segment matches in reserved expansion, where "%2F" will be left encoded.

The default behavior is to not decode RFC 6570 reserved characters in multi segment matches. |

HttpRule

HttpRule defines the mapping of an RPC method to one or more HTTP REST API methods. The mapping specifies how different portions of the RPC request message are mapped to URL path, URL query parameters, and HTTP request body. The mapping is typically specified as an google.api.http annotation on the RPC method, see "google/api/annotations.proto" for details.

The mapping consists of a field specifying the path template and method kind. The path template can refer to fields in the request message, as in the example below which describes a REST GET operation on a resource collection of messages:

service Messaging {
  rpc GetMessage(GetMessageRequest) returns (Message) {
    option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
  }
}
message GetMessageRequest {
  message SubMessage {
    string subfield = 1;
  }
  string message_id = 1; // mapped to the URL
  SubMessage sub = 2;    // `sub.subfield` is url-mapped
}
message Message {
  string text = 1; // content of the resource
}

The same http annotation can alternatively be expressed inside the GRPC API Configuration YAML file.

http:
  rules:
    - selector: <proto_package_name>.Messaging.GetMessage
      get: /v1/messages/{message_id}/{sub.subfield}

This definition enables an automatic, bidrectional mapping of HTTP JSON to RPC. Example:

HTTP RPC
GET /v1/messages/123456/foo GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))

In general, not only fields but also field paths can be referenced from a path pattern. Fields mapped to the path pattern cannot be repeated and must have a primitive (non-message) type.

Any fields in the request message which are not bound by the path pattern automatically become (optional) HTTP query parameters. Assume the following definition of the request message:

service Messaging {
  rpc GetMessage(GetMessageRequest) returns (Message) {
    option (google.api.http).get = "/v1/messages/{message_id}";
  }
}
message GetMessageRequest {
  message SubMessage {
    string subfield = 1;
  }
  string message_id = 1; // mapped to the URL
  int64 revision = 2;    // becomes a parameter
  SubMessage sub = 3;    // `sub.subfield` becomes a parameter
}

This enables a HTTP JSON to RPC mapping as below:

HTTP RPC
GET /v1/messages/123456?revision=2&sub.subfield=foo GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))

Note that fields which are mapped to HTTP parameters must have a primitive type or a repeated primitive type. Message types are not allowed. In the case of a repeated type, the parameter can be repeated in the URL, as in ...?param=A&param=B.

For HTTP method kinds which allow a request body, the body field specifies the mapping. Consider a REST update method on the message resource collection:

service Messaging {
  rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
    option (google.api.http) = {
      put: "/v1/messages/{message_id}"
      body: "message"
    };
  }
}
message UpdateMessageRequest {
  string message_id = 1; // mapped to the URL
  Message message = 2;   // mapped to the body
}

The following HTTP JSON to RPC mapping is enabled, where the representation of the JSON in the request body is determined by protos JSON encoding:

HTTP RPC
PUT /v1/messages/123456 { "text": "Hi!" } UpdateMessage(message_id: "123456" message { text: "Hi!" })

The special name * can be used in the body mapping to define that every field not bound by the path template should be mapped to the request body. This enables the following alternative definition of the update method:

service Messaging {
  rpc UpdateMessage(Message) returns (Message) {
    option (google.api.http) = {
      put: "/v1/messages/{message_id}"
      body: "*"
    };
  }
}
message Message {
  string message_id = 1;
  string text = 2;
}

The following HTTP JSON to RPC mapping is enabled:

HTTP RPC
PUT /v1/messages/123456 { "text": "Hi!" } UpdateMessage(message_id: "123456" text: "Hi!")

Note that when using * in the body mapping, it is not possible to have HTTP parameters, as all fields not bound by the path end in the body. This makes this option more rarely used in practice of defining REST APIs. The common usage of * is in custom methods which don't use the URL at all for transferring data.

It is possible to define multiple HTTP methods for one RPC by using the additional_bindings option. Example:

service Messaging {
  rpc GetMessage(GetMessageRequest) returns (Message) {
    option (google.api.http) = {
      get: "/v1/messages/{message_id}"
      additional_bindings {
        get: "/v1/users/{user_id}/messages/{message_id}"
      }
    };
  }
}
message GetMessageRequest {
  string message_id = 1;
  string user_id = 2;
}

This enables the following two alternative HTTP JSON to RPC mappings:

HTTP RPC
GET /v1/messages/123456 GetMessage(message_id: "123456")
GET /v1/users/me/messages/123456 GetMessage(user_id: "me" message_id: "123456")

Rules for HTTP mapping

The rules for mapping HTTP path, query parameters, and body fields to the request message are as follows:

  1. The body field specifies either * or a field path, or is omitted. If omitted, it indicates there is no HTTP request body.
  2. Leaf fields (recursive expansion of nested messages in the request) can be classified into three types: (a) Matched in the URL template. (b) Covered by body (if body is *, everything except (a) fields; else everything under the body field) (c) All other fields.
  3. URL query parameters found in the HTTP request are mapped to (c) fields.
  4. Any body sent with an HTTP request can contain only (b) fields.

The syntax of the path template is as follows:

Template = "/" Segments [ Verb ] ;
Segments = Segment { "/" Segment } ;
Segment  = "*" | "**" | LITERAL | Variable ;
Variable = "{" FieldPath [ "=" Segments ] "}" ;
FieldPath = IDENT { "." IDENT } ;
Verb     = ":" LITERAL ;

The syntax * matches a single path segment. The syntax ** matches zero or more path segments, which must be the last part of the path except the Verb. The syntax LITERAL matches literal text in the path.

The syntax Variable matches part of the URL path as specified by its template. A variable template must not contain other variables. If a variable matches a single path segment, its template may be omitted, e.g. {var} is equivalent to {var=*}.

If a variable contains exactly one path segment, such as "{var}" or "{var=*}", when such a variable is expanded into a URL path, all characters except [-_.~0-9a-zA-Z] are percent-encoded. Such variables show up in the Discovery Document as {var}.

If a variable contains one or more path segments, such as "{var=foo/*}" or "{var=**}", when such a variable is expanded into a URL path, all characters except [-_.~/0-9a-zA-Z] are percent-encoded. Such variables show up in the Discovery Document as {+var}.

NOTE: While the single segment variable matches the semantics of RFC 6570 Section 3.2.2 Simple String Expansion, the multi segment variable does not match RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion does not expand special characters like ? and #, which would lead to invalid URLs.

NOTE: the field paths in variables and in the body must not refer to repeated fields or map fields.

Field Type Label Description
selector string Selects methods to which this rule applies.

Refer to [selector][google.api.DocumentationRule.selector] for syntax details. | | get | string | | Used for listing and getting information about resources. | | put | string | | Used for updating a resource. | | post | string | | Used for creating a resource. | | delete | string | | Used for deleting a resource. | | patch | string | | Used for updating a resource. | | custom | CustomHttpPattern | | The custom pattern is used for specifying an HTTP method that is not included in the pattern field, such as HEAD, or "*" to leave the HTTP method unspecified for this rule. The wild-card rule is useful for services that provide content to Web (HTML) clients. | | body | string | | The name of the request field whose value is mapped to the HTTP body, or * for mapping all fields not captured by the path pattern to the HTTP body. NOTE: the referred field must not be a repeated field and must be present at the top-level of request message type. | | response_body | string | | Optional. The name of the response field whose value is mapped to the HTTP body of response. Other response fields are ignored. When not set, the response message will be used as HTTP body of response. | | additional_bindings | HttpRule | repeated | Additional HTTP bindings for the selector. Nested bindings must not contain an additional_bindings field themselves (that is, the nesting may only be one level deep). |

Top

item.proto

Item related messages. Strictly, not related directly to any transactions or even match results.

Address

Represents address (From and To) of an item

Field Type Label Description
line_one string Required.
city string Required.
state string Required.
country string Required.
postal_code string Required.

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

ItemForNotificationMessage

Represents minimum information of item required for insightful app notification

Field Type Label Description
name string Required.
owner_id string Required.
non_owner_id string Required.
end_date_epoch int64 Required.
image_thumbnail string Required.

ItemIdentification

Repesents a unique itemId

Field Type Label Description
item_id string Required.

ItemMessage

Represents an item

Field Type Label Description
end_date_epoch int64
end_lat double
end_lon double
start_lat double
start_lon double
end_address Address
start_address Address
owner_id string
non_owner_id string
owner_type PersonType
non_owner_type PersonType
name string
category string
description string
images string repeated
image_thumbnail string
length int32
width int32
height int32
weight int32
value int32
dimension_unit DimensionUnit
weight_unit WeightUnit
currency_unit CurrencyUnit

Response

Represents a ItemService response

Field Type Label Description
fields Response.FieldsEntry repeated Represents a response map

Response.FieldsEntry

Field Type Label Description
key string
value Value

StringList

Represents list of strings

Field Type Label Description
list string repeated List of string

UpdateItemMessage

Represents mutable fields of an item

Field Type Label Description
id string Required.
description string Required.
non_owner_id string Required.
value int32 Required.
end_time_epoch int64 Required.

Value

Represents a return value

Field Type Label Description
item_for_notification_message_value ItemForNotificationMessage Minimum item info required for insightful app notification
string_list_value StringList List of strings
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

ItemService

Service for Item handling.

Method Name Request Type Response Type Description
CreateItem ItemMessage Response Creates a new item; details specified by ItemMessage (Unbounded). Also creates one entry in ItemPost collection corresponding to this item. This ItemPost and Item are strongly connected, i.e. any change in Item will be reflected in the corresponding fields in ItemPost.
UpdateItem UpdateItemMessage Response Updates an item. Correspondingly updates ItemPost as well. Returns non-null error.message if item with id does not exists.
DeleteItem ItemIdentification Response Deletes an item. Correspondingly deletes ItemPost as well.
GetItemName ItemIdentification Response Returns name of the item identified by its id
GetItemForNotification ItemIdentification Response Returns minimum item information identified by id required for sending insightful app notification to user.

Top

item_post.proto

ItemPost related messages.

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

ExpireItemPostMessage

Represents an ItemId

Field Type Label Description
item_id string

ItemPostIdentification

Represents an itemId

Field Type Label Description
item_id string

ItemPostMessage

Represents an ItemPostMessage

Field Type Label Description
item_id string
end_date_epoch int64
end_lat double
end_lon double
start_lat double
start_lon double
owner_id string
non_owner_id string
owner_type PersonType
non_owner_type PersonType
status Status
expired bool

ItemPostUpdateMessage

Represents mutable fields of ItemPost

Field Type Label Description
item_id string
non_owner_id string
end_time_epoch int64

Response

Represents a ItemPostService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

StatusChangeToInRequestMessage

Represents an itemId and travelPlanId

Field Type Label Description
item_id string
travel_plan_id string

StatusChangeToNotFinalizedMessage

Represents an itemId and travelPlanId

Field Type Label Description
item_id string
travel_plan_id string

UpdateStatusMessage

Represents a status update message

Field Type Label Description
item_id string
new_status Status

Value

Represents a return value

Field Type Label Description
item_post_value ItemPostMessage ItemPostMessage value
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

Represents a NULL value

Name Number Description
NULL_VALUE 0

ItemPostService

Service for handling ItemPost

Method Name Request Type Response Type Description
CreateItemPost ItemPostMessage Response Creates an ItemPost corresponding to an Item. Also creates a Job scheduled at item's endDate.
UpdateItemPost ItemPostUpdateMessage Response Updates the mutable fields of ItemPost corresponding to an item. If item.endDate is updated, then it also updates the Job scheduled time.
DeleteItemPost ItemPostIdentification Response Deletes ItemPost and the corresponding Job scheduled at item.endDate.
ExpireItemPost ExpireItemPostMessage Response Expires ItemPost identified by itemId. Takes action based on current item status. If the status is NOT_FINALIZED -> Just notify the sender and receiver, If IN_REQUEST -> delete all RequestPost of this item and notify sender and receiver, If FINALIZED or ON_MOVE -> delete all RequestPost of this item, expire item in AcceptedTransaction, finally notify sender,receiver and involved traveller
UpdateStatus UpdateStatusMessage Response Updates status of ItemPost identified by itemId
CancelRequest StatusChangeToNotFinalizedMessage Response Deletes all Request post for itemId & travelPlanId
RequestIn StatusChangeToInRequestMessage Response Updates status of itemPost and travelPlanPost to IN_REQUEST and creates a new RequestPost
GetItemPostMessage ItemPostIdentification Response Returns ItemPost identified by itemId

Top

job.proto

Job related messages

CreateJobMessage

Message to create a job

Field Type Label Description
name string Name of the job
data string Information associated with the job. Commonly itemId or travelPlanId
priority int32 Priority of the Job on scaled of 1-10
type int32 Type of Job. 0 -> normal, 1 -> repeat
task_type int32 Type of task of Job. 0 -> Expiry, else -> any other task
next_run_at int64 Epoch of next run scheduled time of the job
repeat_after int64 Only for Job with type -> "repeat". Represents after how much time the Job should schedule its nextRunAt

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

JobMessage

Message for Job updation and deletion

Field Type Label Description
ids string repeated List of ids
next_run_ats int64 repeated List of next run at [Date]

Response

Represents a NotificationsService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

Value

Represents a return Value

Field Type Label Description
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

JobService

Service for handling Job

Method Name Request Type Response Type Description
CreateJob CreateJobMessage Response Creates a Job to run at a given time or periodically. Least count = 5000ms
UpdateJob JobMessage Response Updates a job with its nextRunAt time identified by its id.
DeleteJob JobMessage Response Deletes a Job identified by its id.

Top

notifications.proto

Notification related messages

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

NotificationMessage

Notification Message. High priority by default

Field Type Label Description
send_to string repeated List of userIds
headings NotificationMessage.HeadingsEntry repeated Locale-wise map { 'en': 'message in english', 'fr': 'Message in french' }
contents NotificationMessage.ContentsEntry repeated Locale-wise map { 'en': 'message in english', 'fr': 'Message in french' }
json_stringified_payload string Json payload but stringified
big_picture string Android big picture url

NotificationMessage.ContentsEntry

Field Type Label Description
key string
value string

NotificationMessage.HeadingsEntry

Field Type Label Description
key string
value string

OsNotificationReschedule

Message for rescheduling an already scheduled One Signal notification

Field Type Label Description
os_notification_id string
new_time_epoch int64

Response

Represents a CompletedTransactionService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

Value

Represents a return Value

Field Type Label Description
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

NotificationService

Service for handling Notifications and SMSs

Method Name Request Type Response Type Description
SendNotificationNow NotificationMessage Response Dispatches a new notification. Accepts a list of userIds, asks User service for corresponding One Signal tokens. If one signal token is unavailable then it grabs the phone number of that user and send an SMS (like a fallback).

Top

pending_rating.proto

Pending rating related messages

DeletePendingRatingMessage

Message to delete a PendingRating

Field Type Label Description
from_user_id string
to_user_id string
completed_transaction_id string

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

PendingRatingsForCTIdMessage

Message to create 6 pending rating documents for a given CompletedTransaction

Field Type Label Description
completed_on int64 Timestamp
completed_transaction_id string
owner_id string
non_owner_id string
traveller_id string
item_name string

Response

Represents a CompletedTransactionService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

Value

Represents a return Value

Field Type Label Description
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

PendingRatingService

Service for handling Pending Rating

Method Name Request Type Response Type Description
CreatePendingRatingsForCTId PendingRatingsForCTIdMessage Response Create 6 pending rating documents for 3 involved users in a CompletedTransaction
DeletePendingRating DeletePendingRatingMessage Response Deletes a pending rating

Top

rating.proto

Rating related messages

CreateRatingMessage

Message to create Rating

Field Type Label Description
completed_on int64
from_user_id string
to_user_id string
text string
completed_transaction_id string
rating double
personalityStructure PersonalityStructure
recommended bool

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

Response

Represents a CompletedTransactionService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

Value

Represents a return Value

Field Type Label Description
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

RatingService

Service for handling Ratings

Method Name Request Type Response Type Description
CreateRating CreateRatingMessage Response Creates a Rating document. Deletes its corresponding PendingRating and updates the Account of the user who has received the rating.

Top

request_post.proto

RequestPost related messages

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

IntList

List of Integers

Field Type Label Description
int_list int64 repeated List of integers

RequestPostMessage

Message to create a new RequestPost

Field Type Label Description
item_id string
travel_plan_id string
requested_by_traveller bool

Response

Represents a CompletedTransactionService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

StatusChangeToFinalizedMessage

Message to identify unique RequestPost

Field Type Label Description
item_id string
travel_plan_id string

UpdateAllStatusesOf

Message to assign new statuses to item and travelPlan respectively.

Field Type Label Description
item_id string
travel_plan_id string
new_item_status Status
new_travel_plan_status Status

Value

Represents a response Value

Field Type Label Description
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value
int_list_value IntList List of integers

NullValue

NULL value

Name Number Description
NULL_VALUE 0

RequestPostService

Service to handle RequestPost

Method Name Request Type Response Type Description
CreateRequestPost RequestPostMessage Response Creates a new RequestPost. Gathers item and travelplan info from Item and TravelPlan respectively. Throws an error if it exists already.
GetRequestPostCount RequestPostMessage Response Returns a integer count of all RequestPost individually for a given itemId and a given travelPlanId
GetRequestPostCountAndSetStatus RequestPostMessage Response NOT overridden yet
DeleteRequestPost RequestPostMessage Response Deletes a request post identified by itemId and travelPlanId
DeleteAllRequestPost RequestPostMessage Response Deletes all RequestPost individually for a given itemId and a given travelPlanId
UpdateAllStatuses UpdateAllStatusesOf Response Updates statuses of all RequestPost individually for a given itemId and a given travelPlanId to a given new status.
StatusChangeToFinalized StatusChangeToFinalizedMessage Response Handles status change to FINALIZED. Updates statuses of all RequestPost individually for a given itemId and a given travelPlanId to FINALIZED, updates ItemPost and travelPlanPost 's status to FINALIZED, creates a new AcceptedTransaction and finally deletes this RequestPost.

Top

travel_plan_post.proto

TravelPlanPost related message

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

ExpireTravelPlanPostMessage

Represents a travelPlanId

Field Type Label Description
travel_plan_id string

Response

Represents a ItemPostService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

StatusChangeToInRequestMessage

Represents an itemId and travelPlanId

Field Type Label Description
item_id string
travel_plan_id string

StatusChangeToNotFinalizedMessage

Represents an itemId and travelPlanId

Field Type Label Description
item_id string
travel_plan_id string

TravelPlanPostIdentification

Represents a travelPlanId

Field Type Label Description
travel_plan_id string

TravelPlanPostMessage

Represents a TravelPlanPostMessage

Field Type Label Description
travel_plan_id string
end_date_epoch int64
start_date_epoch int64
end_lat double
end_lon double
start_lat double
start_lon double
traveller_id string
status Status
expired bool

TravelPlanPostUpdateMessage

Represents mutable fields of TravelPlanPost

Field Type Label Description
travel_plan_id string
start_time_epoch int64
end_time_epoch int64

UpdateStatusMessage

Represents a status update message

Field Type Label Description
travel_plan_id string
new_status Status

Value

Represents a return value

Field Type Label Description
travel_plan_post_value TravelPlanPostMessage TravelPlanPostMessage value
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

Represents a NULL value

Name Number Description
NULL_VALUE 0

TravelPlanPostService

Service to handle TravelPlanPost

Method Name Request Type Response Type Description
CreateTravelPlanPost TravelPlanPostMessage Response Creates a TravelPlanPost corresponding to a TravelPlan. Also creates two Jobs scheduled at travelPlan's endDate and startDate.
UpdateTravelPlanPost TravelPlanPostUpdateMessage Response Updates the mutable fields of TravelPlanPost corresponding to a TravelPlan. If travelPlan.endDate etc. is updated, then it also updates the respective Job scheduled time.
DeleteTravelPlanPost TravelPlanPostIdentification Response Deletes TravelPlanPost and the corresponding Jobs scheduled at travelPlan.endDate and travelPlan.startDate.
GetTravelPlanPostMessage TravelPlanPostIdentification Response Returns TravelPlanPost identified by travelPlanId
RequestIn StatusChangeToInRequestMessage Response Updates status of itemPost and travelPlanPost to IN_REQUEST and creates a new RequestPost
CancelRequest StatusChangeToNotFinalizedMessage Response Deletes all Request post for itemId & travelPlanId
UpdateStatus UpdateStatusMessage Response Updates status of TravelPlanPost identified by travelPlanId
ExpireTravelPlanPost ExpireTravelPlanPostMessage Response Expires TravelPlanPost identified by travelPlanId. Takes action based on current travelPlan status. If the status is NOT_FINALIZED -> Just notify the traveller, If IN_REQUEST -> delete all RequestPost of this travelPlan and notify traveller, If FINALIZED or ON_MOVE -> delete all RequestPost of this travelPlan, expire travelPlan in AcceptedTransaction, finally notify traveller and involved sender,receiver

Top

travel_plans.proto

Travel plan related messages.

Address

Represents address (From and to)

Field Type Label Description
line_one string
city string
state string
country string
postal_code string

Error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

Response

Represents a TravelPlanService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

TravelPlanForNotificationMessage

Minimum information of travel plan required for insightful in-app notification

Field Type Label Description
from_to string
traveller_id string
start_time_epoch int64
end_date_epoch int64

TravelPlanIdentification

Represents unique travel plan id

Field Type Label Description
travel_plan_id string

TravelPlanMessage

Represents travel plan message

Field Type Label Description
end_date_epoch int64
start_date_epoch int64
end_lat double
end_lon double
start_lat double
start_lon double
end_address Address
start_address Address
traveller_id string
description string
mode_of_travel ModeOfTravel

UpdateTravelPlanMessage

Mutable fields of travel plan

Field Type Label Description
id string
description string
mode_of_travel ModeOfTravel
start_time_epoch int64
end_time_epoch int64

Value

Return Value

Field Type Label Description
travel_plan_for_notification_message_value TravelPlanForNotificationMessage Minimum information of travel plan required for insightful in-app notification
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

NullValue

NULL value

Name Number Description
NULL_VALUE 0

TravelPlanService

Service for handling Travel plans

Method Name Request Type Response Type Description
CreateTravelPlan TravelPlanMessage Response Creates a new travelPlan; details specified by TravelPlanMessage (Unbounded). Also creates one entry in TravelPlanPost collection corresponding to this travelPlan. This TravelPlanPost and TravelPlan are strongly connected, i.e. any change in TravelPlan will be reflected in the corresponding fields in TravelPlanPost.
UpdateTravelPlan UpdateTravelPlanMessage Response Updates an travelPlan. Correspondingly updates TravelPlanPost as well. Returns non-null error.message if travelPlan with id does not exists.
DeleteTravelPlan TravelPlanIdentification Response Deletes an travelPlan. Correspondingly deletes TravelPlanPost as well.
TravelPlanForNotification TravelPlanIdentification Response Returns minimum travelPlan information identified by id required for sending insightful app notification to user.

Top

user.proto

User related messages.

Address

Represents a user's address

Field Type Label Description
house_number string Required.
street_number string
city string Required.
state string Required.
country string Required.
pincode int32 Required.

Error

Represents an error

Field Type Label Description
method string The method in which this error occurred.
message string Localized error message
metadata string Meta information required for debugging etc.

NewRatingFeatureMessage

Message to add a new rating to User's profile and Account. See UserService.AggregateRatingFeatures

Field Type Label Description
user_id string Required. UserId of user
rating double Required. User rating
recommended bool Required. Is this user recommended by the user who gave this rating
delta_trust_factor int32 Required. Equivalent delta in trust factor of this user

OsTokensMessage

Represents List of One Signal tokens of Users. See UserService.GetUsersOsTokens

Field Type Label Description
os_tokens string repeated Required. List of One Signal tokens

Personal

Represents User's personal fields

Field Type Label Description
name string Required. Concatenation of first_name, last_name as "$first_name $last_name"
first_name string Required.
last_name string Required.
gender Personal.Gender Required.
image_url string Required.
image_thumbnail_url string Required.
mobile string Required. Ex: 7081103173
country_code string Required. Ex: 91, 1
email string
about_me string
address Address
year_of_birth int32 Default = 0
number_of_fb_friends int32 Required. Default = 0
number_of_google_conns int32 Required. Default = 0
number_of_linkedIn_conns int32 Required. Default = 0
aadhaar_number string 12 digit string
aadhaar_doc_url string Firebase Storage File URL

Response

Represents a UserService response

Field Type Label Description
fields Response.FieldsEntry repeated Map of kind Value

Response.FieldsEntry

Field Type Label Description
key string
value Value

UpdateUserFields

Represents fields which are mutable for a User

Field Type Label Description
id string Required. UserId
image_url string Required. Firebase Storage URL
first_name string Required.
last_name string Required.
gender string Required.
year_of_birth int32
about_me string
email string
address Address
aadhaar_number string

User

Represents a User

Field Type Label Description
id string Required. UserId
os_token string One Signal token. Required for sending app notifications
registered bool Required. Whether this User is registered or is added just as non-owner by some other user
exists bool Required. Eq. deleted
trust_factor int32 Required. User's aggregated trust factor points
number_of_recommendations int32 Required. Number of recommendations received by this user
number_of_authorisations int32 Required.
number_of_ratings int32 Required.
rating double Required.
personal Personal Required. Personal object
verifications Verifications Required. Verifications object

UserAccountPart

Represents part of User's Account which is aggregated from all of ratings and reviews

Field Type Label Description
number_of_recommendations int32 Required.
number_of_authorisations int32 Required.
number_of_ratings int32 Required.
rating double Required.

UserIdentification

Represents a userId

Field Type Label Description
user_id string Required.

UserIdentifications

Represents List of UserIds. See UserService.GetUsersOsTokens

Field Type Label Description
user_ids string repeated Required.

UsersMobileNumber

Message to Create or Get a User. See UserService.CreateUser

Field Type Label Description
mobile string Required. User's mobile number. Ex: +917081130173
return_only_id bool Required. Whether to return only UserId or User Data

Value

Represents a return value

Field Type Label Description
user_account_part_value UserAccountPart Account info of user from user's document
os_tokens_value OsTokensMessage List of One Signal tokens
user_value User User value
string_value string String value
bool_value bool Boolean value
error_value Error Error value
null_value NullValue NULL value

Verifications

Represents user's verified/unverified fields

Field Type Label Description
aadhaar bool
address bool
email bool
facebook bool
gender bool
linkedIn bool
name bool
year_of_birth bool
mobile bool

NullValue

Represents a NULL value

Name Number Description
NULL_VALUE 0

Personal.Gender

Represents user's gender

Name Number Description
M 0 Male
F 1 Female
O 3 Other
NR 4 NotAvailable/NotRecognized

UserService

Service for handling User.

Method Name Request Type Response Type Description
CreateUser UsersMobileNumber Response Used to create a user. Also creates a document in Account to store RatingStructure and PersonalityStructure indexed against userId. If return_only_id is set true, it returns only UserId otherwise a Response with User as data. Returns a non-null error.message if user already exists.
UpdateUser UpdateUserFields Response Used to update a user. UpdateUserFields every field is required. Returns a non-null error.message if user does not exists.
GetUserAccountPart UserIdentification Response Returns UserAccountPart for a given User. Returns a non-null error.message if user does not exists.
GetUsersOsTokens UserIdentifications Response Returns list of One Signal tokens for a given list of User Ids. If One Signal token of a user is null, the it returns phone number (like +917081130173) of that user so as to send MSG91 SMS.
AggregateRatingFeatures NewRatingFeatureMessage Response Used to add a new rating to user's profile and account when a transaction completes.

Scalar Value Types

.proto Type Notes C++ Type Java Type Python Type
double double double float
float float float float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long
uint32 Uses variable-length encoding. uint32 int int/long
uint64 Uses variable-length encoding. uint64 long int/long
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long
sfixed32 Always four bytes. int32 int int
sfixed64 Always eight bytes. int64 long int/long
bool bool boolean boolean
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode
bytes May contain any arbitrary sequence of bytes. string ByteString str

About

gRPC Protocol Documentation for APIs to serve the soul of CarryMates

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published