twitter-lite icon indicating copy to clipboard operation
twitter-lite copied to clipboard

Document the subdomain constructor property

Open dandv opened this issue 7 years ago • 1 comments

Haven't seen this in the other Twitter libraries. Presumably it would help with issues like https://github.com/ttezel/twit/issues/415, though it's probably better to abstract the resource subdomains from the user.

dandv avatar Feb 20 '18 04:02 dandv

@dandv It's been a while for this issue, but I think you make an important point. What is the best way to handle Twitter endpoints that don't start with api.twitter.com (for example, publish.twitter.com). Right now we just pass in a string to the constructor like this:

const client = new Twitter({
  subdomain: "api", // this could be "publish", for example
  consumer_key: "abc", // from Twitter.
  consumer_secret: "def", // from Twitter.
  access_token_key: "uvw", // from your User (oauth_token)
  access_token_secret: "xyz" // from your User (oauth_token_secret)
});

When you say "it's probably better to abstract the resource subdomains from the user", what do you have in mind? Would we want a full-fledged object that corresponds to each subdomain like this?

// instead of
client.get("statuses/show", {...})

// we have
client.statuses.show({...})

Let me know what you had in mind!

dylanirlbeck avatar Feb 20 '20 18:02 dylanirlbeck