@skinramp/ts-sdk 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +41 -0
- package/package.json +37 -0
package/README.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# tsdown-starter
|
|
2
|
+
|
|
3
|
+
A starter for creating a TypeScript package.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
- Install dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Run the unit tests:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Build the library:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as convex_values0 from "convex/values";
|
|
2
|
+
|
|
3
|
+
//#region src/client.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Skinramp SDK client
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* const skinramp = new Skinramp('sk_development_...')
|
|
11
|
+
*
|
|
12
|
+
* // Create a payment
|
|
13
|
+
* const payment = await skinramp.payments.create('user_123')
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare class Skinramp {
|
|
17
|
+
private readonly convexHttp;
|
|
18
|
+
readonly apiKey: string;
|
|
19
|
+
constructor(apiKey: string, apiUrl?: string);
|
|
20
|
+
readonly payments: {
|
|
21
|
+
create: (data: {
|
|
22
|
+
amount: number;
|
|
23
|
+
gameId?: "CS2" | "ROBLOX" | "RUST";
|
|
24
|
+
metadata?: Record<string, string | number | boolean>;
|
|
25
|
+
}) => Promise<convex_values0.GenericId<"payments">>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { Skinramp, Skinramp as default };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ConvexHttpClient } from "convex/browser";
|
|
2
|
+
import { anyApi } from "convex/server";
|
|
3
|
+
import "convex/values";
|
|
4
|
+
|
|
5
|
+
//#region src/api.ts
|
|
6
|
+
const api = anyApi;
|
|
7
|
+
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/client.ts
|
|
10
|
+
/**
|
|
11
|
+
* Skinramp SDK client
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* const skinramp = new Skinramp('sk_development_...')
|
|
16
|
+
*
|
|
17
|
+
* // Create a payment
|
|
18
|
+
* const payment = await skinramp.payments.create('user_123')
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
var Skinramp = class {
|
|
22
|
+
convexHttp;
|
|
23
|
+
apiKey;
|
|
24
|
+
constructor(apiKey, apiUrl = "https://sync.skinramp.com") {
|
|
25
|
+
if (!apiKey) throw new Error("API key is required");
|
|
26
|
+
this.apiKey = apiKey;
|
|
27
|
+
this.convexHttp = new ConvexHttpClient(apiUrl);
|
|
28
|
+
}
|
|
29
|
+
payments = { create: async (data) => {
|
|
30
|
+
if (!this.apiKey) throw new Error("API key is required");
|
|
31
|
+
return await this.convexHttp.mutation(api.payments.createPayment, {
|
|
32
|
+
apiKey: this.apiKey,
|
|
33
|
+
amount: data.amount,
|
|
34
|
+
gameId: data.gameId,
|
|
35
|
+
metadata: data.metadata
|
|
36
|
+
});
|
|
37
|
+
} };
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
//#endregion
|
|
41
|
+
export { Skinramp, Skinramp as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@skinramp/ts-sdk",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "Skinramp TypeScript SDK",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"homepage": "https://docs.skinramp.com",
|
|
7
|
+
"author": "Skinramp <support@skinramp.com>",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.mjs",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.mjs",
|
|
12
|
+
"./package.json": "./package.json"
|
|
13
|
+
},
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsdown",
|
|
20
|
+
"dev": "tsdown --watch",
|
|
21
|
+
"prepublishOnly": "pnpm run build",
|
|
22
|
+
"test": "vitest",
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
24
|
+
},
|
|
25
|
+
"types": "./dist/index.d.mts",
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/bun": "^1.3.5",
|
|
28
|
+
"@types/node": "^25.0.3",
|
|
29
|
+
"bumpp": "^10.3.2",
|
|
30
|
+
"tsdown": "^0.18.3",
|
|
31
|
+
"typescript": "^5.9.3",
|
|
32
|
+
"vitest": "^4.0.16"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"convex": "^1.31.2"
|
|
36
|
+
}
|
|
37
|
+
}
|