Skip to content

Commit

Permalink
v2 (#240)
Browse files Browse the repository at this point in the history
* Moved OAS submodule to project root in 'oas' directory

* clean up

* Setup configurations

* Update readme

* Add wrapper generator script

* Add starter code and update path

* Add templates

* Update gitignore

* rename -> tsconfig.script.json

* update yarn lock

* Log number of generated methods

* Make webhook types fired from convoy available

* v2-alpha

* Update OAS and accept params as camelCase

* Update alpha version

* generate code

* Fix global header construction logic

* Generate code

* 2.0.0-alpha.3

* Accept addresses as string[] rather than string in fetchSubscriptionCheck

* 2.0.0-alpha.4

* Rename fetchBulkUsersByEthereumAddress -> fetchBulkUsersByEthereumOrSolAddress

* 2.0.0-alpha.5

* Rename fetchBulkUsersByEthereumOrSolAddress -> fetchBulkUsersByEthOrSolAddress

* 2.0.0-alpha.6

* Add postinstall logs and error out if config is a string and show the correct usage

* 2.0.0-alpha.7

* move postinstall script in src

* move postinstall script in src

* 2.0.0-alpha.9

* move postinstall script in src

* 2.0.0-alpha.10

* Change path for postinstall script

* change warn to log

* remove node postinstall

* 2.0.0-alpha.14

* 2.0.0-alpha.15

* Cleanup postinstall work

* Make apis private

* format errors correctly

* 2.0.0-alpha.18

* Generate code

* 2.0.0-alpha.19

* Update code

* Update workflow to mark v2 as latest
  • Loading branch information
Shreyaschorge authored Nov 21, 2024
1 parent 9595bc1 commit 5e61d40
Show file tree
Hide file tree
Showing 574 changed files with 34,762 additions and 27,248 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/publish-to-npm.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: "Publish to npm 🚀"
name: "Publish v2 to npm 🚀"

on:
push:
branches:
- main
paths:
- src/neynar-api/common/version.ts

- package.json
jobs:
build:
runs-on: ubuntu-latest
Expand All @@ -21,13 +20,15 @@ jobs:
node-version: "20"

- name: Install dependencies
run: npm install
run: npm install --ignore-scripts

- name: Build
run: npm run build

- name: Set npm Config
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}

- name: Publish to npm
- name: Publish v2 to npm
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 2 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,5 @@ build

.DS_Store

# Temporary generated files
src/neynar-api/neynar-v1-api/openapi-tmp
src/neynar-api/neynar-v2-api/openapi-farcaster-tmp
src/neynar-api/neynar-v2-api/openapi-neynar-tmp

test-sdk.ts
test-sdk.ts
test-sdk.js
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "src/oas"]
path = src/oas
[submodule "oas"]
path = oas
url = [email protected]:neynarxyz/OAS.git
146 changes: 0 additions & 146 deletions CONTRIBUTING.md

This file was deleted.

18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,14 @@

