1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#pragma once
class ASMObjectCreateRequest : public HttpRequest
{
public:
ASMObjectCreateRequest(LoginInfo &li, const char *szContact) :
HttpRequest(REQUEST_POST, "api.asm.skype.com/v1/objects")
{
Headers
<< CHAR_VALUE("Authorization:", CMStringA(::FORMAT, "skype_token %s", li.api.szToken));
JSONNode node, jPermissions, jPermission(JSON_ARRAY);
jPermissions.set_name("permissions");
jPermission.set_name(szContact);
jPermission << JSONNode("read", (char*)NULL);
jPermissions << jPermission;
node << JSONNode("type", "pish/image") << jPermissions;
Body << VALUE(node.write().c_str());
}// {"id":"0-neu-d1-d0649c1fb4e4c60f2d2d1f2165a99f60"}
};
class ASMObjectUploadRequest : public HttpRequest
{
public:
ASMObjectUploadRequest(LoginInfo &li, const char *szObject, const PBYTE data, const size_t size) :
HttpRequest(REQUEST_PUT, FORMAT, "api.asm.skype.com/v1/objects/%s/content/imgpsh", szObject)
{
Headers
<< CHAR_VALUE("Authorization:", CMStringA(::FORMAT, "skype_token %s", li.api.szToken));
pData = (char*)mir_alloc(size);
memcpy(pData, data, size);
dataLength = (int)size;
}
~ASMObjectUploadRequest()
{
mir_free(pData);
HttpRequest::~HttpRequest();
}
};
|