@xyz17711/company-profile 0.1.1 → 0.1.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 +7 -4
- package/dist/index.d.ts +9 -0
- package/dist/index.js +8 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,10 +25,13 @@ npm install @xyz17711/company-profile
|
|
|
25
25
|
```typescript
|
|
26
26
|
import { Client } from "@xyz17711/company-profile";
|
|
27
27
|
|
|
28
|
-
const client = new Client(
|
|
28
|
+
const client = new Client(); // talks to https://api.17711.xyz/registry/company-profile-service by default
|
|
29
29
|
// see the Methods table above for every available call and its request/response type
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
+
Pass another base URL (self-hosted instance, test server) as the first argument:
|
|
33
|
+
`new Client("https://my-host.example/registry/company-profile-service")`.
|
|
34
|
+
|
|
32
35
|
## Paying past the free quota
|
|
33
36
|
|
|
34
37
|
Every gated tool allows a small number of free calls per day; beyond that it returns a 402
|
|
@@ -38,7 +41,7 @@ network, and payee address attached:
|
|
|
38
41
|
```typescript
|
|
39
42
|
import { Client, PaymentRequiredError } from "@xyz17711/company-profile";
|
|
40
43
|
|
|
41
|
-
const client = new Client(
|
|
44
|
+
const client = new Client();
|
|
42
45
|
try {
|
|
43
46
|
await client.getProfile(/* ... */);
|
|
44
47
|
} catch (e) {
|
|
@@ -54,7 +57,7 @@ own environment/secrets manager, never a literal string in source code:
|
|
|
54
57
|
```typescript
|
|
55
58
|
import { Client } from "@xyz17711/company-profile";
|
|
56
59
|
|
|
57
|
-
const client = new Client(
|
|
60
|
+
const client = new Client({
|
|
58
61
|
x402PrivateKey: process.env.X402_PRIVATE_KEY,
|
|
59
62
|
x402ExpectedNetwork: "eip155:8453", // Base mainnet; use eip155:84532 for Base Sepolia testnet
|
|
60
63
|
x402MaxPaymentUsdc: 0.01, // refuse any single call above this
|
|
@@ -73,7 +76,7 @@ with that same key in this process.
|
|
|
73
76
|
import { Client } from "@xyz17711/company-profile";
|
|
74
77
|
import { CompanyProfileToolkit } from "@xyz17711/company-profile/langchain";
|
|
75
78
|
|
|
76
|
-
const client = new Client(
|
|
79
|
+
const client = new Client({ /* ...wallet options... */ });
|
|
77
80
|
const tools = new CompanyProfileToolkit(client).getTools();
|
|
78
81
|
```
|
|
79
82
|
|
package/dist/index.d.ts
CHANGED
|
@@ -68,8 +68,17 @@ export interface GetCompanyProfileRequest {
|
|
|
68
68
|
/** The oldest result you accept, in seconds. Omit it for the default (profiles up to 24 hours old); `0` forces a fresh read of the website. The response always says how old it is. */
|
|
69
69
|
max_age_seconds?: number | null;
|
|
70
70
|
}
|
|
71
|
+
/** Production base URL of this service; pass another to self-host or test. */
|
|
72
|
+
export declare const DEFAULT_BASE_URL = "https://api.17711.xyz/registry/company-profile-service";
|
|
71
73
|
/** Typed client for company-profile-service, e.g. `client.getProfile(...)`. */
|
|
72
74
|
export declare class Client extends BaseClient {
|
|
75
|
+
/**
|
|
76
|
+
* `new Client()` talks to the production service. Pass a base URL to target another
|
|
77
|
+
* instance, and/or wallet options (`new Client({ x402PrivateKey, ... })`) to pay past the
|
|
78
|
+
* free quota automatically.
|
|
79
|
+
*/
|
|
80
|
+
constructor(options?: ClientOptions);
|
|
81
|
+
constructor(baseUrl?: string, options?: ClientOptions);
|
|
73
82
|
/** Company profile and enrichment from a domain or a name: offering, public contacts, social links and WHOIS domain data as valid JSON ($0.009, x402) */
|
|
74
83
|
getProfile(request: GetCompanyProfileRequest): Promise<GetCompanyProfileResponse>;
|
|
75
84
|
}
|
package/dist/index.js
CHANGED
|
@@ -2,8 +2,16 @@
|
|
|
2
2
|
* Typed HTTP client and request/response interfaces for company-profile-service.
|
|
3
3
|
*/
|
|
4
4
|
import { Client as BaseClient } from "@xyz17711/core";
|
|
5
|
+
/** Production base URL of this service; pass another to self-host or test. */
|
|
6
|
+
export const DEFAULT_BASE_URL = "https://api.17711.xyz/registry/company-profile-service";
|
|
5
7
|
/** Typed client for company-profile-service, e.g. `client.getProfile(...)`. */
|
|
6
8
|
export class Client extends BaseClient {
|
|
9
|
+
constructor(baseUrlOrOptions, options = {}) {
|
|
10
|
+
const [url, opts] = typeof baseUrlOrOptions === "object"
|
|
11
|
+
? [DEFAULT_BASE_URL, baseUrlOrOptions]
|
|
12
|
+
: [baseUrlOrOptions ?? DEFAULT_BASE_URL, options];
|
|
13
|
+
super(url, opts);
|
|
14
|
+
}
|
|
7
15
|
/** Company profile and enrichment from a domain or a name: offering, public contacts, social links and WHOIS domain data as valid JSON ($0.009, x402) */
|
|
8
16
|
async getProfile(request) {
|
|
9
17
|
return this.post("/v1/company-profile/get_profile", request);
|
package/package.json
CHANGED