Parse Embedded C SDK  1
Parse Embedded C SDK
parse.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, Parse, LLC. All rights reserved.
3  *
4  * You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
5  * copy, modify, and distribute this software in source code or binary form for use
6  * in connection with the web services and APIs provided by Parse.
7  *
8  * As with any software that integrates with the Parse platform, your use of
9  * this software is subject to the Parse Terms of Service
10  * [https://www.parse.com/about/terms]. This copyright notice shall be
11  * included in all copies or substantial portions of the software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
19  *
20  */
21 
22 #pragma once
23 
24 #ifndef __PARSE_H__
25 #define __PARSE_H__
26 
27 #ifdef __cplusplus
28 extern "C"
29 {
30 #endif
31 
46 #define APPLICATION_ID_MAX_LEN 40
47 
51 #define CLIENT_KEY_MAX_LEN 40
52 
56 #define OBJECT_ID_MAX_LEN 16
57 
61 #define INSTALLATION_ID_MAX_LEN 36
62 
66 #define SESSION_TOKEN_MAX_LEN 40
67 
68 struct ParseClientInternal;
86 typedef const struct ParseClientInternal *ParseClient;
87 
107 typedef void (*parseRequestCallback)(ParseClient client, int error, int httpStatus, const char* httpResponseBody);
108 
126 typedef void (*parsePushCallback)(ParseClient client, int error, const char* data);
127 
143 ParseClient parseInitialize(const char *applicationId, const char *clientKey);
144 
159 void parseSetInstallationId(ParseClient client, const char *installationId);
160 
184 const char *parseGetInstallationId(ParseClient client);
185 
198 void parseSetSessionToken(ParseClient client, const char *sessionToken);
199 
205 void parseClearSessionToken(ParseClient client);
206 
219 const char *parseGetSessionToken(ParseClient client);
220 
237 void parseSetPushCallback(ParseClient client, parsePushCallback callback);
238 
256 int parseStartPushService(ParseClient client);
257 
266 void parseStopPushService(ParseClient client);
267 
284 int parseProcessNextPushNotification(ParseClient client);
285 
317 #if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__)) || defined (PART_CC3200)
318 int parseGetPushSocket(ParseClient client);
319 #endif
320 
330 void parseRunPushLoop(ParseClient client);
331 
349 void parseSendRequest(ParseClient client, const char *httpVerb, const char *httpPath, const char *httpRequestBody, parseRequestCallback callback);
350 
364 int parseGetErrorCode(const char *httpResponseBody);
365 
366 #ifdef __cplusplus
367 }
368 #endif
369 
370 #endif /* __PARSE_H__ */
void parseSetPushCallback(ParseClient client, parsePushCallback callback)
Set the callback for push notifications and errors.
void parseSetSessionToken(ParseClient client, const char *sessionToken)
Set the session token for the Parse client.
void parseSendRequest(ParseClient client, const char *httpVerb, const char *httpPath, const char *httpRequestBody, parseRequestCallback callback)
Send an API request.
void parseClearSessionToken(ParseClient client)
Clear the session token.
ParseClient parseInitialize(const char *applicationId, const char *clientKey)
Initialize the Parse client and user session.
void parseRunPushLoop(ParseClient client)
Process push notifications events in a loop.
const char * parseGetSessionToken(ParseClient client)
Return the client session token.
void(* parseRequestCallback)(ParseClient client, int error, int httpStatus, const char *httpResponseBody)
Callback for API requests.
Definition: parse.h:107
void(* parsePushCallback)(ParseClient client, int error, const char *data)
Callback for push notifications and errors from the push service.
Definition: parse.h:126
const char * parseGetInstallationId(ParseClient client)
Return the client installation id.
void parseStopPushService(ParseClient client)
Stop the push notifications service.
int parseStartPushService(ParseClient client)
Start the push notifications service.
int parseProcessNextPushNotification(ParseClient client)
Process next pending push notification.
int parseGetPushSocket(ParseClient client)
Request Parse push file handle for use with select call.
int parseGetErrorCode(const char *httpResponseBody)
Extract Parse error code.
const struct ParseClientInternal * ParseClient
Parse client handle.
Definition: parse.h:86
void parseSetInstallationId(ParseClient client, const char *installationId)
Set the installation object id for this client.