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

Added formatResponse option to the ghost content API #264

Closed
wants to merge 2 commits into from

Conversation

nextwebb
Copy link

@nextwebb nextwebb commented Apr 21, 2020

Added formatResponse option to the ghost content API,
A fix for "Add an option to skip response formatting in Content/Admin API SDKs #73"
#73

The contentAPI will now have the "format response" boolean property, as an option
like this:
const api = new GhostContentAPI({
url: 'YOUR URL',
key: 'YOUR KEY',
version: "VERSION",
formatResponse: true/false
})

@nextwebb nextwebb closed this Apr 21, 2020
@nextwebb nextwebb reopened this Apr 21, 2020
@nextwebb nextwebb changed the title Nextwebb dev Added formatResponse option to the ghost content API Apr 21, 2020
@kevinansfield
Copy link
Member

@nextwebb it seems that your PR contains a lot of file permission changes and also needs conflicts resolving. Could you look at both of those issues please?

Copy link

@phawazzzy phawazzzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


}
if(formatResponse === true ){
return Object.assign(res.dat, {meta: res.data.meta});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be return Object.assign(res.data, {meta: res.data.meta}); and not return Object.assign(res.dat, {meta: res.data.meta});

return GhostContentAPI({url, version, key, formatResponse});
}

if (!formatResponse) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel the formatResponse option should not throw an error if it isnt declared or assigned a value...
It should default to true just as mentioned here by the first person who commented on the issue here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into it

@nextwebb nextwebb closed this Apr 23, 2020
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