@maxim_mazurok/gapi.client.solar-v1 0.0.20240327
Sign up to get free protection for your applications and to get access to all the features.
- package/index.d.ts +383 -0
- package/package.json +20 -0
- package/readme.md +86 -0
package/index.d.ts
ADDED
@@ -0,0 +1,383 @@
|
|
1
|
+
/* Type definitions for non-npm package Solar API v1 0.0 */
|
2
|
+
// Project: https://developers.google.com/maps/documentation/solar
|
3
|
+
// Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
|
4
|
+
// Nick Amoscato <https://github.com/namoscato>
|
5
|
+
// Declan Vong <https://github.com/declanvong>
|
6
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
7
|
+
|
8
|
+
// IMPORTANT
|
9
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
10
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
11
|
+
// Generated from: https://solar.googleapis.com/$discovery/rest?version=v1
|
12
|
+
// Revision: 20240327
|
13
|
+
|
14
|
+
/// <reference types="gapi.client" />
|
15
|
+
|
16
|
+
declare namespace gapi.client {
|
17
|
+
/** Load Solar API v1 */
|
18
|
+
function load(
|
19
|
+
urlOrObject: 'https://solar.googleapis.com/$discovery/rest?version=v1'
|
20
|
+
): Promise<void>;
|
21
|
+
/** @deprecated Please load APIs with discovery documents. */
|
22
|
+
function load(name: 'solar', version: 'v1'): Promise<void>;
|
23
|
+
/** @deprecated Please load APIs with discovery documents. */
|
24
|
+
function load(name: 'solar', version: 'v1', callback: () => any): void;
|
25
|
+
|
26
|
+
namespace solar {
|
27
|
+
interface BuildingInsights {
|
28
|
+
/** Administrative area 1 (e.g., in the US, the state) that contains this building. For example, in the US, the abbreviation might be "MA" or "CA." */
|
29
|
+
administrativeArea?: string;
|
30
|
+
/** The bounding box of the building. */
|
31
|
+
boundingBox?: LatLngBox;
|
32
|
+
/** A point near the center of the building. */
|
33
|
+
center?: LatLng;
|
34
|
+
/** Date that the underlying imagery was acquired. This is approximate. */
|
35
|
+
imageryDate?: Date;
|
36
|
+
/** When processing was completed on this imagery. */
|
37
|
+
imageryProcessedDate?: Date;
|
38
|
+
/** The quality of the imagery used to compute the data for this building. */
|
39
|
+
imageryQuality?: string;
|
40
|
+
/** The resource name for the building, of the format `building/`. */
|
41
|
+
name?: string;
|
42
|
+
/** Postal code (e.g., US zip code) this building is contained by. */
|
43
|
+
postalCode?: string;
|
44
|
+
/** Region code for the country (or region) this building is in. */
|
45
|
+
regionCode?: string;
|
46
|
+
/** Solar potential of the building. */
|
47
|
+
solarPotential?: SolarPotential;
|
48
|
+
/** Statistical area (e.g., US census tract) this building is in. */
|
49
|
+
statisticalArea?: string;
|
50
|
+
}
|
51
|
+
interface CashPurchaseSavings {
|
52
|
+
/** Initial cost before tax incentives: the amount that must be paid out-of-pocket. Contrast with `upfront_cost`, which is after tax incentives. */
|
53
|
+
outOfPocketCost?: Money;
|
54
|
+
/** Number of years until payback occurs. A negative value means payback never occurs within the lifetime period. */
|
55
|
+
paybackYears?: number;
|
56
|
+
/** The value of all tax rebates. */
|
57
|
+
rebateValue?: Money;
|
58
|
+
/** How much is saved (or not) over the lifetime period. */
|
59
|
+
savings?: SavingsOverTime;
|
60
|
+
/** Initial cost after tax incentives: it's the amount that must be paid during first year. Contrast with `out_of_pocket_cost`, which is before tax incentives. */
|
61
|
+
upfrontCost?: Money;
|
62
|
+
}
|
63
|
+
interface DataLayers {
|
64
|
+
/** The URL for the annual flux map (annual sunlight on roofs) of the region. Values are kWh/kW/year. This is *unmasked flux*: flux is computed for every location, not just building rooftops. Invalid locations are stored as -9999: locations outside our coverage area will be invalid, and a few locations inside the coverage area, where we were unable to calculate flux, will also be invalid. */
|
65
|
+
annualFluxUrl?: string;
|
66
|
+
/** The URL for an image of the DSM (Digital Surface Model) of the region. Values are in meters above EGM96 geoid (i.e., sea level). Invalid locations (where we don't have data) are stored as -9999. */
|
67
|
+
dsmUrl?: string;
|
68
|
+
/** Twelve URLs for hourly shade, corresponding to January...December, in order. Each GeoTIFF will contain 24 bands, corresponding to the 24 hours of the day. Each pixel is a 32 bit integer, corresponding to the (up to) 31 days of that month; a 1 bit means that the corresponding location is able to see the sun at that day, of that hour, of that month. Invalid locations are stored as -9999 (since this is negative, it has bit 31 set, and no valid value could have bit 31 set as that would correspond to the 32nd day of the month). An example may be useful. If you want to know whether a point (at pixel location (x, y)) saw sun at 4pm on the 22nd of June you would: 1. fetch the sixth URL in this list (corresponding to June). 1. look up the 17th channel (corresponding to 4pm). 1. read the 32-bit value at (x, y). 1. read bit 21 of the value (corresponding to the 22nd of the month). 1. if that bit is a 1, then that spot saw the sun at 4pm 22 June. More formally: Given `month` (1-12), `day` (1...month max; February has 28 days) and `hour` (0-23), the shade/sun for that month/day/hour at a position `(x, y)` is the bit ``` (hourly_shade[month - 1])(x, y)[hour] & (1 << (day - 1)) ``` where `(x, y)` is spatial indexing, `[month - 1]` refers to fetching the `month - 1`st URL (indexing from zero), `[hour]` is indexing into the channels, and a final non-zero result means "sunny". There are no leap days, and DST doesn't exist (all days are 24 hours long; noon is always "standard time" noon). */
|
69
|
+
hourlyShadeUrls?: string[];
|
70
|
+
/** When the source imagery (from which all the other data are derived) in this region was taken. It is necessarily somewhat approximate, as the images may have been taken over more than one day. */
|
71
|
+
imageryDate?: Date;
|
72
|
+
/** When processing was completed on this imagery. */
|
73
|
+
imageryProcessedDate?: Date;
|
74
|
+
/** The quality of the result's imagery. */
|
75
|
+
imageryQuality?: string;
|
76
|
+
/** The URL for the building mask image: one bit per pixel saying whether that pixel is considered to be part of a rooftop or not. */
|
77
|
+
maskUrl?: string;
|
78
|
+
/** The URL for the monthly flux map (sunlight on roofs, broken down by month) of the region. Values are kWh/kW/year. The GeoTIFF pointed to by this URL will contain twelve bands, corresponding to January...December, in order. */
|
79
|
+
monthlyFluxUrl?: string;
|
80
|
+
/** The URL for an image of RGB data (aerial photo) of the region. */
|
81
|
+
rgbUrl?: string;
|
82
|
+
}
|
83
|
+
interface Date {
|
84
|
+
/** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
|
85
|
+
day?: number;
|
86
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
87
|
+
month?: number;
|
88
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
89
|
+
year?: number;
|
90
|
+
}
|
91
|
+
interface FinancedPurchaseSavings {
|
92
|
+
/** Annual loan payments. */
|
93
|
+
annualLoanPayment?: Money;
|
94
|
+
/** The interest rate on loans assumed in this set of calculations. */
|
95
|
+
loanInterestRate?: number;
|
96
|
+
/** The value of all tax rebates (including Federal Investment Tax Credit (ITC)). */
|
97
|
+
rebateValue?: Money;
|
98
|
+
/** How much is saved (or not) over the lifetime period. */
|
99
|
+
savings?: SavingsOverTime;
|
100
|
+
}
|
101
|
+
interface FinancialAnalysis {
|
102
|
+
/** How much electricity the house uses in an average month, based on the bill size and the local electricity rates. */
|
103
|
+
averageKwhPerMonth?: number;
|
104
|
+
/** Cost and benefit of buying the solar panels with cash. */
|
105
|
+
cashPurchaseSavings?: CashPurchaseSavings;
|
106
|
+
/** Whether this is the bill size selected to be the default bill for the area this building is in. Exactly one `FinancialAnalysis` in `BuildingSolarPotential` should have `default_bill` set. */
|
107
|
+
defaultBill?: boolean;
|
108
|
+
/** Cost and benefit of buying the solar panels by financing the purchase. */
|
109
|
+
financedPurchaseSavings?: FinancedPurchaseSavings;
|
110
|
+
/** Financial information that applies regardless of the financing method used. */
|
111
|
+
financialDetails?: FinancialDetails;
|
112
|
+
/** Cost and benefit of leasing the solar panels. */
|
113
|
+
leasingSavings?: LeasingSavings;
|
114
|
+
/** The monthly electric bill this analysis assumes. */
|
115
|
+
monthlyBill?: Money;
|
116
|
+
/** Index in solar_panel_configs of the optimum solar layout for this bill size. This can be -1 indicating that there is no layout. In this case, the remaining submessages will be omitted. */
|
117
|
+
panelConfigIndex?: number;
|
118
|
+
}
|
119
|
+
interface FinancialDetails {
|
120
|
+
/** Total cost of electricity the user would have paid over the lifetime period if they didn't install solar. */
|
121
|
+
costOfElectricityWithoutSolar?: Money;
|
122
|
+
/** Amount of money available from federal incentives; this applies if the user buys (with or without a loan) the panels. */
|
123
|
+
federalIncentive?: Money;
|
124
|
+
/** How many AC kWh we think the solar panels will generate in their first year. */
|
125
|
+
initialAcKwhPerYear?: number;
|
126
|
+
/** Amount of money the user will receive from Solar Renewable Energy Credits over the panel lifetime; this applies if the user buys (with or without a loan) the panels. */
|
127
|
+
lifetimeSrecTotal?: Money;
|
128
|
+
/** Whether net metering is allowed. */
|
129
|
+
netMeteringAllowed?: boolean;
|
130
|
+
/** The percentage (0-100) of solar electricity production we assumed was exported to the grid, based on the first quarter of production. This affects the calculations if net metering is not allowed. */
|
131
|
+
percentageExportedToGrid?: number;
|
132
|
+
/** Utility bill for electricity not produced by solar, for the lifetime of the panels. */
|
133
|
+
remainingLifetimeUtilityBill?: Money;
|
134
|
+
/** Percentage (0-100) of the user's power supplied by solar. Valid for the first year but approximately correct for future years. */
|
135
|
+
solarPercentage?: number;
|
136
|
+
/** Amount of money available from state incentives; this applies if the user buys (with or without a loan) the panels. */
|
137
|
+
stateIncentive?: Money;
|
138
|
+
/** Amount of money available from utility incentives; this applies if the user buys (with or without a loan) the panels. */
|
139
|
+
utilityIncentive?: Money;
|
140
|
+
}
|
141
|
+
interface HttpBody {
|
142
|
+
/** The HTTP Content-Type header value specifying the content type of the body. */
|
143
|
+
contentType?: string;
|
144
|
+
/** The HTTP request/response body as raw binary. */
|
145
|
+
data?: string;
|
146
|
+
/** Application specific response metadata. Must be set in the first response for streaming APIs. */
|
147
|
+
extensions?: Array<{[P in string]: any}>;
|
148
|
+
}
|
149
|
+
interface LatLng {
|
150
|
+
/** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
|
151
|
+
latitude?: number;
|
152
|
+
/** The longitude in degrees. It must be in the range [-180.0, +180.0]. */
|
153
|
+
longitude?: number;
|
154
|
+
}
|
155
|
+
interface LatLngBox {
|
156
|
+
/** The northeast corner of the box. */
|
157
|
+
ne?: LatLng;
|
158
|
+
/** The southwest corner of the box. */
|
159
|
+
sw?: LatLng;
|
160
|
+
}
|
161
|
+
interface LeasingSavings {
|
162
|
+
/** Estimated annual leasing cost. */
|
163
|
+
annualLeasingCost?: Money;
|
164
|
+
/** Whether leases are allowed in this juristiction (leases are not allowed in some states). If this field is false, then the values in this message should probably be ignored. */
|
165
|
+
leasesAllowed?: boolean;
|
166
|
+
/** Whether leases are supported in this juristiction by the financial calculation engine. If this field is false, then the values in this message should probably be ignored. This is independent of `leases_allowed`: in some areas leases are allowed, but under conditions that aren't handled by the financial models. */
|
167
|
+
leasesSupported?: boolean;
|
168
|
+
/** How much is saved (or not) over the lifetime period. */
|
169
|
+
savings?: SavingsOverTime;
|
170
|
+
}
|
171
|
+
interface Money {
|
172
|
+
/** The three-letter currency code defined in ISO 4217. */
|
173
|
+
currencyCode?: string;
|
174
|
+
/** Number of nano (10^-9) units of the amount. The value must be between -999,999,999 and +999,999,999 inclusive. If `units` is positive, `nanos` must be positive or zero. If `units` is zero, `nanos` can be positive, zero, or negative. If `units` is negative, `nanos` must be negative or zero. For example $-1.75 is represented as `units`=-1 and `nanos`=-750,000,000. */
|
175
|
+
nanos?: number;
|
176
|
+
/** The whole units of the amount. For example if `currencyCode` is `"USD"`, then 1 unit is one US dollar. */
|
177
|
+
units?: string;
|
178
|
+
}
|
179
|
+
interface RoofSegmentSizeAndSunshineStats {
|
180
|
+
/** Compass direction the roof segment is pointing in. 0 = North, 90 = East, 180 = South. For a "flat" roof segment (`pitch_degrees` very near 0), azimuth is not well defined, so for consistency, we define it arbitrarily to be 0 (North). */
|
181
|
+
azimuthDegrees?: number;
|
182
|
+
/** The bounding box of the roof segment. */
|
183
|
+
boundingBox?: LatLngBox;
|
184
|
+
/** A point near the center of the roof segment. */
|
185
|
+
center?: LatLng;
|
186
|
+
/** Angle of the roof segment relative to the theoretical ground plane. 0 = parallel to the ground, 90 = perpendicular to the ground. */
|
187
|
+
pitchDegrees?: number;
|
188
|
+
/** The height of the roof segment plane, in meters above sea level, at the point designated by `center`. Together with the pitch, azimuth, and center location, this fully defines the roof segment plane. */
|
189
|
+
planeHeightAtCenterMeters?: number;
|
190
|
+
/** Total size and sunlight quantiles for the roof segment. */
|
191
|
+
stats?: SizeAndSunshineStats;
|
192
|
+
}
|
193
|
+
interface RoofSegmentSummary {
|
194
|
+
/** Compass direction the roof segment is pointing in. 0 = North, 90 = East, 180 = South. For a "flat" roof segment (`pitch_degrees` very near 0), azimuth is not well defined, so for consistency, we define it arbitrarily to be 0 (North). */
|
195
|
+
azimuthDegrees?: number;
|
196
|
+
/** The total number of panels on this segment. */
|
197
|
+
panelsCount?: number;
|
198
|
+
/** Angle of the roof segment relative to the theoretical ground plane. 0 = parallel to the ground, 90 = perpendicular to the ground. */
|
199
|
+
pitchDegrees?: number;
|
200
|
+
/** Index in roof_segment_stats of the corresponding `RoofSegmentSizeAndSunshineStats`. */
|
201
|
+
segmentIndex?: number;
|
202
|
+
/** How much sunlight energy this part of the layout captures over the course of a year, in DC kWh, assuming the panels described above. */
|
203
|
+
yearlyEnergyDcKwh?: number;
|
204
|
+
}
|
205
|
+
interface SavingsOverTime {
|
206
|
+
/** Indicates whether this scenario is financially viable. Will be false for scenarios with poor financial viability (e.g., money-losing). */
|
207
|
+
financiallyViable?: boolean;
|
208
|
+
/** Using the assumed discount rate, what is the present value of the cumulative lifetime savings? */
|
209
|
+
presentValueOfSavingsLifetime?: Money;
|
210
|
+
/** Using the assumed discount rate, what is the present value of the cumulative 20-year savings? */
|
211
|
+
presentValueOfSavingsYear20?: Money;
|
212
|
+
/** Savings in the entire panel lifetime. */
|
213
|
+
savingsLifetime?: Money;
|
214
|
+
/** Savings in the first year after panel installation. */
|
215
|
+
savingsYear1?: Money;
|
216
|
+
/** Savings in the first twenty years after panel installation. */
|
217
|
+
savingsYear20?: Money;
|
218
|
+
}
|
219
|
+
interface SizeAndSunshineStats {
|
220
|
+
/** The area of the roof or roof segment, in m^2. This is the roof area (accounting for tilt), not the ground footprint area. */
|
221
|
+
areaMeters2?: number;
|
222
|
+
/** The ground footprint area covered by the roof or roof segment, in m^2. */
|
223
|
+
groundAreaMeters2?: number;
|
224
|
+
/** Quantiles of the pointwise sunniness across the area. If there are N values here, this represents the (N-1)-iles. For example, if there are 5 values, then they would be the quartiles (min, 25%, 50%, 75%, max). Values are in annual kWh/kW like max_sunshine_hours_per_year. */
|
225
|
+
sunshineQuantiles?: number[];
|
226
|
+
}
|
227
|
+
interface SolarPanel {
|
228
|
+
/** The centre of the panel. */
|
229
|
+
center?: LatLng;
|
230
|
+
/** The orientation of the panel. */
|
231
|
+
orientation?: string;
|
232
|
+
/** Index in roof_segment_stats of the `RoofSegmentSizeAndSunshineStats` which corresponds to the roof segment that this panel is placed on. */
|
233
|
+
segmentIndex?: number;
|
234
|
+
/** How much sunlight energy this layout captures over the course of a year, in DC kWh. */
|
235
|
+
yearlyEnergyDcKwh?: number;
|
236
|
+
}
|
237
|
+
interface SolarPanelConfig {
|
238
|
+
/** Total number of panels. Note that this is redundant to (the sum of) the corresponding fields in roof_segment_summaries. */
|
239
|
+
panelsCount?: number;
|
240
|
+
/** Information about the production of each roof segment that is carrying at least one panel in this layout. `roof_segment_summaries[i]` describes the i-th roof segment, including its size, expected production and orientation. */
|
241
|
+
roofSegmentSummaries?: RoofSegmentSummary[];
|
242
|
+
/** How much sunlight energy this layout captures over the course of a year, in DC kWh, assuming the panels described above. */
|
243
|
+
yearlyEnergyDcKwh?: number;
|
244
|
+
}
|
245
|
+
interface SolarPotential {
|
246
|
+
/** Size and sunlight quantiles for the entire building, including parts of the roof that were not assigned to some roof segment. Because the orientations of these parts are not well characterised, the roof area estimate is unreliable, but the ground area estimate is reliable. It may be that a more reliable whole building roof area can be obtained by scaling the roof area from whole_roof_stats by the ratio of the ground areas of `building_stats` and `whole_roof_stats`. */
|
247
|
+
buildingStats?: SizeAndSunshineStats;
|
248
|
+
/** Equivalent amount of CO2 produced per MWh of grid electricity. This is a measure of the carbon intensity of grid electricity displaced by solar electricity. */
|
249
|
+
carbonOffsetFactorKgPerMwh?: number;
|
250
|
+
/** A FinancialAnalysis gives the savings from going solar assuming a given monthly bill and a given electricity provider. They are in order of increasing order of monthly bill amount. This field will be empty for buildings in areas for which the Solar API does not have enough information to perform financial computations. */
|
251
|
+
financialAnalyses?: FinancialAnalysis[];
|
252
|
+
/** Size, in square meters, of the maximum array. */
|
253
|
+
maxArrayAreaMeters2?: number;
|
254
|
+
/** Size of the maximum array - that is, the maximum number of panels that can fit on the roof. */
|
255
|
+
maxArrayPanelsCount?: number;
|
256
|
+
/** Maximum number of sunshine hours received per year, by any point on the roof. Sunshine hours are a measure of the total amount of insolation (energy) received per year. 1 sunshine hour = 1 kWh per kW (where kW refers to kW of capacity under Standard Testing Conditions). */
|
257
|
+
maxSunshineHoursPerYear?: number;
|
258
|
+
/** Capacity, in watts, of the panel used in the calculations. */
|
259
|
+
panelCapacityWatts?: number;
|
260
|
+
/** Height, in meters in portrait orientation, of the panel used in the calculations. */
|
261
|
+
panelHeightMeters?: number;
|
262
|
+
/** The expected lifetime, in years, of the solar panels. This is used in the financial calculations. */
|
263
|
+
panelLifetimeYears?: number;
|
264
|
+
/** Width, in meters in portrait orientation, of the panel used in the calculations. */
|
265
|
+
panelWidthMeters?: number;
|
266
|
+
/** Size and sunlight quantiles for each roof segment. */
|
267
|
+
roofSegmentStats?: RoofSegmentSizeAndSunshineStats[];
|
268
|
+
/** Each SolarPanelConfig describes a different arrangement of solar panels on the roof. They are in order of increasing number of panels. The `SolarPanelConfig` with panels_count=N is based on the first N panels in the `solar_panels` list. This field is only populated if at least 4 panels can fit on a roof. */
|
269
|
+
solarPanelConfigs?: SolarPanelConfig[];
|
270
|
+
/** Each SolarPanel describes a single solar panel. They are listed in the order that the panel layout algorithm placed this. This is usually, though not always, in decreasing order of annual energy production. */
|
271
|
+
solarPanels?: SolarPanel[];
|
272
|
+
/** Total size and sunlight quantiles for the part of the roof that was assigned to some roof segment. Despite the name, this may not include the entire building. See building_stats. */
|
273
|
+
wholeRoofStats?: SizeAndSunshineStats;
|
274
|
+
}
|
275
|
+
interface BuildingInsightsResource {
|
276
|
+
/** Locates the closest building to a query point. Returns an error with code `NOT_FOUND` if there are no buildings within approximately 50m of the query point. */
|
277
|
+
findClosest(request?: {
|
278
|
+
/** V1 error format. */
|
279
|
+
'$.xgafv'?: string;
|
280
|
+
/** OAuth access token. */
|
281
|
+
access_token?: string;
|
282
|
+
/** Data format for response. */
|
283
|
+
alt?: string;
|
284
|
+
/** JSONP */
|
285
|
+
callback?: string;
|
286
|
+
/** Selector specifying which fields to include in a partial response. */
|
287
|
+
fields?: string;
|
288
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
289
|
+
key?: string;
|
290
|
+
/** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
|
291
|
+
'location.latitude'?: number;
|
292
|
+
/** The longitude in degrees. It must be in the range [-180.0, +180.0]. */
|
293
|
+
'location.longitude'?: number;
|
294
|
+
/** OAuth 2.0 token for the current user. */
|
295
|
+
oauth_token?: string;
|
296
|
+
/** Returns response with indentations and line breaks. */
|
297
|
+
prettyPrint?: boolean;
|
298
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
299
|
+
quotaUser?: string;
|
300
|
+
/** Optional. The minimum quality level allowed in the results. No result with lower quality than this will be returned. Not specifying this is equivalent to restricting to HIGH quality only. */
|
301
|
+
requiredQuality?: string;
|
302
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
303
|
+
upload_protocol?: string;
|
304
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
305
|
+
uploadType?: string;
|
306
|
+
}): Request<BuildingInsights>;
|
307
|
+
}
|
308
|
+
interface DataLayersResource {
|
309
|
+
/** Gets solar information for a region surrounding a location. Returns an error with code `NOT_FOUND` if the location is outside the coverage area. */
|
310
|
+
get(request?: {
|
311
|
+
/** V1 error format. */
|
312
|
+
'$.xgafv'?: string;
|
313
|
+
/** OAuth access token. */
|
314
|
+
access_token?: string;
|
315
|
+
/** Data format for response. */
|
316
|
+
alt?: string;
|
317
|
+
/** JSONP */
|
318
|
+
callback?: string;
|
319
|
+
/** Selector specifying which fields to include in a partial response. */
|
320
|
+
fields?: string;
|
321
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
322
|
+
key?: string;
|
323
|
+
/** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
|
324
|
+
'location.latitude'?: number;
|
325
|
+
/** The longitude in degrees. It must be in the range [-180.0, +180.0]. */
|
326
|
+
'location.longitude'?: number;
|
327
|
+
/** OAuth 2.0 token for the current user. */
|
328
|
+
oauth_token?: string;
|
329
|
+
/** Optional. The minimum scale, in meters per pixel, of the data to return. Values of 0.1 (the default, if this field is not set explicitly), 0.25, 0.5, and 1.0 are supported. Imagery components whose normal resolution is less than `pixel_size_meters` will be returned at the resolution specified by `pixel_size_meters`; imagery components whose normal resolution is equal to or greater than `pixel_size_meters` will be returned at that normal resolution. */
|
330
|
+
pixelSizeMeters?: number;
|
331
|
+
/** Returns response with indentations and line breaks. */
|
332
|
+
prettyPrint?: boolean;
|
333
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
334
|
+
quotaUser?: string;
|
335
|
+
/** Required. The radius, in meters, defining the region surrounding that centre point for which data should be returned. The limitations on this value are: * Any value up to 100m can always be specified. * Values over 100m can be specified, as long as `radius_meters` <= `pixel_size_meters * 1000`. * However, for values over 175m, the `DataLayerView` in the request must not include monthly flux or hourly shade. */
|
336
|
+
radiusMeters?: number;
|
337
|
+
/** Optional. The minimum quality level allowed in the results. No result with lower quality than this will be returned. Not specifying this is equivalent to restricting to HIGH quality only. */
|
338
|
+
requiredQuality?: string;
|
339
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
340
|
+
upload_protocol?: string;
|
341
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
342
|
+
uploadType?: string;
|
343
|
+
/** Optional. The desired subset of the data to return. */
|
344
|
+
view?: string;
|
345
|
+
}): Request<DataLayers>;
|
346
|
+
}
|
347
|
+
interface GeoTiffResource {
|
348
|
+
/** Returns an image by its ID. */
|
349
|
+
get(request?: {
|
350
|
+
/** V1 error format. */
|
351
|
+
'$.xgafv'?: string;
|
352
|
+
/** OAuth access token. */
|
353
|
+
access_token?: string;
|
354
|
+
/** Data format for response. */
|
355
|
+
alt?: string;
|
356
|
+
/** JSONP */
|
357
|
+
callback?: string;
|
358
|
+
/** Selector specifying which fields to include in a partial response. */
|
359
|
+
fields?: string;
|
360
|
+
/** Required. The ID of the asset being requested. */
|
361
|
+
id?: string;
|
362
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
363
|
+
key?: string;
|
364
|
+
/** OAuth 2.0 token for the current user. */
|
365
|
+
oauth_token?: string;
|
366
|
+
/** Returns response with indentations and line breaks. */
|
367
|
+
prettyPrint?: boolean;
|
368
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
369
|
+
quotaUser?: string;
|
370
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
371
|
+
upload_protocol?: string;
|
372
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
373
|
+
uploadType?: string;
|
374
|
+
}): Request<HttpBody>;
|
375
|
+
}
|
376
|
+
|
377
|
+
const buildingInsights: BuildingInsightsResource;
|
378
|
+
|
379
|
+
const dataLayers: DataLayersResource;
|
380
|
+
|
381
|
+
const geoTiff: GeoTiffResource;
|
382
|
+
}
|
383
|
+
}
|
package/package.json
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
{
|
2
|
+
"name": "@maxim_mazurok/gapi.client.solar-v1",
|
3
|
+
"version": "0.0.20240327",
|
4
|
+
"description": "TypeScript typings for Solar API v1",
|
5
|
+
"repository": {
|
6
|
+
"type": "git",
|
7
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
8
|
+
},
|
9
|
+
"license": "MIT",
|
10
|
+
"author": {
|
11
|
+
"name": "Maxim Mazurok",
|
12
|
+
"email": "maxim@mazurok.com",
|
13
|
+
"url": "https://maxim.mazurok.com"
|
14
|
+
},
|
15
|
+
"types": "index.d.ts",
|
16
|
+
"dependencies": {
|
17
|
+
"@types/gapi.client": "*",
|
18
|
+
"@types/gapi.client.discovery-v1": "*"
|
19
|
+
}
|
20
|
+
}
|
package/readme.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
# TypeScript typings for Solar API v1
|
2
|
+
|
3
|
+
Solar API.
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/maps/documentation/solar).
|
5
|
+
|
6
|
+
## Installing
|
7
|
+
|
8
|
+
Install typings for Solar API:
|
9
|
+
|
10
|
+
```
|
11
|
+
npm install @types/gapi.client.solar-v1 --save-dev
|
12
|
+
```
|
13
|
+
|
14
|
+
## Usage
|
15
|
+
|
16
|
+
You need to initialize Google API client in your code:
|
17
|
+
|
18
|
+
```typescript
|
19
|
+
gapi.load('client', () => {
|
20
|
+
// now we can use gapi.client
|
21
|
+
// ...
|
22
|
+
});
|
23
|
+
```
|
24
|
+
|
25
|
+
Then load api client wrapper:
|
26
|
+
|
27
|
+
```typescript
|
28
|
+
gapi.client.load(
|
29
|
+
'https://solar.googleapis.com/$discovery/rest?version=v1',
|
30
|
+
() => {
|
31
|
+
// now we can use:
|
32
|
+
// gapi.client.solar
|
33
|
+
}
|
34
|
+
);
|
35
|
+
```
|
36
|
+
|
37
|
+
```typescript
|
38
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
39
|
+
gapi.client.load('solar', 'v1', () => {
|
40
|
+
// now we can use:
|
41
|
+
// gapi.client.solar
|
42
|
+
});
|
43
|
+
```
|
44
|
+
|
45
|
+
Don't forget to authenticate your client before sending any request to resources:
|
46
|
+
|
47
|
+
```typescript
|
48
|
+
// declare client_id registered in Google Developers Console
|
49
|
+
var client_id = '',
|
50
|
+
scope = [
|
51
|
+
// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
52
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
53
|
+
],
|
54
|
+
immediate = true;
|
55
|
+
// ...
|
56
|
+
|
57
|
+
gapi.auth.authorize(
|
58
|
+
{client_id: client_id, scope: scope, immediate: immediate},
|
59
|
+
authResult => {
|
60
|
+
if (authResult && !authResult.error) {
|
61
|
+
/* handle successful authorization */
|
62
|
+
} else {
|
63
|
+
/* handle authorization error */
|
64
|
+
}
|
65
|
+
}
|
66
|
+
);
|
67
|
+
```
|
68
|
+
|
69
|
+
After that you can use Solar API resources: <!-- TODO: make this work for multiple namespaces -->
|
70
|
+
|
71
|
+
```typescript
|
72
|
+
/*
|
73
|
+
Locates the closest building to a query point. Returns an error with code `NOT_FOUND` if there are no buildings within approximately 50m of the query point.
|
74
|
+
*/
|
75
|
+
await gapi.client.solar.buildingInsights.findClosest({});
|
76
|
+
|
77
|
+
/*
|
78
|
+
Gets solar information for a region surrounding a location. Returns an error with code `NOT_FOUND` if the location is outside the coverage area.
|
79
|
+
*/
|
80
|
+
await gapi.client.solar.dataLayers.get({});
|
81
|
+
|
82
|
+
/*
|
83
|
+
Returns an image by its ID.
|
84
|
+
*/
|
85
|
+
await gapi.client.solar.geoTiff.get({});
|
86
|
+
```
|