import { Textql } from "@textql/sdk";
const textql = new Textql({
apiKey: process.env["TEXTQL_API_KEY"] ?? "",
});
async function run() {
const result = await textql.ontology.getFileUsageTimeline({
body: {},
});
console.log(result);
}
run();import os
from textql_sdk import Textql
with Textql(
api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:
res = textql.ontology.get_file_usage_timeline()
# Handle response
print(res)curl --request POST \
--url https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--header 'tql_api_key: <api-key>' \
--data '
{
"pathPrefix": "<string>",
"observationPeriod": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
tql_api_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({pathPrefix: '<string>', observationPeriod: '<string>'})
};
fetch('https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pathPrefix' => '<string>',
'observationPeriod' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json",
"tql_api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline"
payload := strings.NewReader("{\n \"pathPrefix\": \"<string>\",\n \"observationPeriod\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("tql_api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("tql_api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pathPrefix\": \"<string>\",\n \"observationPeriod\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["tql_api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pathPrefix\": \"<string>\",\n \"observationPeriod\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"days": [
{
"date": {
"year": 123,
"month": 123,
"day": 123
},
"averageTokens": 123,
"averageQueryTime": "<string>",
"hitRate": 123,
"numErrors": 123,
"numEmpties": 123,
"chatsPulled": 123,
"chatsUsed": 123
}
]
}{
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "<string>",
"debug": {}
}
]
}Get File Usage Timeline
import { Textql } from "@textql/sdk";
const textql = new Textql({
apiKey: process.env["TEXTQL_API_KEY"] ?? "",
});
async function run() {
const result = await textql.ontology.getFileUsageTimeline({
body: {},
});
console.log(result);
}
run();import os
from textql_sdk import Textql
with Textql(
api_key=os.getenv("TEXTQL_API_KEY", ""),
) as textql:
res = textql.ontology.get_file_usage_timeline()
# Handle response
print(res)curl --request POST \
--url https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline \
--header 'Connect-Protocol-Version: <connect-protocol-version>' \
--header 'Content-Type: application/json' \
--header 'tql_api_key: <api-key>' \
--data '
{
"pathPrefix": "<string>",
"observationPeriod": "<string>"
}
'const options = {
method: 'POST',
headers: {
'Connect-Protocol-Version': '<connect-protocol-version>',
tql_api_key: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({pathPrefix: '<string>', observationPeriod: '<string>'})
};
fetch('https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'pathPrefix' => '<string>',
'observationPeriod' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Connect-Protocol-Version: <connect-protocol-version>",
"Content-Type: application/json",
"tql_api_key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline"
payload := strings.NewReader("{\n \"pathPrefix\": \"<string>\",\n \"observationPeriod\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Connect-Protocol-Version", "<connect-protocol-version>")
req.Header.Add("tql_api_key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline")
.header("Connect-Protocol-Version", "<connect-protocol-version>")
.header("tql_api_key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pathPrefix\": \"<string>\",\n \"observationPeriod\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.textql.com/rpc/public/textql.rpc.public.patches.OntologyManagementService/GetFileUsageTimeline")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Connect-Protocol-Version"] = '<connect-protocol-version>'
request["tql_api_key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"pathPrefix\": \"<string>\",\n \"observationPeriod\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"days": [
{
"date": {
"year": 123,
"month": 123,
"day": 123
},
"averageTokens": 123,
"averageQueryTime": "<string>",
"hitRate": 123,
"numErrors": 123,
"numEmpties": 123,
"chatsPulled": 123,
"chatsUsed": 123
}
]
}{
"message": "<string>",
"details": [
{
"type": "<string>",
"value": "<string>",
"debug": {}
}
]
}Authorizations
Headers
Define the version of the Connect protocol
1 Define the timeout, in ms
Body
A Duration represents a signed, fixed-length span of time represented as a count of seconds and fractions of seconds at nanosecond resolution. It is independent of any calendar and concepts like "day" or "month". It is related to Timestamp in that the difference between two Timestamp values is a Duration and it can be added or subtracted from a Timestamp. Range is approximately +-10,000 years.
Examples
Example 1: Compute Duration from two Timestamps in pseudo code.
Timestamp start = ...;
Timestamp end = ...;
Duration duration = ...;
duration.seconds = end.seconds - start.seconds;
duration.nanos = end.nanos - start.nanos;
if (duration.seconds < 0 && duration.nanos > 0) {
duration.seconds += 1;
duration.nanos -= 1000000000;
} else if (duration.seconds > 0 && duration.nanos < 0) {
duration.seconds -= 1;
duration.nanos += 1000000000;
}
Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
Timestamp start = ...;
Duration duration = ...;
Timestamp end = ...;
end.seconds = start.seconds + duration.seconds;
end.nanos = start.nanos + duration.nanos;
if (end.nanos < 0) {
end.seconds -= 1;
end.nanos += 1000000000;
} else if (end.nanos >= 1000000000) {
end.seconds += 1;
end.nanos -= 1000000000;
}
Example 3: Compute Duration from datetime.timedelta in Python.
td = datetime.timedelta(days=3, minutes=10)
duration = Duration()
duration.FromTimedelta(td)
JSON Mapping
In JSON format, the Duration type is encoded as a string rather than an object, where the string ends in the suffix "s" (indicating seconds) and is preceded by the number of seconds, with nanoseconds expressed as fractional seconds. For example, 3 seconds with 0 nanoseconds should be encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should be expressed in JSON format as "3.000000001s", and 3 seconds and 1 microsecond should be expressed in JSON format as "3.000001s".
Response
Success
Show child attributes
Show child attributes