apogeoapi 1.0.0 → 1.0.1
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/CHANGELOG.md +9 -2
- package/EXAMPLES.md +17 -17
- package/README.md +532 -532
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/utils/http-client.js +2 -2
- package/dist/utils/http-client.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
All notable changes to the
|
|
3
|
+
All notable changes to the apogeoapi will be documented in this file.
|
|
4
4
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
@@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
8
8
|
## [1.0.0] - 2024-01-15
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
|
-
- Initial release of
|
|
11
|
+
- Initial release of apogeoapi
|
|
12
12
|
- Full TypeScript support with complete type definitions
|
|
13
13
|
- **AuthClient** - Authentication (register, login, refresh token)
|
|
14
14
|
- **GeoClient** - Geography data (countries, states, cities, search)
|
|
@@ -40,6 +40,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
40
40
|
- Error handling patterns
|
|
41
41
|
- Production best practices
|
|
42
42
|
|
|
43
|
+
## [1.0.1] - 2026-04-05
|
|
44
|
+
|
|
45
|
+
### Fixed
|
|
46
|
+
- Renamed package from `@geo-api/sdk` to `apogeoapi` across all documentation and source files
|
|
47
|
+
- Updated default base URL from placeholder `yourcompany.com` to `https://api.apogeoapi.com/v1`
|
|
48
|
+
- Updated `User-Agent` header to `apogeoapi/1.0.1`
|
|
49
|
+
|
|
43
50
|
## [Unreleased]
|
|
44
51
|
|
|
45
52
|
### Planned
|
package/EXAMPLES.md
CHANGED
|
@@ -21,13 +21,13 @@ Complete examples demonstrating how to use the Geo API SDK.
|
|
|
21
21
|
### Node.js / Express Application
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import { GeoAPI } from '
|
|
24
|
+
import { GeoAPI } from 'apogeoapi';
|
|
25
25
|
import express from 'express';
|
|
26
26
|
|
|
27
27
|
const app = express();
|
|
28
28
|
const client = new GeoAPI({
|
|
29
29
|
apiKey: process.env.GEO_API_KEY!,
|
|
30
|
-
baseURL: process.env.GEO_API_URL || 'https://api.
|
|
30
|
+
baseURL: process.env.GEO_API_URL || 'https://api.apogeoapi.com/v1',
|
|
31
31
|
timeout: 30000,
|
|
32
32
|
retries: 3
|
|
33
33
|
});
|
|
@@ -48,7 +48,7 @@ app.listen(3000);
|
|
|
48
48
|
|
|
49
49
|
```typescript
|
|
50
50
|
// pages/api/countries.ts
|
|
51
|
-
import { GeoAPI } from '
|
|
51
|
+
import { GeoAPI } from 'apogeoapi';
|
|
52
52
|
import type { NextApiRequest, NextApiResponse } from 'next';
|
|
53
53
|
|
|
54
54
|
const client = new GeoAPI({
|
|
@@ -74,7 +74,7 @@ export default async function handler(
|
|
|
74
74
|
|
|
75
75
|
```typescript
|
|
76
76
|
// hooks/useGeoAPI.ts
|
|
77
|
-
import { GeoAPI } from '
|
|
77
|
+
import { GeoAPI } from 'apogeoapi';
|
|
78
78
|
import { useState, useEffect } from 'react';
|
|
79
79
|
|
|
80
80
|
const client = new GeoAPI({
|
|
@@ -120,7 +120,7 @@ function CountriesList() {
|
|
|
120
120
|
### Complete Registration & Login Flow
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
|
-
import { GeoAPI, GeoAPIError } from '
|
|
123
|
+
import { GeoAPI, GeoAPIError } from 'apogeoapi';
|
|
124
124
|
|
|
125
125
|
// Initialize without auth (for registration)
|
|
126
126
|
const publicClient = new GeoAPI({
|
|
@@ -193,7 +193,7 @@ async function refreshAuthToken(refreshToken: string) {
|
|
|
193
193
|
### Building a Location Selector
|
|
194
194
|
|
|
195
195
|
```typescript
|
|
196
|
-
import { GeoAPI, Country, State, City } from '
|
|
196
|
+
import { GeoAPI, Country, State, City } from 'apogeoapi';
|
|
197
197
|
|
|
198
198
|
const client = new GeoAPI({ apiKey: process.env.GEO_API_KEY! });
|
|
199
199
|
|
|
@@ -241,7 +241,7 @@ console.log(results); // { countries: [...], states: [...], cities: [...] }
|
|
|
241
241
|
### Caching Geography Data
|
|
242
242
|
|
|
243
243
|
```typescript
|
|
244
|
-
import { GeoAPI, Country } from '
|
|
244
|
+
import { GeoAPI, Country } from 'apogeoapi';
|
|
245
245
|
|
|
246
246
|
class CachedGeoClient {
|
|
247
247
|
private cache = new Map<string, any>();
|
|
@@ -295,7 +295,7 @@ const countriesAgain = await cachedClient.getCountries(); // Returns from cache
|
|
|
295
295
|
### Usage Monitoring Dashboard
|
|
296
296
|
|
|
297
297
|
```typescript
|
|
298
|
-
import { GeoAPI } from '
|
|
298
|
+
import { GeoAPI } from 'apogeoapi';
|
|
299
299
|
|
|
300
300
|
const client = new GeoAPI({ apiKey: 'xxx' });
|
|
301
301
|
|
|
@@ -345,7 +345,7 @@ buildDashboard();
|
|
|
345
345
|
### Rotating API Keys
|
|
346
346
|
|
|
347
347
|
```typescript
|
|
348
|
-
import { GeoAPI } from '
|
|
348
|
+
import { GeoAPI } from 'apogeoapi';
|
|
349
349
|
|
|
350
350
|
const client = new GeoAPI({ token: 'user_jwt_token' });
|
|
351
351
|
|
|
@@ -390,7 +390,7 @@ function waitForEnter(): Promise<void> {
|
|
|
390
390
|
### Complete Upgrade Flow
|
|
391
391
|
|
|
392
392
|
```typescript
|
|
393
|
-
import { GeoAPI } from '
|
|
393
|
+
import { GeoAPI } from 'apogeoapi';
|
|
394
394
|
|
|
395
395
|
const client = new GeoAPI({ token: 'user_jwt_token' });
|
|
396
396
|
|
|
@@ -428,7 +428,7 @@ async function upgradeSubscription() {
|
|
|
428
428
|
### Complete Webhook Implementation
|
|
429
429
|
|
|
430
430
|
```typescript
|
|
431
|
-
import { GeoAPI } from '
|
|
431
|
+
import { GeoAPI } from 'apogeoapi';
|
|
432
432
|
import express from 'express';
|
|
433
433
|
import crypto from 'crypto';
|
|
434
434
|
|
|
@@ -528,7 +528,7 @@ async function testWebhook(webhookId: string) {
|
|
|
528
528
|
### Comprehensive Error Handler
|
|
529
529
|
|
|
530
530
|
```typescript
|
|
531
|
-
import { GeoAPI, GeoAPIError } from '
|
|
531
|
+
import { GeoAPI, GeoAPIError } from 'apogeoapi';
|
|
532
532
|
|
|
533
533
|
const client = new GeoAPI({ apiKey: 'xxx' });
|
|
534
534
|
|
|
@@ -594,7 +594,7 @@ const countries = await robustApiCall(() => client.geo.getCountries());
|
|
|
594
594
|
|
|
595
595
|
```typescript
|
|
596
596
|
// lib/geo-client.ts
|
|
597
|
-
import { GeoAPI } from '
|
|
597
|
+
import { GeoAPI } from 'apogeoapi';
|
|
598
598
|
|
|
599
599
|
let clientInstance: GeoAPI | null = null;
|
|
600
600
|
|
|
@@ -627,7 +627,7 @@ const countries = await client.geo.getCountries();
|
|
|
627
627
|
|
|
628
628
|
```typescript
|
|
629
629
|
// config/geo-api.config.ts
|
|
630
|
-
import { SDKConfig } from '
|
|
630
|
+
import { SDKConfig } from 'apogeoapi';
|
|
631
631
|
|
|
632
632
|
const configs: Record<string, SDKConfig> = {
|
|
633
633
|
development: {
|
|
@@ -640,7 +640,7 @@ const configs: Record<string, SDKConfig> = {
|
|
|
640
640
|
|
|
641
641
|
staging: {
|
|
642
642
|
apiKey: process.env.STAGING_GEO_API_KEY!,
|
|
643
|
-
baseURL: 'https://staging-api.
|
|
643
|
+
baseURL: 'https://staging-api.apogeoapi.com/v1',
|
|
644
644
|
timeout: 30000,
|
|
645
645
|
retries: 3,
|
|
646
646
|
debug: false
|
|
@@ -648,7 +648,7 @@ const configs: Record<string, SDKConfig> = {
|
|
|
648
648
|
|
|
649
649
|
production: {
|
|
650
650
|
apiKey: process.env.PROD_GEO_API_KEY!,
|
|
651
|
-
baseURL: 'https://api.
|
|
651
|
+
baseURL: 'https://api.apogeoapi.com/v1',
|
|
652
652
|
timeout: 30000,
|
|
653
653
|
retries: 3,
|
|
654
654
|
debug: false
|
|
@@ -663,4 +663,4 @@ export function getConfig(): SDKConfig {
|
|
|
663
663
|
|
|
664
664
|
---
|
|
665
665
|
|
|
666
|
-
**For more examples, see the [full documentation](https://api.
|
|
666
|
+
**For more examples, see the [full documentation](https://api.apogeoapi.com/api/docs).**
|