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

Need more help applying what is written in guide #9

Open
MehmetKursat opened this issue Sep 13, 2016 · 3 comments
Open

Need more help applying what is written in guide #9

MehmetKursat opened this issue Sep 13, 2016 · 3 comments

Comments

@MehmetKursat
Copy link

MehmetKursat commented Sep 13, 2016

How do I use this pledge_schema thing to achieve this:

For instance, if you wanted to request the total amount a patron has ever paid to your campaign, which is not included by default, you could do:

const patreonAPIClient = patreonAPI(access_token)
const url = jsonApiURL(`/current_user`, {
  fields: {
    pledge: [...pledge_schema.default_attributes, pledge_schema.attributes.total_historical_amount_cents]
  }
})
patreonAPIClient(url, callback)

I required jsonApiURL from here https://github.com/Patreon/patreon-js/blob/master/src/jsonapi-url.js but then what? I get Uncaught error: pledge_schema is not defined

@21echoes
Copy link
Contributor

Hey @FiatPax ! Try import pledge_schema from 'src/schemas/pledge'

@MehmetKursat
Copy link
Author

MehmetKursat commented Sep 13, 2016

Alright I tried and now I get this error: Cannot read property 'Symbol(Symbol.iterator)' of undefined

Just in case you need to see my code

var patreonAPI = patreon.default
var patreonOAuth = patreon.oauth

test(request, reply) {
        var patreonAPIClient = patreonAPI(access_tkn)

        const url = jsonApiURL(`/current_user`, {
            fields: {
                pledge: [...pledge_schema.default_attributes, pledge_schema.attributes.total_historical_amount_cents]
            }
        })
        patreonAPIClient(url, function (err, res) {
            reply(res)
        })
    }

@anton-minnion
Copy link

Struggled with trying to inlude the total_historical_amount_cents field in the json return. Found the schemas in the 'dist' folder of the npm install:

import pledge_schema from 'patreon/dist/schemas/pledge';

But not working, just get a 500 error following the docs.

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

No branches or pull requests

4 participants