Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions desktop/src/generated/synkronus-client/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ apis/AttachmentsApi.ts
apis/DataExportApi.ts
apis/DefaultApi.ts
apis/HealthApi.ts
apis/StatsApi.ts
apis/index.ts
docs/APIVersionInfo.md
docs/APIVersionsResponse.md
Expand Down Expand Up @@ -34,7 +35,11 @@ docs/GetHealth503Response.md
docs/HealthApi.md
docs/LoginRequest.md
docs/Observation.md
docs/ObservationFormTypeCount.md
docs/ObservationGeolocation.md
docs/ObservationStatsResponse.md
docs/ObservationTimeline.md
docs/ObservationTimelineBucket.md
docs/ProblemDetail.md
docs/ProblemDetailErrorsInner.md
docs/RefreshTokenRequest.md
Expand All @@ -43,6 +48,7 @@ docs/RepositoryResetResponse.md
docs/ResetUserPassword200Response.md
docs/ResetUserPasswordRequest.md
docs/ServerInfo.md
docs/StatsApi.md
docs/SwitchAppBundleVersion200Response.md
docs/SyncPullRequest.md
docs/SyncPullRequestSince.md
Expand Down Expand Up @@ -85,7 +91,11 @@ models/GetHealth200Response.ts
models/GetHealth503Response.ts
models/LoginRequest.ts
models/Observation.ts
models/ObservationFormTypeCount.ts
models/ObservationGeolocation.ts
models/ObservationStatsResponse.ts
models/ObservationTimeline.ts
models/ObservationTimelineBucket.ts
models/ProblemDetail.ts
models/ProblemDetailErrorsInner.ts
models/RefreshTokenRequest.ts
Expand Down
90 changes: 90 additions & 0 deletions desktop/src/generated/synkronus-client/apis/StatsApi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
// @ts-nocheck
/* tslint:disable */
/* eslint-disable */
/**
* Synkronus API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.6
*
*
* 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 {
ErrorResponse,
ObservationStatsResponse,
} from '../models/index';

export interface GetObservationStatsRequest {
xOdeVersion: string;
}

/**
*
*/
export class StatsApi extends runtime.BaseAPI {

/**
* Creates request options for getObservationStats without sending the request
*/
async getObservationStatsRequestOpts(requestParameters: GetObservationStatsRequest): Promise<runtime.RequestOpts> {
if (requestParameters['xOdeVersion'] == null) {
throw new runtime.RequiredError(
'xOdeVersion',
'Required parameter "xOdeVersion" was null or undefined when calling getObservationStats().'
);
}

const queryParameters: any = {};

const headerParameters: runtime.HTTPHeaders = {};

if (requestParameters['xOdeVersion'] != null) {
headerParameters['x-ode-version'] = String(requestParameters['xOdeVersion']);
}

if (this.configuration && this.configuration.accessToken) {
const token = this.configuration.accessToken;
const tokenString = await token("bearerAuth", ["read-only", "read-write", "admin"]);

if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}

let urlPath = `/api/stats/observations`;

return {
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
};
}

/**
* Returns non-deleted observation totals grouped by form type and a dense activity timeline bucketed by UTC calendar day (or week when the span is at least 365 days). Soft-deleted observations are excluded. Timeline dates use `created_at` interpreted in UTC. Intended for portal/desktop overview charts; not a general-purpose query API.
* Observation aggregate stats for dashboard charts
*/
async getObservationStatsRaw(requestParameters: GetObservationStatsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ObservationStatsResponse>> {
const requestOptions = await this.getObservationStatsRequestOpts(requestParameters);
const response = await this.request(requestOptions, initOverrides);

return new runtime.JSONApiResponse(response);
}

/**
* Returns non-deleted observation totals grouped by form type and a dense activity timeline bucketed by UTC calendar day (or week when the span is at least 365 days). Soft-deleted observations are excluded. Timeline dates use `created_at` interpreted in UTC. Intended for portal/desktop overview charts; not a general-purpose query API.
* Observation aggregate stats for dashboard charts
*/
async getObservationStats(requestParameters: GetObservationStatsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ObservationStatsResponse> {
const response = await this.getObservationStatsRaw(requestParameters, initOverrides);
return await response.value();
}

}
1 change: 1 addition & 0 deletions desktop/src/generated/synkronus-client/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './AttachmentsApi';
export * from './DataExportApi';
export * from './DefaultApi';
export * from './HealthApi';
export * from './StatsApi';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

# ObservationFormTypeCount


## Properties

Name | Type
------------ | -------------
`formType` | string
`count` | number


[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# ObservationStatsResponse


## Properties

Name | Type
------------ | -------------
`totalCount` | number
`byFormType` | [Array&lt;ObservationFormTypeCount&gt;](ObservationFormTypeCount.md)
`timeline` | [ObservationTimeline](ObservationTimeline.md)
`computedAt` | Date


[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


17 changes: 17 additions & 0 deletions desktop/src/generated/synkronus-client/docs/ObservationTimeline.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

# ObservationTimeline


## Properties

Name | Type
------------ | -------------
`bucketUnit` | string
`rangeStart` | string
`rangeEnd` | string
`buckets` | [Array&lt;ObservationTimelineBucket&gt;](ObservationTimelineBucket.md)


[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@

# ObservationTimelineBucket


## Properties

Name | Type
------------ | -------------
`bucketStart` | string
`label` | string
`count` | number


[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)


83 changes: 83 additions & 0 deletions desktop/src/generated/synkronus-client/docs/StatsApi.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# StatsApi

All URIs are relative to *http://localhost*

| Method | HTTP request | Description |
|------------- | ------------- | -------------|
| [**getObservationStats**](StatsApi.md#getobservationstats) | **GET** /api/stats/observations | Observation aggregate stats for dashboard charts |



## getObservationStats

> ObservationStatsResponse getObservationStats(xOdeVersion)

Observation aggregate stats for dashboard charts

Returns non-deleted observation totals grouped by form type and a dense activity timeline bucketed by UTC calendar day (or week when the span is at least 365 days). Soft-deleted observations are excluded. Timeline dates use &#x60;created_at&#x60; interpreted in UTC. Intended for portal/desktop overview charts; not a general-purpose query API.

### Example

```ts
import {
Configuration,
StatsApi,
} from '';
import type { GetObservationStatsRequest } from '';

async function example() {
console.log("🚀 Testing SDK...");
const config = new Configuration({
// Configure HTTP bearer authorization: bearerAuth
accessToken: "YOUR BEARER TOKEN",
});
const api = new StatsApi(config);

const body = {
// string | Client semantic version; the major segment must match the server. Optional leading v/V and semver pre-release/build suffixes are accepted (same rules as Synkronus).
xOdeVersion: 1.0.0,
} satisfies GetObservationStatsRequest;

try {
const data = await api.getObservationStats(body);
console.log(data);
} catch (error) {
console.error(error);
}
}

// Run the test
example().catch(console.error);
```

### Parameters


| Name | Type | Description | Notes |
|------------- | ------------- | ------------- | -------------|
| **xOdeVersion** | `string` | Client semantic version; the major segment must match the server. Optional leading v/V and semver pre-release/build suffixes are accepted (same rules as Synkronus). | [Defaults to `undefined`] |

### Return type

[**ObservationStatsResponse**](ObservationStatsResponse.md)

### Authorization

[bearerAuth](../README.md#bearerAuth)

### HTTP request headers

- **Content-Type**: Not defined
- **Accept**: `application/json`


### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
| **200** | Observation aggregate stats | - |
| **401** | Unauthorized | - |
| **403** | Forbidden | - |
| **500** | Internal server error | - |

[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)

Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// @ts-nocheck
/* tslint:disable */
/* eslint-disable */
/**
* Synkronus API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.0.6
*
*
* 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 ObservationFormTypeCount
*/
export interface ObservationFormTypeCount {
/**
* Form type id; empty/whitespace stored values become "(no form type)"
* @type {string}
* @memberof ObservationFormTypeCount
*/
formType: string;
/**
*
* @type {number}
* @memberof ObservationFormTypeCount
*/
count: number;
}

/**
* Check if a given object implements the ObservationFormTypeCount interface.
*/
export function instanceOfObservationFormTypeCount(value: object): value is ObservationFormTypeCount {
if (!('formType' in value) || value['formType'] === undefined) return false;
if (!('count' in value) || value['count'] === undefined) return false;
return true;
}

export function ObservationFormTypeCountFromJSON(json: any): ObservationFormTypeCount {
return ObservationFormTypeCountFromJSONTyped(json, false);
}

export function ObservationFormTypeCountFromJSONTyped(json: any, ignoreDiscriminator: boolean): ObservationFormTypeCount {
if (json == null) {
return json;
}
return {

'formType': json['formType'],
'count': json['count'],
};
}

export function ObservationFormTypeCountToJSON(json: any): ObservationFormTypeCount {
return ObservationFormTypeCountToJSONTyped(json, false);
}

export function ObservationFormTypeCountToJSONTyped(value?: ObservationFormTypeCount | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}

return {

'formType': value['formType'],
'count': value['count'],
};
}

Loading
Loading