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

refactor: convert ReadMe into a class #958

Merged
merged 2 commits into from
Feb 1, 2024

Conversation

kanadgupta
Copy link
Member

@kanadgupta kanadgupta commented Jan 31, 2024

🧰 Changes

This updates the SDK to be a class. As part of this, the signature is slightly updated:

import { ReadMe } from 'readmeio';
- const readme = ReadMe(key);
+ const readme = new ReadMe(key);
app.use(readme.express(() => {}));

🧬 QA & Testing

Strongly suggest hiding whitespace before reviewing! Does this signature look good? Do tests still pass?

@kanadgupta kanadgupta added area:node refactor Issues about tackling technical debt labels Jan 31, 2024
@kanadgupta kanadgupta marked this pull request as ready for review January 31, 2024 23:35
Comment on lines -58 to -61
// See comment at the auth definition below
let readmeAPIKey = '';
let readmeProjectData: GetProjectResponse200 | undefined;
let readmeVersionData: ReadMeVersion[] | undefined;
Copy link
Member

Choose a reason for hiding this comment

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

moving everything into a class will also contain this data to the specific instance. as-is it'd be difficult/impossible to spin up different instances of the SDK against different projects (like a group of microservices) because this data would get clobbered between each

Copy link
Member

@erunion erunion left a comment

Choose a reason for hiding this comment

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

seems ok to me

Copy link
Member

@gratcliff gratcliff left a comment

Choose a reason for hiding this comment

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

💙

@mjcuva mjcuva merged commit 48e8815 into node/unified-snippet Feb 1, 2024
37 checks passed
@mjcuva mjcuva deleted the kanad/unified-snippet-class-refactor branch February 1, 2024 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactor Issues about tackling technical debt
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants