Skip to content

Introduce custom header agent + bump version of generator #37

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

Merged
merged 10 commits into from
Aug 30, 2021
Merged

Conversation

pcothenet
Copy link
Contributor

@pcothenet pcothenet commented Aug 27, 2021

What

  • Introduce a custom User-Agent header
  • Updates the generator version

Pairs with https://github.com/patch-technology/client-code-generation/pull/31

Why

  • Better analytics of usage pattern
  • Better debugging of user issues

SDK Release Checklist

  • Have you added an integration test for the changes?
  • Have you built the package locally and made queries against it successfully?
  • Did you update the changelog?
  • Did you bump the package version?
  • For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?

@pcothenet pcothenet changed the title WIP - Upgrade code generator Introduce custom header agent + bump version of generator Aug 27, 2021
Comment on lines +1 to +4
# Logs
logs
*.log
npm-debug.log*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding some sensible defaults from the template.

@@ -1,25 +1,26 @@
{
"name": "@patch-technology/patch",
"version": "1.9.0",
"description": "JavaScript wrapper for the Patch API",
"version": "1.10.0",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that the description and version are now automatically generated from the generator config.

Comment on lines +7 to +13
"scripts": {
"build": "babel src -d dist",
"prepare": "npm run build",
"test": "mocha"
},
"browser": {
"fs": false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that package.json is no longer defined on this repo but in the templates.

Comment on lines +18 to +20
this.defaultHeaders = {
'User-Agent': 'patch-node/1.10.0'
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a default User-Agent header.

Comment on lines +72 to +80
static canBeJsonified(str) {
if (typeof str !== 'string' && typeof str !== 'object') return false;
try {
const type = str.toString();
return type === '[object Object]' || type === '[object Array]';
} catch (err) {
return false;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those were added by more recent versions of the template.

@kleinjm I however left your parsing changes (so this isn't used) as replacing with this was breaking the metadata feature.

Comment on lines -22 to -24
this.createBitcoinEstimate = this.createBitcoinEstimate.bind(this);
this.createBitcoinEstimateWithHttpInfo =
this.createBitcoinEstimateWithHttpInfo.bind(this);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was surprising (unclear why needed), and not in the most recent template.

@pcothenet pcothenet marked this pull request as ready for review August 27, 2021 23:04
@pcothenet pcothenet requested a review from kleinjm August 27, 2021 23:15
@pcothenet pcothenet merged commit d9bac10 into main Aug 30, 2021
@pcothenet pcothenet deleted the pc/gen5 branch August 30, 2021 21:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants