Add authentication fields to api request header
This commit is contained in:
1 parent
a13be3156b
commit
ff20d27f41
3 files changed
+11
No files matched your search
@@ -26,6 +26,7 @@ namespace bts.api.core
|
||||
case ApiError.ServerDisconnect: return "Server disconnected.";
|
||||
case ApiError.MissingMethod: return "Method not found.";
|
||||
case ApiError.ServerFault: return "Server error.";
|
||||
case ApiError.AccessDenied: return "Access denied";
|
||||
default: return "Unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,9 +7,16 @@ message PingPong {
|
||||
bytes payload = 1;
|
||||
}
|
||||
|
||||
// *** wire protocol ***
|
||||
// 1 byte - header size
|
||||
// RequestHeader
|
||||
// T Request
|
||||
|
||||
message RequestHeader {
|
||||
int32 request_id = 1;
|
||||
int32 method = 2;
|
||||
string token = 3;
|
||||
string service_id = 4;
|
||||
}
|
||||
|
||||
enum ApiError {
|
||||
@@ -19,6 +26,7 @@ enum ApiError {
|
||||
MISSING_METHOD = 3;
|
||||
SERVER_FAULT = 4;
|
||||
UNEXPECTED_RESPONSE = 5;
|
||||
ACCESS_DENIED = 6;
|
||||
}
|
||||
|
||||
message ResponseHeader {
|
||||
@@ -26,6 +34,7 @@ message ResponseHeader {
|
||||
ApiError code = 2;
|
||||
}
|
||||
|
||||
|
||||
// Some Useful buffers for use as arguments/returns
|
||||
|
||||
message VoidMessage {}
|
||||
|
||||
@@ -26,6 +26,7 @@ class Result
|
||||
case ApiError::MISSING_METHOD: return "Method not found.";
|
||||
case ApiError::SERVER_FAULT: return "Server error.";
|
||||
case ApiError::UNEXPECTED_RESPONSE: return "Internal error";
|
||||
case ApiError::ACCESS_DENIED: return "Access denied";
|
||||
default: return "Unknown error";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user