1 /* 2 * Copyright 2017-2019, Andrew Lindesay <apl@lindesay.co.nz>. 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef SERVER_HELPER_H 6 #define SERVER_HELPER_H 7 8 #include <HttpHeaders.h> 9 10 #include "ValidationFailure.h" 11 12 13 using BPrivate::Network::BHttpHeaders; 14 15 class BMessage; 16 17 18 class ServerHelper { 19 public: 20 static bool IsNetworkAvailable(); 21 static bool IsPlatformNetworkAvailable(); 22 23 static void NotifyClientTooOld( 24 const BHttpHeaders& responseHeaders 25 ); 26 static void AlertClientTooOld(BMessage* message); 27 28 static void NotifyTransportError(status_t error); 29 static void AlertTransportError(BMessage* message); 30 31 static void NotifyServerJsonRpcError( 32 BMessage& error); 33 static void AlertServerJsonRpcError( 34 BMessage* responseEnvelopeMessage); 35 static void GetFailuresFromJsonRpcError( 36 ValidationFailures& failures, 37 BMessage& responseEnvelopeMessage); 38 }; 39 40 #endif // SERVER_HELPER_H 41