Skip to content

Commit

Permalink
Merge pull request #6 from PaystackOSS/patch/module-res
Browse files Browse the repository at this point in the history
Patch: Fix TS constructor error
  • Loading branch information
damilola-paystack authored Nov 1, 2022
2 parents 416cc50 + f551f42 commit 7e46835
Show file tree
Hide file tree
Showing 92 changed files with 94 additions and 36 deletions.
2 changes: 1 addition & 1 deletion lib/apis/Subscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class Subscription extends runtime_1.BaseAPI {
const queryParameters = {};
const response = yield this.request({
path: `/subscription/{code}/manage/link`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))),
method: 'POST',
method: 'GET',
query: queryParameters,
});
return models_1.ResponseFromJSON(response);
Expand Down
5 changes: 5 additions & 0 deletions lib/apis/Transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ class Transaction extends runtime_1.BaseAPI {
});
}
/**
* Fetch a transaction to get its details
* Fetch Transaction
*/
fetch(requestParameters) {
Expand Down Expand Up @@ -244,6 +245,7 @@ class Transaction extends runtime_1.BaseAPI {
});
}
/**
* List transactions that has occurred on your integration
* List Transactions
*/
list(requestParameters) {
Expand Down Expand Up @@ -333,6 +335,7 @@ class Transaction extends runtime_1.BaseAPI {
});
}
/**
* Get the details about the lifecycle of a transaction from initiation to completion
* Fetch Transaction Timeline
*/
timeline(requestParameters) {
Expand All @@ -350,6 +353,7 @@ class Transaction extends runtime_1.BaseAPI {
});
}
/**
* Get the total amount of all transactions
* Transaction Totals
*/
totals(requestParameters) {
Expand All @@ -376,6 +380,7 @@ class Transaction extends runtime_1.BaseAPI {
});
}
/**
* Verify a previously initiated transaction using it\'s reference
* Verify Transaction
*/
verify(requestParameters) {
Expand Down
60 changes: 40 additions & 20 deletions lib/apis/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,42 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Balance = require("./Balance");
exports.BulkCharge = require("./BulkCharge");
exports.Charge = require("./Charge");
exports.Customer = require("./Customer");
exports.DedicatedVirtualAccount = require("./DedicatedVirtualAccount");
exports.Dispute = require("./Dispute");
exports.Integration = require("./Integration");
exports.Page = require("./Page");
exports.PaymentRequest = require("./PaymentRequest");
exports.Plan = require("./Plan");
exports.Product = require("./Product");
exports.Refund = require("./Refund");
exports.Settlement = require("./Settlement");
exports.Split = require("./Split");
exports.Subaccount = require("./Subaccount");
exports.Subscription = require("./Subscription");
exports.Transaction = require("./Transaction");
exports.Transfer = require("./Transfer");
exports.TransferRecipient = require("./TransferRecipient");
exports.Verification = require("./Verification");
exports.Verification = exports.TransferRecipient = exports.Transfer = exports.Transaction = exports.Subscription = exports.Subaccount = exports.Split = exports.Settlement = exports.Refund = exports.Product = exports.Plan = exports.PaymentRequest = exports.Page = exports.Integration = exports.Dispute = exports.DedicatedVirtualAccount = exports.Customer = exports.Charge = exports.BulkCharge = exports.Balance = void 0;
exports.Balance = __importStar(require("./Balance"));
exports.BulkCharge = __importStar(require("./BulkCharge"));
exports.Charge = __importStar(require("./Charge"));
exports.Customer = __importStar(require("./Customer"));
exports.DedicatedVirtualAccount = __importStar(require("./DedicatedVirtualAccount"));
exports.Dispute = __importStar(require("./Dispute"));
exports.Integration = __importStar(require("./Integration"));
exports.Page = __importStar(require("./Page"));
exports.PaymentRequest = __importStar(require("./PaymentRequest"));
exports.Plan = __importStar(require("./Plan"));
exports.Product = __importStar(require("./Product"));
exports.Refund = __importStar(require("./Refund"));
exports.Settlement = __importStar(require("./Settlement"));
exports.Split = __importStar(require("./Split"));
exports.Subaccount = __importStar(require("./Subaccount"));
exports.Subscription = __importStar(require("./Subscription"));
exports.Transaction = __importStar(require("./Transaction"));
exports.Transfer = __importStar(require("./Transfer"));
exports.TransferRecipient = __importStar(require("./TransferRecipient"));
exports.Verification = __importStar(require("./Verification"));
1 change: 0 additions & 1 deletion lib/index.d.ts

This file was deleted.

23 changes: 22 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,26 @@
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const Resources = require("./apis");
exports.Paystack = void 0;
const Resources = __importStar(require("./apis"));
class Paystack {
constructor(apiKey) {
this.extend(apiKey);
Expand All @@ -24,5 +44,6 @@ class Paystack {
return resource.toLowerCase().replace("api", "");
}
}
exports.Paystack = Paystack;
module.exports = Paystack;
module.exports.default = Paystack;
2 changes: 1 addition & 1 deletion lib/models/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p);
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./Accepted"), exports);
Expand Down
2 changes: 1 addition & 1 deletion lib/runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class BaseAPI {
path: tempPath,
headers: {
"authorization": `Bearer ${this.apiKey}`,
"user-agent": `@paystack/paystack-sdk - 1.0.0`
"user-agent": `@paystack/paystack-sdk - 1.0.1`
}
};
return new Promise((resolve, reject) => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions lib/apis/Transaction.d.ts → lib/types/apis/Transaction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export declare class Transaction extends BaseAPI {
*/
event(requestParameters: EventRequest): Promise<Response>;
/**
* Fetch a transaction to get its details
* Fetch Transaction
*/
fetch(requestParameters: FetchRequest): Promise<Response>;
Expand All @@ -116,6 +117,7 @@ export declare class Transaction extends BaseAPI {
*/
initialize(requestParameters: InitializeRequest): Promise<Response>;
/**
* List transactions that has occurred on your integration
* List Transactions
*/
list(requestParameters: ListRequest): Promise<Response>;
Expand All @@ -128,14 +130,17 @@ export declare class Transaction extends BaseAPI {
*/
session(requestParameters: SessionRequest): Promise<Response>;
/**
* Get the details about the lifecycle of a transaction from initiation to completion
* Fetch Transaction Timeline
*/
timeline(requestParameters: TimelineRequest): Promise<Response>;
/**
* Get the total amount of all transactions
* Transaction Totals
*/
totals(requestParameters: TotalsRequest): Promise<Response>;
/**
* Verify a previously initiated transaction using it\'s reference
* Verify Transaction
*/
verify(requestParameters: VerifyRequest): Promise<Response>;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions lib/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export declare class Paystack {
[index: string]: any;
constructor(apiKey: string);
private extend;
private toCamelCase;
private cleanResourceKey;
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paystack/paystack-sdk",
"version": "1.0.0",
"version": "1.0.1",
"description": "Paystack API wrapper for Node",
"author": "Paystack <[email protected]> (https://paystack.com/docs)",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion src/apis/Subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ export class Subscription extends BaseAPI {

const response = await this.request({
path: `/subscription/{code}/manage/link`.replace(`{${"code"}}`, encodeURIComponent(String(requestParameters.code))),
method: 'POST',
method: 'GET',
query: queryParameters,
});

Expand Down
5 changes: 5 additions & 0 deletions src/apis/Transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ export class Transaction extends BaseAPI {
}

/**
* Fetch a transaction to get its details
* Fetch Transaction
*/
async fetch(requestParameters: FetchRequest): Promise<Response> {
Expand Down Expand Up @@ -373,6 +374,7 @@ export class Transaction extends BaseAPI {
}

/**
* List transactions that has occurred on your integration
* List Transactions
*/
async list(requestParameters: ListRequest): Promise<Response> {
Expand Down Expand Up @@ -479,6 +481,7 @@ export class Transaction extends BaseAPI {
}

/**
* Get the details about the lifecycle of a transaction from initiation to completion
* Fetch Transaction Timeline
*/
async timeline(requestParameters: TimelineRequest): Promise<Response> {
Expand All @@ -498,6 +501,7 @@ export class Transaction extends BaseAPI {
}

/**
* Get the total amount of all transactions
* Transaction Totals
*/
async totals(requestParameters: TotalsRequest): Promise<Response> {
Expand Down Expand Up @@ -530,6 +534,7 @@ export class Transaction extends BaseAPI {
}

/**
* Verify a previously initiated transaction using it\'s reference
* Verify Transaction
*/
async verify(requestParameters: VerifyRequest): Promise<Response> {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as Resources from './apis'

class Paystack {
export class Paystack {
[index: string]: any

constructor(apiKey: string) {
Expand Down
2 changes: 1 addition & 1 deletion src/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class BaseAPI {
path: tempPath,
headers: {
"authorization": `Bearer ${this.apiKey}`,
"user-agent": `@paystack/paystack-sdk - 1.0.0`
"user-agent": `@paystack/paystack-sdk - 1.0.1`
}
}

Expand Down
10 changes: 3 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
{
"compilerOptions": {
"declaration": true,
"declarationDir": "./lib/types",
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"esModuleInterop": true,
"outDir": "lib",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"lib",
"node_modules"
]
"include": ["src"]
}

0 comments on commit 7e46835

Please sign in to comment.