Giter VIP home page Giter VIP logo

patreon-ts's Introduction

Hi there ๐Ÿ‘‹

  • ๐Ÿ”ญ Current Projects
    • Active: Working on a game using a homemade engine. In Rust, with WGPU.
    • Backburner: Working on a rebuild of Flash Flash Revolution, called Rust Rust Revolution.
  • ๐Ÿ˜„ Pronouns: he/him
  • โš–๏ธ My code and my opinions are my own.

patreon-ts's People

Contributors

dependabot[bot] avatar north101 avatar zageron avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

north101

patreon-ts's Issues

Update example to better reflect how the Schema definitions can be used to receive results.

The following example can be improved:

Previous Example:

const UserQueryObject: Schemas.User = new Schemas.User(
    {
        attributes:
        {
            about: Schemas.user_constants.attributes?.about,
        },
    });

const endpointQuery: ParsedUrlQueryInput = Endpoints.BuildEndpointQuery(UserQueryObject);

const query: string = Endpoints.BuildSimpleEndpoint(
    Endpoints.SimpleEndpoints.Identity,
    endpointQuery);

const result: string = await PatreonRequest(accessTokenStore, query);
const obj: any = JSON.parse(result);
// Do stuff with raw object.

New (Better) Usage:

const UserQueryObject: Schemas.User = new Schemas.User(
    { attributes: { about: Schemas.user_constants.attributes.first_name } }
);
const endpointQuery: ParsedUrlQueryInput = Endpoints.BuildEndpointQuery(UserQueryObject);

const query: string = Endpoints.BuildSimpleEndpoint(
    Endpoints.SimpleEndpoints.Identity,
    endpointQuery);

const result: string = await PatreonRequest(accessToken, query);

const UserResultObject: Schemas.User = new Schemas.User(
    // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
    JSON.parse(result).data
);

Feature Request: Extended schemas

I am currently using this hacky code to get the data I need. I'm not sure if theres a proper way to do it

const UserQueryObject = new Schemas.UserSchema({
  relationships: {
    memberships: Schemas.user_constants.relationships?.memberships,
    "memberships.campaign": "memberships.campaign", // not supported by lib but works
    campaign: Schemas.user_constants.relationships.campaign,
  } as any,
});

const endpointQuery = Endpoints.BuildEndpointQuery(UserQueryObject);
endpointQuery["fields[member]"] = "patron_status"; // not supported by lib but works

const query: string = Endpoints.BuildSimpleEndpoint(
  Endpoints.SimpleEndpoints.Identity,
  endpointQuery
);

const result: UserMembership = JSON.parse(
  await PatreonRequest(CreatePatreonTokenFromOAuthToken(accessToken), query)
);

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.