diff --git a/.github/workflows/build-typescript.yml b/.github/workflows/build-typescript.yml new file mode 100644 index 0000000..075df7d --- /dev/null +++ b/.github/workflows/build-typescript.yml @@ -0,0 +1,38 @@ +name: Build typescript client library +on: + push: + branches: ["master"] + pull_request: + branches: ["master"] + + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # Checkout your code + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # Use the action to generate a server library + - name: Generate ASPNET Core server + uses: openapi-generators/openapitools-generator-action@b729d184e6b3459572c37c0e37f88a832e69b552 #v1.5.0 + with: + generator: typescript-fetch + openapi-file: PxAPI-2.yml + config-file: typescript-fetch-generator-config.yml + generator-tag: v7.11.0 + command-args: -o ./typescript-fetch + + - name: Check for staged changes + run: | + git diff --exit-code + + # TODO build and test with npm diff --git a/README.md b/README.md index 8ee404b..2fcce94 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,18 @@ Documentation for the PxApi When creating a PR for updatedating [PxAPI-2.yml](PxAPI-2.yml) please use the following command to also include changes in generated server code. +ASP.NET Core 8.0 Server + ```sh docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v7.11.0 generate -i /local/PxAPI-2.yml -g aspnetcore -c /local/aspnetcore-generator-config.yml -o /local ``` +TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/) + +```sh +docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli:v7.11.0 generate -i /local/PxAPI-2.yml -g typescript-fetch -c /local/typescript-fetch-generator-config.yml -o /local/typescript-fetch +``` + Replace `${PWD}` with `$(pwd)` when running on Linux ## PxWeb.Api2.Server - ASP.NET Core 8.0 Server diff --git a/typescript-fetch-generator-config.yml b/typescript-fetch-generator-config.yml new file mode 100644 index 0000000..99bb37f --- /dev/null +++ b/typescript-fetch-generator-config.yml @@ -0,0 +1,6 @@ +additionalProperties: + licenseName: Apache-2.0 + npmName: pxwebapi-client + #npmRepository: + npmVersion: 0.0.1 + snapshot: false diff --git a/typescript-fetch/.gitignore b/typescript-fetch/.gitignore new file mode 100644 index 0000000..149b576 --- /dev/null +++ b/typescript-fetch/.gitignore @@ -0,0 +1,4 @@ +wwwroot/*.js +node_modules +typings +dist diff --git a/typescript-fetch/.npmignore b/typescript-fetch/.npmignore new file mode 100644 index 0000000..42061c0 --- /dev/null +++ b/typescript-fetch/.npmignore @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/typescript-fetch/.openapi-generator-ignore b/typescript-fetch/.openapi-generator-ignore new file mode 100644 index 0000000..2000c19 --- /dev/null +++ b/typescript-fetch/.openapi-generator-ignore @@ -0,0 +1,24 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md +package.json diff --git a/typescript-fetch/.openapi-generator/FILES b/typescript-fetch/.openapi-generator/FILES new file mode 100644 index 0000000..2fa74ce --- /dev/null +++ b/typescript-fetch/.openapi-generator/FILES @@ -0,0 +1,60 @@ +.gitignore +.npmignore +README.md +src/apis/ConfigurationApi.ts +src/apis/NavigationApi.ts +src/apis/SavedQueriesApi.ts +src/apis/TableApi.ts +src/apis/index.ts +src/index.ts +src/models/Adjustment.ts +src/models/ApiFeature.ts +src/models/ClassType.ts +src/models/CodeListInformation.ts +src/models/CodeListMetadata.ts +src/models/CodeListResponse.ts +src/models/CodeListType.ts +src/models/CodeListsResponse.ts +src/models/ConfigResponse.ts +src/models/Contact.ts +src/models/Dataset.ts +src/models/DimensionExtension.ts +src/models/DimensionValue.ts +src/models/ExtensionDimension.ts +src/models/ExtensionRoot.ts +src/models/ExtensionRootPx.ts +src/models/FolderContentItem.ts +src/models/FolderContentItemTypeEnum.ts +src/models/FolderInformation.ts +src/models/FolderResponse.ts +src/models/Heading.ts +src/models/JsonstatCategory.ts +src/models/JsonstatCategoryUnitValue.ts +src/models/JsonstatExtensionLink.ts +src/models/JsonstatLink.ts +src/models/KeyValuePair.ts +src/models/Language.ts +src/models/Link.ts +src/models/MeasuringType.ts +src/models/Note.ts +src/models/OutputFormatParamType.ts +src/models/OutputFormatType.ts +src/models/PageInfo.ts +src/models/PathElement.ts +src/models/PriceType.ts +src/models/Problem.ts +src/models/Role.ts +src/models/SavedQuery.ts +src/models/SelectionResponse.ts +src/models/SourceReference.ts +src/models/Table.ts +src/models/TableResponse.ts +src/models/TablesResponse.ts +src/models/TimeUnit.ts +src/models/ValueMap.ts +src/models/VariablePlacementType.ts +src/models/VariableSelection.ts +src/models/VariablesSelection.ts +src/models/index.ts +src/runtime.ts +tsconfig.json diff --git a/typescript-fetch/.openapi-generator/VERSION b/typescript-fetch/.openapi-generator/VERSION new file mode 100644 index 0000000..b23eb27 --- /dev/null +++ b/typescript-fetch/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.11.0 diff --git a/typescript-fetch/README.md b/typescript-fetch/README.md new file mode 100644 index 0000000..0b3ed8d --- /dev/null +++ b/typescript-fetch/README.md @@ -0,0 +1,46 @@ +## pxwebapi-client@0.0.1 + +This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run `npm publish` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install pxwebapi-client@0.0.1 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save +``` diff --git a/typescript-fetch/package-lock.json b/typescript-fetch/package-lock.json new file mode 100644 index 0000000..473b4b5 --- /dev/null +++ b/typescript-fetch/package-lock.json @@ -0,0 +1,30 @@ +{ + "name": "pxwebapi-client", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "pxwebapi-client", + "version": "0.0.1", + "license": "Apache-2.0", + "devDependencies": { + "typescript": "^4.0 || ^5.0" + } + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + } + } +} diff --git a/typescript-fetch/package.json b/typescript-fetch/package.json new file mode 100644 index 0000000..647d2da --- /dev/null +++ b/typescript-fetch/package.json @@ -0,0 +1,20 @@ +{ + "name": "pxwebapi-client", + "version": "0.0.1", + "description": "OpenAPI client for PxWebApi 2.0", + "author": "OpenAPI-Generator", + "repository": { + "type": "git", + "url": "https://github.com/PxTools/PxApiSpecs.git" + }, + "license": "Apache-2.0", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts": { + "build": "tsc", + "prepare": "npm run build" + }, + "devDependencies": { + "typescript": "^4.0 || ^5.0" + } +} diff --git a/typescript-fetch/src/apis/ConfigurationApi.ts b/typescript-fetch/src/apis/ConfigurationApi.ts new file mode 100644 index 0000000..f2283c5 --- /dev/null +++ b/typescript-fetch/src/apis/ConfigurationApi.ts @@ -0,0 +1,59 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + ConfigResponse, + Problem, +} from '../models/index'; +import { + ConfigResponseFromJSON, + ConfigResponseToJSON, + ProblemFromJSON, + ProblemToJSON, +} from '../models/index'; + +/** + * + */ +export class ConfigurationApi extends runtime.BaseAPI { + + /** + * Get API configuration settings. + */ + async getApiConfigurationRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/config`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => ConfigResponseFromJSON(jsonValue)); + } + + /** + * Get API configuration settings. + */ + async getApiConfiguration(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getApiConfigurationRaw(initOverrides); + return await response.value(); + } + +} diff --git a/typescript-fetch/src/apis/NavigationApi.ts b/typescript-fetch/src/apis/NavigationApi.ts new file mode 100644 index 0000000..c0eb44a --- /dev/null +++ b/typescript-fetch/src/apis/NavigationApi.ts @@ -0,0 +1,109 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + FolderResponse, + Problem, +} from '../models/index'; +import { + FolderResponseFromJSON, + FolderResponseToJSON, + ProblemFromJSON, + ProblemToJSON, +} from '../models/index'; + +export interface GetNavigationByIdRequest { + id: string; + lang?: string | null; +} + +export interface GetNavigationRootRequest { + lang?: string | null; +} + +/** + * + */ +export class NavigationApi extends runtime.BaseAPI { + + /** + * Gets Folder by {id}. + */ + async getNavigationByIdRaw(requestParameters: GetNavigationByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getNavigationById().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/navigation/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => FolderResponseFromJSON(jsonValue)); + } + + /** + * Gets Folder by {id}. + */ + async getNavigationById(requestParameters: GetNavigationByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getNavigationByIdRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Get root Folder. + */ + async getNavigationRootRaw(requestParameters: GetNavigationRootRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/navigation`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => FolderResponseFromJSON(jsonValue)); + } + + /** + * Get root Folder. + */ + async getNavigationRoot(requestParameters: GetNavigationRootRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getNavigationRootRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/typescript-fetch/src/apis/SavedQueriesApi.ts b/typescript-fetch/src/apis/SavedQueriesApi.ts new file mode 100644 index 0000000..b3a4fd3 --- /dev/null +++ b/typescript-fetch/src/apis/SavedQueriesApi.ts @@ -0,0 +1,165 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + OutputFormatParamType, + OutputFormatType, + Problem, + SavedQuery, +} from '../models/index'; +import { + OutputFormatParamTypeFromJSON, + OutputFormatParamTypeToJSON, + OutputFormatTypeFromJSON, + OutputFormatTypeToJSON, + ProblemFromJSON, + ProblemToJSON, + SavedQueryFromJSON, + SavedQueryToJSON, +} from '../models/index'; + +export interface CreateSaveQueryRequest { + savedQuery?: SavedQuery; +} + +export interface GetSaveQueryRequest { + id: string; +} + +export interface RunSaveQueryRequest { + id: string; + lang?: string | null; + outputFormat?: OutputFormatType; + outputFormatParams?: Array; +} + +/** + * + */ +export class SavedQueriesApi extends runtime.BaseAPI { + + /** + * Save a query for later use. + */ + async createSaveQueryRaw(requestParameters: CreateSaveQueryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request({ + path: `/savedqueries`, + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: SavedQueryToJSON(requestParameters['savedQuery']), + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => SavedQueryFromJSON(jsonValue)); + } + + /** + * Save a query for later use. + */ + async createSaveQuery(requestParameters: CreateSaveQueryRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.createSaveQueryRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Retrieves the content of a saved query. + */ + async getSaveQueryRaw(requestParameters: GetSaveQueryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getSaveQuery().' + ); + } + + const queryParameters: any = {}; + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/savedqueries/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => SavedQueryFromJSON(jsonValue)); + } + + /** + * Retrieves the content of a saved query. + */ + async getSaveQuery(requestParameters: GetSaveQueryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getSaveQueryRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Retrieves the data by running the saved query. + */ + async runSaveQueryRaw(requestParameters: RunSaveQueryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling runSaveQuery().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + if (requestParameters['outputFormat'] != null) { + queryParameters['outputFormat'] = requestParameters['outputFormat']; + } + + if (requestParameters['outputFormatParams'] != null) { + queryParameters['outputFormatParams'] = requestParameters['outputFormatParams']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/savedqueries/{id}/data`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } + } + + /** + * Retrieves the data by running the saved query. + */ + async runSaveQuery(requestParameters: RunSaveQueryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.runSaveQueryRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/typescript-fetch/src/apis/TableApi.ts b/typescript-fetch/src/apis/TableApi.ts new file mode 100644 index 0000000..ada3a11 --- /dev/null +++ b/typescript-fetch/src/apis/TableApi.ts @@ -0,0 +1,426 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as runtime from '../runtime'; +import type { + CodeListResponse, + Dataset, + OutputFormatParamType, + OutputFormatType, + Problem, + SelectionResponse, + TableResponse, + TablesResponse, + VariablesSelection, +} from '../models/index'; +import { + CodeListResponseFromJSON, + CodeListResponseToJSON, + DatasetFromJSON, + DatasetToJSON, + OutputFormatParamTypeFromJSON, + OutputFormatParamTypeToJSON, + OutputFormatTypeFromJSON, + OutputFormatTypeToJSON, + ProblemFromJSON, + ProblemToJSON, + SelectionResponseFromJSON, + SelectionResponseToJSON, + TableResponseFromJSON, + TableResponseToJSON, + TablesResponseFromJSON, + TablesResponseToJSON, + VariablesSelectionFromJSON, + VariablesSelectionToJSON, +} from '../models/index'; + +export interface GetDefaultSelectionRequest { + id: string; + lang?: string | null; +} + +export interface GetMetadataByIdRequest { + id: string; + lang?: string | null; + defaultSelection?: boolean; +} + +export interface GetTableByIdRequest { + id: string; + lang?: string | null; +} + +export interface GetTableCodeListByIdRequest { + id: string; + lang?: string | null; +} + +export interface GetTableDataRequest { + id: string; + lang?: string | null; + valuecodes?: { [key: string]: Array; }; + codelist?: { [key: string]: string; }; + outputFormat?: OutputFormatType; + outputFormatParams?: Array; + heading?: Array; + stub?: Array; +} + +export interface GetTableDataByPostRequest { + id: string; + lang?: string | null; + outputFormat?: OutputFormatType; + outputFormatParams?: Array; + variablesSelection?: VariablesSelection; +} + +export interface ListAllTablesRequest { + lang?: string | null; + query?: string; + pastDays?: number; + includeDiscontinued?: boolean; + pageNumber?: number; + pageSize?: number; +} + +/** + * + */ +export class TableApi extends runtime.BaseAPI { + + /** + * Get information about what is selected for the table by default when no selection is made i the /data endpoint. + * Get the default selection for Table by {id}. + */ + async getDefaultSelectionRaw(requestParameters: GetDefaultSelectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getDefaultSelection().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/tables/{id}/defaultselection`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => SelectionResponseFromJSON(jsonValue)); + } + + /** + * Get information about what is selected for the table by default when no selection is made i the /data endpoint. + * Get the default selection for Table by {id}. + */ + async getDefaultSelection(requestParameters: GetDefaultSelectionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getDefaultSelectionRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * **Used for listing detailed information about a specific table** * List all variables and values and all other metadata needed to be able to fetch data * Also links to where to: + Fetch - Where to get information about codelists * 2 output formats + Custom json - JSON-stat2 + * Get Metadata about Table by {id}. + */ + async getMetadataByIdRaw(requestParameters: GetMetadataByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getMetadataById().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + if (requestParameters['defaultSelection'] != null) { + queryParameters['defaultSelection'] = requestParameters['defaultSelection']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/tables/{id}/metadata`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => DatasetFromJSON(jsonValue)); + } + + /** + * **Used for listing detailed information about a specific table** * List all variables and values and all other metadata needed to be able to fetch data * Also links to where to: + Fetch - Where to get information about codelists * 2 output formats + Custom json - JSON-stat2 + * Get Metadata about Table by {id}. + */ + async getMetadataById(requestParameters: GetMetadataByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getMetadataByIdRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Get Table by {id}. + */ + async getTableByIdRaw(requestParameters: GetTableByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getTableById().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/tables/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => TableResponseFromJSON(jsonValue)); + } + + /** + * Get Table by {id}. + */ + async getTableById(requestParameters: GetTableByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTableByIdRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Get Codelist by {id}. + */ + async getTableCodeListByIdRaw(requestParameters: GetTableCodeListByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getTableCodeListById().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/codelists/{id}`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => CodeListResponseFromJSON(jsonValue)); + } + + /** + * Get Codelist by {id}. + */ + async getTableCodeListById(requestParameters: GetTableCodeListByIdRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTableCodeListByIdRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Get data from table by {id}. + */ + async getTableDataRaw(requestParameters: GetTableDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getTableData().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + if (requestParameters['valuecodes'] != null) { + queryParameters['valuecodes'] = requestParameters['valuecodes']; + } + + if (requestParameters['codelist'] != null) { + queryParameters['codelist'] = requestParameters['codelist']; + } + + if (requestParameters['outputFormat'] != null) { + queryParameters['outputFormat'] = requestParameters['outputFormat']; + } + + if (requestParameters['outputFormatParams'] != null) { + queryParameters['outputFormatParams'] = requestParameters['outputFormatParams']; + } + + if (requestParameters['heading'] != null) { + queryParameters['heading'] = requestParameters['heading']!.join(runtime.COLLECTION_FORMATS["csv"]); + } + + if (requestParameters['stub'] != null) { + queryParameters['stub'] = requestParameters['stub']!.join(runtime.COLLECTION_FORMATS["csv"]); + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/tables/{id}/data`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } + } + + /** + * Get data from table by {id}. + */ + async getTableData(requestParameters: GetTableDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTableDataRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Get data from table by {id}. + */ + async getTableDataByPostRaw(requestParameters: GetTableDataByPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + if (requestParameters['id'] == null) { + throw new runtime.RequiredError( + 'id', + 'Required parameter "id" was null or undefined when calling getTableDataByPost().' + ); + } + + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + if (requestParameters['outputFormat'] != null) { + queryParameters['outputFormat'] = requestParameters['outputFormat']; + } + + if (requestParameters['outputFormatParams'] != null) { + queryParameters['outputFormatParams'] = requestParameters['outputFormatParams']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + headerParameters['Content-Type'] = 'application/json'; + + const response = await this.request({ + path: `/tables/{id}/data`.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id']))), + method: 'POST', + headers: headerParameters, + query: queryParameters, + body: VariablesSelectionToJSON(requestParameters['variablesSelection']), + }, initOverrides); + + if (this.isJsonMime(response.headers.get('content-type'))) { + return new runtime.JSONApiResponse(response); + } else { + return new runtime.TextApiResponse(response) as any; + } + } + + /** + * Get data from table by {id}. + */ + async getTableDataByPost(requestParameters: GetTableDataByPostRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.getTableDataByPostRaw(requestParameters, initOverrides); + return await response.value(); + } + + /** + * Get all Tables. + */ + async listAllTablesRaw(requestParameters: ListAllTablesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { + const queryParameters: any = {}; + + if (requestParameters['lang'] != null) { + queryParameters['lang'] = requestParameters['lang']; + } + + if (requestParameters['query'] != null) { + queryParameters['query'] = requestParameters['query']; + } + + if (requestParameters['pastDays'] != null) { + queryParameters['pastDays'] = requestParameters['pastDays']; + } + + if (requestParameters['includeDiscontinued'] != null) { + queryParameters['includeDiscontinued'] = requestParameters['includeDiscontinued']; + } + + if (requestParameters['pageNumber'] != null) { + queryParameters['pageNumber'] = requestParameters['pageNumber']; + } + + if (requestParameters['pageSize'] != null) { + queryParameters['pageSize'] = requestParameters['pageSize']; + } + + const headerParameters: runtime.HTTPHeaders = {}; + + const response = await this.request({ + path: `/tables`, + method: 'GET', + headers: headerParameters, + query: queryParameters, + }, initOverrides); + + return new runtime.JSONApiResponse(response, (jsonValue) => TablesResponseFromJSON(jsonValue)); + } + + /** + * Get all Tables. + */ + async listAllTables(requestParameters: ListAllTablesRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { + const response = await this.listAllTablesRaw(requestParameters, initOverrides); + return await response.value(); + } + +} diff --git a/typescript-fetch/src/apis/index.ts b/typescript-fetch/src/apis/index.ts new file mode 100644 index 0000000..40bc602 --- /dev/null +++ b/typescript-fetch/src/apis/index.ts @@ -0,0 +1,6 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './ConfigurationApi'; +export * from './NavigationApi'; +export * from './SavedQueriesApi'; +export * from './TableApi'; diff --git a/typescript-fetch/src/index.ts b/typescript-fetch/src/index.ts new file mode 100644 index 0000000..bebe8bb --- /dev/null +++ b/typescript-fetch/src/index.ts @@ -0,0 +1,5 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './runtime'; +export * from './apis/index'; +export * from './models/index'; diff --git a/typescript-fetch/src/models/Adjustment.ts b/typescript-fetch/src/models/Adjustment.ts new file mode 100644 index 0000000..46177ad --- /dev/null +++ b/typescript-fetch/src/models/Adjustment.ts @@ -0,0 +1,55 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * WorkOnly means that data is adjusted e.g. to take into account the number of working days. SesOnly means that data is seasonally adjusted. + * @export + */ +export const Adjustment = { + None: 'None', + SesOnly: 'SesOnly', + WorkOnly: 'WorkOnly', + WorkAndSes: 'WorkAndSes' +} as const; +export type Adjustment = typeof Adjustment[keyof typeof Adjustment]; + + +export function instanceOfAdjustment(value: any): boolean { + for (const key in Adjustment) { + if (Object.prototype.hasOwnProperty.call(Adjustment, key)) { + if (Adjustment[key as keyof typeof Adjustment] === value) { + return true; + } + } + } + return false; +} + +export function AdjustmentFromJSON(json: any): Adjustment { + return AdjustmentFromJSONTyped(json, false); +} + +export function AdjustmentFromJSONTyped(json: any, ignoreDiscriminator: boolean): Adjustment { + return json as Adjustment; +} + +export function AdjustmentToJSON(value?: Adjustment | null): any { + return value as any; +} + +export function AdjustmentToJSONTyped(value: any, ignoreDiscriminator: boolean): Adjustment { + return value as Adjustment; +} + diff --git a/typescript-fetch/src/models/ApiFeature.ts b/typescript-fetch/src/models/ApiFeature.ts new file mode 100644 index 0000000..746abb6 --- /dev/null +++ b/typescript-fetch/src/models/ApiFeature.ts @@ -0,0 +1,82 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { KeyValuePair } from './KeyValuePair'; +import { + KeyValuePairFromJSON, + KeyValuePairFromJSONTyped, + KeyValuePairToJSON, + KeyValuePairToJSONTyped, +} from './KeyValuePair'; + +/** + * + * @export + * @interface ApiFeature + */ +export interface ApiFeature { + /** + * The identifyer for the feature + * @type {string} + * @memberof ApiFeature + */ + id: string; + /** + * + * @type {Array} + * @memberof ApiFeature + */ + params?: Array; +} + +/** + * Check if a given object implements the ApiFeature interface. + */ +export function instanceOfApiFeature(value: object): value is ApiFeature { + if (!('id' in value) || value['id'] === undefined) return false; + return true; +} + +export function ApiFeatureFromJSON(json: any): ApiFeature { + return ApiFeatureFromJSONTyped(json, false); +} + +export function ApiFeatureFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiFeature { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'params': json['params'] == null ? undefined : ((json['params'] as Array).map(KeyValuePairFromJSON)), + }; +} + +export function ApiFeatureToJSON(json: any): ApiFeature { + return ApiFeatureToJSONTyped(json, false); +} + +export function ApiFeatureToJSONTyped(value?: ApiFeature | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'params': value['params'] == null ? undefined : ((value['params'] as Array).map(KeyValuePairToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/ClassType.ts b/typescript-fetch/src/models/ClassType.ts new file mode 100644 index 0000000..dd04f3f --- /dev/null +++ b/typescript-fetch/src/models/ClassType.ts @@ -0,0 +1,52 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Is always dataset + * @export + */ +export const ClassType = { + Dataset: 'dataset' +} as const; +export type ClassType = typeof ClassType[keyof typeof ClassType]; + + +export function instanceOfClassType(value: any): boolean { + for (const key in ClassType) { + if (Object.prototype.hasOwnProperty.call(ClassType, key)) { + if (ClassType[key as keyof typeof ClassType] === value) { + return true; + } + } + } + return false; +} + +export function ClassTypeFromJSON(json: any): ClassType { + return ClassTypeFromJSONTyped(json, false); +} + +export function ClassTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ClassType { + return json as ClassType; +} + +export function ClassTypeToJSON(value?: ClassType | null): any { + return value as any; +} + +export function ClassTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): ClassType { + return value as ClassType; +} + diff --git a/typescript-fetch/src/models/CodeListInformation.ts b/typescript-fetch/src/models/CodeListInformation.ts new file mode 100644 index 0000000..268e6d2 --- /dev/null +++ b/typescript-fetch/src/models/CodeListInformation.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { CodeListType } from './CodeListType'; +import { + CodeListTypeFromJSON, + CodeListTypeFromJSONTyped, + CodeListTypeToJSON, + CodeListTypeToJSONTyped, +} from './CodeListType'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface CodeListInformation + */ +export interface CodeListInformation { + /** + * The identity of the CodeList + * @type {string} + * @memberof CodeListInformation + */ + id: string; + /** + * A textual name for the CodeList + * @type {string} + * @memberof CodeListInformation + */ + label: string; + /** + * + * @type {CodeListType} + * @memberof CodeListInformation + */ + type: CodeListType; + /** + * Links to associated information about the code list + * @type {Array} + * @memberof CodeListInformation + */ + links: Array; +} + + + +/** + * Check if a given object implements the CodeListInformation interface. + */ +export function instanceOfCodeListInformation(value: object): value is CodeListInformation { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('links' in value) || value['links'] === undefined) return false; + return true; +} + +export function CodeListInformationFromJSON(json: any): CodeListInformation { + return CodeListInformationFromJSONTyped(json, false); +} + +export function CodeListInformationFromJSONTyped(json: any, ignoreDiscriminator: boolean): CodeListInformation { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'label': json['label'], + 'type': CodeListTypeFromJSON(json['type']), + 'links': ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function CodeListInformationToJSON(json: any): CodeListInformation { + return CodeListInformationToJSONTyped(json, false); +} + +export function CodeListInformationToJSONTyped(value?: CodeListInformation | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'label': value['label'], + 'type': CodeListTypeToJSON(value['type']), + 'links': ((value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/CodeListMetadata.ts b/typescript-fetch/src/models/CodeListMetadata.ts new file mode 100644 index 0000000..44862d0 --- /dev/null +++ b/typescript-fetch/src/models/CodeListMetadata.ts @@ -0,0 +1,110 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { CodeListType } from './CodeListType'; +import { + CodeListTypeFromJSON, + CodeListTypeFromJSONTyped, + CodeListTypeToJSON, + CodeListTypeToJSONTyped, +} from './CodeListType'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface CodeListMetadata + */ +export interface CodeListMetadata { + /** + * The identiyer for the codelist + * @type {string} + * @memberof CodeListMetadata + */ + id: string; + /** + * The textual name for the codelist. + * @type {string} + * @memberof CodeListMetadata + */ + label: string; + /** + * + * @type {CodeListType} + * @memberof CodeListMetadata + */ + type: CodeListType; + /** + * + * @type {Array} + * @memberof CodeListMetadata + */ + links: Array; +} + + + +/** + * Check if a given object implements the CodeListMetadata interface. + */ +export function instanceOfCodeListMetadata(value: object): value is CodeListMetadata { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('links' in value) || value['links'] === undefined) return false; + return true; +} + +export function CodeListMetadataFromJSON(json: any): CodeListMetadata { + return CodeListMetadataFromJSONTyped(json, false); +} + +export function CodeListMetadataFromJSONTyped(json: any, ignoreDiscriminator: boolean): CodeListMetadata { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'label': json['label'], + 'type': CodeListTypeFromJSON(json['type']), + 'links': ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function CodeListMetadataToJSON(json: any): CodeListMetadata { + return CodeListMetadataToJSONTyped(json, false); +} + +export function CodeListMetadataToJSONTyped(value?: CodeListMetadata | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'label': value['label'], + 'type': CodeListTypeToJSON(value['type']), + 'links': ((value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/CodeListResponse.ts b/typescript-fetch/src/models/CodeListResponse.ts new file mode 100644 index 0000000..61931be --- /dev/null +++ b/typescript-fetch/src/models/CodeListResponse.ts @@ -0,0 +1,160 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { CodeListType } from './CodeListType'; +import { + CodeListTypeFromJSON, + CodeListTypeFromJSONTyped, + CodeListTypeToJSON, + CodeListTypeToJSONTyped, +} from './CodeListType'; +import type { ValueMap } from './ValueMap'; +import { + ValueMapFromJSON, + ValueMapFromJSONTyped, + ValueMapToJSON, + ValueMapToJSONTyped, +} from './ValueMap'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface CodeListResponse + */ +export interface CodeListResponse { + /** + * The identiyer for the codelist + * @type {string} + * @memberof CodeListResponse + */ + id: string; + /** + * The textual name for the codelist. + * @type {string} + * @memberof CodeListResponse + */ + label: string; + /** + * The language code for the language used in this response + * @type {string} + * @memberof CodeListResponse + */ + language: string; + /** + * The languages that the codelist is available in + * @type {Array} + * @memberof CodeListResponse + */ + languages: Array; + /** + * If the codelist is eliminatable + * @type {boolean} + * @memberof CodeListResponse + */ + elimination?: boolean; + /** + * The value code that should be used for elimination. If not set the variable will be eliminated by summing up all values. + * @type {string} + * @memberof CodeListResponse + */ + eliminationValueCode?: string; + /** + * + * @type {CodeListType} + * @memberof CodeListResponse + */ + type: CodeListType; + /** + * + * @type {Array} + * @memberof CodeListResponse + */ + values: Array; + /** + * + * @type {Array} + * @memberof CodeListResponse + */ + links: Array; +} + + + +/** + * Check if a given object implements the CodeListResponse interface. + */ +export function instanceOfCodeListResponse(value: object): value is CodeListResponse { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + if (!('language' in value) || value['language'] === undefined) return false; + if (!('languages' in value) || value['languages'] === undefined) return false; + if (!('type' in value) || value['type'] === undefined) return false; + if (!('values' in value) || value['values'] === undefined) return false; + if (!('links' in value) || value['links'] === undefined) return false; + return true; +} + +export function CodeListResponseFromJSON(json: any): CodeListResponse { + return CodeListResponseFromJSONTyped(json, false); +} + +export function CodeListResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CodeListResponse { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'label': json['label'], + 'language': json['language'], + 'languages': json['languages'], + 'elimination': json['elimination'] == null ? undefined : json['elimination'], + 'eliminationValueCode': json['eliminationValueCode'] == null ? undefined : json['eliminationValueCode'], + 'type': CodeListTypeFromJSON(json['type']), + 'values': ((json['values'] as Array).map(ValueMapFromJSON)), + 'links': ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function CodeListResponseToJSON(json: any): CodeListResponse { + return CodeListResponseToJSONTyped(json, false); +} + +export function CodeListResponseToJSONTyped(value?: CodeListResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'label': value['label'], + 'language': value['language'], + 'languages': value['languages'], + 'elimination': value['elimination'], + 'eliminationValueCode': value['eliminationValueCode'], + 'type': CodeListTypeToJSON(value['type']), + 'values': ((value['values'] as Array).map(ValueMapToJSON)), + 'links': ((value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/CodeListType.ts b/typescript-fetch/src/models/CodeListType.ts new file mode 100644 index 0000000..8bd3191 --- /dev/null +++ b/typescript-fetch/src/models/CodeListType.ts @@ -0,0 +1,53 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Type of codelist + * @export + */ +export const CodeListType = { + Aggregation: 'Aggregation', + Valueset: 'Valueset' +} as const; +export type CodeListType = typeof CodeListType[keyof typeof CodeListType]; + + +export function instanceOfCodeListType(value: any): boolean { + for (const key in CodeListType) { + if (Object.prototype.hasOwnProperty.call(CodeListType, key)) { + if (CodeListType[key as keyof typeof CodeListType] === value) { + return true; + } + } + } + return false; +} + +export function CodeListTypeFromJSON(json: any): CodeListType { + return CodeListTypeFromJSONTyped(json, false); +} + +export function CodeListTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): CodeListType { + return json as CodeListType; +} + +export function CodeListTypeToJSON(value?: CodeListType | null): any { + return value as any; +} + +export function CodeListTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): CodeListType { + return value as CodeListType; +} + diff --git a/typescript-fetch/src/models/CodeListsResponse.ts b/typescript-fetch/src/models/CodeListsResponse.ts new file mode 100644 index 0000000..63ea751 --- /dev/null +++ b/typescript-fetch/src/models/CodeListsResponse.ts @@ -0,0 +1,97 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { CodeListMetadata } from './CodeListMetadata'; +import { + CodeListMetadataFromJSON, + CodeListMetadataFromJSONTyped, + CodeListMetadataToJSON, + CodeListMetadataToJSONTyped, +} from './CodeListMetadata'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface CodeListsResponse + */ +export interface CodeListsResponse { + /** + * The language code for the language used in this response + * @type {string} + * @memberof CodeListsResponse + */ + language: string; + /** + * + * @type {Array} + * @memberof CodeListsResponse + */ + codeLists?: Array; + /** + * + * @type {Array} + * @memberof CodeListsResponse + */ + links?: Array; +} + +/** + * Check if a given object implements the CodeListsResponse interface. + */ +export function instanceOfCodeListsResponse(value: object): value is CodeListsResponse { + if (!('language' in value) || value['language'] === undefined) return false; + return true; +} + +export function CodeListsResponseFromJSON(json: any): CodeListsResponse { + return CodeListsResponseFromJSONTyped(json, false); +} + +export function CodeListsResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): CodeListsResponse { + if (json == null) { + return json; + } + return { + + 'language': json['language'], + 'codeLists': json['codeLists'] == null ? undefined : ((json['codeLists'] as Array).map(CodeListMetadataFromJSON)), + 'links': json['links'] == null ? undefined : ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function CodeListsResponseToJSON(json: any): CodeListsResponse { + return CodeListsResponseToJSONTyped(json, false); +} + +export function CodeListsResponseToJSONTyped(value?: CodeListsResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'language': value['language'], + 'codeLists': value['codeLists'] == null ? undefined : ((value['codeLists'] as Array).map(CodeListMetadataToJSON)), + 'links': value['links'] == null ? undefined : ((value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/ConfigResponse.ts b/typescript-fetch/src/models/ConfigResponse.ts new file mode 100644 index 0000000..77c7d3d --- /dev/null +++ b/typescript-fetch/src/models/ConfigResponse.ts @@ -0,0 +1,185 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { ApiFeature } from './ApiFeature'; +import { + ApiFeatureFromJSON, + ApiFeatureFromJSONTyped, + ApiFeatureToJSON, + ApiFeatureToJSONTyped, +} from './ApiFeature'; +import type { SourceReference } from './SourceReference'; +import { + SourceReferenceFromJSON, + SourceReferenceFromJSONTyped, + SourceReferenceToJSON, + SourceReferenceToJSONTyped, +} from './SourceReference'; +import type { Language } from './Language'; +import { + LanguageFromJSON, + LanguageFromJSONTyped, + LanguageToJSON, + LanguageToJSONTyped, +} from './Language'; + +/** + * API configuration + * @export + * @interface ConfigResponse + */ +export interface ConfigResponse { + /** + * The version of the API spesification + * @type {string} + * @memberof ConfigResponse + */ + apiVersion: string; + /** + * The version of the API implementation + * @type {string} + * @memberof ConfigResponse + */ + appVersion: string; + /** + * A list of language that exists for the data. + * @type {Array} + * @memberof ConfigResponse + */ + languages: Array; + /** + * The id of the language that is the default language. + * @type {string} + * @memberof ConfigResponse + */ + defaultLanguage: string; + /** + * A threshold of how many datacells that can be fetched in a single API call + * @type {number} + * @memberof ConfigResponse + */ + maxDataCells: number; + /** + * The maximum number of call to the API for a time window indicated by timeWindow. + * @type {number} + * @memberof ConfigResponse + */ + maxCallsPerTimeWindow: number; + /** + * The time window restricting how many call that can be done. + * @type {number} + * @memberof ConfigResponse + */ + timeWindow: number; + /** + * The license that the data is provided. + * @type {string} + * @memberof ConfigResponse + */ + license: string; + /** + * A list of how the data should be cite for diffrent languages. + * @type {Array} + * @memberof ConfigResponse + */ + sourceReferences?: Array; + /** + * The default data format to used when no format is specified in the request. + * @type {string} + * @memberof ConfigResponse + */ + defaultDataFormat: string; + /** + * List of available data formts for fetching data in. + * @type {Array} + * @memberof ConfigResponse + */ + dataFormats: Array; + /** + * A list of features for the API + * @type {Array} + * @memberof ConfigResponse + */ + features?: Array; +} + +/** + * Check if a given object implements the ConfigResponse interface. + */ +export function instanceOfConfigResponse(value: object): value is ConfigResponse { + if (!('apiVersion' in value) || value['apiVersion'] === undefined) return false; + if (!('appVersion' in value) || value['appVersion'] === undefined) return false; + if (!('languages' in value) || value['languages'] === undefined) return false; + if (!('defaultLanguage' in value) || value['defaultLanguage'] === undefined) return false; + if (!('maxDataCells' in value) || value['maxDataCells'] === undefined) return false; + if (!('maxCallsPerTimeWindow' in value) || value['maxCallsPerTimeWindow'] === undefined) return false; + if (!('timeWindow' in value) || value['timeWindow'] === undefined) return false; + if (!('license' in value) || value['license'] === undefined) return false; + if (!('defaultDataFormat' in value) || value['defaultDataFormat'] === undefined) return false; + if (!('dataFormats' in value) || value['dataFormats'] === undefined) return false; + return true; +} + +export function ConfigResponseFromJSON(json: any): ConfigResponse { + return ConfigResponseFromJSONTyped(json, false); +} + +export function ConfigResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): ConfigResponse { + if (json == null) { + return json; + } + return { + + 'apiVersion': json['apiVersion'], + 'appVersion': json['appVersion'], + 'languages': ((json['languages'] as Array).map(LanguageFromJSON)), + 'defaultLanguage': json['defaultLanguage'], + 'maxDataCells': json['maxDataCells'], + 'maxCallsPerTimeWindow': json['maxCallsPerTimeWindow'], + 'timeWindow': json['timeWindow'], + 'license': json['license'], + 'sourceReferences': json['sourceReferences'] == null ? undefined : ((json['sourceReferences'] as Array).map(SourceReferenceFromJSON)), + 'defaultDataFormat': json['defaultDataFormat'], + 'dataFormats': json['dataFormats'], + 'features': json['features'] == null ? undefined : ((json['features'] as Array).map(ApiFeatureFromJSON)), + }; +} + +export function ConfigResponseToJSON(json: any): ConfigResponse { + return ConfigResponseToJSONTyped(json, false); +} + +export function ConfigResponseToJSONTyped(value?: ConfigResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'apiVersion': value['apiVersion'], + 'appVersion': value['appVersion'], + 'languages': ((value['languages'] as Array).map(LanguageToJSON)), + 'defaultLanguage': value['defaultLanguage'], + 'maxDataCells': value['maxDataCells'], + 'maxCallsPerTimeWindow': value['maxCallsPerTimeWindow'], + 'timeWindow': value['timeWindow'], + 'license': value['license'], + 'sourceReferences': value['sourceReferences'] == null ? undefined : ((value['sourceReferences'] as Array).map(SourceReferenceToJSON)), + 'defaultDataFormat': value['defaultDataFormat'], + 'dataFormats': value['dataFormats'], + 'features': value['features'] == null ? undefined : ((value['features'] as Array).map(ApiFeatureToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/Contact.ts b/typescript-fetch/src/models/Contact.ts new file mode 100644 index 0000000..0cf4181 --- /dev/null +++ b/typescript-fetch/src/models/Contact.ts @@ -0,0 +1,98 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface Contact + */ +export interface Contact { + /** + * + * @type {string} + * @memberof Contact + */ + name?: string; + /** + * + * @type {string} + * @memberof Contact + */ + organization?: string; + /** + * + * @type {string} + * @memberof Contact + */ + phone?: string; + /** + * + * @type {string} + * @memberof Contact + */ + mail?: string; + /** + * Raw contact information for compatability with PX files + * @type {string} + * @memberof Contact + */ + raw: string; +} + +/** + * Check if a given object implements the Contact interface. + */ +export function instanceOfContact(value: object): value is Contact { + if (!('raw' in value) || value['raw'] === undefined) return false; + return true; +} + +export function ContactFromJSON(json: any): Contact { + return ContactFromJSONTyped(json, false); +} + +export function ContactFromJSONTyped(json: any, ignoreDiscriminator: boolean): Contact { + if (json == null) { + return json; + } + return { + + 'name': json['name'] == null ? undefined : json['name'], + 'organization': json['organization'] == null ? undefined : json['organization'], + 'phone': json['phone'] == null ? undefined : json['phone'], + 'mail': json['mail'] == null ? undefined : json['mail'], + 'raw': json['raw'], + }; +} + +export function ContactToJSON(json: any): Contact { + return ContactToJSONTyped(json, false); +} + +export function ContactToJSONTyped(value?: Contact | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'name': value['name'], + 'organization': value['organization'], + 'phone': value['phone'], + 'mail': value['mail'], + 'raw': value['raw'], + }; +} + diff --git a/typescript-fetch/src/models/Dataset.ts b/typescript-fetch/src/models/Dataset.ts new file mode 100644 index 0000000..18e57a5 --- /dev/null +++ b/typescript-fetch/src/models/Dataset.ts @@ -0,0 +1,232 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Role } from './Role'; +import { + RoleFromJSON, + RoleFromJSONTyped, + RoleToJSON, + RoleToJSONTyped, +} from './Role'; +import type { DimensionValue } from './DimensionValue'; +import { + DimensionValueFromJSON, + DimensionValueFromJSONTyped, + DimensionValueToJSON, + DimensionValueToJSONTyped, +} from './DimensionValue'; +import type { JsonstatLink } from './JsonstatLink'; +import { + JsonstatLinkFromJSON, + JsonstatLinkFromJSONTyped, + JsonstatLinkToJSON, + JsonstatLinkToJSONTyped, +} from './JsonstatLink'; +import type { ClassType } from './ClassType'; +import { + ClassTypeFromJSON, + ClassTypeFromJSONTyped, + ClassTypeToJSON, + ClassTypeToJSONTyped, +} from './ClassType'; +import type { ExtensionRoot } from './ExtensionRoot'; +import { + ExtensionRootFromJSON, + ExtensionRootFromJSONTyped, + ExtensionRootToJSON, + ExtensionRootToJSONTyped, +} from './ExtensionRoot'; + +/** + * Representation of TableMetaData/TableData according to JSON-stat 2.0 Dataset Schema (2018-09-05 10:55), see full specification of JSON-stat format [here](https://json-stat.org/full/) + * + * Properties in **extension** are mostly from PX-file format, see [PX file format](https://www.scb.se/en/services/statistical-programs-for-px-files/px-file-format/) + * + * @export + * @interface Dataset + */ +export interface Dataset { + /** + * JSON-stat version 2.0 + * @type {string} + * @memberof Dataset + */ + version: DatasetVersionEnum; + /** + * + * @type {ClassType} + * @memberof Dataset + */ + _class: ClassType; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#href) + * @type {string} + * @memberof Dataset + */ + href?: string; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#label) + * @type {string} + * @memberof Dataset + */ + label?: string; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#source) + * @type {string} + * @memberof Dataset + */ + source?: string; + /** + * See https://json-stat.org/full/#updated + * @type {string} + * @memberof Dataset + */ + updated?: string; + /** + * + * @type {{ [key: string]: Array; }} + * @memberof Dataset + */ + link?: { [key: string]: Array; }; + /** + * Spesification on json-stat.org -> [here](https://json-stat.org/full/#note) + * @type {Array} + * @memberof Dataset + */ + note?: Array; + /** + * + * @type {Role} + * @memberof Dataset + */ + role?: Role; + /** + * + * @type {Set} + * @memberof Dataset + */ + id: Set; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#size) + * @type {Array} + * @memberof Dataset + */ + size: Array; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#dimension) + * @type {{ [key: string]: DimensionValue; }} + * @memberof Dataset + */ + dimension: { [key: string]: DimensionValue; }; + /** + * + * @type {ExtensionRoot} + * @memberof Dataset + */ + extension?: ExtensionRoot; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#value) + * @type {Array} + * @memberof Dataset + */ + value: Array | null; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#status) + * @type {{ [key: string]: string; }} + * @memberof Dataset + */ + status?: { [key: string]: string; }; +} + + +/** + * @export + */ +export const DatasetVersionEnum = { + _20: '2.0' +} as const; +export type DatasetVersionEnum = typeof DatasetVersionEnum[keyof typeof DatasetVersionEnum]; + + +/** + * Check if a given object implements the Dataset interface. + */ +export function instanceOfDataset(value: object): value is Dataset { + if (!('version' in value) || value['version'] === undefined) return false; + if (!('_class' in value) || value['_class'] === undefined) return false; + if (!('id' in value) || value['id'] === undefined) return false; + if (!('size' in value) || value['size'] === undefined) return false; + if (!('dimension' in value) || value['dimension'] === undefined) return false; + if (!('value' in value) || value['value'] === undefined) return false; + return true; +} + +export function DatasetFromJSON(json: any): Dataset { + return DatasetFromJSONTyped(json, false); +} + +export function DatasetFromJSONTyped(json: any, ignoreDiscriminator: boolean): Dataset { + if (json == null) { + return json; + } + return { + + 'version': json['version'], + '_class': ClassTypeFromJSON(json['class']), + 'href': json['href'] == null ? undefined : json['href'], + 'label': json['label'] == null ? undefined : json['label'], + 'source': json['source'] == null ? undefined : json['source'], + 'updated': json['updated'] == null ? undefined : json['updated'], + 'link': json['link'] == null ? undefined : json['link'], + 'note': json['note'] == null ? undefined : json['note'], + 'role': json['role'] == null ? undefined : RoleFromJSON(json['role']), + 'id': new Set(json['id']), + 'size': json['size'], + 'dimension': (mapValues(json['dimension'], DimensionValueFromJSON)), + 'extension': json['extension'] == null ? undefined : ExtensionRootFromJSON(json['extension']), + 'value': json['value'] == null ? null : json['value'], + 'status': json['status'] == null ? undefined : json['status'], + }; +} + +export function DatasetToJSON(json: any): Dataset { + return DatasetToJSONTyped(json, false); +} + +export function DatasetToJSONTyped(value?: Dataset | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'version': value['version'], + 'class': ClassTypeToJSON(value['_class']), + 'href': value['href'], + 'label': value['label'], + 'source': value['source'], + 'updated': value['updated'], + 'link': value['link'], + 'note': value['note'], + 'role': RoleToJSON(value['role']), + 'id': Array.from(value['id'] as Set), + 'size': value['size'], + 'dimension': (mapValues(value['dimension'], DimensionValueToJSON)), + 'extension': ExtensionRootToJSON(value['extension']), + 'value': value['value'], + 'status': value['status'], + }; +} + diff --git a/typescript-fetch/src/models/DimensionExtension.ts b/typescript-fetch/src/models/DimensionExtension.ts new file mode 100644 index 0000000..6af2583 --- /dev/null +++ b/typescript-fetch/src/models/DimensionExtension.ts @@ -0,0 +1,65 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface DimensionExtension + */ +export interface DimensionExtension { + /** + * A extension object + * @type {{ [key: string]: string; }} + * @memberof DimensionExtension + */ + extension?: { [key: string]: string; }; +} + +/** + * Check if a given object implements the DimensionExtension interface. + */ +export function instanceOfDimensionExtension(value: object): value is DimensionExtension { + return true; +} + +export function DimensionExtensionFromJSON(json: any): DimensionExtension { + return DimensionExtensionFromJSONTyped(json, false); +} + +export function DimensionExtensionFromJSONTyped(json: any, ignoreDiscriminator: boolean): DimensionExtension { + if (json == null) { + return json; + } + return { + + 'extension': json['extension'] == null ? undefined : json['extension'], + }; +} + +export function DimensionExtensionToJSON(json: any): DimensionExtension { + return DimensionExtensionToJSONTyped(json, false); +} + +export function DimensionExtensionToJSONTyped(value?: DimensionExtension | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'extension': value['extension'], + }; +} + diff --git a/typescript-fetch/src/models/DimensionValue.ts b/typescript-fetch/src/models/DimensionValue.ts new file mode 100644 index 0000000..cdff20c --- /dev/null +++ b/typescript-fetch/src/models/DimensionValue.ts @@ -0,0 +1,119 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { JsonstatExtensionLink } from './JsonstatExtensionLink'; +import { + JsonstatExtensionLinkFromJSON, + JsonstatExtensionLinkFromJSONTyped, + JsonstatExtensionLinkToJSON, + JsonstatExtensionLinkToJSONTyped, +} from './JsonstatExtensionLink'; +import type { ExtensionDimension } from './ExtensionDimension'; +import { + ExtensionDimensionFromJSON, + ExtensionDimensionFromJSONTyped, + ExtensionDimensionToJSON, + ExtensionDimensionToJSONTyped, +} from './ExtensionDimension'; +import type { JsonstatCategory } from './JsonstatCategory'; +import { + JsonstatCategoryFromJSON, + JsonstatCategoryFromJSONTyped, + JsonstatCategoryToJSON, + JsonstatCategoryToJSONTyped, +} from './JsonstatCategory'; + +/** + * + * @export + * @interface DimensionValue + */ +export interface DimensionValue { + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#label) + * @type {string} + * @memberof DimensionValue + */ + label?: string; + /** + * Spesification on json-stat.org -> [here](https://json-stat.org/full/#note) + * @type {Array} + * @memberof DimensionValue + */ + note?: Array; + /** + * + * @type {JsonstatCategory} + * @memberof DimensionValue + */ + category?: JsonstatCategory; + /** + * + * @type {ExtensionDimension} + * @memberof DimensionValue + */ + extension?: ExtensionDimension; + /** + * + * @type {JsonstatExtensionLink} + * @memberof DimensionValue + */ + link?: JsonstatExtensionLink; +} + +/** + * Check if a given object implements the DimensionValue interface. + */ +export function instanceOfDimensionValue(value: object): value is DimensionValue { + return true; +} + +export function DimensionValueFromJSON(json: any): DimensionValue { + return DimensionValueFromJSONTyped(json, false); +} + +export function DimensionValueFromJSONTyped(json: any, ignoreDiscriminator: boolean): DimensionValue { + if (json == null) { + return json; + } + return { + + 'label': json['label'] == null ? undefined : json['label'], + 'note': json['note'] == null ? undefined : json['note'], + 'category': json['category'] == null ? undefined : JsonstatCategoryFromJSON(json['category']), + 'extension': json['extension'] == null ? undefined : ExtensionDimensionFromJSON(json['extension']), + 'link': json['link'] == null ? undefined : JsonstatExtensionLinkFromJSON(json['link']), + }; +} + +export function DimensionValueToJSON(json: any): DimensionValue { + return DimensionValueToJSONTyped(json, false); +} + +export function DimensionValueToJSONTyped(value?: DimensionValue | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'label': value['label'], + 'note': value['note'], + 'category': JsonstatCategoryToJSON(value['category']), + 'extension': ExtensionDimensionToJSON(value['extension']), + 'link': JsonstatExtensionLinkToJSON(value['link']), + }; +} + diff --git a/typescript-fetch/src/models/ExtensionDimension.ts b/typescript-fetch/src/models/ExtensionDimension.ts new file mode 100644 index 0000000..f899202 --- /dev/null +++ b/typescript-fetch/src/models/ExtensionDimension.ts @@ -0,0 +1,174 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Adjustment } from './Adjustment'; +import { + AdjustmentFromJSON, + AdjustmentFromJSONTyped, + AdjustmentToJSON, + AdjustmentToJSONTyped, +} from './Adjustment'; +import type { CodeListInformation } from './CodeListInformation'; +import { + CodeListInformationFromJSON, + CodeListInformationFromJSONTyped, + CodeListInformationToJSON, + CodeListInformationToJSONTyped, +} from './CodeListInformation'; +import type { MeasuringType } from './MeasuringType'; +import { + MeasuringTypeFromJSON, + MeasuringTypeFromJSONTyped, + MeasuringTypeToJSON, + MeasuringTypeToJSONTyped, +} from './MeasuringType'; +import type { PriceType } from './PriceType'; +import { + PriceTypeFromJSON, + PriceTypeFromJSONTyped, + PriceTypeToJSON, + PriceTypeToJSONTyped, +} from './PriceType'; + +/** + * extension at dimension + * @export + * @interface ExtensionDimension + */ +export interface ExtensionDimension { + /** + * Can dimension be elminated + * @type {boolean} + * @memberof ExtensionDimension + */ + elimination?: boolean; + /** + * Elimination value code + * @type {string} + * @memberof ExtensionDimension + */ + eliminationValueCode?: string; + /** + * Describes if a note of a certain index is mandatory. + * @type {{ [key: string]: boolean; }} + * @memberof ExtensionDimension + */ + noteMandatory?: { [key: string]: boolean; }; + /** + * Describes which value note are mandatory + * @type {{ [key: string]: { [key: string]: boolean; }; }} + * @memberof ExtensionDimension + */ + categoryNoteMandatory?: { [key: string]: { [key: string]: boolean; }; }; + /** + * Text with information on the exact period for the statistics + * @type {{ [key: string]: string; }} + * @memberof ExtensionDimension + */ + refperiod?: { [key: string]: string; }; + /** + * Information about how variables are presented + * @type {string} + * @memberof ExtensionDimension + */ + show?: string; + /** + * Available codelists for this dimension + * @type {Array} + * @memberof ExtensionDimension + */ + codeLists?: Array; + /** + * Indicates if data is stock, flow or average. + * @type {{ [key: string]: MeasuringType; }} + * @memberof ExtensionDimension + */ + measuringType?: { [key: string]: MeasuringType; }; + /** + * Indicates if data is in current or fixed prices. + * @type {{ [key: string]: PriceType; }} + * @memberof ExtensionDimension + */ + priceType?: { [key: string]: PriceType; }; + /** + * Describes adjustments made to the data + * @type {{ [key: string]: Adjustment; }} + * @memberof ExtensionDimension + */ + adjustment?: { [key: string]: Adjustment; }; + /** + * Base period for, for instance index series. Is shown with the footnote. If there is a contents variable the keyword is repeated for each value of the contents variable. + * @type {{ [key: string]: string; }} + * @memberof ExtensionDimension + */ + basePeriod?: { [key: string]: string; }; +} + +/** + * Check if a given object implements the ExtensionDimension interface. + */ +export function instanceOfExtensionDimension(value: object): value is ExtensionDimension { + return true; +} + +export function ExtensionDimensionFromJSON(json: any): ExtensionDimension { + return ExtensionDimensionFromJSONTyped(json, false); +} + +export function ExtensionDimensionFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtensionDimension { + if (json == null) { + return json; + } + return { + + 'elimination': json['elimination'] == null ? undefined : json['elimination'], + 'eliminationValueCode': json['eliminationValueCode'] == null ? undefined : json['eliminationValueCode'], + 'noteMandatory': json['noteMandatory'] == null ? undefined : json['noteMandatory'], + 'categoryNoteMandatory': json['categoryNoteMandatory'] == null ? undefined : json['categoryNoteMandatory'], + 'refperiod': json['refperiod'] == null ? undefined : json['refperiod'], + 'show': json['show'] == null ? undefined : json['show'], + 'codeLists': json['codeLists'] == null ? undefined : ((json['codeLists'] as Array).map(CodeListInformationFromJSON)), + 'measuringType': json['measuringType'] == null ? undefined : (mapValues(json['measuringType'], MeasuringTypeFromJSON)), + 'priceType': json['priceType'] == null ? undefined : (mapValues(json['priceType'], PriceTypeFromJSON)), + 'adjustment': json['adjustment'] == null ? undefined : (mapValues(json['adjustment'], AdjustmentFromJSON)), + 'basePeriod': json['basePeriod'] == null ? undefined : json['basePeriod'], + }; +} + +export function ExtensionDimensionToJSON(json: any): ExtensionDimension { + return ExtensionDimensionToJSONTyped(json, false); +} + +export function ExtensionDimensionToJSONTyped(value?: ExtensionDimension | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'elimination': value['elimination'], + 'eliminationValueCode': value['eliminationValueCode'], + 'noteMandatory': value['noteMandatory'], + 'categoryNoteMandatory': value['categoryNoteMandatory'], + 'refperiod': value['refperiod'], + 'show': value['show'], + 'codeLists': value['codeLists'] == null ? undefined : ((value['codeLists'] as Array).map(CodeListInformationToJSON)), + 'measuringType': value['measuringType'] == null ? undefined : (mapValues(value['measuringType'], MeasuringTypeToJSON)), + 'priceType': value['priceType'] == null ? undefined : (mapValues(value['priceType'], PriceTypeToJSON)), + 'adjustment': value['adjustment'] == null ? undefined : (mapValues(value['adjustment'], AdjustmentToJSON)), + 'basePeriod': value['basePeriod'], + }; +} + diff --git a/typescript-fetch/src/models/ExtensionRoot.ts b/typescript-fetch/src/models/ExtensionRoot.ts new file mode 100644 index 0000000..a262a13 --- /dev/null +++ b/typescript-fetch/src/models/ExtensionRoot.ts @@ -0,0 +1,128 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { ExtensionRootPx } from './ExtensionRootPx'; +import { + ExtensionRootPxFromJSON, + ExtensionRootPxFromJSONTyped, + ExtensionRootPxToJSON, + ExtensionRootPxToJSONTyped, +} from './ExtensionRootPx'; +import type { Contact } from './Contact'; +import { + ContactFromJSON, + ContactFromJSONTyped, + ContactToJSON, + ContactToJSONTyped, +} from './Contact'; + +/** + * extension at root level + * @export + * @interface ExtensionRoot + */ +export interface ExtensionRoot { + /** + * Describes if a note of a certain index is mandatory. + * @type {{ [key: string]: boolean; }} + * @memberof ExtensionRoot + */ + noteMandatory?: { [key: string]: boolean; }; + /** + * + * @type {ExtensionRootPx} + * @memberof ExtensionRoot + */ + px?: ExtensionRootPx; + /** + * Earliest time period in table + * @type {string} + * @memberof ExtensionRoot + */ + firstPeriod?: string; + /** + * Latest time period in table + * @type {string} + * @memberof ExtensionRoot + */ + lastPeriod?: string; + /** + * Tag for table + * @type {Array} + * @memberof ExtensionRoot + */ + tags?: Array; + /** + * If the table is discontinued or not. That is if it no longer updated with new figures. + * @type {boolean} + * @memberof ExtensionRoot + */ + discontinued?: boolean | null; + /** + * A list of contacts associated with the table. + * @type {Array} + * @memberof ExtensionRoot + */ + contact?: Array; +} + +/** + * Check if a given object implements the ExtensionRoot interface. + */ +export function instanceOfExtensionRoot(value: object): value is ExtensionRoot { + return true; +} + +export function ExtensionRootFromJSON(json: any): ExtensionRoot { + return ExtensionRootFromJSONTyped(json, false); +} + +export function ExtensionRootFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtensionRoot { + if (json == null) { + return json; + } + return { + + 'noteMandatory': json['noteMandatory'] == null ? undefined : json['noteMandatory'], + 'px': json['px'] == null ? undefined : ExtensionRootPxFromJSON(json['px']), + 'firstPeriod': json['firstPeriod'] == null ? undefined : json['firstPeriod'], + 'lastPeriod': json['lastPeriod'] == null ? undefined : json['lastPeriod'], + 'tags': json['tags'] == null ? undefined : json['tags'], + 'discontinued': json['discontinued'] == null ? undefined : json['discontinued'], + 'contact': json['contact'] == null ? undefined : ((json['contact'] as Array).map(ContactFromJSON)), + }; +} + +export function ExtensionRootToJSON(json: any): ExtensionRoot { + return ExtensionRootToJSONTyped(json, false); +} + +export function ExtensionRootToJSONTyped(value?: ExtensionRoot | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'noteMandatory': value['noteMandatory'], + 'px': ExtensionRootPxToJSON(value['px']), + 'firstPeriod': value['firstPeriod'], + 'lastPeriod': value['lastPeriod'], + 'tags': value['tags'], + 'discontinued': value['discontinued'], + 'contact': value['contact'] == null ? undefined : ((value['contact'] as Array).map(ContactToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/ExtensionRootPx.ts b/typescript-fetch/src/models/ExtensionRootPx.ts new file mode 100644 index 0000000..4f25941 --- /dev/null +++ b/typescript-fetch/src/models/ExtensionRootPx.ts @@ -0,0 +1,212 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Properties corresponds to keywords in the px-file. + * + * See [PX file format](https://www.scb.se/en/services/statistical-programs-for-px-files/px-file-format/) + * + * @export + * @interface ExtensionRootPx + */ +export interface ExtensionRootPx { + /** + * Name of a file containing more information for the statistics** + * @type {string} + * @memberof ExtensionRootPx + */ + infofile?: string; + /** + * A text that is the identity of the table + * @type {string} + * @memberof ExtensionRootPx + */ + tableid?: string; + /** + * The number of decimals in the table cells + * @type {number} + * @memberof ExtensionRootPx + */ + decimals?: number; + /** + * Indicates if the data table is included in the official statistics of the organization + * @type {boolean} + * @memberof ExtensionRootPx + */ + officialStatistics?: boolean; + /** + * If the contents of the table cannot be aggregated + * @type {boolean} + * @memberof ExtensionRootPx + */ + aggregallowed?: boolean; + /** + * If the table is protected by copyright + * @type {boolean} + * @memberof ExtensionRootPx + */ + copyright?: boolean; + /** + * code (two characters) for language + * @type {string} + * @memberof ExtensionRootPx + */ + language?: string; + /** + * Information about the contents, which makes up the first part of a title created when retrieving tables from PC-Axis. + * @type {string} + * @memberof ExtensionRootPx + */ + contents?: string; + /** + * See _description_ in [PX file format](https://www.scb.se/en/services/statistical-programs-for-px-files/px-file-format/) + * @type {string} + * @memberof ExtensionRootPx + */ + description?: string; + /** + * For some languages it is difficult to build a table title dynamically. The keyword descriptiondefault = True; means that the text after keyword Description will be used as title for the table + * @type {boolean} + * @memberof ExtensionRootPx + */ + descriptiondefault?: boolean; + /** + * List of suggested variables for table head + * @type {Array} + * @memberof ExtensionRootPx + */ + heading?: Array; + /** + * List of suggested variables for table stub + * @type {Array} + * @memberof ExtensionRootPx + */ + stub?: Array; + /** + * The name of the matrix + * @type {string} + * @memberof ExtensionRootPx + */ + matrix?: string; + /** + * Subject area code + * @type {string} + * @memberof ExtensionRootPx + */ + subjectCode?: string; + /** + * Subject area + * @type {string} + * @memberof ExtensionRootPx + */ + subjectArea?: string; + /** + * See https://json-stat.org/full/#updated + * @type {string} + * @memberof ExtensionRootPx + */ + nextUpdate?: string; + /** + * Survey for table + * @type {string} + * @memberof ExtensionRootPx + */ + survey?: string; + /** + * Links for tables + * @type {string} + * @memberof ExtensionRootPx + */ + link?: string; + /** + * How often a table is updated + * @type {string} + * @memberof ExtensionRootPx + */ + updateFrequency?: string; +} + +/** + * Check if a given object implements the ExtensionRootPx interface. + */ +export function instanceOfExtensionRootPx(value: object): value is ExtensionRootPx { + return true; +} + +export function ExtensionRootPxFromJSON(json: any): ExtensionRootPx { + return ExtensionRootPxFromJSONTyped(json, false); +} + +export function ExtensionRootPxFromJSONTyped(json: any, ignoreDiscriminator: boolean): ExtensionRootPx { + if (json == null) { + return json; + } + return { + + 'infofile': json['infofile'] == null ? undefined : json['infofile'], + 'tableid': json['tableid'] == null ? undefined : json['tableid'], + 'decimals': json['decimals'] == null ? undefined : json['decimals'], + 'officialStatistics': json['official-statistics'] == null ? undefined : json['official-statistics'], + 'aggregallowed': json['aggregallowed'] == null ? undefined : json['aggregallowed'], + 'copyright': json['copyright'] == null ? undefined : json['copyright'], + 'language': json['language'] == null ? undefined : json['language'], + 'contents': json['contents'] == null ? undefined : json['contents'], + 'description': json['description'] == null ? undefined : json['description'], + 'descriptiondefault': json['descriptiondefault'] == null ? undefined : json['descriptiondefault'], + 'heading': json['heading'] == null ? undefined : json['heading'], + 'stub': json['stub'] == null ? undefined : json['stub'], + 'matrix': json['matrix'] == null ? undefined : json['matrix'], + 'subjectCode': json['subject-code'] == null ? undefined : json['subject-code'], + 'subjectArea': json['subject-area'] == null ? undefined : json['subject-area'], + 'nextUpdate': json['nextUpdate'] == null ? undefined : json['nextUpdate'], + 'survey': json['survey'] == null ? undefined : json['survey'], + 'link': json['link'] == null ? undefined : json['link'], + 'updateFrequency': json['updateFrequency'] == null ? undefined : json['updateFrequency'], + }; +} + +export function ExtensionRootPxToJSON(json: any): ExtensionRootPx { + return ExtensionRootPxToJSONTyped(json, false); +} + +export function ExtensionRootPxToJSONTyped(value?: ExtensionRootPx | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'infofile': value['infofile'], + 'tableid': value['tableid'], + 'decimals': value['decimals'], + 'official-statistics': value['officialStatistics'], + 'aggregallowed': value['aggregallowed'], + 'copyright': value['copyright'], + 'language': value['language'], + 'contents': value['contents'], + 'description': value['description'], + 'descriptiondefault': value['descriptiondefault'], + 'heading': value['heading'], + 'stub': value['stub'], + 'matrix': value['matrix'], + 'subject-code': value['subjectCode'], + 'subject-area': value['subjectArea'], + 'nextUpdate': value['nextUpdate'], + 'survey': value['survey'], + 'link': value['link'], + 'updateFrequency': value['updateFrequency'], + }; +} + diff --git a/typescript-fetch/src/models/FolderContentItem.ts b/typescript-fetch/src/models/FolderContentItem.ts new file mode 100644 index 0000000..1f162e5 --- /dev/null +++ b/typescript-fetch/src/models/FolderContentItem.ts @@ -0,0 +1,137 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { FolderContentItemTypeEnum } from './FolderContentItemTypeEnum'; +import { + FolderContentItemTypeEnumFromJSON, + FolderContentItemTypeEnumFromJSONTyped, + FolderContentItemTypeEnumToJSON, + FolderContentItemTypeEnumToJSONTyped, +} from './FolderContentItemTypeEnum'; + +import { FolderInformation, FolderInformationFromJSONTyped, FolderInformationToJSON, FolderInformationToJSONTyped } from './FolderInformation'; +import { Heading, HeadingFromJSONTyped, HeadingToJSON, HeadingToJSONTyped } from './Heading'; +import { Table, TableFromJSONTyped, TableToJSON, TableToJSONTyped } from './Table'; +/** + * Navigation item. + * @export + * @interface FolderContentItem + */ +export interface FolderContentItem { + /** + * + * @type {FolderContentItemTypeEnum} + * @memberof FolderContentItem + */ + type: FolderContentItemTypeEnum; + /** + * + * @type {string} + * @memberof FolderContentItem + */ + id: string; + /** + * Display text + * @type {string} + * @memberof FolderContentItem + */ + label: string | null; + /** + * Longer text describing node. + * @type {string} + * @memberof FolderContentItem + */ + description?: string | null; + /** + * String for sorting the contents in folder + * @type {string} + * @memberof FolderContentItem + */ + sortCode?: string; +} + + + +/** + * Check if a given object implements the FolderContentItem interface. + */ +export function instanceOfFolderContentItem(value: object): value is FolderContentItem { + if (!('type' in value) || value['type'] === undefined) return false; + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + return true; +} + +export function FolderContentItemFromJSON(json: any): FolderContentItem { + return FolderContentItemFromJSONTyped(json, false); +} + +export function FolderContentItemFromJSONTyped(json: any, ignoreDiscriminator: boolean): FolderContentItem { + if (json == null) { + return json; + } + if (!ignoreDiscriminator) { + if (json['objectType'] === 'FolderInformation') { + return FolderInformationFromJSONTyped(json, ignoreDiscriminator); + } + if (json['objectType'] === 'Heading') { + return HeadingFromJSONTyped(json, ignoreDiscriminator); + } + if (json['objectType'] === 'Table') { + return TableFromJSONTyped(json, ignoreDiscriminator); + } + } + return { + + 'type': FolderContentItemTypeEnumFromJSON(json['type']), + 'id': json['id'], + 'label': json['label'], + 'description': json['description'] == null ? undefined : json['description'], + 'sortCode': json['sortCode'] == null ? undefined : json['sortCode'], + }; +} + +export function FolderContentItemToJSON(json: any): FolderContentItem { + return FolderContentItemToJSONTyped(json, false); +} + +export function FolderContentItemToJSONTyped(value?: FolderContentItem | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + if (!ignoreDiscriminator) { + switch (value['objectType']) { + case 'FolderInformation': + return FolderInformationToJSONTyped(value as FolderInformation, ignoreDiscriminator); + case 'Heading': + return HeadingToJSONTyped(value as Heading, ignoreDiscriminator); + case 'Table': + return TableToJSONTyped(value as Table, ignoreDiscriminator); + default: + throw new Error(`No variant of FolderContentItem exists with 'objectType=${value['objectType']}'`); + } + } + + return { + + 'type': FolderContentItemTypeEnumToJSON(value['type']), + 'id': value['id'], + 'label': value['label'], + 'description': value['description'], + 'sortCode': value['sortCode'], + }; +} + diff --git a/typescript-fetch/src/models/FolderContentItemTypeEnum.ts b/typescript-fetch/src/models/FolderContentItemTypeEnum.ts new file mode 100644 index 0000000..5a82cd8 --- /dev/null +++ b/typescript-fetch/src/models/FolderContentItemTypeEnum.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * + * @export + */ +export const FolderContentItemTypeEnum = { + Heading: 'Heading', + FolderInformation: 'FolderInformation', + Table: 'Table' +} as const; +export type FolderContentItemTypeEnum = typeof FolderContentItemTypeEnum[keyof typeof FolderContentItemTypeEnum]; + + +export function instanceOfFolderContentItemTypeEnum(value: any): boolean { + for (const key in FolderContentItemTypeEnum) { + if (Object.prototype.hasOwnProperty.call(FolderContentItemTypeEnum, key)) { + if (FolderContentItemTypeEnum[key as keyof typeof FolderContentItemTypeEnum] === value) { + return true; + } + } + } + return false; +} + +export function FolderContentItemTypeEnumFromJSON(json: any): FolderContentItemTypeEnum { + return FolderContentItemTypeEnumFromJSONTyped(json, false); +} + +export function FolderContentItemTypeEnumFromJSONTyped(json: any, ignoreDiscriminator: boolean): FolderContentItemTypeEnum { + return json as FolderContentItemTypeEnum; +} + +export function FolderContentItemTypeEnumToJSON(value?: FolderContentItemTypeEnum | null): any { + return value as any; +} + +export function FolderContentItemTypeEnumToJSONTyped(value: any, ignoreDiscriminator: boolean): FolderContentItemTypeEnum { + return value as FolderContentItemTypeEnum; +} + diff --git a/typescript-fetch/src/models/FolderInformation.ts b/typescript-fetch/src/models/FolderInformation.ts new file mode 100644 index 0000000..8b62b0f --- /dev/null +++ b/typescript-fetch/src/models/FolderInformation.ts @@ -0,0 +1,98 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { FolderContentItemTypeEnum } from './FolderContentItemTypeEnum'; +import { + FolderContentItemTypeEnumFromJSON, + FolderContentItemTypeEnumFromJSONTyped, + FolderContentItemTypeEnumToJSON, + FolderContentItemTypeEnumToJSONTyped, +} from './FolderContentItemTypeEnum'; +import type { FolderContentItem } from './FolderContentItem'; +import { + FolderContentItemFromJSON, + FolderContentItemFromJSONTyped, + FolderContentItemToJSON, + FolderContentItemToJSONTyped, +} from './FolderContentItem'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * Folder information item + * @export + * @interface FolderInformation + */ +export interface FolderInformation extends FolderContentItem { + /** + * + * @type {Array} + * @memberof FolderInformation + */ + tags?: Array; + /** + * Links to ... + * @type {Array} + * @memberof FolderInformation + */ + links: Array | null; +} + + + +/** + * Check if a given object implements the FolderInformation interface. + */ +export function instanceOfFolderInformation(value: object): value is FolderInformation { + if (!('links' in value) || value['links'] === undefined) return false; + return true; +} + +export function FolderInformationFromJSON(json: any): FolderInformation { + return FolderInformationFromJSONTyped(json, false); +} + +export function FolderInformationFromJSONTyped(json: any, ignoreDiscriminator: boolean): FolderInformation { + if (json == null) { + return json; + } + return { + ...FolderContentItemFromJSONTyped(json, true), + 'tags': json['tags'] == null ? undefined : json['tags'], + 'links': (json['links'] == null ? null : (json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function FolderInformationToJSON(json: any): FolderInformation { + return FolderInformationToJSONTyped(json, false); +} + +export function FolderInformationToJSONTyped(value?: FolderInformation | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + ...FolderContentItemToJSONTyped(value, true), + 'tags': value['tags'], + 'links': (value['links'] == null ? null : (value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/FolderResponse.ts b/typescript-fetch/src/models/FolderResponse.ts new file mode 100644 index 0000000..d924795 --- /dev/null +++ b/typescript-fetch/src/models/FolderResponse.ts @@ -0,0 +1,133 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { FolderContentItem } from './FolderContentItem'; +import { + FolderContentItemFromJSON, + FolderContentItemFromJSONTyped, + FolderContentItemToJSON, + FolderContentItemToJSONTyped, +} from './FolderContentItem'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * Folder item + * @export + * @interface FolderResponse + */ +export interface FolderResponse { + /** + * The language code (ISO 639) for this response + * @type {string} + * @memberof FolderResponse + */ + language: string; + /** + * + * @type {string} + * @memberof FolderResponse + */ + id: string | null; + /** + * Display text + * @type {string} + * @memberof FolderResponse + */ + label: string | null; + /** + * Longer text describing node. + * @type {string} + * @memberof FolderResponse + */ + description?: string | null; + /** + * + * @type {Array} + * @memberof FolderResponse + */ + tags?: Array; + /** + * + * @type {Array} + * @memberof FolderResponse + */ + folderContents: Array | null; + /** + * Links to ... + * @type {Array} + * @memberof FolderResponse + */ + links: Array | null; +} + +/** + * Check if a given object implements the FolderResponse interface. + */ +export function instanceOfFolderResponse(value: object): value is FolderResponse { + if (!('language' in value) || value['language'] === undefined) return false; + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + if (!('folderContents' in value) || value['folderContents'] === undefined) return false; + if (!('links' in value) || value['links'] === undefined) return false; + return true; +} + +export function FolderResponseFromJSON(json: any): FolderResponse { + return FolderResponseFromJSONTyped(json, false); +} + +export function FolderResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): FolderResponse { + if (json == null) { + return json; + } + return { + + 'language': json['language'], + 'id': json['id'], + 'label': json['label'], + 'description': json['description'] == null ? undefined : json['description'], + 'tags': json['tags'] == null ? undefined : json['tags'], + 'folderContents': (json['folderContents'] == null ? null : (json['folderContents'] as Array).map(FolderContentItemFromJSON)), + 'links': (json['links'] == null ? null : (json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function FolderResponseToJSON(json: any): FolderResponse { + return FolderResponseToJSONTyped(json, false); +} + +export function FolderResponseToJSONTyped(value?: FolderResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'language': value['language'], + 'id': value['id'], + 'label': value['label'], + 'description': value['description'], + 'tags': value['tags'], + 'folderContents': (value['folderContents'] == null ? null : (value['folderContents'] as Array).map(FolderContentItemToJSON)), + 'links': (value['links'] == null ? null : (value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/Heading.ts b/typescript-fetch/src/models/Heading.ts new file mode 100644 index 0000000..0743a43 --- /dev/null +++ b/typescript-fetch/src/models/Heading.ts @@ -0,0 +1,63 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { FolderContentItemTypeEnum } from './FolderContentItemTypeEnum'; +import { + FolderContentItemTypeEnumFromJSON, + FolderContentItemTypeEnumFromJSONTyped, + FolderContentItemTypeEnumToJSON, + FolderContentItemTypeEnumToJSONTyped, +} from './FolderContentItemTypeEnum'; +import type { FolderContentItem } from './FolderContentItem'; +import { + FolderContentItemFromJSON, + FolderContentItemFromJSONTyped, + FolderContentItemToJSON, + FolderContentItemToJSONTyped, +} from './FolderContentItem'; + +/** + * Heading item + * @export + * @interface Heading + */ +export interface Heading extends FolderContentItem { +} + + + +/** + * Check if a given object implements the Heading interface. + */ +export function instanceOfHeading(value: object): value is Heading { + return true; +} + +export function HeadingFromJSON(json: any): Heading { + return HeadingFromJSONTyped(json, false); +} + +export function HeadingFromJSONTyped(json: any, ignoreDiscriminator: boolean): Heading { + return json; +} + +export function HeadingToJSON(json: any): Heading { + return HeadingToJSONTyped(json, false); +} + +export function HeadingToJSONTyped(value?: Heading | null, ignoreDiscriminator: boolean = false): any { + return value; +} + diff --git a/typescript-fetch/src/models/JsonstatCategory.ts b/typescript-fetch/src/models/JsonstatCategory.ts new file mode 100644 index 0000000..cebc9ec --- /dev/null +++ b/typescript-fetch/src/models/JsonstatCategory.ts @@ -0,0 +1,105 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { JsonstatCategoryUnitValue } from './JsonstatCategoryUnitValue'; +import { + JsonstatCategoryUnitValueFromJSON, + JsonstatCategoryUnitValueFromJSONTyped, + JsonstatCategoryUnitValueToJSON, + JsonstatCategoryUnitValueToJSONTyped, +} from './JsonstatCategoryUnitValue'; + +/** + * + * @export + * @interface JsonstatCategory + */ +export interface JsonstatCategory { + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#index) + * @type {{ [key: string]: number; }} + * @memberof JsonstatCategory + */ + index?: { [key: string]: number; }; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#label) + * @type {{ [key: string]: string; }} + * @memberof JsonstatCategory + */ + label?: { [key: string]: string; }; + /** + * Notes for values + * @type {{ [key: string]: Array; }} + * @memberof JsonstatCategory + */ + note?: { [key: string]: Array; }; + /** + * + * @type {{ [key: string]: Set; }} + * @memberof JsonstatCategory + */ + child?: { [key: string]: Set; }; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#unit) + * @type {{ [key: string]: JsonstatCategoryUnitValue; }} + * @memberof JsonstatCategory + */ + unit?: { [key: string]: JsonstatCategoryUnitValue; }; +} + +/** + * Check if a given object implements the JsonstatCategory interface. + */ +export function instanceOfJsonstatCategory(value: object): value is JsonstatCategory { + return true; +} + +export function JsonstatCategoryFromJSON(json: any): JsonstatCategory { + return JsonstatCategoryFromJSONTyped(json, false); +} + +export function JsonstatCategoryFromJSONTyped(json: any, ignoreDiscriminator: boolean): JsonstatCategory { + if (json == null) { + return json; + } + return { + + 'index': json['index'] == null ? undefined : json['index'], + 'label': json['label'] == null ? undefined : json['label'], + 'note': json['note'] == null ? undefined : json['note'], + 'child': json['child'] == null ? undefined : json['child'], + 'unit': json['unit'] == null ? undefined : (mapValues(json['unit'], JsonstatCategoryUnitValueFromJSON)), + }; +} + +export function JsonstatCategoryToJSON(json: any): JsonstatCategory { + return JsonstatCategoryToJSONTyped(json, false); +} + +export function JsonstatCategoryToJSONTyped(value?: JsonstatCategory | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'index': value['index'], + 'label': value['label'], + 'note': value['note'], + 'child': value['child'], + 'unit': value['unit'] == null ? undefined : (mapValues(value['unit'], JsonstatCategoryUnitValueToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/JsonstatCategoryUnitValue.ts b/typescript-fetch/src/models/JsonstatCategoryUnitValue.ts new file mode 100644 index 0000000..596903c --- /dev/null +++ b/typescript-fetch/src/models/JsonstatCategoryUnitValue.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface JsonstatCategoryUnitValue + */ +export interface JsonstatCategoryUnitValue { + /** + * It is the base unit (person, gram, euro, etc.). + * @type {string} + * @memberof JsonstatCategoryUnitValue + */ + base?: string; + /** + * Number of decimals + * @type {number} + * @memberof JsonstatCategoryUnitValue + */ + decimals?: number; +} + +/** + * Check if a given object implements the JsonstatCategoryUnitValue interface. + */ +export function instanceOfJsonstatCategoryUnitValue(value: object): value is JsonstatCategoryUnitValue { + return true; +} + +export function JsonstatCategoryUnitValueFromJSON(json: any): JsonstatCategoryUnitValue { + return JsonstatCategoryUnitValueFromJSONTyped(json, false); +} + +export function JsonstatCategoryUnitValueFromJSONTyped(json: any, ignoreDiscriminator: boolean): JsonstatCategoryUnitValue { + if (json == null) { + return json; + } + return { + + 'base': json['base'] == null ? undefined : json['base'], + 'decimals': json['decimals'] == null ? undefined : json['decimals'], + }; +} + +export function JsonstatCategoryUnitValueToJSON(json: any): JsonstatCategoryUnitValue { + return JsonstatCategoryUnitValueToJSONTyped(json, false); +} + +export function JsonstatCategoryUnitValueToJSONTyped(value?: JsonstatCategoryUnitValue | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'base': value['base'], + 'decimals': value['decimals'], + }; +} + diff --git a/typescript-fetch/src/models/JsonstatExtensionLink.ts b/typescript-fetch/src/models/JsonstatExtensionLink.ts new file mode 100644 index 0000000..b5a1ec2 --- /dev/null +++ b/typescript-fetch/src/models/JsonstatExtensionLink.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { DimensionExtension } from './DimensionExtension'; +import { + DimensionExtensionFromJSON, + DimensionExtensionFromJSONTyped, + DimensionExtensionToJSON, + DimensionExtensionToJSONTyped, +} from './DimensionExtension'; + +/** + * + * @export + * @interface JsonstatExtensionLink + */ +export interface JsonstatExtensionLink { + /** + * + * @type {Array} + * @memberof JsonstatExtensionLink + */ + describedby?: Array; +} + +/** + * Check if a given object implements the JsonstatExtensionLink interface. + */ +export function instanceOfJsonstatExtensionLink(value: object): value is JsonstatExtensionLink { + return true; +} + +export function JsonstatExtensionLinkFromJSON(json: any): JsonstatExtensionLink { + return JsonstatExtensionLinkFromJSONTyped(json, false); +} + +export function JsonstatExtensionLinkFromJSONTyped(json: any, ignoreDiscriminator: boolean): JsonstatExtensionLink { + if (json == null) { + return json; + } + return { + + 'describedby': json['describedby'] == null ? undefined : ((json['describedby'] as Array).map(DimensionExtensionFromJSON)), + }; +} + +export function JsonstatExtensionLinkToJSON(json: any): JsonstatExtensionLink { + return JsonstatExtensionLinkToJSONTyped(json, false); +} + +export function JsonstatExtensionLinkToJSONTyped(value?: JsonstatExtensionLink | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'describedby': value['describedby'] == null ? undefined : ((value['describedby'] as Array).map(DimensionExtensionToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/JsonstatLink.ts b/typescript-fetch/src/models/JsonstatLink.ts new file mode 100644 index 0000000..4a3fec6 --- /dev/null +++ b/typescript-fetch/src/models/JsonstatLink.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface JsonstatLink + */ +export interface JsonstatLink { + /** + * + * @type {string} + * @memberof JsonstatLink + */ + type?: string; + /** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#href) + * @type {string} + * @memberof JsonstatLink + */ + href?: string; +} + +/** + * Check if a given object implements the JsonstatLink interface. + */ +export function instanceOfJsonstatLink(value: object): value is JsonstatLink { + return true; +} + +export function JsonstatLinkFromJSON(json: any): JsonstatLink { + return JsonstatLinkFromJSONTyped(json, false); +} + +export function JsonstatLinkFromJSONTyped(json: any, ignoreDiscriminator: boolean): JsonstatLink { + if (json == null) { + return json; + } + return { + + 'type': json['type'] == null ? undefined : json['type'], + 'href': json['href'] == null ? undefined : json['href'], + }; +} + +export function JsonstatLinkToJSON(json: any): JsonstatLink { + return JsonstatLinkToJSONTyped(json, false); +} + +export function JsonstatLinkToJSONTyped(value?: JsonstatLink | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'type': value['type'], + 'href': value['href'], + }; +} + diff --git a/typescript-fetch/src/models/KeyValuePair.ts b/typescript-fetch/src/models/KeyValuePair.ts new file mode 100644 index 0000000..6abe940 --- /dev/null +++ b/typescript-fetch/src/models/KeyValuePair.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface KeyValuePair + */ +export interface KeyValuePair { + /** + * The key + * @type {string} + * @memberof KeyValuePair + */ + key: string; + /** + * The value associated with the key + * @type {string} + * @memberof KeyValuePair + */ + value: string; +} + +/** + * Check if a given object implements the KeyValuePair interface. + */ +export function instanceOfKeyValuePair(value: object): value is KeyValuePair { + if (!('key' in value) || value['key'] === undefined) return false; + if (!('value' in value) || value['value'] === undefined) return false; + return true; +} + +export function KeyValuePairFromJSON(json: any): KeyValuePair { + return KeyValuePairFromJSONTyped(json, false); +} + +export function KeyValuePairFromJSONTyped(json: any, ignoreDiscriminator: boolean): KeyValuePair { + if (json == null) { + return json; + } + return { + + 'key': json['key'], + 'value': json['value'], + }; +} + +export function KeyValuePairToJSON(json: any): KeyValuePair { + return KeyValuePairToJSONTyped(json, false); +} + +export function KeyValuePairToJSONTyped(value?: KeyValuePair | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'key': value['key'], + 'value': value['value'], + }; +} + diff --git a/typescript-fetch/src/models/Language.ts b/typescript-fetch/src/models/Language.ts new file mode 100644 index 0000000..8e2b064 --- /dev/null +++ b/typescript-fetch/src/models/Language.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Language information + * @export + * @interface Language + */ +export interface Language { + /** + * The language ISO code + * @type {string} + * @memberof Language + */ + id: string; + /** + * The name of the language + * @type {string} + * @memberof Language + */ + label: string; +} + +/** + * Check if a given object implements the Language interface. + */ +export function instanceOfLanguage(value: object): value is Language { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + return true; +} + +export function LanguageFromJSON(json: any): Language { + return LanguageFromJSONTyped(json, false); +} + +export function LanguageFromJSONTyped(json: any, ignoreDiscriminator: boolean): Language { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'label': json['label'], + }; +} + +export function LanguageToJSON(json: any): Language { + return LanguageToJSONTyped(json, false); +} + +export function LanguageToJSONTyped(value?: Language | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'label': value['label'], + }; +} + diff --git a/typescript-fetch/src/models/Link.ts b/typescript-fetch/src/models/Link.ts new file mode 100644 index 0000000..1873eb8 --- /dev/null +++ b/typescript-fetch/src/models/Link.ts @@ -0,0 +1,84 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface Link + */ +export interface Link { + /** + * the link relation, see https://www.iana.org/assignments/link-relations/link-relations.xhtml + * @type {string} + * @memberof Link + */ + rel: string; + /** + * The language that is used for the link, see https://moz.com/learn/seo/hreflang-tag + * @type {string} + * @memberof Link + */ + hreflang: string; + /** + * the link to the resource + * @type {string} + * @memberof Link + */ + href: string; +} + +/** + * Check if a given object implements the Link interface. + */ +export function instanceOfLink(value: object): value is Link { + if (!('rel' in value) || value['rel'] === undefined) return false; + if (!('hreflang' in value) || value['hreflang'] === undefined) return false; + if (!('href' in value) || value['href'] === undefined) return false; + return true; +} + +export function LinkFromJSON(json: any): Link { + return LinkFromJSONTyped(json, false); +} + +export function LinkFromJSONTyped(json: any, ignoreDiscriminator: boolean): Link { + if (json == null) { + return json; + } + return { + + 'rel': json['rel'], + 'hreflang': json['hreflang'], + 'href': json['href'], + }; +} + +export function LinkToJSON(json: any): Link { + return LinkToJSONTyped(json, false); +} + +export function LinkToJSONTyped(value?: Link | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'rel': value['rel'], + 'hreflang': value['hreflang'], + 'href': value['href'], + }; +} + diff --git a/typescript-fetch/src/models/MeasuringType.ts b/typescript-fetch/src/models/MeasuringType.ts new file mode 100644 index 0000000..25d6a59 --- /dev/null +++ b/typescript-fetch/src/models/MeasuringType.ts @@ -0,0 +1,55 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Indicates if data is stock, flow or average. + * @export + */ +export const MeasuringType = { + Stock: 'Stock', + Flow: 'Flow', + Average: 'Average', + Other: 'Other' +} as const; +export type MeasuringType = typeof MeasuringType[keyof typeof MeasuringType]; + + +export function instanceOfMeasuringType(value: any): boolean { + for (const key in MeasuringType) { + if (Object.prototype.hasOwnProperty.call(MeasuringType, key)) { + if (MeasuringType[key as keyof typeof MeasuringType] === value) { + return true; + } + } + } + return false; +} + +export function MeasuringTypeFromJSON(json: any): MeasuringType { + return MeasuringTypeFromJSONTyped(json, false); +} + +export function MeasuringTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): MeasuringType { + return json as MeasuringType; +} + +export function MeasuringTypeToJSON(value?: MeasuringType | null): any { + return value as any; +} + +export function MeasuringTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): MeasuringType { + return value as MeasuringType; +} + diff --git a/typescript-fetch/src/models/Note.ts b/typescript-fetch/src/models/Note.ts new file mode 100644 index 0000000..698bc2d --- /dev/null +++ b/typescript-fetch/src/models/Note.ts @@ -0,0 +1,74 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface Note + */ +export interface Note { + /** + * Must be shown to end user if true + * @type {boolean} + * @memberof Note + */ + mandatory?: boolean; + /** + * + * @type {string} + * @memberof Note + */ + text: string; +} + +/** + * Check if a given object implements the Note interface. + */ +export function instanceOfNote(value: object): value is Note { + if (!('text' in value) || value['text'] === undefined) return false; + return true; +} + +export function NoteFromJSON(json: any): Note { + return NoteFromJSONTyped(json, false); +} + +export function NoteFromJSONTyped(json: any, ignoreDiscriminator: boolean): Note { + if (json == null) { + return json; + } + return { + + 'mandatory': json['mandatory'] == null ? undefined : json['mandatory'], + 'text': json['text'], + }; +} + +export function NoteToJSON(json: any): Note { + return NoteToJSONTyped(json, false); +} + +export function NoteToJSONTyped(value?: Note | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'mandatory': value['mandatory'], + 'text': value['text'], + }; +} + diff --git a/typescript-fetch/src/models/OutputFormatParamType.ts b/typescript-fetch/src/models/OutputFormatParamType.ts new file mode 100644 index 0000000..ce4b128 --- /dev/null +++ b/typescript-fetch/src/models/OutputFormatParamType.ts @@ -0,0 +1,66 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Parameters for the output format. + * * UseCodes: Can not be combined with UseTexts and UseCodesAndTexts. And only applicable for csv, html and xlsx output format. + * * UseTexts: Can not be combined with UsedCodes and UseCodesAndTexts. And only applicable for csv, html and xlsx output format. + * * UseCodesAndTexts: Can not be combined with UseCodess and UseTexts. And only applicable for csv, html and xlsx output format. + * * IncludeTitle: Only applicable for csv, html and xlsx output format. + * * SeparatorTab: Can not be combined with SeparatorSpace and SeparatorSemicolon. And only applicable for csv output format. + * * SeparatorSpace: Can not be combined with SeparatorTab and SeparatorSemicolon. And only applicable for csv output format. + * * SeparatorSemicolon: Can not be combined with SeparatorTab and SeparatorSpace. And only applicable for csv output format. + * + * @export + */ +export const OutputFormatParamType = { + UseCodes: 'UseCodes', + UseTexts: 'UseTexts', + UseCodesAndTexts: 'UseCodesAndTexts', + IncludeTitle: 'IncludeTitle', + SeparatorTab: 'SeparatorTab', + SeparatorSpace: 'SeparatorSpace', + SeparatorSemicolon: 'SeparatorSemicolon' +} as const; +export type OutputFormatParamType = typeof OutputFormatParamType[keyof typeof OutputFormatParamType]; + + +export function instanceOfOutputFormatParamType(value: any): boolean { + for (const key in OutputFormatParamType) { + if (Object.prototype.hasOwnProperty.call(OutputFormatParamType, key)) { + if (OutputFormatParamType[key as keyof typeof OutputFormatParamType] === value) { + return true; + } + } + } + return false; +} + +export function OutputFormatParamTypeFromJSON(json: any): OutputFormatParamType { + return OutputFormatParamTypeFromJSONTyped(json, false); +} + +export function OutputFormatParamTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): OutputFormatParamType { + return json as OutputFormatParamType; +} + +export function OutputFormatParamTypeToJSON(value?: OutputFormatParamType | null): any { + return value as any; +} + +export function OutputFormatParamTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): OutputFormatParamType { + return value as OutputFormatParamType; +} + diff --git a/typescript-fetch/src/models/OutputFormatType.ts b/typescript-fetch/src/models/OutputFormatType.ts new file mode 100644 index 0000000..0a1ddd7 --- /dev/null +++ b/typescript-fetch/src/models/OutputFormatType.ts @@ -0,0 +1,58 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * + * @export + */ +export const OutputFormatType = { + Px: 'px', + JsonStat2: 'json-stat2', + Csv: 'csv', + Xlsx: 'xlsx', + Html: 'html', + JsonPx: 'json-px', + Parquet: 'parquet' +} as const; +export type OutputFormatType = typeof OutputFormatType[keyof typeof OutputFormatType]; + + +export function instanceOfOutputFormatType(value: any): boolean { + for (const key in OutputFormatType) { + if (Object.prototype.hasOwnProperty.call(OutputFormatType, key)) { + if (OutputFormatType[key as keyof typeof OutputFormatType] === value) { + return true; + } + } + } + return false; +} + +export function OutputFormatTypeFromJSON(json: any): OutputFormatType { + return OutputFormatTypeFromJSONTyped(json, false); +} + +export function OutputFormatTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): OutputFormatType { + return json as OutputFormatType; +} + +export function OutputFormatTypeToJSON(value?: OutputFormatType | null): any { + return value as any; +} + +export function OutputFormatTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): OutputFormatType { + return value as OutputFormatType; +} + diff --git a/typescript-fetch/src/models/PageInfo.ts b/typescript-fetch/src/models/PageInfo.ts new file mode 100644 index 0000000..c588707 --- /dev/null +++ b/typescript-fetch/src/models/PageInfo.ts @@ -0,0 +1,109 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface PageInfo + */ +export interface PageInfo { + /** + * The current page number. + * @type {number} + * @memberof PageInfo + */ + pageNumber: number; + /** + * The maximal number of elements in a page + * @type {number} + * @memberof PageInfo + */ + pageSize: number; + /** + * the Total number of elements + * @type {number} + * @memberof PageInfo + */ + totalElements: number; + /** + * The total number of pages + * @type {number} + * @memberof PageInfo + */ + totalPages: number; + /** + * + * @type {Array} + * @memberof PageInfo + */ + links?: Array; +} + +/** + * Check if a given object implements the PageInfo interface. + */ +export function instanceOfPageInfo(value: object): value is PageInfo { + if (!('pageNumber' in value) || value['pageNumber'] === undefined) return false; + if (!('pageSize' in value) || value['pageSize'] === undefined) return false; + if (!('totalElements' in value) || value['totalElements'] === undefined) return false; + if (!('totalPages' in value) || value['totalPages'] === undefined) return false; + return true; +} + +export function PageInfoFromJSON(json: any): PageInfo { + return PageInfoFromJSONTyped(json, false); +} + +export function PageInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): PageInfo { + if (json == null) { + return json; + } + return { + + 'pageNumber': json['pageNumber'], + 'pageSize': json['pageSize'], + 'totalElements': json['totalElements'], + 'totalPages': json['totalPages'], + 'links': json['links'] == null ? undefined : ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function PageInfoToJSON(json: any): PageInfo { + return PageInfoToJSONTyped(json, false); +} + +export function PageInfoToJSONTyped(value?: PageInfo | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'pageNumber': value['pageNumber'], + 'pageSize': value['pageSize'], + 'totalElements': value['totalElements'], + 'totalPages': value['totalPages'], + 'links': value['links'] == null ? undefined : ((value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/PathElement.ts b/typescript-fetch/src/models/PathElement.ts new file mode 100644 index 0000000..745a351 --- /dev/null +++ b/typescript-fetch/src/models/PathElement.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface PathElement + */ +export interface PathElement { + /** + * The identity of the PathElement + * @type {string} + * @memberof PathElement + */ + id: string; + /** + * A textual name for the PathElement + * @type {string} + * @memberof PathElement + */ + label: string; +} + +/** + * Check if a given object implements the PathElement interface. + */ +export function instanceOfPathElement(value: object): value is PathElement { + if (!('id' in value) || value['id'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + return true; +} + +export function PathElementFromJSON(json: any): PathElement { + return PathElementFromJSONTyped(json, false); +} + +export function PathElementFromJSONTyped(json: any, ignoreDiscriminator: boolean): PathElement { + if (json == null) { + return json; + } + return { + + 'id': json['id'], + 'label': json['label'], + }; +} + +export function PathElementToJSON(json: any): PathElement { + return PathElementToJSONTyped(json, false); +} + +export function PathElementToJSONTyped(value?: PathElement | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'label': value['label'], + }; +} + diff --git a/typescript-fetch/src/models/PriceType.ts b/typescript-fetch/src/models/PriceType.ts new file mode 100644 index 0000000..27ef146 --- /dev/null +++ b/typescript-fetch/src/models/PriceType.ts @@ -0,0 +1,54 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Indicates if data is in current or fixed prices. + * @export + */ +export const PriceType = { + NotApplicable: 'NotApplicable', + Current: 'Current', + Fixed: 'Fixed' +} as const; +export type PriceType = typeof PriceType[keyof typeof PriceType]; + + +export function instanceOfPriceType(value: any): boolean { + for (const key in PriceType) { + if (Object.prototype.hasOwnProperty.call(PriceType, key)) { + if (PriceType[key as keyof typeof PriceType] === value) { + return true; + } + } + } + return false; +} + +export function PriceTypeFromJSON(json: any): PriceType { + return PriceTypeFromJSONTyped(json, false); +} + +export function PriceTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PriceType { + return json as PriceType; +} + +export function PriceTypeToJSON(value?: PriceType | null): any { + return value as any; +} + +export function PriceTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): PriceType { + return value as PriceType; +} + diff --git a/typescript-fetch/src/models/Problem.ts b/typescript-fetch/src/models/Problem.ts new file mode 100644 index 0000000..a6e6704 --- /dev/null +++ b/typescript-fetch/src/models/Problem.ts @@ -0,0 +1,109 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface Problem + */ +export interface Problem { + /** + * An absolute URI that identifies the problem type. When dereferenced, + * it SHOULD provide human-readable documentation for the problem type + * (e.g., using HTML). + * + * @type {string} + * @memberof Problem + */ + type?: string; + /** + * A short, summary of the problem type. Written in english and readable + * for engineers (usually not suited for non technical stakeholders and + * not localized); example: Service Unavailable + * + * @type {string} + * @memberof Problem + */ + title?: string; + /** + * The HTTP status code generated by the origin server for this occurrence + * of the problem. + * + * @type {number} + * @memberof Problem + */ + status?: number; + /** + * A human readable explanation specific to this occurrence of the + * problem. + * + * @type {string} + * @memberof Problem + */ + detail?: string; + /** + * An absolute URI that identifies the specific occurrence of the problem. + * It may or may not yield further information if dereferenced. + * + * @type {string} + * @memberof Problem + */ + instance?: string; +} + +/** + * Check if a given object implements the Problem interface. + */ +export function instanceOfProblem(value: object): value is Problem { + return true; +} + +export function ProblemFromJSON(json: any): Problem { + return ProblemFromJSONTyped(json, false); +} + +export function ProblemFromJSONTyped(json: any, ignoreDiscriminator: boolean): Problem { + if (json == null) { + return json; + } + return { + + 'type': json['type'] == null ? undefined : json['type'], + 'title': json['title'] == null ? undefined : json['title'], + 'status': json['status'] == null ? undefined : json['status'], + 'detail': json['detail'] == null ? undefined : json['detail'], + 'instance': json['instance'] == null ? undefined : json['instance'], + }; +} + +export function ProblemToJSON(json: any): Problem { + return ProblemToJSONTyped(json, false); +} + +export function ProblemToJSONTyped(value?: Problem | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'type': value['type'], + 'title': value['title'], + 'status': value['status'], + 'detail': value['detail'], + 'instance': value['instance'], + }; +} + diff --git a/typescript-fetch/src/models/Role.ts b/typescript-fetch/src/models/Role.ts new file mode 100644 index 0000000..a1f58cf --- /dev/null +++ b/typescript-fetch/src/models/Role.ts @@ -0,0 +1,81 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * Specification on json-stat.org -> [here](https://json-stat.org/full/#role) + * @export + * @interface Role + */ +export interface Role { + /** + * + * @type {Set} + * @memberof Role + */ + time?: Set; + /** + * + * @type {Set} + * @memberof Role + */ + geo?: Set; + /** + * + * @type {Set} + * @memberof Role + */ + metric?: Set; +} + +/** + * Check if a given object implements the Role interface. + */ +export function instanceOfRole(value: object): value is Role { + return true; +} + +export function RoleFromJSON(json: any): Role { + return RoleFromJSONTyped(json, false); +} + +export function RoleFromJSONTyped(json: any, ignoreDiscriminator: boolean): Role { + if (json == null) { + return json; + } + return { + + 'time': json['time'] == null ? undefined : new Set(json['time']), + 'geo': json['geo'] == null ? undefined : new Set(json['geo']), + 'metric': json['metric'] == null ? undefined : new Set(json['metric']), + }; +} + +export function RoleToJSON(json: any): Role { + return RoleToJSONTyped(json, false); +} + +export function RoleToJSONTyped(value?: Role | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'time': value['time'] == null ? undefined : Array.from(value['time'] as Set), + 'geo': value['geo'] == null ? undefined : Array.from(value['geo'] as Set), + 'metric': value['metric'] == null ? undefined : Array.from(value['metric'] as Set), + }; +} + diff --git a/typescript-fetch/src/models/SavedQuery.ts b/typescript-fetch/src/models/SavedQuery.ts new file mode 100644 index 0000000..eef1bc7 --- /dev/null +++ b/typescript-fetch/src/models/SavedQuery.ts @@ -0,0 +1,132 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { OutputFormatParamType } from './OutputFormatParamType'; +import { + OutputFormatParamTypeFromJSON, + OutputFormatParamTypeFromJSONTyped, + OutputFormatParamTypeToJSON, + OutputFormatParamTypeToJSONTyped, +} from './OutputFormatParamType'; +import type { VariablesSelection } from './VariablesSelection'; +import { + VariablesSelectionFromJSON, + VariablesSelectionFromJSONTyped, + VariablesSelectionToJSON, + VariablesSelectionToJSONTyped, +} from './VariablesSelection'; +import type { OutputFormatType } from './OutputFormatType'; +import { + OutputFormatTypeFromJSON, + OutputFormatTypeFromJSONTyped, + OutputFormatTypeToJSON, + OutputFormatTypeToJSONTyped, +} from './OutputFormatType'; + +/** + * + * @export + * @interface SavedQuery + */ +export interface SavedQuery { + /** + * The id of the saved query + * @type {string} + * @memberof SavedQuery + */ + id?: string; + /** + * + * @type {VariablesSelection} + * @memberof SavedQuery + */ + selection: VariablesSelection; + /** + * language code for the language used in this response + * @type {string} + * @memberof SavedQuery + */ + language: string; + /** + * which table the query is for + * @type {string} + * @memberof SavedQuery + */ + tableId: string; + /** + * + * @type {OutputFormatType} + * @memberof SavedQuery + */ + outputFormat?: OutputFormatType; + /** + * + * @type {Array} + * @memberof SavedQuery + */ + outputFormatParams?: Array; +} + + + +/** + * Check if a given object implements the SavedQuery interface. + */ +export function instanceOfSavedQuery(value: object): value is SavedQuery { + if (!('selection' in value) || value['selection'] === undefined) return false; + if (!('language' in value) || value['language'] === undefined) return false; + if (!('tableId' in value) || value['tableId'] === undefined) return false; + return true; +} + +export function SavedQueryFromJSON(json: any): SavedQuery { + return SavedQueryFromJSONTyped(json, false); +} + +export function SavedQueryFromJSONTyped(json: any, ignoreDiscriminator: boolean): SavedQuery { + if (json == null) { + return json; + } + return { + + 'id': json['id'] == null ? undefined : json['id'], + 'selection': VariablesSelectionFromJSON(json['selection']), + 'language': json['language'], + 'tableId': json['tableId'], + 'outputFormat': json['outputFormat'] == null ? undefined : OutputFormatTypeFromJSON(json['outputFormat']), + 'outputFormatParams': json['outputFormatParams'] == null ? undefined : ((json['outputFormatParams'] as Array).map(OutputFormatParamTypeFromJSON)), + }; +} + +export function SavedQueryToJSON(json: any): SavedQuery { + return SavedQueryToJSONTyped(json, false); +} + +export function SavedQueryToJSONTyped(value?: SavedQuery | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'id': value['id'], + 'selection': VariablesSelectionToJSON(value['selection']), + 'language': value['language'], + 'tableId': value['tableId'], + 'outputFormat': OutputFormatTypeToJSON(value['outputFormat']), + 'outputFormatParams': value['outputFormatParams'] == null ? undefined : ((value['outputFormatParams'] as Array).map(OutputFormatParamTypeToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/SelectionResponse.ts b/typescript-fetch/src/models/SelectionResponse.ts new file mode 100644 index 0000000..1dc7674 --- /dev/null +++ b/typescript-fetch/src/models/SelectionResponse.ts @@ -0,0 +1,114 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { VariablePlacementType } from './VariablePlacementType'; +import { + VariablePlacementTypeFromJSON, + VariablePlacementTypeFromJSONTyped, + VariablePlacementTypeToJSON, + VariablePlacementTypeToJSONTyped, +} from './VariablePlacementType'; +import type { VariableSelection } from './VariableSelection'; +import { + VariableSelectionFromJSON, + VariableSelectionFromJSONTyped, + VariableSelectionToJSON, + VariableSelectionToJSONTyped, +} from './VariableSelection'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface SelectionResponse + */ +export interface SelectionResponse { + /** + * The language code for the language used in this response + * @type {string} + * @memberof SelectionResponse + */ + language: string; + /** + * + * @type {Array} + * @memberof SelectionResponse + */ + links: Array; + /** + * + * @type {Array} + * @memberof SelectionResponse + */ + selection: Array; + /** + * + * @type {VariablePlacementType} + * @memberof SelectionResponse + */ + placement?: VariablePlacementType; +} + +/** + * Check if a given object implements the SelectionResponse interface. + */ +export function instanceOfSelectionResponse(value: object): value is SelectionResponse { + if (!('language' in value) || value['language'] === undefined) return false; + if (!('links' in value) || value['links'] === undefined) return false; + if (!('selection' in value) || value['selection'] === undefined) return false; + return true; +} + +export function SelectionResponseFromJSON(json: any): SelectionResponse { + return SelectionResponseFromJSONTyped(json, false); +} + +export function SelectionResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): SelectionResponse { + if (json == null) { + return json; + } + return { + + 'language': json['language'], + 'links': ((json['links'] as Array).map(LinkFromJSON)), + 'selection': ((json['selection'] as Array).map(VariableSelectionFromJSON)), + 'placement': json['placement'] == null ? undefined : VariablePlacementTypeFromJSON(json['placement']), + }; +} + +export function SelectionResponseToJSON(json: any): SelectionResponse { + return SelectionResponseToJSONTyped(json, false); +} + +export function SelectionResponseToJSONTyped(value?: SelectionResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'language': value['language'], + 'links': ((value['links'] as Array).map(LinkToJSON)), + 'selection': ((value['selection'] as Array).map(VariableSelectionToJSON)), + 'placement': VariablePlacementTypeToJSON(value['placement']), + }; +} + diff --git a/typescript-fetch/src/models/SourceReference.ts b/typescript-fetch/src/models/SourceReference.ts new file mode 100644 index 0000000..045bba2 --- /dev/null +++ b/typescript-fetch/src/models/SourceReference.ts @@ -0,0 +1,75 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * How data should be cite for a specific language + * @export + * @interface SourceReference + */ +export interface SourceReference { + /** + * The language id + * @type {string} + * @memberof SourceReference + */ + language: string; + /** + * The text that should be displayed + * @type {string} + * @memberof SourceReference + */ + text: string; +} + +/** + * Check if a given object implements the SourceReference interface. + */ +export function instanceOfSourceReference(value: object): value is SourceReference { + if (!('language' in value) || value['language'] === undefined) return false; + if (!('text' in value) || value['text'] === undefined) return false; + return true; +} + +export function SourceReferenceFromJSON(json: any): SourceReference { + return SourceReferenceFromJSONTyped(json, false); +} + +export function SourceReferenceFromJSONTyped(json: any, ignoreDiscriminator: boolean): SourceReference { + if (json == null) { + return json; + } + return { + + 'language': json['language'], + 'text': json['text'], + }; +} + +export function SourceReferenceToJSON(json: any): SourceReference { + return SourceReferenceToJSONTyped(json, false); +} + +export function SourceReferenceToJSONTyped(value?: SourceReference | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'language': value['language'], + 'text': value['text'], + }; +} + diff --git a/typescript-fetch/src/models/Table.ts b/typescript-fetch/src/models/Table.ts new file mode 100644 index 0000000..05bb1d4 --- /dev/null +++ b/typescript-fetch/src/models/Table.ts @@ -0,0 +1,199 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { FolderContentItemTypeEnum } from './FolderContentItemTypeEnum'; +import { + FolderContentItemTypeEnumFromJSON, + FolderContentItemTypeEnumFromJSONTyped, + FolderContentItemTypeEnumToJSON, + FolderContentItemTypeEnumToJSONTyped, +} from './FolderContentItemTypeEnum'; +import type { PathElement } from './PathElement'; +import { + PathElementFromJSON, + PathElementFromJSONTyped, + PathElementToJSON, + PathElementToJSONTyped, +} from './PathElement'; +import type { TimeUnit } from './TimeUnit'; +import { + TimeUnitFromJSON, + TimeUnitFromJSONTyped, + TimeUnitToJSON, + TimeUnitToJSONTyped, +} from './TimeUnit'; +import type { FolderContentItem } from './FolderContentItem'; +import { + FolderContentItemFromJSON, + FolderContentItemFromJSONTyped, + FolderContentItemToJSON, + FolderContentItemToJSONTyped, +} from './FolderContentItem'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * Table item + * @export + * @interface Table + */ +export interface Table extends FolderContentItem { + /** + * + * @type {Array} + * @memberof Table + */ + tags?: Array; + /** + * Date and time when the figures in the table was last updated, in UTC time. + * @type {Date} + * @memberof Table + */ + updated: Date | null; + /** + * First period + * @type {string} + * @memberof Table + */ + firstPeriod: string | null; + /** + * Last period + * @type {string} + * @memberof Table + */ + lastPeriod: string | null; + /** + * Mostly for internal use. Which category table belongs to. internal, public, private or section. + * @type {string} + * @memberof Table + */ + category?: TableCategoryEnum; + /** + * List of varibles name + * @type {Array} + * @memberof Table + */ + variableNames: Array; + /** + * If the table is discontinued or not. That is if it no longer updated with new figures. + * @type {boolean} + * @memberof Table + */ + discontinued?: boolean | null; + /** + * The source of the table + * @type {string} + * @memberof Table + */ + source?: string; + /** + * + * @type {TimeUnit} + * @memberof Table + */ + timeUnit?: TimeUnit; + /** + * The path to the table + * @type {Array>} + * @memberof Table + */ + paths?: Array>; + /** + * Links to ... + * @type {Array} + * @memberof Table + */ + links: Array | null; +} + + +/** + * @export + */ +export const TableCategoryEnum = { + Internal: 'internal', + Public: 'public', + Private: 'private', + Section: 'section' +} as const; +export type TableCategoryEnum = typeof TableCategoryEnum[keyof typeof TableCategoryEnum]; + + +/** + * Check if a given object implements the Table interface. + */ +export function instanceOfTable(value: object): value is Table { + if (!('updated' in value) || value['updated'] === undefined) return false; + if (!('firstPeriod' in value) || value['firstPeriod'] === undefined) return false; + if (!('lastPeriod' in value) || value['lastPeriod'] === undefined) return false; + if (!('variableNames' in value) || value['variableNames'] === undefined) return false; + if (!('links' in value) || value['links'] === undefined) return false; + return true; +} + +export function TableFromJSON(json: any): Table { + return TableFromJSONTyped(json, false); +} + +export function TableFromJSONTyped(json: any, ignoreDiscriminator: boolean): Table { + if (json == null) { + return json; + } + return { + ...FolderContentItemFromJSONTyped(json, true), + 'tags': json['tags'] == null ? undefined : json['tags'], + 'updated': (json['updated'] == null ? null : new Date(json['updated'])), + 'firstPeriod': json['firstPeriod'], + 'lastPeriod': json['lastPeriod'], + 'category': json['category'] == null ? undefined : json['category'], + 'variableNames': json['variableNames'], + 'discontinued': json['discontinued'] == null ? undefined : json['discontinued'], + 'source': json['source'] == null ? undefined : json['source'], + 'timeUnit': json['timeUnit'] == null ? undefined : TimeUnitFromJSON(json['timeUnit']), + 'paths': json['paths'] == null ? undefined : json['paths'], + 'links': (json['links'] == null ? null : (json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function TableToJSON(json: any): Table { + return TableToJSONTyped(json, false); +} + +export function TableToJSONTyped(value?: Table | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + ...FolderContentItemToJSONTyped(value, true), + 'tags': value['tags'], + 'updated': (value['updated'] == null ? null : (value['updated'] as any).toISOString()), + 'firstPeriod': value['firstPeriod'], + 'lastPeriod': value['lastPeriod'], + 'category': value['category'], + 'variableNames': value['variableNames'], + 'discontinued': value['discontinued'], + 'source': value['source'], + 'timeUnit': TimeUnitToJSON(value['timeUnit']), + 'paths': value['paths'], + 'links': (value['links'] == null ? null : (value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/TableResponse.ts b/typescript-fetch/src/models/TableResponse.ts new file mode 100644 index 0000000..8265a00 --- /dev/null +++ b/typescript-fetch/src/models/TableResponse.ts @@ -0,0 +1,104 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { FolderContentItemTypeEnum } from './FolderContentItemTypeEnum'; +import { + FolderContentItemTypeEnumFromJSON, + FolderContentItemTypeEnumFromJSONTyped, + FolderContentItemTypeEnumToJSON, + FolderContentItemTypeEnumToJSONTyped, +} from './FolderContentItemTypeEnum'; +import type { Table } from './Table'; +import { + TableFromJSON, + TableFromJSONTyped, + TableToJSON, + TableToJSONTyped, +} from './Table'; +import type { PathElement } from './PathElement'; +import { + PathElementFromJSON, + PathElementFromJSONTyped, + PathElementToJSON, + PathElementToJSONTyped, +} from './PathElement'; +import type { TimeUnit } from './TimeUnit'; +import { + TimeUnitFromJSON, + TimeUnitFromJSONTyped, + TimeUnitToJSON, + TimeUnitToJSONTyped, +} from './TimeUnit'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface TableResponse + */ +export interface TableResponse extends Table { + /** + * The language code (ISO 639) for this response + * @type {string} + * @memberof TableResponse + */ + language: string; +} + + + +/** + * Check if a given object implements the TableResponse interface. + */ +export function instanceOfTableResponse(value: object): value is TableResponse { + if (!('language' in value) || value['language'] === undefined) return false; + return true; +} + +export function TableResponseFromJSON(json: any): TableResponse { + return TableResponseFromJSONTyped(json, false); +} + +export function TableResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TableResponse { + if (json == null) { + return json; + } + return { + ...TableFromJSONTyped(json, true), + 'language': json['language'], + }; +} + +export function TableResponseToJSON(json: any): TableResponse { + return TableResponseToJSONTyped(json, false); +} + +export function TableResponseToJSONTyped(value?: TableResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + ...TableToJSONTyped(value, true), + 'language': value['language'], + }; +} + diff --git a/typescript-fetch/src/models/TablesResponse.ts b/typescript-fetch/src/models/TablesResponse.ts new file mode 100644 index 0000000..5218f5d --- /dev/null +++ b/typescript-fetch/src/models/TablesResponse.ts @@ -0,0 +1,114 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { PageInfo } from './PageInfo'; +import { + PageInfoFromJSON, + PageInfoFromJSONTyped, + PageInfoToJSON, + PageInfoToJSONTyped, +} from './PageInfo'; +import type { Table } from './Table'; +import { + TableFromJSON, + TableFromJSONTyped, + TableToJSON, + TableToJSONTyped, +} from './Table'; +import type { Link } from './Link'; +import { + LinkFromJSON, + LinkFromJSONTyped, + LinkToJSON, + LinkToJSONTyped, +} from './Link'; + +/** + * + * @export + * @interface TablesResponse + */ +export interface TablesResponse { + /** + * The language code (ISO 639) for this response + * @type {string} + * @memberof TablesResponse + */ + language: string; + /** + * + * @type {Array} + * @memberof TablesResponse + */ + tables: Array
; + /** + * + * @type {PageInfo} + * @memberof TablesResponse + */ + page: PageInfo; + /** + * + * @type {Array} + * @memberof TablesResponse + */ + links?: Array; +} + +/** + * Check if a given object implements the TablesResponse interface. + */ +export function instanceOfTablesResponse(value: object): value is TablesResponse { + if (!('language' in value) || value['language'] === undefined) return false; + if (!('tables' in value) || value['tables'] === undefined) return false; + if (!('page' in value) || value['page'] === undefined) return false; + return true; +} + +export function TablesResponseFromJSON(json: any): TablesResponse { + return TablesResponseFromJSONTyped(json, false); +} + +export function TablesResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TablesResponse { + if (json == null) { + return json; + } + return { + + 'language': json['language'], + 'tables': ((json['tables'] as Array).map(TableFromJSON)), + 'page': PageInfoFromJSON(json['page']), + 'links': json['links'] == null ? undefined : ((json['links'] as Array).map(LinkFromJSON)), + }; +} + +export function TablesResponseToJSON(json: any): TablesResponse { + return TablesResponseToJSONTyped(json, false); +} + +export function TablesResponseToJSONTyped(value?: TablesResponse | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'language': value['language'], + 'tables': ((value['tables'] as Array).map(TableToJSON)), + 'page': PageInfoToJSON(value['page']), + 'links': value['links'] == null ? undefined : ((value['links'] as Array).map(LinkToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/TimeUnit.ts b/typescript-fetch/src/models/TimeUnit.ts new file mode 100644 index 0000000..9b3e462 --- /dev/null +++ b/typescript-fetch/src/models/TimeUnit.ts @@ -0,0 +1,56 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +/** + * Indicates the time scale for the variable. + * @export + */ +export const TimeUnit = { + Annual: 'Annual', + Quarterly: 'Quarterly', + Monthly: 'Monthly', + Weekly: 'Weekly', + Other: 'Other' +} as const; +export type TimeUnit = typeof TimeUnit[keyof typeof TimeUnit]; + + +export function instanceOfTimeUnit(value: any): boolean { + for (const key in TimeUnit) { + if (Object.prototype.hasOwnProperty.call(TimeUnit, key)) { + if (TimeUnit[key as keyof typeof TimeUnit] === value) { + return true; + } + } + } + return false; +} + +export function TimeUnitFromJSON(json: any): TimeUnit { + return TimeUnitFromJSONTyped(json, false); +} + +export function TimeUnitFromJSONTyped(json: any, ignoreDiscriminator: boolean): TimeUnit { + return json as TimeUnit; +} + +export function TimeUnitToJSON(value?: TimeUnit | null): any { + return value as any; +} + +export function TimeUnitToJSONTyped(value: any, ignoreDiscriminator: boolean): TimeUnit { + return value as TimeUnit; +} + diff --git a/typescript-fetch/src/models/ValueMap.ts b/typescript-fetch/src/models/ValueMap.ts new file mode 100644 index 0000000..5ef80fd --- /dev/null +++ b/typescript-fetch/src/models/ValueMap.ts @@ -0,0 +1,100 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { Note } from './Note'; +import { + NoteFromJSON, + NoteFromJSONTyped, + NoteToJSON, + NoteToJSONTyped, +} from './Note'; + +/** + * + * @export + * @interface ValueMap + */ +export interface ValueMap { + /** + * The code for the value. + * @type {string} + * @memberof ValueMap + */ + code: string; + /** + * The textual representation for the value + * @type {string} + * @memberof ValueMap + */ + label: string; + /** + * An array of codes from the origial codelist for the variable that cand be mapped to this value + * @type {Array} + * @memberof ValueMap + */ + valueMap: Array; + /** + * Optional notes that are associated with the value + * @type {Array} + * @memberof ValueMap + */ + notes?: Array; +} + +/** + * Check if a given object implements the ValueMap interface. + */ +export function instanceOfValueMap(value: object): value is ValueMap { + if (!('code' in value) || value['code'] === undefined) return false; + if (!('label' in value) || value['label'] === undefined) return false; + if (!('valueMap' in value) || value['valueMap'] === undefined) return false; + return true; +} + +export function ValueMapFromJSON(json: any): ValueMap { + return ValueMapFromJSONTyped(json, false); +} + +export function ValueMapFromJSONTyped(json: any, ignoreDiscriminator: boolean): ValueMap { + if (json == null) { + return json; + } + return { + + 'code': json['code'], + 'label': json['label'], + 'valueMap': json['valueMap'], + 'notes': json['notes'] == null ? undefined : ((json['notes'] as Array).map(NoteFromJSON)), + }; +} + +export function ValueMapToJSON(json: any): ValueMap { + return ValueMapToJSONTyped(json, false); +} + +export function ValueMapToJSONTyped(value?: ValueMap | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'code': value['code'], + 'label': value['label'], + 'valueMap': value['valueMap'], + 'notes': value['notes'] == null ? undefined : ((value['notes'] as Array).map(NoteToJSON)), + }; +} + diff --git a/typescript-fetch/src/models/VariablePlacementType.ts b/typescript-fetch/src/models/VariablePlacementType.ts new file mode 100644 index 0000000..34f5d57 --- /dev/null +++ b/typescript-fetch/src/models/VariablePlacementType.ts @@ -0,0 +1,73 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface VariablePlacementType + */ +export interface VariablePlacementType { + /** + * List of variables that should be placed in the heading in the resulting data + * @type {Array} + * @memberof VariablePlacementType + */ + heading?: Array; + /** + * List of variables that should be placed in the stub in the resulting data + * @type {Array} + * @memberof VariablePlacementType + */ + stub?: Array; +} + +/** + * Check if a given object implements the VariablePlacementType interface. + */ +export function instanceOfVariablePlacementType(value: object): value is VariablePlacementType { + return true; +} + +export function VariablePlacementTypeFromJSON(json: any): VariablePlacementType { + return VariablePlacementTypeFromJSONTyped(json, false); +} + +export function VariablePlacementTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): VariablePlacementType { + if (json == null) { + return json; + } + return { + + 'heading': json['heading'] == null ? undefined : json['heading'], + 'stub': json['stub'] == null ? undefined : json['stub'], + }; +} + +export function VariablePlacementTypeToJSON(json: any): VariablePlacementType { + return VariablePlacementTypeToJSONTyped(json, false); +} + +export function VariablePlacementTypeToJSONTyped(value?: VariablePlacementType | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'heading': value['heading'], + 'stub': value['stub'], + }; +} + diff --git a/typescript-fetch/src/models/VariableSelection.ts b/typescript-fetch/src/models/VariableSelection.ts new file mode 100644 index 0000000..6dc7644 --- /dev/null +++ b/typescript-fetch/src/models/VariableSelection.ts @@ -0,0 +1,82 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +/** + * + * @export + * @interface VariableSelection + */ +export interface VariableSelection { + /** + * The variable code. + * @type {string} + * @memberof VariableSelection + */ + variableCode: string; + /** + * The identifier of the codelist that should be applied + * @type {string} + * @memberof VariableSelection + */ + codeList?: string | null; + /** + * An array of string that specifies wich values sould be selected. Either as value codes or value expressions + * @type {Array} + * @memberof VariableSelection + */ + valueCodes?: Array; +} + +/** + * Check if a given object implements the VariableSelection interface. + */ +export function instanceOfVariableSelection(value: object): value is VariableSelection { + if (!('variableCode' in value) || value['variableCode'] === undefined) return false; + return true; +} + +export function VariableSelectionFromJSON(json: any): VariableSelection { + return VariableSelectionFromJSONTyped(json, false); +} + +export function VariableSelectionFromJSONTyped(json: any, ignoreDiscriminator: boolean): VariableSelection { + if (json == null) { + return json; + } + return { + + 'variableCode': json['variableCode'], + 'codeList': json['codeList'] == null ? undefined : json['codeList'], + 'valueCodes': json['valueCodes'] == null ? undefined : json['valueCodes'], + }; +} + +export function VariableSelectionToJSON(json: any): VariableSelection { + return VariableSelectionToJSONTyped(json, false); +} + +export function VariableSelectionToJSONTyped(value?: VariableSelection | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'variableCode': value['variableCode'], + 'codeList': value['codeList'], + 'valueCodes': value['valueCodes'], + }; +} + diff --git a/typescript-fetch/src/models/VariablesSelection.ts b/typescript-fetch/src/models/VariablesSelection.ts new file mode 100644 index 0000000..0d959ec --- /dev/null +++ b/typescript-fetch/src/models/VariablesSelection.ts @@ -0,0 +1,89 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +import { mapValues } from '../runtime'; +import type { VariablePlacementType } from './VariablePlacementType'; +import { + VariablePlacementTypeFromJSON, + VariablePlacementTypeFromJSONTyped, + VariablePlacementTypeToJSON, + VariablePlacementTypeToJSONTyped, +} from './VariablePlacementType'; +import type { VariableSelection } from './VariableSelection'; +import { + VariableSelectionFromJSON, + VariableSelectionFromJSONTyped, + VariableSelectionToJSON, + VariableSelectionToJSONTyped, +} from './VariableSelection'; + +/** + * + * @export + * @interface VariablesSelection + */ +export interface VariablesSelection { + /** + * + * @type {Array} + * @memberof VariablesSelection + */ + selection: Array; + /** + * + * @type {VariablePlacementType} + * @memberof VariablesSelection + */ + placement?: VariablePlacementType; +} + +/** + * Check if a given object implements the VariablesSelection interface. + */ +export function instanceOfVariablesSelection(value: object): value is VariablesSelection { + if (!('selection' in value) || value['selection'] === undefined) return false; + return true; +} + +export function VariablesSelectionFromJSON(json: any): VariablesSelection { + return VariablesSelectionFromJSONTyped(json, false); +} + +export function VariablesSelectionFromJSONTyped(json: any, ignoreDiscriminator: boolean): VariablesSelection { + if (json == null) { + return json; + } + return { + + 'selection': ((json['selection'] as Array).map(VariableSelectionFromJSON)), + 'placement': json['placement'] == null ? undefined : VariablePlacementTypeFromJSON(json['placement']), + }; +} + +export function VariablesSelectionToJSON(json: any): VariablesSelection { + return VariablesSelectionToJSONTyped(json, false); +} + +export function VariablesSelectionToJSONTyped(value?: VariablesSelection | null, ignoreDiscriminator: boolean = false): any { + if (value == null) { + return value; + } + + return { + + 'selection': ((value['selection'] as Array).map(VariableSelectionToJSON)), + 'placement': VariablePlacementTypeToJSON(value['placement']), + }; +} + diff --git a/typescript-fetch/src/models/index.ts b/typescript-fetch/src/models/index.ts new file mode 100644 index 0000000..9a8e797 --- /dev/null +++ b/typescript-fetch/src/models/index.ts @@ -0,0 +1,50 @@ +/* tslint:disable */ +/* eslint-disable */ +export * from './Adjustment'; +export * from './ApiFeature'; +export * from './ClassType'; +export * from './CodeListInformation'; +export * from './CodeListMetadata'; +export * from './CodeListResponse'; +export * from './CodeListType'; +export * from './CodeListsResponse'; +export * from './ConfigResponse'; +export * from './Contact'; +export * from './Dataset'; +export * from './DimensionExtension'; +export * from './DimensionValue'; +export * from './ExtensionDimension'; +export * from './ExtensionRoot'; +export * from './ExtensionRootPx'; +export * from './FolderContentItem'; +export * from './FolderContentItemTypeEnum'; +export * from './FolderInformation'; +export * from './FolderResponse'; +export * from './Heading'; +export * from './JsonstatCategory'; +export * from './JsonstatCategoryUnitValue'; +export * from './JsonstatExtensionLink'; +export * from './JsonstatLink'; +export * from './KeyValuePair'; +export * from './Language'; +export * from './Link'; +export * from './MeasuringType'; +export * from './Note'; +export * from './OutputFormatParamType'; +export * from './OutputFormatType'; +export * from './PageInfo'; +export * from './PathElement'; +export * from './PriceType'; +export * from './Problem'; +export * from './Role'; +export * from './SavedQuery'; +export * from './SelectionResponse'; +export * from './SourceReference'; +export * from './Table'; +export * from './TableResponse'; +export * from './TablesResponse'; +export * from './TimeUnit'; +export * from './ValueMap'; +export * from './VariablePlacementType'; +export * from './VariableSelection'; +export * from './VariablesSelection'; diff --git a/typescript-fetch/src/runtime.ts b/typescript-fetch/src/runtime.ts new file mode 100644 index 0000000..7f5d64c --- /dev/null +++ b/typescript-fetch/src/runtime.ts @@ -0,0 +1,431 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * PxApi + * This api lets you do 2 things; Find a table(Navigation) and use a table (Table). _Table below is added to show how tables can be described in yml._ **Table contains status code this API may return** | Status code | Description | Reason | | ------- | ----------- | --------------------- | | 200 | Success | The endpoint has delivered response for the request | | 400 | Bad request | If the request is not valid | | 403 | Forbidden | number of cells exceed the API limit | | 404 | Not found | If the URL in request does not exist | | 429 | Too many request | Requests exceed the API time limit. Large queries should be run in sequence | | 50X | Internal Server Error | The service might be down | + * + * The version of the OpenAPI document: 2.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export const BASE_PATH = "http://localhost".replace(/\/+$/, ""); + +export interface ConfigurationParameters { + basePath?: string; // override base path + fetchApi?: FetchAPI; // override for fetch implementation + middleware?: Middleware[]; // middleware to apply before/after fetch requests + queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings + username?: string; // parameter for basic security + password?: string; // parameter for basic security + apiKey?: string | Promise | ((name: string) => string | Promise); // parameter for apiKey security + accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string | Promise); // parameter for oauth2 security + headers?: HTTPHeaders; //header params we want to use on every request + credentials?: RequestCredentials; //value for the credentials param we want to use on each request +} + +export class Configuration { + constructor(private configuration: ConfigurationParameters = {}) {} + + set config(configuration: Configuration) { + this.configuration = configuration; + } + + get basePath(): string { + return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH; + } + + get fetchApi(): FetchAPI | undefined { + return this.configuration.fetchApi; + } + + get middleware(): Middleware[] { + return this.configuration.middleware || []; + } + + get queryParamsStringify(): (params: HTTPQuery) => string { + return this.configuration.queryParamsStringify || querystring; + } + + get username(): string | undefined { + return this.configuration.username; + } + + get password(): string | undefined { + return this.configuration.password; + } + + get apiKey(): ((name: string) => string | Promise) | undefined { + const apiKey = this.configuration.apiKey; + if (apiKey) { + return typeof apiKey === 'function' ? apiKey : () => apiKey; + } + return undefined; + } + + get accessToken(): ((name?: string, scopes?: string[]) => string | Promise) | undefined { + const accessToken = this.configuration.accessToken; + if (accessToken) { + return typeof accessToken === 'function' ? accessToken : async () => accessToken; + } + return undefined; + } + + get headers(): HTTPHeaders | undefined { + return this.configuration.headers; + } + + get credentials(): RequestCredentials | undefined { + return this.configuration.credentials; + } +} + +export const DefaultConfig = new Configuration(); + +/** + * This is the base class for all generated API classes. + */ +export class BaseAPI { + + private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i'); + private middleware: Middleware[]; + + constructor(protected configuration = DefaultConfig) { + this.middleware = configuration.middleware; + } + + withMiddleware(this: T, ...middlewares: Middleware[]) { + const next = this.clone(); + next.middleware = next.middleware.concat(...middlewares); + return next; + } + + withPreMiddleware(this: T, ...preMiddlewares: Array) { + const middlewares = preMiddlewares.map((pre) => ({ pre })); + return this.withMiddleware(...middlewares); + } + + withPostMiddleware(this: T, ...postMiddlewares: Array) { + const middlewares = postMiddlewares.map((post) => ({ post })); + return this.withMiddleware(...middlewares); + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + protected isJsonMime(mime: string | null | undefined): boolean { + if (!mime) { + return false; + } + return BaseAPI.jsonRegex.test(mime); + } + + protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise { + const { url, init } = await this.createFetchParams(context, initOverrides); + const response = await this.fetchApi(url, init); + if (response && (response.status >= 200 && response.status < 300)) { + return response; + } + throw new ResponseError(response, 'Response returned an error code'); + } + + private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) { + let url = this.configuration.basePath + context.path; + if (context.query !== undefined && Object.keys(context.query).length !== 0) { + // only add the querystring to the URL if there are query parameters. + // this is done to avoid urls ending with a "?" character which buggy webservers + // do not handle correctly sometimes. + url += '?' + this.configuration.queryParamsStringify(context.query); + } + + const headers = Object.assign({}, this.configuration.headers, context.headers); + Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {}); + + const initOverrideFn = + typeof initOverrides === "function" + ? initOverrides + : async () => initOverrides; + + const initParams = { + method: context.method, + headers, + body: context.body, + credentials: this.configuration.credentials, + }; + + const overriddenInit: RequestInit = { + ...initParams, + ...(await initOverrideFn({ + init: initParams, + context, + })) + }; + + let body: any; + if (isFormData(overriddenInit.body) + || (overriddenInit.body instanceof URLSearchParams) + || isBlob(overriddenInit.body)) { + body = overriddenInit.body; + } else if (this.isJsonMime(headers['Content-Type'])) { + body = JSON.stringify(overriddenInit.body); + } else { + body = overriddenInit.body; + } + + const init: RequestInit = { + ...overriddenInit, + body + }; + + return { url, init }; + } + + private fetchApi = async (url: string, init: RequestInit) => { + let fetchParams = { url, init }; + for (const middleware of this.middleware) { + if (middleware.pre) { + fetchParams = await middleware.pre({ + fetch: this.fetchApi, + ...fetchParams, + }) || fetchParams; + } + } + let response: Response | undefined = undefined; + try { + response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init); + } catch (e) { + for (const middleware of this.middleware) { + if (middleware.onError) { + response = await middleware.onError({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + error: e, + response: response ? response.clone() : undefined, + }) || response; + } + } + if (response === undefined) { + if (e instanceof Error) { + throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response'); + } else { + throw e; + } + } + } + for (const middleware of this.middleware) { + if (middleware.post) { + response = await middleware.post({ + fetch: this.fetchApi, + url: fetchParams.url, + init: fetchParams.init, + response: response.clone(), + }) || response; + } + } + return response; + } + + /** + * Create a shallow clone of `this` by constructing a new instance + * and then shallow cloning data members. + */ + private clone(this: T): T { + const constructor = this.constructor as any; + const next = new constructor(this.configuration); + next.middleware = this.middleware.slice(); + return next; + } +}; + +function isBlob(value: any): value is Blob { + return typeof Blob !== 'undefined' && value instanceof Blob; +} + +function isFormData(value: any): value is FormData { + return typeof FormData !== "undefined" && value instanceof FormData; +} + +export class ResponseError extends Error { + override name: "ResponseError" = "ResponseError"; + constructor(public response: Response, msg?: string) { + super(msg); + } +} + +export class FetchError extends Error { + override name: "FetchError" = "FetchError"; + constructor(public cause: Error, msg?: string) { + super(msg); + } +} + +export class RequiredError extends Error { + override name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +export type FetchAPI = WindowOrWorkerGlobalScope['fetch']; + +export type Json = any; +export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD'; +export type HTTPHeaders = { [key: string]: string }; +export type HTTPQuery = { [key: string]: string | number | null | boolean | Array | Set | HTTPQuery }; +export type HTTPBody = Json | FormData | URLSearchParams; +export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody }; +export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original'; + +export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise + +export interface FetchParams { + url: string; + init: RequestInit; +} + +export interface RequestOpts { + path: string; + method: HTTPMethod; + headers: HTTPHeaders; + query?: HTTPQuery; + body?: HTTPBody; +} + +export function querystring(params: HTTPQuery, prefix: string = ''): string { + return Object.keys(params) + .map(key => querystringSingleKey(key, params[key], prefix)) + .filter(part => part.length > 0) + .join('&'); +} + +function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array | Set | HTTPQuery, keyPrefix: string = ''): string { + const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key); + if (value instanceof Array) { + const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue))) + .join(`&${encodeURIComponent(fullKey)}=`); + return `${encodeURIComponent(fullKey)}=${multiValue}`; + } + if (value instanceof Set) { + const valueAsArray = Array.from(value); + return querystringSingleKey(key, valueAsArray, keyPrefix); + } + if (value instanceof Date) { + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`; + } + if (value instanceof Object) { + return querystring(value as HTTPQuery, fullKey); + } + return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`; +} + +export function exists(json: any, key: string) { + const value = json[key]; + return value !== null && value !== undefined; +} + +export function mapValues(data: any, fn: (item: any) => any) { + return Object.keys(data).reduce( + (acc, key) => ({ ...acc, [key]: fn(data[key]) }), + {} + ); +} + +export function canConsumeForm(consumes: Consume[]): boolean { + for (const consume of consumes) { + if ('multipart/form-data' === consume.contentType) { + return true; + } + } + return false; +} + +export interface Consume { + contentType: string; +} + +export interface RequestContext { + fetch: FetchAPI; + url: string; + init: RequestInit; +} + +export interface ResponseContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + response: Response; +} + +export interface ErrorContext { + fetch: FetchAPI; + url: string; + init: RequestInit; + error: unknown; + response?: Response; +} + +export interface Middleware { + pre?(context: RequestContext): Promise; + post?(context: ResponseContext): Promise; + onError?(context: ErrorContext): Promise; +} + +export interface ApiResponse { + raw: Response; + value(): Promise; +} + +export interface ResponseTransformer { + (json: any): T; +} + +export class JSONApiResponse { + constructor(public raw: Response, private transformer: ResponseTransformer = (jsonValue: any) => jsonValue) {} + + async value(): Promise { + return this.transformer(await this.raw.json()); + } +} + +export class VoidApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return undefined; + } +} + +export class BlobApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.blob(); + }; +} + +export class TextApiResponse { + constructor(public raw: Response) {} + + async value(): Promise { + return await this.raw.text(); + }; +} diff --git a/typescript-fetch/tsconfig.json b/typescript-fetch/tsconfig.json new file mode 100644 index 0000000..4567ec1 --- /dev/null +++ b/typescript-fetch/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "moduleResolution": "node", + "outDir": "dist", + "lib": [ + "es6", + "dom" + ], + "typeRoots": [ + "node_modules/@types" + ] + }, + "exclude": [ + "dist", + "node_modules" + ] +}