├── .devcontainer ├── Dockerfile └── devcontainer.json ├── .eslintrc.js ├── .github └── workflows │ ├── ci.yml │ ├── publish-npm.yml │ └── release-doctor.yml ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── .release-please-manifest.json ├── .stats.yml ├── Brewfile ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── SECURITY.md ├── api.md ├── bin ├── check-release-environment └── publish-npm ├── examples └── .keep ├── jest.config.ts ├── package.json ├── release-please-config.json ├── scripts ├── bootstrap ├── build ├── format ├── lint ├── mock ├── test └── utils │ ├── check-is-in-git-install.sh │ ├── check-version.cjs │ ├── fix-index-exports.cjs │ ├── git-swap.sh │ ├── make-dist-package-json.cjs │ └── postprocess-files.cjs ├── src ├── _shims │ ├── MultipartBody.ts │ ├── README.md │ ├── auto │ │ ├── runtime-bun.ts │ │ ├── runtime-deno.ts │ │ ├── runtime-node.ts │ │ ├── runtime.ts │ │ ├── types-deno.ts │ │ ├── types-node.ts │ │ ├── types.d.ts │ │ ├── types.js │ │ └── types.mjs │ ├── bun-runtime.ts │ ├── index-deno.ts │ ├── index.d.ts │ ├── index.js │ ├── index.mjs │ ├── manual-types.d.ts │ ├── manual-types.js │ ├── manual-types.mjs │ ├── node-runtime.ts │ ├── node-types.d.ts │ ├── node-types.js │ ├── node-types.mjs │ ├── registry.ts │ ├── web-runtime.ts │ ├── web-types.d.ts │ ├── web-types.js │ └── web-types.mjs ├── core.ts ├── error.ts ├── index.ts ├── lib │ └── .keep ├── resource.ts ├── resources │ ├── authentications.ts │ ├── cart │ │ ├── cart.ts │ │ ├── index.ts │ │ └── item.ts │ ├── chat-app │ │ ├── chat-app.ts │ │ ├── chats │ │ │ ├── c.ts │ │ │ ├── chats.ts │ │ │ ├── index.ts │ │ │ └── users.ts │ │ ├── index.ts │ │ └── messages.ts │ ├── chats │ │ ├── chats.ts │ │ ├── group.ts │ │ └── index.ts │ ├── ecommerce │ │ ├── addresses.ts │ │ ├── cart.ts │ │ ├── categories.ts │ │ ├── coupons │ │ │ ├── coupons.ts │ │ │ ├── customer-available.ts │ │ │ ├── index.ts │ │ │ └── status.ts │ │ ├── ecommerce.ts │ │ ├── index.ts │ │ ├── orders │ │ │ ├── admin.ts │ │ │ ├── index.ts │ │ │ ├── orders.ts │ │ │ ├── provider │ │ │ │ ├── index.ts │ │ │ │ ├── paypal.ts │ │ │ │ ├── provider.ts │ │ │ │ └── razorpay.ts │ │ │ └── status.ts │ │ └── profile │ │ │ ├── index.ts │ │ │ ├── my-orders.ts │ │ │ └── profile.ts │ ├── healthcheck.ts │ ├── index.ts │ ├── kitchen-sink │ │ ├── http-methods.ts │ │ ├── index.ts │ │ ├── kitchen-sink.ts │ │ ├── request │ │ │ ├── headers.ts │ │ │ ├── index.ts │ │ │ ├── ip.ts │ │ │ ├── path-variable.ts │ │ │ ├── query-parameter.ts │ │ │ ├── request.ts │ │ │ └── user-agent.ts │ │ ├── response │ │ │ ├── cache.ts │ │ │ ├── headers.ts │ │ │ ├── html.ts │ │ │ ├── index.ts │ │ │ ├── response.ts │ │ │ └── xml.ts │ │ └── status-codes.ts │ ├── kitchen-sinks │ │ ├── cookies.ts │ │ ├── index.ts │ │ └── kitchen-sinks.ts │ ├── messages.ts │ ├── products │ │ ├── category.ts │ │ ├── index.ts │ │ ├── products.ts │ │ └── subimage.ts │ ├── public │ │ ├── books.ts │ │ ├── cats │ │ │ ├── cat.ts │ │ │ ├── cats.ts │ │ │ └── index.ts │ │ ├── dogs │ │ │ ├── dog.ts │ │ │ ├── dogs.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── meals │ │ │ ├── index.ts │ │ │ ├── meal.ts │ │ │ └── meals.ts │ │ ├── public.ts │ │ ├── quotes.ts │ │ ├── random-jokes │ │ │ ├── index.ts │ │ │ ├── joke.ts │ │ │ └── random-jokes.ts │ │ ├── random-products │ │ │ ├── index.ts │ │ │ ├── product.ts │ │ │ └── random-products.ts │ │ ├── random-users │ │ │ ├── index.ts │ │ │ ├── random-users.ts │ │ │ └── user.ts │ │ ├── stocks.ts │ │ └── youtube │ │ │ ├── channel.ts │ │ │ ├── comments.ts │ │ │ ├── index.ts │ │ │ ├── playlists.ts │ │ │ ├── related.ts │ │ │ ├── videos.ts │ │ │ └── youtube.ts │ ├── reset-db.ts │ ├── seed │ │ ├── chat-app.ts │ │ ├── ecommerce.ts │ │ ├── generated-credentials.ts │ │ ├── index.ts │ │ ├── seed.ts │ │ ├── social-media.ts │ │ └── todos.ts │ ├── social-media │ │ ├── bookmarks.ts │ │ ├── comments.ts │ │ ├── follow │ │ │ ├── follow.ts │ │ │ ├── followers.ts │ │ │ ├── following.ts │ │ │ └── index.ts │ │ ├── index.ts │ │ ├── posts │ │ │ ├── images.ts │ │ │ ├── index.ts │ │ │ ├── my.ts │ │ │ ├── posts.ts │ │ │ ├── tag.ts │ │ │ └── user-posts.ts │ │ ├── profile │ │ │ ├── cover-image.ts │ │ │ ├── index.ts │ │ │ └── profile.ts │ │ └── social-media.ts │ ├── todos.ts │ └── users │ │ ├── avatar.ts │ │ ├── index.ts │ │ └── users.ts ├── shims │ ├── node.ts │ └── web.ts ├── uploads.ts └── version.ts ├── tests ├── api-resources │ ├── authentications.test.ts │ ├── cart │ │ ├── cart.test.ts │ │ └── item.test.ts │ ├── chat-app │ │ ├── chats │ │ │ ├── c.test.ts │ │ │ ├── chats.test.ts │ │ │ └── users.test.ts │ │ └── messages.test.ts │ ├── chats │ │ ├── chats.test.ts │ │ └── group.test.ts │ ├── ecommerce │ │ ├── addresses.test.ts │ │ ├── cart.test.ts │ │ ├── categories.test.ts │ │ ├── coupons │ │ │ ├── coupons.test.ts │ │ │ ├── customer-available.test.ts │ │ │ └── status.test.ts │ │ ├── orders │ │ │ ├── admin.test.ts │ │ │ ├── orders.test.ts │ │ │ ├── provider │ │ │ │ ├── paypal.test.ts │ │ │ │ └── razorpay.test.ts │ │ │ └── status.test.ts │ │ └── profile │ │ │ ├── my-orders.test.ts │ │ │ └── profile.test.ts │ ├── healthcheck.test.ts │ ├── kitchen-sink │ │ ├── http-methods.test.ts │ │ ├── request │ │ │ ├── headers.test.ts │ │ │ ├── ip.test.ts │ │ │ ├── path-variable.test.ts │ │ │ ├── query-parameter.test.ts │ │ │ └── user-agent.test.ts │ │ ├── response │ │ │ ├── cache.test.ts │ │ │ ├── headers.test.ts │ │ │ ├── html.test.ts │ │ │ └── xml.test.ts │ │ └── status-codes.test.ts │ ├── kitchen-sinks │ │ ├── cookies.test.ts │ │ └── kitchen-sinks.test.ts │ ├── messages.test.ts │ ├── products │ │ ├── category.test.ts │ │ ├── products.test.ts │ │ └── subimage.test.ts │ ├── public │ │ ├── books.test.ts │ │ ├── cats │ │ │ ├── cat.test.ts │ │ │ └── cats.test.ts │ │ ├── dogs │ │ │ ├── dog.test.ts │ │ │ └── dogs.test.ts │ │ ├── meals │ │ │ ├── meal.test.ts │ │ │ └── meals.test.ts │ │ ├── quotes.test.ts │ │ ├── random-jokes │ │ │ ├── joke.test.ts │ │ │ └── random-jokes.test.ts │ │ ├── random-products │ │ │ ├── product.test.ts │ │ │ └── random-products.test.ts │ │ ├── random-users │ │ │ ├── random-users.test.ts │ │ │ └── user.test.ts │ │ ├── stocks.test.ts │ │ └── youtube │ │ │ ├── channel.test.ts │ │ │ ├── comments.test.ts │ │ │ ├── playlists.test.ts │ │ │ ├── related.test.ts │ │ │ └── videos.test.ts │ ├── reset-db.test.ts │ ├── seed │ │ ├── chat-app.test.ts │ │ ├── ecommerce.test.ts │ │ ├── generated-credentials.test.ts │ │ ├── social-media.test.ts │ │ └── todos.test.ts │ ├── social-media │ │ ├── bookmarks.test.ts │ │ ├── comments.test.ts │ │ ├── follow │ │ │ ├── followers.test.ts │ │ │ └── following.test.ts │ │ ├── posts │ │ │ ├── images.test.ts │ │ │ ├── my.test.ts │ │ │ ├── posts.test.ts │ │ │ ├── tag.test.ts │ │ │ └── user-posts.test.ts │ │ └── profile │ │ │ ├── cover-image.test.ts │ │ │ └── profile.test.ts │ ├── todos.test.ts │ └── users │ │ ├── avatar.test.ts │ │ └── users.test.ts ├── form.test.ts ├── index.test.ts ├── responses.test.ts ├── stringifyQuery.test.ts └── uploads.test.ts ├── tsc-multi.json ├── tsconfig.build.json ├── tsconfig.deno.json ├── tsconfig.dist-src.json ├── tsconfig.json └── yarn.lock /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM debian:bookworm-slim AS stainless 3 | 4 | RUN apt-get update && apt-get install -y \ 5 | nodejs \ 6 | npm \ 7 | yarnpkg \ 8 | && apt-get clean autoclean 9 | 10 | # Ensure UTF-8 encoding 11 | ENV LANG=C.UTF-8 12 | ENV LC_ALL=C.UTF-8 13 | 14 | # Yarn 15 | RUN ln -sf /usr/bin/yarnpkg /usr/bin/yarn 16 | 17 | WORKDIR /workspace 18 | 19 | COPY package.json yarn.lock /workspace/ 20 | 21 | RUN yarn install 22 | 23 | COPY . /workspace 24 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the 2 | // README at: https://github.com/devcontainers/templates/tree/main/src/debian 3 | { 4 | "name": "Debian", 5 | "build": { 6 | "dockerfile": "Dockerfile" 7 | } 8 | 9 | // Features to add to the dev container. More info: https://containers.dev/features. 10 | // "features": {}, 11 | 12 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 13 | // "forwardPorts": [], 14 | 15 | // Configure tool-specific properties. 16 | // "customizations": {}, 17 | 18 | // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root. 19 | // "remoteUser": "root" 20 | } 21 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | parser: '@typescript-eslint/parser', 3 | plugins: ['@typescript-eslint', 'unused-imports', 'prettier'], 4 | rules: { 5 | 'no-unused-vars': 'off', 6 | 'prettier/prettier': 'error', 7 | 'unused-imports/no-unused-imports': 'error', 8 | }, 9 | root: true, 10 | }; 11 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | - next 10 | 11 | jobs: 12 | lint: 13 | name: lint 14 | runs-on: ubuntu-latest 15 | 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | 20 | - name: Set up Node 21 | uses: actions/setup-node@v4 22 | with: 23 | node-version: '18' 24 | 25 | - name: Bootstrap 26 | run: ./scripts/bootstrap 27 | 28 | - name: Check types 29 | run: ./scripts/lint 30 | 31 | build: 32 | name: build 33 | runs-on: ubuntu-latest 34 | 35 | 36 | steps: 37 | - uses: actions/checkout@v4 38 | 39 | - name: Set up Node 40 | uses: actions/setup-node@v4 41 | with: 42 | node-version: '18' 43 | 44 | - name: Bootstrap 45 | run: ./scripts/bootstrap 46 | 47 | - name: Check build 48 | run: ./scripts/build 49 | test: 50 | name: test 51 | runs-on: ubuntu-latest 52 | 53 | steps: 54 | - uses: actions/checkout@v4 55 | 56 | - name: Set up Node 57 | uses: actions/setup-node@v4 58 | with: 59 | node-version: '18' 60 | 61 | - name: Bootstrap 62 | run: ./scripts/bootstrap 63 | 64 | - name: Run tests 65 | run: ./scripts/test 66 | 67 | -------------------------------------------------------------------------------- /.github/workflows/publish-npm.yml: -------------------------------------------------------------------------------- 1 | # This workflow is triggered when a GitHub release is created. 2 | # It can also be run manually to re-publish to NPM in case it failed for some reason. 3 | # You can run this workflow by navigating to https://www.github.com/hiteshchoudhary/freeapi-nodesdk/actions/workflows/publish-npm.yml 4 | name: Publish NPM 5 | on: 6 | workflow_dispatch: 7 | 8 | release: 9 | types: [published] 10 | 11 | jobs: 12 | publish: 13 | name: publish 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | 19 | - name: Set up Node 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: '18' 23 | 24 | - name: Install dependencies 25 | run: | 26 | yarn install 27 | 28 | - name: Publish to NPM 29 | run: | 30 | bash ./bin/publish-npm 31 | env: 32 | NPM_TOKEN: ${{ secrets.FREEAPIAPP_NPM_TOKEN || secrets.NPM_TOKEN }} 33 | -------------------------------------------------------------------------------- /.github/workflows/release-doctor.yml: -------------------------------------------------------------------------------- 1 | name: Release Doctor 2 | on: 3 | pull_request: 4 | branches: 5 | - main 6 | workflow_dispatch: 7 | 8 | jobs: 9 | release_doctor: 10 | name: release doctor 11 | runs-on: ubuntu-latest 12 | if: github.repository == 'hiteshchoudhary/freeapi-nodesdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') 13 | 14 | steps: 15 | - uses: actions/checkout@v4 16 | 17 | - name: Check release environment 18 | run: | 19 | bash ./bin/check-release-environment 20 | env: 21 | NPM_TOKEN: ${{ secrets.FREEAPIAPP_NPM_TOKEN || secrets.NPM_TOKEN }} 22 | 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .prism.log 2 | node_modules 3 | yarn-error.log 4 | codegen.log 5 | Brewfile.lock.json 6 | dist 7 | dist-deno 8 | /*.tgz 9 | .idea/ 10 | 11 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | CHANGELOG.md 2 | /ecosystem-tests/*/** 3 | /node_modules 4 | /deno 5 | 6 | # don't format tsc output, will break source maps 7 | /dist 8 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "arrowParens": "always", 3 | "experimentalTernaries": true, 4 | "printWidth": 110, 5 | "singleQuote": true, 6 | "trailingComma": "all" 7 | } 8 | -------------------------------------------------------------------------------- /.release-please-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | ".": "0.1.0-alpha.1" 3 | } 4 | -------------------------------------------------------------------------------- /.stats.yml: -------------------------------------------------------------------------------- 1 | configured_endpoints: 166 2 | openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/hiteshchoudhary-ssesph%2Ffreeapiapp-a9f3a290e4dc07d70270ba92440e0cace3c7015b2089349eba66608e8af6bbbf.yml 3 | -------------------------------------------------------------------------------- /Brewfile: -------------------------------------------------------------------------------- 1 | brew "node" 2 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 0.1.0-alpha.1 (2024-11-28) 4 | 5 | Full Changelog: [v0.0.1-alpha.1...v0.1.0-alpha.1](https://github.com/hiteshchoudhary/freeapi-nodesdk/compare/v0.0.1-alpha.1...v0.1.0-alpha.1) 6 | 7 | ### Features 8 | 9 | * **internal:** make git install file structure match npm ([#13](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/13)) ([4e74778](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/4e74778c22418f377b7b82fbc5886c2a63225c16)) 10 | 11 | 12 | ### Chores 13 | 14 | * **internal:** codegen related update ([#12](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/12)) ([c9cb6c6](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/c9cb6c6055176dec21885a7412eca508edceb119)) 15 | * rebuild project due to codegen change ([#10](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/10)) ([94c23ce](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/94c23cea24ebbd64d6e336b79c39ca111d77cea2)) 16 | * rebuild project due to codegen change ([#11](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/11)) ([ad8f6ab](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/ad8f6ab8db24eedc7bb7442a7c1d4cc2b146ba55)) 17 | * rebuild project due to codegen change ([#5](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/5)) ([65b053a](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/65b053a0e0abb4406d6021a2bd9b884ecd6a874b)) 18 | * rebuild project due to codegen change ([#7](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/7)) ([9b1ccc8](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/9b1ccc83cfaa7534705d4209ac5c97db6b929562)) 19 | * rebuild project due to codegen change ([#8](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/8)) ([a91edf2](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/a91edf2918df7929155ce6bcec6401167a30229d)) 20 | * rebuild project due to codegen change ([#9](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/9)) ([f3630e1](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/f3630e132f562ffd74404a0f411bb66328bab536)) 21 | 22 | ## 0.0.1-alpha.1 (2024-10-29) 23 | 24 | Full Changelog: [v0.0.1-alpha.0...v0.0.1-alpha.1](https://github.com/hiteshchoudhary/freeapi-nodesdk/compare/v0.0.1-alpha.0...v0.0.1-alpha.1) 25 | 26 | ### Chores 27 | 28 | * go live ([#1](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/1)) ([67249ab](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/67249abb58a775e9cb79b04881b46aee95cb66b0)) 29 | * update SDK settings ([#3](https://github.com/hiteshchoudhary/freeapi-nodesdk/issues/3)) ([64804a4](https://github.com/hiteshchoudhary/freeapi-nodesdk/commit/64804a4c4bdd8d6dce55fa595b662ff249df7e66)) 30 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting Security Issues 4 | 5 | This SDK is generated by [Stainless Software Inc](http://stainlessapi.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. 6 | 7 | To report a security issue, please contact the Stainless team at security@stainlessapi.com. 8 | 9 | ## Responsible Disclosure 10 | 11 | We appreciate the efforts of security researchers and individuals who help us maintain the security of 12 | SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible 13 | disclosure practices by allowing us a reasonable amount of time to investigate and address the issue 14 | before making any information public. 15 | 16 | ## Reporting Non-SDK Related Security Issues 17 | 18 | If you encounter security issues that are not directly related to SDKs but pertain to the services 19 | or products provided by Freeapiapp please follow the respective company's security reporting guidelines. 20 | 21 | ### Freeapiapp Terms and Policies 22 | 23 | Please contact dev-feedback@freeapiapp.com for any questions or concerns regarding security of our services. 24 | 25 | --- 26 | 27 | Thank you for helping us keep the SDKs and systems they interact with secure. 28 | -------------------------------------------------------------------------------- /bin/check-release-environment: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | errors=() 4 | 5 | if [ -z "${NPM_TOKEN}" ]; then 6 | errors+=("The FREEAPIAPP_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets") 7 | fi 8 | 9 | lenErrors=${#errors[@]} 10 | 11 | if [[ lenErrors -gt 0 ]]; then 12 | echo -e "Found the following errors in the release environment:\n" 13 | 14 | for error in "${errors[@]}"; do 15 | echo -e "- $error\n" 16 | done 17 | 18 | exit 1 19 | fi 20 | 21 | echo "The environment is ready to push releases!" 22 | 23 | -------------------------------------------------------------------------------- /bin/publish-npm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -eux 4 | 5 | npm config set '//registry.npmjs.org/:_authToken' "$NPM_TOKEN" 6 | 7 | # Build the project 8 | yarn build 9 | 10 | # Navigate to the dist directory 11 | cd dist 12 | 13 | # Get the version from package.json 14 | VERSION="$(node -p "require('./package.json').version")" 15 | 16 | # Extract the pre-release tag if it exists 17 | if [[ "$VERSION" =~ -([a-zA-Z]+) ]]; then 18 | # Extract the part before any dot in the pre-release identifier 19 | TAG="${BASH_REMATCH[1]}" 20 | else 21 | TAG="latest" 22 | fi 23 | 24 | # Publish with the appropriate tag 25 | yarn publish --access public --tag "$TAG" 26 | -------------------------------------------------------------------------------- /examples/.keep: -------------------------------------------------------------------------------- 1 | File generated from our OpenAPI spec by Stainless. 2 | 3 | This directory can be used to store example files demonstrating usage of this SDK. 4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. 5 | -------------------------------------------------------------------------------- /jest.config.ts: -------------------------------------------------------------------------------- 1 | import type { JestConfigWithTsJest } from 'ts-jest'; 2 | 3 | const config: JestConfigWithTsJest = { 4 | preset: 'ts-jest/presets/default-esm', 5 | testEnvironment: 'node', 6 | transform: { 7 | '^.+\\.(t|j)sx?$': ['@swc/jest', { sourceMaps: 'inline' }], 8 | }, 9 | moduleNameMapper: { 10 | '^freeapiapp$': '/src/index.ts', 11 | '^freeapiapp/_shims/auto/(.*)$': '/src/_shims/auto/$1-node', 12 | '^freeapiapp/(.*)$': '/src/$1', 13 | }, 14 | modulePathIgnorePatterns: [ 15 | '/ecosystem-tests/', 16 | '/dist/', 17 | '/deno/', 18 | '/deno_tests/', 19 | ], 20 | testPathIgnorePatterns: ['scripts'], 21 | }; 22 | 23 | export default config; 24 | -------------------------------------------------------------------------------- /release-please-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "packages": { 3 | ".": {} 4 | }, 5 | "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", 6 | "include-v-in-tag": true, 7 | "include-component-in-tag": false, 8 | "versioning": "prerelease", 9 | "prerelease": true, 10 | "bump-minor-pre-major": true, 11 | "bump-patch-for-minor-pre-major": false, 12 | "pull-request-header": "Automated Release PR", 13 | "pull-request-title-pattern": "release: ${version}", 14 | "changelog-sections": [ 15 | { 16 | "type": "feat", 17 | "section": "Features" 18 | }, 19 | { 20 | "type": "fix", 21 | "section": "Bug Fixes" 22 | }, 23 | { 24 | "type": "perf", 25 | "section": "Performance Improvements" 26 | }, 27 | { 28 | "type": "revert", 29 | "section": "Reverts" 30 | }, 31 | { 32 | "type": "chore", 33 | "section": "Chores" 34 | }, 35 | { 36 | "type": "docs", 37 | "section": "Documentation" 38 | }, 39 | { 40 | "type": "style", 41 | "section": "Styles" 42 | }, 43 | { 44 | "type": "refactor", 45 | "section": "Refactors" 46 | }, 47 | { 48 | "type": "test", 49 | "section": "Tests", 50 | "hidden": true 51 | }, 52 | { 53 | "type": "build", 54 | "section": "Build System" 55 | }, 56 | { 57 | "type": "ci", 58 | "section": "Continuous Integration", 59 | "hidden": true 60 | } 61 | ], 62 | "release-type": "node", 63 | "extra-files": [ 64 | "src/version.ts", 65 | "README.md" 66 | ] 67 | } 68 | -------------------------------------------------------------------------------- /scripts/bootstrap: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ]; then 8 | brew bundle check >/dev/null 2>&1 || { 9 | echo "==> Installing Homebrew dependencies…" 10 | brew bundle 11 | } 12 | fi 13 | 14 | echo "==> Installing Node dependencies…" 15 | 16 | PACKAGE_MANAGER=$(command -v yarn >/dev/null 2>&1 && echo "yarn" || echo "npm") 17 | 18 | $PACKAGE_MANAGER install 19 | -------------------------------------------------------------------------------- /scripts/build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -exuo pipefail 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | node scripts/utils/check-version.cjs 8 | 9 | # Build into dist and will publish the package from there, 10 | # so that src/resources/foo.ts becomes /resources/foo.js 11 | # This way importing from `"freeapiapp/resources/foo"` works 12 | # even with `"moduleResolution": "node"` 13 | 14 | rm -rf dist; mkdir dist 15 | # Copy src to dist/src and build from dist/src into dist, so that 16 | # the source map for index.js.map will refer to ./src/index.ts etc 17 | cp -rp src README.md dist 18 | rm dist/src/_shims/*-deno.ts dist/src/_shims/auto/*-deno.ts 19 | for file in LICENSE CHANGELOG.md; do 20 | if [ -e "${file}" ]; then cp "${file}" dist; fi 21 | done 22 | if [ -e "bin/cli" ]; then 23 | mkdir dist/bin 24 | cp -p "bin/cli" dist/bin/; 25 | fi 26 | # this converts the export map paths for the dist directory 27 | # and does a few other minor things 28 | node scripts/utils/make-dist-package-json.cjs > dist/package.json 29 | 30 | # build to .js/.mjs/.d.ts files 31 | npm exec tsc-multi 32 | # copy over handwritten .js/.mjs/.d.ts files 33 | cp src/_shims/*.{d.ts,js,mjs,md} dist/_shims 34 | cp src/_shims/auto/*.{d.ts,js,mjs} dist/_shims/auto 35 | # we need to add exports = module.exports = Freeapiapp to index.js; 36 | # No way to get that from index.ts because it would cause compile errors 37 | # when building .mjs 38 | node scripts/utils/fix-index-exports.cjs 39 | # with "moduleResolution": "nodenext", if ESM resolves to index.d.ts, 40 | # it'll have TS errors on the default import. But if it resolves to 41 | # index.d.mts the default import will work (even though both files have 42 | # the same export default statement) 43 | cp dist/index.d.ts dist/index.d.mts 44 | cp tsconfig.dist-src.json dist/src/tsconfig.json 45 | 46 | node scripts/utils/postprocess-files.cjs 47 | 48 | # make sure that nothing crashes when we require the output CJS or 49 | # import the output ESM 50 | (cd dist && node -e 'require("freeapiapp")') 51 | (cd dist && node -e 'import("freeapiapp")' --input-type=module) 52 | 53 | if [ -e ./scripts/build-deno ] 54 | then 55 | ./scripts/build-deno 56 | fi 57 | -------------------------------------------------------------------------------- /scripts/format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | echo "==> Running eslint --fix" 8 | ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --fix --ext ts,js . 9 | -------------------------------------------------------------------------------- /scripts/lint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | echo "==> Running eslint" 8 | ESLINT_USE_FLAT_CONFIG="false" ./node_modules/.bin/eslint --ext ts,js . 9 | 10 | echo "==> Running tsc" 11 | ./node_modules/.bin/tsc --noEmit 12 | -------------------------------------------------------------------------------- /scripts/mock: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | if [[ -n "$1" && "$1" != '--'* ]]; then 8 | URL="$1" 9 | shift 10 | else 11 | URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" 12 | fi 13 | 14 | # Check if the URL is empty 15 | if [ -z "$URL" ]; then 16 | echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" 17 | exit 1 18 | fi 19 | 20 | echo "==> Starting mock server with URL ${URL}" 21 | 22 | # Run prism mock on the given spec 23 | if [ "$1" == "--daemon" ]; then 24 | npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" &> .prism.log & 25 | 26 | # Wait for server to come online 27 | echo -n "Waiting for server" 28 | while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do 29 | echo -n "." 30 | sleep 0.1 31 | done 32 | 33 | if grep -q "✖ fatal" ".prism.log"; then 34 | cat .prism.log 35 | exit 1 36 | fi 37 | 38 | echo 39 | else 40 | npm exec --package=@stainless-api/prism-cli@5.8.5 -- prism mock "$URL" 41 | fi 42 | -------------------------------------------------------------------------------- /scripts/test: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | cd "$(dirname "$0")/.." 6 | 7 | RED='\033[0;31m' 8 | GREEN='\033[0;32m' 9 | YELLOW='\033[0;33m' 10 | NC='\033[0m' # No Color 11 | 12 | function prism_is_running() { 13 | curl --silent "http://localhost:4010" >/dev/null 2>&1 14 | } 15 | 16 | kill_server_on_port() { 17 | pids=$(lsof -t -i tcp:"$1" || echo "") 18 | if [ "$pids" != "" ]; then 19 | kill "$pids" 20 | echo "Stopped $pids." 21 | fi 22 | } 23 | 24 | function is_overriding_api_base_url() { 25 | [ -n "$TEST_API_BASE_URL" ] 26 | } 27 | 28 | if ! is_overriding_api_base_url && ! prism_is_running ; then 29 | # When we exit this script, make sure to kill the background mock server process 30 | trap 'kill_server_on_port 4010' EXIT 31 | 32 | # Start the dev server 33 | ./scripts/mock --daemon 34 | fi 35 | 36 | if is_overriding_api_base_url ; then 37 | echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" 38 | echo 39 | elif ! prism_is_running ; then 40 | echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" 41 | echo -e "running against your OpenAPI spec." 42 | echo 43 | echo -e "To run the server, pass in the path or url of your OpenAPI" 44 | echo -e "spec to the prism command:" 45 | echo 46 | echo -e " \$ ${YELLOW}npm exec --package=@stoplight/prism-cli@~5.3.2 -- prism mock path/to/your.openapi.yml${NC}" 47 | echo 48 | 49 | exit 1 50 | else 51 | echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" 52 | echo 53 | fi 54 | 55 | echo "==> Running tests" 56 | ./node_modules/.bin/jest "$@" 57 | -------------------------------------------------------------------------------- /scripts/utils/check-is-in-git-install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # Check if you happen to call prepare for a repository that's already in node_modules. 3 | [ "$(basename "$(dirname "$PWD")")" = 'node_modules' ] || 4 | # The name of the containing directory that 'npm` uses, which looks like 5 | # $HOME/.npm/_cacache/git-cloneXXXXXX 6 | [ "$(basename "$(dirname "$PWD")")" = 'tmp' ] || 7 | # The name of the containing directory that 'yarn` uses, which looks like 8 | # $(yarn cache dir)/.tmp/XXXXX 9 | [ "$(basename "$(dirname "$PWD")")" = '.tmp' ] 10 | -------------------------------------------------------------------------------- /scripts/utils/check-version.cjs: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | const main = () => { 5 | const pkg = require('../../package.json'); 6 | const version = pkg['version']; 7 | if (!version) throw 'The version property is not set in the package.json file'; 8 | if (typeof version !== 'string') { 9 | throw `Unexpected type for the package.json version field; got ${typeof version}, expected string`; 10 | } 11 | 12 | const versionFile = path.resolve(__dirname, '..', '..', 'src', 'version.ts'); 13 | const contents = fs.readFileSync(versionFile, 'utf8'); 14 | const output = contents.replace(/(export const VERSION = ')(.*)(')/g, `$1${version}$3`); 15 | fs.writeFileSync(versionFile, output); 16 | }; 17 | 18 | if (require.main === module) { 19 | main(); 20 | } 21 | -------------------------------------------------------------------------------- /scripts/utils/fix-index-exports.cjs: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | 4 | const indexJs = 5 | process.env['DIST_PATH'] ? 6 | path.resolve(process.env['DIST_PATH'], 'index.js') 7 | : path.resolve(__dirname, '..', '..', 'dist', 'index.js'); 8 | 9 | let before = fs.readFileSync(indexJs, 'utf8'); 10 | let after = before.replace( 11 | /^\s*exports\.default\s*=\s*(\w+)/m, 12 | 'exports = module.exports = $1;\nexports.default = $1', 13 | ); 14 | fs.writeFileSync(indexJs, after, 'utf8'); 15 | -------------------------------------------------------------------------------- /scripts/utils/git-swap.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -exuo pipefail 3 | # the package is published to NPM from ./dist 4 | # we want the final file structure for git installs to match the npm installs, so we 5 | 6 | # delete everything except ./dist and ./node_modules 7 | find . -maxdepth 1 -mindepth 1 ! -name 'dist' ! -name 'node_modules' -exec rm -rf '{}' + 8 | 9 | # move everything from ./dist to . 10 | mv dist/* . 11 | 12 | # delete the now-empty ./dist 13 | rmdir dist 14 | -------------------------------------------------------------------------------- /scripts/utils/make-dist-package-json.cjs: -------------------------------------------------------------------------------- 1 | const pkgJson = require(process.env['PKG_JSON_PATH'] || '../../package.json'); 2 | 3 | function processExportMap(m) { 4 | for (const key in m) { 5 | const value = m[key]; 6 | if (typeof value === 'string') m[key] = value.replace(/^\.\/dist\//, './'); 7 | else processExportMap(value); 8 | } 9 | } 10 | processExportMap(pkgJson.exports); 11 | 12 | for (const key of ['types', 'main', 'module']) { 13 | if (typeof pkgJson[key] === 'string') pkgJson[key] = pkgJson[key].replace(/^(\.\/)?dist\//, './'); 14 | } 15 | 16 | delete pkgJson.devDependencies; 17 | delete pkgJson.scripts.prepack; 18 | delete pkgJson.scripts.prepublishOnly; 19 | delete pkgJson.scripts.prepare; 20 | 21 | console.log(JSON.stringify(pkgJson, null, 2)); 22 | -------------------------------------------------------------------------------- /src/_shims/MultipartBody.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export class MultipartBody { 5 | constructor(public body: any) {} 6 | get [Symbol.toStringTag](): string { 7 | return 'MultipartBody'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime-bun.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../bun-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime-deno.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../web-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime-node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../node-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/runtime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../web-runtime'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/types-deno.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../web-types'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/types-node.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export * from '../node-types'; 5 | -------------------------------------------------------------------------------- /src/_shims/auto/types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/auto/types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/bun-runtime.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import { type Shims } from './registry'; 5 | import { getRuntime as getWebRuntime } from './web-runtime'; 6 | import { ReadStream as FsReadStream } from 'node:fs'; 7 | 8 | export function getRuntime(): Shims { 9 | const runtime = getWebRuntime(); 10 | function isFsReadStream(value: any): value is FsReadStream { 11 | return value instanceof FsReadStream; 12 | } 13 | return { ...runtime, isFsReadStream }; 14 | } 15 | -------------------------------------------------------------------------------- /src/_shims/index.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | const shims = require('./registry'); 5 | const auto = require('freeapiapp/_shims/auto/runtime'); 6 | if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); 7 | for (const property of Object.keys(shims)) { 8 | Object.defineProperty(exports, property, { 9 | get() { 10 | return shims[property]; 11 | }, 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /src/_shims/index.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import * as shims from './registry.mjs'; 5 | import * as auto from 'freeapiapp/_shims/auto/runtime'; 6 | if (!shims.kind) shims.setShims(auto.getRuntime(), { auto: true }); 7 | export * from './registry.mjs'; 8 | -------------------------------------------------------------------------------- /src/_shims/manual-types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | /** 5 | * Types will get added to this namespace when you import one of the following: 6 | * 7 | * import 'freeapiapp/shims/node' 8 | * import 'freeapiapp/shims/web' 9 | * 10 | * Importing more than one will cause type and runtime errors. 11 | */ 12 | export namespace manual {} 13 | -------------------------------------------------------------------------------- /src/_shims/manual-types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/manual-types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/node-types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | import * as nf from 'node-fetch'; 5 | import * as fd from 'formdata-node'; 6 | 7 | export { type Agent } from 'node:http'; 8 | export { type Readable } from 'node:stream'; 9 | export { type ReadStream as FsReadStream } from 'node:fs'; 10 | export { ReadableStream } from 'node:stream/web'; 11 | 12 | export const fetch: typeof nf.default; 13 | 14 | export type Request = nf.Request; 15 | export type RequestInfo = nf.RequestInfo; 16 | export type RequestInit = nf.RequestInit; 17 | 18 | export type Response = nf.Response; 19 | export type ResponseInit = nf.ResponseInit; 20 | export type ResponseType = nf.ResponseType; 21 | export type BodyInit = nf.BodyInit; 22 | export type Headers = nf.Headers; 23 | export type HeadersInit = nf.HeadersInit; 24 | 25 | type EndingType = 'native' | 'transparent'; 26 | export interface BlobPropertyBag { 27 | endings?: EndingType; 28 | type?: string; 29 | } 30 | 31 | export interface FilePropertyBag extends BlobPropertyBag { 32 | lastModified?: number; 33 | } 34 | 35 | export type FileFromPathOptions = Omit; 36 | 37 | export type FormData = fd.FormData; 38 | export const FormData: typeof fd.FormData; 39 | export type File = fd.File; 40 | export const File: typeof fd.File; 41 | export type Blob = fd.Blob; 42 | export const Blob: typeof fd.Blob; 43 | -------------------------------------------------------------------------------- /src/_shims/node-types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/node-types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/web-types.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | export type Agent = any; 5 | 6 | declare const _fetch: typeof fetch; 7 | export { _fetch as fetch }; 8 | 9 | type _Request = Request; 10 | export { _Request as Request }; 11 | 12 | type _RequestInfo = RequestInfo; 13 | export { type _RequestInfo as RequestInfo }; 14 | 15 | type _RequestInit = RequestInit; 16 | export { type _RequestInit as RequestInit }; 17 | 18 | type _Response = Response; 19 | export { _Response as Response }; 20 | 21 | type _ResponseInit = ResponseInit; 22 | export { type _ResponseInit as ResponseInit }; 23 | 24 | type _ResponseType = ResponseType; 25 | export { type _ResponseType as ResponseType }; 26 | 27 | type _BodyInit = BodyInit; 28 | export { type _BodyInit as BodyInit }; 29 | 30 | type _Headers = Headers; 31 | export { _Headers as Headers }; 32 | 33 | type _HeadersInit = HeadersInit; 34 | export { type _HeadersInit as HeadersInit }; 35 | 36 | type EndingType = 'native' | 'transparent'; 37 | 38 | export interface BlobPropertyBag { 39 | endings?: EndingType; 40 | type?: string; 41 | } 42 | 43 | export interface FilePropertyBag extends BlobPropertyBag { 44 | lastModified?: number; 45 | } 46 | 47 | export type FileFromPathOptions = Omit; 48 | 49 | type _FormData = FormData; 50 | declare const _FormData: typeof FormData; 51 | export { _FormData as FormData }; 52 | 53 | type _File = File; 54 | declare const _File: typeof File; 55 | export { _File as File }; 56 | 57 | type _Blob = Blob; 58 | declare const _Blob: typeof Blob; 59 | export { _Blob as Blob }; 60 | 61 | export declare class Readable { 62 | readable: boolean; 63 | readonly readableEnded: boolean; 64 | readonly readableFlowing: boolean | null; 65 | readonly readableHighWaterMark: number; 66 | readonly readableLength: number; 67 | readonly readableObjectMode: boolean; 68 | destroyed: boolean; 69 | read(size?: number): any; 70 | pause(): this; 71 | resume(): this; 72 | isPaused(): boolean; 73 | destroy(error?: Error): this; 74 | [Symbol.asyncIterator](): AsyncIterableIterator; 75 | } 76 | 77 | export declare class FsReadStream extends Readable { 78 | path: {}; // node type is string | Buffer 79 | } 80 | 81 | type _ReadableStream = ReadableStream; 82 | declare const _ReadableStream: typeof ReadableStream; 83 | export { _ReadableStream as ReadableStream }; 84 | -------------------------------------------------------------------------------- /src/_shims/web-types.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/_shims/web-types.mjs: -------------------------------------------------------------------------------- 1 | /** 2 | * Disclaimer: modules in _shims aren't intended to be imported by SDK users. 3 | */ 4 | -------------------------------------------------------------------------------- /src/lib/.keep: -------------------------------------------------------------------------------- 1 | File generated from our OpenAPI spec by Stainless. 2 | 3 | This directory can be used to store custom files to expand the SDK. 4 | It is ignored by Stainless code generation and its content (other than this keep file) won't be touched. 5 | -------------------------------------------------------------------------------- /src/resource.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import type { Freeapiapp } from './index'; 4 | 5 | export class APIResource { 6 | protected _client: Freeapiapp; 7 | 8 | constructor(client: Freeapiapp) { 9 | this._client = client; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/resources/cart/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Cart, type CartRetrieveResponse } from './cart'; 4 | export { Item, type ItemCreateResponse, type ItemDeleteResponse, type ItemCreateParams } from './item'; 5 | -------------------------------------------------------------------------------- /src/resources/chat-app/chat-app.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as MessagesAPI from './messages'; 5 | import { MessageDeleteResponse, Messages } from './messages'; 6 | import * as ChatsAPI from './chats/chats'; 7 | import { ChatListResponse, Chats } from './chats/chats'; 8 | 9 | export class ChatApp extends APIResource { 10 | chats: ChatsAPI.Chats = new ChatsAPI.Chats(this._client); 11 | messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client); 12 | } 13 | 14 | ChatApp.Chats = Chats; 15 | ChatApp.Messages = Messages; 16 | 17 | export declare namespace ChatApp { 18 | export { Chats as Chats, type ChatListResponse as ChatListResponse }; 19 | 20 | export { Messages as Messages, type MessageDeleteResponse as MessageDeleteResponse }; 21 | } 22 | -------------------------------------------------------------------------------- /src/resources/chat-app/chats/c.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class C extends APIResource { 7 | /** 8 | * This API endpoint enables a logged-in user to initiate a personalized one-on-one 9 | * chat interaction with another user. 10 | * 11 | * By providing correct `receiverId`, the API facilitates the creation of a private 12 | * chat environment where participants can engage in direct and focused 13 | * conversations. 14 | */ 15 | create(receiverId: string, options?: Core.RequestOptions): Core.APIPromise { 16 | return this._client.post(`/chat-app/chats/c/${receiverId}`, options); 17 | } 18 | } 19 | 20 | export interface CCreateResponse { 21 | data?: CCreateResponse.Data; 22 | 23 | message?: string; 24 | 25 | statusCode?: number; 26 | 27 | success?: boolean; 28 | } 29 | 30 | export namespace CCreateResponse { 31 | export interface Data { 32 | __v?: number; 33 | 34 | _id?: string; 35 | 36 | admin?: string; 37 | 38 | createdAt?: string; 39 | 40 | isGroupChat?: boolean; 41 | 42 | name?: string; 43 | 44 | participants?: Array; 45 | 46 | updatedAt?: string; 47 | } 48 | 49 | export namespace Data { 50 | export interface Participant { 51 | __v?: number; 52 | 53 | _id?: string; 54 | 55 | avatar?: Participant.Avatar; 56 | 57 | createdAt?: string; 58 | 59 | email?: string; 60 | 61 | isEmailVerified?: boolean; 62 | 63 | loginType?: string; 64 | 65 | role?: string; 66 | 67 | updatedAt?: string; 68 | 69 | username?: string; 70 | } 71 | 72 | export namespace Participant { 73 | export interface Avatar { 74 | _id?: string; 75 | 76 | localPath?: string; 77 | 78 | url?: string; 79 | } 80 | } 81 | } 82 | } 83 | 84 | export declare namespace C { 85 | export { type CCreateResponse as CCreateResponse }; 86 | } 87 | -------------------------------------------------------------------------------- /src/resources/chat-app/chats/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { C, type CCreateResponse } from './c'; 4 | export { Chats, type ChatListResponse } from './chats'; 5 | export { Users, type UserListResponse } from './users'; 6 | -------------------------------------------------------------------------------- /src/resources/chat-app/chats/users.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Users extends APIResource { 7 | /** 8 | * This API endpoint enables developers to retrieve a list of users who are 9 | * available for chat interactions. 10 | * 11 | * The endpoint facilitates the identification of potential chat partners or group 12 | * members for the logged-in user. 13 | * 14 | * It provides a seamless way to explore and initiate conversations, fostering a 15 | * dynamic and engaging chat environment within the application. 16 | */ 17 | list(options?: Core.RequestOptions): Core.APIPromise { 18 | return this._client.get('/chat-app/chats/users', options); 19 | } 20 | } 21 | 22 | export interface UserListResponse { 23 | data?: Array; 24 | 25 | message?: string; 26 | 27 | statusCode?: number; 28 | 29 | success?: boolean; 30 | } 31 | 32 | export namespace UserListResponse { 33 | export interface Data { 34 | __v?: number; 35 | 36 | _id?: string; 37 | 38 | avatar?: Data.Avatar; 39 | 40 | createdAt?: string; 41 | 42 | email?: string; 43 | 44 | isEmailVerified?: boolean; 45 | 46 | loginType?: string; 47 | 48 | password?: string; 49 | 50 | role?: string; 51 | 52 | updatedAt?: string; 53 | 54 | username?: string; 55 | } 56 | 57 | export namespace Data { 58 | export interface Avatar { 59 | _id?: string; 60 | 61 | localPath?: string; 62 | 63 | url?: string; 64 | } 65 | } 66 | } 67 | 68 | export declare namespace Users { 69 | export { type UserListResponse as UserListResponse }; 70 | } 71 | -------------------------------------------------------------------------------- /src/resources/chat-app/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { ChatApp } from './chat-app'; 4 | export { Chats, type ChatListResponse } from './chats/index'; 5 | export { Messages, type MessageDeleteResponse } from './messages'; 6 | -------------------------------------------------------------------------------- /src/resources/chat-app/messages.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class Messages extends APIResource { 7 | /** 8 | * This API endpoint empowers logged-in users to seamlessly delete a message in the 9 | * chat that is sent by them. 10 | * 11 | * By sending a `DELETE` request to this endpoint with the relevant `chatId` and 12 | * `messageId`, users can effectively remove the specified message, thereby 13 | * enhancing their control over their chat interactions and facilitating a 14 | * streamlined and personalized messaging experience. 15 | */ 16 | delete( 17 | chatId: string, 18 | messageId: string, 19 | options?: Core.RequestOptions, 20 | ): Core.APIPromise { 21 | return this._client.delete(`/chat-app/messages/${chatId}/${messageId}`, options); 22 | } 23 | } 24 | 25 | export interface MessageDeleteResponse { 26 | data?: MessageDeleteResponse.Data; 27 | 28 | message?: string; 29 | 30 | statusCode?: number; 31 | 32 | success?: boolean; 33 | } 34 | 35 | export namespace MessageDeleteResponse { 36 | export interface Data { 37 | _id?: string; 38 | } 39 | } 40 | 41 | export declare namespace Messages { 42 | export { type MessageDeleteResponse as MessageDeleteResponse }; 43 | } 44 | -------------------------------------------------------------------------------- /src/resources/chats/chats.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | import * as GroupAPI from './group'; 6 | import { 7 | Group, 8 | GroupCreateParams, 9 | GroupCreateResponse, 10 | GroupDeleteResponse, 11 | GroupLeaveResponse, 12 | GroupParticipantAddResponse, 13 | GroupParticipantRemoveResponse, 14 | GroupRetrieveResponse, 15 | GroupUpdateParams, 16 | GroupUpdateResponse, 17 | } from './group'; 18 | 19 | export class Chats extends APIResource { 20 | group: GroupAPI.Group = new GroupAPI.Group(this._client); 21 | 22 | /** 23 | * This API endpoint empowers logged-in users to seamlessly delete a one-on-one 24 | * chat conversation in which they are a participant. 25 | * 26 | * By sending a `DELETE` request to this endpoint with the relevant `chatId`, users 27 | * can effectively remove the specified one-on-one chat, thereby enhancing their 28 | * control over their chat interactions and facilitating a streamlined and 29 | * personalized messaging experience. 30 | */ 31 | remove(chatId: string, options?: Core.RequestOptions): Core.APIPromise { 32 | return this._client.delete(`/chat-app/chats/remove/${chatId}`, options); 33 | } 34 | } 35 | 36 | export interface ChatRemoveResponse { 37 | data?: unknown; 38 | 39 | message?: string; 40 | 41 | statusCode?: number; 42 | 43 | success?: boolean; 44 | } 45 | 46 | Chats.Group = Group; 47 | 48 | export declare namespace Chats { 49 | export { type ChatRemoveResponse as ChatRemoveResponse }; 50 | 51 | export { 52 | Group as Group, 53 | type GroupCreateResponse as GroupCreateResponse, 54 | type GroupRetrieveResponse as GroupRetrieveResponse, 55 | type GroupUpdateResponse as GroupUpdateResponse, 56 | type GroupDeleteResponse as GroupDeleteResponse, 57 | type GroupLeaveResponse as GroupLeaveResponse, 58 | type GroupParticipantAddResponse as GroupParticipantAddResponse, 59 | type GroupParticipantRemoveResponse as GroupParticipantRemoveResponse, 60 | type GroupCreateParams as GroupCreateParams, 61 | type GroupUpdateParams as GroupUpdateParams, 62 | }; 63 | } 64 | -------------------------------------------------------------------------------- /src/resources/chats/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Chats, type ChatRemoveResponse } from './chats'; 4 | export { 5 | Group, 6 | type GroupCreateResponse, 7 | type GroupRetrieveResponse, 8 | type GroupUpdateResponse, 9 | type GroupDeleteResponse, 10 | type GroupLeaveResponse, 11 | type GroupParticipantAddResponse, 12 | type GroupParticipantRemoveResponse, 13 | type GroupCreateParams, 14 | type GroupUpdateParams, 15 | } from './group'; 16 | -------------------------------------------------------------------------------- /src/resources/ecommerce/cart.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class Cart extends APIResource { 7 | /** 8 | * The API endpoint allows a logged-in user to clear their entire shopping cart. 9 | * 10 | * By invoking this API, the user can remove all items from their cart, effectively 11 | * clearing it and starting afresh. 12 | * 13 | * This feature provides a convenient way for users to manage their shopping carts 14 | * and begin a new shopping session. 15 | */ 16 | clear(options?: Core.RequestOptions): Core.APIPromise { 17 | return this._client.delete('/ecommerce/cart/clear', options); 18 | } 19 | } 20 | 21 | export interface CartClearResponse { 22 | data?: Array; 23 | 24 | message?: string; 25 | 26 | statusCode?: number; 27 | 28 | success?: boolean; 29 | } 30 | 31 | export declare namespace Cart { 32 | export { type CartClearResponse as CartClearResponse }; 33 | } 34 | -------------------------------------------------------------------------------- /src/resources/ecommerce/coupons/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Coupons, 5 | type CouponCreateResponse, 6 | type CouponRetrieveResponse, 7 | type CouponUpdateResponse, 8 | type CouponListResponse, 9 | type CouponDeleteResponse, 10 | type CouponApplyResponse, 11 | type CouponRemoveResponse, 12 | type CouponCreateParams, 13 | type CouponUpdateParams, 14 | type CouponListParams, 15 | type CouponApplyParams, 16 | type CouponRemoveParams, 17 | } from './coupons'; 18 | export { 19 | CustomerAvailable, 20 | type CustomerAvailableListResponse, 21 | type CustomerAvailableListParams, 22 | } from './customer-available'; 23 | export { Status, type StatusUpdateResponse, type StatusUpdateParams } from './status'; 24 | -------------------------------------------------------------------------------- /src/resources/ecommerce/coupons/status.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import { isRequestOptions } from '../../../core'; 5 | import * as Core from '../../../core'; 6 | 7 | export class Status extends APIResource { 8 | /** 9 | * The API endpoint allows an administrator role user to update the activity status 10 | * of a coupon. 11 | * 12 | * It expects a request with a path variable `couponId` indicating the specific 13 | * coupon to update. In the request body, there should be a `isActive` key, which 14 | * is a boolean value indicating the desired status of the coupon. 15 | * 16 | * When this API is called, it toggles the active status of the coupon. This 17 | * functionality allows the administrator to enable or disable the use of certain 18 | * coupon codes in the application. 19 | */ 20 | update( 21 | couponId: string, 22 | body?: StatusUpdateParams, 23 | options?: Core.RequestOptions, 24 | ): Core.APIPromise; 25 | update(couponId: string, options?: Core.RequestOptions): Core.APIPromise; 26 | update( 27 | couponId: string, 28 | body: StatusUpdateParams | Core.RequestOptions = {}, 29 | options?: Core.RequestOptions, 30 | ): Core.APIPromise { 31 | if (isRequestOptions(body)) { 32 | return this.update(couponId, {}, body); 33 | } 34 | return this._client.patch(`/ecommerce/coupons/status/${couponId}`, { body, ...options }); 35 | } 36 | } 37 | 38 | export interface StatusUpdateResponse { 39 | data?: StatusUpdateResponse.Data; 40 | 41 | message?: string; 42 | 43 | statusCode?: number; 44 | 45 | success?: boolean; 46 | } 47 | 48 | export namespace StatusUpdateResponse { 49 | export interface Data { 50 | __v?: number; 51 | 52 | _id?: string; 53 | 54 | couponCode?: string; 55 | 56 | createdAt?: string; 57 | 58 | discountValue?: number; 59 | 60 | expiryDate?: string; 61 | 62 | isActive?: boolean; 63 | 64 | minimumCartValue?: number; 65 | 66 | name?: string; 67 | 68 | owner?: string; 69 | 70 | startDate?: string; 71 | 72 | type?: string; 73 | 74 | updatedAt?: string; 75 | } 76 | } 77 | 78 | export interface StatusUpdateParams { 79 | isActive?: boolean; 80 | } 81 | 82 | export declare namespace Status { 83 | export { type StatusUpdateResponse as StatusUpdateResponse, type StatusUpdateParams as StatusUpdateParams }; 84 | } 85 | -------------------------------------------------------------------------------- /src/resources/ecommerce/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Addresses, 5 | type AddressCreateResponse, 6 | type AddressRetrieveResponse, 7 | type AddressUpdateResponse, 8 | type AddressListResponse, 9 | type AddressDeleteResponse, 10 | type AddressCreateParams, 11 | type AddressUpdateParams, 12 | type AddressListParams, 13 | } from './addresses'; 14 | export { Cart, type CartClearResponse } from './cart'; 15 | export { 16 | Categories, 17 | type CategoryCreateResponse, 18 | type CategoryRetrieveResponse, 19 | type CategoryUpdateResponse, 20 | type CategoryListResponse, 21 | type CategoryDeleteResponse, 22 | type CategoryCreateParams, 23 | type CategoryUpdateParams, 24 | type CategoryListParams, 25 | } from './categories'; 26 | export { 27 | Coupons, 28 | type CouponCreateResponse, 29 | type CouponRetrieveResponse, 30 | type CouponUpdateResponse, 31 | type CouponListResponse, 32 | type CouponDeleteResponse, 33 | type CouponApplyResponse, 34 | type CouponRemoveResponse, 35 | type CouponCreateParams, 36 | type CouponUpdateParams, 37 | type CouponListParams, 38 | type CouponApplyParams, 39 | type CouponRemoveParams, 40 | } from './coupons/index'; 41 | export { Ecommerce } from './ecommerce'; 42 | export { Orders, type OrderRetrieveResponse } from './orders/index'; 43 | export { 44 | Profile, 45 | type ProfileRetrieveResponse, 46 | type ProfileUpdateResponse, 47 | type ProfileUpdateParams, 48 | } from './profile/index'; 49 | -------------------------------------------------------------------------------- /src/resources/ecommerce/orders/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Admin, type AdminListResponse, type AdminListParams } from './admin'; 4 | export { Orders, type OrderRetrieveResponse } from './orders'; 5 | export { Provider } from './provider/index'; 6 | export { Status, type StatusUpdateResponse, type StatusUpdateParams } from './status'; 7 | -------------------------------------------------------------------------------- /src/resources/ecommerce/orders/provider/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Paypal, 5 | type PaypalCreateResponse, 6 | type PaypalCreateParams, 7 | type PaypalVerifyPaymentParams, 8 | } from './paypal'; 9 | export { Provider } from './provider'; 10 | export { 11 | Razorpay, 12 | type RazorpayCreateResponse, 13 | type RazorpayVerifyPaymentResponse, 14 | type RazorpayCreateParams, 15 | type RazorpayVerifyPaymentParams, 16 | } from './razorpay'; 17 | -------------------------------------------------------------------------------- /src/resources/ecommerce/orders/provider/provider.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../../resource'; 4 | import * as PaypalAPI from './paypal'; 5 | import { Paypal, PaypalCreateParams, PaypalCreateResponse, PaypalVerifyPaymentParams } from './paypal'; 6 | import * as RazorpayAPI from './razorpay'; 7 | import { 8 | Razorpay, 9 | RazorpayCreateParams, 10 | RazorpayCreateResponse, 11 | RazorpayVerifyPaymentParams, 12 | RazorpayVerifyPaymentResponse, 13 | } from './razorpay'; 14 | 15 | export class Provider extends APIResource { 16 | razorpay: RazorpayAPI.Razorpay = new RazorpayAPI.Razorpay(this._client); 17 | paypal: PaypalAPI.Paypal = new PaypalAPI.Paypal(this._client); 18 | } 19 | 20 | Provider.Razorpay = Razorpay; 21 | Provider.Paypal = Paypal; 22 | 23 | export declare namespace Provider { 24 | export { 25 | Razorpay as Razorpay, 26 | type RazorpayCreateResponse as RazorpayCreateResponse, 27 | type RazorpayVerifyPaymentResponse as RazorpayVerifyPaymentResponse, 28 | type RazorpayCreateParams as RazorpayCreateParams, 29 | type RazorpayVerifyPaymentParams as RazorpayVerifyPaymentParams, 30 | }; 31 | 32 | export { 33 | Paypal as Paypal, 34 | type PaypalCreateResponse as PaypalCreateResponse, 35 | type PaypalCreateParams as PaypalCreateParams, 36 | type PaypalVerifyPaymentParams as PaypalVerifyPaymentParams, 37 | }; 38 | } 39 | -------------------------------------------------------------------------------- /src/resources/ecommerce/orders/status.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import { isRequestOptions } from '../../../core'; 5 | import * as Core from '../../../core'; 6 | 7 | export class Status extends APIResource { 8 | /** 9 | * The API allows an authenticated user with the role of `ADMIN` to update the 10 | * status of an order. 11 | * 12 | * The API expects the `orderId` to be passed as a path variable and the desired 13 | * status (`DELIVERED` or `CANCELLED`) to be provided in the request body. 14 | * 15 | * This API provides a secure and controlled way for administrators to modify the 16 | * status of an order, enabling efficient order management within the system. 17 | */ 18 | update( 19 | orderId: string, 20 | body?: StatusUpdateParams, 21 | options?: Core.RequestOptions, 22 | ): Core.APIPromise; 23 | update(orderId: string, options?: Core.RequestOptions): Core.APIPromise; 24 | update( 25 | orderId: string, 26 | body: StatusUpdateParams | Core.RequestOptions = {}, 27 | options?: Core.RequestOptions, 28 | ): Core.APIPromise { 29 | if (isRequestOptions(body)) { 30 | return this.update(orderId, {}, body); 31 | } 32 | return this._client.patch(`/ecommerce/orders/status/${orderId}`, { body, ...options }); 33 | } 34 | } 35 | 36 | export interface StatusUpdateResponse { 37 | data?: StatusUpdateResponse.Data; 38 | 39 | message?: string; 40 | 41 | statusCode?: number; 42 | 43 | success?: boolean; 44 | } 45 | 46 | export namespace StatusUpdateResponse { 47 | export interface Data { 48 | status?: string; 49 | } 50 | } 51 | 52 | export interface StatusUpdateParams { 53 | status?: string; 54 | } 55 | 56 | export declare namespace Status { 57 | export { type StatusUpdateResponse as StatusUpdateResponse, type StatusUpdateParams as StatusUpdateParams }; 58 | } 59 | -------------------------------------------------------------------------------- /src/resources/ecommerce/profile/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { MyOrders, type MyOrderListResponse, type MyOrderListParams } from './my-orders'; 4 | export { 5 | Profile, 6 | type ProfileRetrieveResponse, 7 | type ProfileUpdateResponse, 8 | type ProfileUpdateParams, 9 | } from './profile'; 10 | -------------------------------------------------------------------------------- /src/resources/healthcheck.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import * as Core from '../core'; 5 | 6 | export class Healthcheck extends APIResource { 7 | /** 8 | * This API endpoint is commonly used to determine the health status or 9 | * availability of a system or service. 10 | * 11 | * It is a simple and lightweight endpoint designed to perform a quick health check 12 | * of the application or infrastructure. 13 | */ 14 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.get('/healthcheck', options); 16 | } 17 | } 18 | 19 | export interface HealthcheckRetrieveResponse { 20 | data?: string; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export declare namespace Healthcheck { 30 | export { type HealthcheckRetrieveResponse as HealthcheckRetrieveResponse }; 31 | } 32 | -------------------------------------------------------------------------------- /src/resources/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Authentications, 5 | type AuthenticationCurrentUserResponse, 6 | type AuthenticationLoginResponse, 7 | type AuthenticationLogoutResponse, 8 | type AuthenticationRegisterResponse, 9 | type AuthenticationVerifyEmailResponse, 10 | type AuthenticationLoginParams, 11 | type AuthenticationRegisterParams, 12 | } from './authentications'; 13 | export { Cart, type CartRetrieveResponse } from './cart/cart'; 14 | export { ChatApp } from './chat-app/chat-app'; 15 | export { Chats, type ChatRemoveResponse } from './chats/chats'; 16 | export { Ecommerce } from './ecommerce/ecommerce'; 17 | export { Healthcheck, type HealthcheckRetrieveResponse } from './healthcheck'; 18 | export { KitchenSink } from './kitchen-sink/kitchen-sink'; 19 | export { 20 | KitchenSinks, 21 | type KitchenSinkResponseBrotliResponse, 22 | type KitchenSinkResponseGzipResponse, 23 | type KitchenSinkRedirectToParams, 24 | } from './kitchen-sinks/kitchen-sinks'; 25 | export { 26 | Messages, 27 | type MessageListResponse, 28 | type MessageSendResponse, 29 | type MessageSendParams, 30 | } from './messages'; 31 | export { 32 | Products, 33 | type ProductCreateResponse, 34 | type ProductRetrieveResponse, 35 | type ProductUpdateResponse, 36 | type ProductListResponse, 37 | type ProductDeleteResponse, 38 | type ProductCreateParams, 39 | type ProductUpdateParams, 40 | type ProductListParams, 41 | } from './products/products'; 42 | export { Public } from './public/public'; 43 | export { ResetDB, type ResetDBDeleteResponse } from './reset-db'; 44 | export { Seed } from './seed/seed'; 45 | export { SocialMedia } from './social-media/social-media'; 46 | export { 47 | Todos, 48 | type TodoCreateResponse, 49 | type TodoRetrieveResponse, 50 | type TodoUpdateResponse, 51 | type TodoListResponse, 52 | type TodoDeleteResponse, 53 | type TodoToggleStatusResponse, 54 | type TodoCreateParams, 55 | type TodoUpdateParams, 56 | type TodoListParams, 57 | } from './todos'; 58 | export { 59 | Users, 60 | type UserAssignRoleResponse, 61 | type UserChangePasswordResponse, 62 | type UserForgotPasswordResponse, 63 | type UserRefreshTokenResponse, 64 | type UserResendEmailVerificationResponse, 65 | type UserResetPasswordResponse, 66 | type UserAssignRoleParams, 67 | type UserChangePasswordParams, 68 | type UserForgotPasswordParams, 69 | type UserResetPasswordParams, 70 | } from './users/users'; 71 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | HTTPMethods, 5 | type HTTPMethodCreateResponse, 6 | type HTTPMethodUpdateResponse, 7 | type HTTPMethodDeleteResponse, 8 | type HTTPMethodGetResponse, 9 | type HTTPMethodPutResponse, 10 | } from './http-methods'; 11 | export { KitchenSink } from './kitchen-sink'; 12 | export { Request } from './request/index'; 13 | export { Response } from './response/index'; 14 | export { StatusCodes, type StatusCodeListResponse } from './status-codes'; 15 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/kitchen-sink.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as HTTPMethodsAPI from './http-methods'; 5 | import { 6 | HTTPMethodCreateResponse, 7 | HTTPMethodDeleteResponse, 8 | HTTPMethodGetResponse, 9 | HTTPMethodPutResponse, 10 | HTTPMethodUpdateResponse, 11 | HTTPMethods, 12 | } from './http-methods'; 13 | import * as StatusCodesAPI from './status-codes'; 14 | import { StatusCodeListResponse, StatusCodes } from './status-codes'; 15 | import * as RequestAPI from './request/request'; 16 | import { Request } from './request/request'; 17 | import * as ResponseAPI from './response/response'; 18 | import { Response } from './response/response'; 19 | 20 | export class KitchenSink extends APIResource { 21 | httpMethods: HTTPMethodsAPI.HTTPMethods = new HTTPMethodsAPI.HTTPMethods(this._client); 22 | statusCodes: StatusCodesAPI.StatusCodes = new StatusCodesAPI.StatusCodes(this._client); 23 | request: RequestAPI.Request = new RequestAPI.Request(this._client); 24 | response: ResponseAPI.Response = new ResponseAPI.Response(this._client); 25 | } 26 | 27 | KitchenSink.HTTPMethods = HTTPMethods; 28 | KitchenSink.StatusCodes = StatusCodes; 29 | KitchenSink.Request = Request; 30 | KitchenSink.Response = Response; 31 | 32 | export declare namespace KitchenSink { 33 | export { 34 | HTTPMethods as HTTPMethods, 35 | type HTTPMethodCreateResponse as HTTPMethodCreateResponse, 36 | type HTTPMethodUpdateResponse as HTTPMethodUpdateResponse, 37 | type HTTPMethodDeleteResponse as HTTPMethodDeleteResponse, 38 | type HTTPMethodGetResponse as HTTPMethodGetResponse, 39 | type HTTPMethodPutResponse as HTTPMethodPutResponse, 40 | }; 41 | 42 | export { StatusCodes as StatusCodes, type StatusCodeListResponse as StatusCodeListResponse }; 43 | 44 | export { Request as Request }; 45 | 46 | export { Response as Response }; 47 | } 48 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/headers.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Headers extends APIResource { 7 | /** 8 | * This API endpoint is designed to provide information about the headers included 9 | * in an HTTP request made to the API. 10 | * 11 | * It allows users to retrieve the details of the headers sent in the request, 12 | * including their names, values, and any additional relevant information. 13 | */ 14 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.get('/kitchen-sink/request/headers', options); 16 | } 17 | } 18 | 19 | export interface HeaderRetrieveResponse { 20 | data?: HeaderRetrieveResponse.Data; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export namespace HeaderRetrieveResponse { 30 | export interface Data { 31 | headers?: Data.Headers; 32 | } 33 | 34 | export namespace Data { 35 | export interface Headers { 36 | accept?: string; 37 | 38 | 'accept-encoding'?: string; 39 | 40 | 'cache-control'?: string; 41 | 42 | connection?: string; 43 | 44 | cookie?: string; 45 | 46 | host?: string; 47 | 48 | 'postman-token'?: string; 49 | 50 | 'user-agent'?: string; 51 | } 52 | } 53 | } 54 | 55 | export declare namespace Headers { 56 | export { type HeaderRetrieveResponse as HeaderRetrieveResponse }; 57 | } 58 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Headers, type HeaderRetrieveResponse } from './headers'; 4 | export { IP, type IPRetrieveResponse } from './ip'; 5 | export { PathVariable, type PathVariableRetrieveResponse } from './path-variable'; 6 | export { 7 | QueryParameter, 8 | type QueryParameterRetrieveResponse, 9 | type QueryParameterRetrieveParams, 10 | } from './query-parameter'; 11 | export { Request } from './request'; 12 | export { UserAgent, type UserAgentRetrieveResponse } from './user-agent'; 13 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/ip.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class IP extends APIResource { 7 | /** 8 | * This API endpoint is designed to provide the current client's IP (Internet 9 | * Protocol) address. 10 | * 11 | * It allows users to retrieve the IP address from which the client is making the 12 | * request to the API. 13 | */ 14 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.get('/kitchen-sink/request/ip', options); 16 | } 17 | } 18 | 19 | export interface IPRetrieveResponse { 20 | data?: IPRetrieveResponse.Data; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export namespace IPRetrieveResponse { 30 | export interface Data { 31 | ip?: string; 32 | 33 | ipv?: string; 34 | } 35 | } 36 | 37 | export declare namespace IP { 38 | export { type IPRetrieveResponse as IPRetrieveResponse }; 39 | } 40 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/path-variable.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class PathVariable extends APIResource { 7 | /** 8 | * The API endpoint allows you to retrieve the path variable being supplied in the 9 | * URL. 10 | * 11 | * By accessing this endpoint, you can obtain the specific value provided as a path 12 | * parameter in the URL. 13 | * 14 | * This functionality is useful when you need to access and utilize **the dynamic 15 | * portion of the URL** within your application or for further processing. 16 | */ 17 | retrieve( 18 | pathVariable: string, 19 | options?: Core.RequestOptions, 20 | ): Core.APIPromise { 21 | return this._client.get(`/kitchen-sink/request/path-variable/${pathVariable}`, options); 22 | } 23 | } 24 | 25 | export interface PathVariableRetrieveResponse { 26 | data?: PathVariableRetrieveResponse.Data; 27 | 28 | message?: string; 29 | 30 | statusCode?: number; 31 | 32 | success?: boolean; 33 | } 34 | 35 | export namespace PathVariableRetrieveResponse { 36 | export interface Data { 37 | pathVariable?: string; 38 | } 39 | } 40 | 41 | export declare namespace PathVariable { 42 | export { type PathVariableRetrieveResponse as PathVariableRetrieveResponse }; 43 | } 44 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/query-parameter.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import { isRequestOptions } from '../../../core'; 5 | import * as Core from '../../../core'; 6 | 7 | export class QueryParameter extends APIResource { 8 | /** 9 | * The API endpoint provides the capability to retrieve the query parameters being 10 | * supplied in the URL. 11 | * 12 | * When accessing this endpoint, you can retrieve and access the values of the 13 | * query parameters included in the URL. 14 | * 15 | * This functionality allows you to extract and utilize the information provided as 16 | * query parameters for further processing or customization within your 17 | * application. 18 | */ 19 | retrieve( 20 | query?: QueryParameterRetrieveParams, 21 | options?: Core.RequestOptions, 22 | ): Core.APIPromise; 23 | retrieve(options?: Core.RequestOptions): Core.APIPromise; 24 | retrieve( 25 | query: QueryParameterRetrieveParams | Core.RequestOptions = {}, 26 | options?: Core.RequestOptions, 27 | ): Core.APIPromise { 28 | if (isRequestOptions(query)) { 29 | return this.retrieve({}, query); 30 | } 31 | return this._client.get('/kitchen-sink/request/query-parameter', { query, ...options }); 32 | } 33 | } 34 | 35 | export interface QueryParameterRetrieveResponse { 36 | data?: QueryParameterRetrieveResponse.Data; 37 | 38 | message?: string; 39 | 40 | statusCode?: number; 41 | 42 | success?: boolean; 43 | } 44 | 45 | export namespace QueryParameterRetrieveResponse { 46 | export interface Data { 47 | query1?: string; 48 | 49 | query2?: string; 50 | 51 | query3?: string; 52 | } 53 | } 54 | 55 | export interface QueryParameterRetrieveParams { 56 | query1?: string; 57 | 58 | query2?: string; 59 | 60 | query3?: string; 61 | } 62 | 63 | export declare namespace QueryParameter { 64 | export { 65 | type QueryParameterRetrieveResponse as QueryParameterRetrieveResponse, 66 | type QueryParameterRetrieveParams as QueryParameterRetrieveParams, 67 | }; 68 | } 69 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/request.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as HeadersAPI from './headers'; 5 | import { HeaderRetrieveResponse, Headers } from './headers'; 6 | import * as IPAPI from './ip'; 7 | import { IP, IPRetrieveResponse } from './ip'; 8 | import * as PathVariableAPI from './path-variable'; 9 | import { PathVariable, PathVariableRetrieveResponse } from './path-variable'; 10 | import * as QueryParameterAPI from './query-parameter'; 11 | import { 12 | QueryParameter, 13 | QueryParameterRetrieveParams, 14 | QueryParameterRetrieveResponse, 15 | } from './query-parameter'; 16 | import * as UserAgentAPI from './user-agent'; 17 | import { UserAgent, UserAgentRetrieveResponse } from './user-agent'; 18 | 19 | export class Request extends APIResource { 20 | headers: HeadersAPI.Headers = new HeadersAPI.Headers(this._client); 21 | ip: IPAPI.IP = new IPAPI.IP(this._client); 22 | userAgent: UserAgentAPI.UserAgent = new UserAgentAPI.UserAgent(this._client); 23 | pathVariable: PathVariableAPI.PathVariable = new PathVariableAPI.PathVariable(this._client); 24 | queryParameter: QueryParameterAPI.QueryParameter = new QueryParameterAPI.QueryParameter(this._client); 25 | } 26 | 27 | Request.Headers = Headers; 28 | Request.IP = IP; 29 | Request.UserAgent = UserAgent; 30 | Request.PathVariable = PathVariable; 31 | Request.QueryParameter = QueryParameter; 32 | 33 | export declare namespace Request { 34 | export { Headers as Headers, type HeaderRetrieveResponse as HeaderRetrieveResponse }; 35 | 36 | export { IP as IP, type IPRetrieveResponse as IPRetrieveResponse }; 37 | 38 | export { UserAgent as UserAgent, type UserAgentRetrieveResponse as UserAgentRetrieveResponse }; 39 | 40 | export { PathVariable as PathVariable, type PathVariableRetrieveResponse as PathVariableRetrieveResponse }; 41 | 42 | export { 43 | QueryParameter as QueryParameter, 44 | type QueryParameterRetrieveResponse as QueryParameterRetrieveResponse, 45 | type QueryParameterRetrieveParams as QueryParameterRetrieveParams, 46 | }; 47 | } 48 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/request/user-agent.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class UserAgent extends APIResource { 7 | /** 8 | * This API endpoint is designed to provide information about the user agent string 9 | * associated with the client making the request. 10 | * 11 | * It allows users to retrieve details about the user agent, which typically 12 | * includes the name and version of the client's software or web browser. 13 | */ 14 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.get('/kitchen-sink/request/user-agent', options); 16 | } 17 | } 18 | 19 | export interface UserAgentRetrieveResponse { 20 | data?: UserAgentRetrieveResponse.Data; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export namespace UserAgentRetrieveResponse { 30 | export interface Data { 31 | userAgent?: string; 32 | } 33 | } 34 | 35 | export declare namespace UserAgent { 36 | export { type UserAgentRetrieveResponse as UserAgentRetrieveResponse }; 37 | } 38 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/response/cache.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Cache extends APIResource { 7 | /** 8 | * - `Cache-control` is an HTTP header used to specify browser caching policies in 9 | * both client requests and server responses. 10 | * 11 | * - Policies include how a resource is cached, where it’s cached and its maximum 12 | * age before expiring (i.e., time to live) 13 | * 14 | * _For example,_ 15 | * 16 | * `cache-control: max-age=120` means that the returned resource is valid for 17 | * **120** seconds, after which the browser has to request a newer version. 18 | * 19 | * - The `public` (cacheResponseDirective) response directive indicates that a 20 | * resource can be cached by any cache. 21 | * 22 | * - The `private` (cacheResponseDirective) response directive indicates that a 23 | * resource is user specific - it can still be cached, but only on a client 24 | * device. For example, a web page response marked as private can be cached by a 25 | * desktop browser, but not a content delivery network (CDN). 26 | */ 27 | retrieve( 28 | timeToLive: string, 29 | cacheResponseDirective: string, 30 | options?: Core.RequestOptions, 31 | ): Core.APIPromise { 32 | return this._client.get(`/kitchen-sink/response/cache/${timeToLive}/${cacheResponseDirective}`, options); 33 | } 34 | } 35 | 36 | export interface CacheRetrieveResponse { 37 | data?: CacheRetrieveResponse.Data; 38 | 39 | message?: string; 40 | 41 | statusCode?: number; 42 | 43 | success?: boolean; 44 | } 45 | 46 | export namespace CacheRetrieveResponse { 47 | export interface Data { 48 | headers?: Data.Headers; 49 | } 50 | 51 | export namespace Data { 52 | export interface Headers { 53 | 'access-control-allow-credentials'?: string; 54 | 55 | 'access-control-allow-origin'?: string; 56 | 57 | 'cache-control'?: string; 58 | 59 | 'x-powered-by'?: string; 60 | } 61 | } 62 | } 63 | 64 | export declare namespace Cache { 65 | export { type CacheRetrieveResponse as CacheRetrieveResponse }; 66 | } 67 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/response/headers.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Headers extends APIResource { 7 | /** 8 | * The API endpoint enables you to retrieve the response headers. 9 | * 10 | * By accessing this endpoint, you can obtain the headers included in the response 11 | * of an HTTP request. 12 | * 13 | * This functionality is useful for inspecting and retrieving important metadata 14 | * and information associated with the response, such as content type, cache 15 | * control, and authentication-related headers. 16 | * 17 | * It allows you to access and utilize the response headers for further processing 18 | * or to gather relevant information from the API response. 19 | */ 20 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 21 | return this._client.get('/kitchen-sink/response/headers', options); 22 | } 23 | } 24 | 25 | export interface HeaderRetrieveResponse { 26 | data?: HeaderRetrieveResponse.Data; 27 | 28 | message?: string; 29 | 30 | statusCode?: number; 31 | 32 | success?: boolean; 33 | } 34 | 35 | export namespace HeaderRetrieveResponse { 36 | export interface Data { 37 | headers?: Data.Headers; 38 | } 39 | 40 | export namespace Data { 41 | export interface Headers { 42 | 'access-control-allow-credentials'?: string; 43 | 44 | 'access-control-allow-origin'?: string; 45 | 46 | 'content-length'?: string; 47 | 48 | 'content-type'?: string; 49 | 50 | etag?: string; 51 | 52 | 'x-powered-by'?: string; 53 | } 54 | } 55 | } 56 | 57 | export declare namespace Headers { 58 | export { type HeaderRetrieveResponse as HeaderRetrieveResponse }; 59 | } 60 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/response/html.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class HTML extends APIResource { 7 | /** 8 | * The API endpoint provides the ability to retrieve an HTML template as a 9 | * response. 10 | * 11 | * When accessing this endpoint, you will receive an HTML template that can be 12 | * rendered and displayed in a web browser or used for further manipulation. 13 | * 14 | * This functionality is useful when you need to dynamically generate or retrieve 15 | * HTML templates from your application's backend and deliver them to clients for 16 | * rendering user interfaces or displaying structured content. 17 | */ 18 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 19 | return this._client.get('/kitchen-sink/response/html', { 20 | ...options, 21 | headers: { Accept: '*/*', ...options?.headers }, 22 | }); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/response/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Cache, type CacheRetrieveResponse } from './cache'; 4 | export { HTML } from './html'; 5 | export { Headers, type HeaderRetrieveResponse } from './headers'; 6 | export { Response } from './response'; 7 | export { Xml } from './xml'; 8 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/response/response.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as CacheAPI from './cache'; 5 | import { Cache, CacheRetrieveResponse } from './cache'; 6 | import * as HeadersAPI from './headers'; 7 | import { HeaderRetrieveResponse, Headers } from './headers'; 8 | import * as HTMLAPI from './html'; 9 | import { HTML } from './html'; 10 | import * as XmlAPI from './xml'; 11 | import { Xml } from './xml'; 12 | 13 | export class Response extends APIResource { 14 | headers: HeadersAPI.Headers = new HeadersAPI.Headers(this._client); 15 | cache: CacheAPI.Cache = new CacheAPI.Cache(this._client); 16 | html: HTMLAPI.HTML = new HTMLAPI.HTML(this._client); 17 | xml: XmlAPI.Xml = new XmlAPI.Xml(this._client); 18 | } 19 | 20 | Response.Headers = Headers; 21 | Response.Cache = Cache; 22 | Response.HTML = HTML; 23 | Response.Xml = Xml; 24 | 25 | export declare namespace Response { 26 | export { Headers as Headers, type HeaderRetrieveResponse as HeaderRetrieveResponse }; 27 | 28 | export { Cache as Cache, type CacheRetrieveResponse as CacheRetrieveResponse }; 29 | 30 | export { HTML as HTML }; 31 | 32 | export { Xml as Xml }; 33 | } 34 | -------------------------------------------------------------------------------- /src/resources/kitchen-sink/response/xml.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Xml extends APIResource { 7 | /** 8 | * The API endpoint allows you to retrieve an XML template as a response. 9 | * 10 | * When accessing this endpoint, you will receive an XML template that can be used 11 | * for various purposes, such as data interchange, configuration, or structured 12 | * content representation. 13 | * 14 | * This functionality is particularly useful when you need to dynamically generate 15 | * or retrieve XML templates from your application's backend and deliver them to 16 | * clients for processing, parsing, or integration with other systems that support 17 | * XML data formats. 18 | */ 19 | retrieve(options?: Core.RequestOptions): Core.APIPromise { 20 | return this._client.get('/kitchen-sink/response/xml', { 21 | ...options, 22 | headers: { Accept: '*/*', ...options?.headers }, 23 | }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/resources/kitchen-sinks/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Cookies, 5 | type CookieCreateResponse, 6 | type CookieRetrieveResponse, 7 | type CookieRemoveResponse, 8 | type CookieCreateParams, 9 | type CookieRemoveParams, 10 | } from './cookies'; 11 | export { 12 | KitchenSinks, 13 | type KitchenSinkResponseBrotliResponse, 14 | type KitchenSinkResponseGzipResponse, 15 | type KitchenSinkRedirectToParams, 16 | } from './kitchen-sinks'; 17 | -------------------------------------------------------------------------------- /src/resources/products/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Category, type CategoryRetrieveResponse, type CategoryRetrieveParams } from './category'; 4 | export { 5 | Products, 6 | type ProductCreateResponse, 7 | type ProductRetrieveResponse, 8 | type ProductUpdateResponse, 9 | type ProductListResponse, 10 | type ProductDeleteResponse, 11 | type ProductCreateParams, 12 | type ProductUpdateParams, 13 | type ProductListParams, 14 | } from './products'; 15 | export { Subimage, type SubimageRemoveResponse } from './subimage'; 16 | -------------------------------------------------------------------------------- /src/resources/products/subimage.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class Subimage extends APIResource { 7 | /** 8 | * The API enables an `ADMIN` user to remove sub-images associated with a product 9 | * by providing `productId` and `subImageId`. 10 | * 11 | * It provides functionality for the frontend to offer the `ADMIN` user an option 12 | * to manage the sub-images of a product. 13 | * 14 | * Using this API, the `ADMIN` user can remove specific sub-images from the 15 | * product, thereby allowing them to effectively control and update the visual 16 | * representation of the product. 17 | */ 18 | remove( 19 | productId: string, 20 | subImageId: string, 21 | options?: Core.RequestOptions, 22 | ): Core.APIPromise { 23 | return this._client.patch(`/ecommerce/products/remove/subimage/${productId}/${subImageId}`, options); 24 | } 25 | } 26 | 27 | export interface SubimageRemoveResponse { 28 | data?: SubimageRemoveResponse.Data; 29 | 30 | message?: string; 31 | 32 | statusCode?: number; 33 | 34 | success?: boolean; 35 | } 36 | 37 | export namespace SubimageRemoveResponse { 38 | export interface Data { 39 | __v?: number; 40 | 41 | _id?: string; 42 | 43 | category?: string; 44 | 45 | createdAt?: string; 46 | 47 | description?: string; 48 | 49 | mainImage?: Data.MainImage; 50 | 51 | name?: string; 52 | 53 | owner?: string; 54 | 55 | price?: number; 56 | 57 | stock?: number; 58 | 59 | subImages?: Array; 60 | 61 | updatedAt?: string; 62 | } 63 | 64 | export namespace Data { 65 | export interface MainImage { 66 | _id?: string; 67 | 68 | localPath?: string; 69 | 70 | url?: string; 71 | } 72 | } 73 | } 74 | 75 | export declare namespace Subimage { 76 | export { type SubimageRemoveResponse as SubimageRemoveResponse }; 77 | } 78 | -------------------------------------------------------------------------------- /src/resources/public/cats/cat.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Cat extends APIResource { 7 | /** 8 | * The API endpoint returns a randomly selected cat object from a list. 9 | * 10 | * When accessing this endpoint, you will receive a response containing a cat 11 | * object randomly chosen from the available list. 12 | */ 13 | random(options?: Core.RequestOptions): Core.APIPromise { 14 | return this._client.get('/public/cats/cat/random', options); 15 | } 16 | } 17 | 18 | export interface CatRandomResponse { 19 | data?: CatRandomResponse.Data; 20 | 21 | message?: string; 22 | 23 | statusCode?: number; 24 | 25 | success?: boolean; 26 | } 27 | 28 | export namespace CatRandomResponse { 29 | export interface Data { 30 | id?: number; 31 | 32 | adaptability?: number; 33 | 34 | affection_level?: number; 35 | 36 | cfa_url?: string; 37 | 38 | child_friendly?: number; 39 | 40 | country_code?: string; 41 | 42 | country_codes?: string; 43 | 44 | description?: string; 45 | 46 | dog_friendly?: number; 47 | 48 | energy_level?: number; 49 | 50 | experimental?: number; 51 | 52 | grooming?: number; 53 | 54 | hairless?: number; 55 | 56 | health_issues?: number; 57 | 58 | hypoallergenic?: number; 59 | 60 | image?: string; 61 | 62 | indoor?: number; 63 | 64 | intelligence?: number; 65 | 66 | life_span?: string; 67 | 68 | name?: string; 69 | 70 | natural?: number; 71 | 72 | origin?: string; 73 | 74 | rare?: number; 75 | 76 | rex?: number; 77 | 78 | shedding_level?: number; 79 | 80 | short_legs?: number; 81 | 82 | social_needs?: number; 83 | 84 | stranger_friendly?: number; 85 | 86 | suppressed_tail?: number; 87 | 88 | temperament?: string; 89 | 90 | vcahospitals_url?: string; 91 | 92 | vetstreet_url?: string; 93 | 94 | vocalisation?: number; 95 | 96 | weight?: Data.Weight; 97 | 98 | wikipedia_url?: string; 99 | } 100 | 101 | export namespace Data { 102 | export interface Weight { 103 | imperial?: string; 104 | 105 | metric?: string; 106 | } 107 | } 108 | } 109 | 110 | export declare namespace Cat { 111 | export { type CatRandomResponse as CatRandomResponse }; 112 | } 113 | -------------------------------------------------------------------------------- /src/resources/public/cats/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Cat, type CatRandomResponse } from './cat'; 4 | export { Cats, type CatRetrieveResponse, type CatListResponse, type CatListParams } from './cats'; 5 | -------------------------------------------------------------------------------- /src/resources/public/dogs/dog.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Dog extends APIResource { 7 | /** 8 | * The API endpoint returns a randomly selected dog object from a list. 9 | * 10 | * When accessing this endpoint, you will receive a response containing a dog 11 | * object randomly chosen from the available list. 12 | */ 13 | random(options?: Core.RequestOptions): Core.APIPromise { 14 | return this._client.get('/public/dogs/dog/random', options); 15 | } 16 | } 17 | 18 | export interface DogRandomResponse { 19 | data?: DogRandomResponse.Data; 20 | 21 | message?: string; 22 | 23 | statusCode?: number; 24 | 25 | success?: boolean; 26 | } 27 | 28 | export namespace DogRandomResponse { 29 | export interface Data { 30 | id?: number; 31 | 32 | bred_for?: string; 33 | 34 | breed_group?: string; 35 | 36 | height?: Data.Height; 37 | 38 | image?: Data.Image; 39 | 40 | life_span?: string; 41 | 42 | name?: string; 43 | 44 | reference_image_id?: string; 45 | 46 | temperament?: string; 47 | 48 | weight?: Data.Weight; 49 | } 50 | 51 | export namespace Data { 52 | export interface Height { 53 | imperial?: string; 54 | 55 | metric?: string; 56 | } 57 | 58 | export interface Image { 59 | id?: string; 60 | 61 | height?: number; 62 | 63 | url?: string; 64 | 65 | width?: number; 66 | } 67 | 68 | export interface Weight { 69 | imperial?: string; 70 | 71 | metric?: string; 72 | } 73 | } 74 | } 75 | 76 | export declare namespace Dog { 77 | export { type DogRandomResponse as DogRandomResponse }; 78 | } 79 | -------------------------------------------------------------------------------- /src/resources/public/dogs/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Dog, type DogRandomResponse } from './dog'; 4 | export { Dogs, type DogRetrieveResponse, type DogListResponse, type DogListParams } from './dogs'; 5 | -------------------------------------------------------------------------------- /src/resources/public/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Books, 5 | type BookRetrieveResponse, 6 | type BookListResponse, 7 | type BookRandomResponse, 8 | type BookListParams, 9 | } from './books'; 10 | export { Cats, type CatRetrieveResponse, type CatListResponse, type CatListParams } from './cats/index'; 11 | export { Dogs, type DogRetrieveResponse, type DogListResponse, type DogListParams } from './dogs/index'; 12 | export { Meals, type MealRetrieveResponse, type MealListResponse, type MealListParams } from './meals/index'; 13 | export { Public } from './public'; 14 | export { 15 | Quotes, 16 | type QuoteRetrieveResponse, 17 | type QuoteListResponse, 18 | type QuoteRandomResponse, 19 | type QuoteListParams, 20 | } from './quotes'; 21 | export { 22 | RandomJokes, 23 | type RandomJokeRetrieveResponse, 24 | type RandomJokeListResponse, 25 | type RandomJokeListParams, 26 | } from './random-jokes/index'; 27 | export { 28 | RandomProducts, 29 | type RandomProductRetrieveResponse, 30 | type RandomProductListResponse, 31 | type RandomProductListParams, 32 | } from './random-products/index'; 33 | export { 34 | RandomUsers, 35 | type RandomUserRetrieveResponse, 36 | type RandomUserListResponse, 37 | type RandomUserListParams, 38 | } from './random-users/index'; 39 | export { 40 | Stocks, 41 | type StockRetrieveResponse, 42 | type StockListResponse, 43 | type StockRandomResponse, 44 | type StockListParams, 45 | } from './stocks'; 46 | export { Youtube } from './youtube/index'; 47 | -------------------------------------------------------------------------------- /src/resources/public/meals/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Meal, type MealRandomResponse } from './meal'; 4 | export { Meals, type MealRetrieveResponse, type MealListResponse, type MealListParams } from './meals'; 5 | -------------------------------------------------------------------------------- /src/resources/public/random-jokes/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Joke, type JokeRandomResponse } from './joke'; 4 | export { 5 | RandomJokes, 6 | type RandomJokeRetrieveResponse, 7 | type RandomJokeListResponse, 8 | type RandomJokeListParams, 9 | } from './random-jokes'; 10 | -------------------------------------------------------------------------------- /src/resources/public/random-jokes/joke.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Joke extends APIResource { 7 | /** 8 | * The API endpoint returns a random joke from a list of jokes. 9 | * 10 | * When accessing this endpoint, you will receive a response containing a randomly 11 | * selected joke. 12 | */ 13 | random(options?: Core.RequestOptions): Core.APIPromise { 14 | return this._client.get('/public/randomjokes/joke/random', options); 15 | } 16 | } 17 | 18 | export interface JokeRandomResponse { 19 | data?: JokeRandomResponse.Data; 20 | 21 | message?: string; 22 | 23 | statusCode?: number; 24 | 25 | success?: boolean; 26 | } 27 | 28 | export namespace JokeRandomResponse { 29 | export interface Data { 30 | id?: number; 31 | 32 | categories?: Array; 33 | 34 | content?: string; 35 | } 36 | } 37 | 38 | export declare namespace Joke { 39 | export { type JokeRandomResponse as JokeRandomResponse }; 40 | } 41 | -------------------------------------------------------------------------------- /src/resources/public/random-products/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Product, type ProductRandomResponse } from './product'; 4 | export { 5 | RandomProducts, 6 | type RandomProductRetrieveResponse, 7 | type RandomProductListResponse, 8 | type RandomProductListParams, 9 | } from './random-products'; 10 | -------------------------------------------------------------------------------- /src/resources/public/random-products/product.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Product extends APIResource { 7 | /** 8 | * The API endpoint allows you to retrieve a randomly generated dummy product. 9 | * 10 | * When accessing this endpoint, you will receive a response containing the details 11 | * of a randomly generated product. 12 | */ 13 | random(options?: Core.RequestOptions): Core.APIPromise { 14 | return this._client.get('/public/randomproducts/product/random', options); 15 | } 16 | } 17 | 18 | export interface ProductRandomResponse { 19 | data?: ProductRandomResponse.Data; 20 | 21 | message?: string; 22 | 23 | statusCode?: number; 24 | 25 | success?: boolean; 26 | } 27 | 28 | export namespace ProductRandomResponse { 29 | export interface Data { 30 | id?: number; 31 | 32 | brand?: string; 33 | 34 | category?: string; 35 | 36 | description?: string; 37 | 38 | discountPercentage?: number; 39 | 40 | images?: Array; 41 | 42 | price?: number; 43 | 44 | rating?: number; 45 | 46 | stock?: number; 47 | 48 | thumbnail?: string; 49 | 50 | title?: string; 51 | } 52 | } 53 | 54 | export declare namespace Product { 55 | export { type ProductRandomResponse as ProductRandomResponse }; 56 | } 57 | -------------------------------------------------------------------------------- /src/resources/public/random-users/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | RandomUsers, 5 | type RandomUserRetrieveResponse, 6 | type RandomUserListResponse, 7 | type RandomUserListParams, 8 | } from './random-users'; 9 | export { User, type UserRandomResponse } from './user'; 10 | -------------------------------------------------------------------------------- /src/resources/public/youtube/comments.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as Core from '../../../core'; 5 | 6 | export class Comments extends APIResource { 7 | /** 8 | * The API endpoint allows you to retrieve YouTube video comments based on the 9 | * video's unique ID provided as a path variable. 10 | * 11 | * When accessing this endpoint, you will receive a response containing complete 12 | * details of the comments, including the author's information, like count, and the 13 | * comment content. 14 | * 15 | * This functionality facilitates accessing and displaying comprehensive comment 16 | * data for a specific YouTube video. 17 | * 18 | * **Disclaimer:** 19 | * 20 | * Data provided by the API is static and not real-time. 21 | * 22 | * This simplifies the process of developing a **YouTube clone**, allowing 23 | * developers to solely focus on UI design and creativity, without worrying about 24 | * complex API key configuration. 25 | */ 26 | retrieve(videoId: string, options?: Core.RequestOptions): Core.APIPromise { 27 | return this._client.get(`/public/youtube/comments/${videoId}`, options); 28 | } 29 | } 30 | 31 | export interface CommentRetrieveResponse { 32 | data?: Array; 33 | 34 | message?: string; 35 | 36 | statusCode?: number; 37 | 38 | success?: boolean; 39 | } 40 | 41 | export namespace CommentRetrieveResponse { 42 | export interface Data { 43 | id?: string; 44 | 45 | snippet?: Data.Snippet; 46 | } 47 | 48 | export namespace Data { 49 | export interface Snippet { 50 | topLevelComment?: Snippet.TopLevelComment; 51 | 52 | totalReplyCount?: number; 53 | 54 | videoId?: string; 55 | } 56 | 57 | export namespace Snippet { 58 | export interface TopLevelComment { 59 | id?: string; 60 | 61 | snippet?: TopLevelComment.Snippet; 62 | } 63 | 64 | export namespace TopLevelComment { 65 | export interface Snippet { 66 | authorDisplayName?: string; 67 | 68 | authorProfileImageUrl?: string; 69 | 70 | likeCount?: number; 71 | 72 | publishedAt?: string; 73 | 74 | textDisplay?: string; 75 | 76 | textOriginal?: string; 77 | 78 | updatedAt?: string; 79 | } 80 | } 81 | } 82 | } 83 | } 84 | 85 | export declare namespace Comments { 86 | export { type CommentRetrieveResponse as CommentRetrieveResponse }; 87 | } 88 | -------------------------------------------------------------------------------- /src/resources/public/youtube/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Channel, type ChannelListResponse } from './channel'; 4 | export { Comments, type CommentRetrieveResponse } from './comments'; 5 | export { 6 | Playlists, 7 | type PlaylistRetrieveResponse, 8 | type PlaylistListResponse, 9 | type PlaylistListParams, 10 | } from './playlists'; 11 | export { Related, type RelatedListResponse, type RelatedListParams } from './related'; 12 | export { Videos, type VideoRetrieveResponse, type VideoListResponse, type VideoListParams } from './videos'; 13 | export { Youtube } from './youtube'; 14 | -------------------------------------------------------------------------------- /src/resources/public/youtube/youtube.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as ChannelAPI from './channel'; 5 | import { Channel, ChannelListResponse } from './channel'; 6 | import * as CommentsAPI from './comments'; 7 | import { CommentRetrieveResponse, Comments } from './comments'; 8 | import * as PlaylistsAPI from './playlists'; 9 | import { PlaylistListParams, PlaylistListResponse, PlaylistRetrieveResponse, Playlists } from './playlists'; 10 | import * as RelatedAPI from './related'; 11 | import { Related, RelatedListParams, RelatedListResponse } from './related'; 12 | import * as VideosAPI from './videos'; 13 | import { VideoListParams, VideoListResponse, VideoRetrieveResponse, Videos } from './videos'; 14 | 15 | export class Youtube extends APIResource { 16 | channel: ChannelAPI.Channel = new ChannelAPI.Channel(this._client); 17 | videos: VideosAPI.Videos = new VideosAPI.Videos(this._client); 18 | comments: CommentsAPI.Comments = new CommentsAPI.Comments(this._client); 19 | related: RelatedAPI.Related = new RelatedAPI.Related(this._client); 20 | playlists: PlaylistsAPI.Playlists = new PlaylistsAPI.Playlists(this._client); 21 | } 22 | 23 | Youtube.Channel = Channel; 24 | Youtube.Videos = Videos; 25 | Youtube.Comments = Comments; 26 | Youtube.Related = Related; 27 | Youtube.Playlists = Playlists; 28 | 29 | export declare namespace Youtube { 30 | export { Channel as Channel, type ChannelListResponse as ChannelListResponse }; 31 | 32 | export { 33 | Videos as Videos, 34 | type VideoRetrieveResponse as VideoRetrieveResponse, 35 | type VideoListResponse as VideoListResponse, 36 | type VideoListParams as VideoListParams, 37 | }; 38 | 39 | export { Comments as Comments, type CommentRetrieveResponse as CommentRetrieveResponse }; 40 | 41 | export { 42 | Related as Related, 43 | type RelatedListResponse as RelatedListResponse, 44 | type RelatedListParams as RelatedListParams, 45 | }; 46 | 47 | export { 48 | Playlists as Playlists, 49 | type PlaylistRetrieveResponse as PlaylistRetrieveResponse, 50 | type PlaylistListResponse as PlaylistListResponse, 51 | type PlaylistListParams as PlaylistListParams, 52 | }; 53 | } 54 | -------------------------------------------------------------------------------- /src/resources/reset-db.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../resource'; 4 | import * as Core from '../core'; 5 | 6 | export class ResetDB extends APIResource { 7 | /** 8 | * ⚠️ DANGER ⚠️ 9 | * 10 | * This API endpoint is a potentially destructive operation designed to allow users 11 | * to drop or delete an entire database associated with their account or 12 | * application. 13 | * 14 | * _**It should be used with caution as it permanently deletes all data stored in 15 | * the specified database.**_ 16 | */ 17 | delete(options?: Core.RequestOptions): Core.APIPromise { 18 | return this._client.delete('/reset-db', options); 19 | } 20 | } 21 | 22 | export interface ResetDBDeleteResponse { 23 | data?: unknown | null; 24 | 25 | message?: string; 26 | 27 | statusCode?: number; 28 | 29 | success?: boolean; 30 | } 31 | 32 | export declare namespace ResetDB { 33 | export { type ResetDBDeleteResponse as ResetDBDeleteResponse }; 34 | } 35 | -------------------------------------------------------------------------------- /src/resources/seed/chat-app.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class ChatApp extends APIResource { 7 | /** 8 | * This API endpoint is responsible for populating all the essential entities 9 | * required for a chat app service in the database. It provides a convenient way 10 | * for developers to initialize the chat app with dummy or sample data for testing 11 | * or development purposes. 12 | */ 13 | create(options?: Core.RequestOptions): Core.APIPromise { 14 | return this._client.post('/seed/chat-app', options); 15 | } 16 | } 17 | 18 | export interface ChatAppCreateResponse { 19 | data?: unknown; 20 | 21 | message?: string; 22 | 23 | statusCode?: number; 24 | 25 | success?: boolean; 26 | } 27 | 28 | export declare namespace ChatApp { 29 | export { type ChatAppCreateResponse as ChatAppCreateResponse }; 30 | } 31 | -------------------------------------------------------------------------------- /src/resources/seed/ecommerce.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class Ecommerce extends APIResource { 7 | /** 8 | * This API endpoint is responsible for populating all the essential entities 9 | * required for an ecommerce service in the database. 10 | * 11 | * It provides a convenient way for developers to initialize the ecommerce system 12 | * with dummy or sample data for testing or development purposes. 13 | */ 14 | create(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.post('/seed/ecommerce', options); 16 | } 17 | } 18 | 19 | export interface EcommerceCreateResponse { 20 | data?: unknown; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export declare namespace Ecommerce { 30 | export { type EcommerceCreateResponse as EcommerceCreateResponse }; 31 | } 32 | -------------------------------------------------------------------------------- /src/resources/seed/generated-credentials.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class GeneratedCredentials extends APIResource { 7 | /** 8 | * This API serves a JSON file containing a collection of dummy usernames and their 9 | * corresponding raw passwords. 10 | * 11 | * It is primarily designed to assist developers during the database seeding 12 | * process and provide a convenient way to access the raw passwords for testing or 13 | * development purposes. 14 | */ 15 | list(options?: Core.RequestOptions): Core.APIPromise { 16 | return this._client.get('/seed/generated-credentials', options); 17 | } 18 | } 19 | 20 | export interface GeneratedCredentialListResponse { 21 | data?: Array; 22 | 23 | message?: string; 24 | 25 | statusCode?: number; 26 | 27 | success?: boolean; 28 | } 29 | 30 | export namespace GeneratedCredentialListResponse { 31 | export interface Data { 32 | password?: string; 33 | 34 | role?: string; 35 | 36 | username?: string; 37 | } 38 | } 39 | 40 | export declare namespace GeneratedCredentials { 41 | export { type GeneratedCredentialListResponse as GeneratedCredentialListResponse }; 42 | } 43 | -------------------------------------------------------------------------------- /src/resources/seed/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { ChatApp, type ChatAppCreateResponse } from './chat-app'; 4 | export { Ecommerce, type EcommerceCreateResponse } from './ecommerce'; 5 | export { GeneratedCredentials, type GeneratedCredentialListResponse } from './generated-credentials'; 6 | export { Seed } from './seed'; 7 | export { SocialMedia, type SocialMediaCreateResponse } from './social-media'; 8 | export { Todos, type TodoCreateResponse } from './todos'; 9 | -------------------------------------------------------------------------------- /src/resources/seed/seed.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as ChatAppAPI from './chat-app'; 5 | import { ChatApp, ChatAppCreateResponse } from './chat-app'; 6 | import * as EcommerceAPI from './ecommerce'; 7 | import { Ecommerce, EcommerceCreateResponse } from './ecommerce'; 8 | import * as GeneratedCredentialsAPI from './generated-credentials'; 9 | import { GeneratedCredentialListResponse, GeneratedCredentials } from './generated-credentials'; 10 | import * as SocialMediaAPI from './social-media'; 11 | import { SocialMedia, SocialMediaCreateResponse } from './social-media'; 12 | import * as TodosAPI from './todos'; 13 | import { TodoCreateResponse, Todos } from './todos'; 14 | 15 | export class Seed extends APIResource { 16 | generatedCredentials: GeneratedCredentialsAPI.GeneratedCredentials = 17 | new GeneratedCredentialsAPI.GeneratedCredentials(this._client); 18 | todos: TodosAPI.Todos = new TodosAPI.Todos(this._client); 19 | ecommerce: EcommerceAPI.Ecommerce = new EcommerceAPI.Ecommerce(this._client); 20 | socialMedia: SocialMediaAPI.SocialMedia = new SocialMediaAPI.SocialMedia(this._client); 21 | chatApp: ChatAppAPI.ChatApp = new ChatAppAPI.ChatApp(this._client); 22 | } 23 | 24 | Seed.GeneratedCredentials = GeneratedCredentials; 25 | Seed.Todos = Todos; 26 | Seed.Ecommerce = Ecommerce; 27 | Seed.SocialMedia = SocialMedia; 28 | Seed.ChatApp = ChatApp; 29 | 30 | export declare namespace Seed { 31 | export { 32 | GeneratedCredentials as GeneratedCredentials, 33 | type GeneratedCredentialListResponse as GeneratedCredentialListResponse, 34 | }; 35 | 36 | export { Todos as Todos, type TodoCreateResponse as TodoCreateResponse }; 37 | 38 | export { Ecommerce as Ecommerce, type EcommerceCreateResponse as EcommerceCreateResponse }; 39 | 40 | export { SocialMedia as SocialMedia, type SocialMediaCreateResponse as SocialMediaCreateResponse }; 41 | 42 | export { ChatApp as ChatApp, type ChatAppCreateResponse as ChatAppCreateResponse }; 43 | } 44 | -------------------------------------------------------------------------------- /src/resources/seed/social-media.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class SocialMedia extends APIResource { 7 | /** 8 | * This API endpoint is responsible for populating all the essential entities 9 | * required for a social media app service in the database. 10 | * 11 | * It provides a convenient way for developers to initialize the social media app 12 | * with dummy or sample data for testing or development purposes. 13 | */ 14 | create(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.post('/seed/social-media', options); 16 | } 17 | } 18 | 19 | export interface SocialMediaCreateResponse { 20 | data?: unknown; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export declare namespace SocialMedia { 30 | export { type SocialMediaCreateResponse as SocialMediaCreateResponse }; 31 | } 32 | -------------------------------------------------------------------------------- /src/resources/seed/todos.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import * as Core from '../../core'; 5 | 6 | export class Todos extends APIResource { 7 | /** 8 | * This API endpoint is responsible for populating the database with dummy todo 9 | * items. 10 | * 11 | * It allows developers to easily seed the database with a set of predefined todos 12 | * for testing or development purposes. 13 | */ 14 | create(options?: Core.RequestOptions): Core.APIPromise { 15 | return this._client.post('/seed/todos', options); 16 | } 17 | } 18 | 19 | export interface TodoCreateResponse { 20 | data?: unknown; 21 | 22 | message?: string; 23 | 24 | statusCode?: number; 25 | 26 | success?: boolean; 27 | } 28 | 29 | export declare namespace Todos { 30 | export { type TodoCreateResponse as TodoCreateResponse }; 31 | } 32 | -------------------------------------------------------------------------------- /src/resources/social-media/follow/follow.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../../resource'; 4 | import * as FollowersAPI from './followers'; 5 | import { FollowerListParams, FollowerListResponse, Followers } from './followers'; 6 | import * as FollowingAPI from './following'; 7 | import { Following, FollowingListParams, FollowingListResponse } from './following'; 8 | 9 | export class Follow extends APIResource { 10 | followers: FollowersAPI.Followers = new FollowersAPI.Followers(this._client); 11 | following: FollowingAPI.Following = new FollowingAPI.Following(this._client); 12 | } 13 | 14 | Follow.Followers = Followers; 15 | Follow.Following = Following; 16 | 17 | export declare namespace Follow { 18 | export { 19 | Followers as Followers, 20 | type FollowerListResponse as FollowerListResponse, 21 | type FollowerListParams as FollowerListParams, 22 | }; 23 | 24 | export { 25 | Following as Following, 26 | type FollowingListResponse as FollowingListResponse, 27 | type FollowingListParams as FollowingListParams, 28 | }; 29 | } 30 | -------------------------------------------------------------------------------- /src/resources/social-media/follow/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Follow } from './follow'; 4 | export { Followers, type FollowerListResponse, type FollowerListParams } from './followers'; 5 | export { Following, type FollowingListResponse, type FollowingListParams } from './following'; 6 | -------------------------------------------------------------------------------- /src/resources/social-media/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { 4 | Bookmarks, 5 | type BookmarkCreateResponse, 6 | type BookmarkRetrieveResponse, 7 | type BookmarkRetrieveParams, 8 | } from './bookmarks'; 9 | export { 10 | Comments, 11 | type CommentCreateResponse, 12 | type CommentUpdateResponse, 13 | type CommentListResponse, 14 | type CommentDeleteResponse, 15 | type CommentLikeResponse, 16 | type CommentCreateParams, 17 | type CommentUpdateParams, 18 | type CommentListParams, 19 | } from './comments'; 20 | export { Follow } from './follow/index'; 21 | export { 22 | Posts, 23 | type PostCreateResponse, 24 | type PostRetrieveResponse, 25 | type PostUpdateResponse, 26 | type PostListResponse, 27 | type PostDeleteResponse, 28 | type PostLikeResponse, 29 | type PostCreateParams, 30 | type PostUpdateParams, 31 | type PostListParams, 32 | } from './posts/index'; 33 | export { 34 | Profile, 35 | type ProfileRetrieveResponse, 36 | type ProfileUpdateResponse, 37 | type ProfileUpdateParams, 38 | } from './profile/index'; 39 | export { SocialMedia } from './social-media'; 40 | -------------------------------------------------------------------------------- /src/resources/social-media/posts/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Images, type ImageRemoveResponse } from './images'; 4 | export { My, type MyListResponse, type MyListParams } from './my'; 5 | export { 6 | Posts, 7 | type PostCreateResponse, 8 | type PostRetrieveResponse, 9 | type PostUpdateResponse, 10 | type PostListResponse, 11 | type PostDeleteResponse, 12 | type PostLikeResponse, 13 | type PostCreateParams, 14 | type PostUpdateParams, 15 | type PostListParams, 16 | } from './posts'; 17 | export { Tag, type TagListResponse, type TagListParams } from './tag'; 18 | export { UserPosts, type UserPostListResponse, type UserPostListParams } from './user-posts'; 19 | -------------------------------------------------------------------------------- /src/resources/social-media/profile/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { CoverImage, type CoverImageUpdateResponse, type CoverImageUpdateParams } from './cover-image'; 4 | export { 5 | Profile, 6 | type ProfileRetrieveResponse, 7 | type ProfileUpdateResponse, 8 | type ProfileUpdateParams, 9 | } from './profile'; 10 | -------------------------------------------------------------------------------- /src/resources/users/avatar.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { APIResource } from '../../resource'; 4 | import { isRequestOptions } from '../../core'; 5 | import * as Core from '../../core'; 6 | 7 | export class Avatar extends APIResource { 8 | /** 9 | * The API endpoint enables users to update their avatar or profile picture. 10 | * 11 | * By accessing this endpoint and providing the necessary parameters, users can 12 | * upload a new image file for their desired avatar. 13 | */ 14 | update(body?: AvatarUpdateParams, options?: Core.RequestOptions): Core.APIPromise; 15 | update(options?: Core.RequestOptions): Core.APIPromise; 16 | update( 17 | body: AvatarUpdateParams | Core.RequestOptions = {}, 18 | options?: Core.RequestOptions, 19 | ): Core.APIPromise { 20 | if (isRequestOptions(body)) { 21 | return this.update({}, body); 22 | } 23 | return this._client.patch('/users/avatar', Core.multipartFormRequestOptions({ body, ...options })); 24 | } 25 | } 26 | 27 | export interface AvatarUpdateResponse { 28 | data?: AvatarUpdateResponse.Data; 29 | 30 | message?: string; 31 | 32 | statusCode?: number; 33 | 34 | success?: boolean; 35 | } 36 | 37 | export namespace AvatarUpdateResponse { 38 | export interface Data { 39 | __v?: number; 40 | 41 | _id?: string; 42 | 43 | avatar?: Data.Avatar; 44 | 45 | createdAt?: string; 46 | 47 | email?: string; 48 | 49 | emailVerificationExpiry?: string; 50 | 51 | emailVerificationToken?: string; 52 | 53 | isEmailVerified?: boolean; 54 | 55 | loginType?: string; 56 | 57 | password?: string; 58 | 59 | refreshToken?: string; 60 | 61 | role?: string; 62 | 63 | updatedAt?: string; 64 | 65 | username?: string; 66 | } 67 | 68 | export namespace Data { 69 | export interface Avatar { 70 | _id?: string; 71 | 72 | localPath?: string; 73 | 74 | url?: string; 75 | } 76 | } 77 | } 78 | 79 | export interface AvatarUpdateParams { 80 | /** 81 | * File 82 | */ 83 | avatar?: Core.Uploadable; 84 | } 85 | 86 | export declare namespace Avatar { 87 | export { type AvatarUpdateResponse as AvatarUpdateResponse, type AvatarUpdateParams as AvatarUpdateParams }; 88 | } 89 | -------------------------------------------------------------------------------- /src/resources/users/index.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | export { Avatar, type AvatarUpdateResponse, type AvatarUpdateParams } from './avatar'; 4 | export { 5 | Users, 6 | type UserAssignRoleResponse, 7 | type UserChangePasswordResponse, 8 | type UserForgotPasswordResponse, 9 | type UserRefreshTokenResponse, 10 | type UserResendEmailVerificationResponse, 11 | type UserResetPasswordResponse, 12 | type UserAssignRoleParams, 13 | type UserChangePasswordParams, 14 | type UserForgotPasswordParams, 15 | type UserResetPasswordParams, 16 | } from './users'; 17 | -------------------------------------------------------------------------------- /src/shims/node.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as types from '../_shims/node-types'; 3 | import { setShims } from '../_shims/registry'; 4 | import { getRuntime } from '../_shims/node-runtime'; 5 | setShims(getRuntime()); 6 | 7 | declare module '../_shims/manual-types' { 8 | export namespace manual { 9 | // @ts-ignore 10 | export type Agent = types.Agent; 11 | // @ts-ignore 12 | export import fetch = types.fetch; 13 | // @ts-ignore 14 | export type Request = types.Request; 15 | // @ts-ignore 16 | export type RequestInfo = types.RequestInfo; 17 | // @ts-ignore 18 | export type RequestInit = types.RequestInit; 19 | // @ts-ignore 20 | export type Response = types.Response; 21 | // @ts-ignore 22 | export type ResponseInit = types.ResponseInit; 23 | // @ts-ignore 24 | export type ResponseType = types.ResponseType; 25 | // @ts-ignore 26 | export type BodyInit = types.BodyInit; 27 | // @ts-ignore 28 | export type Headers = types.Headers; 29 | // @ts-ignore 30 | export type HeadersInit = types.HeadersInit; 31 | // @ts-ignore 32 | export type BlobPropertyBag = types.BlobPropertyBag; 33 | // @ts-ignore 34 | export type FilePropertyBag = types.FilePropertyBag; 35 | // @ts-ignore 36 | export type FileFromPathOptions = types.FileFromPathOptions; 37 | // @ts-ignore 38 | export import FormData = types.FormData; 39 | // @ts-ignore 40 | export import File = types.File; 41 | // @ts-ignore 42 | export import Blob = types.Blob; 43 | // @ts-ignore 44 | export type Readable = types.Readable; 45 | // @ts-ignore 46 | export type FsReadStream = types.FsReadStream; 47 | // @ts-ignore 48 | export import ReadableStream = types.ReadableStream; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/shims/web.ts: -------------------------------------------------------------------------------- 1 | // @ts-ignore 2 | import * as types from '../_shims/web-types'; 3 | import { setShims } from '../_shims/registry'; 4 | import { getRuntime } from '../_shims/web-runtime'; 5 | setShims(getRuntime({ manuallyImported: true })); 6 | 7 | declare module '../_shims/manual-types' { 8 | export namespace manual { 9 | // @ts-ignore 10 | export type Agent = types.Agent; 11 | // @ts-ignore 12 | export import fetch = types.fetch; 13 | // @ts-ignore 14 | export type Request = types.Request; 15 | // @ts-ignore 16 | export type RequestInfo = types.RequestInfo; 17 | // @ts-ignore 18 | export type RequestInit = types.RequestInit; 19 | // @ts-ignore 20 | export type Response = types.Response; 21 | // @ts-ignore 22 | export type ResponseInit = types.ResponseInit; 23 | // @ts-ignore 24 | export type ResponseType = types.ResponseType; 25 | // @ts-ignore 26 | export type BodyInit = types.BodyInit; 27 | // @ts-ignore 28 | export type Headers = types.Headers; 29 | // @ts-ignore 30 | export type HeadersInit = types.HeadersInit; 31 | // @ts-ignore 32 | export type BlobPropertyBag = types.BlobPropertyBag; 33 | // @ts-ignore 34 | export type FilePropertyBag = types.FilePropertyBag; 35 | // @ts-ignore 36 | export type FileFromPathOptions = types.FileFromPathOptions; 37 | // @ts-ignore 38 | export import FormData = types.FormData; 39 | // @ts-ignore 40 | export import File = types.File; 41 | // @ts-ignore 42 | export import Blob = types.Blob; 43 | // @ts-ignore 44 | export type Readable = types.Readable; 45 | // @ts-ignore 46 | export type FsReadStream = types.FsReadStream; 47 | // @ts-ignore 48 | export import ReadableStream = types.ReadableStream; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/version.ts: -------------------------------------------------------------------------------- 1 | export const VERSION = '0.1.0-alpha.1'; // x-release-please-version 2 | -------------------------------------------------------------------------------- /tests/api-resources/cart/cart.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource cart', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.cart.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.cart.retrieve({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/chat-app/chats/c.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource c', () => { 9 | test('create', async () => { 10 | const responsePromise = client.chatApp.chats.c.create('64c940d8ffe6c671f4d049d6'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('create: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.chatApp.chats.c.create('64c940d8ffe6c671f4d049d6', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/chat-app/chats/chats.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource chats', () => { 9 | test('list', async () => { 10 | const responsePromise = client.chatApp.chats.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.chatApp.chats.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/chat-app/chats/users.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource users', () => { 9 | test('list', async () => { 10 | const responsePromise = client.chatApp.chats.users.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.chatApp.chats.users.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/chat-app/messages.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource messages', () => { 9 | test('delete', async () => { 10 | const responsePromise = client.chatApp.messages.delete( 11 | '64ce7766307617f3a412b803', 12 | '660c01cef9b076f062b161a8', 13 | ); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('delete: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.chatApp.messages.delete('64ce7766307617f3a412b803', '660c01cef9b076f062b161a8', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Freeapiapp.NotFoundError); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tests/api-resources/chats/chats.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource chats', () => { 9 | test('remove', async () => { 10 | const responsePromise = client.chats.remove('64ce7766307617f3a412b803'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('remove: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.chats.remove('64ce7766307617f3a412b803', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/cart.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource cart', () => { 9 | test('clear', async () => { 10 | const responsePromise = client.ecommerce.cart.clear(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('clear: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.ecommerce.cart.clear({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/coupons/customer-available.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource customerAvailable', () => { 9 | test('list', async () => { 10 | const responsePromise = client.ecommerce.coupons.customerAvailable.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.ecommerce.coupons.customerAvailable.list({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.ecommerce.coupons.customerAvailable.list( 31 | { limit: '5', page: '1' }, 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Freeapiapp.NotFoundError); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/coupons/status.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource status', () => { 9 | test('update', async () => { 10 | const responsePromise = client.ecommerce.coupons.status.update('6489654c8b460248066d8430'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('update: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.ecommerce.coupons.status.update('6489654c8b460248066d8430', { 24 | path: '/_stainless_unknown_path', 25 | }), 26 | ).rejects.toThrow(Freeapiapp.NotFoundError); 27 | }); 28 | 29 | test('update: request options and params are passed correctly', async () => { 30 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 31 | await expect( 32 | client.ecommerce.coupons.status.update( 33 | '6489654c8b460248066d8430', 34 | { isActive: true }, 35 | { path: '/_stainless_unknown_path' }, 36 | ), 37 | ).rejects.toThrow(Freeapiapp.NotFoundError); 38 | }); 39 | }); 40 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/orders/admin.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource admin', () => { 9 | test('list', async () => { 10 | const responsePromise = client.ecommerce.orders.admin.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.ecommerce.orders.admin.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.ecommerce.orders.admin.list( 31 | { limit: '10', page: '2', status: 'PENDING' }, 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Freeapiapp.NotFoundError); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/orders/orders.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource orders', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.ecommerce.orders.retrieve('649e7bfcdbf96264731f5a0c'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.ecommerce.orders.retrieve('649e7bfcdbf96264731f5a0c', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/orders/status.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource status', () => { 9 | test('update', async () => { 10 | const responsePromise = client.ecommerce.orders.status.update('64801f2a81acfc368d253158'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('update: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.ecommerce.orders.status.update('64801f2a81acfc368d253158', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('update: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.ecommerce.orders.status.update( 31 | '64801f2a81acfc368d253158', 32 | { status: 'DELIVERED' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/ecommerce/profile/my-orders.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource myOrders', () => { 9 | test('list', async () => { 10 | const responsePromise = client.ecommerce.profile.myOrders.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.ecommerce.profile.myOrders.list({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.ecommerce.profile.myOrders.list( 31 | { limit: '10', page: '1' }, 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Freeapiapp.NotFoundError); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/api-resources/healthcheck.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource healthcheck', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.healthcheck.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.healthcheck.retrieve({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/request/headers.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource headers', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.request.headers.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.request.headers.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/request/ip.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource ip', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.request.ip.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.request.ip.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/request/path-variable.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource pathVariable', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.request.pathVariable.retrieve('123'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.request.pathVariable.retrieve('123', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/request/query-parameter.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource queryParameter', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.request.queryParameter.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.request.queryParameter.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('retrieve: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.kitchenSink.request.queryParameter.retrieve( 31 | { query1: 'value1', query2: 'value2', query3: 'value3' }, 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Freeapiapp.NotFoundError); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/request/user-agent.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource userAgent', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.request.userAgent.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.request.userAgent.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/response/cache.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource cache', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.response.cache.retrieve('120', 'public'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.response.cache.retrieve('120', 'public', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/response/headers.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource headers', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.response.headers.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.response.headers.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/response/html.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource html', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.response.html.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.response.html.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/response/xml.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource xml', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.response.xml.retrieve(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.response.xml.retrieve({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/kitchen-sink/status-codes.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource statusCodes', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.kitchenSink.statusCodes.retrieve('429'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.kitchenSink.statusCodes.retrieve('429', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list', async () => { 28 | const responsePromise = client.kitchenSink.statusCodes.list(); 29 | const rawResponse = await responsePromise.asResponse(); 30 | expect(rawResponse).toBeInstanceOf(Response); 31 | const response = await responsePromise; 32 | expect(response).not.toBeInstanceOf(Response); 33 | const dataAndResponse = await responsePromise.withResponse(); 34 | expect(dataAndResponse.data).toBe(response); 35 | expect(dataAndResponse.response).toBe(rawResponse); 36 | }); 37 | 38 | test('list: request options instead of params are passed correctly', async () => { 39 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 40 | await expect(client.kitchenSink.statusCodes.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 41 | Freeapiapp.NotFoundError, 42 | ); 43 | }); 44 | }); 45 | -------------------------------------------------------------------------------- /tests/api-resources/products/category.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource category', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.products.category.retrieve('649e792a64e7dba29b7265fe'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.products.category.retrieve('649e792a64e7dba29b7265fe', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('retrieve: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.products.category.retrieve( 31 | '649e792a64e7dba29b7265fe', 32 | { limit: '5', page: '1' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/products/subimage.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource subimage', () => { 9 | test('remove', async () => { 10 | const responsePromise = client.products.subimage.remove( 11 | '647c6059fe873dfa3c256fc3', 12 | '647c69c1912544cbe9cf05a2', 13 | ); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('remove: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.products.subimage.remove('647c6059fe873dfa3c256fc3', '647c69c1912544cbe9cf05a2', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Freeapiapp.NotFoundError); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tests/api-resources/public/cats/cat.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource cat', () => { 9 | test('random', async () => { 10 | const responsePromise = client.public.cats.cat.random(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('random: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.cats.cat.random({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/cats/cats.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource cats', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.public.cats.retrieve('12'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.cats.retrieve('12', { path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | 27 | test('list', async () => { 28 | const responsePromise = client.public.cats.list(); 29 | const rawResponse = await responsePromise.asResponse(); 30 | expect(rawResponse).toBeInstanceOf(Response); 31 | const response = await responsePromise; 32 | expect(response).not.toBeInstanceOf(Response); 33 | const dataAndResponse = await responsePromise.withResponse(); 34 | expect(dataAndResponse.data).toBe(response); 35 | expect(dataAndResponse.response).toBe(rawResponse); 36 | }); 37 | 38 | test('list: request options instead of params are passed correctly', async () => { 39 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 40 | await expect(client.public.cats.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 41 | Freeapiapp.NotFoundError, 42 | ); 43 | }); 44 | 45 | test('list: request options and params are passed correctly', async () => { 46 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 47 | await expect( 48 | client.public.cats.list( 49 | { limit: '10', page: '1', query: 'sociable' }, 50 | { path: '/_stainless_unknown_path' }, 51 | ), 52 | ).rejects.toThrow(Freeapiapp.NotFoundError); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /tests/api-resources/public/dogs/dog.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource dog', () => { 9 | test('random', async () => { 10 | const responsePromise = client.public.dogs.dog.random(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('random: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.dogs.dog.random({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/dogs/dogs.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource dogs', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.public.dogs.retrieve('124'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.dogs.retrieve('124', { path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | 27 | test('list', async () => { 28 | const responsePromise = client.public.dogs.list(); 29 | const rawResponse = await responsePromise.asResponse(); 30 | expect(rawResponse).toBeInstanceOf(Response); 31 | const response = await responsePromise; 32 | expect(response).not.toBeInstanceOf(Response); 33 | const dataAndResponse = await responsePromise.withResponse(); 34 | expect(dataAndResponse.data).toBe(response); 35 | expect(dataAndResponse.response).toBe(rawResponse); 36 | }); 37 | 38 | test('list: request options instead of params are passed correctly', async () => { 39 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 40 | await expect(client.public.dogs.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 41 | Freeapiapp.NotFoundError, 42 | ); 43 | }); 44 | 45 | test('list: request options and params are passed correctly', async () => { 46 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 47 | await expect( 48 | client.public.dogs.list( 49 | { limit: '10', page: '1', query: 'Affenpinscher' }, 50 | { path: '/_stainless_unknown_path' }, 51 | ), 52 | ).rejects.toThrow(Freeapiapp.NotFoundError); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /tests/api-resources/public/meals/meal.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource meal', () => { 9 | test('random', async () => { 10 | const responsePromise = client.public.meals.meal.random(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('random: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.meals.meal.random({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/meals/meals.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource meals', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.public.meals.retrieve('1'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.meals.retrieve('1', { path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | 27 | test('list', async () => { 28 | const responsePromise = client.public.meals.list(); 29 | const rawResponse = await responsePromise.asResponse(); 30 | expect(rawResponse).toBeInstanceOf(Response); 31 | const response = await responsePromise; 32 | expect(response).not.toBeInstanceOf(Response); 33 | const dataAndResponse = await responsePromise.withResponse(); 34 | expect(dataAndResponse.data).toBe(response); 35 | expect(dataAndResponse.response).toBe(rawResponse); 36 | }); 37 | 38 | test('list: request options instead of params are passed correctly', async () => { 39 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 40 | await expect(client.public.meals.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 41 | Freeapiapp.NotFoundError, 42 | ); 43 | }); 44 | 45 | test('list: request options and params are passed correctly', async () => { 46 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 47 | await expect( 48 | client.public.meals.list( 49 | { limit: '10', page: '1', query: 'rice' }, 50 | { path: '/_stainless_unknown_path' }, 51 | ), 52 | ).rejects.toThrow(Freeapiapp.NotFoundError); 53 | }); 54 | }); 55 | -------------------------------------------------------------------------------- /tests/api-resources/public/random-jokes/joke.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource joke', () => { 9 | test('random', async () => { 10 | const responsePromise = client.public.randomJokes.joke.random(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('random: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.randomJokes.joke.random({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/random-products/product.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource product', () => { 9 | test('random', async () => { 10 | const responsePromise = client.public.randomProducts.product.random(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('random: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.public.randomProducts.product.random({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/random-users/random-users.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource randomUsers', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.public.randomUsers.retrieve('13'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.public.randomUsers.retrieve('13', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list', async () => { 28 | const responsePromise = client.public.randomUsers.list(); 29 | const rawResponse = await responsePromise.asResponse(); 30 | expect(rawResponse).toBeInstanceOf(Response); 31 | const response = await responsePromise; 32 | expect(response).not.toBeInstanceOf(Response); 33 | const dataAndResponse = await responsePromise.withResponse(); 34 | expect(dataAndResponse.data).toBe(response); 35 | expect(dataAndResponse.response).toBe(rawResponse); 36 | }); 37 | 38 | test('list: request options instead of params are passed correctly', async () => { 39 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 40 | await expect(client.public.randomUsers.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 41 | Freeapiapp.NotFoundError, 42 | ); 43 | }); 44 | 45 | test('list: request options and params are passed correctly', async () => { 46 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 47 | await expect( 48 | client.public.randomUsers.list({ limit: '10', page: '1' }, { path: '/_stainless_unknown_path' }), 49 | ).rejects.toThrow(Freeapiapp.NotFoundError); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /tests/api-resources/public/random-users/user.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource user', () => { 9 | test('random', async () => { 10 | const responsePromise = client.public.randomUsers.user.random(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('random: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.randomUsers.user.random({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/youtube/channel.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource channel', () => { 9 | test('list', async () => { 10 | const responsePromise = client.public.youtube.channel.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.public.youtube.channel.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/youtube/comments.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource comments', () => { 9 | test('retrieve', async () => { 10 | const responsePromise = client.public.youtube.comments.retrieve('cv-6bAeYsOY'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('retrieve: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.public.youtube.comments.retrieve('cv-6bAeYsOY', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/public/youtube/related.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource related', () => { 9 | test('list', async () => { 10 | const responsePromise = client.public.youtube.related.list('eLyISYdoVac'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.public.youtube.related.list('eLyISYdoVac', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.public.youtube.related.list( 31 | 'eLyISYdoVac', 32 | { limit: '5', page: '1' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/reset-db.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource resetDB', () => { 9 | test('delete', async () => { 10 | const responsePromise = client.resetDB.delete(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('delete: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.resetDB.delete({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/seed/chat-app.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource chatApp', () => { 9 | test('create', async () => { 10 | const responsePromise = client.seed.chatApp.create(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('create: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.seed.chatApp.create({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/seed/ecommerce.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource ecommerce', () => { 9 | test('create', async () => { 10 | const responsePromise = client.seed.ecommerce.create(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('create: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.seed.ecommerce.create({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/seed/generated-credentials.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource generatedCredentials', () => { 9 | test('list', async () => { 10 | const responsePromise = client.seed.generatedCredentials.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.seed.generatedCredentials.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/seed/social-media.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource socialMedia', () => { 9 | test('create', async () => { 10 | const responsePromise = client.seed.socialMedia.create(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('create: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.seed.socialMedia.create({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/seed/todos.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource todos', () => { 9 | test('create', async () => { 10 | const responsePromise = client.seed.todos.create(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('create: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.seed.todos.create({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/bookmarks.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource bookmarks', () => { 9 | test('create', async () => { 10 | const responsePromise = client.socialMedia.bookmarks.create('64ad9c97bab19994fc168932'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('create: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.socialMedia.bookmarks.create('64ad9c97bab19994fc168932', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('retrieve', async () => { 28 | const responsePromise = client.socialMedia.bookmarks.retrieve(); 29 | const rawResponse = await responsePromise.asResponse(); 30 | expect(rawResponse).toBeInstanceOf(Response); 31 | const response = await responsePromise; 32 | expect(response).not.toBeInstanceOf(Response); 33 | const dataAndResponse = await responsePromise.withResponse(); 34 | expect(dataAndResponse.data).toBe(response); 35 | expect(dataAndResponse.response).toBe(rawResponse); 36 | }); 37 | 38 | test('retrieve: request options instead of params are passed correctly', async () => { 39 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 40 | await expect(client.socialMedia.bookmarks.retrieve({ path: '/_stainless_unknown_path' })).rejects.toThrow( 41 | Freeapiapp.NotFoundError, 42 | ); 43 | }); 44 | 45 | test('retrieve: request options and params are passed correctly', async () => { 46 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 47 | await expect( 48 | client.socialMedia.bookmarks.retrieve({ limit: '5', page: '1' }, { path: '/_stainless_unknown_path' }), 49 | ).rejects.toThrow(Freeapiapp.NotFoundError); 50 | }); 51 | }); 52 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/follow/followers.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource followers', () => { 9 | test('list', async () => { 10 | const responsePromise = client.socialMedia.follow.followers.list('abdiel_breitenberg22'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.socialMedia.follow.followers.list('abdiel_breitenberg22', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.socialMedia.follow.followers.list( 31 | 'abdiel_breitenberg22', 32 | { limit: '5', page: '1' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/follow/following.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource following', () => { 9 | test('list', async () => { 10 | const responsePromise = client.socialMedia.follow.following.list('abdiel_breitenberg22'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.socialMedia.follow.following.list('abdiel_breitenberg22', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.socialMedia.follow.following.list( 31 | 'abdiel_breitenberg22', 32 | { limit: '5', page: '1' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/posts/images.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource images', () => { 9 | test('remove', async () => { 10 | const responsePromise = client.socialMedia.posts.images.remove( 11 | '64a3e3bc9d02a1e3d365f06a', 12 | '64a3e45c9d02a1e3d365f08d', 13 | ); 14 | const rawResponse = await responsePromise.asResponse(); 15 | expect(rawResponse).toBeInstanceOf(Response); 16 | const response = await responsePromise; 17 | expect(response).not.toBeInstanceOf(Response); 18 | const dataAndResponse = await responsePromise.withResponse(); 19 | expect(dataAndResponse.data).toBe(response); 20 | expect(dataAndResponse.response).toBe(rawResponse); 21 | }); 22 | 23 | test('remove: request options instead of params are passed correctly', async () => { 24 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 25 | await expect( 26 | client.socialMedia.posts.images.remove('64a3e3bc9d02a1e3d365f06a', '64a3e45c9d02a1e3d365f08d', { 27 | path: '/_stainless_unknown_path', 28 | }), 29 | ).rejects.toThrow(Freeapiapp.NotFoundError); 30 | }); 31 | }); 32 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/posts/my.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource my', () => { 9 | test('list', async () => { 10 | const responsePromise = client.socialMedia.posts.my.list(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.socialMedia.posts.my.list({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.socialMedia.posts.my.list({ limit: '10', page: '1' }, { path: '/_stainless_unknown_path' }), 31 | ).rejects.toThrow(Freeapiapp.NotFoundError); 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/posts/tag.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource tag', () => { 9 | test('list', async () => { 10 | const responsePromise = client.socialMedia.posts.tag.list('dolore'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.socialMedia.posts.tag.list('dolore', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.socialMedia.posts.tag.list( 31 | 'dolore', 32 | { limit: '3', page: '1' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/posts/user-posts.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource userPosts', () => { 9 | test('list', async () => { 10 | const responsePromise = client.socialMedia.posts.userPosts.list('santos82'); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('list: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.socialMedia.posts.userPosts.list('santos82', { path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('list: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.socialMedia.posts.userPosts.list( 31 | 'santos82', 32 | { limit: '3', page: '1' }, 33 | { path: '/_stainless_unknown_path' }, 34 | ), 35 | ).rejects.toThrow(Freeapiapp.NotFoundError); 36 | }); 37 | }); 38 | -------------------------------------------------------------------------------- /tests/api-resources/social-media/profile/cover-image.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp, { toFile } from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource coverImage', () => { 9 | test('update', async () => { 10 | const responsePromise = client.socialMedia.profile.coverImage.update(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('update: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect( 23 | client.socialMedia.profile.coverImage.update({ path: '/_stainless_unknown_path' }), 24 | ).rejects.toThrow(Freeapiapp.NotFoundError); 25 | }); 26 | 27 | test('update: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.socialMedia.profile.coverImage.update( 31 | { coverImage: await toFile(Buffer.from('# my file contents'), 'README.md') }, 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Freeapiapp.NotFoundError); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/api-resources/users/avatar.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import Freeapiapp, { toFile } from 'freeapiapp'; 4 | import { Response } from 'node-fetch'; 5 | 6 | const client = new Freeapiapp({ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010' }); 7 | 8 | describe('resource avatar', () => { 9 | test('update', async () => { 10 | const responsePromise = client.users.avatar.update(); 11 | const rawResponse = await responsePromise.asResponse(); 12 | expect(rawResponse).toBeInstanceOf(Response); 13 | const response = await responsePromise; 14 | expect(response).not.toBeInstanceOf(Response); 15 | const dataAndResponse = await responsePromise.withResponse(); 16 | expect(dataAndResponse.data).toBe(response); 17 | expect(dataAndResponse.response).toBe(rawResponse); 18 | }); 19 | 20 | test('update: request options instead of params are passed correctly', async () => { 21 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 22 | await expect(client.users.avatar.update({ path: '/_stainless_unknown_path' })).rejects.toThrow( 23 | Freeapiapp.NotFoundError, 24 | ); 25 | }); 26 | 27 | test('update: request options and params are passed correctly', async () => { 28 | // ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error 29 | await expect( 30 | client.users.avatar.update( 31 | { avatar: await toFile(Buffer.from('# my file contents'), 'README.md') }, 32 | { path: '/_stainless_unknown_path' }, 33 | ), 34 | ).rejects.toThrow(Freeapiapp.NotFoundError); 35 | }); 36 | }); 37 | -------------------------------------------------------------------------------- /tests/form.test.ts: -------------------------------------------------------------------------------- 1 | import { multipartFormRequestOptions, createForm } from 'freeapiapp/core'; 2 | import { Blob } from 'freeapiapp/_shims/index'; 3 | import { toFile } from 'freeapiapp'; 4 | 5 | describe('form data validation', () => { 6 | test('valid values do not error', async () => { 7 | await multipartFormRequestOptions({ 8 | body: { 9 | foo: 'foo', 10 | string: 1, 11 | bool: true, 12 | file: await toFile(Buffer.from('some-content')), 13 | blob: new Blob(['Some content'], { type: 'text/plain' }), 14 | }, 15 | }); 16 | }); 17 | 18 | test('null', async () => { 19 | await expect(() => 20 | multipartFormRequestOptions({ 21 | body: { 22 | null: null, 23 | }, 24 | }), 25 | ).rejects.toThrow(TypeError); 26 | }); 27 | 28 | test('undefined is stripped', async () => { 29 | const form = await createForm({ 30 | foo: undefined, 31 | bar: 'baz', 32 | }); 33 | expect(form.has('foo')).toBe(false); 34 | expect(form.get('bar')).toBe('baz'); 35 | }); 36 | 37 | test('nested undefined property is stripped', async () => { 38 | const form = await createForm({ 39 | bar: { 40 | baz: undefined, 41 | }, 42 | }); 43 | expect(Array.from(form.entries())).toEqual([]); 44 | 45 | const form2 = await createForm({ 46 | bar: { 47 | foo: 'string', 48 | baz: undefined, 49 | }, 50 | }); 51 | expect(Array.from(form2.entries())).toEqual([['bar[foo]', 'string']]); 52 | }); 53 | 54 | test('nested undefined array item is stripped', async () => { 55 | const form = await createForm({ 56 | bar: [undefined, undefined], 57 | }); 58 | expect(Array.from(form.entries())).toEqual([]); 59 | 60 | const form2 = await createForm({ 61 | bar: [undefined, 'foo'], 62 | }); 63 | expect(Array.from(form2.entries())).toEqual([['bar[]', 'foo']]); 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /tests/responses.test.ts: -------------------------------------------------------------------------------- 1 | import { createResponseHeaders } from 'freeapiapp/core'; 2 | import { Headers } from 'freeapiapp/_shims/index'; 3 | 4 | describe('response parsing', () => { 5 | // TODO: test unicode characters 6 | test('headers are case agnostic', async () => { 7 | const headers = createResponseHeaders(new Headers({ 'Content-Type': 'foo', Accept: 'text/plain' })); 8 | expect(headers['content-type']).toEqual('foo'); 9 | expect(headers['Content-type']).toEqual('foo'); 10 | expect(headers['Content-Type']).toEqual('foo'); 11 | expect(headers['accept']).toEqual('text/plain'); 12 | expect(headers['Accept']).toEqual('text/plain'); 13 | expect(headers['Hello-World']).toBeUndefined(); 14 | }); 15 | 16 | test('duplicate headers are concatenated', () => { 17 | const headers = createResponseHeaders( 18 | new Headers([ 19 | ['Content-Type', 'text/xml'], 20 | ['Content-Type', 'application/json'], 21 | ]), 22 | ); 23 | expect(headers['content-type']).toBe('text/xml, application/json'); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /tests/stringifyQuery.test.ts: -------------------------------------------------------------------------------- 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. 2 | 3 | import { Freeapiapp } from 'freeapiapp'; 4 | 5 | const { stringifyQuery } = Freeapiapp.prototype as any; 6 | 7 | describe(stringifyQuery, () => { 8 | for (const [input, expected] of [ 9 | [{ a: '1', b: 2, c: true }, 'a=1&b=2&c=true'], 10 | [{ a: null, b: false, c: undefined }, 'a=&b=false'], 11 | [{ 'a/b': 1.28341 }, `${encodeURIComponent('a/b')}=1.28341`], 12 | [ 13 | { 'a/b': 'c/d', 'e=f': 'g&h' }, 14 | `${encodeURIComponent('a/b')}=${encodeURIComponent('c/d')}&${encodeURIComponent( 15 | 'e=f', 16 | )}=${encodeURIComponent('g&h')}`, 17 | ], 18 | ]) { 19 | it(`${JSON.stringify(input)} -> ${expected}`, () => { 20 | expect(stringifyQuery(input)).toEqual(expected); 21 | }); 22 | } 23 | 24 | for (const value of [[], {}, new Date()]) { 25 | it(`${JSON.stringify(value)} -> `, () => { 26 | expect(() => stringifyQuery({ value })).toThrow(`Cannot stringify type ${typeof value}`); 27 | }); 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /tests/uploads.test.ts: -------------------------------------------------------------------------------- 1 | import fs from 'fs'; 2 | import { toFile, type ResponseLike } from 'freeapiapp/uploads'; 3 | import { File } from 'freeapiapp/_shims/index'; 4 | 5 | class MyClass { 6 | name: string = 'foo'; 7 | } 8 | 9 | function mockResponse({ url, content }: { url: string; content?: Blob }): ResponseLike { 10 | return { 11 | url, 12 | blob: async () => content as any, 13 | }; 14 | } 15 | 16 | describe('toFile', () => { 17 | it('throws a helpful error for mismatched types', async () => { 18 | await expect( 19 | // @ts-expect-error intentionally mismatched type 20 | toFile({ foo: 'string' }), 21 | ).rejects.toThrowErrorMatchingInlineSnapshot( 22 | `"Unexpected data type: object; constructor: Object; props: ["foo"]"`, 23 | ); 24 | 25 | await expect( 26 | // @ts-expect-error intentionally mismatched type 27 | toFile(new MyClass()), 28 | ).rejects.toThrowErrorMatchingInlineSnapshot( 29 | `"Unexpected data type: object; constructor: MyClass; props: ["name"]"`, 30 | ); 31 | }); 32 | 33 | it('disallows string at the type-level', async () => { 34 | // @ts-expect-error we intentionally do not type support for `string` 35 | // to help people avoid passing a file path 36 | const file = await toFile('contents'); 37 | expect(file.text()).resolves.toEqual('contents'); 38 | }); 39 | 40 | it('extracts a file name from a Response', async () => { 41 | const response = mockResponse({ url: 'https://example.com/my/audio.mp3' }); 42 | const file = await toFile(response); 43 | expect(file.name).toEqual('audio.mp3'); 44 | }); 45 | 46 | it('extracts a file name from a File', async () => { 47 | const input = new File(['foo'], 'input.jsonl'); 48 | const file = await toFile(input); 49 | expect(file.name).toEqual('input.jsonl'); 50 | }); 51 | 52 | it('extracts a file name from a ReadStream', async () => { 53 | const input = fs.createReadStream('tests/uploads.test.ts'); 54 | const file = await toFile(input); 55 | expect(file.name).toEqual('uploads.test.ts'); 56 | }); 57 | 58 | it('does not copy File objects', async () => { 59 | const input = new File(['foo'], 'input.jsonl', { type: 'jsonl' }); 60 | const file = await toFile(input); 61 | expect(file).toBe(input); 62 | expect(file.name).toEqual('input.jsonl'); 63 | expect(file.type).toBe('jsonl'); 64 | }); 65 | }); 66 | -------------------------------------------------------------------------------- /tsc-multi.json: -------------------------------------------------------------------------------- 1 | { 2 | "targets": [ 3 | { "extname": ".js", "module": "commonjs" }, 4 | { "extname": ".mjs", "module": "esnext" } 5 | ], 6 | "projects": ["tsconfig.build.json"] 7 | } 8 | -------------------------------------------------------------------------------- /tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["dist/src"], 4 | "exclude": ["dist/src/_shims/*-deno.ts"], 5 | "compilerOptions": { 6 | "rootDir": "./dist/src", 7 | "paths": { 8 | "freeapiapp/*": ["dist/src/*"], 9 | "freeapiapp": ["dist/src/index.ts"], 10 | }, 11 | "noEmit": false, 12 | "declaration": true, 13 | "declarationMap": true, 14 | "outDir": "dist", 15 | "pretty": true, 16 | "sourceMap": true 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /tsconfig.deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": ["dist-deno"], 4 | "exclude": [], 5 | "compilerOptions": { 6 | "rootDir": "./dist-deno", 7 | "lib": ["es2020", "DOM"], 8 | "noEmit": true, 9 | "declaration": true, 10 | "declarationMap": true, 11 | "outDir": "dist-deno", 12 | "pretty": true, 13 | "sourceMap": true 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tsconfig.dist-src.json: -------------------------------------------------------------------------------- 1 | { 2 | // this config is included in the published src directory to prevent TS errors 3 | // from appearing when users go to source, and VSCode opens the source .ts file 4 | // via declaration maps 5 | "include": ["index.ts"], 6 | "compilerOptions": { 7 | "target": "es2015", 8 | "lib": ["DOM"], 9 | "moduleResolution": "node" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "include": ["src", "tests", "examples"], 3 | "exclude": ["src/_shims/**/*-deno.ts"], 4 | "compilerOptions": { 5 | "target": "es2020", 6 | "lib": ["es2020"], 7 | "module": "commonjs", 8 | "moduleResolution": "node", 9 | "esModuleInterop": true, 10 | "baseUrl": "./", 11 | "paths": { 12 | "freeapiapp/_shims/auto/*": ["src/_shims/auto/*-node"], 13 | "freeapiapp/*": ["src/*"], 14 | "freeapiapp": ["src/index.ts"] 15 | }, 16 | "noEmit": true, 17 | 18 | "resolveJsonModule": true, 19 | 20 | "forceConsistentCasingInFileNames": true, 21 | 22 | "strict": true, 23 | "noImplicitAny": true, 24 | "strictNullChecks": true, 25 | "strictFunctionTypes": true, 26 | "strictBindCallApply": true, 27 | "strictPropertyInitialization": true, 28 | "noImplicitThis": true, 29 | "noImplicitReturns": true, 30 | "alwaysStrict": true, 31 | "exactOptionalPropertyTypes": true, 32 | "noUncheckedIndexedAccess": true, 33 | "noImplicitOverride": true, 34 | "noPropertyAccessFromIndexSignature": true, 35 | "isolatedModules": false, 36 | 37 | "skipLibCheck": true 38 | } 39 | } 40 | --------------------------------------------------------------------------------