Giter Site home page Giter Site logo

auxlabs / twitch Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 15.9 MB

An implementation of the Twitch Developer APIs for dotnet

Home Page: https://docs.auxlabs.org/Twitch/

License: MIT License

C# 100.00%
csharp dotnet rest twitch twitch-api websocket eventsub pubsub bot chat

twitch's People

Contributors

aux avatar

Watchers

 avatar  avatar  avatar

twitch's Issues

[Feature] Model contracts

Implement interfaces between like-objects for cross-compatibility between projects.

Chat's UserStateEventArgs and Rest's User are both objects containing data referring to a user and so both implement Core's IUser. This should be implemented across all entities in all projects. e.g. Users, Channels, Broadcasts, etc...

[Feature] Twitch rest client factory for multiple authorization

There are many situations with the twitch api where requests can only be made using an oauth token authorized by a broadcaster or moderator rather than an application's user account. The best method to handle this is probably by making a TwitchRestApiClientFactory or something similar that manages identity internally and allows the user to generate TwitchRestApiClient for authorized users as needed.

Notes

  • Ironically , the identity api client itself doesn't have a sense of identity, so it can be inside the factory itself.
  • TwitchRestApiClient would need a constructor to allow providing a premade HttpClient.
  • The factory class would need to cache validated identities and provide methods for getting user identities by id or name.

While this method works fine for the lower library, it will probably cause issues with the higher library. Since entities there all contain a reference to the client that created them it might cause confusion if a user caches them, but it might not we'll see.

[Feature] Implement extension endpoints

Extension endpoints have a unique authentication scheme that isn't compatible with most other endpoints in the rest api. They should probably be implemented in their own client.

This is related to #12

Array query not inputting multiple parameters

Haven't tested if it's an issue with the mock api or the library, but it's probably the library.

Requests that ask for an array inside of the url only generate one ?tag=value instead of many ?tag=value&tag=value repeating.

Implement .Net Standard 2.1 For Unity

Self explanatory title.

The latest .Net version unity supports is .Net Standard 2.1 and .Net 4.x, compared to this library's .Net 6.0
The latest c# version unity supports is c#6, compared to this library's c#10

[Feature] Auto refresh expired tokens

The rest client should auto attempt to refresh tokens when they expire, if the user provides the necessary info to do so.

Notes

  • The client will check scopes before sending requests, so all 401 Unauthorized responses should be due to an invalid token.
  • App access tokens aren't refreshed, a new one needs to be generated.
  • If the client isn't provided with client id, client secret, and refresh token, throw for unauthorized: invalid oauth token.
  • If the client does have that info, but the refresh fails, this should mean the token has been revoked. Throw an error specific to that.
  • If the client has that info and the refresh succeeds, automatically retry the request.
  • Add a property to TwitchRestApiConfig to optionally disable auto refresh even if information is provided.

Requests that allow duplicate keys run slow

For requests that allow multiple of a single property, like &id=value&id=value&id=value&id=value the query builder takes on average 4x longer to generate the request. From 0.24s in non-array requests to 1.16s in array requests. There's definitely a better way to handle this, figure it out later.

[Feature] Check for valid authorization before requests

Most requests have a specific set of permissions the client needs to be valid. The client has this information and should check before sending any request. This isn't limited to just Rest requests, EventSub and PubSub both also have specific permissions.

Example:

/channels/editors or GetChannelEditorsAsync

  • This request is fed a broadcaster id as a parameter
  • Twitch's documentation says only the owner of the channel can request it's editors
  • So the broadcaster id parameter must match the identity user id
  • Requires the channel:read:editors scope

Subscriptions endpoints should allow app authorizations

As the client is now, it denies app authorizations for any endpoint that has required scopes. This doesn't work for subscriptions since, in the case of extensions, the app can have scopes authorized that aren't viewable from the API. Unless a method is added to view these scopes, the client should just allow app authorizations to simply bypass the scope check even if it will result in a 401 Unauthorized.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.