Qore SalesforceRestClient Module Reference 1.5.1
Loading...
Searching...
No Matches
SalesforceRestClient.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* SalesforceRestClient.qm Copyright (C) 2016 - 2022 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}
37
179const BulkJobQuery = "query";
180
182const BulkJobInsert = "insert";
183
185const BulkJobUpdate = "update";
186
188const BulkJobUpsert = "upsert";
189
191const BulkJobDelete = "delete";
193
195
203 BulkJobQuery: True,
204 BulkJobInsert: True,
205 BulkJobUpdate: True,
206 BulkJobUpsert: True,
207 BulkJobDelete: True,
208};
209
214const BulkJobCsv = "CSV";
215
217const BulkJobJson = "JSON";
218
220const BulkJobXml = "XML";
221
223const BulkJobZipCsv = "ZIP_CSV";
224
226const BulkJobZipJson = "ZIP_JSON";
227
229const BulkJobZipXml = "ZIP_XML";
231
233
242 BulkJobCsv: MimeTypeCsv,
243 BulkJobJson: MimeTypeJson,
244 BulkJobXml: MimeTypeXmlApp,
245 BulkJobZipCsv: "zip/csv",
246 BulkJobZipJson: "zip/json",
247 BulkJobZipXml: "zip/xml",
248};
249
251
297
298public:
300 const Defaults = {
301 "oauth_url_auth": "https://login.salesforce.com/services/oauth2/authorize",
302 "oauth_url_token": "https://login.salesforce.com/services/oauth2/token",
303 "oauth_url_revoke": "https://login.salesforce.com/services/oauth2/revoke",
304 "api": "auto",
305 };
306
308 const DefaultSendEncoding = "gzip";
309
311 const RequiredOptions = ...;
312
313
315 const AsyncDataloadNs = "http://www.force.com/2009/06/asyncapi/dataload";
316
318 const JobInfoAttributes = ...;
319
320
321protected:
324
327
330
332 Mutex m();
333
335 string token;
336
338 string client_id;
339
342
344 string username;
345
347 string password;
348
350 string api;
351
353 string api_used;
354
356 hash<auto> api_hash;
357
358public:
359
361
399 constructor(*hash<auto> opts, *softbool do_not_connect) ;
400
401
403
443 hash<auto> patch(string path, auto body, *reference<hash<auto>> info, *hash<auto> hdr);
444
445
447
490 hash<auto> doRequest(string m, string path, auto body, *reference<hash<auto>> info, softbool decode_errors = True, *hash<auto> hdr);
491
492
494
539 hash<auto> doBulkRequest(string m, string path, auto body, *reference<hash<auto>> info, softbool decode_errors = True, *hash<auto> hdr);
540
541
543
585 hash<auto> bulkGet(string path, auto body, *reference<hash<auto>> info, *hash<auto> hdr);
586
587
589
631 hash<auto> bulkPost(string path, auto body, *reference<hash<auto>> info, *hash<auto> hdr);
632
633
635
666 hash<auto> bulkJobCreate(string operation, string object, string job_content_type, *reference<hash<auto>> info, *hash<auto> hdr);
667
668
670
701 hash<auto> bulkJobAddBatch(string jobid, data batch_data, string job_content_type, *reference<hash<auto>> info, *hash<auto> hdr);
702
703
705
730 hash<auto> bulkJobClose(string jobid, *reference<hash<auto>> info, *hash<auto> hdr);
731
732
734
750 login(*reference<hash<auto>> info);
751
752
754
775 logout(*reference<hash<auto>> info);
776
777
779 string getApi();
780
781
783 *string getToken();
784
785
787
789 checkClientOptions(hash<auto> opts);
790
791
793
799 static string getBulkDate(date d);
800
802 static string getGmtDate(date d);
803
805protected:
806 static hash getOptions(*hash<auto> opts);
807public:
808
809
811
813protected:
814 loginIntern(*reference<hash> info);
815public:
816
817};
818
820
835
836public:
838 const ConnectionScheme = <ConnectionSchemeInfo>{
839 "cls": Class::forName("SalesforceRestConnection"),
840 "options": RestConnection::ConnectionScheme.options + {
841 "api": <ConnectionOptionInfo>{
842 "type": "string",
843 "desc": "the Salesforce.com API to use; use `auto` (the default) to use the latest API version",
844 "default_value": SalesforceRestClient::Defaults.api,
845 },
846 "client_id": <ConnectionOptionInfo>{
847 "type": "string",
848 "desc": "the Salesforce.com \"consumer key\" for the Connected App",
849 },
850 "client_secret": <ConnectionOptionInfo>{
851 "type": "string",
852 "desc": "the Salesforce.com \"consumer secret\" for the Connected App",
853 "sensitive": True,
854 },
855 "oauth_url_auth": <ConnectionOptionInfo>{
856 "type": "string",
857 "desc": "the OAuth authorization URL",
858 "default_value": SalesforceRestClient::Defaults.oauth_url_auth,
859 },
860 "oauth_url_token": <ConnectionOptionInfo>{
861 "type": "string",
862 "desc": "the OAuth token URL",
863 "default_value": SalesforceRestClient::Defaults.oauth_url_auth,
864 },
865 "oauth_url_revoke": <ConnectionOptionInfo>{
866 "type": "string",
867 "desc": "the OAuth logout / revoke token URL",
868 "default_value": SalesforceRestClient::Defaults.oauth_url_auth,
869 },
870 "password": <ConnectionOptionInfo>{
871 "type": "string",
872 "desc": "the ServiceNow password (will override any password in the URL)",
873 "sensitive": True,
874 },
875 "username": <ConnectionOptionInfo>{
876 "type": "string",
877 "desc": "the ServiceNow username (will override any username in the URL)",
878 "sensitive": False,
879 },
880 },
881 // FIXME: username and password are currently optional for backwards compatibility with URL auth options
882 "required_options": "client_id,client_secret",
883 };
884
886
894 constructor(string name, string description, string url, hash<auto> attributes = {}, hash<auto> options = {})
895 ;
896
897
899 string getType();
900
901
903
908
909
911
916
917
919protected:
921public:
922
923
925
930protected:
931 SalesforceRestClient getImpl(bool connect = True, *hash<auto> rtopts);
932public:
933
934
936protected:
937 hash<ConnectionSchemeInfo> getConnectionSchemeInfoImpl();
938public:
939
940};
941};
constructor(*hash< auto > opts, *softbool do_not_connect)
creates the object with the given options (which include the following mandatory options for Salesfor...
static string getBulkDate(date d)
returns a date string for use with Salesforce.com Bulk REST API requests
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...
login(*reference< hash< auto > > info)
logs in to Salesforce.com with the credentials provided in the constructor()
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
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
string password
Salesforce.com password.
Definition: SalesforceRestClient.qm.dox.h:347
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
string token
Salesforce.com token.
Definition: SalesforceRestClient.qm.dox.h:335
string oauth_url_revoke
Salesforce.com OAuth2 Revoke Token URL.
Definition: SalesforceRestClient.qm.dox.h:329
*string getToken()
returns the access token
string api_used
Salesforce.com REST API version currently in use.
Definition: SalesforceRestClient.qm.dox.h:353
string username
Salesforce.com username.
Definition: SalesforceRestClient.qm.dox.h:344
logout(*reference< hash< auto > > info)
logs out of Salesforce.com by revoking the access token
hash< auto > api_hash
hash of APIs retrieved from GET /services/data; keyed by API version string; values: "label",...
Definition: SalesforceRestClient.qm.dox.h:356
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
string client_secret
Salesforce.com "consumer secret".
Definition: SalesforceRestClient.qm.dox.h:341
string client_id
Salesforce.com "consumer key".
Definition: SalesforceRestClient.qm.dox.h:338
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 ...
string getApi()
returns the Salesforce.com REST API version currently in use
Mutex m()
Mutex for token acquisition.
const Defaults
defaults for direct member values
Definition: SalesforceRestClient.qm.dox.h:300
string oauth_url_auth
Salesforce.com OAuth2 Authorization URL.
Definition: SalesforceRestClient.qm.dox.h:323
string api
Salesforce.com REST API version to be used ("auto" = latest version)
Definition: SalesforceRestClient.qm.dox.h:350
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 > 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...
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...
string oauth_url_token
Salesforce.com OAuth2 Get Token URL.
Definition: SalesforceRestClient.qm.dox.h:326
class for Salesforce.com REST connections; returns SalesforceRestClient::SalesforceRestClient objects
Definition: SalesforceRestClient.qm.dox.h:834
SalesforceRestClient getImpl(bool connect=True, *hash< auto > rtopts)
returns a SalesforceRestClient::SalesforceRestClient object
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.
const ConnectionScheme
Connection entry info.
Definition: SalesforceRestClient.qm.dox.h:838
setChildCapabilities()
Sets child data provider capabilities.
bool hasDataProvider()
returns True as this connection returns a data provider with the getDataProvider() method
DataProvider::AbstractDataProvider getDataProvider()
returns a data provider object for this connection
const BulkJobZipCsv
Salesforce.com bulk job "ZIP_CSV" content type.
Definition: SalesforceRestClient.qm.dox.h:223
const BulkJobCsv
Definition: SalesforceRestClient.qm.dox.h:214
const BulkJobXml
Salesforce.com bulk job "XML" content type.
Definition: SalesforceRestClient.qm.dox.h:220
const BulkJobJson
Salesforce.com bulk job "JSON" content type.
Definition: SalesforceRestClient.qm.dox.h:217
const BulkJobZipJson
Salesforce.com bulk job "ZIP_JSON" content type.
Definition: SalesforceRestClient.qm.dox.h:226
const BulkJobZipXml
Salesforce.com bulk job "ZIP_XML" content type.
Definition: SalesforceRestClient.qm.dox.h:229
const BulkJobQuery
Definition: SalesforceRestClient.qm.dox.h:179
const BulkJobUpsert
Salesforce.com bulk job "upsert" operation.
Definition: SalesforceRestClient.qm.dox.h:188
const BulkJobDelete
Salesforce.com bulk job "delete" operation.
Definition: SalesforceRestClient.qm.dox.h:191
const BulkJobInsert
Salesforce.com bulk job "insert" operation.
Definition: SalesforceRestClient.qm.dox.h:182
const BulkJobUpdate
Salesforce.com bulk job "update" operation.
Definition: SalesforceRestClient.qm.dox.h:185
the SalesforceRestClient namespace contains all the objects in the SalesforceRestClient module
Definition: SalesforceRestClient.qm.dox.h:174
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:241
const BulkJobOperations
a hash of Salesforce.com bulk job operations; keys are Salesforce.com Bulk REST API Job Operations
Definition: SalesforceRestClient.qm.dox.h:202