@cardog/ocm-client 0.1.0

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.
@@ -0,0 +1,866 @@
1
+ /**
2
+ * Request and response types for OCM API endpoints
3
+ */
4
+ type DistanceUnit = "km" | "miles";
5
+ type OutputFormat = "json" | "xml" | "kml" | "geojson";
6
+ type SortOrder = "distance" | "id" | "relevance";
7
+ /**
8
+ * Parameters for POI search endpoint (GET /v4/poi)
9
+ */
10
+ interface POISearchParams {
11
+ latitude?: number;
12
+ longitude?: number;
13
+ distance?: number;
14
+ distanceunit?: DistanceUnit;
15
+ boundingbox?: string;
16
+ polyline?: string;
17
+ chargepointid?: number | number[];
18
+ countryid?: number | number[];
19
+ countrycode?: string;
20
+ operatorid?: number | number[];
21
+ connectiontypeid?: number | number[];
22
+ statustypeid?: number | number[];
23
+ usagetypeid?: number | number[];
24
+ levelid?: number | number[];
25
+ dataproviderid?: number | number[];
26
+ submissionstatustypeid?: number | number[];
27
+ minpowerkw?: number;
28
+ maxresults?: number;
29
+ modifiedsince?: string | Date;
30
+ output?: OutputFormat;
31
+ compact?: boolean;
32
+ verbose?: boolean;
33
+ camelcase?: boolean;
34
+ includecomments?: boolean;
35
+ client?: string;
36
+ }
37
+ /**
38
+ * Parameters for authentication endpoint
39
+ */
40
+ interface AuthenticateParams {
41
+ EmailAddress: string;
42
+ Password: string;
43
+ }
44
+ /**
45
+ * Response from authentication endpoint
46
+ */
47
+ interface AuthenticateResponse {
48
+ ID: number;
49
+ CurrentSessionToken: string;
50
+ APIKey?: string;
51
+ Username?: string;
52
+ EmailAddress?: string;
53
+ Profile?: {
54
+ ID: number;
55
+ Username?: string;
56
+ ProfileImageURL?: string;
57
+ ReputationPoints?: number;
58
+ };
59
+ }
60
+ /**
61
+ * Parameters for submitting a new POI
62
+ */
63
+ interface SubmitPOIParams {
64
+ AddressInfo: {
65
+ Title?: string;
66
+ AddressLine1?: string;
67
+ Town?: string;
68
+ StateOrProvince?: string;
69
+ Postcode?: string;
70
+ CountryID: number;
71
+ Latitude: number;
72
+ Longitude: number;
73
+ ContactTelephone1?: string;
74
+ ContactEmail?: string;
75
+ AccessComments?: string;
76
+ RelatedURL?: string;
77
+ };
78
+ Connections?: Array<{
79
+ ConnectionTypeID: number;
80
+ StatusTypeID?: number;
81
+ LevelID?: number;
82
+ Amps?: number;
83
+ Voltage?: number;
84
+ PowerKW?: number;
85
+ CurrentTypeID?: number;
86
+ Quantity?: number;
87
+ Comments?: string;
88
+ }>;
89
+ NumberOfPoints?: number;
90
+ OperatorID?: number;
91
+ UsageTypeID?: number;
92
+ StatusTypeID?: number;
93
+ GeneralComments?: string;
94
+ UsageCost?: string;
95
+ DataProvidersReference?: string;
96
+ }
97
+ /**
98
+ * Parameters for submitting a comment
99
+ */
100
+ interface SubmitCommentParams {
101
+ ChargePointID: number;
102
+ CommentTypeID?: number;
103
+ Comment?: string;
104
+ Rating?: number;
105
+ CheckinStatusTypeID?: number;
106
+ UserName?: string;
107
+ }
108
+ /**
109
+ * API error response
110
+ */
111
+ interface APIError {
112
+ status: number;
113
+ message: string;
114
+ code?: string;
115
+ }
116
+ /**
117
+ * GeoJSON Feature representation of a POI
118
+ */
119
+ interface POIGeoJSONFeature {
120
+ type: "Feature";
121
+ geometry: {
122
+ type: "Point";
123
+ coordinates: [number, number];
124
+ };
125
+ properties: {
126
+ ID: number;
127
+ Name?: string;
128
+ AddressLine1?: string;
129
+ Town?: string;
130
+ StateOrProvince?: string;
131
+ Postcode?: string;
132
+ Country?: string;
133
+ Operator?: string;
134
+ UsageCost?: string;
135
+ NumberOfPoints?: number;
136
+ StatusType?: string;
137
+ UsageType?: string;
138
+ Connections?: string;
139
+ [key: string]: unknown;
140
+ };
141
+ }
142
+ interface POIGeoJSONCollection {
143
+ type: "FeatureCollection";
144
+ features: POIGeoJSONFeature[];
145
+ }
146
+
147
+ /**
148
+ * Standard connection type IDs from Open Charge Map
149
+ *
150
+ * These values correspond to the ConnectionType reference data.
151
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L89
152
+ * @see https://openchargemap.org/site/develop/api - GET /v4/referencedata
153
+ */
154
+ declare enum StandardConnectionTypes {
155
+ /** Unknown or unspecified connector */
156
+ Unknown = 0,
157
+ /** SAE J1772 - Standard North American Level 1/2 connector */
158
+ J1772 = 1,
159
+ /** CHAdeMO - Japanese DC fast charging standard */
160
+ CHAdeMO = 2,
161
+ /** IEC 62196-2 Type 2 - European AC connector (Mennekes) */
162
+ Type2Mennekes = 25,
163
+ /** Type 2 socket outlet */
164
+ Type2Outlet = 28,
165
+ /** SAE J1772 Combo (CCS1) - North American DC fast charging */
166
+ CCSCombo1 = 32,
167
+ /** IEC 62196-3 Combo (CCS2) - European DC fast charging */
168
+ CCSCombo2 = 33,
169
+ /** Tesla proprietary connector (Roadster) */
170
+ Tesla = 27,
171
+ /** Tesla Supercharger connector */
172
+ TeslaSupercharger = 30,
173
+ /** NACS (North American Charging Standard) - Tesla's connector adopted as SAE J3400 */
174
+ NACS = 36,
175
+ /** Alias for CCSCombo1 */
176
+ Type1CCS = 32,
177
+ /** Alias for CCSCombo2 */
178
+ Type2CCS = 33
179
+ }
180
+ /**
181
+ * Standard status type IDs indicating operational state
182
+ *
183
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L71
184
+ */
185
+ declare enum StandardStatusTypes {
186
+ /** Status unknown or not specified */
187
+ Unknown = 0,
188
+ /** Station is operational and available for use */
189
+ CurrentlyAvailable = 50,
190
+ /** Alias for CurrentlyAvailable */
191
+ Operational = 50,
192
+ /** Station is not operational */
193
+ NotOperational = 100,
194
+ /** Station is planned for future installation */
195
+ PlannedForFuture = 150,
196
+ /** Station is temporarily unavailable (maintenance, etc.) */
197
+ TemporarilyUnavailable = 75,
198
+ /** Station has been removed/decommissioned */
199
+ Removed = 200
200
+ }
201
+ /**
202
+ * Standard usage type IDs indicating access restrictions
203
+ *
204
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L80
205
+ */
206
+ declare enum StandardUsageTypes {
207
+ /** Usage type unknown */
208
+ Unknown = 0,
209
+ /** Public access - no restrictions */
210
+ Public = 1,
211
+ /** Public access but membership/account required */
212
+ PublicMembershipRequired = 4,
213
+ /** Public access with payment at location */
214
+ PublicPayAtLocation = 5,
215
+ /** Public access but notice/call ahead required */
216
+ PublicNoticeRequired = 7,
217
+ /** Private - restricted access */
218
+ Private = 2,
219
+ /** Private - for staff and visitors only */
220
+ PrivateForStaffAndVisitors = 6,
221
+ /** Private residential */
222
+ PrivateResidential = 3
223
+ }
224
+ /**
225
+ * Standard current types for charging connections
226
+ *
227
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L62
228
+ */
229
+ declare enum StandardCurrentTypes {
230
+ /** Current type unknown */
231
+ Unknown = 0,
232
+ /** AC single phase */
233
+ AC_SinglePhase = 10,
234
+ /** AC three phase */
235
+ AC_ThreePhase = 20,
236
+ /** DC (Direct Current) */
237
+ DC = 30
238
+ }
239
+ /**
240
+ * Charging level IDs (ChargerType in OCM)
241
+ *
242
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L53
243
+ */
244
+ declare enum ChargingLevels {
245
+ /** Level 1 - Standard household outlet (slow) */
246
+ Level1 = 1,
247
+ /** Level 2 - Dedicated EVSE (medium speed) */
248
+ Level2 = 2,
249
+ /** Level 3 - DC Fast Charging (rapid) */
250
+ Level3_DCFastCharging = 3
251
+ }
252
+ /**
253
+ * Submission status types for POI data quality
254
+ *
255
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L98
256
+ */
257
+ declare enum StandardSubmissionStatusTypes {
258
+ /** Submitted and pending review */
259
+ Submitted_UnderReview = 1,
260
+ /** Imported from external source, unverified */
261
+ Imported_UnverifiedOrLowQuality = 100,
262
+ /** Imported and published */
263
+ Imported_Published = 200,
264
+ /** User submitted and published */
265
+ Submitted_Published = 1000
266
+ }
267
+
268
+ /**
269
+ * Reference data types from Open Charge Map
270
+ *
271
+ * These are lookup tables that should be cached locally as they rarely change.
272
+ * Fetch via GET /v4/referencedata
273
+ *
274
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs
275
+ */
276
+ /**
277
+ * Country reference data
278
+ *
279
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L17
280
+ */
281
+ interface Country {
282
+ ID: number;
283
+ Title: string;
284
+ /** ISO 3166-1 alpha-2 country code (e.g., "US", "GB", "CA") */
285
+ ISOCode: string;
286
+ /** Continent code (e.g., "NA", "EU", "AS") */
287
+ ContinentCode?: string;
288
+ }
289
+ /**
290
+ * Connection/plug type reference data
291
+ *
292
+ * Describes the physical connector type (J1772, CCS, CHAdeMO, etc.)
293
+ *
294
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/ConnectionType.cs
295
+ */
296
+ interface ConnectionType {
297
+ ID: number;
298
+ /** Display name (e.g., "CCS (Type 1)", "CHAdeMO") */
299
+ Title: string;
300
+ /** Official/formal name if different from Title */
301
+ FormalName?: string;
302
+ /** Whether this connector type is no longer in production */
303
+ IsDiscontinued?: boolean;
304
+ /** Whether this connector type is obsolete */
305
+ IsObsolete?: boolean;
306
+ }
307
+ /**
308
+ * Current type reference data (AC Single Phase, AC Three Phase, DC)
309
+ *
310
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CurrentType.cs
311
+ */
312
+ interface CurrentType {
313
+ ID: number;
314
+ Title: string;
315
+ Description?: string;
316
+ }
317
+ /**
318
+ * Charger type / charging level reference data
319
+ *
320
+ * Indicates the charging speed category (Level 1, 2, 3)
321
+ *
322
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/ChargerType.cs
323
+ */
324
+ interface ChargerType {
325
+ ID: number;
326
+ Title: string;
327
+ Comments?: string;
328
+ /** Whether this charger type supports fast charging (typically Level 3/DC) */
329
+ IsFastChargeCapable?: boolean;
330
+ }
331
+ /**
332
+ * Status type reference data
333
+ *
334
+ * Indicates operational status (Operational, Not Operational, Planned, etc.)
335
+ *
336
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/StatusType.cs
337
+ */
338
+ interface StatusType {
339
+ ID: number;
340
+ Title: string;
341
+ /** Whether this status indicates the station is operational */
342
+ IsOperational?: boolean;
343
+ /** Whether users can select this status when submitting */
344
+ IsUserSelectable?: boolean;
345
+ }
346
+ /**
347
+ * Usage type reference data
348
+ *
349
+ * Indicates access restrictions (Public, Private, Membership Required, etc.)
350
+ *
351
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/UsageType.cs
352
+ */
353
+ interface UsageType {
354
+ ID: number;
355
+ Title: string;
356
+ /** Whether payment is required at the location */
357
+ IsPayAtLocation?: boolean;
358
+ /** Whether membership/account is required */
359
+ IsMembershipRequired?: boolean;
360
+ /** Whether an access key/card is required */
361
+ IsAccessKeyRequired?: boolean;
362
+ }
363
+ /**
364
+ * Charging network operator information
365
+ *
366
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/OperatorInfo.cs
367
+ */
368
+ interface OperatorInfo {
369
+ ID: number;
370
+ /** Operator/network name (e.g., "ChargePoint", "Electrify America") */
371
+ Title: string;
372
+ WebsiteURL?: string;
373
+ Comments?: string;
374
+ PhonePrimaryContact?: string;
375
+ PhoneSecondaryContact?: string;
376
+ /** Whether this is a private individual rather than a company */
377
+ IsPrivateIndividual?: boolean;
378
+ AddressInfo?: AddressInfo;
379
+ BookingURL?: string;
380
+ ContactEmail?: string;
381
+ FaultReportEmail?: string;
382
+ /** Whether edits to this operator's stations are restricted */
383
+ IsRestrictedEdit?: boolean;
384
+ }
385
+ /**
386
+ * Data provider information
387
+ *
388
+ * Indicates the source of the POI data (government registry, network API, user submission, etc.)
389
+ *
390
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/DataProvider.cs
391
+ */
392
+ interface DataProviderInfo {
393
+ ID: number;
394
+ Title: string;
395
+ WebsiteURL?: string;
396
+ Comments?: string;
397
+ DataProviderStatusType?: DataProviderStatusType;
398
+ /** Whether edits to this provider's data are restricted */
399
+ IsRestrictedEdit?: boolean;
400
+ /** Whether data is under an open data license */
401
+ IsOpenDataLicensed?: boolean;
402
+ /** Whether this is an approved import source */
403
+ IsApprovedImport?: boolean;
404
+ License?: string;
405
+ DateLastImported?: string;
406
+ }
407
+ /**
408
+ * Data provider status
409
+ */
410
+ interface DataProviderStatusType {
411
+ ID: number;
412
+ Title: string;
413
+ IsProviderEnabled?: boolean;
414
+ }
415
+ /**
416
+ * Submission status type
417
+ *
418
+ * Indicates the review/quality status of POI data
419
+ *
420
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/SubmissionStatusType.cs
421
+ */
422
+ interface SubmissionStatusType {
423
+ ID: number;
424
+ Title: string;
425
+ /** Whether this status means the POI is publicly visible */
426
+ IsLive?: boolean;
427
+ }
428
+ /**
429
+ * Address/location information
430
+ *
431
+ * Used for both POI locations and operator addresses.
432
+ *
433
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/AddressInfo.cs
434
+ */
435
+ interface AddressInfo {
436
+ ID?: number;
437
+ /** Location name/title */
438
+ Title?: string;
439
+ AddressLine1?: string;
440
+ AddressLine2?: string;
441
+ Town?: string;
442
+ StateOrProvince?: string;
443
+ Postcode?: string;
444
+ Country?: Country;
445
+ CountryID?: number;
446
+ /** WGS84 latitude (-90 to 90) */
447
+ Latitude: number;
448
+ /** WGS84 longitude (-180 to 180) */
449
+ Longitude: number;
450
+ ContactTelephone1?: string;
451
+ ContactTelephone2?: string;
452
+ ContactEmail?: string;
453
+ /** Access instructions, hours, restrictions */
454
+ AccessComments?: string;
455
+ /** Related URL (location website, etc.) */
456
+ RelatedURL?: string;
457
+ /** Distance from search point (only in search results) */
458
+ Distance?: number;
459
+ /** Distance unit: 1 = km, 2 = miles */
460
+ DistanceUnit?: number;
461
+ }
462
+ /**
463
+ * Complete reference data response from GET /v4/referencedata
464
+ *
465
+ * Contains all lookup tables. Should be cached locally and refreshed periodically.
466
+ *
467
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/CoreReferenceData.cs#L107
468
+ */
469
+ interface CoreReferenceData {
470
+ ChargerTypes: ChargerType[];
471
+ ConnectionTypes: ConnectionType[];
472
+ CurrentTypes: CurrentType[];
473
+ Countries: Country[];
474
+ DataProviders: DataProviderInfo[];
475
+ Operators: OperatorInfo[];
476
+ StatusTypes: StatusType[];
477
+ UsageTypes: UsageType[];
478
+ SubmissionStatusTypes: SubmissionStatusType[];
479
+ UserCommentTypes?: UserCommentType[];
480
+ CheckinStatusTypes?: CheckinStatusType[];
481
+ }
482
+ /**
483
+ * User comment type reference data
484
+ */
485
+ interface UserCommentType {
486
+ ID: number;
487
+ Title: string;
488
+ }
489
+ /**
490
+ * Check-in status type reference data
491
+ */
492
+ interface CheckinStatusType {
493
+ ID: number;
494
+ Title: string;
495
+ /** Whether this is a positive check-in (successful charge) */
496
+ IsPositive?: boolean;
497
+ /** Whether this was an automated check-in */
498
+ IsAutomatedCheckin?: boolean;
499
+ }
500
+
501
+ /**
502
+ * Connection/plug information for a charging station
503
+ *
504
+ * Represents a single charging connector at a POI, including its type,
505
+ * power output, and availability status.
506
+ *
507
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/ConnectionInfo.cs
508
+ */
509
+ interface ConnectionInfo {
510
+ ID?: number;
511
+ /** Reference to ConnectionType.ID */
512
+ ConnectionTypeID?: number;
513
+ /** Expanded ConnectionType object (when verbose=true) */
514
+ ConnectionType?: ConnectionType;
515
+ /** Reference to StatusType.ID */
516
+ StatusTypeID?: number;
517
+ /** Expanded StatusType object */
518
+ StatusType?: StatusType;
519
+ /** Reference to ChargerType.ID (charging level) */
520
+ LevelID?: number;
521
+ /** Expanded ChargerType object */
522
+ Level?: ChargerType;
523
+ /** Maximum amperage */
524
+ Amps?: number;
525
+ /** Voltage */
526
+ Voltage?: number;
527
+ /** Power output in kilowatts */
528
+ PowerKW?: number;
529
+ /** Reference to CurrentType.ID (AC/DC) */
530
+ CurrentTypeID?: number;
531
+ /** Expanded CurrentType object */
532
+ CurrentType?: CurrentType;
533
+ /** Number of connectors of this type at this station */
534
+ Quantity?: number;
535
+ /** Additional notes about this connection */
536
+ Comments?: string;
537
+ }
538
+ /**
539
+ * User comment/check-in on a POI
540
+ *
541
+ * Represents user-submitted feedback including ratings, comments, and check-ins.
542
+ *
543
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/UserComment.cs
544
+ */
545
+ interface UserComment {
546
+ ID: number;
547
+ ChargePointID: number;
548
+ CommentTypeID?: number;
549
+ CommentType?: {
550
+ ID: number;
551
+ Title: string;
552
+ };
553
+ UserName?: string;
554
+ Comment?: string;
555
+ /** Rating from 1-5 */
556
+ Rating?: number;
557
+ RelatedURL?: string;
558
+ DateCreated: string;
559
+ User?: {
560
+ ID: number;
561
+ Username?: string;
562
+ ProfileImageURL?: string;
563
+ };
564
+ /** Reference to CheckinStatusType.ID */
565
+ CheckinStatusTypeID?: number;
566
+ CheckinStatusType?: {
567
+ ID: number;
568
+ Title: string;
569
+ IsPositive?: boolean;
570
+ };
571
+ /** Whether an editor has reviewed this comment */
572
+ IsActionedByEditor?: boolean;
573
+ }
574
+ /**
575
+ * Media item attached to a POI
576
+ *
577
+ * Photos or videos uploaded for a charging station.
578
+ *
579
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/MediaItem.cs
580
+ */
581
+ interface MediaItem {
582
+ ID: number;
583
+ ChargePointID: number;
584
+ /** Full URL to the media item */
585
+ ItemURL: string;
586
+ /** URL to thumbnail version */
587
+ ItemThumbnailURL?: string;
588
+ Comment?: string;
589
+ IsEnabled?: boolean;
590
+ IsVideo?: boolean;
591
+ IsFeaturedItem?: boolean;
592
+ IsExternalResource?: boolean;
593
+ User?: {
594
+ ID: number;
595
+ Username?: string;
596
+ };
597
+ DateCreated?: string;
598
+ }
599
+ /**
600
+ * Equipment information for a POI
601
+ */
602
+ interface EquipmentInfo {
603
+ ID?: number;
604
+ SupplyType?: {
605
+ ID: number;
606
+ Title: string;
607
+ };
608
+ SupplyTypeID?: number;
609
+ GroundingType?: {
610
+ ID: number;
611
+ Title: string;
612
+ };
613
+ GroundingTypeID?: number;
614
+ Comments?: string;
615
+ }
616
+ /**
617
+ * Main POI (Point of Interest) / ChargePoint entity
618
+ *
619
+ * This is the core entity returned by the GET /v4/poi endpoint.
620
+ * Represents a single charging location which may have multiple connections.
621
+ *
622
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/ChargePoint.cs
623
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Extended/ChargePoint.cs
624
+ */
625
+ interface ChargePoint {
626
+ /** Unique identifier for this POI */
627
+ ID: number;
628
+ /** UUID for this POI */
629
+ UUID?: string;
630
+ /**
631
+ * Address and geographic coordinates
632
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/AddressInfo.cs
633
+ */
634
+ AddressInfo: AddressInfo;
635
+ /**
636
+ * List of charging connections/plugs at this location
637
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/ConnectionInfo.cs
638
+ */
639
+ Connections?: ConnectionInfo[];
640
+ /** Total number of charging points/bays at this location */
641
+ NumberOfPoints?: number;
642
+ /** General comments about this location */
643
+ GeneralComments?: string;
644
+ /** Cost/pricing information (free-form text) */
645
+ UsageCost?: string;
646
+ /** Reference to OperatorInfo.ID */
647
+ OperatorID?: number;
648
+ /**
649
+ * Expanded operator information
650
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/OperatorInfo.cs
651
+ */
652
+ OperatorInfo?: OperatorInfo;
653
+ /** Reference to UsageType.ID */
654
+ UsageTypeID?: number;
655
+ /**
656
+ * Expanded usage type (Public, Private, etc.)
657
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/UsageType.cs
658
+ */
659
+ UsageType?: UsageType;
660
+ /** Reference to StatusType.ID */
661
+ StatusTypeID?: number;
662
+ /**
663
+ * Expanded status type (Operational, Not Operational, etc.)
664
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/StatusType.cs
665
+ */
666
+ StatusType?: StatusType;
667
+ /** Reference to DataProvider.ID */
668
+ DataProviderID?: number;
669
+ /**
670
+ * Data source information
671
+ * @see https://github.com/openchargemap/ocm-system/blob/master/API/OCM.Net/OCM.API.Model/Base/DataProvider.cs
672
+ */
673
+ DataProvider?: DataProviderInfo;
674
+ /** External reference ID from the data provider */
675
+ DataProvidersReference?: string;
676
+ /** Reference to SubmissionStatusType.ID */
677
+ SubmissionStatusTypeID?: number;
678
+ /** Submission/review status */
679
+ SubmissionStatus?: SubmissionStatusType;
680
+ /** User comments and check-ins (when includecomments=true) */
681
+ UserComments?: UserComment[];
682
+ /** Photos and videos */
683
+ MediaItems?: MediaItem[];
684
+ Equipment?: EquipmentInfo;
685
+ /** When this POI was first added to OCM */
686
+ DateCreated?: string;
687
+ /** When this POI was last confirmed accurate */
688
+ DateLastConfirmed?: string;
689
+ /** When the status was last updated */
690
+ DateLastStatusUpdate?: string;
691
+ /** When this POI was last verified by a user */
692
+ DateLastVerified?: string;
693
+ /** Planned opening date (for PlannedForFuture status) */
694
+ DatePlanned?: string;
695
+ /** Custom metadata key-value pairs */
696
+ MetadataValues?: MetadataValue[];
697
+ /** Whether this POI was recently verified */
698
+ IsRecentlyVerified?: boolean;
699
+ /** Similarity score when detecting duplicates */
700
+ PercentageSimilarity?: number;
701
+ }
702
+ /**
703
+ * Metadata key-value pair
704
+ */
705
+ interface MetadataValue {
706
+ ID: number;
707
+ MetadataFieldID: number;
708
+ MetadataFieldOptionID?: number;
709
+ ItemValue?: string;
710
+ }
711
+ /**
712
+ * Alias for ChargePoint
713
+ *
714
+ * OCM uses "POI" (Point of Interest) terminology in the API.
715
+ */
716
+ type POI = ChargePoint;
717
+ /**
718
+ * Search result with distance information
719
+ *
720
+ * When searching by location, AddressInfo includes Distance and DistanceUnit.
721
+ */
722
+ interface POISearchResult extends ChargePoint {
723
+ AddressInfo: AddressInfo & {
724
+ /** Distance from search coordinates */
725
+ Distance?: number;
726
+ /** Distance unit: 1 = km, 2 = miles */
727
+ DistanceUnit?: number;
728
+ };
729
+ }
730
+
731
+ interface OCMClientOptions {
732
+ /**
733
+ * API key for authentication (required)
734
+ * Get one at https://openchargemap.org
735
+ */
736
+ apiKey: string;
737
+ /**
738
+ * Base URL for the API
739
+ * @default "https://api.openchargemap.io"
740
+ */
741
+ baseUrl?: string;
742
+ /**
743
+ * API version
744
+ * @default "v4"
745
+ */
746
+ version?: string;
747
+ /**
748
+ * Custom fetch implementation (useful for testing or server-side usage)
749
+ */
750
+ fetch?: typeof fetch;
751
+ /**
752
+ * Default timeout in milliseconds
753
+ * @default 30000
754
+ */
755
+ timeout?: number;
756
+ /**
757
+ * User session token for authenticated requests
758
+ */
759
+ sessionToken?: string;
760
+ }
761
+ declare class OCMClient {
762
+ private apiKey;
763
+ private baseUrl;
764
+ private version;
765
+ private fetchFn;
766
+ private timeout;
767
+ private sessionToken?;
768
+ constructor(options: OCMClientOptions);
769
+ /**
770
+ * Build URL with query parameters
771
+ */
772
+ private buildUrl;
773
+ /**
774
+ * Make a request with proper headers and error handling
775
+ */
776
+ private request;
777
+ /**
778
+ * Search for charging stations
779
+ *
780
+ * @example
781
+ * ```ts
782
+ * // Nearby search
783
+ * const stations = await client.searchPOI({
784
+ * latitude: 37.7749,
785
+ * longitude: -122.4194,
786
+ * distance: 10,
787
+ * distanceunit: "km"
788
+ * });
789
+ *
790
+ * // Fast chargers only
791
+ * const fastChargers = await client.searchPOI({
792
+ * latitude: 37.7749,
793
+ * longitude: -122.4194,
794
+ * connectiontypeid: [32, 33], // CCS Combo
795
+ * minpowerkw: 50
796
+ * });
797
+ * ```
798
+ */
799
+ searchPOI(params?: POISearchParams): Promise<ChargePoint[]>;
800
+ /**
801
+ * Get a specific POI by ID
802
+ */
803
+ getPOI(id: number, verbose?: boolean): Promise<ChargePoint | null>;
804
+ /**
805
+ * Search POIs and return GeoJSON format
806
+ */
807
+ searchPOIGeoJSON(params: Omit<POISearchParams, "output">): Promise<POIGeoJSONCollection>;
808
+ /**
809
+ * Get POIs modified since a specific date
810
+ * Useful for syncing/caching
811
+ */
812
+ getPOIUpdates(since: Date, params?: Omit<POISearchParams, "modifiedsince">): Promise<ChargePoint[]>;
813
+ /**
814
+ * Get all reference data (lookup tables)
815
+ * Results should be cached locally
816
+ *
817
+ * @example
818
+ * ```ts
819
+ * const refData = await client.getReferenceData();
820
+ * console.log(refData.ConnectionTypes);
821
+ * console.log(refData.StatusTypes);
822
+ * ```
823
+ */
824
+ getReferenceData(): Promise<CoreReferenceData>;
825
+ /**
826
+ * Authenticate user and get session token
827
+ * Store the sessionToken for subsequent authenticated requests
828
+ */
829
+ authenticate(credentials: AuthenticateParams): Promise<AuthenticateResponse>;
830
+ /**
831
+ * Set session token for authenticated requests
832
+ */
833
+ setSessionToken(token: string): void;
834
+ /**
835
+ * Clear session token
836
+ */
837
+ clearSession(): void;
838
+ /**
839
+ * Submit a new POI
840
+ * Requires authentication
841
+ */
842
+ submitPOI(poi: SubmitPOIParams): Promise<{
843
+ ID: number;
844
+ }>;
845
+ /**
846
+ * Submit a comment/check-in on a POI
847
+ * Requires authentication
848
+ */
849
+ submitComment(comment: SubmitCommentParams): Promise<{
850
+ ID: number;
851
+ }>;
852
+ }
853
+ /**
854
+ * Custom error class for OCM API errors
855
+ */
856
+ declare class OCMAPIError extends Error {
857
+ status: number;
858
+ code?: string;
859
+ constructor(status: number, message: string);
860
+ }
861
+ /**
862
+ * Create an OCM client instance
863
+ */
864
+ declare function createOCMClient(options: OCMClientOptions): OCMClient;
865
+
866
+ export { type APIError, type AddressInfo, type AuthenticateParams, type AuthenticateResponse, type ChargePoint, type ChargerType, ChargingLevels, type CheckinStatusType, type ConnectionInfo, type ConnectionType, type CoreReferenceData, type Country, type CurrentType, type DataProviderInfo, type DataProviderStatusType, type DistanceUnit, type EquipmentInfo, type MediaItem, type MetadataValue, OCMAPIError, OCMClient, type OCMClientOptions, type OperatorInfo, type OutputFormat, type POI, type POIGeoJSONCollection, type POIGeoJSONFeature, type POISearchParams, type POISearchResult, type SortOrder, StandardConnectionTypes, StandardCurrentTypes, StandardStatusTypes, StandardSubmissionStatusTypes, StandardUsageTypes, type StatusType, type SubmissionStatusType, type SubmitCommentParams, type SubmitPOIParams, type UsageType, type UserComment, type UserCommentType, createOCMClient };