Please refer to our [Getting Started Guide](https://docs.neynar.com/reference/getting-started-with-sdk)

Checkout [examples](https://github.com/neynarxyz/farcaster-examples) using this SDK

## Type Definitions

You can directly import the type definitions from the SDK as shown below:
<!-- TODO: Add migration guide link here-->

- See your `node_modules/@neynar/nodejs-sdk/build/neynar-api/v2/openapi-farcaster` directory for the type definitions.

```typescript
import { type User } from '@neynar/nodejs-sdk/build/neynar-api/v2/openapi-farcaster/models/user'
import { type CastAuthor } from '@neynar/nodejs-sdk/build/neynar-api/v2/openapi-farcaster/models/cast-author'
import { type CastWithInteractionsReactions } from '@neynar/nodejs-sdk/build/neynar-api/v2/openapi-farcaster/models/cast-with-interactions-reactions'

```
Checkout [examples](https://github.com/neynarxyz/farcaster-examples) using this SDK

## Contribution Guidelines

see [CONTRIBUTING.md](./CONTRIBUTING.md).
SDK is auto generated.
To make contributions to this SDK please update the [OAS](https://github.com/neynarxyz/oas)

## License

Expand Down
1 change: 1 addition & 0 deletions oas
Submodule oas added at 346fd9
15 changes: 15 additions & 0 deletions openapi-generator-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"withSeparateModelsAndApi": true,
"apiPackage": "apis",
"modelPackage": "models",
"templateDir": "./templates",
"modelPropertyNaming": "original",
"ensureUniqueParams": true,
"generateAliasAsModel": true,
"additionalProperties": {
"useSingleRequestParameter": true,
"withInterfaces": true,
"supportsES6": true,
"paramNaming": "camelCase"
}
}
2 changes: 1 addition & 1 deletion openapitools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
"spaces": 2,
"generator-cli": {
"version": "6.6.0"
"version": "7.9.0"
}
}
36 changes: 20 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@neynar/nodejs-sdk",
"version": "1.67.0",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/)",
"version": "2.0.0-alpha.19",
"description": "SDK to interact with Neynar APIs (https://docs.neynar.com/reference/quickstart)",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"files": [
Expand All @@ -10,23 +10,27 @@
"scripts": {
"clean": "del-cli ./build/*",
"build": "yarn run clean && tsc",
"generate:neynar-oas-v1-farcaster": "del-cli src/neynar-api/v1/openapi; openapi-generator-cli generate -i src/oas/src/v1/spec.yaml -g typescript-axios -o src/neynar-api/v1/openapi --config src/oas/openapi-generator-config.json",
"generate:neynar-oas-v2-farcaster": "del-cli src/neynar-api/v2/openapi-farcaster; openapi-generator-cli generate -i src/oas/src/v2/spec.yaml -g typescript-axios -o src/neynar-api/v2/openapi-farcaster --config src/oas/openapi-generator-config.json",
"generate:neynar-oas-v2-stp": "del-cli src/neynar-api/v2/openapi-stp; openapi-generator-cli generate -i src/oas/src/v2/stp/spec.yaml -g typescript-axios -o src/neynar-api/v2/openapi-stp --config src/oas/openapi-generator-config.json"
"generate:api": "del-cli src/api && openapi-generator-cli generate -i ./oas/src/v2/spec.yaml -g typescript-axios -o ./src/api --config ./openapi-generator-config.json --inline-schema-options 'REFACTOR_ALLOF_INLINE_SCHEMAS=true'",
"generate:hub-api": "del-cli src/hub-api && openapi-generator-cli generate -i ./oas/src/hub-rest-api/spec.yaml -g typescript-axios -o ./src/hub-api --config ./openapi-generator-config.json --inline-schema-options 'REFACTOR_ALLOF_INLINE_SCHEMAS=true'",
"generate": "yarn generate:api && yarn generate:hub-api",
"generate:api:wrapper": "cross-env CLIENT_TYPE=api ts-node -P tsconfig.scripts.json scripts/generate-wrapper.ts",
"generate:hub-api:wrapper": "cross-env CLIENT_TYPE=hub-api ts-node -P tsconfig.scripts.json scripts/generate-wrapper.ts",
"generate:wrapper": "yarn generate:api:wrapper && yarn generate:hub-api:wrapper",
"generate:all": "yarn generate && yarn generate:wrapper"
},
"author": "Neynar",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.8.4",
"del-cli": "^5.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.2.2"
},
"dependencies": {
"@openapitools/openapi-generator-cli": "^2.7.0",
"axios": "^1.6.2",
"semver": "^7.6.0",
"viem": "^2.21.14"
"@openapitools/openapi-generator-cli": "^2.14.1",
"semver": "^7.6.3",
"viem": "^2.21.44"
},
"devDependencies": {
"@types/node": "^22.7.9",
"cross-env": "^7.0.3",
"del-cli": "^6.0.0",
"ts-node": "^10.9.2",
"typescript": "^5.6.3"
},
"engines": {
"node": ">=19.9.0"
Expand All @@ -38,4 +42,4 @@
"neynar",
"nodejs"
]
}
}
Loading

0 comments on commit 5e61d40

Please sign in to comment.