Qore SalesforceRestClient Module Reference 2.0.1
Loading...
Searching...
No Matches
SalesforceRestClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* SalesforceRestClient.qm Copyright (C) 2016 - 2024 Qore Technologies, s.r.o.
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23*/
24
25// minimum qore version
26
27// require type definitions everywhere
28
29// enable all warnings
30
31// don't use "$" for vars, members, and methods, assume local variable scope
32
33// do not ignore argument errors
34
35
36
186const BulkJobQuery = "query";
187
189const BulkJobInsert = "insert";
190
192const BulkJobUpdate = "update";
193
195const BulkJobUpsert = "upsert";
196
198const BulkJobDelete = "delete";
200
202
210
211
216const BulkJobCsv = "CSV";
217
219const BulkJobJson = "JSON";
220
222const BulkJobXml = "XML";
223
225const BulkJobZipCsv = "ZIP_CSV";
226
228const BulkJobZipJson = "ZIP_JSON";
229
231const BulkJobZipXml = "ZIP_XML";
233
235
244
245
247
293
294public:
296 const Defaults = ...;
297
298
300 const DefaultSendEncoding = "gzip";
301
303 const RequiredOptions = ...;
304
305
307 const AsyncDataloadNs = "http://www.force.com/2009/06/asyncapi/dataload";
308
310 const JobInfoAttributes = ...;
311
312
313protected:
316
318 Mutex m();
319
321 string api;
322
324 string api_used;
325
328
331
333 hash<string, hash<auto>> api_hash;
334
335public:
336
338
396 constructor(*hash<auto> opts, *softbool do_not_connect) ;
397
398
400
440 hash<auto> patch(string path, auto body, *reference<hash<auto>> info, *hash<auto> hdr);
441
442
444
487 hash<auto> doRequest(string m, string path, auto body, *reference<hash<auto>> info, softbool decode_errors = True, *hash<auto> hdr);
488
489
491
536 hash<auto> doBulkRequest(string m, string path, auto body, *reference<hash<auto>> info, softbool decode_errors = True, *hash<auto> hdr);
537
538
540
582 hash<auto> bulkGet(string path, auto body, *reference<hash<auto>> info, *hash<auto> hdr);
583
584
586
628 hash<auto> bulkPost(string path, auto body, *reference<hash<auto>> info, *hash<auto> hdr);
629
630
632
663 hash<auto> bulkJobCreate(string operation, string object, string job_content_type, *reference<hash<auto>> info, *hash<auto> hdr);
664
665
667
698 hash<auto> bulkJobAddBatch(string jobid, data batch_data, string job_content_type, *reference<hash<auto>> info, *hash<auto> hdr);
699
700
702
727 hash<auto> bulkJobClose(string jobid, *reference<hash<auto>> info, *hash<auto> hdr);
728
729
731
747 login(*reference<hash<auto>> info);
748
749
751
772 logout(*reference<hash<auto>> info);
773
774
776 *string getApi();
777
778
780 *hash<string, hash<auto>> getApis();
781
782
784
786 checkClientOptions(hash<auto> opts);
787
788
790 processApis(*list<auto> apis);
791
792
795
796
798
800 bool isAuthTokenError(int status_code, hash<auto> headers, bool body_deserialized, *string body_content_type, auto body);
801
802
804
806 hash<auto> getOAuth2Options();
807
808
810
816 static string getBulkDate(date d);
817
819 static string getGmtDate(date d);
820
822
824protected:
826public:
827
828
830
832protected:
833 setOAuth2LoginInfo(hash<auto> h);
834public:
835
836
838protected:
839 static hash getOptions(*hash<auto> opts);
840public:
841
842
844protected:
845 checkLogin(*reference<hash<auto>> info);
846public:
847
848
850protected:
852public:
853
854
856protected:
857 hash<auto> loginIntern(*reference<hash> info);
858public:
859
860
862
864protected:
865 *hash<auto> getUpdateOptionsAfterLogin(hash<auto> h);
866public:
867
868
870
872protected:
873 *hash<auto> getOAuth2AuthHeaders();
874public:
875
876};
877
879
895
896public:
898 const ConnectionScheme = ...;
899
900
903
904
906 const OAuth2Options = ...;
907
908
910 const OAuth2StandardToSalesforceOptionMap = map {$1.value: $1.key}, OAuth2Options.pairIterator();
911
913 const OAuth2DifferentOptionMap = map {$1.value: $1.key}, OAuth2Options.pairIterator(), $1.key != $1.value;
914
916
924 constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {})
925 ;
926
927
929
946 constructor(hash<auto> config, *hash<auto> attr) ;
947
948
950 string getType();
951
952
954
959
960
962
964 *string getAppName();
965
966
968
974 DataProvider::AbstractDataProvider getDataProvider(*hash<auto> constructor_options);
975
976
978
980 string getOAuth2OptionName(string opt);
981
982
984
986 hash<auto> getOAuth2Options();
987
988
990
992 *hash<auto> getOAuth2AuthHeaders();
993
994
996protected:
997 *hash<auto> processOAuth2TokenResponseImpl(hash<auto> resp);
998public:
999
1000
1002protected:
1004public:
1005
1006
1008protected:
1010public:
1011
1012
1014
1019protected:
1020 SalesforceRestClient getImpl(bool connect = True, *hash<auto> rtopts);
1021public:
1022
1023
1025protected:
1026 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
1027public:
1028
1029
1031protected:
1032 *string getPingPath();
1033public:
1034
1035
1037
1042 Qore::AbstractPollOperation startPollConnect(*Logger::LoggerInterface logger);
1043
1044};
1045
1047
1050
1051public:
1052protected:
1054 const SPS_GET_APIS = "get-apis";
1055
1056public:
1057
1058 constructor(RestConnection conn, RestClient rc, hash<auto> real_opts) : RestPingPollOperation(conn, rc, real_opts + {
1059 "url": real_opts.instance_url ?? real_opts.url,
1060 }) {
1061 }
1062
1063protected:
1064 checkOtherStates();
1065public:
1066
1067
1068protected:
1069 gotOAuth2LoginInfo(hash<auto> h);
1070public:
1071
1072
1073protected:
1074 doStartGetApis();
1075public:
1076
1077};
1078};
*hash< auto > getUpdateOptionsAfterLogin(hash< auto > h)
Returns options to update after an OAuth2 login.
constructor(*hash< auto > opts, *softbool do_not_connect)
creates the object with the given options
setOAuth2LoginInfo(hash< auto > h)
Sets options from the OAuth2 login response on the local object.
static string getBulkDate(date d)
returns a date string for use with Salesforce.com Bulk REST API requests
checkLogin(*reference< hash< auto > > info)
Checks if a login is necessary; if so, then the login is performed.
hash< auto > bulkJobAddBatch(string jobid, data batch_data, string job_content_type, *reference< hash< auto > > info, *hash< auto > hdr)
add a batch to a job using the Bulk REST API
login(*reference< hash< auto > > info)
logs in to Salesforce.com with the credentials provided in the constructor()
*hash< auto > getOAuth2AuthHeaders()
Returns headers to use with OAuth2 authorization / token requests.
*string getApi()
returns the Salesforce.com REST API version currently in use
string oauth2_logout_url
Salesforce.com OAuth2 Revoke Token URL.
Definition SalesforceRestClient.qm.dox.h:315
static hash getOptions(*hash< auto > opts)
returns options for the RestClient::constructor()
static string getGmtDate(date d)
returns a date string in GMT for use in Salesforce.com requests
hash< auto > getOAuth2Options()
Return OAuth2 options.
processApis(*list< auto > apis)
Process the API response from Salesforce and set / verify the client's API level.
string api_used
Salesforce.com REST API version currently in use.
Definition SalesforceRestClient.qm.dox.h:324
setVerifyApi()
Sets / verifies the api level and sets the application URL accordingly.
logout(*reference< hash< auto > > info)
logs out of Salesforce.com by revoking the access token
hash< auto > bulkGet(string path, auto body, *reference< hash< auto > > info, *hash< auto > hdr)
sends an HTTP GET request to the REST server using the Salesforce.com Bulk REST API and returns the r...
checkClientOptions(hash< auto > opts)
verifies that the options passed match the configured options
hash< string, hash< auto > > api_hash
hash of APIs retrieved from GET /services/data; keyed by API version string; values: "label",...
Definition SalesforceRestClient.qm.dox.h:333
hash< auto > bulkPost(string path, auto body, *reference< hash< auto > > info, *hash< auto > hdr)
sends an HTTP POST request to the REST server using the Salesforce.com Bulk REST API and returns the ...
hash< auto > doBulkRequest(string m, string path, auto body, *reference< hash< auto > > info, softbool decode_errors=True, *hash< auto > hdr)
sends a Bulk API REST request to the Salesforce.com server using "rawxml" serialization and returns t...
Mutex m()
Mutex for token acquisition.
string api
Salesforce.com REST API version to be used ("auto" = latest version)
Definition SalesforceRestClient.qm.dox.h:321
hash< auto > bulkJobClose(string jobid, *reference< hash< auto > > info, *hash< auto > hdr)
sends a Bulk REST API job close POST request to the server and returns the deserialized result messag...
hash< auto > patch(string path, auto body, *reference< hash< auto > > info, *hash< auto > hdr)
sends an HTTP PATCH request to the Salesforce.com REST server and returns the response; performs an i...
setApi()
Checks the API and sets the final URL.
hash< auto > loginIntern(*reference< hash > info)
performs authentication and authorization with Salesforce.com using the OAuth2 authorization URL
hash< auto > bulkJobCreate(string operation, string object, string job_content_type, *reference< hash< auto > > info, *hash< auto > hdr)
creates a Salesforce.com batch job and returns the job information as a hash
bool isAuthTokenError(int status_code, hash< auto > headers, bool body_deserialized, *string body_content_type, auto body)
Returns True if the response was related to an authorization token error.
hash< auto > doRequest(string m, string path, auto body, *reference< hash< auto > > info, softbool decode_errors=True, *hash< auto > hdr)
sends an HTTP request to the REST server and returns the response; performs an implicit login to Sale...
setHeaders()
Set headers for Salesforce REST communications.
string instance_url
The instance URL.
Definition SalesforceRestClient.qm.dox.h:327
string id_service_url
The identity service URL.
Definition SalesforceRestClient.qm.dox.h:330
*hash< string, hash< auto > > getApis()
Return available APIs as a hash.
class for Salesforce.com REST connections; returns SalesforceRestClient::SalesforceRestClient objects
Definition SalesforceRestClient.qm.dox.h:894
SalesforceRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a SalesforceRestClient::SalesforceRestClient object
constructor(hash< auto > config, *hash< auto > attr)
creates the SalesforceRestConnection connection object
const OAuth2Options
Maps Salesforce REST options to standard options.
Definition SalesforceRestClient.qm.dox.h:906
const OAuth2AuthRequestOptions
options required to support the OAuth2 authorization code grant flow
Definition SalesforceRestClient.qm.dox.h:902
constructor(string name, string description, string url, hash< auto > attributes={}, hash< auto > options={})
creates the SalesforceRestConnection connection object
hash< ConnectionSchemeInfo > getConnectionSchemeInfoImpl()
Returns the ConnectionSchemeInfo hash for this object.
Qore::AbstractPollOperation startPollConnect(*Logger::LoggerInterface logger)
Called to start a non-blocking polling ping operation on the remote REST server.
hash< auto > getOAuth2Options()
Returns OAuth2 options in a standard format.
const ConnectionScheme
Connection entry info.
Definition SalesforceRestClient.qm.dox.h:898
const OAuth2DifferentOptionMap
Different OAuth2 option map; standard name => extern name.
Definition SalesforceRestClient.qm.dox.h:913
setChildCapabilities()
Sets child data provider capabilities.
DataProvider::AbstractDataProvider getDataProvider(*hash< auto > constructor_options)
returns a data provider object for this connection
*hash< auto > processOAuth2TokenResponseImpl(hash< auto > resp)
Processes OAuth2 login responses and returns updated options.
*hash< auto > getOAuth2AuthHeaders()
Returns headers to use with OAuth2 authorization / token requests.
*string getPingPath()
Returns the ping path from the ping_path option.
bool hasDataProvider()
returns True as this connection returns a data provider with the getDataProvider() method
checkAuthCodeFeature()
Sets the auth code feature if supported.
const OAuth2StandardToSalesforceOptionMap
Maps standard option names to Salesforce REST option names.
Definition SalesforceRestClient.qm.dox.h:910
*string getAppName()
Returns the data provider application name this connection serves, if any.
string getOAuth2OptionName(string opt)
Returns the OAuth2 option name for this connection.
REST ping polling I/O class with OAuth2 authentication.
Definition SalesforceRestClient.qm.dox.h:1049
const SPS_GET_APIS
Get available APIs.
Definition SalesforceRestClient.qm.dox.h:1054
const BulkJobZipCsv
Salesforce.com bulk job "ZIP_CSV" content type.
Definition SalesforceRestClient.qm.dox.h:225
const BulkJobCsv
Definition SalesforceRestClient.qm.dox.h:216
const BulkJobXml
Salesforce.com bulk job "XML" content type.
Definition SalesforceRestClient.qm.dox.h:222
const BulkJobJson
Salesforce.com bulk job "JSON" content type.
Definition SalesforceRestClient.qm.dox.h:219
const BulkJobZipJson
Salesforce.com bulk job "ZIP_JSON" content type.
Definition SalesforceRestClient.qm.dox.h:228
const BulkJobZipXml
Salesforce.com bulk job "ZIP_XML" content type.
Definition SalesforceRestClient.qm.dox.h:231
const BulkJobQuery
Definition SalesforceRestClient.qm.dox.h:186
const BulkJobUpsert
Salesforce.com bulk job "upsert" operation.
Definition SalesforceRestClient.qm.dox.h:195
const BulkJobDelete
Salesforce.com bulk job "delete" operation.
Definition SalesforceRestClient.qm.dox.h:198
const BulkJobInsert
Salesforce.com bulk job "insert" operation.
Definition SalesforceRestClient.qm.dox.h:189
const BulkJobUpdate
Salesforce.com bulk job "update" operation.
Definition SalesforceRestClient.qm.dox.h:192
the SalesforceRestClient namespace contains all the objects in the SalesforceRestClient module
Definition SalesforceRestClient.qm.dox.h:181
const BulkJobContentTypes
a hash of Salesforce.com bulk job content types; keys are Salesforce.com Bulk REST API Job Content Ty...
Definition SalesforceRestClient.qm.dox.h:243
const BulkJobOperations
a hash of Salesforce.com bulk job operations; keys are Salesforce.com Bulk REST API Job Operations
Definition SalesforceRestClient.qm.dox.h:209