Skip to content

Commit a4d83ad

Browse files
ralphdoefrantuma
authored andcommitted
samples updates - samples/client/petstore/tizen/
1 parent 626f014 commit a4d83ad

File tree

7 files changed

+344
-3
lines changed

7 files changed

+344
-3
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0-SNAPSHOT
1+
2.4.0-SNAPSHOT

samples/client/petstore/tizen/doc/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,10 @@ Method | HTTP request | Description
9494
## What are the Model files for the data structures/objects?
9595
Class | Description
9696
------------- | -------------
97+
*Amount* | some description
9798
*ApiResponse* | Describes the result of uploading an image resource
9899
*Category* | A category for a pet
100+
*Currency* | some description
99101
*Order* | An order for a pets from the pet store
100102
*Pet* | A pet for sale in the pet store
101103
*Tag* | A tag for a pet
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
#include <map>
2+
#include <cstdlib>
3+
#include <glib-object.h>
4+
#include <json-glib/json-glib.h>
5+
#include "Helpers.h"
6+
7+
8+
#include "Amount.h"
9+
10+
using namespace std;
11+
using namespace Tizen::ArtikCloud;
12+
13+
Amount::Amount()
14+
{
15+
//__init();
16+
}
17+
18+
Amount::~Amount()
19+
{
20+
//__cleanup();
21+
}
22+
23+
void
24+
Amount::__init()
25+
{
26+
//
27+
//
28+
//value = double(0);
29+
//
30+
//
31+
//currency = new Currency();
32+
//
33+
}
34+
35+
void
36+
Amount::__cleanup()
37+
{
38+
//if(value != NULL) {
39+
//
40+
//delete value;
41+
//value = NULL;
42+
//}
43+
//if(currency != NULL) {
44+
//
45+
//delete currency;
46+
//currency = NULL;
47+
//}
48+
//
49+
}
50+
51+
void
52+
Amount::fromJson(char* jsonStr)
53+
{
54+
JsonObject *pJsonObject = json_node_get_object(json_from_string(jsonStr,NULL));
55+
JsonNode *node;
56+
const gchar *valueKey = "value";
57+
node = json_object_get_member(pJsonObject, valueKey);
58+
if (node !=NULL) {
59+
60+
61+
if (isprimitive("double")) {
62+
jsonToValue(&value, node, "double", "");
63+
} else {
64+
65+
}
66+
}
67+
const gchar *currencyKey = "currency";
68+
node = json_object_get_member(pJsonObject, currencyKey);
69+
if (node !=NULL) {
70+
71+
72+
if (isprimitive("Currency")) {
73+
jsonToValue(&currency, node, "Currency", "Currency");
74+
} else {
75+
76+
Currency* obj = static_cast<Currency*> (&currency);
77+
obj->fromJson(json_to_string(node, false));
78+
79+
}
80+
}
81+
}
82+
83+
Amount::Amount(char* json)
84+
{
85+
this->fromJson(json);
86+
}
87+
88+
char*
89+
Amount::toJson()
90+
{
91+
JsonObject *pJsonObject = json_object_new();
92+
JsonNode *node;
93+
if (isprimitive("double")) {
94+
double obj = getValue();
95+
node = converttoJson(&obj, "double", "");
96+
}
97+
else {
98+
99+
}
100+
const gchar *valueKey = "value";
101+
json_object_set_member(pJsonObject, valueKey, node);
102+
if (isprimitive("Currency")) {
103+
Currency obj = getCurrency();
104+
node = converttoJson(&obj, "Currency", "");
105+
}
106+
else {
107+
108+
Currency obj = static_cast<Currency> (getCurrency());
109+
GError *mygerror;
110+
mygerror = NULL;
111+
node = json_from_string(obj.toJson(), &mygerror);
112+
113+
}
114+
const gchar *currencyKey = "currency";
115+
json_object_set_member(pJsonObject, currencyKey, node);
116+
node = json_node_alloc();
117+
json_node_init(node, JSON_NODE_OBJECT);
118+
json_node_take_object(node, pJsonObject);
119+
char * ret = json_to_string(node, false);
120+
json_node_free(node);
121+
return ret;
122+
}
123+
124+
double
125+
Amount::getValue()
126+
{
127+
return value;
128+
}
129+
130+
void
131+
Amount::setValue(double value)
132+
{
133+
this->value = value;
134+
}
135+
136+
Currency
137+
Amount::getCurrency()
138+
{
139+
return currency;
140+
}
141+
142+
void
143+
Amount::setCurrency(Currency currency)
144+
{
145+
this->currency = currency;
146+
}
147+
148+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
* Amount.h
3+
*
4+
* some description
5+
*/
6+
7+
#ifndef _Amount_H_
8+
#define _Amount_H_
9+
10+
11+
#include <string>
12+
#include "Currency.h"
13+
#include "Object.h"
14+
15+
/** \defgroup Models Data Structures for API
16+
* Classes containing all the Data Structures needed for calling/returned by API endpoints
17+
*
18+
*/
19+
20+
namespace Tizen {
21+
namespace ArtikCloud {
22+
23+
24+
/*! \brief some description
25+
*
26+
* \ingroup Models
27+
*
28+
*/
29+
30+
class Amount : public Object {
31+
public:
32+
/*! \brief Constructor.
33+
*/
34+
Amount();
35+
Amount(char* str);
36+
37+
/*! \brief Destructor.
38+
*/
39+
virtual ~Amount();
40+
41+
/*! \brief Retrieve a string JSON representation of this class.
42+
*/
43+
char* toJson();
44+
45+
/*! \brief Fills in members of this class from JSON string representing it.
46+
*/
47+
void fromJson(char* jsonStr);
48+
49+
/*! \brief Get some description
50+
*/
51+
double getValue();
52+
53+
/*! \brief Set some description
54+
*/
55+
void setValue(double value);
56+
/*! \brief Get
57+
*/
58+
Currency getCurrency();
59+
60+
/*! \brief Set
61+
*/
62+
void setCurrency(Currency currency);
63+
64+
private:
65+
double value;
66+
Currency currency;
67+
void __init();
68+
void __cleanup();
69+
70+
};
71+
}
72+
}
73+
74+
#endif /* _Amount_H_ */
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#include <map>
2+
#include <cstdlib>
3+
#include <glib-object.h>
4+
#include <json-glib/json-glib.h>
5+
#include "Helpers.h"
6+
7+
8+
#include "Currency.h"
9+
10+
using namespace std;
11+
using namespace Tizen::ArtikCloud;
12+
13+
Currency::Currency()
14+
{
15+
//__init();
16+
}
17+
18+
Currency::~Currency()
19+
{
20+
//__cleanup();
21+
}
22+
23+
void
24+
Currency::__init()
25+
{
26+
//
27+
}
28+
29+
void
30+
Currency::__cleanup()
31+
{
32+
//
33+
}
34+
35+
void
36+
Currency::fromJson(char* jsonStr)
37+
{
38+
JsonObject *pJsonObject = json_node_get_object(json_from_string(jsonStr,NULL));
39+
JsonNode *node;
40+
}
41+
42+
Currency::Currency(char* json)
43+
{
44+
this->fromJson(json);
45+
}
46+
47+
char*
48+
Currency::toJson()
49+
{
50+
JsonObject *pJsonObject = json_object_new();
51+
JsonNode *node;
52+
node = json_node_alloc();
53+
json_node_init(node, JSON_NODE_OBJECT);
54+
json_node_take_object(node, pJsonObject);
55+
char * ret = json_to_string(node, false);
56+
json_node_free(node);
57+
return ret;
58+
}
59+
60+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* Currency.h
3+
*
4+
* some description
5+
*/
6+
7+
#ifndef _Currency_H_
8+
#define _Currency_H_
9+
10+
11+
#include <string>
12+
#include "Object.h"
13+
14+
/** \defgroup Models Data Structures for API
15+
* Classes containing all the Data Structures needed for calling/returned by API endpoints
16+
*
17+
*/
18+
19+
namespace Tizen {
20+
namespace ArtikCloud {
21+
22+
23+
/*! \brief some description
24+
*
25+
* \ingroup Models
26+
*
27+
*/
28+
29+
class Currency : public Object {
30+
public:
31+
/*! \brief Constructor.
32+
*/
33+
Currency();
34+
Currency(char* str);
35+
36+
/*! \brief Destructor.
37+
*/
38+
virtual ~Currency();
39+
40+
/*! \brief Retrieve a string JSON representation of this class.
41+
*/
42+
char* toJson();
43+
44+
/*! \brief Fills in members of this class from JSON string representing it.
45+
*/
46+
void fromJson(char* jsonStr);
47+
48+
49+
private:
50+
void __init();
51+
void __cleanup();
52+
53+
};
54+
}
55+
}
56+
57+
#endif /* _Currency_H_ */

samples/client/petstore/tizen/src/UserManager.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ bool deleteUserAsync(char * accessToken,
136136
/*! \brief Get user by user name. *Synchronous*
137137
*
138138
*
139-
* \param username The name that needs to be fetched. Use user1 for testing. *Required*
139+
* \param username The name that needs to be fetched. Use user1 for testing. *Required*
140140
* \param handler The callback function to be invoked on completion. *Required*
141141
* \param accessToken The Authorization token. *Required*
142142
* \param userData The user data to be passed to the callback function.
@@ -149,7 +149,7 @@ bool getUserByNameSync(char * accessToken,
149149
/*! \brief Get user by user name. *Asynchronous*
150150
*
151151
*
152-
* \param username The name that needs to be fetched. Use user1 for testing. *Required*
152+
* \param username The name that needs to be fetched. Use user1 for testing. *Required*
153153
* \param handler The callback function to be invoked on completion. *Required*
154154
* \param accessToken The Authorization token. *Required*
155155
* \param userData The user data to be passed to the callback function.

0 commit comments

Comments
 (0)