├── .circleci └── config.yml ├── .github ├── ISSUE_TEMPLATE │ ├── bug-report.md │ ├── documentation.md │ ├── feature-request.md │ └── general-issue.md ├── pull_request_template.md └── stale.yml ├── .gitignore ├── CHANGELOG.md ├── CODE-OF-CONDUCT.md ├── GENERAL-CONTRIBUTING.md ├── README.md ├── Reloadly.sln ├── SAMPLE-CODE.md ├── node-sdk-airtime ├── USAGE.md ├── src │ ├── .gitignore │ ├── Airtime.d.ts │ ├── Airtime.js │ ├── Airtime.js.map │ ├── Airtime.ts │ ├── AirtimeApi.d.ts │ ├── AirtimeApi.js │ ├── AirtimeApi.js.map │ ├── AirtimeApi.ts │ ├── README.md │ ├── dto │ │ ├── request │ │ │ ├── EmailTopupRequest.d.ts │ │ │ ├── EmailTopupRequest.js │ │ │ ├── EmailTopupRequest.js.map │ │ │ ├── EmailTopupRequest.ts │ │ │ ├── PhoneTopupRequest.d.ts │ │ │ ├── PhoneTopupRequest.js │ │ │ ├── PhoneTopupRequest.js.map │ │ │ ├── PhoneTopupRequest.ts │ │ │ ├── TopupRequest.d.ts │ │ │ ├── TopupRequest.js │ │ │ ├── TopupRequest.js.map │ │ │ └── TopupRequest.ts │ │ └── response │ │ │ ├── AccountBalanceInfo.d.ts │ │ │ ├── AccountBalanceInfo.js │ │ │ ├── AccountBalanceInfo.js.map │ │ │ ├── AccountBalanceInfo.ts │ │ │ ├── Country.d.ts │ │ │ ├── Country.js │ │ │ ├── Country.js.map │ │ │ ├── Country.ts │ │ │ ├── Discount.d.ts │ │ │ ├── Discount.js │ │ │ ├── Discount.js.map │ │ │ ├── Discount.ts │ │ │ ├── FxRate.d.ts │ │ │ ├── FxRate.js │ │ │ ├── FxRate.js.map │ │ │ ├── FxRate.ts │ │ │ ├── Operator.d.ts │ │ │ ├── Operator.js │ │ │ ├── Operator.js.map │ │ │ ├── Operator.ts │ │ │ ├── OperatorFxRate.d.ts │ │ │ ├── OperatorFxRate.js │ │ │ ├── OperatorFxRate.js.map │ │ │ ├── OperatorFxRate.ts │ │ │ ├── Phone.d.ts │ │ │ ├── Phone.js │ │ │ ├── Phone.js.map │ │ │ ├── Phone.ts │ │ │ ├── PinDetail.d.ts │ │ │ ├── PinDetail.js │ │ │ ├── PinDetail.js.map │ │ │ ├── PinDetail.ts │ │ │ ├── Promotion.d.ts │ │ │ ├── Promotion.js │ │ │ ├── Promotion.js.map │ │ │ ├── Promotion.ts │ │ │ ├── SimplifiedCountry.d.ts │ │ │ ├── SimplifiedCountry.js │ │ │ ├── SimplifiedCountry.js.map │ │ │ ├── SimplifiedCountry.ts │ │ │ ├── SimplifiedOperator.d.ts │ │ │ ├── SimplifiedOperator.js │ │ │ ├── SimplifiedOperator.js.map │ │ │ ├── SimplifiedOperator.ts │ │ │ ├── TopupTransaction.d.ts │ │ │ ├── TopupTransaction.js │ │ │ ├── TopupTransaction.js.map │ │ │ ├── TopupTransaction.ts │ │ │ ├── TransactionBalanceInfo.d.ts │ │ │ ├── TransactionBalanceInfo.js │ │ │ ├── TransactionBalanceInfo.js.map │ │ │ └── TransactionBalanceInfo.ts │ ├── enums │ │ ├── DenominationType.d.ts │ │ ├── DenominationType.js │ │ ├── DenominationType.js.map │ │ └── DenominationType.ts │ ├── filter │ │ ├── OperatorFilter.d.ts │ │ ├── OperatorFilter.js │ │ ├── OperatorFilter.js.map │ │ ├── OperatorFilter.ts │ │ ├── TransactionHistoryFilter.d.ts │ │ ├── TransactionHistoryFilter.js │ │ ├── TransactionHistoryFilter.js.map │ │ └── TransactionHistoryFilter.ts │ ├── internal │ │ └── dto │ │ │ └── request │ │ │ ├── FxRateRequest.d.ts │ │ │ ├── FxRateRequest.js │ │ │ ├── FxRateRequest.js.map │ │ │ └── FxRateRequest.ts │ ├── operation │ │ ├── AccountOperations.d.ts │ │ ├── AccountOperations.js │ │ ├── AccountOperations.js.map │ │ ├── AccountOperations.ts │ │ ├── BaseAirtimeOperation.d.ts │ │ ├── BaseAirtimeOperation.js │ │ ├── BaseAirtimeOperation.js.map │ │ ├── BaseAirtimeOperation.ts │ │ ├── CountryOperations.d.ts │ │ ├── CountryOperations.js │ │ ├── CountryOperations.js.map │ │ ├── CountryOperations.ts │ │ ├── DiscountOperations.d.ts │ │ ├── DiscountOperations.js │ │ ├── DiscountOperations.js.map │ │ ├── DiscountOperations.ts │ │ ├── OperatorOperations.d.ts │ │ ├── OperatorOperations.js │ │ ├── OperatorOperations.js.map │ │ ├── OperatorOperations.ts │ │ ├── PromotionOperations.d.ts │ │ ├── PromotionOperations.js │ │ ├── PromotionOperations.js.map │ │ ├── PromotionOperations.ts │ │ ├── ReportOperations.d.ts │ │ ├── ReportOperations.js │ │ ├── ReportOperations.js.map │ │ ├── ReportOperations.ts │ │ ├── TopupOperations.d.ts │ │ ├── TopupOperations.js │ │ ├── TopupOperations.js.map │ │ ├── TopupOperations.ts │ │ ├── TransactionHistoryOperations.d.ts │ │ ├── TransactionHistoryOperations.js │ │ ├── TransactionHistoryOperations.js.map │ │ └── TransactionHistoryOperations.ts │ ├── package-lock.json │ ├── package.json │ ├── reloadly.airtime.njsproj │ ├── test │ │ ├── AccountOperationsTests.d.ts │ │ ├── AccountOperationsTests.js │ │ ├── AccountOperationsTests.js.map │ │ ├── AccountOperationsTests.ts │ │ ├── CountryOperationsTests.d.ts │ │ ├── CountryOperationsTests.js │ │ ├── CountryOperationsTests.js.map │ │ ├── CountryOperationsTests.ts │ │ ├── DiscountOperationsTests.d.ts │ │ ├── DiscountOperationsTests.js │ │ ├── DiscountOperationsTests.js.map │ │ ├── DiscountOperationsTests.ts │ │ ├── OperatorOperationsTests.d.ts │ │ ├── OperatorOperationsTests.js │ │ ├── OperatorOperationsTests.js.map │ │ ├── OperatorOperationsTests.ts │ │ ├── PromotionOperationsTests.d.ts │ │ ├── PromotionOperationsTests.js │ │ ├── PromotionOperationsTests.js.map │ │ ├── PromotionOperationsTests.ts │ │ ├── TestCredentials.d.ts │ │ ├── TestCredentials.js │ │ ├── TestCredentials.js.map │ │ ├── TestCredentials.ts │ │ ├── TopupOperationsTests.d.ts │ │ ├── TopupOperationsTests.js │ │ ├── TopupOperationsTests.js.map │ │ ├── TopupOperationsTests.ts │ │ ├── TransactionHistoryOperationsTests.d.ts │ │ ├── TransactionHistoryOperationsTests.js │ │ ├── TransactionHistoryOperationsTests.js.map │ │ └── TransactionHistoryOperationsTests.ts │ └── tsconfig.json └── usage │ ├── ACCOUNT-OPERATIONS.md │ ├── COUNTRY-OPERATIONS.md │ ├── DISCOUNT-OPERATIONS.md │ ├── OPERATOR-OPERATIONS.md │ ├── PROMOTION-OPERATIONS.md │ ├── REPORT-OPERATIONS.md │ └── TOPUP-OPERATIONS.md ├── node-sdk-authentication ├── USAGE.md └── src │ ├── .gitignore │ ├── Authentication.d.ts │ ├── Authentication.js │ ├── Authentication.js.map │ ├── Authentication.ts │ ├── Client │ ├── AuthenticationApi.d.ts │ ├── AuthenticationApi.js │ ├── AuthenticationApi.js.map │ ├── AuthenticationApi.ts │ ├── OAuth2ClientCredentialsOperation.d.ts │ ├── OAuth2ClientCredentialsOperation.js │ ├── OAuth2ClientCredentialsOperation.js.map │ └── OAuth2ClientCredentialsOperation.ts │ ├── README.md │ ├── Request │ ├── IOAuth2ClientCredentialsRequest.d.ts │ ├── IOAuth2ClientCredentialsRequest.js │ ├── IOAuth2ClientCredentialsRequest.js.map │ ├── IOAuth2ClientCredentialsRequest.ts │ ├── TokenRequest.d.ts │ ├── TokenRequest.js │ ├── TokenRequest.js.map │ └── TokenRequest.ts │ ├── Response │ ├── TokenHolder.d.ts │ ├── TokenHolder.js │ ├── TokenHolder.js.map │ └── TokenHolder.ts │ ├── package-lock.json │ ├── package.json │ ├── reloadly.authentication.njsproj │ ├── test │ ├── AuthenticationApiTests.d.ts │ ├── AuthenticationApiTests.js │ ├── AuthenticationApiTests.js.map │ ├── AuthenticationApiTests.ts │ ├── TestCredentials.d.ts │ ├── TestCredentials.js │ ├── TestCredentials.js.map │ └── TestCredentials.ts │ └── tsconfig.json ├── node-sdk-core └── src │ ├── Constant │ ├── ServiceURLs.d.ts │ ├── ServiceURLs.js │ ├── ServiceURLs.js.map │ └── ServiceURLs.ts │ ├── Core.d.ts │ ├── Core.js │ ├── Core.js.map │ ├── Core.ts │ ├── Dto │ ├── APIError.ts │ ├── ApiError.d.ts │ ├── ApiError.js │ ├── ApiError.js.map │ └── Response │ │ ├── Page.d.ts │ │ ├── Page.js │ │ ├── Page.js.map │ │ └── Page.ts │ ├── Enums │ ├── Environment.d.ts │ ├── Environment.js │ ├── Environment.js.map │ ├── Environment.ts │ ├── Service.d.ts │ ├── Service.js │ ├── Service.js.map │ └── Service.ts │ ├── Exception │ ├── APIException.ts │ ├── ApiException.d.ts │ ├── ApiException.js │ ├── ApiException.js.map │ ├── OAuth │ │ ├── OAuthException.d.ts │ │ ├── OAuthException.js │ │ ├── OAuthException.js.map │ │ └── OAuthException.ts │ ├── RateLimitException.d.ts │ ├── RateLimitException.js │ ├── RateLimitException.js.map │ ├── RateLimitException.ts │ ├── ReloadlyException.d.ts │ ├── ReloadlyException.js │ ├── ReloadlyException.js.map │ └── ReloadlyException.ts │ ├── Internal │ ├── Client │ │ ├── BaseOperation.d.ts │ │ ├── BaseOperation.js │ │ ├── BaseOperation.js.map │ │ └── BaseOperation.ts │ ├── Constant │ │ ├── Auth.d.ts │ │ ├── Auth.js │ │ ├── Auth.js.map │ │ ├── Auth.ts │ │ ├── GrantType.d.ts │ │ ├── GrantType.js │ │ ├── GrantType.js.map │ │ ├── GrantType.ts │ │ ├── HttpHeader.d.ts │ │ ├── HttpHeader.js │ │ ├── HttpHeader.js.map │ │ ├── HttpHeader.ts │ │ ├── MediaType.d.ts │ │ ├── MediaType.js │ │ ├── MediaType.js.map │ │ └── MediaType.ts │ ├── Dto │ │ └── Request │ │ │ ├── BaseRequest.d.ts │ │ │ ├── BaseRequest.js │ │ │ ├── BaseRequest.js.map │ │ │ ├── BaseRequest.ts │ │ │ ├── CustomRequest.d.ts │ │ │ ├── CustomRequest.js │ │ │ ├── CustomRequest.js.map │ │ │ ├── CustomRequest.ts │ │ │ ├── ICustomizableRequest.d.ts │ │ │ ├── ICustomizableRequest.js │ │ │ ├── ICustomizableRequest.js.map │ │ │ ├── ICustomizableRequest.ts │ │ │ ├── Interfaces │ │ │ ├── IRequest.d.ts │ │ │ ├── IRequest.js │ │ │ ├── IRequest.js.map │ │ │ └── IRequest.ts │ │ │ ├── ProxyOptions.d.ts │ │ │ ├── ProxyOptions.js │ │ │ ├── ProxyOptions.js.map │ │ │ ├── ProxyOptions.ts │ │ │ ├── ProxyOptionsAuth.d.ts │ │ │ ├── ProxyOptionsAuth.js │ │ │ ├── ProxyOptionsAuth.js.map │ │ │ └── ProxyOptionsAuth.ts │ ├── Enums │ │ ├── Version.d.ts │ │ ├── Version.js │ │ ├── Version.js.map │ │ └── Version.ts │ ├── Filter │ │ ├── BaseFilter.d.ts │ │ ├── BaseFilter.js │ │ ├── BaseFilter.js.map │ │ ├── BaseFilter.ts │ │ ├── QueryFilter.d.ts │ │ ├── QueryFilter.js │ │ ├── QueryFilter.js.map │ │ └── QueryFilter.ts │ ├── Net │ │ ├── Api.d.ts │ │ ├── Api.js │ │ ├── Api.js.map │ │ ├── Api.ts │ │ ├── ServiceApi.d.ts │ │ ├── ServiceApi.js │ │ ├── ServiceApi.js.map │ │ ├── ServiceApi.ts │ │ ├── Telemetry.d.ts │ │ ├── Telemetry.js │ │ ├── Telemetry.js.map │ │ └── Telemetry.ts │ └── Util │ │ ├── ExceptionUtil.d.ts │ │ ├── ExceptionUtil.js │ │ ├── ExceptionUtil.js.map │ │ ├── ExceptionUtil.ts │ │ ├── TelemetryUtil.d.ts │ │ ├── TelemetryUtil.js │ │ ├── TelemetryUtil.js.map │ │ └── TelemetryUtil.ts │ ├── README.md │ ├── package-lock.json │ ├── package.json │ ├── reloadly.core.njsproj │ ├── test │ ├── CustomRequestTests.d.ts │ ├── CustomRequestTests.js │ ├── CustomRequestTests.js.map │ ├── CustomRequestTests.ts │ ├── ExceptionUtilTests.d.ts │ ├── ExceptionUtilTests.js │ ├── ExceptionUtilTests.js.map │ ├── ExceptionUtilTests.ts │ ├── OAuthExceptionTests.d.ts │ ├── OAuthExceptionTests.js │ ├── OAuthExceptionTests.js.map │ ├── OAuthExceptionTests.ts │ ├── TelemetryUtilTests.d.ts │ ├── TelemetryUtilTests.js │ ├── TelemetryUtilTests.js.map │ └── TelemetryUtilTests.ts │ └── tsconfig.json ├── package-lock.json └── reloadly-example ├── .gitignore ├── README.md ├── USAGE.md ├── app.js ├── app.js.map ├── app.ts ├── package-lock.json ├── package.json ├── public └── stylesheets │ └── main.css ├── reloadly-example.njsproj ├── routes ├── ExampleClass.js ├── ExampleClass.js.map ├── auth.js ├── auth.js.map ├── auth.ts ├── auth_refresh_token.js ├── auth_refresh_token.js.map ├── auth_refresh_token.ts ├── auth_refreshtoken.js ├── auth_refreshtoken.js.map ├── balance.js ├── balance.js.map ├── balance.ts ├── country_list.js ├── country_list.js.map ├── country_list.ts ├── discount_byoperatorid.js ├── discount_byoperatorid.js.map ├── discount_byoperatorid.ts ├── index.js ├── index.js.map ├── index.ts ├── operator_listbycountrycode.js ├── operator_listbycountrycode.js.map ├── operator_listbycountrycode.ts ├── promotion_byid.js ├── promotion_byid.js.map ├── promotion_byid.ts ├── report_transaction_list.js ├── report_transaction_list.js.map ├── report_transaction_list.ts ├── topup.js ├── topup.js.map └── topup.ts ├── tsconfig.json └── views ├── error.pug ├── index.pug └── layout.pug /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 # Use version 2.1 to enable orb usage. 2 | 3 | jobs: 4 | build: 5 | docker: 6 | - image: circleci/node:14.15.4 7 | working_directory: ~/node-sdk-core/src 8 | # working_directory: ~/repo 9 | steps: 10 | - checkout 11 | - run: 12 | name: "test env var" 13 | command: | 14 | echo $env:CODECOV_TOKEN 15 | # Core 16 | - run: npm install --prefix node-sdk-core/src 17 | - run: npm install --prefix node-sdk-core/src --save-dev nyc 18 | - run: npx nyc --reporter=lcov --report-dir=node-sdk-core/src/coverage npm test --prefix node-sdk-core/src 19 | # Authentication 20 | - run: npm install --prefix node-sdk-authentication/src 21 | - run: npm install --prefix node-sdk-authentication/src --save-dev nyc 22 | - run: npx nyc --reporter=lcov --report-dir=node-sdk-authentication/src/coverage npm test --prefix node-sdk-authentication/src 23 | # Airtime 24 | - run: npm install --prefix node-sdk-airtime/src 25 | - run: npm install --prefix node-sdk-airtime/src --save-dev nyc 26 | - run: npx nyc --reporter=lcov --report-dir=node-sdk-airtime/src/coverage npm test --prefix node-sdk-airtime/src 27 | # Code Coverage 28 | - run: npm install --prefix=$HOME/.local -g codecov 29 | - run: codecov 30 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4D5 Documentation Issue" 3 | about: Report an issue in the API Reference documentation or Developer Guide 4 | labels: documentation, needs-triage 5 | --- 6 | 7 | 8 | 9 | ## Describe the issue 10 | 11 | 12 | ## Links 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680 Feature Request" 3 | about: Suggest an idea for this project 4 | labels: feature-request, needs-triage 5 | --- 6 | 7 | 8 | 9 | ## Describe the Feature 10 | 11 | 12 | ## Is your Feature Request related to a problem? 13 | 14 | 15 | ## Proposed Solution 16 | 17 | 18 | ## Describe alternatives you've considered 19 | 20 | 21 | ## Additional Context 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | - [ ] I may be able to implement this feature request 30 | 31 | 32 | ## Your Environment 33 | 34 | * Reloadly NodeJS SDK version used: 35 | * NodeJS Version used: 36 | * Operating System and version: 37 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/general-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F4AC General Issue" 3 | about: Create a new issue labels: guidance, needs-triage 4 | --- 5 | 6 | 7 | 8 | ## Describe the issue 9 | 10 | 11 | 12 | ## Steps to Reproduce 13 | 14 | 15 | 16 | 17 | 18 | ## Current Behavior 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | ## Your Environment 27 | 28 | 29 | 30 | * Reloadly NodeJS SDK version used: 31 | * NodeJS Version used: 32 | * Operating System and version: 33 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ### Changes 2 | 3 | Please describe both what is changing and why this is important. Include: 4 | 5 | - Endpoints added, deleted, deprecated, or changed 6 | - Classes and methods added, deleted, deprecated, or changed 7 | - Screenshots of new or changed UI, if applicable 8 | - A summary of usage if this is a new feature or change to a public API (this should also be added to relevant 9 | documentation once released) 10 | - Any alternative designs or approaches considered 11 | 12 | ### References 13 | 14 | Please include relevant links supporting this change such as a: 15 | 16 | - support ticket 17 | - community post 18 | - StackOverflow post 19 | - support forum thread 20 | 21 | ### Testing 22 | 23 | Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this 24 | library has unit and/or integration testing, tests should be added for new functionality and existing tests should 25 | complete without errors. 26 | 27 | - [ ] This change adds test coverage 28 | - [ ] This change has been tested on the latest version of the platform/language or why not 29 | 30 | ### Checklist 31 | 32 | - [ ] I have read 33 | the [Reloadly general contribution guidelines](https://github.com/reloadly/reloadly-sdk-nodejs/blob/master/GENERAL-CONTRIBUTING.md) 34 | - [ ] I have read 35 | the [Reloadly Code of Conduct](https://github.com/reloadly/reloadly-sdk-nodejs/blob/master/CODE-OF-CONDUCT.md) 36 | - [ ] All existing and new tests complete without errors 37 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Configuration for probot-stale - https://github.com/probot/stale 2 | 3 | # Number of days of inactivity before an Issue or Pull Request becomes stale 4 | daysUntilStale: 90 5 | 6 | # Number of days of inactivity before an Issue or Pull Request with the stale label is closed. 7 | daysUntilClose: 7 8 | 9 | # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable 10 | exemptLabels: [ ] 11 | 12 | # Set to true to ignore issues with an assignee (defaults to false) 13 | exemptAssignees: true 14 | 15 | # Label to use when marking as stale 16 | staleLabel: closed:stale 17 | 18 | # Comment to post when marking as stale. Set to `false` to disable 19 | markComment: > 20 | This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If you have not received a response for our team (apologies for the delay) and this is still a blocker, please reply with additional information or just a ping. Thank you for your contribution! 🙇‍♂️ -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.0.1 4 | Added ```supportsGeographicalRechargePlan``` and ```geographicalRechargePlans``` to operator object. 5 | 6 | ## 1.0.2 7 | Increase test coverage, minor cleanups & bug fixes. 8 | -------------------------------------------------------------------------------- /SAMPLE-CODE.md: -------------------------------------------------------------------------------- 1 | ## Sample Code 2 | 3 | ### Authentication SDK 4 | 5 | * [Usage](node-sdk-authentication/USAGE.md) 6 | 7 | ### Airtime SDK 8 | 9 | * [Overview](node-sdk-airtime/USAGE.md) (You should start here) 10 | * [Account Operations](node-sdk-airtime/usage/ACCOUNT-OPERATIONS.md) 11 | * [Country Operations](node-sdk-airtime/usage/COUNTRY-OPERATIONS.md) 12 | * [Discount Operations](node-sdk-airtime/usage/DISCOUNT-OPERATIONS.md) 13 | * [Operator Operations](node-sdk-airtime/usage/OPERATOR-OPERATIONS.md) 14 | * [Promotion Operations](node-sdk-airtime/usage/PROMOTION-OPERATIONS.md) 15 | * [Report Operations](node-sdk-airtime/usage/REPORT-OPERATIONS.md) 16 | * [Topup Operations](node-sdk-airtime/usage/TOPUP-OPERATIONS.md) 17 | 18 | ### Example Application 19 | 20 | * [Overview](reloadly-example/USAGE.md) -------------------------------------------------------------------------------- /node-sdk-airtime/src/.gitignore: -------------------------------------------------------------------------------- 1 | .env -------------------------------------------------------------------------------- /node-sdk-airtime/src/Airtime.d.ts: -------------------------------------------------------------------------------- 1 | export { FxRate } from "./dto/response/FxRate"; 2 | export { Phone } from "./dto/response/Phone"; 3 | export { Promotion } from "./dto/response/Promotion"; 4 | export { SimplifiedCountry } from "./dto/response/SimplifiedCountry"; 5 | export { AirtimeApi } from "./AirtimeApi"; 6 | export { PhoneTopupRequest } from "./dto/request/PhoneTopupRequest"; 7 | export { DenominationType } from "./enums/DenominationType"; 8 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/Airtime.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Airtime.js","sourceRoot":"","sources":["Airtime.ts"],"names":[],"mappings":";;;AAAA,gDAA+C;AAAtC,gGAAA,MAAM,OAAA;AACf,8CAA6C;AAApC,8FAAA,KAAK,OAAA;AACd,sDAAqD;AAA5C,sGAAA,SAAS,OAAA;AAClB,sEAAqE;AAA5D,sHAAA,iBAAiB,OAAA;AAC1B,2CAA0C;AAAjC,wGAAA,UAAU,OAAA;AACnB,qEAAoE;AAA3D,sHAAA,iBAAiB,OAAA;AAC1B,6DAA4D;AAAnD,oHAAA,gBAAgB,OAAA"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/Airtime.ts: -------------------------------------------------------------------------------- 1 | export { FxRate } from "./dto/response/FxRate"; 2 | export { Phone } from "./dto/response/Phone"; 3 | export { Promotion } from "./dto/response/Promotion"; 4 | export { SimplifiedCountry } from "./dto/response/SimplifiedCountry"; 5 | export { AirtimeApi } from "./AirtimeApi"; 6 | export { PhoneTopupRequest } from "./dto/request/PhoneTopupRequest"; 7 | export { DenominationType } from "./enums/DenominationType"; 8 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/README.md: -------------------------------------------------------------------------------- 1 | # @reloadly/reloadly.airtime 2 | 3 | The implementation is based on the [Airtime API Docs](https://developers.reloadly.com/#airtime-api). 4 | 5 | ## Usage 6 | 7 | ```typescript 8 | const ReloadlyAirtime = require("@reloadly/reloadly.airtime"); 9 | const ReloadlyCore = require("@reloadly/reloadly.core"); 10 | 11 | var api = new ReloadlyAirtime.AirtimeApi("", "", null, ReloadlyCore.Environment.SANDBOX); 12 | var operation = await api.accounts(); 13 | var request = operation.getBalance(); 14 | var balanceInfo = await request.execute(); 15 | ``` 16 | 17 | You may find more information on the repository homepage: 18 | https://github.com/Reloadly/reloadly-sdk-nodejs 19 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/EmailTopupRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { TopupRequest } from "./TopupRequest"; 2 | import { Phone } from "../response/Phone"; 3 | export declare class EmailTopupRequest extends TopupRequest { 4 | /** 5 | * Destination recipient email address to be credited 6 | */ 7 | recipientEmail: string; 8 | constructor(amount: number, operatorId: number, recipientEmail: string, senderPhone: Phone, useLocalAmount: boolean, customIdentifier: string); 9 | } 10 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/EmailTopupRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.EmailTopupRequest = void 0; 4 | const TopupRequest_1 = require("./TopupRequest"); 5 | class EmailTopupRequest extends TopupRequest_1.TopupRequest { 6 | constructor(amount, operatorId, recipientEmail, senderPhone, useLocalAmount, customIdentifier) { 7 | super(amount, operatorId, useLocalAmount, senderPhone, customIdentifier); 8 | this.recipientEmail = recipientEmail; 9 | } 10 | } 11 | exports.EmailTopupRequest = EmailTopupRequest; 12 | //# sourceMappingURL=EmailTopupRequest.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/EmailTopupRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"EmailTopupRequest.js","sourceRoot":"","sources":["EmailTopupRequest.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAG9C,MAAa,iBAAkB,SAAQ,2BAAY;IAO/C,YAAY,MAAc,EAAE,UAAkB,EAAE,cAAsB,EAClE,WAAkB,EAAE,cAAuB,EAAE,gBAAwB;QAErE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACzE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;CACJ;AAbD,8CAaC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/EmailTopupRequest.ts: -------------------------------------------------------------------------------- 1 | import { TopupRequest } from "./TopupRequest"; 2 | import { Phone } from "../response/Phone"; 3 | 4 | export class EmailTopupRequest extends TopupRequest { 5 | 6 | /** 7 | * Destination recipient email address to be credited 8 | */ 9 | recipientEmail: string; 10 | 11 | constructor(amount: number, operatorId: number, recipientEmail: string, 12 | senderPhone: Phone, useLocalAmount: boolean, customIdentifier: string) { 13 | 14 | super(amount, operatorId, useLocalAmount, senderPhone, customIdentifier); 15 | this.recipientEmail = recipientEmail; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/PhoneTopupRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { TopupRequest } from "./TopupRequest"; 2 | import { Phone } from "../response/Phone"; 3 | export declare class PhoneTopupRequest extends TopupRequest { 4 | /** 5 | * Destination recipient phone number (with country prefix) to be credited, example +50936377111 6 | */ 7 | recipientPhone: Phone; 8 | constructor(amount: number, operatorId: number, recipientPhone: Phone, useLocalAmount: boolean, senderPhone: Phone, customIdentifier?: string); 9 | } 10 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/PhoneTopupRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.PhoneTopupRequest = void 0; 4 | const TopupRequest_1 = require("./TopupRequest"); 5 | class PhoneTopupRequest extends TopupRequest_1.TopupRequest { 6 | constructor(amount, operatorId, recipientPhone, useLocalAmount, senderPhone, customIdentifier) { 7 | super(amount, operatorId, useLocalAmount, senderPhone, customIdentifier); 8 | this.recipientPhone = recipientPhone; 9 | } 10 | } 11 | exports.PhoneTopupRequest = PhoneTopupRequest; 12 | //# sourceMappingURL=PhoneTopupRequest.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/PhoneTopupRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PhoneTopupRequest.js","sourceRoot":"","sources":["PhoneTopupRequest.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAG9C,MAAa,iBAAkB,SAAQ,2BAAY;IAO/C,YAAY,MAAc,EAAE,UAAkB,EAC1C,cAAqB,EAAE,cAAuB,EAAE,WAAkB,EAAE,gBAAyB;QAE7F,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,gBAAgB,CAAC,CAAC;QACzE,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;CACJ;AAbD,8CAaC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/PhoneTopupRequest.ts: -------------------------------------------------------------------------------- 1 | import { TopupRequest } from "./TopupRequest"; 2 | import { Phone } from "../response/Phone"; 3 | 4 | export class PhoneTopupRequest extends TopupRequest { 5 | 6 | /** 7 | * Destination recipient phone number (with country prefix) to be credited, example +50936377111 8 | */ 9 | recipientPhone: Phone; 10 | 11 | constructor(amount: number, operatorId: number, 12 | recipientPhone: Phone, useLocalAmount: boolean, senderPhone: Phone, customIdentifier?: string) { 13 | 14 | super(amount, operatorId, useLocalAmount, senderPhone, customIdentifier); 15 | this.recipientPhone = recipientPhone; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/TopupRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { Phone } from "../response/Phone"; 2 | export declare abstract class TopupRequest { 3 | /** 4 | * Amount (in sender's currency) to credit recipient phone for 5 | */ 6 | amount: number; 7 | /** 8 | * Unique identifier of the destination mobile operator id 9 | */ 10 | operatorId: number; 11 | /** 12 | * Phone number of user requesting to credit the recipient phone, this field is optional. 13 | */ 14 | senderPhone: Phone; 15 | /** 16 | * Indicates whether topup amount is a local amount (as in the same currency as the destination country) 17 | */ 18 | useLocalAmount: boolean; 19 | /** 20 | * This field can be used to record any kind of info when performing the transaction. 21 | * Maximum length allowed for field customIdentifier is 150 characters, this field is optional. 22 | */ 23 | customIdentifier: string; 24 | constructor(amount: number, operatorId: number, useLocalAmount: boolean, senderPhone: Phone, customIdentifier?: string); 25 | } 26 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/TopupRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TopupRequest = void 0; 4 | class TopupRequest { 5 | constructor(amount, operatorId, useLocalAmount, senderPhone, customIdentifier) { 6 | this.amount = amount; 7 | this.operatorId = operatorId; 8 | this.useLocalAmount = useLocalAmount; 9 | this.senderPhone = senderPhone; 10 | this.customIdentifier = customIdentifier; 11 | } 12 | } 13 | exports.TopupRequest = TopupRequest; 14 | //# sourceMappingURL=TopupRequest.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/TopupRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TopupRequest.js","sourceRoot":"","sources":["TopupRequest.ts"],"names":[],"mappings":";;;AAEA,MAAsB,YAAY;IA4B9B,YAAY,MAAc,EAAE,UAAkB,EAC1C,cAAuB,EAAE,WAAkB,EAAE,gBAAyB;QACtE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;IAC7C,CAAC;CACJ;AApCD,oCAoCC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/request/TopupRequest.ts: -------------------------------------------------------------------------------- 1 | import { Phone } from "../response/Phone"; 2 | 3 | export abstract class TopupRequest { 4 | 5 | /** 6 | * Amount (in sender's currency) to credit recipient phone for 7 | */ 8 | amount: number; 9 | 10 | /** 11 | * Unique identifier of the destination mobile operator id 12 | */ 13 | operatorId: number; 14 | 15 | /** 16 | * Phone number of user requesting to credit the recipient phone, this field is optional. 17 | */ 18 | senderPhone: Phone; 19 | 20 | /** 21 | * Indicates whether topup amount is a local amount (as in the same currency as the destination country) 22 | */ 23 | useLocalAmount: boolean; 24 | 25 | /** 26 | * This field can be used to record any kind of info when performing the transaction. 27 | * Maximum length allowed for field customIdentifier is 150 characters, this field is optional. 28 | */ 29 | customIdentifier: string; 30 | 31 | constructor(amount: number, operatorId: number, 32 | useLocalAmount: boolean, senderPhone: Phone, customIdentifier?: string) { 33 | this.amount = amount; 34 | this.operatorId = operatorId; 35 | this.useLocalAmount = useLocalAmount; 36 | this.senderPhone = senderPhone; 37 | this.customIdentifier = customIdentifier; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/AccountBalanceInfo.d.ts: -------------------------------------------------------------------------------- 1 | export declare class AccountBalanceInfo { 2 | /** 3 | * Current account balance amount 4 | */ 5 | balance: bigint; 6 | /** 7 | * Account ISO-4217 3 letter currency code. See https://www.iso.org/iso-4217-currency-codes.html. 8 | * Example : USD 9 | */ 10 | currencyCode: string; 11 | /** 12 | * Account currency name for the given currency code, example "United States Dollar" 13 | */ 14 | currencyName: string; 15 | /** 16 | * Account balance last updated date 17 | */ 18 | updatedAt: Date; 19 | } 20 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/AccountBalanceInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AccountBalanceInfo = void 0; 4 | class AccountBalanceInfo { 5 | } 6 | exports.AccountBalanceInfo = AccountBalanceInfo; 7 | //# sourceMappingURL=AccountBalanceInfo.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/AccountBalanceInfo.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AccountBalanceInfo.js","sourceRoot":"","sources":["AccountBalanceInfo.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;CAsB9B;AAtBD,gDAsBC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/AccountBalanceInfo.ts: -------------------------------------------------------------------------------- 1 | export class AccountBalanceInfo { 2 | 3 | /** 4 | * Current account balance amount 5 | */ 6 | balance: bigint; 7 | 8 | /** 9 | * Account ISO-4217 3 letter currency code. See https://www.iso.org/iso-4217-currency-codes.html. 10 | * Example : USD 11 | */ 12 | currencyCode: string; 13 | 14 | /** 15 | * Account currency name for the given currency code, example "United States Dollar" 16 | */ 17 | currencyName: string; 18 | 19 | /** 20 | * Account balance last updated date 21 | */ 22 | updatedAt: Date; 23 | } 24 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Country.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Country { 2 | /** 3 | * ISO 3166-1 alpha-2 Country code. See https://www.iso.org/obp/ui/#search 4 | */ 5 | isoName: string; 6 | /** 7 | * Full country name 8 | */ 9 | name: string; 10 | /** 11 | * Account ISO-4217 3 letter currency code for the given country. 12 | * See https://www.iso.org/iso-4217-currency-codes.html 13 | */ 14 | currencyCode: string; 15 | /** 16 | * Full currency name 17 | */ 18 | currencyName: string; 19 | /** 20 | * Symbol of currency 21 | */ 22 | currencySymbol: string; 23 | /** 24 | * Url of country flag image 25 | */ 26 | flag: string; 27 | /** 28 | * Calling codes of the country 29 | */ 30 | callingCodes: string[]; 31 | } 32 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Country.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Country = void 0; 4 | class Country { 5 | } 6 | exports.Country = Country; 7 | //# sourceMappingURL=Country.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Country.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Country.js","sourceRoot":"","sources":["Country.ts"],"names":[],"mappings":";;;AAAA,MAAa,OAAO;CAqCnB;AArCD,0BAqCC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Country.ts: -------------------------------------------------------------------------------- 1 | export class Country { 2 | 3 | /** 4 | * ISO 3166-1 alpha-2 Country code. See https://www.iso.org/obp/ui/#search 5 | */ 6 | isoName: string; 7 | 8 | /** 9 | * Full country name 10 | */ 11 | name: string; 12 | 13 | /** 14 | * Account ISO-4217 3 letter currency code for the given country. 15 | * See https://www.iso.org/iso-4217-currency-codes.html 16 | */ 17 | currencyCode: string; 18 | 19 | /** 20 | * Full currency name 21 | */ 22 | currencyName: string; 23 | 24 | /** 25 | * Symbol of currency 26 | */ 27 | currencySymbol: string; 28 | 29 | /** 30 | * Url of country flag image 31 | */ 32 | flag: string; 33 | 34 | /** 35 | * Calling codes of the country 36 | */ 37 | callingCodes: string[]; 38 | } 39 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Discount.d.ts: -------------------------------------------------------------------------------- 1 | import { SimplifiedOperator } from "./SimplifiedOperator"; 2 | export declare class Discount { 3 | percentage: number; 4 | internationalPercentage: number; 5 | localPercentage: number; 6 | updatedAt: Date; 7 | operator: SimplifiedOperator; 8 | } 9 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Discount.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Discount = void 0; 4 | class Discount { 5 | } 6 | exports.Discount = Discount; 7 | //# sourceMappingURL=Discount.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Discount.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Discount.js","sourceRoot":"","sources":["Discount.ts"],"names":[],"mappings":";;;AAEA,MAAa,QAAQ;CAMpB;AAND,4BAMC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Discount.ts: -------------------------------------------------------------------------------- 1 | import { SimplifiedOperator } from "./SimplifiedOperator"; 2 | 3 | export class Discount { 4 | percentage:number; 5 | internationalPercentage: number; 6 | localPercentage: number; 7 | updatedAt: Date; 8 | operator: SimplifiedOperator; 9 | } 10 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/FxRate.d.ts: -------------------------------------------------------------------------------- 1 | export declare class FxRate { 2 | rate: number; 3 | currencyCode: string; 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/FxRate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.FxRate = void 0; 4 | class FxRate { 5 | } 6 | exports.FxRate = FxRate; 7 | //# sourceMappingURL=FxRate.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/FxRate.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"FxRate.js","sourceRoot":"","sources":["FxRate.ts"],"names":[],"mappings":";;;AAAA,MAAa,MAAM;CAGlB;AAHD,wBAGC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/FxRate.ts: -------------------------------------------------------------------------------- 1 | export class FxRate { 2 | rate: number; 3 | currencyCode: string; 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Operator.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Operator = void 0; 4 | class Operator { 5 | } 6 | exports.Operator = Operator; 7 | //# sourceMappingURL=Operator.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Operator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Operator.js","sourceRoot":"","sources":["Operator.ts"],"names":[],"mappings":";;;AAKA,MAAa,QAAQ;CAoJpB;AApJD,4BAoJC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/OperatorFxRate.d.ts: -------------------------------------------------------------------------------- 1 | export declare class OperatorFxRate { 2 | id: bigint; 3 | name: string; 4 | fxRate: number; 5 | currencyCode: string; 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/OperatorFxRate.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.OperatorFxRate = void 0; 4 | class OperatorFxRate { 5 | } 6 | exports.OperatorFxRate = OperatorFxRate; 7 | //# sourceMappingURL=OperatorFxRate.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/OperatorFxRate.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"OperatorFxRate.js","sourceRoot":"","sources":["OperatorFxRate.ts"],"names":[],"mappings":";;;AAAA,MAAa,cAAc;CAK1B;AALD,wCAKC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/OperatorFxRate.ts: -------------------------------------------------------------------------------- 1 | export class OperatorFxRate { 2 | id: bigint; 3 | name: string; 4 | fxRate: number; 5 | currencyCode: string; 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Phone.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Phone { 2 | /** 3 | * Phone number 4 | */ 5 | number: string; 6 | /** 7 | * ISO 3166-1 alpha-2 Country code. See https://www.iso.org/obp/ui/#search 8 | */ 9 | countryCode: string; 10 | constructor(number: string, countryCode: string); 11 | } 12 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Phone.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Phone = void 0; 4 | class Phone { 5 | constructor(number, countryCode) { 6 | this.number = number; 7 | this.countryCode = countryCode; 8 | } 9 | } 10 | exports.Phone = Phone; 11 | //# sourceMappingURL=Phone.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Phone.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Phone.js","sourceRoot":"","sources":["Phone.ts"],"names":[],"mappings":";;;AAAA,MAAa,KAAK;IAWd,YAAY,MAAc,EAAE,WAAmB;QAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AAfD,sBAeC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Phone.ts: -------------------------------------------------------------------------------- 1 | export class Phone { 2 | /** 3 | * Phone number 4 | */ 5 | number: string; 6 | 7 | /** 8 | * ISO 3166-1 alpha-2 Country code. See https://www.iso.org/obp/ui/#search 9 | */ 10 | countryCode: string; 11 | 12 | constructor(number: string, countryCode: string) { 13 | this.number = number; 14 | this.countryCode = countryCode; 15 | } 16 | } -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/PinDetail.d.ts: -------------------------------------------------------------------------------- 1 | export declare class PinDetail { 2 | /** 3 | * Serial number 4 | */ 5 | serial: string; 6 | /** 7 | * Info part 1 8 | */ 9 | info1: string; 10 | /** 11 | * Info part 2 12 | */ 13 | info2: string; 14 | /** 15 | * Info part 3 16 | */ 17 | info3: string; 18 | /** 19 | * PIN value 20 | */ 21 | value: number; 22 | /** 23 | * PIN code 24 | */ 25 | code: string; 26 | /** 27 | * PIN IVR info 28 | */ 29 | ivr: string; 30 | /** 31 | * PIN validity info 32 | */ 33 | validity: string; 34 | } 35 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/PinDetail.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.PinDetail = void 0; 4 | class PinDetail { 5 | } 6 | exports.PinDetail = PinDetail; 7 | //# sourceMappingURL=PinDetail.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/PinDetail.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PinDetail.js","sourceRoot":"","sources":["PinDetail.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;CAyCrB;AAzCD,8BAyCC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/PinDetail.ts: -------------------------------------------------------------------------------- 1 | export class PinDetail { 2 | 3 | /** 4 | * Serial number 5 | */ 6 | serial: string; 7 | 8 | /** 9 | * Info part 1 10 | */ 11 | info1: string; 12 | 13 | /** 14 | * Info part 2 15 | */ 16 | info2: string; 17 | 18 | /** 19 | * Info part 3 20 | */ 21 | info3: string; 22 | 23 | /** 24 | * PIN value 25 | */ 26 | value: number; 27 | 28 | /** 29 | * PIN code 30 | */ 31 | code: string; 32 | 33 | /** 34 | * PIN IVR info 35 | */ 36 | ivr: string; 37 | 38 | /** 39 | * PIN validity info 40 | */ 41 | validity: string; 42 | } 43 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Promotion.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Promotion { 2 | /** 3 | * Unique identifier for the given promotion 4 | */ 5 | id: bigint; 6 | /** 7 | * Id of operator to which the promotion applies 8 | */ 9 | operatorId: bigint; 10 | /** 11 | * Title of the promotion 12 | */ 13 | title: string; 14 | /** 15 | * 2nd title for the promotion if any 16 | */ 17 | title2: string; 18 | /** 19 | * Description of the promotion 20 | */ 21 | description: string; 22 | /** 23 | * Date on which the promotion starts 24 | */ 25 | startDate: Date; 26 | /** 27 | * Date on which the promotion ends 28 | */ 29 | endDate: Date; 30 | /** 31 | * Amounts for which the promotion applies 32 | */ 33 | denominations: string; 34 | /** 35 | * Amounts (in destination country currency) for which the promotion applies 36 | */ 37 | localDenominations: string; 38 | } 39 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Promotion.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Promotion = void 0; 4 | class Promotion { 5 | } 6 | exports.Promotion = Promotion; 7 | //# sourceMappingURL=Promotion.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Promotion.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Promotion.js","sourceRoot":"","sources":["Promotion.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;CA8CrB;AA9CD,8BA8CC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/Promotion.ts: -------------------------------------------------------------------------------- 1 | export class Promotion { 2 | 3 | /** 4 | * Unique identifier for the given promotion 5 | */ 6 | id: bigint; 7 | 8 | /** 9 | * Id of operator to which the promotion applies 10 | */ 11 | operatorId: bigint; 12 | 13 | /** 14 | * Title of the promotion 15 | */ 16 | title: string; 17 | 18 | /** 19 | * 2nd title for the promotion if any 20 | */ 21 | title2: string; 22 | 23 | /** 24 | * Description of the promotion 25 | */ 26 | description: string; 27 | 28 | /** 29 | * Date on which the promotion starts 30 | */ 31 | startDate: Date; 32 | 33 | /** 34 | * Date on which the promotion ends 35 | */ 36 | endDate: Date; 37 | 38 | /** 39 | * Amounts for which the promotion applies 40 | */ 41 | denominations: string; 42 | 43 | /** 44 | * Amounts (in destination country currency) for which the promotion applies 45 | */ 46 | localDenominations: string; 47 | } 48 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedCountry.d.ts: -------------------------------------------------------------------------------- 1 | export declare class SimplifiedCountry { 2 | /** 3 | * ISO 3166-1 alpha-2 Country code. See https://www.iso.org/obp/ui/#search 4 | */ 5 | isoName: string; 6 | /** 7 | * Full country name 8 | */ 9 | name: string; 10 | } 11 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedCountry.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.SimplifiedCountry = void 0; 4 | class SimplifiedCountry { 5 | } 6 | exports.SimplifiedCountry = SimplifiedCountry; 7 | //# sourceMappingURL=SimplifiedCountry.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedCountry.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SimplifiedCountry.js","sourceRoot":"","sources":["SimplifiedCountry.ts"],"names":[],"mappings":";;;AAAA,MAAa,iBAAiB;CAW7B;AAXD,8CAWC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedCountry.ts: -------------------------------------------------------------------------------- 1 | export class SimplifiedCountry { 2 | 3 | /** 4 | * ISO 3166-1 alpha-2 Country code. See https://www.iso.org/obp/ui/#search 5 | */ 6 | isoName: string; 7 | 8 | /** 9 | * Full country name 10 | */ 11 | name: string; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedOperator.d.ts: -------------------------------------------------------------------------------- 1 | export declare class SimplifiedOperator { 2 | id: bigint; 3 | name: string; 4 | countryCode: string; 5 | data: boolean; 6 | bundle: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedOperator.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.SimplifiedOperator = void 0; 4 | class SimplifiedOperator { 5 | } 6 | exports.SimplifiedOperator = SimplifiedOperator; 7 | //# sourceMappingURL=SimplifiedOperator.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedOperator.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"SimplifiedOperator.js","sourceRoot":"","sources":["SimplifiedOperator.ts"],"names":[],"mappings":";;;AAAA,MAAa,kBAAkB;CAM9B;AAND,gDAMC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/SimplifiedOperator.ts: -------------------------------------------------------------------------------- 1 | export class SimplifiedOperator { 2 | id: bigint; 3 | name: string; 4 | countryCode: string; 5 | data: boolean; 6 | bundle: boolean; 7 | } 8 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/TopupTransaction.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TopupTransaction = void 0; 4 | class TopupTransaction { 5 | } 6 | exports.TopupTransaction = TopupTransaction; 7 | //# sourceMappingURL=TopupTransaction.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/TopupTransaction.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TopupTransaction.js","sourceRoot":"","sources":["TopupTransaction.ts"],"names":[],"mappings":";;;AAGA,MAAa,gBAAgB;CA2F5B;AA3FD,4CA2FC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/TransactionBalanceInfo.d.ts: -------------------------------------------------------------------------------- 1 | export declare class TransactionBalanceInfo { 2 | /** 3 | * Account balance prior to the transaction 4 | */ 5 | oldBalance: number; 6 | /** 7 | * Current account balance amount 8 | */ 9 | newBalance: number; 10 | /** 11 | * Account ISO-4217 3 letter currency code. See https://www.iso.org/iso-4217-currency-codes.html. 12 | * Example : USD 13 | */ 14 | currencyCode: string; 15 | /** 16 | * Account currency name for the given currency code, example "United States Dollar" 17 | */ 18 | currencyName: string; 19 | /** 20 | * Account balance last updated date 21 | */ 22 | updatedAt: Date; 23 | } 24 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/TransactionBalanceInfo.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TransactionBalanceInfo = void 0; 4 | class TransactionBalanceInfo { 5 | } 6 | exports.TransactionBalanceInfo = TransactionBalanceInfo; 7 | //# sourceMappingURL=TransactionBalanceInfo.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/TransactionBalanceInfo.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TransactionBalanceInfo.js","sourceRoot":"","sources":["TransactionBalanceInfo.ts"],"names":[],"mappings":";;;AAAA,MAAa,sBAAsB;CA2BlC;AA3BD,wDA2BC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/dto/response/TransactionBalanceInfo.ts: -------------------------------------------------------------------------------- 1 | export class TransactionBalanceInfo { 2 | 3 | /** 4 | * Account balance prior to the transaction 5 | */ 6 | oldBalance: number; 7 | 8 | /** 9 | * Current account balance amount 10 | */ 11 | newBalance: number; 12 | 13 | /** 14 | * Account ISO-4217 3 letter currency code. See https://www.iso.org/iso-4217-currency-codes.html. 15 | * Example : USD 16 | */ 17 | currencyCode: string; 18 | 19 | /** 20 | * Account currency name for the given currency code, example "United States Dollar" 21 | */ 22 | currencyName: string; 23 | 24 | /** 25 | * Account balance last updated date 26 | */ 27 | updatedAt: Date; 28 | } 29 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/enums/DenominationType.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum DenominationType { 2 | FIXED = 0, 3 | RANGE = 1 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/enums/DenominationType.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.DenominationType = void 0; 4 | var DenominationType; 5 | (function (DenominationType) { 6 | DenominationType[DenominationType["FIXED"] = 0] = "FIXED"; 7 | DenominationType[DenominationType["RANGE"] = 1] = "RANGE"; 8 | })(DenominationType = exports.DenominationType || (exports.DenominationType = {})); 9 | //# sourceMappingURL=DenominationType.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/enums/DenominationType.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DenominationType.js","sourceRoot":"","sources":["DenominationType.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAGX;AAHD,WAAY,gBAAgB;IACxB,yDAAK,CAAA;IACL,yDAAK,CAAA;AACT,CAAC,EAHW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAG3B"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/enums/DenominationType.ts: -------------------------------------------------------------------------------- 1 | export enum DenominationType { 2 | FIXED, 3 | RANGE 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/internal/dto/request/FxRateRequest.d.ts: -------------------------------------------------------------------------------- 1 | export declare class FxRateRequest { 2 | amount: number; 3 | constructor(amount: number); 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/internal/dto/request/FxRateRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.FxRateRequest = void 0; 4 | class FxRateRequest { 5 | constructor(amount) { 6 | this.amount = amount; 7 | } 8 | } 9 | exports.FxRateRequest = FxRateRequest; 10 | //# sourceMappingURL=FxRateRequest.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/internal/dto/request/FxRateRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"FxRateRequest.js","sourceRoot":"","sources":["FxRateRequest.ts"],"names":[],"mappings":";;;AAAA,MAAa,aAAa;IAGtB,YAAY,MAAc;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACzB,CAAC;CACJ;AAND,sCAMC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/internal/dto/request/FxRateRequest.ts: -------------------------------------------------------------------------------- 1 | export class FxRateRequest { 2 | amount: number; 3 | 4 | constructor(amount: number) { 5 | this.amount = amount; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/AccountOperations.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { AccountBalanceInfo } from "../dto/response/AccountBalanceInfo"; 3 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 4 | export declare class AccountOperations extends BaseAirtimeOperation { 5 | static readonly END_POINT = "accounts"; 6 | static readonly PATH_BALANCE = "balance"; 7 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 8 | getBalance(): ReloadlyCore.IRequest; 9 | } 10 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/AccountOperations.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AccountOperations = void 0; 4 | const BaseAirtimeOperation_1 = require("./BaseAirtimeOperation"); 5 | class AccountOperations extends BaseAirtimeOperation_1.BaseAirtimeOperation { 6 | constructor(baseUrl, apiToken, apiVersion, enableTelemetry) { 7 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 8 | } 9 | getBalance() { 10 | var url = AccountOperations.END_POINT + "/" + AccountOperations.PATH_BALANCE; 11 | return this.createGetRequest(url); 12 | } 13 | } 14 | exports.AccountOperations = AccountOperations; 15 | AccountOperations.END_POINT = "accounts"; 16 | AccountOperations.PATH_BALANCE = "balance"; 17 | //# sourceMappingURL=AccountOperations.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/AccountOperations.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AccountOperations.js","sourceRoot":"","sources":["AccountOperations.ts"],"names":[],"mappings":";;;AAEA,iEAA8D;AAE9D,MAAa,iBAAkB,SAAQ,2CAAoB;IAKvD,YAAY,OAAe,EAAE,QAAgB,EAAE,UAAkB,EAAE,eAAwB;QACvF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEM,UAAU;QACb,IAAI,GAAG,GAAG,iBAAiB,CAAC,SAAS,GAAG,GAAG,GAAG,iBAAiB,CAAC,YAAY,CAAC;QAC7E,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;;AAZL,8CAaC;AAXmB,2BAAS,GAAG,UAAU,CAAC;AACvB,8BAAY,GAAG,SAAS,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/AccountOperations.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { AccountBalanceInfo } from "../dto/response/AccountBalanceInfo"; 3 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 4 | 5 | export class AccountOperations extends BaseAirtimeOperation { 6 | 7 | static readonly END_POINT = "accounts"; 8 | static readonly PATH_BALANCE = "balance"; 9 | 10 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean) { 11 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 12 | } 13 | 14 | public getBalance(): ReloadlyCore.IRequest { 15 | var url = AccountOperations.END_POINT + "/" + AccountOperations.PATH_BALANCE; 16 | return this.createGetRequest(url); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/BaseAirtimeOperation.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | export declare abstract class BaseAirtimeOperation extends ReloadlyCore.BaseOperation { 3 | protected readonly apiVersion: string; 4 | protected readonly apiToken: string; 5 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 6 | protected createGetRequest(relativeUrl: string, filter?: ReloadlyCore.QueryFilter): ReloadlyCore.IRequest; 7 | protected createPostRequest(relativeUrl: string, body: {}): ReloadlyCore.IRequest; 8 | } 9 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/CountryOperations.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { Country } from "../dto/response/Country"; 4 | export declare class CountryOperations extends BaseAirtimeOperation { 5 | static readonly END_POINT = "countries"; 6 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 7 | list(): ReloadlyCore.IRequest; 8 | getByCode(countryCode: string): ReloadlyCore.IRequest; 9 | } 10 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/CountryOperations.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.CountryOperations = void 0; 4 | const BaseAirtimeOperation_1 = require("./BaseAirtimeOperation"); 5 | class CountryOperations extends BaseAirtimeOperation_1.BaseAirtimeOperation { 6 | constructor(baseUrl, apiToken, apiVersion, enableTelemetry) { 7 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 8 | } 9 | list() { 10 | return this.createGetRequest(CountryOperations.END_POINT); 11 | } 12 | getByCode(countryCode) { 13 | if (!countryCode) 14 | throw new Error("'countryCode' must be provided."); 15 | return this.createGetRequest(CountryOperations.END_POINT + "/" + countryCode); 16 | } 17 | } 18 | exports.CountryOperations = CountryOperations; 19 | CountryOperations.END_POINT = "countries"; 20 | //# sourceMappingURL=CountryOperations.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/CountryOperations.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CountryOperations.js","sourceRoot":"","sources":["CountryOperations.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,MAAa,iBAAkB,SAAQ,2CAAoB;IAIvD,YAAY,OAAe,EAAE,QAAgB,EAAE,UAAkB,EAAE,eAAwB;QACvF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEM,IAAI;QACP,OAAO,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC9D,CAAC;IAEM,SAAS,CAAC,WAAmB;QAChC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QAErE,OAAO,IAAI,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,SAAS,GAAG,GAAG,GAAG,WAAW,CAAC,CAAC;IAClF,CAAC;;AAhBL,8CAiBC;AAfmB,2BAAS,GAAG,WAAW,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/CountryOperations.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { Country } from "../dto/response/Country"; 4 | 5 | export class CountryOperations extends BaseAirtimeOperation { 6 | 7 | static readonly END_POINT = "countries"; 8 | 9 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean) { 10 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 11 | } 12 | 13 | public list(): ReloadlyCore.IRequest { 14 | return this.createGetRequest(CountryOperations.END_POINT); 15 | } 16 | 17 | public getByCode(countryCode: string): ReloadlyCore.IRequest { 18 | if (!countryCode) throw new Error("'countryCode' must be provided."); 19 | 20 | return this.createGetRequest(CountryOperations.END_POINT + "/" + countryCode); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/DiscountOperations.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { Discount } from "../dto/response/Discount"; 4 | export declare class DiscountOperations extends BaseAirtimeOperation { 5 | static readonly END_POINT = "operators"; 6 | static readonly PATH_SEGMENT_DISCOUNT = "commissions"; 7 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 8 | list(filter?: ReloadlyCore.QueryFilter): ReloadlyCore.IRequest>; 9 | getByOperatorId(operatorId: bigint): ReloadlyCore.IRequest; 10 | validateOperatorId(operatorId: bigint): void; 11 | } 12 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/DiscountOperations.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.DiscountOperations = void 0; 4 | const BaseAirtimeOperation_1 = require("./BaseAirtimeOperation"); 5 | class DiscountOperations extends BaseAirtimeOperation_1.BaseAirtimeOperation { 6 | constructor(baseUrl, apiToken, apiVersion, enableTelemetry) { 7 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 8 | } 9 | list(filter) { 10 | var url = DiscountOperations.END_POINT + "/" + DiscountOperations.PATH_SEGMENT_DISCOUNT; 11 | return this.createGetRequest(url, filter); 12 | } 13 | getByOperatorId(operatorId) { 14 | this.validateOperatorId(operatorId); 15 | var url = DiscountOperations.END_POINT + "/" + operatorId + "/" + DiscountOperations.PATH_SEGMENT_DISCOUNT; 16 | return this.createGetRequest(url); 17 | } 18 | validateOperatorId(operatorId) { 19 | if (!operatorId || operatorId < 0) 20 | throw new Error("'operatorId' must be greater than 0."); 21 | } 22 | } 23 | exports.DiscountOperations = DiscountOperations; 24 | DiscountOperations.END_POINT = "operators"; 25 | DiscountOperations.PATH_SEGMENT_DISCOUNT = "commissions"; 26 | //# sourceMappingURL=DiscountOperations.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/DiscountOperations.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"DiscountOperations.js","sourceRoot":"","sources":["DiscountOperations.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,MAAa,kBAAmB,SAAQ,2CAAoB;IAKxD,YAAY,OAAe,EAAE,QAAgB,EAAE,UAAkB,EAAE,eAAwB;QACvF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEM,IAAI,CAAC,MAAiC;QACzC,IAAI,GAAG,GAAG,kBAAkB,CAAC,SAAS,GAAG,GAAG,GAAG,kBAAkB,CAAC,qBAAqB,CAAC;QACxF,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC9C,CAAC;IAEM,eAAe,CAAC,UAAkB;QACrC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACpC,IAAI,GAAG,GAAG,kBAAkB,CAAC,SAAS,GAAG,GAAG,GAAG,UAAU,GAAG,GAAG,GAAG,kBAAkB,CAAC,qBAAqB,CAAC;QAC3G,OAAO,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC;IAED,kBAAkB,CAAC,UAAkB;QACjC,IAAI,CAAC,UAAU,IAAI,UAAU,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC/F,CAAC;;AAtBL,gDAuBC;AArBmB,4BAAS,GAAG,WAAW,CAAC;AACxB,wCAAqB,GAAG,aAAa,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/DiscountOperations.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { Discount } from "../dto/response/Discount"; 4 | 5 | export class DiscountOperations extends BaseAirtimeOperation { 6 | 7 | static readonly END_POINT = "operators"; 8 | static readonly PATH_SEGMENT_DISCOUNT = "commissions"; 9 | 10 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean) { 11 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 12 | } 13 | 14 | public list(filter?: ReloadlyCore.QueryFilter): ReloadlyCore.IRequest> { 15 | var url = DiscountOperations.END_POINT + "/" + DiscountOperations.PATH_SEGMENT_DISCOUNT; 16 | return this.createGetRequest(url, filter); 17 | } 18 | 19 | public getByOperatorId(operatorId: bigint): ReloadlyCore.IRequest { 20 | this.validateOperatorId(operatorId); 21 | var url = DiscountOperations.END_POINT + "/" + operatorId + "/" + DiscountOperations.PATH_SEGMENT_DISCOUNT; 22 | return this.createGetRequest(url); 23 | } 24 | 25 | validateOperatorId(operatorId: bigint) { 26 | if (!operatorId || operatorId < 0) throw new Error("'operatorId' must be greater than 0."); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/PromotionOperations.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { Promotion } from "../dto/response/Promotion"; 4 | export declare class PromotionOperations extends BaseAirtimeOperation { 5 | static readonly END_POINT = "promotions"; 6 | static readonly PATH_SEGMENT_COUNTRIES = "countries"; 7 | static readonly PATH_SEGMENT_OPERATORS = "operators"; 8 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 9 | list(filter?: ReloadlyCore.QueryFilter): ReloadlyCore.IRequest>; 10 | getById(promotionId: bigint): ReloadlyCore.IRequest; 11 | getByCountryCode(countryCode: string): ReloadlyCore.IRequest; 12 | getByOperatorId(operatorId: bigint): ReloadlyCore.IRequest; 13 | validateOperatorId(operatorId: bigint): void; 14 | } 15 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/PromotionOperations.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"PromotionOperations.js","sourceRoot":"","sources":["PromotionOperations.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAG9D,MAAa,mBAAoB,SAAQ,2CAAoB;IAMzD,YAAY,OAAe,EAAE,QAAgB,EAAE,UAAkB,EAAE,eAAwB;QACvF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEM,IAAI,CAAC,MAAiC;QACzC,OAAO,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACxE,CAAC;IAEM,OAAO,CAAC,WAAmB;QAC9B,IAAI,CAAC,WAAW,IAAI,WAAW,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAC9F,OAAO,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,SAAS,GAAG,GAAG,GAAG,WAAW,CAAC,CAAC;IACpF,CAAC;IAEM,gBAAgB,CAAC,WAAmB;QACvC,IAAI,CAAC,WAAW;YAAE,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,gBAAgB,CACxB,mBAAmB,CAAC,SAAS,GAAG,GAAG;YACnC,mBAAmB,CAAC,sBAAsB,GAAG,GAAG;YAChD,WAAW,CAAC,CAAC;IACrB,CAAC;IAEM,eAAe,CAAC,UAAkB;QACrC,IAAI,CAAC,kBAAkB,CAAC,UAAU,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC,gBAAgB,CACxB,mBAAmB,CAAC,SAAS,GAAG,GAAG;YACnC,mBAAmB,CAAC,sBAAsB,GAAG,GAAG;YAChD,UAAU,CAAC,CAAC;IACpB,CAAC;IAED,kBAAkB,CAAC,UAAkB;QACjC,IAAI,CAAC,UAAU,IAAI,UAAU,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;IAC/F,CAAC;;AArCL,kDAsCC;AApCmB,6BAAS,GAAG,YAAY,CAAC;AACzB,0CAAsB,GAAG,WAAW,CAAC;AACrC,0CAAsB,GAAG,WAAW,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/ReportOperations.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 2 | import { TransactionHistoryOperations } from "./TransactionHistoryOperations"; 3 | export declare class ReportOperations extends BaseAirtimeOperation { 4 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 5 | transactionsHistory(): TransactionHistoryOperations; 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/ReportOperations.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ReportOperations = void 0; 4 | const BaseAirtimeOperation_1 = require("./BaseAirtimeOperation"); 5 | const TransactionHistoryOperations_1 = require("./TransactionHistoryOperations"); 6 | class ReportOperations extends BaseAirtimeOperation_1.BaseAirtimeOperation { 7 | constructor(baseUrl, apiToken, apiVersion, enableTelemetry) { 8 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 9 | } 10 | transactionsHistory() { 11 | return new TransactionHistoryOperations_1.TransactionHistoryOperations(this.baseUrl, this.apiToken, this.apiVersion, this.enableTelemetry); 12 | } 13 | } 14 | exports.ReportOperations = ReportOperations; 15 | //# sourceMappingURL=ReportOperations.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/ReportOperations.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ReportOperations.js","sourceRoot":"","sources":["ReportOperations.ts"],"names":[],"mappings":";;;AAAA,iEAA8D;AAC9D,iFAA8E;AAE9E,MAAa,gBAAiB,SAAQ,2CAAoB;IAEtD,YAAY,OAAe,EAAE,QAAgB,EAAE,UAAkB,EAAE,eAAwB;QACvF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAEM,mBAAmB;QACtB,OAAO,IAAI,2DAA4B,CACnC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;IAC5E,CAAC;CACJ;AAVD,4CAUC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/ReportOperations.ts: -------------------------------------------------------------------------------- 1 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 2 | import { TransactionHistoryOperations } from "./TransactionHistoryOperations"; 3 | 4 | export class ReportOperations extends BaseAirtimeOperation { 5 | 6 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean) { 7 | super(baseUrl, apiToken, apiVersion, enableTelemetry); 8 | } 9 | 10 | public transactionsHistory(): TransactionHistoryOperations { 11 | return new TransactionHistoryOperations( 12 | this.baseUrl, this.apiToken, this.apiVersion, this.enableTelemetry); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/TopupOperations.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { TopupRequest } from "../dto/request/TopupRequest"; 4 | import { TopupTransaction } from "../dto/response/TopupTransaction"; 5 | export declare class TopupOperations extends BaseAirtimeOperation { 6 | static readonly END_POINT = "topups"; 7 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 8 | send(request: TopupRequest): ReloadlyCore.IRequest; 9 | private validateTopupRequest; 10 | private assertValidPhone; 11 | private assertValidEmail; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/TransactionHistoryOperations.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require("@reloadly/reloadly.core"); 2 | import { BaseAirtimeOperation } from "./BaseAirtimeOperation"; 3 | import { TopupTransaction } from "../dto/response/TopupTransaction"; 4 | import { TransactionHistoryFilter } from "../filter/TransactionHistoryFilter"; 5 | export declare class TransactionHistoryOperations extends BaseAirtimeOperation { 6 | constructor(baseUrl: string, apiToken: string, apiVersion: string, enableTelemetry: boolean); 7 | static readonly TOPUP_TRANSACTION_HISTORY_END_POINT = "topups/reports/transactions"; 8 | list(filter?: TransactionHistoryFilter): ReloadlyCore.IRequest>; 9 | getById(transactionId: bigint): ReloadlyCore.IRequest; 10 | private validateStartAndEndDate; 11 | } 12 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/operation/TransactionHistoryOperations.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TransactionHistoryOperations.js","sourceRoot":"","sources":["TransactionHistoryOperations.ts"],"names":[],"mappings":";;;AACA,iEAA8D;AAI9D,MAAa,4BAA6B,SAAQ,2CAAoB;IAElE,YAAY,OAAe,EAAE,QAAgB,EAAE,UAAkB,EAAE,eAAwB;QACvF,KAAK,CAAC,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC;IAC1D,CAAC;IAIM,IAAI,CAAC,MAAiC;QACzC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,gBAAgB,CAAC,4BAA4B,CAAC,mCAAmC,EAAE,MAAM,CAAC,CAAC;IAC3G,CAAC;IAEM,OAAO,CAAC,aAAqB;QAChC,IAAI,CAAC,aAAa,IAAI,aAAa,IAAI,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;QACrG,OAAO,IAAI,CAAC,gBAAgB,CACxB,4BAA4B,CAAC,mCAAmC,GAAG,GAAG,GAAG,aAAa,CAAC,CAAC;IAChG,CAAC;IAEO,uBAAuB,CAAC,MAAiC;QAC7D,IAAI,CAAC,MAAM;YAAE,OAAO;QACpB,IAAI,CAAC,CAAC,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE;YAChF,MAAM,IAAI,KAAK,CAAC,mEAAmE,CAAC,CAAC;SACxF;aAAM,IAAI,MAAM,CAAC,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE;YAC1C,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;SAC3E;IACL,CAAC;;AA1BL,oEA2BC;AArBmB,gEAAmC,GAAG,6BAA6B,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@reloadly/reloadly.airtime", 3 | "version": "1.0.6", 4 | "description": "reloadly.airtime", 5 | "author": "reloadly", 6 | "homepage": "https://developers.reloadly.com/", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/Reloadly/reloadly-sdk-nodejs.git", 10 | "directory": "node-sdk-airtime" 11 | }, 12 | "devDependencies": { 13 | "@types/mocha": "^8.2.3", 14 | "@types/node": "^15.14.3", 15 | "mocha": "^8.4.0", 16 | "nyc": "^15.1.0", 17 | "typescript": "^4.3.5" 18 | }, 19 | "scripts": { 20 | "build": "tsc --build", 21 | "clean": "tsc --build --clean", 22 | "test": "nyc mocha" 23 | }, 24 | "dependencies": { 25 | "@reloadly/reloadly.authentication": "^1.0.6", 26 | "@reloadly/reloadly.core": "^1.0.6", 27 | "dotenv": "^10.0.0" 28 | }, 29 | "main": "Airtime.js", 30 | "license": "MIT", 31 | "directories": { 32 | "test": "test" 33 | }, 34 | "bugs": { 35 | "url": "https://github.com/Reloadly/reloadly-sdk-nodejs/issues" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/AccountOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/AccountOperationsTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | require('dotenv').config(); 4 | const AirtimeApi_1 = require("../AirtimeApi"); 5 | const TestCredentials_1 = require("./TestCredentials"); 6 | var assert = require('assert'); 7 | describe('Account Operations Tests', function () { 8 | it('Get Balance', async function () { 9 | this.timeout(0); 10 | var airtimeApi = new AirtimeApi_1.AirtimeApi(TestCredentials_1.TestCredentials.ClientId(), TestCredentials_1.TestCredentials.ClientSecret()); 11 | var accounts = await airtimeApi.accounts(); 12 | var req = accounts.getBalance(); 13 | var res = await req.execute(); 14 | assert.ok(Number(res.balance) !== 0, "getBalance failed."); 15 | }); 16 | }); 17 | //# sourceMappingURL=AccountOperationsTests.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/AccountOperationsTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AccountOperationsTests.js","sourceRoot":"","sources":["AccountOperationsTests.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,8CAA2C;AAC3C,uDAAoD;AAEpD,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,0BAA0B,EAAE;IACjC,EAAE,CAAC,aAAa,EAAE,KAAK;QACnB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,UAAU,GAAG,IAAI,uBAAU,CAC3B,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpC,IAAI,QAAQ,GAAG,MAAM,UAAU,CAAC,QAAQ,EAAE,CAAC;QAC3C,IAAI,GAAG,GAAG,QAAQ,CAAC,UAAU,EAAE,CAAC;QAChC,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/AccountOperationsTests.ts: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | import { AirtimeApi } from "../AirtimeApi"; 3 | import { TestCredentials } from "./TestCredentials"; 4 | 5 | var assert = require('assert'); 6 | 7 | describe('Account Operations Tests', function () { 8 | it('Get Balance', async function () { 9 | this.timeout(0); 10 | 11 | var airtimeApi = new AirtimeApi( 12 | TestCredentials.ClientId(), 13 | TestCredentials.ClientSecret()); 14 | 15 | var accounts = await airtimeApi.accounts(); 16 | var req = accounts.getBalance(); 17 | var res = await req.execute(); 18 | assert.ok(Number(res.balance) !== 0, "getBalance failed."); 19 | }) 20 | }) -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/CountryOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/CountryOperationsTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | require('dotenv').config(); 4 | const AirtimeApi_1 = require("../AirtimeApi"); 5 | const TestCredentials_1 = require("./TestCredentials"); 6 | var assert = require('assert'); 7 | describe('Country Operations Tests', function () { 8 | it('Get Country', async function () { 9 | this.timeout(0); 10 | var airtimeApi = new AirtimeApi_1.AirtimeApi(TestCredentials_1.TestCredentials.ClientId(), TestCredentials_1.TestCredentials.ClientSecret()); 11 | var operation = await airtimeApi.countries(); 12 | var req = operation.getByCode("AF"); 13 | var res = await req.execute(); 14 | assert.ok(res.name === "Afghanistan"); 15 | }); 16 | it('List Countries', async function () { 17 | this.timeout(0); 18 | var airtimeApi = new AirtimeApi_1.AirtimeApi(TestCredentials_1.TestCredentials.ClientId(), TestCredentials_1.TestCredentials.ClientSecret()); 19 | var operation = await airtimeApi.countries(); 20 | var req = operation.list(); 21 | var res = await req.execute(); 22 | assert.ok(res.length > 0); 23 | assert.ok(res[0].name === "Afghanistan"); 24 | }); 25 | }); 26 | //# sourceMappingURL=CountryOperationsTests.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/CountryOperationsTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CountryOperationsTests.js","sourceRoot":"","sources":["CountryOperationsTests.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,8CAA2C;AAC3C,uDAAoD;AAEpD,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,0BAA0B,EAAE;IACjC,EAAE,CAAC,aAAa,EAAE,KAAK;QACnB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,UAAU,GAAG,IAAI,uBAAU,CAC3B,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpC,IAAI,SAAS,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;QAC7C,IAAI,GAAG,GAAG,SAAS,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,gBAAgB,EAAE,KAAK;QACtB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,UAAU,GAAG,IAAI,uBAAU,CAC3B,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpC,IAAI,SAAS,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;QAC7C,IAAI,GAAG,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAC9B,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC1B,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,aAAa,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/CountryOperationsTests.ts: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | import { AirtimeApi } from "../AirtimeApi"; 3 | import { TestCredentials } from "./TestCredentials"; 4 | 5 | var assert = require('assert'); 6 | 7 | describe('Country Operations Tests', function () { 8 | it('Get Country', async function () { 9 | this.timeout(0); 10 | 11 | var airtimeApi = new AirtimeApi( 12 | TestCredentials.ClientId(), 13 | TestCredentials.ClientSecret()); 14 | 15 | var operation = await airtimeApi.countries(); 16 | var req = operation.getByCode("AF"); 17 | var res = await req.execute(); 18 | assert.ok(res.name === "Afghanistan"); 19 | }); 20 | 21 | it('List Countries', async function () { 22 | this.timeout(0); 23 | 24 | var airtimeApi = new AirtimeApi( 25 | TestCredentials.ClientId(), 26 | TestCredentials.ClientSecret()); 27 | 28 | var operation = await airtimeApi.countries(); 29 | var req = operation.list(); 30 | var res = await req.execute(); 31 | assert.ok(res.length > 0); 32 | assert.ok(res[0].name === "Afghanistan"); 33 | }); 34 | }); -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/DiscountOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/OperatorOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/PromotionOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TestCredentials.d.ts: -------------------------------------------------------------------------------- 1 | export declare class TestCredentials { 2 | static ClientId(): string; 3 | static ClientSecret(): string; 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TestCredentials.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TestCredentials = void 0; 4 | class TestCredentials { 5 | static ClientId() { 6 | return process.env.CLIENT_ID; 7 | } 8 | static ClientSecret() { 9 | return process.env.CLIENT_SECRET; 10 | } 11 | } 12 | exports.TestCredentials = TestCredentials; 13 | //# sourceMappingURL=TestCredentials.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TestCredentials.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TestCredentials.js","sourceRoot":"","sources":["TestCredentials.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAEjB,MAAM,CAAC,QAAQ;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,YAAY;QACtB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACrC,CAAC;CACJ;AATD,0CASC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TestCredentials.ts: -------------------------------------------------------------------------------- 1 | export class TestCredentials { 2 | 3 | public static ClientId(): string { 4 | return process.env.CLIENT_ID; 5 | } 6 | 7 | public static ClientSecret(): string { 8 | return process.env.CLIENT_SECRET; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TopupOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TopupOperationsTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | require('dotenv').config(); 4 | const Airtime_1 = require("../Airtime"); 5 | const AirtimeApi_1 = require("../AirtimeApi"); 6 | const Phone_1 = require("../dto/response/Phone"); 7 | const TestCredentials_1 = require("./TestCredentials"); 8 | var assert = require('assert'); 9 | describe('Topup Operations Tests', function () { 10 | it('Topup', async function () { 11 | this.timeout(0); 12 | var airtimeApi = new AirtimeApi_1.AirtimeApi(TestCredentials_1.TestCredentials.ClientId(), TestCredentials_1.TestCredentials.ClientSecret()); 13 | var operOp = await airtimeApi.operators(); 14 | var operReq = operOp.listByCountryCode("GB"); 15 | var operRes = await operReq.execute(); 16 | var operatorId = Number(operRes[0].id); 17 | var operation = await airtimeApi.topups(); 18 | var req = operation.send(new Airtime_1.PhoneTopupRequest(10, operatorId, new Phone_1.Phone("+447772235236", "GB"), true, new Phone_1.Phone("+447772235235", "GB"))); 19 | var res = await req.execute(); 20 | assert.ok("447772235236" === res.recipientPhone); 21 | }); 22 | }); 23 | //# sourceMappingURL=TopupOperationsTests.js.map -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TopupOperationsTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TopupOperationsTests.js","sourceRoot":"","sources":["TopupOperationsTests.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,wCAA+C;AAC/C,8CAA2C;AAC3C,iDAA8C;AAC9C,uDAAoD;AAEpD,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,wBAAwB,EAAE;IAC/B,EAAE,CAAC,OAAO,EAAE,KAAK;QACb,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,UAAU,GAAG,IAAI,uBAAU,CAC3B,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpC,IAAI,MAAM,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;QAC1C,IAAI,OAAO,GAAG,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;QAC7C,IAAI,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACtC,IAAI,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAEvC,IAAI,SAAS,GAAG,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;QAC1C,IAAI,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,2BAAiB,CAC1C,EAAE,EAAE,UAAU,EAAE,IAAI,aAAK,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,aAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/F,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAE9B,MAAM,CAAC,EAAE,CAAC,cAAc,KAAK,GAAG,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TopupOperationsTests.ts: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | import { PhoneTopupRequest } from "../Airtime"; 3 | import { AirtimeApi } from "../AirtimeApi"; 4 | import { Phone } from "../dto/response/Phone"; 5 | import { TestCredentials } from "./TestCredentials"; 6 | 7 | var assert = require('assert'); 8 | 9 | describe('Topup Operations Tests', function () { 10 | it('Topup', async function () { 11 | this.timeout(0); 12 | 13 | var airtimeApi = new AirtimeApi( 14 | TestCredentials.ClientId(), 15 | TestCredentials.ClientSecret()); 16 | 17 | var operOp = await airtimeApi.operators(); 18 | var operReq = operOp.listByCountryCode("GB"); 19 | var operRes = await operReq.execute(); 20 | var operatorId = Number(operRes[0].id); 21 | 22 | var operation = await airtimeApi.topups(); 23 | var req = operation.send(new PhoneTopupRequest( 24 | 10, operatorId, new Phone("+447772235236", "GB"), true, new Phone("+447772235235", "GB"))); 25 | var res = await req.execute(); 26 | 27 | assert.ok("447772235236" === res.recipientPhone); 28 | }); 29 | }); 30 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TransactionHistoryOperationsTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TransactionHistoryOperationsTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TransactionHistoryOperationsTests.js","sourceRoot":"","sources":["TransactionHistoryOperationsTests.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,8CAA2C;AAC3C,uDAAoD;AAEpD,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,qCAAqC,EAAE;IAC5C,EAAE,CAAC,0BAA0B,EAAE,KAAK;QAChC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,UAAU,GAAG,IAAI,uBAAU,CAC3B,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpC,IAAI,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,SAAS,GAAG,QAAQ,CAAC,mBAAmB,EAAE,CAAC;QAC/C,IAAI,GAAG,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QAC3B,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAE9B,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,WAAW,EAAE,KAAK;QACjB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,UAAU,GAAG,IAAI,uBAAU,CAC3B,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpC,IAAI,QAAQ,GAAG,MAAM,UAAU,CAAC,OAAO,EAAE,CAAC;QAC1C,IAAI,SAAS,GAAG,QAAQ,CAAC,mBAAmB,EAAE,CAAC;QAC/C,IAAI,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QAC/B,IAAI,OAAO,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QAEtC,IAAI,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC;QAC9D,IAAI,GAAG,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAE9B,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,KAAK,GAAG,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} -------------------------------------------------------------------------------- /node-sdk-airtime/src/test/TransactionHistoryOperationsTests.ts: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | import { AirtimeApi } from "../AirtimeApi"; 3 | import { TestCredentials } from "./TestCredentials"; 4 | 5 | var assert = require('assert'); 6 | 7 | describe('TransactionHistory Operations Tests', function () { 8 | it('List Transaction History', async function () { 9 | this.timeout(0); 10 | 11 | var airtimeApi = new AirtimeApi( 12 | TestCredentials.ClientId(), 13 | TestCredentials.ClientSecret()); 14 | 15 | var reportOp = await airtimeApi.reports(); 16 | var operation = reportOp.transactionsHistory(); 17 | var req = operation.list(); 18 | var res = await req.execute(); 19 | 20 | assert.ok(res.content.length > 0); 21 | }); 22 | 23 | it('Get By Id', async function () { 24 | this.timeout(0); 25 | 26 | var airtimeApi = new AirtimeApi( 27 | TestCredentials.ClientId(), 28 | TestCredentials.ClientSecret()); 29 | 30 | var reportOp = await airtimeApi.reports(); 31 | var operation = reportOp.transactionsHistory(); 32 | var listReq = operation.list(); 33 | var listRes = await listReq.execute(); 34 | 35 | var req = operation.getById(listRes.content[0].transactionId); 36 | var res = await req.execute(); 37 | 38 | assert.ok(listRes.content[0].transactionId === res.transactionId); 39 | }); 40 | }); 41 | -------------------------------------------------------------------------------- /node-sdk-airtime/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "declaration": true, 5 | "lib": [ "es2020" ], 6 | "moduleResolution": "node", 7 | "module": "commonjs", 8 | "noImplicitAny": false, 9 | "noEmitOnError": true, 10 | "removeComments": false, 11 | "sourceMap": true, 12 | "target": "es2020" 13 | }, 14 | "include": [ 15 | "**/*" 16 | ], 17 | "references": [ 18 | { "path": "../../node-sdk-core/src" }, 19 | { "path": "../../node-sdk-authentication/src" } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /node-sdk-airtime/usage/ACCOUNT-OPERATIONS.md: -------------------------------------------------------------------------------- 1 | # Account Operations 2 | 3 | Use the account operations to perform account related actions. 4 | 5 | ## Retrieve account balance info 6 | 7 | ```typescript 8 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 9 | var operation = await api.accounts(); 10 | var request = operation.getBalance(); 11 | var balanceInfo = await request.execute(); 12 | ``` 13 | -------------------------------------------------------------------------------- /node-sdk-airtime/usage/COUNTRY-OPERATIONS.md: -------------------------------------------------------------------------------- 1 | # Countries Operations 2 | 3 | Reloadly supports 140+ Countries around the globe. You can get a list of all or specific supported countries. The 4 | response will give you a list with complete details, iso, flag as well as calling codes for each country. You can also 5 | further filter the countries by getting details for a specific country by its ISO-Alpha2 code. 6 | See https://www.nationsonline.org/oneworld/country_code_list.htm for more details regarding country ISO codes. 7 | 8 | ```typescript 9 | let api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 10 | let operation = await api.countries(); 11 | 12 | // Get Countries 13 | let countriesReq = operation.list(); 14 | let countries = await countriesReq.execute(); 15 | 16 | // Get Country by ISO Code 17 | let countryReq = operation.getByCode('GB'); 18 | let country = await countryReq.execute(); 19 | ``` 20 | -------------------------------------------------------------------------------- /node-sdk-airtime/usage/PROMOTION-OPERATIONS.md: -------------------------------------------------------------------------------- 1 | # Promotions Operations 2 | 3 | Reloady also support operators promotions. These are provided by the operators and can be activated by sending a 4 | specific topup amount as per the details of the promotion. Using the promotion operations you can retrieve all details 5 | on the different operators promotions and to showcase these to your customers. 6 | 7 | ```typescript 8 | let api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 9 | let operation = await api.promotions(); 10 | 11 | var request0 = await operation.getByCountryCode("EC"); 12 | var promotions0 = await request0.execute(); 13 | 14 | var request1 = await operation.getById(123); 15 | var promotions1 = await request1.execute(); 16 | 17 | var request2 = await operation.getByOperatorId(123); 18 | var promotions2 = await request2.execute(); 19 | 20 | var request3 = await operation.list(); 21 | var promotions3 = await request3.execute(); 22 | ``` 23 | -------------------------------------------------------------------------------- /node-sdk-airtime/usage/REPORT-OPERATIONS.md: -------------------------------------------------------------------------------- 1 | # Report Operations 2 | 3 | Retrieve various reports such as transaction history etc... 4 | 5 | ```typescript 6 | let api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 7 | let operation = await api.reports().transactionsHistory() 8 | 9 | var request0 = operation.getById("Your-Transaction-Custom-Identifier"); 10 | var transaction0 = await request0.execute(); 11 | 12 | var request1 = operation.list(); 13 | var transactions1 = await request1.execute(); 14 | 15 | var request2 = operation.list( 16 | new TransactionHistoryFilter() 17 | .countryCode("HT") 18 | .customIdentifier("Your-Transaction-Custom-Identifier") 19 | .endDate(new Date()) 20 | .operatorId(123) 21 | .operatorName("Digicel Haiti") 22 | .startDate(new Date() - 1) 23 | .withPage(1 /*pageNumber*/, 20 /*pageSize*/) 24 | ); 25 | var transactions2 = await request2.execute(); 26 | ``` 27 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/.gitignore: -------------------------------------------------------------------------------- 1 | .env -------------------------------------------------------------------------------- /node-sdk-authentication/src/Authentication.d.ts: -------------------------------------------------------------------------------- 1 | export { AuthenticationApi } from "./Client/AuthenticationApi"; 2 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Authentication.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AuthenticationApi = void 0; 4 | var AuthenticationApi_1 = require("./Client/AuthenticationApi"); 5 | Object.defineProperty(exports, "AuthenticationApi", { enumerable: true, get: function () { return AuthenticationApi_1.AuthenticationApi; } }); 6 | //# sourceMappingURL=Authentication.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/Authentication.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Authentication.js","sourceRoot":"","sources":["Authentication.ts"],"names":[],"mappings":";;;AAAA,gEAA+D;AAAtD,sHAAA,iBAAiB,OAAA"} -------------------------------------------------------------------------------- /node-sdk-authentication/src/Authentication.ts: -------------------------------------------------------------------------------- 1 | export { AuthenticationApi } from "./Client/AuthenticationApi"; 2 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Client/AuthenticationApi.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require('@reloadly/reloadly.core'); 2 | import { OAuth2ClientCredentialsOperation } from "./OAuth2ClientCredentialsOperation"; 3 | /** 4 | * Class that provides an implementation of some of the Authentication and Authorization API methods 5 | */ 6 | export declare class AuthenticationApi extends ReloadlyCore.Api { 7 | static readonly BASE_URL: string; 8 | service: string; 9 | constructor(clientId: string, clientSecret: string, service: string, enableLogging?: boolean, redactHeaders?: string[], enableTelemetry?: boolean); 10 | clientCredentials(): OAuth2ClientCredentialsOperation; 11 | } 12 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Client/AuthenticationApi.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.AuthenticationApi = void 0; 4 | const ReloadlyCore = require("@reloadly/reloadly.core"); 5 | const OAuth2ClientCredentialsOperation_1 = require("./OAuth2ClientCredentialsOperation"); 6 | /** 7 | * Class that provides an implementation of some of the Authentication and Authorization API methods 8 | */ 9 | class AuthenticationApi extends ReloadlyCore.Api { 10 | constructor(clientId, clientSecret, service, enableLogging = true, redactHeaders = [], enableTelemetry = true) { 11 | super(clientId, clientSecret, enableLogging, redactHeaders, enableTelemetry); 12 | if (!clientId) 13 | throw new Error("'clientId' must be provided."); 14 | if (!clientSecret) 15 | throw new Error("'clientSecret' must be provided."); 16 | if (!service) 17 | throw new Error("'service' must be provided."); 18 | this.service = service; 19 | } 20 | clientCredentials() { 21 | return new OAuth2ClientCredentialsOperation_1.OAuth2ClientCredentialsOperation(AuthenticationApi.BASE_URL, this.clientId, this.clientSecret, this.service) 22 | .proxy(this.proxyOptions) 23 | .timeout(this.timeoutInMilliseconds); 24 | } 25 | } 26 | exports.AuthenticationApi = AuthenticationApi; 27 | AuthenticationApi.BASE_URL = "https://auth.reloadly.com"; 28 | //# sourceMappingURL=AuthenticationApi.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/Client/AuthenticationApi.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AuthenticationApi.js","sourceRoot":"","sources":["AuthenticationApi.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;AACzD,yFAAsF;AAEtF;;GAEG;AACH,MAAa,iBAAkB,SAAQ,YAAY,CAAC,GAAG;IAMnD,YAAY,QAAgB,EAAE,YAAoB,EAC9C,OAAe,EAAE,gBAAyB,IAAI,EAC9C,gBAA0B,EAAE,EAAE,kBAA2B,IAAI;QAE7D,KAAK,CAAC,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;QAE7E,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC/D,IAAI,CAAC,YAAY;YAAE,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;QACvE,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAE7D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IAC3B,CAAC;IAEM,iBAAiB;QACpB,OAAO,IAAI,mEAAgC,CAAC,iBAAiB,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC;aAClH,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC;aACxB,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC7C,CAAC;;AAvBL,8CAwBC;AAtBmB,0BAAQ,GAAW,2BAA2B,CAAC"} -------------------------------------------------------------------------------- /node-sdk-authentication/src/Client/AuthenticationApi.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require('@reloadly/reloadly.core'); 2 | import { OAuth2ClientCredentialsOperation } from "./OAuth2ClientCredentialsOperation"; 3 | 4 | /** 5 | * Class that provides an implementation of some of the Authentication and Authorization API methods 6 | */ 7 | export class AuthenticationApi extends ReloadlyCore.Api { 8 | 9 | static readonly BASE_URL: string = "https://auth.reloadly.com"; 10 | 11 | service: string; 12 | 13 | constructor(clientId: string, clientSecret: string, 14 | service: string, enableLogging: boolean = true, 15 | redactHeaders: string[] = [], enableTelemetry: boolean = true) { 16 | 17 | super(clientId, clientSecret, enableLogging, redactHeaders, enableTelemetry); 18 | 19 | if (!clientId) throw new Error("'clientId' must be provided."); 20 | if (!clientSecret) throw new Error("'clientSecret' must be provided."); 21 | if (!service) throw new Error("'service' must be provided."); 22 | 23 | this.service = service; 24 | } 25 | 26 | public clientCredentials(): OAuth2ClientCredentialsOperation { 27 | return new OAuth2ClientCredentialsOperation(AuthenticationApi.BASE_URL, this.clientId, this.clientSecret, this.service) 28 | .proxy(this.proxyOptions) 29 | .timeout(this.timeoutInMilliseconds); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/README.md: -------------------------------------------------------------------------------- 1 | # @reloadly/reloadly.authentication 2 | 3 | The implementation is based on the [Airtime API Docs](https://developers.reloadly.com/#airtime-api). 4 | 5 | ## Usage 6 | 7 | ```typescript 8 | import ReloadlyAuthentication = require("@reloadly/reloadly.authentication"); 9 | import ReloadlyCore = require("@reloadly/reloadly.core"); 10 | 11 | var api = new ReloadlyAuthentication.AuthenticationApi("", "", ReloadlyCore.ServiceURLs.AIRTIME_SANDBOX); 12 | var operation = api.clientCredentials(); 13 | var request = operation.getAccessToken(); 14 | var response = await request.execute(); 15 | var token = response.access_token; 16 | ``` 17 | 18 | You may find more information on the repository homepage: 19 | https://github.com/Reloadly/reloadly-sdk-nodejs 20 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/IOAuth2ClientCredentialsRequest.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require('@reloadly/reloadly.core'); 2 | import { TokenHolder } from "../Response/TokenHolder"; 3 | /** 4 | * Class that represents an OAuth 2.0 Authentication/Authorization request. The execution will return a {@link TokenHolder}. 5 | */ 6 | export interface IOAuth2ClientCredentialsRequest extends ReloadlyCore.IRequest { 7 | /** 8 | * Setter for the audience value to request 9 | * 10 | * @param audience the audience to request 11 | * @return this request instance. 12 | */ 13 | setAudience(audience: string): IOAuth2ClientCredentialsRequest; 14 | } 15 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/IOAuth2ClientCredentialsRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=IOAuth2ClientCredentialsRequest.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/IOAuth2ClientCredentialsRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IOAuth2ClientCredentialsRequest.js","sourceRoot":"","sources":["IOAuth2ClientCredentialsRequest.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/IOAuth2ClientCredentialsRequest.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require('@reloadly/reloadly.core'); 2 | import { TokenHolder } from "../Response/TokenHolder"; 3 | 4 | /** 5 | * Class that represents an OAuth 2.0 Authentication/Authorization request. The execution will return a {@link TokenHolder}. 6 | */ 7 | export interface IOAuth2ClientCredentialsRequest extends ReloadlyCore.IRequest { 8 | /** 9 | * Setter for the audience value to request 10 | * 11 | * @param audience the audience to request 12 | * @return this request instance. 13 | */ 14 | setAudience(audience: string): IOAuth2ClientCredentialsRequest; 15 | } 16 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/TokenRequest.d.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require('@reloadly/reloadly.core'); 2 | import { IOAuth2ClientCredentialsRequest } from "./IOAuth2ClientCredentialsRequest"; 3 | import { TokenHolder } from "../Response/TokenHolder"; 4 | export declare class TokenRequest extends ReloadlyCore.CustomRequest implements IOAuth2ClientCredentialsRequest { 5 | constructor(url: string); 6 | setAudience(audience: string): TokenRequest; 7 | } 8 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/TokenRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TokenRequest = void 0; 4 | const ReloadlyCore = require("@reloadly/reloadly.core"); 5 | class TokenRequest extends ReloadlyCore.CustomRequest { 6 | constructor(url) { 7 | super(url, "POST", {}, {}); 8 | } 9 | setAudience(audience) { 10 | this.body["audience"] = audience; 11 | return this; 12 | } 13 | } 14 | exports.TokenRequest = TokenRequest; 15 | //# sourceMappingURL=TokenRequest.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/TokenRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TokenRequest.js","sourceRoot":"","sources":["TokenRequest.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;AAIzD,MAAa,YAAa,SAAQ,YAAY,CAAC,aAA0B;IAErE,YAAY,GAAW;QACnB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAC/B,CAAC;IAEM,WAAW,CAAC,QAAgB;QAC/B,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,QAAQ,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAVD,oCAUC"} -------------------------------------------------------------------------------- /node-sdk-authentication/src/Request/TokenRequest.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyCore = require('@reloadly/reloadly.core'); 2 | import { IOAuth2ClientCredentialsRequest } from "./IOAuth2ClientCredentialsRequest"; 3 | import { TokenHolder } from "../Response/TokenHolder"; 4 | 5 | export class TokenRequest extends ReloadlyCore.CustomRequest implements IOAuth2ClientCredentialsRequest { 6 | 7 | constructor(url: string) { 8 | super(url, "POST", {}, {}); 9 | } 10 | 11 | public setAudience(audience: string): TokenRequest { 12 | this.body["audience"] = audience; 13 | return this; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Response/TokenHolder.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class that contains the Tokens obtained after a call to the {@link AuthenticationAPI} methods. 3 | */ 4 | export declare class TokenHolder { 5 | access_token?: string; 6 | token_type: string; 7 | expires_in: bigint; 8 | } 9 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/Response/TokenHolder.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TokenHolder = void 0; 4 | /** 5 | * Class that contains the Tokens obtained after a call to the {@link AuthenticationAPI} methods. 6 | */ 7 | class TokenHolder { 8 | } 9 | exports.TokenHolder = TokenHolder; 10 | //# sourceMappingURL=TokenHolder.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/Response/TokenHolder.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TokenHolder.js","sourceRoot":"","sources":["TokenHolder.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,WAAW;CAIvB;AAJD,kCAIC"} -------------------------------------------------------------------------------- /node-sdk-authentication/src/Response/TokenHolder.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class that contains the Tokens obtained after a call to the {@link AuthenticationAPI} methods. 3 | */ 4 | export class TokenHolder { 5 | access_token?: string; 6 | token_type: string; 7 | expires_in: bigint; 8 | } 9 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@reloadly/reloadly.authentication", 3 | "version": "1.0.6", 4 | "description": "reloadly.authentication", 5 | "author": "reloadly", 6 | "homepage": "https://developers.reloadly.com/", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/Reloadly/reloadly-sdk-nodejs.git", 10 | "directory": "node-sdk-authentication" 11 | }, 12 | "devDependencies": { 13 | "@types/mocha": "^8.2.3", 14 | "@types/node": "^15.14.3", 15 | "mocha": "^8.4.0", 16 | "nyc": "^15.1.0", 17 | "typescript": "^4.3.5" 18 | }, 19 | "scripts": { 20 | "build": "tsc --build", 21 | "clean": "tsc --build --clean", 22 | "test": "nyc mocha" 23 | }, 24 | "dependencies": { 25 | "@reloadly/reloadly.core": "^1.0.6", 26 | "dotenv": "^10.0.0" 27 | }, 28 | "main": "Authentication.js", 29 | "license": "MIT", 30 | "directories": { 31 | "test": "test" 32 | }, 33 | "bugs": { 34 | "url": "https://github.com/Reloadly/reloadly-sdk-nodejs/issues" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/AuthenticationApiTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/AuthenticationApiTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | require('dotenv').config(); 4 | var assert = require('assert'); 5 | const ReloadlyCore = require("@reloadly/reloadly.core"); 6 | const Authentication_1 = require("../Authentication"); 7 | const TestCredentials_1 = require("./TestCredentials"); 8 | describe('Authentication Api Tests', function () { 9 | it('Get Access Token', async function () { 10 | this.timeout(0); 11 | var authenticationApi = new Authentication_1.AuthenticationApi(TestCredentials_1.TestCredentials.ClientId(), TestCredentials_1.TestCredentials.ClientSecret(), ReloadlyCore.Service.AIRTIME_SANDBOX); 12 | var request = await authenticationApi.clientCredentials().getAccessToken(); 13 | var token = await request.execute(); 14 | assert.ok(token.access_token != null); 15 | }); 16 | }); 17 | //# sourceMappingURL=AuthenticationApiTests.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/AuthenticationApiTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"AuthenticationApiTests.js","sourceRoot":"","sources":["AuthenticationApiTests.ts"],"names":[],"mappings":";;AAAA,OAAO,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;AAC3B,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/B,wDAAyD;AACzD,sDAAsD;AACtD,uDAAoD;AAEpD,QAAQ,CAAC,0BAA0B,EAAE;IACjC,EAAE,CAAC,kBAAkB,EAAE,KAAK;QACxB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,iBAAiB,GAAG,IAAI,kCAAiB,CACzC,iCAAe,CAAC,QAAQ,EAAE,EAC1B,iCAAe,CAAC,YAAY,EAAE,EAC9B,YAAY,CAAC,OAAO,CAAC,eAAe,CACvC,CAAC;QAEF,IAAI,OAAO,GAAG,MAAM,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,cAAc,EAAE,CAAC;QAC3E,IAAI,KAAK,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACpC,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,IAAI,IAAI,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/AuthenticationApiTests.ts: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | var assert = require('assert'); 3 | import ReloadlyCore = require('@reloadly/reloadly.core'); 4 | import { AuthenticationApi } from "../Authentication"; 5 | import { TestCredentials } from "./TestCredentials"; 6 | 7 | describe('Authentication Api Tests', function () { 8 | it('Get Access Token', async function () { 9 | this.timeout(0); 10 | 11 | var authenticationApi = new AuthenticationApi( 12 | TestCredentials.ClientId(), 13 | TestCredentials.ClientSecret(), 14 | ReloadlyCore.Service.AIRTIME_SANDBOX 15 | ); 16 | 17 | var request = await authenticationApi.clientCredentials().getAccessToken(); 18 | var token = await request.execute(); 19 | assert.ok(token.access_token != null); 20 | }) 21 | }) -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/TestCredentials.d.ts: -------------------------------------------------------------------------------- 1 | export declare class TestCredentials { 2 | static ClientId(): string; 3 | static ClientSecret(): string; 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/TestCredentials.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.TestCredentials = void 0; 4 | class TestCredentials { 5 | static ClientId() { 6 | return process.env.CLIENT_ID; 7 | } 8 | static ClientSecret() { 9 | return process.env.CLIENT_SECRET; 10 | } 11 | } 12 | exports.TestCredentials = TestCredentials; 13 | //# sourceMappingURL=TestCredentials.js.map -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/TestCredentials.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TestCredentials.js","sourceRoot":"","sources":["TestCredentials.ts"],"names":[],"mappings":";;;AAAA,MAAa,eAAe;IAEjB,MAAM,CAAC,QAAQ;QAClB,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;IACjC,CAAC;IAEM,MAAM,CAAC,YAAY;QACtB,OAAO,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IACrC,CAAC;CACJ;AATD,0CASC"} -------------------------------------------------------------------------------- /node-sdk-authentication/src/test/TestCredentials.ts: -------------------------------------------------------------------------------- 1 | export class TestCredentials { 2 | 3 | public static ClientId(): string { 4 | return process.env.CLIENT_ID; 5 | } 6 | 7 | public static ClientSecret(): string { 8 | return process.env.CLIENT_SECRET; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /node-sdk-authentication/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "declaration": true, 5 | "moduleResolution": "node", 6 | "module": "commonjs", 7 | "noImplicitAny": false, 8 | "noEmitOnError": true, 9 | "removeComments": false, 10 | "sourceMap": true, 11 | "target": "es2020" 12 | }, 13 | "include": [ 14 | "**/*" 15 | ], 16 | "references": [ 17 | { "path": "../../node-sdk-core/src" } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /node-sdk-core/src/Constant/ServiceURLs.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ServiceURLs { 2 | static readonly AIRTIME = "https://topups.reloadly.com"; 3 | static readonly AIRTIME_SANDBOX = "https://topups-sandbox.reloadly.com"; 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Constant/ServiceURLs.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ServiceURLs = void 0; 4 | class ServiceURLs { 5 | } 6 | exports.ServiceURLs = ServiceURLs; 7 | ServiceURLs.AIRTIME = 'https://topups.reloadly.com'; 8 | ServiceURLs.AIRTIME_SANDBOX = 'https://topups-sandbox.reloadly.com'; 9 | //# sourceMappingURL=ServiceURLs.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Constant/ServiceURLs.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ServiceURLs.js","sourceRoot":"","sources":["ServiceURLs.ts"],"names":[],"mappings":";;;AAAA,MAAa,WAAW;;AAAxB,kCAGC;AAFmB,mBAAO,GAAG,6BAA6B,CAAC;AACxC,2BAAe,GAAG,qCAAqC,CAAC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Constant/ServiceURLs.ts: -------------------------------------------------------------------------------- 1 | export class ServiceURLs { 2 | static readonly AIRTIME = 'https://topups.reloadly.com'; 3 | static readonly AIRTIME_SANDBOX = 'https://topups-sandbox.reloadly.com'; 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Core.d.ts: -------------------------------------------------------------------------------- 1 | export { Api } from "./Internal/Net/Api"; 2 | export { BaseOperation } from "./Internal/Client/BaseOperation"; 3 | export { CustomRequest } from "./Internal/Dto/Request/CustomRequest"; 4 | export { Environment } from "./Enums/Environment"; 5 | export { GrantType } from "./Internal/Constant/GrantType"; 6 | export { HttpHeader } from "./Internal/Constant/HttpHeader"; 7 | export { ICustomizableRequest } from "./Internal/Dto/Request/ICustomizableRequest"; 8 | export { IRequest } from "./Internal/Dto/Request/Interfaces/IRequest"; 9 | export { MediaType } from "./Internal/Constant/MediaType"; 10 | export { Page } from "./Dto/Response/Page"; 11 | export { ProxyOptions } from "./Internal/Dto/Request/ProxyOptions"; 12 | export { ProxyOptionsAuth } from "./Internal/Dto/Request/ProxyOptionsAuth"; 13 | export { QueryFilter } from "./Internal/Filter/QueryFilter"; 14 | export { Service } from "./Enums/Service"; 15 | export { ServiceApi } from "./Internal/Net/ServiceApi"; 16 | export { ServiceURLs } from "./Constant/ServiceURLs"; 17 | export { Version } from "./Internal/Enums/Version"; 18 | -------------------------------------------------------------------------------- /node-sdk-core/src/Core.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Core.js","sourceRoot":"","sources":["Core.ts"],"names":[],"mappings":";;;AAAA,0CAAyC;AAAhC,0FAAA,GAAG,OAAA;AACZ,iEAAgE;AAAvD,8GAAA,aAAa,OAAA;AACtB,sEAAqE;AAA5D,8GAAA,aAAa,OAAA;AACtB,mDAAkD;AAAzC,0GAAA,WAAW,OAAA;AACpB,2DAA0D;AAAjD,sGAAA,SAAS,OAAA;AAClB,6DAA4D;AAAnD,wGAAA,UAAU,OAAA;AAGnB,2DAA0D;AAAjD,sGAAA,SAAS,OAAA;AAClB,4CAA2C;AAAlC,4FAAA,IAAI,OAAA;AACb,oEAAmE;AAA1D,4GAAA,YAAY,OAAA;AACrB,4EAA2E;AAAlE,oHAAA,gBAAgB,OAAA;AACzB,6DAA4D;AAAnD,0GAAA,WAAW,OAAA;AACpB,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAChB,wDAAuD;AAA9C,wGAAA,UAAU,OAAA;AACnB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,oDAAmD;AAA1C,kGAAA,OAAO,OAAA"} -------------------------------------------------------------------------------- /node-sdk-core/src/Core.ts: -------------------------------------------------------------------------------- 1 | export { Api } from "./Internal/Net/Api"; 2 | export { BaseOperation } from "./Internal/Client/BaseOperation"; 3 | export { CustomRequest } from "./Internal/Dto/Request/CustomRequest"; 4 | export { Environment } from "./Enums/Environment"; 5 | export { GrantType } from "./Internal/Constant/GrantType"; 6 | export { HttpHeader } from "./Internal/Constant/HttpHeader"; 7 | export { ICustomizableRequest } from "./Internal/Dto/Request/ICustomizableRequest"; 8 | export { IRequest } from "./Internal/Dto/Request/Interfaces/IRequest"; 9 | export { MediaType } from "./Internal/Constant/MediaType"; 10 | export { Page } from "./Dto/Response/Page"; 11 | export { ProxyOptions } from "./Internal/Dto/Request/ProxyOptions"; 12 | export { ProxyOptionsAuth } from "./Internal/Dto/Request/ProxyOptionsAuth"; 13 | export { QueryFilter } from "./Internal/Filter/QueryFilter"; 14 | export { Service } from "./Enums/Service"; 15 | export { ServiceApi } from "./Internal/Net/ServiceApi"; 16 | export { ServiceURLs } from "./Constant/ServiceURLs"; 17 | export { Version } from "./Internal/Enums/Version"; 18 | -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/APIError.ts: -------------------------------------------------------------------------------- 1 | export class ApiError { 2 | /** 3 | * Additional details that might be helpful in understanding the error(s) that occurred. 4 | */ 5 | details: {}[]; 6 | 7 | /** 8 | * For some errors that could be handled programmatically, a string summarizing the error reported. 9 | */ 10 | errorCode: string; 11 | 12 | /** 13 | * Link to documentations containing additional info regarding the error. 14 | */ 15 | infoLink: string; 16 | 17 | /** 18 | * A human-readable message providing more details about the error. 19 | */ 20 | message: string; 21 | 22 | /** 23 | * The end-point that was used when the error occurred 24 | */ 25 | path: string; 26 | 27 | /** 28 | * "The timestamp when the usage occurred" 29 | */ 30 | timeStamp: Date; 31 | 32 | constructor(message: string, path: string, timeStamp: Date, errorCode?: string, details?: {}[], infoLink?: string) { 33 | this.message = message; 34 | this.path = path; 35 | this.timeStamp = timeStamp; 36 | this.errorCode = errorCode; 37 | this.details = details; 38 | this.infoLink = infoLink; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/ApiError.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ApiError { 2 | /** 3 | * Additional details that might be helpful in understanding the error(s) that occurred. 4 | */ 5 | details: {}[]; 6 | /** 7 | * For some errors that could be handled programmatically, a string summarizing the error reported. 8 | */ 9 | errorCode: string; 10 | /** 11 | * Link to documentations containing additional info regarding the error. 12 | */ 13 | infoLink: string; 14 | /** 15 | * A human-readable message providing more details about the error. 16 | */ 17 | message: string; 18 | /** 19 | * The end-point that was used when the error occurred 20 | */ 21 | path: string; 22 | /** 23 | * "The timestamp when the usage occurred" 24 | */ 25 | timeStamp: Date; 26 | constructor(message: string, path: string, timeStamp: Date, errorCode?: string, details?: {}[], infoLink?: string); 27 | } 28 | -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/ApiError.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ApiError = void 0; 4 | class ApiError { 5 | constructor(message, path, timeStamp, errorCode, details, infoLink) { 6 | this.message = message; 7 | this.path = path; 8 | this.timeStamp = timeStamp; 9 | this.errorCode = errorCode; 10 | this.details = details; 11 | this.infoLink = infoLink; 12 | } 13 | } 14 | exports.ApiError = ApiError; 15 | //# sourceMappingURL=ApiError.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/ApiError.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ApiError.js","sourceRoot":"","sources":["ApiError.ts"],"names":[],"mappings":";;;AAAA,MAAa,QAAQ;IA+BjB,YAAY,OAAe,EAAE,IAAY,EAAE,SAAe,EAAE,SAAkB,EAAE,OAAc,EAAE,QAAiB;QAC7G,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAvCD,4BAuCC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/Response/Page.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Page { 2 | content: T[]; 3 | pageable: {}; 4 | totalPages: number; 5 | number?: number; 6 | size?: number; 7 | totalElements?: bigint; 8 | last?: boolean; 9 | sort?: {}; 10 | first?: boolean; 11 | numberOfElements?: number; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/Response/Page.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Page = void 0; 4 | class Page { 5 | } 6 | exports.Page = Page; 7 | //# sourceMappingURL=Page.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/Response/Page.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Page.js","sourceRoot":"","sources":["Page.ts"],"names":[],"mappings":";;;AAAA,MAAa,IAAI;CAYhB;AAZD,oBAYC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Dto/Response/Page.ts: -------------------------------------------------------------------------------- 1 | export class Page{ 2 | 3 | content: T[]; 4 | pageable: {}; 5 | totalPages: number; 6 | number?: number; 7 | size?: number; 8 | totalElements?: bigint; 9 | last?: boolean; 10 | sort?: {}; 11 | first?: boolean; 12 | numberOfElements?: number; 13 | } 14 | -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Environment.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum Environment { 2 | LIVE = 0, 3 | SANDBOX = 1 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Environment.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Environment = void 0; 4 | var Environment; 5 | (function (Environment) { 6 | Environment[Environment["LIVE"] = 0] = "LIVE"; 7 | Environment[Environment["SANDBOX"] = 1] = "SANDBOX"; 8 | })(Environment = exports.Environment || (exports.Environment = {})); 9 | //# sourceMappingURL=Environment.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Environment.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Environment.js","sourceRoot":"","sources":["Environment.ts"],"names":[],"mappings":";;;AAAA,IAAY,WAGX;AAHD,WAAY,WAAW;IACnB,6CAAI,CAAA;IACJ,mDAAO,CAAA;AACX,CAAC,EAHW,WAAW,GAAX,mBAAW,KAAX,mBAAW,QAGtB"} -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Environment.ts: -------------------------------------------------------------------------------- 1 | export enum Environment { 2 | LIVE, 3 | SANDBOX 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Service.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum Service { 2 | AIRTIME = "https://topups.reloadly.com", 3 | AIRTIME_SANDBOX = "https://topups-sandbox.reloadly.com" 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Service.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Service = void 0; 4 | var Service; 5 | (function (Service) { 6 | Service["AIRTIME"] = "https://topups.reloadly.com"; 7 | Service["AIRTIME_SANDBOX"] = "https://topups-sandbox.reloadly.com"; 8 | })(Service = exports.Service || (exports.Service = {})); 9 | //# sourceMappingURL=Service.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Service.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Service.js","sourceRoot":"","sources":["Service.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAGX;AAHD,WAAY,OAAO;IACf,kDAAuC,CAAA;IACvC,kEAAuD,CAAA;AAC3D,CAAC,EAHW,OAAO,GAAP,eAAO,KAAP,eAAO,QAGlB"} -------------------------------------------------------------------------------- /node-sdk-core/src/Enums/Service.ts: -------------------------------------------------------------------------------- 1 | export enum Service { 2 | AIRTIME = "https://topups.reloadly.com", 3 | AIRTIME_SANDBOX = "https://topups-sandbox.reloadly.com" 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ApiException.d.ts: -------------------------------------------------------------------------------- 1 | import { ReloadlyException } from "./ReloadlyException"; 2 | /** 3 | * Class that represents an Reloadly Server error captured from a http response. Provides different methods to get a clue of why the request failed. 4 | */ 5 | export declare class ApiException extends ReloadlyException { 6 | constructor(m: string, path?: string, httpStatusCode?: number, errorCode?: string, details?: {}[]); 7 | /** 8 | * The end-point that was used when the error occurred 9 | */ 10 | path?: string; 11 | /** 12 | * HTTP status indicate whether a specific HTTP request has been successfully completed. 13 | * Responses are grouped in five classes: informational responses, successful responses, 14 | * redirects, client errors, and servers errors. 15 | * See https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 16 | */ 17 | httpStatusCode: number; 18 | /** 19 | * For some errors that could be handled programmatically, a string summarizing the error reported. 20 | */ 21 | errorCode: string; 22 | /** 23 | * Additional details that might be helpful in understanding the error(s) that occurred. 24 | */ 25 | details: {}[]; 26 | /** 27 | * "The timestamp when the usage occurred" 28 | */ 29 | timeStamp: Date; 30 | } 31 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ApiException.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ApiException = void 0; 4 | const ReloadlyException_1 = require("./ReloadlyException"); 5 | /** 6 | * Class that represents an Reloadly Server error captured from a http response. Provides different methods to get a clue of why the request failed. 7 | */ 8 | class ApiException extends ReloadlyException_1.ReloadlyException { 9 | constructor(m, path, httpStatusCode, errorCode, details) { 10 | super(m); 11 | this.httpStatusCode = httpStatusCode; 12 | this.path = path; 13 | Object.setPrototypeOf(this, ApiException.prototype); 14 | } 15 | } 16 | exports.ApiException = ApiException; 17 | //# sourceMappingURL=ApiException.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ApiException.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ApiException.js","sourceRoot":"","sources":["ApiException.ts"],"names":[],"mappings":";;;AAAA,2DAAwD;AAExD;;GAEG;AACH,MAAa,YAAa,SAAQ,qCAAiB;IAC/C,YAAY,CAAS,EAAE,IAAa,EAAE,cAAuB,EAAE,SAAkB,EAAE,OAAc;QAC7F,KAAK,CAAC,CAAC,CAAC,CAAC;QACT,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CA6BJ;AAnCD,oCAmCC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/OAuth/OAuthException.d.ts: -------------------------------------------------------------------------------- 1 | import { ApiException } from "../ApiException"; 2 | export declare class OAuthException extends ApiException { 3 | constructor(m: string, path: string, httpStatusCode: number); 4 | isExpiredToken(): boolean; 5 | } 6 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/OAuth/OAuthException.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.OAuthException = void 0; 4 | const ApiException_1 = require("../ApiException"); 5 | class OAuthException extends ApiException_1.ApiException { 6 | constructor(m, path, httpStatusCode) { 7 | super(m, path, httpStatusCode, null, null); 8 | Object.setPrototypeOf(this, OAuthException.prototype); 9 | } 10 | isExpiredToken() { 11 | return this.errorCode.toUpperCase() === 'TOKEN_EXPIRED'; 12 | } 13 | } 14 | exports.OAuthException = OAuthException; 15 | //# sourceMappingURL=OAuthException.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/OAuth/OAuthException.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"OAuthException.js","sourceRoot":"","sources":["OAuthException.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAE/C,MAAa,cAAe,SAAQ,2BAAY;IAC5C,YAAY,CAAS,EAAE,IAAY,EAAE,cAAsB;QACvD,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QAC3C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED,cAAc;QACV,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,eAAe,CAAC;IAC5D,CAAC;CACJ;AATD,wCASC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/OAuth/OAuthException.ts: -------------------------------------------------------------------------------- 1 | import { ApiException } from "../ApiException"; 2 | 3 | export class OAuthException extends ApiException { 4 | constructor(m: string, path: string, httpStatusCode: number) { 5 | super(m, path, httpStatusCode, null, null); 6 | Object.setPrototypeOf(this, OAuthException.prototype); 7 | } 8 | 9 | isExpiredToken(): boolean { 10 | return this.errorCode.toUpperCase() === 'TOKEN_EXPIRED'; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/RateLimitException.d.ts: -------------------------------------------------------------------------------- 1 | import { ApiException } from "./ApiException"; 2 | export declare class RateLimitException extends ApiException { 3 | constructor(m: string, path: string, httpStatusCode: number, errorCode: string, details: []); 4 | limit: bigint; 5 | remaining: bigint; 6 | expectedResetTimestamp: bigint; 7 | } 8 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/RateLimitException.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.RateLimitException = void 0; 4 | const ApiException_1 = require("./ApiException"); 5 | class RateLimitException extends ApiException_1.ApiException { 6 | constructor(m, path, httpStatusCode, errorCode, details) { 7 | super(m, path, httpStatusCode, errorCode, details); 8 | Object.setPrototypeOf(this, ApiException_1.ApiException.prototype); 9 | } 10 | } 11 | exports.RateLimitException = RateLimitException; 12 | //# sourceMappingURL=RateLimitException.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/RateLimitException.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"RateLimitException.js","sourceRoot":"","sources":["RateLimitException.ts"],"names":[],"mappings":";;;AAAA,iDAA8C;AAE9C,MAAa,kBAAmB,SAAQ,2BAAY;IAChD,YAAY,CAAS,EAAE,IAAY,EAAE,cAAsB,EAAE,SAAiB,EAAE,OAAW;QACvF,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACnD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,2BAAY,CAAC,SAAS,CAAC,CAAC;IACxD,CAAC;CAKJ;AATD,gDASC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/RateLimitException.ts: -------------------------------------------------------------------------------- 1 | import { ApiException } from "./ApiException"; 2 | 3 | export class RateLimitException extends ApiException { 4 | constructor(m: string, path: string, httpStatusCode: number, errorCode: string, details: []) { 5 | super(m, path, httpStatusCode, errorCode, details); 6 | Object.setPrototypeOf(this, ApiException.prototype); 7 | } 8 | 9 | limit: bigint; 10 | remaining: bigint; 11 | expectedResetTimestamp: bigint; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ReloadlyException.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class that represents an error captured when executing an http request to the Reloadly Server. 3 | */ 4 | export declare class ReloadlyException extends Error { 5 | constructor(m: string); 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ReloadlyException.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ReloadlyException = void 0; 4 | /** 5 | * Class that represents an error captured when executing an http request to the Reloadly Server. 6 | */ 7 | class ReloadlyException extends Error { 8 | constructor(m) { 9 | super(m); 10 | Object.setPrototypeOf(this, ReloadlyException.prototype); 11 | } 12 | } 13 | exports.ReloadlyException = ReloadlyException; 14 | //# sourceMappingURL=ReloadlyException.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ReloadlyException.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ReloadlyException.js","sourceRoot":"","sources":["ReloadlyException.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,MAAa,iBAAkB,SAAQ,KAAK;IACxC,YAAY,CAAS;QACjB,KAAK,CAAC,CAAC,CAAC,CAAC;QACT,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAC7D,CAAC;CACJ;AALD,8CAKC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Exception/ReloadlyException.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class that represents an error captured when executing an http request to the Reloadly Server. 3 | */ 4 | export class ReloadlyException extends Error { 5 | constructor(m: string) { 6 | super(m); 7 | Object.setPrototypeOf(this, ReloadlyException.prototype); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Client/BaseOperation.d.ts: -------------------------------------------------------------------------------- 1 | import { ProxyOptions } from "../Dto/Request/ProxyOptions"; 2 | export declare abstract class BaseOperation { 3 | baseUrl: string; 4 | enableTelemetry: boolean; 5 | proxyOptions?: ProxyOptions; 6 | timeoutInMilliseconds?: number; 7 | constructor(baseUrl: string, enableTelemetry?: boolean); 8 | proxy(proxyOptions?: ProxyOptions): this; 9 | timeout(milliseconds?: number): this; 10 | } 11 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Client/BaseOperation.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.BaseOperation = void 0; 4 | class BaseOperation { 5 | constructor(baseUrl, enableTelemetry) { 6 | this.baseUrl = baseUrl; 7 | this.enableTelemetry = enableTelemetry ?? true; 8 | } 9 | proxy(proxyOptions) { 10 | this.proxyOptions = proxyOptions; 11 | return this; 12 | } 13 | timeout(milliseconds) { 14 | this.timeoutInMilliseconds = milliseconds; 15 | return this; 16 | } 17 | } 18 | exports.BaseOperation = BaseOperation; 19 | //# sourceMappingURL=BaseOperation.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Client/BaseOperation.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"BaseOperation.js","sourceRoot":"","sources":["BaseOperation.ts"],"names":[],"mappings":";;;AAEA,MAAsB,aAAa;IAM/B,YACI,OAAe,EACf,eAAyB;QAEzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,eAAe,IAAI,IAAI,CAAC;IACnD,CAAC;IAED,KAAK,CAAC,YAA2B;QAC7B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,YAAqB;QACzB,IAAI,CAAC,qBAAqB,GAAG,YAAY,CAAC;QAC1C,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAvBD,sCAuBC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Client/BaseOperation.ts: -------------------------------------------------------------------------------- 1 | import { ProxyOptions } from "../Dto/Request/ProxyOptions"; 2 | 3 | export abstract class BaseOperation { 4 | baseUrl: string; 5 | enableTelemetry: boolean; 6 | proxyOptions?: ProxyOptions; 7 | timeoutInMilliseconds?: number; 8 | 9 | constructor( 10 | baseUrl: string, 11 | enableTelemetry?: boolean) { 12 | 13 | this.baseUrl = baseUrl; 14 | this.enableTelemetry = enableTelemetry ?? true; 15 | } 16 | 17 | proxy(proxyOptions?: ProxyOptions): this { 18 | this.proxyOptions = proxyOptions; 19 | return this; 20 | } 21 | 22 | timeout(milliseconds?: number): this { 23 | this.timeoutInMilliseconds = milliseconds; 24 | return this; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/Auth.d.ts: -------------------------------------------------------------------------------- 1 | declare enum Auth { 2 | KEY_CLIENT_ID = "client_id", 3 | KEY_CLIENT_SECRET = "client_secret" 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/Auth.js: -------------------------------------------------------------------------------- 1 | var Auth; 2 | (function (Auth) { 3 | Auth["KEY_CLIENT_ID"] = "client_id"; 4 | Auth["KEY_CLIENT_SECRET"] = "client_secret"; 5 | })(Auth || (Auth = {})); 6 | //# sourceMappingURL=Auth.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/Auth.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Auth.js","sourceRoot":"","sources":["Auth.ts"],"names":[],"mappings":"AAAA,IAAK,IAGJ;AAHD,WAAK,IAAI;IACL,mCAA2B,CAAA;IAC3B,2CAAmC,CAAA;AACvC,CAAC,EAHI,IAAI,KAAJ,IAAI,QAGR"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/Auth.ts: -------------------------------------------------------------------------------- 1 | enum Auth { 2 | KEY_CLIENT_ID = "client_id", 3 | KEY_CLIENT_SECRET = "client_secret" 4 | } -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/GrantType.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum GrantType { 2 | CLIENT_CREDENTIALS = "client_credentials" 3 | } 4 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/GrantType.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.GrantType = void 0; 4 | var GrantType; 5 | (function (GrantType) { 6 | GrantType["CLIENT_CREDENTIALS"] = "client_credentials"; 7 | })(GrantType = exports.GrantType || (exports.GrantType = {})); 8 | //# sourceMappingURL=GrantType.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/GrantType.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"GrantType.js","sourceRoot":"","sources":["GrantType.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAEX;AAFD,WAAY,SAAS;IACjB,sDAAyC,CAAA;AAC7C,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/GrantType.ts: -------------------------------------------------------------------------------- 1 | export enum GrantType { 2 | CLIENT_CREDENTIALS = "client_credentials" 3 | } 4 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/HttpHeader.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum HttpHeader { 2 | ACCEPT = "Accept", 3 | CONTENT_TYPE = "Content-Type", 4 | AUTHORIZATION = "Authorization", 5 | PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization" 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/HttpHeader.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.HttpHeader = void 0; 4 | var HttpHeader; 5 | (function (HttpHeader) { 6 | HttpHeader["ACCEPT"] = "Accept"; 7 | HttpHeader["CONTENT_TYPE"] = "Content-Type"; 8 | HttpHeader["AUTHORIZATION"] = "Authorization"; 9 | HttpHeader["PROXY_AUTHORIZATION_HEADER"] = "Proxy-Authorization"; 10 | })(HttpHeader = exports.HttpHeader || (exports.HttpHeader = {})); 11 | //# sourceMappingURL=HttpHeader.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/HttpHeader.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"HttpHeader.js","sourceRoot":"","sources":["HttpHeader.ts"],"names":[],"mappings":";;;AAAA,IAAY,UAKX;AALD,WAAY,UAAU;IAClB,+BAAiB,CAAA;IACjB,2CAA6B,CAAA;IAC7B,6CAA+B,CAAA;IAC/B,gEAAkD,CAAA;AACtD,CAAC,EALW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAKrB"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/HttpHeader.ts: -------------------------------------------------------------------------------- 1 | export enum HttpHeader { 2 | ACCEPT = "Accept", 3 | CONTENT_TYPE = "Content-Type", 4 | AUTHORIZATION = "Authorization", 5 | PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization", 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/MediaType.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum MediaType { 2 | APPLICATION_JSON = "application/json" 3 | } 4 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/MediaType.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.MediaType = void 0; 4 | var MediaType; 5 | (function (MediaType) { 6 | MediaType["APPLICATION_JSON"] = "application/json"; 7 | })(MediaType = exports.MediaType || (exports.MediaType = {})); 8 | //# sourceMappingURL=MediaType.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/MediaType.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"MediaType.js","sourceRoot":"","sources":["MediaType.ts"],"names":[],"mappings":";;;AAAA,IAAY,SAEX;AAFD,WAAY,SAAS;IACjB,kDAAqC,CAAA;AACzC,CAAC,EAFW,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAEpB"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Constant/MediaType.ts: -------------------------------------------------------------------------------- 1 | export enum MediaType { 2 | APPLICATION_JSON = "application/json" 3 | } 4 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/BaseRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { IRequest } from "./Interfaces/IRequest"; 2 | import { ProxyOptions } from "./ProxyOptions"; 3 | export declare abstract class BaseRequest implements IRequest { 4 | static readonly STATUS_CODE_TOO_MANY_REQUEST = 429; 5 | apiVersion: string; 6 | enableTelemetry: boolean; 7 | proxyOptions?: ProxyOptions; 8 | timeoutInMilliseconds?: number; 9 | constructor(); 10 | protected abstract createRequest(): { 11 | method: string; 12 | url: string; 13 | headers: {}; 14 | body?: any; 15 | }; 16 | /** 17 | * Executes this request. 18 | * 19 | * @return the response body JSON decoded as T 20 | * @throws ReloadlyException if the request execution fails. 21 | */ 22 | execute(): Promise; 23 | proxy(options?: ProxyOptions): this; 24 | timeout(milliseconds?: number): this; 25 | private createResponseException; 26 | private createRateLimitException; 27 | } 28 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/CustomRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseRequest } from "./BaseRequest"; 2 | import { ICustomizableRequest } from "./ICustomizableRequest"; 3 | export declare class CustomRequest extends BaseRequest implements ICustomizableRequest { 4 | url: string; 5 | method: string; 6 | headers: {}; 7 | body?: {}; 8 | constructor(url: any, method?: string, headers?: {}, body?: {}); 9 | createRequest(): { 10 | method: any; 11 | url: any; 12 | headers: any; 13 | body?: any; 14 | }; 15 | addHeader(name: string, value: string): CustomRequest; 16 | setBody(value: {}): CustomRequest; 17 | protected createBody(): {}; 18 | } 19 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/CustomRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.CustomRequest = void 0; 4 | const BaseRequest_1 = require("./BaseRequest"); 5 | class CustomRequest extends BaseRequest_1.BaseRequest { 6 | constructor(url, method = "GET", headers = {}, body = null) { 7 | super(); 8 | this.url = url; 9 | this.method = method; 10 | this.headers = headers; 11 | this.body = body; 12 | } 13 | createRequest() { 14 | return { 15 | method: this.method, 16 | url: this.url, 17 | headers: this.headers, 18 | body: this.body 19 | }; 20 | } 21 | addHeader(name, value) { 22 | this.headers[name] = value; 23 | return this; 24 | } 25 | setBody(value) { 26 | this.body = value; 27 | return this; 28 | } 29 | createBody() { 30 | if (this.body) { 31 | return this.body; 32 | } 33 | return null; 34 | } 35 | } 36 | exports.CustomRequest = CustomRequest; 37 | //# sourceMappingURL=CustomRequest.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/CustomRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"CustomRequest.js","sourceRoot":"","sources":["CustomRequest.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAG5C,MAAa,aAAiB,SAAQ,yBAAc;IAQhD,YACI,GAAG,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,EAAE,EAAE,OAAW,IAAI;QAElD,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAED,aAAa;QACT,OAAO;YACH,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC;IACN,CAAC;IAED,SAAS,CAAC,IAAY,EAAE,KAAa;QACjC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;QAC3B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,KAAS;QACb,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,UAAU;QAEhB,IAAI,IAAI,CAAC,IAAI,EAAE;YACX,OAAO,IAAI,CAAC,IAAI,CAAC;SACpB;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA7CD,sCA6CC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/CustomRequest.ts: -------------------------------------------------------------------------------- 1 | import { BaseRequest } from "./BaseRequest"; 2 | import { ICustomizableRequest } from "./ICustomizableRequest"; 3 | 4 | export class CustomRequest extends BaseRequest implements ICustomizableRequest { 5 | 6 | url: string; 7 | method: string; 8 | headers: {}; 9 | body?: {}; 10 | 11 | 12 | constructor( 13 | url, method = "GET", headers = {}, body: {} = null) { 14 | 15 | super(); 16 | this.url = url; 17 | this.method = method; 18 | this.headers = headers; 19 | this.body = body; 20 | } 21 | 22 | createRequest(): { method, url, headers, body?} { 23 | return { 24 | method: this.method, 25 | url: this.url, 26 | headers: this.headers, 27 | body: this.body 28 | }; 29 | } 30 | 31 | addHeader(name: string, value: string): CustomRequest { 32 | this.headers[name] = value; 33 | return this; 34 | } 35 | 36 | setBody(value: {}): CustomRequest { 37 | this.body = value; 38 | return this; 39 | } 40 | 41 | protected createBody(): {} { 42 | 43 | if (this.body) { 44 | return this.body; 45 | } 46 | 47 | return null; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ICustomizableRequest.d.ts: -------------------------------------------------------------------------------- 1 | import { IRequest } from "./Interfaces/IRequest"; 2 | export interface ICustomizableRequest extends IRequest { 3 | addHeader(name: string, value: string): ICustomizableRequest; 4 | setBody(body: {}): ICustomizableRequest; 5 | } 6 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ICustomizableRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=ICustomizableRequest.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ICustomizableRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ICustomizableRequest.js","sourceRoot":"","sources":["ICustomizableRequest.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ICustomizableRequest.ts: -------------------------------------------------------------------------------- 1 | import { IRequest } from "./Interfaces/IRequest"; 2 | 3 | export interface ICustomizableRequest extends IRequest { 4 | addHeader(name: string, value: string): ICustomizableRequest; 5 | setBody(body: {}): ICustomizableRequest; 6 | } 7 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/Interfaces/IRequest.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class that represents an HTTP Request that can be executed. 3 | * 4 | * @param the type of payload expected in the response after the execution. 5 | */ 6 | export interface IRequest { 7 | /** 8 | * Executes this request. 9 | * 10 | * @return the response body JSON decoded as T 11 | * @throws APIException if the request was executed but the response wasn't successful. 12 | * @throws ReloadlyException if the request couldn't be created or executed successfully. 13 | */ 14 | execute(): Promise; 15 | } 16 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/Interfaces/IRequest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | //# sourceMappingURL=IRequest.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/Interfaces/IRequest.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"IRequest.js","sourceRoot":"","sources":["IRequest.ts"],"names":[],"mappings":""} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/Interfaces/IRequest.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Class that represents an HTTP Request that can be executed. 3 | * 4 | * @param the type of payload expected in the response after the execution. 5 | */ 6 | export interface IRequest { 7 | /** 8 | * Executes this request. 9 | * 10 | * @return the response body JSON decoded as T 11 | * @throws APIException if the request was executed but the response wasn't successful. 12 | * @throws ReloadlyException if the request couldn't be created or executed successfully. 13 | */ 14 | execute(): Promise; 15 | } 16 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptions.d.ts: -------------------------------------------------------------------------------- 1 | import { ProxyOptionsAuth } from "./ProxyOptionsAuth"; 2 | export declare class ProxyOptions { 3 | host: string; 4 | port: string; 5 | protocol?: string; 6 | auth?: ProxyOptionsAuth; 7 | constructor(host: string, port: string, protocol?: string, auth?: ProxyOptionsAuth); 8 | axiosOptions(): { 9 | host: string; 10 | port: string; 11 | }; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptions.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ProxyOptions = void 0; 4 | class ProxyOptions { 5 | constructor(host, port, protocol, auth) { 6 | this.host = host; 7 | this.port = port; 8 | this.protocol = protocol; 9 | this.auth = auth; 10 | } 11 | axiosOptions() { 12 | let options = { 13 | host: this.host, 14 | port: this.port 15 | }; 16 | if (this.protocol) 17 | options["protocol"] = this.protocol; 18 | if (this.auth) 19 | options["auth"] = { 20 | username: this.auth.username, 21 | password: this.auth.password 22 | }; 23 | return options; 24 | } 25 | } 26 | exports.ProxyOptions = ProxyOptions; 27 | //# sourceMappingURL=ProxyOptions.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptions.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ProxyOptions.js","sourceRoot":"","sources":["ProxyOptions.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAY;IAMrB,YAAY,IAAY,EAAE,IAAY,EAAE,QAAiB,EAAE,IAAuB;QAC9E,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;IAEM,YAAY;QACf,IAAI,OAAO,GAAG;YACV,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ;YAAE,OAAO,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QACvD,IAAI,IAAI,CAAC,IAAI;YAAE,OAAO,CAAC,MAAM,CAAC,GAAG;gBAC7B,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;gBAC5B,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,QAAQ;aAC/B,CAAC;QAEF,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA3BD,oCA2BC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptions.ts: -------------------------------------------------------------------------------- 1 | import { ProxyOptionsAuth } from "./ProxyOptionsAuth"; 2 | 3 | export class ProxyOptions { 4 | public host: string; 5 | public port: string; 6 | public protocol?: string; 7 | public auth?: ProxyOptionsAuth; 8 | 9 | constructor(host: string, port: string, protocol?: string, auth?: ProxyOptionsAuth) { 10 | this.host = host; 11 | this.port = port; 12 | this.protocol = protocol; 13 | this.auth = auth; 14 | } 15 | 16 | public axiosOptions() { 17 | let options = { 18 | host: this.host, 19 | port: this.port 20 | }; 21 | 22 | if (this.protocol) options["protocol"] = this.protocol; 23 | if (this.auth) options["auth"] = { 24 | username: this.auth.username, 25 | password: this.auth.password 26 | }; 27 | 28 | return options; 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptionsAuth.d.ts: -------------------------------------------------------------------------------- 1 | export declare class ProxyOptionsAuth { 2 | username: string; 3 | password: string; 4 | constructor(username: string, password: string); 5 | } 6 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptionsAuth.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ProxyOptionsAuth = void 0; 4 | class ProxyOptionsAuth { 5 | constructor(username, password) { 6 | this.username = username; 7 | this.password = password; 8 | } 9 | } 10 | exports.ProxyOptionsAuth = ProxyOptionsAuth; 11 | //# sourceMappingURL=ProxyOptionsAuth.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptionsAuth.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ProxyOptionsAuth.js","sourceRoot":"","sources":["ProxyOptionsAuth.ts"],"names":[],"mappings":";;;AAAA,MAAa,gBAAgB;IAIzB,YAAY,QAAgB,EAAE,QAAgB;QAC1C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AARD,4CAQC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Dto/Request/ProxyOptionsAuth.ts: -------------------------------------------------------------------------------- 1 | export class ProxyOptionsAuth { 2 | public username: string; 3 | public password: string; 4 | 5 | constructor(username: string, password: string) { 6 | this.username = username; 7 | this.password = password; 8 | } 9 | } -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Enums/Version.d.ts: -------------------------------------------------------------------------------- 1 | export declare enum Version { 2 | AIRTIME_V1 = "application/com.reloadly.topups-v1+json" 3 | } 4 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Enums/Version.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Version = void 0; 4 | var Version; 5 | (function (Version) { 6 | Version["AIRTIME_V1"] = "application/com.reloadly.topups-v1+json"; 7 | })(Version = exports.Version || (exports.Version = {})); 8 | //# sourceMappingURL=Version.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Enums/Version.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Version.js","sourceRoot":"","sources":["Version.ts"],"names":[],"mappings":";;;AAAA,IAAY,OAEX;AAFD,WAAY,OAAO;IACf,iEAAsD,CAAA;AAC1D,CAAC,EAFW,OAAO,GAAP,eAAO,KAAP,eAAO,QAElB"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Enums/Version.ts: -------------------------------------------------------------------------------- 1 | export enum Version { 2 | AIRTIME_V1 = "application/com.reloadly.topups-v1+json", 3 | } 4 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/BaseFilter.d.ts: -------------------------------------------------------------------------------- 1 | export declare abstract class BaseFilter { 2 | protected parameters: {}; 3 | constructor(); 4 | } 5 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/BaseFilter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.BaseFilter = void 0; 4 | class BaseFilter { 5 | constructor() { 6 | this.parameters = {}; 7 | } 8 | } 9 | exports.BaseFilter = BaseFilter; 10 | //# sourceMappingURL=BaseFilter.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/BaseFilter.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"BaseFilter.js","sourceRoot":"","sources":["BaseFilter.ts"],"names":[],"mappings":";;;AAAA,MAAsB,UAAU;IAG5B;QACI,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;IACzB,CAAC;CACJ;AAND,gCAMC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/BaseFilter.ts: -------------------------------------------------------------------------------- 1 | export abstract class BaseFilter { 2 | protected parameters: {}; 3 | 4 | constructor() { 5 | this.parameters = {}; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/QueryFilter.d.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter } from "./BaseFilter"; 2 | export declare class QueryFilter extends BaseFilter { 3 | parameters: {}; 4 | /** 5 | * Filter by page 6 | * 7 | * @param pageNumber the page number to retrieve. 8 | * @param pageSize the amount of items per page to retrieve. 9 | * @return this filter instance 10 | */ 11 | withPage(pageNumber: number, pageSize: number): QueryFilter; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/QueryFilter.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.QueryFilter = void 0; 4 | const BaseFilter_1 = require("./BaseFilter"); 5 | class QueryFilter extends BaseFilter_1.BaseFilter { 6 | /** 7 | * Filter by page 8 | * 9 | * @param pageNumber the page number to retrieve. 10 | * @param pageSize the amount of items per page to retrieve. 11 | * @return this filter instance 12 | */ 13 | withPage(pageNumber, pageSize) { 14 | if (pageNumber <= 0) { 15 | throw new RangeError("Filter page number must greater than zero"); 16 | } 17 | if (pageSize <= 0) { 18 | throw new RangeError("Filter page size must greater than zero"); 19 | } 20 | this.parameters["page"] = pageNumber; 21 | this.parameters["size"] = pageSize; 22 | return this; 23 | } 24 | } 25 | exports.QueryFilter = QueryFilter; 26 | //# sourceMappingURL=QueryFilter.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/QueryFilter.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"QueryFilter.js","sourceRoot":"","sources":["QueryFilter.ts"],"names":[],"mappings":";;;AAAA,6CAA0C;AAE1C,MAAa,WAAY,SAAQ,uBAAU;IAIvC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAkB,EAAE,QAAgB;QAEzC,IAAI,UAAU,IAAI,CAAC,EAAE;YACjB,MAAM,IAAI,UAAU,CAAC,2CAA2C,CAAC,CAAC;SACrE;QAED,IAAI,QAAQ,IAAI,CAAC,EAAE;YACf,MAAM,IAAI,UAAU,CAAC,yCAAyC,CAAC,CAAC;SACnE;QAED,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,UAAU,CAAC;QACrC,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;QAEnC,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA1BD,kCA0BC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Filter/QueryFilter.ts: -------------------------------------------------------------------------------- 1 | import { BaseFilter } from "./BaseFilter"; 2 | 3 | export class QueryFilter extends BaseFilter { 4 | 5 | parameters: {}; 6 | 7 | /** 8 | * Filter by page 9 | * 10 | * @param pageNumber the page number to retrieve. 11 | * @param pageSize the amount of items per page to retrieve. 12 | * @return this filter instance 13 | */ 14 | withPage(pageNumber: number, pageSize: number): QueryFilter { 15 | 16 | if (pageNumber <= 0) { 17 | throw new RangeError("Filter page number must greater than zero"); 18 | } 19 | 20 | if (pageSize <= 0) { 21 | throw new RangeError("Filter page size must greater than zero"); 22 | } 23 | 24 | this.parameters["page"] = pageNumber; 25 | this.parameters["size"] = pageSize; 26 | 27 | return this; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Api.d.ts: -------------------------------------------------------------------------------- 1 | import { ProxyOptions } from "../Dto/Request/ProxyOptions"; 2 | export declare abstract class Api { 3 | static readonly KEY_CLIENT_ID = "client_id"; 4 | static readonly KEY_CLIENT_SECRET = "client_secret"; 5 | clientId: string; 6 | clientSecret: string; 7 | enableLogging: boolean; 8 | enableTelemetry: boolean; 9 | headersToRedact: string[]; 10 | apiVersion: string; 11 | libraryVersion: string; 12 | proxyOptions?: ProxyOptions; 13 | timeoutInMilliseconds?: number; 14 | constructor(clientId: string, clientSecret: string, enableLogging?: boolean, redactHeaders?: string[], enableTelemetry?: boolean, libraryVersion?: string, apiVersion?: string); 15 | proxy(proxyOptions: ProxyOptions): this; 16 | timeout(milliseconds?: number): this; 17 | } 18 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Api.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Api = void 0; 4 | class Api { 5 | constructor(clientId, clientSecret, enableLogging = false, redactHeaders, enableTelemetry = true, libraryVersion, apiVersion) { 6 | this.clientId = clientId; 7 | this.clientSecret = clientSecret; 8 | this.enableLogging = enableLogging; 9 | this.headersToRedact = redactHeaders ?? []; 10 | this.libraryVersion = libraryVersion; 11 | this.apiVersion = apiVersion; 12 | this.enableTelemetry = enableTelemetry; 13 | } 14 | proxy(proxyOptions) { 15 | this.proxyOptions = proxyOptions; 16 | return this; 17 | } 18 | timeout(milliseconds) { 19 | this.timeoutInMilliseconds = milliseconds; 20 | return this; 21 | } 22 | } 23 | exports.Api = Api; 24 | Api.KEY_CLIENT_ID = "client_id"; 25 | Api.KEY_CLIENT_SECRET = "client_secret"; 26 | //# sourceMappingURL=Api.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Api.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Api.js","sourceRoot":"","sources":["Api.ts"],"names":[],"mappings":";;;AAEA,MAAsB,GAAG;IAerB,YAAY,QAAgB,EAAE,YAAoB,EAC9C,gBAAyB,KAAK,EAAE,aAAwB,EACxD,kBAA2B,IAAI,EAAE,cAAuB,EAAE,UAAmB;QAE7E,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QAEjC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,aAAa,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,YAA0B;QAC5B,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,YAAqB;QACzB,IAAI,CAAC,qBAAqB,GAAG,YAAY,CAAC;QAC1C,OAAO,IAAI,CAAC;IAChB,CAAC;;AArCL,kBAsCC;AApCmB,iBAAa,GAAG,WAAW,CAAC;AAC5B,qBAAiB,GAAG,eAAe,CAAC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Api.ts: -------------------------------------------------------------------------------- 1 | import { ProxyOptions } from "../Dto/Request/ProxyOptions"; 2 | 3 | export abstract class Api { 4 | 5 | static readonly KEY_CLIENT_ID = "client_id"; 6 | static readonly KEY_CLIENT_SECRET = "client_secret"; 7 | 8 | clientId: string; 9 | clientSecret: string; 10 | enableLogging: boolean; 11 | enableTelemetry: boolean; 12 | headersToRedact: string[]; 13 | apiVersion: string; 14 | libraryVersion: string; 15 | proxyOptions?: ProxyOptions; 16 | timeoutInMilliseconds?: number; 17 | 18 | constructor(clientId: string, clientSecret: string, 19 | enableLogging: boolean = false, redactHeaders?: string[], 20 | enableTelemetry: boolean = true, libraryVersion?: string, apiVersion?: string) { 21 | 22 | this.clientId = clientId; 23 | this.clientSecret = clientSecret; 24 | 25 | this.enableLogging = enableLogging; 26 | this.headersToRedact = redactHeaders ?? []; 27 | this.libraryVersion = libraryVersion; 28 | this.apiVersion = apiVersion; 29 | this.enableTelemetry = enableTelemetry; 30 | } 31 | 32 | proxy(proxyOptions: ProxyOptions): this { 33 | this.proxyOptions = proxyOptions; 34 | return this; 35 | } 36 | 37 | timeout(milliseconds?: number): this { 38 | this.timeoutInMilliseconds = milliseconds; 39 | return this; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/ServiceApi.d.ts: -------------------------------------------------------------------------------- 1 | import { Api } from "../../Core"; 2 | export declare abstract class ServiceApi extends Api { 3 | protected accessToken: string; 4 | protected cacheAccessToken: boolean; 5 | constructor(clientId?: string, clientSecret?: string, accessToken?: string, enableLogging?: boolean, redactHeaders?: string[], enableTelemetry?: boolean, sdkVersion?: string, apiVersion?: string); 6 | /** 7 | * Retrieve a new API access token to use on new calls. 8 | * This is useful when the token is about to expire or already has. 9 | * 10 | * @param request - The request to refresh the token for 11 | * @throws ReloadlyException - Error captured when executing an http request to the Reloadly Server 12 | */ 13 | abstract refreshAccessToken(request: {}): any; 14 | isAccessTokenCached(): boolean; 15 | validateCredentials(): void; 16 | /** 17 | * Update the API access token to use on new calls. 18 | * This is useful when the token is about to expire or already has. 19 | * 20 | * @param accessToken the token to authenticate the calls with. 21 | */ 22 | setAccessToken(accessToken: string): void; 23 | validateAccessToken(accessToken: string): string; 24 | } 25 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/ServiceApi.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ServiceApi.js","sourceRoot":"","sources":["ServiceApi.ts"],"names":[],"mappings":";;;AAAA,2CAAoC;AACpC,qCAAiC;AAEjC,MAAsB,UAAW,SAAQ,UAAG;IAKxC,YAAY,QAAiB,EAAE,YAAqB,EAAE,WAAoB,EACtE,gBAAyB,KAAK,EAAE,gBAA0B,EAAE,EAC5D,kBAA2B,IAAI,EAAE,UAAmB,EAAE,UAAmB;QAEzE,KAAK,CACD,QAAQ,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EACpD,eAAe,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QAE7C,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;QACzD,IAAI,CAAC,gBAAgB,GAAG,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;IACvD,CAAC;IAWD,mBAAmB;QACf,OAAO,IAAI,CAAC,gBAAgB,CAAC;IACjC,CAAC;IAED,mBAAmB;QACf,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE;YAC7D,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;SACvG;IACL,CAAC;IAED;;;;;OAKG;IACH,cAAc,CAAC,WAAmB;QAC9B,IAAI,CAAC,WAAW,EAAE;YACd,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;SACtD;QACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,CAAC;IAC7D,CAAC;IAED,mBAAmB,CAAC,WAAmB;QAEnC,IAAI,OAAgB,CAAC;QACrB,IAAI;YACA,OAAO,GAAG,oBAAU,CAAC,WAAW,CAAC,CAAC;SACrC;QAAC,OAAO,iBAAiB,EAAE;YACxB,OAAO,IAAI,CAAC;SACf;QAED,MAAM,cAAc,GAAS,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,IAAI,CAAC,CAAC;QAC1D,IAAI,sBAAsB,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC;QAC7E,MAAM,iBAAiB,GAAG,sBAAsB,GAAG,IAAI,CAAC;QAExD,OAAO,iBAAiB,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC;IACxD,CAAC;CACJ;AAhED,gCAgEC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Telemetry.d.ts: -------------------------------------------------------------------------------- 1 | export declare class Telemetry { 2 | static readonly ENV_KEY = "env"; 3 | static readonly NAME_KEY = "name"; 4 | static readonly VERSION_KEY = "api-version"; 5 | static readonly HEADER_NAME = "Reloadly-Client"; 6 | static readonly LIBRARY_VERSION_KEY = "reloadly-sdk-nodejs"; 7 | name: string; 8 | value: string; 9 | apiVersion: string; 10 | libraryVersion: string; 11 | constructor(name: string, libraryVersion?: string, apiVersion?: string); 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Telemetry.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.Telemetry = void 0; 4 | class Telemetry { 5 | constructor(name, libraryVersion, apiVersion) { 6 | this.name = name; 7 | this.apiVersion = apiVersion; 8 | this.libraryVersion = libraryVersion; 9 | } 10 | } 11 | exports.Telemetry = Telemetry; 12 | Telemetry.ENV_KEY = "env"; 13 | Telemetry.NAME_KEY = "name"; 14 | Telemetry.VERSION_KEY = "api-version"; 15 | Telemetry.HEADER_NAME = "Reloadly-Client"; 16 | Telemetry.LIBRARY_VERSION_KEY = "reloadly-sdk-nodejs"; 17 | //# sourceMappingURL=Telemetry.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Telemetry.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"Telemetry.js","sourceRoot":"","sources":["Telemetry.ts"],"names":[],"mappings":";;;AAAA,MAAa,SAAS;IAalB,YAAmB,IAAY,EAAE,cAAuB,EAAE,UAAmB;QACzE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;;AAjBL,8BAkBC;AAhBmB,iBAAO,GAAG,KAAK,CAAC;AAChB,kBAAQ,GAAG,MAAM,CAAC;AAClB,qBAAW,GAAG,aAAa,CAAC;AAC5B,qBAAW,GAAG,iBAAiB,CAAC;AAChC,6BAAmB,GAAG,qBAAqB,CAAC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Net/Telemetry.ts: -------------------------------------------------------------------------------- 1 | export class Telemetry { 2 | 3 | static readonly ENV_KEY = "env"; 4 | static readonly NAME_KEY = "name"; 5 | static readonly VERSION_KEY = "api-version"; 6 | static readonly HEADER_NAME = "Reloadly-Client"; 7 | static readonly LIBRARY_VERSION_KEY = "reloadly-sdk-nodejs"; 8 | 9 | name: string; 10 | value: string; 11 | apiVersion: string; 12 | libraryVersion: string; 13 | 14 | public constructor(name: string, libraryVersion?: string, apiVersion?: string) { 15 | this.name = name; 16 | this.apiVersion = apiVersion; 17 | this.libraryVersion = libraryVersion; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Util/ExceptionUtil.d.ts: -------------------------------------------------------------------------------- 1 | import { ApiError } from "../../Dto/ApiError"; 2 | import { ApiException } from "../../Exception/ApiException"; 3 | export declare class ExceptionUtil { 4 | static convert(apiError: ApiError, httpStatusCode: number): ApiException; 5 | static doGetApiException(apiError: ApiError, httpStatusCode: number): ApiException; 6 | static isAuthenticationError(apiError: ApiError): boolean; 7 | static setAdditionalFields(apiError: ApiError, apiException: ApiException): ApiException; 8 | } 9 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Util/ExceptionUtil.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | exports.ExceptionUtil = void 0; 4 | const ApiException_1 = require("../../Exception/ApiException"); 5 | const OAuthException_1 = require("../../Exception/OAuth/OAuthException"); 6 | class ExceptionUtil { 7 | static convert(apiError, httpStatusCode) { 8 | return this.setAdditionalFields(apiError, this.doGetApiException(apiError, httpStatusCode)); 9 | } 10 | static doGetApiException(apiError, httpStatusCode) { 11 | if (this.isAuthenticationError(apiError)) { 12 | return new OAuthException_1.OAuthException(apiError.message, apiError.path, httpStatusCode); 13 | } 14 | return new ApiException_1.ApiException(apiError.message, apiError.path, httpStatusCode); 15 | } 16 | static isAuthenticationError(apiError) { 17 | return apiError.path && apiError.path.toLowerCase() == "/oauth/token"; 18 | } 19 | static setAdditionalFields(apiError, apiException) { 20 | if (apiError.errorCode != null && apiError.errorCode.trim() != "") { 21 | apiException.errorCode = apiError.errorCode; 22 | } 23 | if (apiError.timeStamp) { 24 | apiException.timeStamp = apiError.timeStamp; 25 | } 26 | if (apiError.details) { 27 | apiException.details = apiError.details; 28 | } 29 | return apiException; 30 | } 31 | } 32 | exports.ExceptionUtil = ExceptionUtil; 33 | //# sourceMappingURL=ExceptionUtil.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Util/ExceptionUtil.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ExceptionUtil.js","sourceRoot":"","sources":["ExceptionUtil.ts"],"names":[],"mappings":";;;AACA,+DAA4D;AAC5D,yEAAsE;AAEtE,MAAa,aAAa;IACtB,MAAM,CAAC,OAAO,CAAC,QAAkB,EAAE,cAAsB;QACrD,OAAO,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,IAAI,CAAC,iBAAiB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;IAChG,CAAC;IAED,MAAM,CAAC,iBAAiB,CAAC,QAAkB,EAAE,cAAsB;QAC/D,IAAI,IAAI,CAAC,qBAAqB,CAAC,QAAQ,CAAC,EAAE;YACtC,OAAO,IAAI,+BAAc,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;SAC9E;QAED,OAAO,IAAI,2BAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAC7E,CAAC;IAED,MAAM,CAAC,qBAAqB,CAAC,QAAkB;QAC3C,OAAO,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,cAAc,CAAC;IAC1E,CAAC;IAED,MAAM,CAAC,mBAAmB,CAAC,QAAkB,EAAE,YAA0B;QACrE,IAAI,QAAQ,CAAC,SAAS,IAAI,IAAI,IAAI,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE;YAC/D,YAAY,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;SAC/C;QAED,IAAI,QAAQ,CAAC,SAAS,EAAE;YACpB,YAAY,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAC;SAC/C;QAED,IAAI,QAAQ,CAAC,OAAO,EAAE;YAClB,YAAY,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC;SAC3C;QAED,OAAO,YAAY,CAAC;IACxB,CAAC;CAEJ;AAjCD,sCAiCC"} -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Util/ExceptionUtil.ts: -------------------------------------------------------------------------------- 1 | import { ApiError } from "../../Dto/ApiError"; 2 | import { ApiException } from "../../Exception/ApiException"; 3 | import { OAuthException } from "../../Exception/OAuth/OAuthException"; 4 | 5 | export class ExceptionUtil { 6 | static convert(apiError: ApiError, httpStatusCode: number): ApiException { 7 | return this.setAdditionalFields(apiError, this.doGetApiException(apiError, httpStatusCode)); 8 | } 9 | 10 | static doGetApiException(apiError: ApiError, httpStatusCode: number): ApiException { 11 | if (this.isAuthenticationError(apiError)) { 12 | return new OAuthException(apiError.message, apiError.path, httpStatusCode); 13 | } 14 | 15 | return new ApiException(apiError.message, apiError.path, httpStatusCode); 16 | } 17 | 18 | static isAuthenticationError(apiError: ApiError): boolean { 19 | return apiError.path && apiError.path.toLowerCase() == "/oauth/token"; 20 | } 21 | 22 | static setAdditionalFields(apiError: ApiError, apiException: ApiException): ApiException { 23 | if (apiError.errorCode != null && apiError.errorCode.trim() != "") { 24 | apiException.errorCode = apiError.errorCode; 25 | } 26 | 27 | if (apiError.timeStamp) { 28 | apiException.timeStamp = apiError.timeStamp; 29 | } 30 | 31 | if (apiError.details) { 32 | apiException.details = apiError.details; 33 | } 34 | 35 | return apiException; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Util/TelemetryUtil.d.ts: -------------------------------------------------------------------------------- 1 | import { Telemetry } from "../Net/Telemetry"; 2 | export declare class TelemetryUtil { 3 | static ENV_KEY: string; 4 | static NAME_KEY: string; 5 | static VERSION_KEY: string; 6 | static LIBRARY_VERSION_KEY: string; 7 | static create(apiVersion?: string): Telemetry; 8 | static httpHeaderValue(telemetry: Telemetry): string; 9 | static base64Encode(text: string): string; 10 | static base64Decode(base64: string): string; 11 | static getSDKVersion(): string; 12 | } 13 | -------------------------------------------------------------------------------- /node-sdk-core/src/Internal/Util/TelemetryUtil.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TelemetryUtil.js","sourceRoot":"","sources":["TelemetryUtil.ts"],"names":[],"mappings":";;;AAAA,gDAA6C;AAE7C,MAAa,aAAa;IAMtB,MAAM,CAAC,MAAM,CAAC,UAAmB;QAC7B,IAAI,UAAU,GAAG,IAAI,CAAC,aAAa,EAAE,CAAC;QACtC,OAAO,IAAI,qBAAS,CAAC,qBAAqB,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,CAAC,eAAe,CAAC,SAAoB;QAEvC,IAAI,CAAC,SAAS,CAAC,IAAI;YAAE,OAAO,IAAI,CAAC;QAEjC,IAAI,MAAM,GAAG,EAAE,CAAC;QAEhB,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC,IAAI,CAAC;QACvC,IAAI,SAAS,CAAC,UAAU;YAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,SAAS,CAAC,UAAU,CAAC;QAE1E,IAAI,GAAG,GAAG,EAAE,CAAC;QACb,IAAI,SAAS,CAAC,cAAc;YAAE,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,GAAG,SAAS,CAAC,cAAc,CAAC;QACvF,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,GAAG,CAAC;QAE3B,IAAI,IAAI,GAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,IAAY;QAC5B,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACrC,OAAO,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,YAAY,CAAC,MAAc;QAC9B,IAAI,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACzC,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,aAAa;QAChB,OAAO,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAO,CAAC;IACjD,CAAC;;AAxCL,sCAyCC;AAxCU,qBAAO,GAAW,KAAK,CAAC;AACxB,sBAAQ,GAAW,MAAM,CAAC;AAC1B,yBAAW,GAAW,aAAa,CAAC;AACpC,iCAAmB,GAAW,qBAAqB,CAAC"} -------------------------------------------------------------------------------- /node-sdk-core/src/README.md: -------------------------------------------------------------------------------- 1 | # @reloadly/reloadly.core 2 | 3 | The implementation is based on the [Airtime API Docs](https://developers.reloadly.com/#airtime-api). 4 | 5 | @reloadly/reloadly.core is used as a dependency of @reloadly/reloadly.airtime and @reloadly/reloadly.authentication packages. 6 | 7 | You may find more information on the repository homepage: 8 | https://github.com/Reloadly/reloadly-sdk-nodejs 9 | -------------------------------------------------------------------------------- /node-sdk-core/src/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@reloadly/reloadly.core", 3 | "version": "1.0.6", 4 | "description": "reloadly.core", 5 | "author": "reloadly", 6 | "homepage": "https://developers.reloadly.com/", 7 | "repository": { 8 | "type": "git", 9 | "url": "git+https://github.com/Reloadly/reloadly-sdk-nodejs.git", 10 | "directory": "node-sdk-core" 11 | }, 12 | "devDependencies": { 13 | "@types/mocha": "^8.2.3", 14 | "@types/node": "^14.17.6", 15 | "mocha": "^8.4.0", 16 | "nyc": "^15.1.0", 17 | "typescript": "^4.3.5" 18 | }, 19 | "scripts": { 20 | "build": "tsc --build", 21 | "clean": "tsc --build --clean", 22 | "test": "nyc mocha" 23 | }, 24 | "dependencies": { 25 | "axios": "^0.21.2", 26 | "jwt-decode": "^3.1.2" 27 | }, 28 | "main": "Core.js", 29 | "directories": { 30 | "test": "test" 31 | }, 32 | "license": "MIT", 33 | "bugs": { 34 | "url": "https://github.com/Reloadly/reloadly-sdk-nodejs/issues" 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/CustomRequestTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/ExceptionUtilTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/ExceptionUtilTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiError_1 = require("../Dto/ApiError"); 4 | const ExceptionUtil_1 = require("../Internal/Util/ExceptionUtil"); 5 | var assert = require('assert'); 6 | describe('TelemetryUtil Tests', function () { 7 | it('Create ApiException', async function () { 8 | this.timeout(0); 9 | var now = new Date(); 10 | var apiException = ExceptionUtil_1.ExceptionUtil.convert(new ApiError_1.ApiError("err msg", "err/path", now, "err-code", ["detail"], "https://reloadly.com/info"), 500); 11 | assert.ok(apiException.details[0] == "detail"); 12 | assert.ok(apiException.errorCode == "err-code"); 13 | assert.ok(apiException.httpStatusCode == 500); 14 | assert.ok(apiException.message == "err msg"); 15 | assert.ok(apiException.path == "err/path"); 16 | assert.ok(apiException.timeStamp == now); 17 | }); 18 | }); 19 | //# sourceMappingURL=ExceptionUtilTests.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/test/ExceptionUtilTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ExceptionUtilTests.js","sourceRoot":"","sources":["ExceptionUtilTests.ts"],"names":[],"mappings":";;AAAA,8CAA2C;AAC3C,kEAA+D;AAE/D,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,qBAAqB,EAAE;IAC5B,EAAE,CAAC,qBAAqB,EAAE,KAAK;QAC3B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;QAErB,IAAI,YAAY,GAAG,6BAAa,CAAC,OAAO,CACpC,IAAI,mBAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,EAAE,UAAU,EAAE,CAAC,QAAQ,CAAC,EAAE,2BAA2B,CAAC,EAC7F,GAAG,CAAC,CAAC;QAET,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC;QAC/C,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,IAAI,UAAU,CAAC,CAAC;QAChD,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,cAAc,IAAI,GAAG,CAAC,CAAC;QAC9C,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC;QAC7C,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,IAAI,IAAI,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,IAAI,GAAG,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /node-sdk-core/src/test/ExceptionUtilTests.ts: -------------------------------------------------------------------------------- 1 | import { ApiError } from "../Dto/ApiError"; 2 | import { ExceptionUtil } from "../Internal/Util/ExceptionUtil"; 3 | 4 | var assert = require('assert'); 5 | 6 | describe('TelemetryUtil Tests', function () { 7 | it('Create ApiException', async function () { 8 | this.timeout(0); 9 | 10 | var now = new Date(); 11 | 12 | var apiException = ExceptionUtil.convert( 13 | new ApiError("err msg", "err/path", now, "err-code", ["detail"], "https://reloadly.com/info"), 14 | 500); 15 | 16 | assert.ok(apiException.details[0] == "detail"); 17 | assert.ok(apiException.errorCode == "err-code"); 18 | assert.ok(apiException.httpStatusCode == 500); 19 | assert.ok(apiException.message == "err msg"); 20 | assert.ok(apiException.path == "err/path"); 21 | assert.ok(apiException.timeStamp == now); 22 | }); 23 | }) 24 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/OAuthExceptionTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/OAuthExceptionTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const OAuthException_1 = require("../Exception/OAuth/OAuthException"); 4 | var assert = require('assert'); 5 | describe('OAuthException Tests', function () { 6 | it('Get Expired', async function () { 7 | this.timeout(0); 8 | var ex = new OAuthException_1.OAuthException("msg", "p/a/t/h", 403); 9 | ex.errorCode = "TOKEN_EXPIRED"; 10 | var expired = ex.isExpiredToken(); 11 | assert.ok(expired); 12 | }); 13 | }); 14 | //# sourceMappingURL=OAuthExceptionTests.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/test/OAuthExceptionTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"OAuthExceptionTests.js","sourceRoot":"","sources":["OAuthExceptionTests.ts"],"names":[],"mappings":";;AAAA,sEAAmE;AACnE,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,sBAAsB,EAAE;IAC7B,EAAE,CAAC,aAAa,EAAE,KAAK;QACnB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,EAAE,GAAG,IAAI,+BAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC;QACnD,EAAE,CAAC,SAAS,GAAG,eAAe,CAAC;QAE/B,IAAI,OAAO,GAAG,EAAE,CAAC,cAAc,EAAE,CAAC;QAClC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /node-sdk-core/src/test/OAuthExceptionTests.ts: -------------------------------------------------------------------------------- 1 | import { OAuthException } from "../Exception/OAuth/OAuthException"; 2 | var assert = require('assert'); 3 | 4 | describe('OAuthException Tests', function () { 5 | it('Get Expired', async function () { 6 | this.timeout(0); 7 | 8 | var ex = new OAuthException("msg", "p/a/t/h", 403); 9 | ex.errorCode = "TOKEN_EXPIRED"; 10 | 11 | var expired = ex.isExpiredToken(); 12 | assert.ok(expired); 13 | }); 14 | }) 15 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/TelemetryUtilTests.d.ts: -------------------------------------------------------------------------------- 1 | export {}; 2 | -------------------------------------------------------------------------------- /node-sdk-core/src/test/TelemetryUtilTests.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const Telemetry_1 = require("../Internal/Net/Telemetry"); 4 | const TelemetryUtil_1 = require("../Internal/Util/TelemetryUtil"); 5 | var assert = require('assert'); 6 | describe('TelemetryUtil Tests', function () { 7 | it('Get Package Version', async function () { 8 | this.timeout(0); 9 | var version = TelemetryUtil_1.TelemetryUtil.getSDKVersion(); 10 | assert.ok(version == "1.0.6"); 11 | }); 12 | it('Create Header Value', async function () { 13 | this.timeout(0); 14 | var telemetry = TelemetryUtil_1.TelemetryUtil.create("1.0"); 15 | var headerValueBase64 = TelemetryUtil_1.TelemetryUtil.httpHeaderValue(telemetry); 16 | var headerValue = TelemetryUtil_1.TelemetryUtil.base64Decode(headerValueBase64); 17 | assert.ok(headerValue == '{"name":"reloadly-sdk-nodejs","api-version":"1.0","env":{"reloadly-sdk-nodejs":"1.0.6"}}'); 18 | }); 19 | it('Not Create Header Value', async function () { 20 | this.timeout(0); 21 | var headerValue = TelemetryUtil_1.TelemetryUtil.httpHeaderValue(new Telemetry_1.Telemetry(null)); 22 | assert.ok(!headerValue); 23 | }); 24 | }); 25 | //# sourceMappingURL=TelemetryUtilTests.js.map -------------------------------------------------------------------------------- /node-sdk-core/src/test/TelemetryUtilTests.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"TelemetryUtilTests.js","sourceRoot":"","sources":["TelemetryUtilTests.ts"],"names":[],"mappings":";;AAAA,yDAAsD;AACtD,kEAA+D;AAE/D,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAE/B,QAAQ,CAAC,qBAAqB,EAAE;IAC5B,EAAE,CAAC,qBAAqB,EAAE,KAAK;QAC3B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,OAAO,GAAG,6BAAa,CAAC,aAAa,EAAE,CAAC;QAC5C,MAAM,CAAC,EAAE,CAAC,OAAO,IAAI,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,KAAK;QAC3B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,SAAS,GAAG,6BAAa,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5C,IAAI,iBAAiB,GAAG,6BAAa,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,WAAW,GAAG,6BAAa,CAAC,YAAY,CAAC,iBAAiB,CAAC,CAAC;QAChE,MAAM,CAAC,EAAE,CAAC,WAAW,IAAI,0FAA0F,CAAC,CAAC;IACzH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK;QAC/B,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;QAEhB,IAAI,WAAW,GAAG,6BAAa,CAAC,eAAe,CAAC,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QACrE,MAAM,CAAC,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAA"} -------------------------------------------------------------------------------- /node-sdk-core/src/test/TelemetryUtilTests.ts: -------------------------------------------------------------------------------- 1 | import { Telemetry } from "../Internal/Net/Telemetry"; 2 | import { TelemetryUtil } from "../Internal/Util/TelemetryUtil"; 3 | 4 | var assert = require('assert'); 5 | 6 | describe('TelemetryUtil Tests', function () { 7 | it('Get Package Version', async function () { 8 | this.timeout(0); 9 | 10 | var version = TelemetryUtil.getSDKVersion(); 11 | assert.ok(version == "1.0.6"); 12 | }); 13 | 14 | it('Create Header Value', async function () { 15 | this.timeout(0); 16 | 17 | var telemetry = TelemetryUtil.create("1.0"); 18 | var headerValueBase64 = TelemetryUtil.httpHeaderValue(telemetry); 19 | var headerValue = TelemetryUtil.base64Decode(headerValueBase64); 20 | assert.ok(headerValue == '{"name":"reloadly-sdk-nodejs","api-version":"1.0","env":{"reloadly-sdk-nodejs":"1.0.6"}}'); 21 | }); 22 | 23 | it('Not Create Header Value', async function () { 24 | this.timeout(0); 25 | 26 | var headerValue = TelemetryUtil.httpHeaderValue(new Telemetry(null)); 27 | assert.ok(!headerValue); 28 | }); 29 | }) 30 | -------------------------------------------------------------------------------- /node-sdk-core/src/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "declaration": true, 5 | "moduleResolution": "node", 6 | "module": "commonjs", 7 | "noImplicitAny": false, 8 | "noEmitOnError": true, 9 | "removeComments": false, 10 | "sourceMap": true, 11 | "target": "ES2020" 12 | }, 13 | "include": [ 14 | "**/*" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "requires": true, 3 | "lockfileVersion": 1, 4 | "dependencies": { 5 | "@types/node": { 6 | "version": "15.6.2", 7 | "resolved": "https://registry.npmjs.org/@types/node/-/node-15.6.2.tgz", 8 | "integrity": "sha512-dxcOx8801kMo3KlU+C+/ctWrzREAH7YvoF3aoVpRdqgs+Kf7flp+PJDN/EX5bME3suDUZHsxes9hpvBmzYlWbA==" 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /reloadly-example/.gitignore: -------------------------------------------------------------------------------- 1 | ApiCredentials*.* -------------------------------------------------------------------------------- /reloadly-example/README.md: -------------------------------------------------------------------------------- 1 | # reloadly-example 2 | 3 | 4 | -------------------------------------------------------------------------------- /reloadly-example/USAGE.md: -------------------------------------------------------------------------------- 1 | # Example Application 2 | 3 | An example Node.JS Express web application is provided to demonstrate the full API usage in a real-life scenario. 4 | 5 | You may examine the application or just copy & paste code from it into your application. 6 | 7 | The application exposes several HTTP GET endpoints, each providing an example to the usage of a different Airtime API operation such as accounts or promotions. The list of these endpoints are: 8 | 9 | ``` 10 | /auth 11 | /auth/refresh_token // An example of how to handle expired refresh tokens if setting access token manually 12 | /balance 13 | /operator_listbycountrycode 14 | /country_list' 15 | /discount_byoperatorid' 16 | /promotion_byid' 17 | /topup 18 | /report_transaction_list 19 | ``` 20 | -------------------------------------------------------------------------------- /reloadly-example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "reloadly-example", 3 | "version": "0.0.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "tsc --build", 7 | "clean": "tsc --build --clean", 8 | "start": "node app" 9 | }, 10 | "description": "reloadly-example", 11 | "author": { 12 | "name": "" 13 | }, 14 | "main": "app.js", 15 | "dependencies": { 16 | "@reloadly/reloadly.airtime": "^1.0.2", 17 | "debug": "^2.2.0", 18 | "express": "^4.14.0", 19 | "pug": "^3.0.2" 20 | }, 21 | "devDependencies": { 22 | "@types/debug": "0.0.30", 23 | "@types/express": "^4.17.13", 24 | "@types/express-serve-static-core": "^4.17.24", 25 | "@types/mime": "^1.3.1", 26 | "@types/node": "^8.0.14", 27 | "@types/serve-static": "^1.13.10", 28 | "typescript": "^3.9.10" 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /reloadly-example/public/stylesheets/main.css: -------------------------------------------------------------------------------- 1 | body { 2 | padding: 50px; 3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif; 4 | } 5 | 6 | a { 7 | color: #00B7FF; 8 | } 9 | -------------------------------------------------------------------------------- /reloadly-example/routes/ExampleClass.js: -------------------------------------------------------------------------------- 1 | class ExampleClass { 2 | constructor() { } 3 | } 4 | //# sourceMappingURL=ExampleClass.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/ExampleClass.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"ExampleClass.js","sourceRoot":"","sources":["ExampleClass.ts"],"names":[],"mappings":"AAAA,MAAM,YAAY;IACd,gBAAgB,CAAC;CACpB"} -------------------------------------------------------------------------------- /reloadly-example/routes/auth.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ReloadlyAuthentication = require("@reloadly/reloadly.authentication"); 4 | const ReloadlyCore = require("@reloadly/reloadly.core"); 5 | const express = require("express"); 6 | const ApiCredentials_1 = require("../ApiCredentials"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new ReloadlyAuthentication.AuthenticationApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, ReloadlyCore.ServiceURLs.AIRTIME_SANDBOX); 10 | var operation = api.clientCredentials(); 11 | var request = operation.getAccessToken(); 12 | var response = await request.execute(); 13 | res.send("access token: " + response.access_token); 14 | }); 15 | exports.default = router; 16 | //# sourceMappingURL=auth.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/auth.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth.js","sourceRoot":"","sources":["auth.ts"],"names":[],"mappings":";;AAAA,4EAA6E;AAC7E,wDAAyD;AAEzD,mCAAoC;AACpC,sDAAmD;AACnD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IACvJ,IAAI,SAAS,GAAG,GAAG,CAAC,iBAAiB,EAAE,CAAC;IACxC,IAAI,OAAO,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;IAEzC,IAAI,QAAQ,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACvC,GAAG,CAAC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/auth.ts: -------------------------------------------------------------------------------- 1 | import ReloadlyAuthentication = require("@reloadly/reloadly.authentication"); 2 | import ReloadlyCore = require("@reloadly/reloadly.core"); 3 | 4 | import express = require('express'); 5 | import { ApiCredentials } from "../ApiCredentials"; 6 | const router = express.Router(); 7 | 8 | router.get('/', async (req: express.Request, res: express.Response) => { 9 | 10 | var api = new ReloadlyAuthentication.AuthenticationApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, ReloadlyCore.ServiceURLs.AIRTIME_SANDBOX); 11 | var operation = api.clientCredentials(); 12 | var request = operation.getAccessToken(); 13 | 14 | var response = await request.execute(); 15 | res.send("access token: " + response.access_token); 16 | }); 17 | 18 | export default router; 19 | -------------------------------------------------------------------------------- /reloadly-example/routes/auth_refresh_token.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth_refresh_token.js","sourceRoot":"","sources":["auth_refresh_token.ts"],"names":[],"mappings":";;AAAA,8DAA+D;AAC/D,4EAA6E;AAC7E,wDAAyD;AAEzD,mCAAoC;AACpC,sDAAmD;AAEnD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAClE,IAAI,OAAO,GAAG,IAAI,sBAAsB,CAAC,iBAAiB,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,YAAY,CAAC,WAAW,CAAC,eAAe,CAAC,CAAC;IAC3J,IAAI,SAAS,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC5C,IAAI,kBAAkB,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;IACpD,IAAI,mBAAmB,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,CAAC;IAC7D,IAAI,WAAW,GAAG,mBAAmB,CAAC,YAAY,CAAC;IAEnD,IAAI,UAAU,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACrJ,IAAI,kBAAkB,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;IACtD,IAAI,gBAAgB,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAEjD,yBAAyB;IACzB,MAAM,mBAAmB,GAA+F,gBAAgB,CAAC;IACzI,mBAAmB,CAAC,SAAS,CAAC,YAAY,CAAC,UAAU,CAAC,aAAa,EAAE,SAAS,GAAG,SAAS,CAAC,CAAC;IAE5F,IAAI,SAAS,CAAC;IAEd,IAAI;QACA,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAE7C,4BAA4B;QAC5B,MAAM,UAAU,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QACtD,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,wBAAwB;KACzE;IAAC,OAAO,EAAE,EAAE;QACT,IAAI,EAAE,CAAC,SAAS,CAAC,WAAW,EAAE,KAAK,eAAe,EAAE;YAChD,UAAU,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;YAChD,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,wBAAwB;SACzE;aAAM;YACH,yBAAyB;SAC5B;KACJ;AACL,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/auth_refreshtoken.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"auth_refreshtoken.js","sourceRoot":"","sources":["auth_refreshtoken.ts"],"names":[],"mappings":";;AAAA,qFAAqF;AACrF,gEAAgE;AAChE,uDAA2D;AAC3D,uDAA2D;AAE3D,mCAAoC;AACpC,sDAAmD;AACnD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAClE,IAAI,OAAO,GAAG,IAAI,kCAAiB,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,kBAAW,CAAC,eAAe,CAAC,CAAC;IACvH,IAAI,SAAS,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAC5C,IAAI,kBAAkB,GAAG,SAAS,CAAC,cAAc,EAAE,CAAC;IACpD,IAAI,mBAAmB,GAAG,MAAM,kBAAkB,CAAC,OAAO,EAAE,CAAC;IAC7D,IAAI,WAAW,GAAG,mBAAmB,CAAC,YAAY,CAAC;IAEnD,IAAI,UAAU,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,WAAW,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IACxH,IAAI,kBAAkB,GAAG,MAAM,UAAU,CAAC,SAAS,EAAE,CAAC;IACtD,IAAI,gBAAgB,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC;IAEjD,IAAI,SAAS,CAAC;IAEd,IAAI;QACA,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC;QAE7C,4BAA4B;QAC5B,UAAU,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;QAChD,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,wBAAwB;KACzE;IAAC,OAAO,CAAC,EAAE;QACR,IAAI,IAAI,CAAC,8CAA8C,EAAE;YACrD,UAAU,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC;YAChD,SAAS,GAAG,MAAM,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,wBAAwB;SACzE;aAAM;YACH,yBAAyB;SAC5B;KACJ;AACL,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/balance.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const ReloadlyAirtime = require("@reloadly/reloadly.airtime"); 5 | const ReloadlyCore = require("@reloadly/reloadly.core"); 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new ReloadlyAirtime.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, ReloadlyCore.Environment.SANDBOX); 10 | try { 11 | var operation = await api.accounts(); 12 | } 13 | catch (err) { 14 | res.send(err); 15 | } 16 | var request = operation.getBalance(); 17 | var balanceInfo = await request.execute(); 18 | res.send(balanceInfo); 19 | }); 20 | exports.default = router; 21 | //# sourceMappingURL=balance.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/balance.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"balance.js","sourceRoot":"","sources":["balance.ts"],"names":[],"mappings":";;AAAA,sDAAmD;AAEnD,8DAA+D;AAC/D,wDAAyD;AAEzD,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,YAAY,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAEvI,IAAI;QACA,IAAI,SAAS,GAAG,MAAM,GAAG,CAAC,QAAQ,EAAE,CAAC;KACxC;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI,OAAO,GAAG,SAAS,CAAC,UAAU,EAAE,CAAC;IAErC,IAAI,WAAW,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IAC1C,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;AAC1B,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/balance.ts: -------------------------------------------------------------------------------- 1 | import { ApiCredentials } from "../ApiCredentials"; 2 | 3 | import ReloadlyAirtime = require("@reloadly/reloadly.airtime"); 4 | import ReloadlyCore = require("@reloadly/reloadly.core"); 5 | 6 | import express = require('express'); 7 | const router = express.Router(); 8 | 9 | router.get('/', async (req: express.Request, res: express.Response) => { 10 | 11 | var api = new ReloadlyAirtime.AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, ReloadlyCore.Environment.SANDBOX); 12 | 13 | try { 14 | var operation = await api.accounts(); 15 | } catch (err) { 16 | res.send(err); 17 | } 18 | 19 | var request = operation.getBalance(); 20 | 21 | var balanceInfo = await request.execute(); 22 | res.send(balanceInfo); 23 | }); 24 | 25 | export default router; 26 | -------------------------------------------------------------------------------- /reloadly-example/routes/country_list.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const Airtime_1 = require("../../node-sdk-airtime/src/Airtime"); 5 | const Core_1 = require("../../node-sdk-core/src/Core"); 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new Airtime_1.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, Core_1.Environment.SANDBOX); 10 | try { 11 | var operation = await api.countries(); 12 | } 13 | catch (err) { 14 | res.send(err); 15 | } 16 | var request = operation.list(); 17 | var result = await request.execute(); 18 | res.send(result); 19 | }); 20 | exports.default = router; 21 | //# sourceMappingURL=country_list.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/country_list.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"country_list.js","sourceRoot":"","sources":["country_list.ts"],"names":[],"mappings":";;AAAA,sDAE2B;AAE3B,gEAE4C;AAE5C,uDAEsC;AAEtC,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IAE1G,IAAI;QACA,IAAI,SAAS,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;KACzC;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;IAE/B,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/country_list.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApiCredentials 3 | } from "../ApiCredentials"; 4 | 5 | import { 6 | AirtimeApi 7 | } from "../../node-sdk-airtime/src/Airtime"; 8 | 9 | import { 10 | Environment 11 | } from "../../node-sdk-core/src/Core"; 12 | 13 | import express = require('express'); 14 | const router = express.Router(); 15 | 16 | router.get('/', async (req: express.Request, res: express.Response) => { 17 | 18 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 19 | 20 | try { 21 | var operation = await api.countries(); 22 | } catch (err) { 23 | res.send(err); 24 | } 25 | 26 | var request = operation.list(); 27 | 28 | var result = await request.execute(); 29 | res.send(result); 30 | }); 31 | 32 | export default router; 33 | -------------------------------------------------------------------------------- /reloadly-example/routes/discount_byoperatorid.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const Airtime_1 = require("../../node-sdk-airtime/src/Airtime"); 5 | const Core_1 = require("../../node-sdk-core/src/Core"); 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new Airtime_1.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, Core_1.Environment.SANDBOX); 10 | try { 11 | var operation = await api.discounts(); 12 | } 13 | catch (err) { 14 | res.send(err); 15 | } 16 | var request = operation.getByOperatorId(BigInt(5)); 17 | var result = await request.execute(); 18 | res.send(result); 19 | }); 20 | exports.default = router; 21 | //# sourceMappingURL=discount_byoperatorid.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/discount_byoperatorid.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"discount_byoperatorid.js","sourceRoot":"","sources":["discount_byoperatorid.ts"],"names":[],"mappings":";;AAAA,sDAE2B;AAE3B,gEAE4C;AAE5C,uDAEsC;AAEtC,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IAE1G,IAAI;QACA,IAAI,SAAS,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;KACzC;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI,OAAO,GAAG,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAEnD,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/discount_byoperatorid.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApiCredentials 3 | } from "../ApiCredentials"; 4 | 5 | import { 6 | AirtimeApi 7 | } from "../../node-sdk-airtime/src/Airtime"; 8 | 9 | import { 10 | Environment 11 | } from "../../node-sdk-core/src/Core"; 12 | 13 | import express = require('express'); 14 | const router = express.Router(); 15 | 16 | router.get('/', async (req: express.Request, res: express.Response) => { 17 | 18 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 19 | 20 | try { 21 | var operation = await api.discounts(); 22 | } catch (err) { 23 | res.send(err); 24 | } 25 | 26 | var request = operation.getByOperatorId(BigInt(5)); 27 | 28 | var result = await request.execute(); 29 | res.send(result); 30 | }); 31 | 32 | export default router; 33 | -------------------------------------------------------------------------------- /reloadly-example/routes/index.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | /* 4 | * GET home page. 5 | */ 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', (req, res) => { 9 | res.render('index', { title: 'Express' }); 10 | }); 11 | exports.default = router; 12 | //# sourceMappingURL=index.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/index.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAC5D,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9C,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/index.ts: -------------------------------------------------------------------------------- 1 | /* 2 | * GET home page. 3 | */ 4 | import express = require('express'); 5 | const router = express.Router(); 6 | 7 | router.get('/', (req: express.Request, res: express.Response) => { 8 | res.render('index', { title: 'Express' }); 9 | }); 10 | 11 | export default router; -------------------------------------------------------------------------------- /reloadly-example/routes/operator_listbycountrycode.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const Airtime_1 = require("../../node-sdk-airtime/src/Airtime"); 5 | const Core_1 = require("../../node-sdk-core/src/Core"); 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new Airtime_1.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, Core_1.Environment.SANDBOX); 10 | try { 11 | var operation = await api.operators(); 12 | } 13 | catch (err) { 14 | res.send(err); 15 | } 16 | var request = operation.listByCountryCode("TR"); 17 | var result = await request.execute(); 18 | res.send(result); 19 | }); 20 | exports.default = router; 21 | //# sourceMappingURL=operator_listbycountrycode.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/operator_listbycountrycode.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"operator_listbycountrycode.js","sourceRoot":"","sources":["operator_listbycountrycode.ts"],"names":[],"mappings":";;AAAA,sDAE2B;AAE3B,gEAE4C;AAE5C,uDAEsC;AAEtC,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IAE1G,IAAI;QACA,IAAI,SAAS,GAAG,MAAM,GAAG,CAAC,SAAS,EAAE,CAAC;KACzC;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI,OAAO,GAAG,SAAS,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAEhD,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/operator_listbycountrycode.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApiCredentials 3 | } from "../ApiCredentials"; 4 | 5 | import { 6 | AirtimeApi 7 | } from "../../node-sdk-airtime/src/Airtime"; 8 | 9 | import { 10 | Environment 11 | } from "../../node-sdk-core/src/Core"; 12 | 13 | import express = require('express'); 14 | const router = express.Router(); 15 | 16 | router.get('/', async (req: express.Request, res: express.Response) => { 17 | 18 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 19 | 20 | try { 21 | var operation = await api.operators(); 22 | } catch (err) { 23 | res.send(err); 24 | } 25 | 26 | var request = operation.listByCountryCode("TR"); 27 | 28 | var result = await request.execute(); 29 | res.send(result); 30 | }); 31 | 32 | export default router; 33 | -------------------------------------------------------------------------------- /reloadly-example/routes/promotion_byid.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const Airtime_1 = require("../../node-sdk-airtime/src/Airtime"); 5 | const Core_1 = require("../../node-sdk-core/src/Core"); 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new Airtime_1.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, Core_1.Environment.SANDBOX); 10 | try { 11 | var operation = await api.promotions(); 12 | } 13 | catch (err) { 14 | res.send(err); 15 | } 16 | var request = operation.getById(BigInt(5665)); 17 | var result = await request.execute(); 18 | res.send(result); 19 | }); 20 | exports.default = router; 21 | //# sourceMappingURL=promotion_byid.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/promotion_byid.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"promotion_byid.js","sourceRoot":"","sources":["promotion_byid.ts"],"names":[],"mappings":";;AAAA,sDAE2B;AAE3B,gEAE4C;AAE5C,uDAEsC;AAEtC,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IAE1G,IAAI;QACA,IAAI,SAAS,GAAG,MAAM,GAAG,CAAC,UAAU,EAAE,CAAA;KACzC;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAE7C,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;IACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrB,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/promotion_byid.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApiCredentials 3 | } from "../ApiCredentials"; 4 | 5 | import { 6 | AirtimeApi 7 | } from "../../node-sdk-airtime/src/Airtime"; 8 | 9 | import { 10 | Environment 11 | } from "../../node-sdk-core/src/Core"; 12 | 13 | import express = require('express'); 14 | const router = express.Router(); 15 | 16 | router.get('/', async (req: express.Request, res: express.Response) => { 17 | 18 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 19 | 20 | try { 21 | var operation = await api.promotions() 22 | } catch (err) { 23 | res.send(err); 24 | } 25 | 26 | var request = operation.getById(BigInt(5665)) 27 | 28 | var result = await request.execute(); 29 | res.send(result); 30 | }); 31 | 32 | export default router; 33 | -------------------------------------------------------------------------------- /reloadly-example/routes/report_transaction_list.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const Airtime_1 = require("../../node-sdk-airtime/src/Airtime"); 5 | const Core_1 = require("../../node-sdk-core/src/Core"); 6 | const express = require("express"); 7 | const router = express.Router(); 8 | router.get('/', async (req, res) => { 9 | var api = new Airtime_1.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, Core_1.Environment.SANDBOX); 10 | try { 11 | var reportsOperation = await api.reports(); 12 | var operation = reportsOperation.transactionsHistory(); 13 | } 14 | catch (err) { 15 | res.send(err); 16 | } 17 | try { 18 | var request = operation.list(); 19 | var result = await request.execute(); 20 | res.send(result); 21 | } 22 | catch (err) { 23 | res.send(err); 24 | } 25 | }); 26 | exports.default = router; 27 | //# sourceMappingURL=report_transaction_list.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/report_transaction_list.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"report_transaction_list.js","sourceRoot":"","sources":["report_transaction_list.ts"],"names":[],"mappings":";;AAAA,sDAE2B;AAE3B,gEAE4C;AAE5C,uDAEsC;AAEtC,mCAAoC;AACpC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IAE1G,IAAI;QACA,IAAI,gBAAgB,GAAG,MAAM,GAAG,CAAC,OAAO,EAAE,CAAC;QAC3C,IAAI,SAAS,GAAG,gBAAgB,CAAC,mBAAmB,EAAE,CAAC;KAC1D;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI;QACA,IAAI,OAAO,GAAG,SAAS,CAAC,IAAI,EAAE,CAAC;QAC/B,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACpB;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;AACL,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/report_transaction_list.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApiCredentials 3 | } from "../ApiCredentials"; 4 | 5 | import { 6 | AirtimeApi 7 | } from "../../node-sdk-airtime/src/Airtime"; 8 | 9 | import { 10 | Environment 11 | } from "../../node-sdk-core/src/Core"; 12 | 13 | import express = require('express'); 14 | const router = express.Router(); 15 | 16 | router.get('/', async (req: express.Request, res: express.Response) => { 17 | 18 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 19 | 20 | try { 21 | var reportsOperation = await api.reports(); 22 | var operation = reportsOperation.transactionsHistory(); 23 | } catch (err) { 24 | res.send(err); 25 | } 26 | 27 | try { 28 | var request = operation.list(); 29 | var result = await request.execute(); 30 | res.send(result); 31 | } catch (err) { 32 | res.send(err); 33 | } 34 | }); 35 | 36 | export default router; 37 | -------------------------------------------------------------------------------- /reloadly-example/routes/topup.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | Object.defineProperty(exports, "__esModule", { value: true }); 3 | const ApiCredentials_1 = require("../ApiCredentials"); 4 | const Airtime_1 = require("../../node-sdk-airtime/src/Airtime"); 5 | const Core_1 = require("../../node-sdk-core/src/Core"); 6 | const express = require("express"); 7 | const Airtime_2 = require("../../node-sdk-airtime/src/Airtime"); 8 | const router = express.Router(); 9 | router.get('/', async (req, res) => { 10 | var api = new Airtime_1.AirtimeApi(ApiCredentials_1.ApiCredentials.ClientId, ApiCredentials_1.ApiCredentials.ClientSecret, null, Core_1.Environment.SANDBOX); 11 | try { 12 | var operation = await api.topups(); 13 | } 14 | catch (err) { 15 | res.send(err); 16 | } 17 | var request = operation.send(new Airtime_2.PhoneTopupRequest(10, 537, new Airtime_2.Phone("+447772235236", "GB"), true, new Airtime_2.Phone("+447772235235", "GB"))); 18 | try { 19 | var result = await request.execute(); 20 | res.send(result); 21 | } 22 | catch (err) { 23 | res.send(err); 24 | } 25 | }); 26 | exports.default = router; 27 | //# sourceMappingURL=topup.js.map -------------------------------------------------------------------------------- /reloadly-example/routes/topup.js.map: -------------------------------------------------------------------------------- 1 | {"version":3,"file":"topup.js","sourceRoot":"","sources":["topup.ts"],"names":[],"mappings":";;AAAA,sDAE2B;AAE3B,gEAE4C;AAE5C,uDAEsC;AAEtC,mCAAoC;AACpC,gEAA8E;AAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;AAEhC,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,GAAoB,EAAE,GAAqB,EAAE,EAAE;IAElE,IAAI,GAAG,GAAG,IAAI,oBAAU,CAAC,+BAAc,CAAC,QAAQ,EAAE,+BAAc,CAAC,YAAY,EAAE,IAAI,EAAE,kBAAW,CAAC,OAAO,CAAC,CAAC;IAE1G,IAAI;QACA,IAAI,SAAS,GAAG,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC;KACtC;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;IAED,IAAI,OAAO,GAAG,SAAS,CAAC,IAAI,CACxB,IAAI,2BAAiB,CAAC,EAAE,EAAE,GAAG,EAAE,IAAI,eAAK,CAAC,eAAe,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,eAAK,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAE9G,IAAI;QACA,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACrC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACpB;IAAC,OAAO,GAAG,EAAE;QACV,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACjB;AACL,CAAC,CAAC,CAAC;AAEH,kBAAe,MAAM,CAAC"} -------------------------------------------------------------------------------- /reloadly-example/routes/topup.ts: -------------------------------------------------------------------------------- 1 | import { 2 | ApiCredentials 3 | } from "../ApiCredentials"; 4 | 5 | import { 6 | AirtimeApi 7 | } from "../../node-sdk-airtime/src/Airtime"; 8 | 9 | import { 10 | Environment 11 | } from "../../node-sdk-core/src/Core"; 12 | 13 | import express = require('express'); 14 | import { Phone, PhoneTopupRequest } from "../../node-sdk-airtime/src/Airtime"; 15 | const router = express.Router(); 16 | 17 | router.get('/', async (req: express.Request, res: express.Response) => { 18 | 19 | var api = new AirtimeApi(ApiCredentials.ClientId, ApiCredentials.ClientSecret, null, Environment.SANDBOX); 20 | 21 | try { 22 | var operation = await api.topups(); 23 | } catch (err) { 24 | res.send(err); 25 | } 26 | 27 | var request = operation.send( 28 | new PhoneTopupRequest(10, 537, new Phone("+447772235236", "GB"), true, new Phone("+447772235235", "GB"))); 29 | 30 | try { 31 | var result = await request.execute(); 32 | res.send(result); 33 | } catch (err) { 34 | res.send(err); 35 | } 36 | }); 37 | 38 | export default router; 39 | -------------------------------------------------------------------------------- /reloadly-example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "moduleResolution": "node", 4 | "module": "commonjs", 5 | "lib": [ "es2020" ], 6 | "noEmitOnError": true, 7 | "removeComments": false, 8 | "sourceMap": true, 9 | "target": "es2020" 10 | }, 11 | "exclude": [ 12 | "node_modules" 13 | ], 14 | "references": [ 15 | { "path": "../node-sdk-authentication/src" }, 16 | { "path": "../node-sdk-airtime/src" }, 17 | { "path": "../node-sdk-core/src" } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /reloadly-example/views/error.pug: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= message 5 | h2= error.status 6 | pre #{error.stack} -------------------------------------------------------------------------------- /reloadly-example/views/index.pug: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block content 4 | h1= title 5 | p Welcome to #{title} -------------------------------------------------------------------------------- /reloadly-example/views/layout.pug: -------------------------------------------------------------------------------- 1 | doctype html 2 | html 3 | head 4 | title= title 5 | link(rel='stylesheet', href='/stylesheets/main.css') 6 | body 7 | block content --------------------------------------------------------------------------------