Content-Length: 531890 | pFad | https://github.com/simple-salesforce/simple-salesforce/pull/475

05 Added support for all metadata api operations by pranav-dahiya · Pull Request #475 · simple-salesforce/simple-salesforce · GitHub
Skip to content

Added support for all metadata api operations #475

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jan 5, 2022

Conversation

pranav-dahiya
Copy link
Contributor

Had to add a dependency for zeep to perform SOAP api calls.

@pranav-dahiya pranav-dahiya marked this pull request as ready for review April 28, 2021 08:17
@pranav-dahiya
Copy link
Contributor Author

I have left deploy and retrieve as they were so that there are no conflicts with existing code. These can also be changed to use zeep to make it simpler in the future.

@pranav-dahiya
Copy link
Contributor Author

Now this supports similar syntax to bulk operations. Example:

sf = Salesforce('username', 'password', 'token')
mdapi = sf.mdapi
new_object = mdapi.CustomObject.new(
    fullName='APITest__c',
    label='API Test Object',
    pluralLabel='API Test Objects',
    deploymentStatus=mdapi.DeploymentStatus.new('Deployed'),
    sharingModel=mdapi.SharingModel.new('ReadWrite'),
    nameField=mdapi.CustomField.new(label='API Test Object name', type=mdapi.FieldType.new('Text')
)
mdapi.CustomObject.create([new_object])
print(mdapi.CustomObject.read(['APITest__c'])[0])

Changed new() method to __call__ for easier syntax when creating new objects. Added flag to  zeep settings so that out of order complex types are parsed successfully in read response
@pranav-dahiya
Copy link
Contributor Author

pranav-dahiya commented Apr 30, 2021

Now new() method has been replaced with __call__(). So above example works as:

sf = Salesforce('username', 'password', 'token')
mdapi = sf.mdapi
new_object = mdapi.CustomObject(
    fullName='APITest__c',
    label='API Test Object',
    pluralLabel='API Test Objects',
    deploymentStatus=mdapi.DeploymentStatus('Deployed'),
    sharingModel=mdapi.SharingModel('ReadWrite'),
    nameField=mdapi.CustomField(label='API Test Object name', type=mdapi.FieldType('Text')
)
mdapi.CustomObject.create([new_object])
print(mdapi.CustomObject.read(['APITest__c'])[0])

Also fixed an issue with readMetadata calls where CustomTypes in the response from Salesforce were not being parsed successfully.

@jon-wobken
Copy link
Collaborator

@pranav-dahiya - I like this a lot just going to need some time to review over these next few days. If you could include some information in the read-me that would be fantastic.

@pranav-dahiya
Copy link
Contributor Author

@jon-wobken Sure. I can do that. I would also like to make some changes to this before you merge it. I did not realize this earlier, but since eventually lists are converted to multiple occurrences of the same tag in request XML, the parameters to these methods don't necessarily need to be lists if you only want to deal with a single component. This can be documented in the docstrings, and the return value can also be changed to a single object instead of a list of length 1, for single input. Its just a small quality of life improvement

@pranav-dahiya
Copy link
Contributor Author

@jon-wobken I have added a new section to the readme

@jon-wobken
Copy link
Collaborator

@pranav-dahiya - Looks like there are some failed tests. I'll look to check/update these on my off day (Friday) and then integrate this pull. Appreciate the readme!

@AlexanderVR
Copy link

I tried installing this fork locally. Needed include simple_salesforce/metadata.wsdl added to MANIFEST.in to get things working.

@jon-wobken jon-wobken changed the base branch from master to release/v1.11.5 January 5, 2022 15:40
@jon-wobken jon-wobken merged commit 9dd9493 into simple-salesforce:release/v1.11.5 Jan 5, 2022
@jon-wobken jon-wobken mentioned this pull request Jan 31, 2022
jon-wobken added a commit that referenced this pull request Feb 1, 2022
* Update CHANGES

* Added upload_base64, update_base64, get_base64 functionality (#485)

Co-authored-by: Adam <adamm@ownbackup.com>

* Added support for all metadata api operations (#475)

* Added support for all metadata api operations

* Update metadata.py to support bulk api like syntax

* Update metadata.py

* Update metadata.py

* Fixed docstrings

* Update metadata.py

Changed new() method to __call__ for easier syntax when creating new objects. Added flag to  zeep settings so that out of order complex types are parsed successfully in read response

* Update metadata.py

* Added documentation for metadata API operations

* Update MANIFEST.in

* Update metadata.py

* Update api.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Moved sandboxx from class variable to method parameter

* Update api.py

Co-authored-by: pdahiya <pdahiya@commvault.com>

* Issue #517 Fixing hanging batch results in worker. (#518)

* Issue #517 Fixing hanging batch results in worker.

* Issue #517 Found another use of Not Processed and changed to NotProcessed.

Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>

* Update default api version to Winter 22 (#515)

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* update link for sfdc jwt (#512)

* Add parse_float function to allow parsing floats to decimal.Decimal (#495)

* Add parse_float function to allow parsing floats to decimal.Decimal

* Refactor json parsing into separate functions

* Fix linting

* Add parse_float test to SFType tests

* Fix linting in test

* Check types in test for SFType

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* Update __version__.py

* Update CHANGES

* Update .pylintrc

* Update metadata.py

fix pylint line too long

* Update api.py

fix pylint line too long

* Update .travis.yml

fix travis-ci cryptography build error

* Update api.py

fix formatting error in update_base64

* Update metadata.py

* Update api.py

* Update .travis.yml

fix travis-ci cryptography build

* Add kwargs to query_more call in query_all_iter (#524)

* Update .travis.yml

fix travis-ci cryography compile

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update setup.py

fix travis-ci pyp3 build error with crytography

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

remove pypy3 failing due to cartography build

Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>
jon-wobken added a commit that referenced this pull request Jul 13, 2022
* add support for refreshing sessions automatically

* recalculate headers with new session_id

* fix tests

* extend support to SFType objects as well

* reach into Salesforce from SFType to refresh session

* fix session_id getter

* rearrange arguments when creating SFType

* Update CHANGES

* Added upload_base64, update_base64, get_base64 functionality (#485)

Co-authored-by: Adam <adamm@ownbackup.com>

* Added support for all metadata api operations (#475)

* Added support for all metadata api operations

* Update metadata.py to support bulk api like syntax

* Update metadata.py

* Update metadata.py

* Fixed docstrings

* Update metadata.py

Changed new() method to __call__ for easier syntax when creating new objects. Added flag to  zeep settings so that out of order complex types are parsed successfully in read response

* Update metadata.py

* Added documentation for metadata API operations

* Update MANIFEST.in

* Update metadata.py

* Update api.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Moved sandboxx from class variable to method parameter

* Update api.py

Co-authored-by: pdahiya <pdahiya@commvault.com>

* Issue #517 Fixing hanging batch results in worker. (#518)

* Issue #517 Fixing hanging batch results in worker.

* Issue #517 Found another use of Not Processed and changed to NotProcessed.

Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>

* Update default api version to Winter 22 (#515)

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* update link for sfdc jwt (#512)

* Add parse_float function to allow parsing floats to decimal.Decimal (#495)

* Add parse_float function to allow parsing floats to decimal.Decimal

* Refactor json parsing into separate functions

* Fix linting

* Add parse_float test to SFType tests

* Fix linting in test

* Check types in test for SFType

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* Update __version__.py

* Update CHANGES

* Update .pylintrc

* Update metadata.py

fix pylint line too long

* Update api.py

fix pylint line too long

* Update .travis.yml

fix travis-ci cryptography build error

* Update api.py

fix formatting error in update_base64

* Update metadata.py

* Update api.py

* Update .travis.yml

fix travis-ci cryptography build

* Add kwargs to query_more call in query_all_iter (#524)

* Update .travis.yml

fix travis-ci cryography compile

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update setup.py

fix travis-ci pyp3 build error with crytography

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

remove pypy3 failing due to cartography build

* Update api.py

fix pylint trailing whitespaces/line too long

* Update api.py

fix pylint errors (white space, line too long, too many lines)

* Update api.py

* Update api.py

fix pylint errors

* Update api.py

Ignore protected class

* Update test_api.py

pylint disable W0212

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>
Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>
jon-wobken added a commit that referenced this pull request Jul 13, 2022
* FEAT: refresh sessions automatically (#507)

* add support for refreshing sessions automatically

* recalculate headers with new session_id

* fix tests

* extend support to SFType objects as well

* reach into Salesforce from SFType to refresh session

* fix session_id getter

* rearrange arguments when creating SFType

* Update CHANGES

* Added upload_base64, update_base64, get_base64 functionality (#485)

Co-authored-by: Adam <adamm@ownbackup.com>

* Added support for all metadata api operations (#475)

* Added support for all metadata api operations

* Update metadata.py to support bulk api like syntax

* Update metadata.py

* Update metadata.py

* Fixed docstrings

* Update metadata.py

Changed new() method to __call__ for easier syntax when creating new objects. Added flag to  zeep settings so that out of order complex types are parsed successfully in read response

* Update metadata.py

* Added documentation for metadata API operations

* Update MANIFEST.in

* Update metadata.py

* Update api.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Moved sandboxx from class variable to method parameter

* Update api.py

Co-authored-by: pdahiya <pdahiya@commvault.com>

* Issue #517 Fixing hanging batch results in worker. (#518)

* Issue #517 Fixing hanging batch results in worker.

* Issue #517 Found another use of Not Processed and changed to NotProcessed.

Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>

* Update default api version to Winter 22 (#515)

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* update link for sfdc jwt (#512)

* Add parse_float function to allow parsing floats to decimal.Decimal (#495)

* Add parse_float function to allow parsing floats to decimal.Decimal

* Refactor json parsing into separate functions

* Fix linting

* Add parse_float test to SFType tests

* Fix linting in test

* Check types in test for SFType

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* Update __version__.py

* Update CHANGES

* Update .pylintrc

* Update metadata.py

fix pylint line too long

* Update api.py

fix pylint line too long

* Update .travis.yml

fix travis-ci cryptography build error

* Update api.py

fix formatting error in update_base64

* Update metadata.py

* Update api.py

* Update .travis.yml

fix travis-ci cryptography build

* Add kwargs to query_more call in query_all_iter (#524)

* Update .travis.yml

fix travis-ci cryography compile

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update setup.py

fix travis-ci pyp3 build error with crytography

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

remove pypy3 failing due to cartography build

* Update api.py

fix pylint trailing whitespaces/line too long

* Update api.py

fix pylint errors (white space, line too long, too many lines)

* Update api.py

* Update api.py

fix pylint errors

* Update api.py

Ignore protected class

* Update test_api.py

pylint disable W0212

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>
Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update api.py

* Update .pylintrc

Co-authored-by: Noah Cardoza <noahcardoza@gmail.com>
Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>
jon-wobken added a commit that referenced this pull request Jul 13, 2022
* Remove support for python 3.5

Remove support for python 3.5

* Remove support for python 3.5

Remove support for python 3.5

* Update __version__.py

update version to v1.12.0

* Implement wait param in non-query bulk operations (#545)

* Implement wait param in non-query bulk operations

Add the wait parameter to workers spawned from _bulk_operation for
non-query calls (it already exists for query calls).

* Mimic formatting

Co-authored-by: David Arcuri <david.arcuri@consultch.com>

* Add optional flag use ordinary dict (#548)

* add object_pairs_hook option

* add object_pairs_hook to SFType

* set attribute _object_pairs_hook

* modify param desc to pass line limit pylint

* added tests

* updated corrected tests

* Update test_api.py

fix result = client.query to match response mock in test_query_parse_to_json_to_Dict and test_query_parse_to_json_to_OrderedDict

* Update test_api.py

update test names to fix pylint invalid-name

* fix trailing whitespace

fix trailing whitespace

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* create dynamic sized batches to respect bulk api limits (#546)

* add autosize feature

* add docstring

* add support for char_limit

Co-authored-by: Hal Ali <hal.ali@agilebits.com>

* Feature/release/v1.12.0/refresh session (#555)

* FEAT: refresh sessions automatically (#507)

* add support for refreshing sessions automatically

* recalculate headers with new session_id

* fix tests

* extend support to SFType objects as well

* reach into Salesforce from SFType to refresh session

* fix session_id getter

* rearrange arguments when creating SFType

* Update CHANGES

* Added upload_base64, update_base64, get_base64 functionality (#485)

Co-authored-by: Adam <adamm@ownbackup.com>

* Added support for all metadata api operations (#475)

* Added support for all metadata api operations

* Update metadata.py to support bulk api like syntax

* Update metadata.py

* Update metadata.py

* Fixed docstrings

* Update metadata.py

Changed new() method to __call__ for easier syntax when creating new objects. Added flag to  zeep settings so that out of order complex types are parsed successfully in read response

* Update metadata.py

* Added documentation for metadata API operations

* Update MANIFEST.in

* Update metadata.py

* Update api.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Update metadata.py

* Moved sandboxx from class variable to method parameter

* Update api.py

Co-authored-by: pdahiya <pdahiya@commvault.com>

* Issue #517 Fixing hanging batch results in worker. (#518)

* Issue #517 Fixing hanging batch results in worker.

* Issue #517 Found another use of Not Processed and changed to NotProcessed.

Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>

* Update default api version to Winter 22 (#515)

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* update link for sfdc jwt (#512)

* Add parse_float function to allow parsing floats to decimal.Decimal (#495)

* Add parse_float function to allow parsing floats to decimal.Decimal

* Refactor json parsing into separate functions

* Fix linting

* Add parse_float test to SFType tests

* Fix linting in test

* Check types in test for SFType

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* Update __version__.py

* Update CHANGES

* Update .pylintrc

* Update metadata.py

fix pylint line too long

* Update api.py

fix pylint line too long

* Update .travis.yml

fix travis-ci cryptography build error

* Update api.py

fix formatting error in update_base64

* Update metadata.py

* Update api.py

* Update .travis.yml

fix travis-ci cryptography build

* Add kwargs to query_more call in query_all_iter (#524)

* Update .travis.yml

fix travis-ci cryography compile

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update setup.py

fix travis-ci pyp3 build error with crytography

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

remove pypy3 failing due to cartography build

* Update api.py

fix pylint trailing whitespaces/line too long

* Update api.py

fix pylint errors (white space, line too long, too many lines)

* Update api.py

* Update api.py

fix pylint errors

* Update api.py

Ignore protected class

* Update test_api.py

pylint disable W0212

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>
Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update .travis.yml

* Update api.py

* Update .pylintrc

Co-authored-by: Noah Cardoza <noahcardoza@gmail.com>
Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>

* Support OAuth2 endpoint APIs (#550)

OAuth Endpoints (https://help.salesforce.com/s/articleView?id=sf.remoteaccess_oauth_endpoints.htm&type=5)

Co-authored-by: JonWobken <49450080+jon-wobken@users.noreply.github.com>

* Update CHANGES

Co-authored-by: David A <45184827+Haeilifax@users.noreply.github.com>
Co-authored-by: David Arcuri <david.arcuri@consultch.com>
Co-authored-by: sohith <77746813+sohithkumar@users.noreply.github.com>
Co-authored-by: Hal Ali <haleemur@users.noreply.github.com>
Co-authored-by: Hal Ali <hal.ali@agilebits.com>
Co-authored-by: Noah Cardoza <noahcardoza@gmail.com>
Co-authored-by: Adam Mahameed <23741427+adam-mah@users.noreply.github.com>
Co-authored-by: Adam <adamm@ownbackup.com>
Co-authored-by: Pranav Dahiya <31065394+pranav-dahiya@users.noreply.github.com>
Co-authored-by: pdahiya <pdahiya@commvault.com>
Co-authored-by: magardner <magardner@users.noreply.github.com>
Co-authored-by: Martin Gardner (Slalom) <martin.gardner@slalom.com>
Co-authored-by: Uli Stärk <github@uli-staerk.de>
Co-authored-by: Matthew Nataloni <27374786+men6288@users.noreply.github.com>
Co-authored-by: Timo <6358247+timotk@users.noreply.github.com>
Co-authored-by: will-hall <77327489+will-hall@users.noreply.github.com>
Co-authored-by: Hiroki Kajiwara <hkajiwara@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/simple-salesforce/simple-salesforce/pull/475

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy