Skip to content

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.

3 participants