@vepler/sdk 2.139.0 → 2.140.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.
- package/README.md +363 -356
- package/dist/commonjs/funcs/prosperityGet.d.ts +23 -0
- package/dist/commonjs/funcs/prosperityGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/prosperityGet.js +129 -0
- package/dist/commonjs/funcs/prosperityGet.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/sdk/models/errors/getprosperity.d.ts +136 -0
- package/dist/commonjs/sdk/models/errors/getprosperity.d.ts.map +1 -0
- package/dist/commonjs/sdk/models/errors/getprosperity.js +157 -0
- package/dist/commonjs/sdk/models/errors/getprosperity.js.map +1 -0
- package/dist/commonjs/sdk/models/errors/index.d.ts +1 -0
- package/dist/commonjs/sdk/models/errors/index.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/errors/index.js +1 -0
- package/dist/commonjs/sdk/models/errors/index.js.map +1 -1
- package/dist/commonjs/sdk/models/operations/getprosperity.d.ts +15 -0
- package/dist/commonjs/sdk/models/operations/getprosperity.d.ts.map +1 -0
- package/dist/commonjs/sdk/models/operations/getprosperity.js +49 -0
- package/dist/commonjs/sdk/models/operations/getprosperity.js.map +1 -0
- package/dist/commonjs/sdk/models/operations/index.d.ts +1 -0
- package/dist/commonjs/sdk/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/operations/index.js +1 -0
- package/dist/commonjs/sdk/models/operations/index.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/index.d.ts +1 -0
- package/dist/commonjs/sdk/models/shared/index.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/index.js +1 -0
- package/dist/commonjs/sdk/models/shared/index.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/propertydataapi.d.ts +0 -2
- package/dist/commonjs/sdk/models/shared/propertydataapi.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/propertydataapi.js +0 -2
- package/dist/commonjs/sdk/models/shared/propertydataapi.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/prosperitydata.d.ts +5 -1
- package/dist/commonjs/sdk/models/shared/prosperitydata.d.ts.map +1 -1
- package/dist/commonjs/sdk/models/shared/prosperitydata.js +1 -0
- package/dist/commonjs/sdk/models/shared/prosperitydata.js.map +1 -1
- package/dist/commonjs/sdk/models/shared/prosperitylistresponse.d.ts +46 -0
- package/dist/commonjs/sdk/models/shared/prosperitylistresponse.d.ts.map +1 -0
- package/dist/commonjs/sdk/models/shared/prosperitylistresponse.js +69 -0
- package/dist/commonjs/sdk/models/shared/prosperitylistresponse.js.map +1 -0
- package/dist/commonjs/sdk/prosperity.d.ts +17 -0
- package/dist/commonjs/sdk/prosperity.d.ts.map +1 -0
- package/dist/commonjs/sdk/prosperity.js +26 -0
- package/dist/commonjs/sdk/prosperity.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/prosperityGet.d.ts +23 -0
- package/dist/esm/funcs/prosperityGet.d.ts.map +1 -0
- package/dist/esm/funcs/prosperityGet.js +93 -0
- package/dist/esm/funcs/prosperityGet.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/sdk/models/errors/getprosperity.d.ts +136 -0
- package/dist/esm/sdk/models/errors/getprosperity.d.ts.map +1 -0
- package/dist/esm/sdk/models/errors/getprosperity.js +117 -0
- package/dist/esm/sdk/models/errors/getprosperity.js.map +1 -0
- package/dist/esm/sdk/models/errors/index.d.ts +1 -0
- package/dist/esm/sdk/models/errors/index.d.ts.map +1 -1
- package/dist/esm/sdk/models/errors/index.js +1 -0
- package/dist/esm/sdk/models/errors/index.js.map +1 -1
- package/dist/esm/sdk/models/operations/getprosperity.d.ts +15 -0
- package/dist/esm/sdk/models/operations/getprosperity.d.ts.map +1 -0
- package/dist/esm/sdk/models/operations/getprosperity.js +12 -0
- package/dist/esm/sdk/models/operations/getprosperity.js.map +1 -0
- package/dist/esm/sdk/models/operations/index.d.ts +1 -0
- package/dist/esm/sdk/models/operations/index.d.ts.map +1 -1
- package/dist/esm/sdk/models/operations/index.js +1 -0
- package/dist/esm/sdk/models/operations/index.js.map +1 -1
- package/dist/esm/sdk/models/shared/index.d.ts +1 -0
- package/dist/esm/sdk/models/shared/index.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/index.js +1 -0
- package/dist/esm/sdk/models/shared/index.js.map +1 -1
- package/dist/esm/sdk/models/shared/propertydataapi.d.ts +0 -2
- package/dist/esm/sdk/models/shared/propertydataapi.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/propertydataapi.js +0 -2
- package/dist/esm/sdk/models/shared/propertydataapi.js.map +1 -1
- package/dist/esm/sdk/models/shared/prosperitydata.d.ts +5 -1
- package/dist/esm/sdk/models/shared/prosperitydata.d.ts.map +1 -1
- package/dist/esm/sdk/models/shared/prosperitydata.js +1 -0
- package/dist/esm/sdk/models/shared/prosperitydata.js.map +1 -1
- package/dist/esm/sdk/models/shared/prosperitylistresponse.d.ts +46 -0
- package/dist/esm/sdk/models/shared/prosperitylistresponse.d.ts.map +1 -0
- package/dist/esm/sdk/models/shared/prosperitylistresponse.js +32 -0
- package/dist/esm/sdk/models/shared/prosperitylistresponse.js.map +1 -0
- package/dist/esm/sdk/prosperity.d.ts +17 -0
- package/dist/esm/sdk/prosperity.d.ts.map +1 -0
- package/dist/esm/sdk/prosperity.js +22 -0
- package/dist/esm/sdk/prosperity.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/package.json +1 -1
- package/src/funcs/prosperityGet.ts +185 -0
- package/src/lib/config.ts +2 -2
- package/src/sdk/models/errors/getprosperity.ts +264 -0
- package/src/sdk/models/errors/index.ts +1 -0
- package/src/sdk/models/operations/getprosperity.ts +34 -0
- package/src/sdk/models/operations/index.ts +1 -0
- package/src/sdk/models/shared/index.ts +1 -0
- package/src/sdk/models/shared/propertydataapi.ts +0 -6
- package/src/sdk/models/shared/prosperitydata.ts +6 -1
- package/src/sdk/models/shared/prosperitylistresponse.ts +86 -0
- package/src/sdk/prosperity.ts +32 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { SDKCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import {
|
|
15
|
+
ConnectionError,
|
|
16
|
+
InvalidRequestError,
|
|
17
|
+
RequestAbortedError,
|
|
18
|
+
RequestTimeoutError,
|
|
19
|
+
UnexpectedClientError,
|
|
20
|
+
} from "../sdk/models/errors/httpclienterrors.js";
|
|
21
|
+
import * as errors from "../sdk/models/errors/index.js";
|
|
22
|
+
import { ResponseValidationError } from "../sdk/models/errors/responsevalidationerror.js";
|
|
23
|
+
import { SDKBaseError } from "../sdk/models/errors/sdkbaseerror.js";
|
|
24
|
+
import { SDKValidationError } from "../sdk/models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../sdk/models/operations/index.js";
|
|
26
|
+
import * as shared from "../sdk/models/shared/index.js";
|
|
27
|
+
import { APICall, APIPromise } from "../sdk/types/async.js";
|
|
28
|
+
import { Result } from "../sdk/types/fp.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the Prosperity Index for one or more small areas
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Returns the Vepler Prosperity Index for one or more small-area codes — a composite 0-100 economic-prosperity score with national decile (1-10) and percentile. Pass a single code (e.g. `E01000001`) or a comma-separated list (up to 100). Each result is self-describing, carrying its own `geographicCode`, so multi-code lookups can be mapped back by the caller.
|
|
35
|
+
*
|
|
36
|
+
* The score breaks down into four weighted dimensions (income, housing, employment, living standards) and the curated underlying indicators (19 ONS/MHCLG measures) that feed them, each with display value, national median/mean, percentile and source attribution. England & Wales areas also carry the ONS OAC 2021 geodemographic classification (null for Scotland and Northern Ireland, which have no OAC).
|
|
37
|
+
*
|
|
38
|
+
* Codes with no persisted score are silently omitted from the result set — a request for valid-but-unscored codes returns an empty list, not a 404.
|
|
39
|
+
*/
|
|
40
|
+
export function prosperityGet(
|
|
41
|
+
client: SDKCore,
|
|
42
|
+
request: operations.GetProsperityRequest,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
Result<
|
|
46
|
+
shared.ProsperityListResponse,
|
|
47
|
+
| errors.GetProsperityResponseBody
|
|
48
|
+
| errors.GetProsperityProsperityResponseBody
|
|
49
|
+
| SDKBaseError
|
|
50
|
+
| ResponseValidationError
|
|
51
|
+
| ConnectionError
|
|
52
|
+
| RequestAbortedError
|
|
53
|
+
| RequestTimeoutError
|
|
54
|
+
| InvalidRequestError
|
|
55
|
+
| UnexpectedClientError
|
|
56
|
+
| SDKValidationError
|
|
57
|
+
>
|
|
58
|
+
> {
|
|
59
|
+
return new APIPromise($do(
|
|
60
|
+
client,
|
|
61
|
+
request,
|
|
62
|
+
options,
|
|
63
|
+
));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function $do(
|
|
67
|
+
client: SDKCore,
|
|
68
|
+
request: operations.GetProsperityRequest,
|
|
69
|
+
options?: RequestOptions,
|
|
70
|
+
): Promise<
|
|
71
|
+
[
|
|
72
|
+
Result<
|
|
73
|
+
shared.ProsperityListResponse,
|
|
74
|
+
| errors.GetProsperityResponseBody
|
|
75
|
+
| errors.GetProsperityProsperityResponseBody
|
|
76
|
+
| SDKBaseError
|
|
77
|
+
| ResponseValidationError
|
|
78
|
+
| ConnectionError
|
|
79
|
+
| RequestAbortedError
|
|
80
|
+
| RequestTimeoutError
|
|
81
|
+
| InvalidRequestError
|
|
82
|
+
| UnexpectedClientError
|
|
83
|
+
| SDKValidationError
|
|
84
|
+
>,
|
|
85
|
+
APICall,
|
|
86
|
+
]
|
|
87
|
+
> {
|
|
88
|
+
const parsed = safeParse(
|
|
89
|
+
request,
|
|
90
|
+
(value) => operations.GetProsperityRequest$outboundSchema.parse(value),
|
|
91
|
+
"Input validation failed",
|
|
92
|
+
);
|
|
93
|
+
if (!parsed.ok) {
|
|
94
|
+
return [parsed, { status: "invalid" }];
|
|
95
|
+
}
|
|
96
|
+
const payload = parsed.value;
|
|
97
|
+
const body = null;
|
|
98
|
+
|
|
99
|
+
const pathParams = {
|
|
100
|
+
geographicCodes: encodeSimple("geographicCodes", payload.geographicCodes, {
|
|
101
|
+
explode: false,
|
|
102
|
+
charEncoding: "percent",
|
|
103
|
+
}),
|
|
104
|
+
};
|
|
105
|
+
const path = pathToFunc("/v1/prosperity/{geographicCodes}")(pathParams);
|
|
106
|
+
|
|
107
|
+
const headers = new Headers(compactMap({
|
|
108
|
+
Accept: "application/json",
|
|
109
|
+
}));
|
|
110
|
+
|
|
111
|
+
const secConfig = await extractSecurity(client._options.apiKeyAuth);
|
|
112
|
+
const securityInput = secConfig == null ? {} : { apiKeyAuth: secConfig };
|
|
113
|
+
const requestSecurity = resolveGlobalSecurity(securityInput);
|
|
114
|
+
|
|
115
|
+
const context = {
|
|
116
|
+
options: client._options,
|
|
117
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
118
|
+
operationID: "getProsperity",
|
|
119
|
+
oAuth2Scopes: null,
|
|
120
|
+
|
|
121
|
+
resolvedSecurity: requestSecurity,
|
|
122
|
+
|
|
123
|
+
securitySource: client._options.apiKeyAuth,
|
|
124
|
+
retryConfig: options?.retries
|
|
125
|
+
|| client._options.retryConfig
|
|
126
|
+
|| { strategy: "none" },
|
|
127
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
const requestRes = client._createRequest(context, {
|
|
131
|
+
security: requestSecurity,
|
|
132
|
+
method: "GET",
|
|
133
|
+
baseURL: options?.serverURL,
|
|
134
|
+
path: path,
|
|
135
|
+
headers: headers,
|
|
136
|
+
body: body,
|
|
137
|
+
userAgent: client._options.userAgent,
|
|
138
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
139
|
+
}, options);
|
|
140
|
+
if (!requestRes.ok) {
|
|
141
|
+
return [requestRes, { status: "invalid" }];
|
|
142
|
+
}
|
|
143
|
+
const req = requestRes.value;
|
|
144
|
+
|
|
145
|
+
const doResult = await client._do(req, {
|
|
146
|
+
context,
|
|
147
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
148
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
149
|
+
retryConfig: context.retryConfig,
|
|
150
|
+
retryCodes: context.retryCodes,
|
|
151
|
+
});
|
|
152
|
+
if (!doResult.ok) {
|
|
153
|
+
return [doResult, { status: "request-error", request: req }];
|
|
154
|
+
}
|
|
155
|
+
const response = doResult.value;
|
|
156
|
+
|
|
157
|
+
const responseFields = {
|
|
158
|
+
HttpMeta: { Response: response, Request: req },
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
const [result] = await M.match<
|
|
162
|
+
shared.ProsperityListResponse,
|
|
163
|
+
| errors.GetProsperityResponseBody
|
|
164
|
+
| errors.GetProsperityProsperityResponseBody
|
|
165
|
+
| SDKBaseError
|
|
166
|
+
| ResponseValidationError
|
|
167
|
+
| ConnectionError
|
|
168
|
+
| RequestAbortedError
|
|
169
|
+
| RequestTimeoutError
|
|
170
|
+
| InvalidRequestError
|
|
171
|
+
| UnexpectedClientError
|
|
172
|
+
| SDKValidationError
|
|
173
|
+
>(
|
|
174
|
+
M.json(200, shared.ProsperityListResponse$inboundSchema),
|
|
175
|
+
M.jsonErr(400, errors.GetProsperityResponseBody$inboundSchema),
|
|
176
|
+
M.jsonErr(500, errors.GetProsperityProsperityResponseBody$inboundSchema),
|
|
177
|
+
M.fail("4XX"),
|
|
178
|
+
M.fail("5XX"),
|
|
179
|
+
)(response, req, { extraFields: responseFields });
|
|
180
|
+
if (!result.ok) {
|
|
181
|
+
return [result, { status: "complete", request: req, response }];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
return [result, { status: "complete", request: req, response }];
|
|
185
|
+
}
|
package/src/lib/config.ts
CHANGED
|
@@ -60,8 +60,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
|
|
|
60
60
|
|
|
61
61
|
export const SDK_METADATA = {
|
|
62
62
|
language: "typescript",
|
|
63
|
-
openapiDocVersion: "2.
|
|
63
|
+
openapiDocVersion: "2.140.0",
|
|
64
64
|
sdkVersion: "0.10.0",
|
|
65
65
|
genVersion: "2.889.1",
|
|
66
|
-
userAgent: "speakeasy-sdk/typescript 0.10.0 2.889.1 2.
|
|
66
|
+
userAgent: "speakeasy-sdk/typescript 0.10.0 2.889.1 2.140.0 @vepler/sdk",
|
|
67
67
|
} as const;
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../../lib/schemas.js";
|
|
8
|
+
import * as openEnums from "../../types/enums.js";
|
|
9
|
+
import { OpenEnum } from "../../types/enums.js";
|
|
10
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
11
|
+
import { SDKBaseError } from "./sdkbaseerror.js";
|
|
12
|
+
import { SDKValidationError } from "./sdkvalidationerror.js";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Error type category
|
|
16
|
+
*/
|
|
17
|
+
export const GetProsperityProsperityType = {
|
|
18
|
+
ApiError: "api_error",
|
|
19
|
+
InvalidRequestError: "invalid_request_error",
|
|
20
|
+
AuthenticationError: "authentication_error",
|
|
21
|
+
RateLimitError: "rate_limit_error",
|
|
22
|
+
} as const;
|
|
23
|
+
/**
|
|
24
|
+
* Error type category
|
|
25
|
+
*/
|
|
26
|
+
export type GetProsperityProsperityType = OpenEnum<
|
|
27
|
+
typeof GetProsperityProsperityType
|
|
28
|
+
>;
|
|
29
|
+
|
|
30
|
+
export type GetProsperityProsperityError = {
|
|
31
|
+
/**
|
|
32
|
+
* Machine-readable error code
|
|
33
|
+
*/
|
|
34
|
+
code?: string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* URL to relevant documentation
|
|
37
|
+
*/
|
|
38
|
+
docUrl?: string | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* Human-readable error message
|
|
41
|
+
*/
|
|
42
|
+
message: string;
|
|
43
|
+
/**
|
|
44
|
+
* Parameter that caused the error
|
|
45
|
+
*/
|
|
46
|
+
param?: string | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Suggested corrections (e.g. postcode typo suggestions)
|
|
49
|
+
*/
|
|
50
|
+
suggestions?: Array<string> | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Error type category
|
|
53
|
+
*/
|
|
54
|
+
type: GetProsperityProsperityType;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Error response
|
|
59
|
+
*/
|
|
60
|
+
export type GetProsperityProsperityResponseBodyData = {
|
|
61
|
+
error: GetProsperityProsperityError;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Error response
|
|
66
|
+
*/
|
|
67
|
+
export class GetProsperityProsperityResponseBody extends SDKBaseError {
|
|
68
|
+
error: GetProsperityProsperityError;
|
|
69
|
+
|
|
70
|
+
/** The original data that was passed to this error instance. */
|
|
71
|
+
data$: GetProsperityProsperityResponseBodyData;
|
|
72
|
+
|
|
73
|
+
constructor(
|
|
74
|
+
err: GetProsperityProsperityResponseBodyData,
|
|
75
|
+
httpMeta: { response: Response; request: Request; body: string },
|
|
76
|
+
) {
|
|
77
|
+
const message = err.error?.message
|
|
78
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
79
|
+
super(message, httpMeta);
|
|
80
|
+
this.data$ = err;
|
|
81
|
+
this.error = err.error;
|
|
82
|
+
|
|
83
|
+
this.name = "GetProsperityProsperityResponseBody";
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Error type category
|
|
89
|
+
*/
|
|
90
|
+
export const GetProsperityType = {
|
|
91
|
+
ApiError: "api_error",
|
|
92
|
+
InvalidRequestError: "invalid_request_error",
|
|
93
|
+
AuthenticationError: "authentication_error",
|
|
94
|
+
RateLimitError: "rate_limit_error",
|
|
95
|
+
} as const;
|
|
96
|
+
/**
|
|
97
|
+
* Error type category
|
|
98
|
+
*/
|
|
99
|
+
export type GetProsperityType = OpenEnum<typeof GetProsperityType>;
|
|
100
|
+
|
|
101
|
+
export type GetProsperityError = {
|
|
102
|
+
/**
|
|
103
|
+
* Machine-readable error code
|
|
104
|
+
*/
|
|
105
|
+
code?: string | undefined;
|
|
106
|
+
/**
|
|
107
|
+
* URL to relevant documentation
|
|
108
|
+
*/
|
|
109
|
+
docUrl?: string | undefined;
|
|
110
|
+
/**
|
|
111
|
+
* Human-readable error message
|
|
112
|
+
*/
|
|
113
|
+
message: string;
|
|
114
|
+
/**
|
|
115
|
+
* Parameter that caused the error
|
|
116
|
+
*/
|
|
117
|
+
param?: string | undefined;
|
|
118
|
+
/**
|
|
119
|
+
* Suggested corrections (e.g. postcode typo suggestions)
|
|
120
|
+
*/
|
|
121
|
+
suggestions?: Array<string> | undefined;
|
|
122
|
+
/**
|
|
123
|
+
* Error type category
|
|
124
|
+
*/
|
|
125
|
+
type: GetProsperityType;
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Error response
|
|
130
|
+
*/
|
|
131
|
+
export type GetProsperityResponseBodyData = {
|
|
132
|
+
error: GetProsperityError;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Error response
|
|
137
|
+
*/
|
|
138
|
+
export class GetProsperityResponseBody extends SDKBaseError {
|
|
139
|
+
error: GetProsperityError;
|
|
140
|
+
|
|
141
|
+
/** The original data that was passed to this error instance. */
|
|
142
|
+
data$: GetProsperityResponseBodyData;
|
|
143
|
+
|
|
144
|
+
constructor(
|
|
145
|
+
err: GetProsperityResponseBodyData,
|
|
146
|
+
httpMeta: { response: Response; request: Request; body: string },
|
|
147
|
+
) {
|
|
148
|
+
const message = err.error?.message
|
|
149
|
+
|| `API error occurred: ${JSON.stringify(err)}`;
|
|
150
|
+
super(message, httpMeta);
|
|
151
|
+
this.data$ = err;
|
|
152
|
+
this.error = err.error;
|
|
153
|
+
|
|
154
|
+
this.name = "GetProsperityResponseBody";
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** @internal */
|
|
159
|
+
export const GetProsperityProsperityType$inboundSchema: z.ZodType<
|
|
160
|
+
GetProsperityProsperityType,
|
|
161
|
+
z.ZodTypeDef,
|
|
162
|
+
unknown
|
|
163
|
+
> = openEnums.inboundSchema(GetProsperityProsperityType);
|
|
164
|
+
|
|
165
|
+
/** @internal */
|
|
166
|
+
export const GetProsperityProsperityError$inboundSchema: z.ZodType<
|
|
167
|
+
GetProsperityProsperityError,
|
|
168
|
+
z.ZodTypeDef,
|
|
169
|
+
unknown
|
|
170
|
+
> = z.object({
|
|
171
|
+
code: z.string().optional(),
|
|
172
|
+
doc_url: z.string().optional(),
|
|
173
|
+
message: z.string(),
|
|
174
|
+
param: z.string().optional(),
|
|
175
|
+
suggestions: z.array(z.string()).optional(),
|
|
176
|
+
type: GetProsperityProsperityType$inboundSchema,
|
|
177
|
+
}).transform((v) => {
|
|
178
|
+
return remap$(v, {
|
|
179
|
+
"doc_url": "docUrl",
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
export function getProsperityProsperityErrorFromJSON(
|
|
184
|
+
jsonString: string,
|
|
185
|
+
): SafeParseResult<GetProsperityProsperityError, SDKValidationError> {
|
|
186
|
+
return safeParse(
|
|
187
|
+
jsonString,
|
|
188
|
+
(x) => GetProsperityProsperityError$inboundSchema.parse(JSON.parse(x)),
|
|
189
|
+
`Failed to parse 'GetProsperityProsperityError' from JSON`,
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/** @internal */
|
|
194
|
+
export const GetProsperityProsperityResponseBody$inboundSchema: z.ZodType<
|
|
195
|
+
GetProsperityProsperityResponseBody,
|
|
196
|
+
z.ZodTypeDef,
|
|
197
|
+
unknown
|
|
198
|
+
> = z.object({
|
|
199
|
+
error: z.lazy(() => GetProsperityProsperityError$inboundSchema),
|
|
200
|
+
request$: z.instanceof(Request),
|
|
201
|
+
response$: z.instanceof(Response),
|
|
202
|
+
body$: z.string(),
|
|
203
|
+
})
|
|
204
|
+
.transform((v) => {
|
|
205
|
+
return new GetProsperityProsperityResponseBody(v, {
|
|
206
|
+
request: v.request$,
|
|
207
|
+
response: v.response$,
|
|
208
|
+
body: v.body$,
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
/** @internal */
|
|
213
|
+
export const GetProsperityType$inboundSchema: z.ZodType<
|
|
214
|
+
GetProsperityType,
|
|
215
|
+
z.ZodTypeDef,
|
|
216
|
+
unknown
|
|
217
|
+
> = openEnums.inboundSchema(GetProsperityType);
|
|
218
|
+
|
|
219
|
+
/** @internal */
|
|
220
|
+
export const GetProsperityError$inboundSchema: z.ZodType<
|
|
221
|
+
GetProsperityError,
|
|
222
|
+
z.ZodTypeDef,
|
|
223
|
+
unknown
|
|
224
|
+
> = z.object({
|
|
225
|
+
code: z.string().optional(),
|
|
226
|
+
doc_url: z.string().optional(),
|
|
227
|
+
message: z.string(),
|
|
228
|
+
param: z.string().optional(),
|
|
229
|
+
suggestions: z.array(z.string()).optional(),
|
|
230
|
+
type: GetProsperityType$inboundSchema,
|
|
231
|
+
}).transform((v) => {
|
|
232
|
+
return remap$(v, {
|
|
233
|
+
"doc_url": "docUrl",
|
|
234
|
+
});
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
export function getProsperityErrorFromJSON(
|
|
238
|
+
jsonString: string,
|
|
239
|
+
): SafeParseResult<GetProsperityError, SDKValidationError> {
|
|
240
|
+
return safeParse(
|
|
241
|
+
jsonString,
|
|
242
|
+
(x) => GetProsperityError$inboundSchema.parse(JSON.parse(x)),
|
|
243
|
+
`Failed to parse 'GetProsperityError' from JSON`,
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/** @internal */
|
|
248
|
+
export const GetProsperityResponseBody$inboundSchema: z.ZodType<
|
|
249
|
+
GetProsperityResponseBody,
|
|
250
|
+
z.ZodTypeDef,
|
|
251
|
+
unknown
|
|
252
|
+
> = z.object({
|
|
253
|
+
error: z.lazy(() => GetProsperityError$inboundSchema),
|
|
254
|
+
request$: z.instanceof(Request),
|
|
255
|
+
response$: z.instanceof(Response),
|
|
256
|
+
body$: z.string(),
|
|
257
|
+
})
|
|
258
|
+
.transform((v) => {
|
|
259
|
+
return new GetProsperityResponseBody(v, {
|
|
260
|
+
request: v.request$,
|
|
261
|
+
response: v.response$,
|
|
262
|
+
body: v.body$,
|
|
263
|
+
});
|
|
264
|
+
});
|
|
@@ -71,6 +71,7 @@ export * from "./getpropertiesbyslugs.js";
|
|
|
71
71
|
export * from "./getpropertiesbysource.js";
|
|
72
72
|
export * from "./getpropertiesinsite.js";
|
|
73
73
|
export * from "./getpropertytiles.js";
|
|
74
|
+
export * from "./getprosperity.js";
|
|
74
75
|
export * from "./getpsc.js";
|
|
75
76
|
export * from "./getschoolbyid.js";
|
|
76
77
|
export * from "./getschoolbysource.js";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type GetProsperityRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* Single small-area code or comma-separated list (up to 100), e.g. E01000001 or E01000001,E01000002
|
|
10
|
+
*/
|
|
11
|
+
geographicCodes: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type GetProsperityRequest$Outbound = {
|
|
16
|
+
geographicCodes: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const GetProsperityRequest$outboundSchema: z.ZodType<
|
|
21
|
+
GetProsperityRequest$Outbound,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
GetProsperityRequest
|
|
24
|
+
> = z.object({
|
|
25
|
+
geographicCodes: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function getProsperityRequestToJSON(
|
|
29
|
+
getProsperityRequest: GetProsperityRequest,
|
|
30
|
+
): string {
|
|
31
|
+
return JSON.stringify(
|
|
32
|
+
GetProsperityRequest$outboundSchema.parse(getProsperityRequest),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -69,6 +69,7 @@ export * from "./getpropertiesbylocation.js";
|
|
|
69
69
|
export * from "./getpropertiesbysource.js";
|
|
70
70
|
export * from "./getpropertiesinsite.js";
|
|
71
71
|
export * from "./getpropertytiles.js";
|
|
72
|
+
export * from "./getprosperity.js";
|
|
72
73
|
export * from "./getpsc.js";
|
|
73
74
|
export * from "./getschoolbyid.js";
|
|
74
75
|
export * from "./getschoolbysource.js";
|
|
@@ -274,6 +274,7 @@ export * from "./propertyvalueimpact.js";
|
|
|
274
274
|
export * from "./prosperitydata.js";
|
|
275
275
|
export * from "./prosperitydimensionscore.js";
|
|
276
276
|
export * from "./prosperityindicator.js";
|
|
277
|
+
export * from "./prosperitylistresponse.js";
|
|
277
278
|
export * from "./provenance.js";
|
|
278
279
|
export * from "./psc.js";
|
|
279
280
|
export * from "./psclistresponse.js";
|
|
@@ -26,10 +26,6 @@ import {
|
|
|
26
26
|
PropertyAddress$inboundSchema,
|
|
27
27
|
} from "./propertyaddress.js";
|
|
28
28
|
import { PropertyTags, PropertyTags$inboundSchema } from "./propertytags.js";
|
|
29
|
-
import {
|
|
30
|
-
ProsperityData,
|
|
31
|
-
ProsperityData$inboundSchema,
|
|
32
|
-
} from "./prosperitydata.js";
|
|
33
29
|
import {
|
|
34
30
|
RefurbishmentData,
|
|
35
31
|
RefurbishmentData$inboundSchema,
|
|
@@ -471,7 +467,6 @@ export type PropertyDataApi = {
|
|
|
471
467
|
* Unique property identifier
|
|
472
468
|
*/
|
|
473
469
|
propertyId?: string | undefined;
|
|
474
|
-
prosperity?: ProsperityData | undefined;
|
|
475
470
|
refurbishment?: RefurbishmentData | undefined;
|
|
476
471
|
/**
|
|
477
472
|
* Related property IDs
|
|
@@ -884,7 +879,6 @@ export const PropertyDataApi$inboundSchema: z.ZodType<
|
|
|
884
879
|
pricing: PricingData$inboundSchema.optional(),
|
|
885
880
|
propertyCategory: z.nullable(PropertyCategory$inboundSchema).optional(),
|
|
886
881
|
propertyId: z.string().optional(),
|
|
887
|
-
prosperity: ProsperityData$inboundSchema.optional(),
|
|
888
882
|
refurbishment: RefurbishmentData$inboundSchema.optional(),
|
|
889
883
|
relationships: z.array(z.string()).optional(),
|
|
890
884
|
roomDetails: RoomDetails$inboundSchema.optional(),
|
|
@@ -84,6 +84,10 @@ export type ProsperityData = {
|
|
|
84
84
|
* Per-dimension prosperity breakdown, keyed by dimension
|
|
85
85
|
*/
|
|
86
86
|
dimensions?: Dimensions | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Small-area code this score belongs to (LSOA in England/Wales, Data Zone in Scotland, SOA in NI)
|
|
89
|
+
*/
|
|
90
|
+
geographicCode: string;
|
|
87
91
|
/**
|
|
88
92
|
* Curated array of the underlying indicators (19 ONS/MHCLG measures) that feed the dimensions
|
|
89
93
|
*/
|
|
@@ -93,7 +97,7 @@ export type ProsperityData = {
|
|
|
93
97
|
*/
|
|
94
98
|
percentile: number;
|
|
95
99
|
/**
|
|
96
|
-
* Overall prosperity score 0-100 for the
|
|
100
|
+
* Overall prosperity score 0-100 for the area
|
|
97
101
|
*/
|
|
98
102
|
score: number;
|
|
99
103
|
/**
|
|
@@ -165,6 +169,7 @@ export const ProsperityData$inboundSchema: z.ZodType<
|
|
|
165
169
|
dataQuality: DataQuality$inboundSchema,
|
|
166
170
|
decile: z.number().int(),
|
|
167
171
|
dimensions: z.lazy(() => Dimensions$inboundSchema).optional(),
|
|
172
|
+
geographicCode: z.string(),
|
|
168
173
|
indicators: z.array(ProsperityIndicator$inboundSchema).optional(),
|
|
169
174
|
percentile: z.number().int(),
|
|
170
175
|
score: z.number(),
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { remap as remap$ } from "../../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../../lib/schemas.js";
|
|
8
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
9
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
ProsperityData,
|
|
13
|
+
ProsperityData$inboundSchema,
|
|
14
|
+
} from "./prosperitydata.js";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Object type identifier
|
|
18
|
+
*/
|
|
19
|
+
export const ProsperityListResponseObject = {
|
|
20
|
+
List: "list",
|
|
21
|
+
} as const;
|
|
22
|
+
/**
|
|
23
|
+
* Object type identifier
|
|
24
|
+
*/
|
|
25
|
+
export type ProsperityListResponseObject = ClosedEnum<
|
|
26
|
+
typeof ProsperityListResponseObject
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Paginated list response
|
|
31
|
+
*/
|
|
32
|
+
export type ProsperityListResponse = {
|
|
33
|
+
/**
|
|
34
|
+
* Array of items
|
|
35
|
+
*/
|
|
36
|
+
data: Array<ProsperityData>;
|
|
37
|
+
/**
|
|
38
|
+
* Whether more items exist
|
|
39
|
+
*/
|
|
40
|
+
hasMore: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Object type identifier
|
|
43
|
+
*/
|
|
44
|
+
object: ProsperityListResponseObject;
|
|
45
|
+
/**
|
|
46
|
+
* Total number of items available
|
|
47
|
+
*/
|
|
48
|
+
totalCount?: number | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* URL of the request
|
|
51
|
+
*/
|
|
52
|
+
url: string;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
/** @internal */
|
|
56
|
+
export const ProsperityListResponseObject$inboundSchema: z.ZodNativeEnum<
|
|
57
|
+
typeof ProsperityListResponseObject
|
|
58
|
+
> = z.nativeEnum(ProsperityListResponseObject);
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export const ProsperityListResponse$inboundSchema: z.ZodType<
|
|
62
|
+
ProsperityListResponse,
|
|
63
|
+
z.ZodTypeDef,
|
|
64
|
+
unknown
|
|
65
|
+
> = z.object({
|
|
66
|
+
data: z.array(ProsperityData$inboundSchema),
|
|
67
|
+
has_more: z.boolean(),
|
|
68
|
+
object: ProsperityListResponseObject$inboundSchema,
|
|
69
|
+
total_count: z.number().optional(),
|
|
70
|
+
url: z.string(),
|
|
71
|
+
}).transform((v) => {
|
|
72
|
+
return remap$(v, {
|
|
73
|
+
"has_more": "hasMore",
|
|
74
|
+
"total_count": "totalCount",
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
export function prosperityListResponseFromJSON(
|
|
79
|
+
jsonString: string,
|
|
80
|
+
): SafeParseResult<ProsperityListResponse, SDKValidationError> {
|
|
81
|
+
return safeParse(
|
|
82
|
+
jsonString,
|
|
83
|
+
(x) => ProsperityListResponse$inboundSchema.parse(JSON.parse(x)),
|
|
84
|
+
`Failed to parse 'ProsperityListResponse' from JSON`,
|
|
85
|
+
);
|
|
86
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { prosperityGet } from "../funcs/prosperityGet.js";
|
|
6
|
+
import { ClientSDK, RequestOptions } from "../lib/sdks.js";
|
|
7
|
+
import * as operations from "./models/operations/index.js";
|
|
8
|
+
import * as shared from "./models/shared/index.js";
|
|
9
|
+
import { unwrapAsync } from "./types/fp.js";
|
|
10
|
+
|
|
11
|
+
export class Prosperity extends ClientSDK {
|
|
12
|
+
/**
|
|
13
|
+
* Get the Prosperity Index for one or more small areas
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* Returns the Vepler Prosperity Index for one or more small-area codes — a composite 0-100 economic-prosperity score with national decile (1-10) and percentile. Pass a single code (e.g. `E01000001`) or a comma-separated list (up to 100). Each result is self-describing, carrying its own `geographicCode`, so multi-code lookups can be mapped back by the caller.
|
|
17
|
+
*
|
|
18
|
+
* The score breaks down into four weighted dimensions (income, housing, employment, living standards) and the curated underlying indicators (19 ONS/MHCLG measures) that feed them, each with display value, national median/mean, percentile and source attribution. England & Wales areas also carry the ONS OAC 2021 geodemographic classification (null for Scotland and Northern Ireland, which have no OAC).
|
|
19
|
+
*
|
|
20
|
+
* Codes with no persisted score are silently omitted from the result set — a request for valid-but-unscored codes returns an empty list, not a 404.
|
|
21
|
+
*/
|
|
22
|
+
async get(
|
|
23
|
+
request: operations.GetProsperityRequest,
|
|
24
|
+
options?: RequestOptions,
|
|
25
|
+
): Promise<shared.ProsperityListResponse> {
|
|
26
|
+
return unwrapAsync(prosperityGet(
|
|
27
|
+
this,
|
|
28
|
+
request,
|
|
29
|
+
options,
|
|
30
|
+
));
|
|
31
|
+
}
|
|
32
|
+
}
|