Skip to content
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

adds asJsonString. Experimentally adds asStream and asBytes #56

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesperfj
Copy link
Owner

This is a proposal to address #47.

It also adds an asStream() and asBytes() method to potentially address #55.

Looking forward to comments. Does this work for you @holtonma and @aduston?

@jesperfj
Copy link
Owner Author

There is only a crude test for asJsonString() at this point. The other two new methods are experimental and would need some tests to make it into a release.

@aduston
Copy link

aduston commented Oct 17, 2017

It will work, but it might be awkward. What is a ResourceRepresentation? Is it a JSON object or a wrapper for any response from the API? The only public method in ForceApi that returns a ResourceRepresentation sets an Accept header of application/json, which contradicts the idea that this should be used for just getting bytes of file content data from the API.

If you wish to try this out first hand, try accessing the Body of an Attachment or the VersionData of a ContentVersion using this library with these changes.

@jesperfj
Copy link
Owner Author

jesperfj commented Oct 17, 2017 via email

@aduston
Copy link

aduston commented Oct 17, 2017

not expose the http classes in the public api

FWIW, another option you have is to create a different class that just wraps raw file responses. It would expose an InputStream and perhaps nothing else. Then your API will return two types of things: ResourceRepresentations and Data (or whatever you name it -- Salesforce calls the field "Body" for Attachment and Document, and VersionData for ContentVersion). This would avoid exposing the http classes, but might make the design less awkward.

Thanks for the library, btw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants