This commit is contained in:
Islam Shehata
2024-04-22 16:18:31 +02:00
commit 5af87e0567
6 changed files with 416 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@@ -0,0 +1,11 @@
/models
/models/errors
/types
/lib
/sdk
/hooks
/index.*
/cjs
/node_modules
/.tsbuildinfo
/sdks

76
.speakeasy/gen.lock Executable file
View File

@@ -0,0 +1,76 @@
lockVersion: 2.0.0
id: 96ed1f55-25a7-4285-99c3-e65d0d9e3e68
management:
docChecksum: 2e0930ee7c51185a6fafcce81e2b1c08
docVersion: "2"
speakeasyVersion: 1.267.1
generationVersion: 2.312.1
releaseVersion: 0.0.1
configChecksum: dccd54b2decd1337051f75336f7d093f
features:
typescript:
core: 3.8.0
flattening: 2.81.1
globalSecurity: 2.82.9
globalServerURLs: 2.82.4
responseFormat: 0.2.3
generatedFiles:
- src/sdk/annotations.ts
- src/sdk/sdk.ts
- .eslintrc.js
- .npmignore
- RUNTIMES.md
- jsr.json
- package.json
- src/index.ts
- src/lib/base64.ts
- src/lib/config.ts
- src/lib/encodings.ts
- src/lib/http.ts
- src/lib/retries.ts
- src/lib/schemas.ts
- src/lib/sdks.ts
- src/lib/security.ts
- src/lib/url.ts
- src/sdk/index.ts
- src/models/errors/sdkerror.ts
- src/models/errors/sdkvalidationerror.ts
- src/types/blobs.ts
- src/types/index.ts
- src/types/operations.ts
- src/types/rfcdate.ts
- tsconfig.json
- src/models/operations/getannotation.ts
- src/models/operations/updateannotation.ts
- src/models/operations/deleteannotation.ts
- src/models/operations/getannotations.ts
- src/models/operations/createannotation.ts
- src/models/components/annotation.ts
- src/models/components/httpmetadata.ts
- src/models/components/baseannotation.ts
- src/models/components/newannotation.ts
- src/models/components/security.ts
- src/models/errors/index.ts
- src/models/operations/index.ts
- src/models/components/index.ts
- docs/models/operations/getannotationrequest.md
- docs/models/operations/getannotationresponse.md
- docs/models/operations/updateannotationrequest.md
- docs/models/operations/updateannotationresponse.md
- docs/models/operations/deleteannotationrequest.md
- docs/models/operations/deleteannotationresponse.md
- docs/models/operations/getannotationsrequest.md
- docs/models/operations/getannotationsresponse.md
- docs/models/operations/createannotationresponse.md
- docs/models/components/annotation.md
- docs/models/components/httpmetadata.md
- docs/models/components/baseannotation.md
- docs/models/components/newannotation.md
- docs/models/components/security.md
- docs/sdks/axiomjs/README.md
- docs/sdks/annotations/README.md
- USAGE.md
- .gitattributes
- src/hooks/hooks.ts
- src/hooks/types.ts
- src/hooks/index.ts

38
.speakeasy/gen.yaml Executable file
View File

@@ -0,0 +1,38 @@
configVersion: 2.0.0
generation:
sdkClassName: axiom-js
maintainOpenAPIOrder: true
usageSnippets:
optionalPropertyRendering: withExample
useClassNamesForArrayFields: true
fixes:
nameResolutionDec2023: true
parameterOrderingFeb2024: true
requestResponseComponentNamesFeb2024: true
auth:
oAuth2ClientCredentialsEnabled: false
typescript:
version: 0.0.2
additionalDependencies:
dependencies: {}
devDependencies: {}
peerDependencies: {}
additionalPackageJSON: {}
author: Axiom, Inc.
clientServerStatusCodesAsErrors: true
enumFormat: enum
flattenGlobalSecurity: true
imports:
option: openapi
paths:
callbacks: models/callbacks
errors: models/errors
operations: models/operations
shared: models/components
webhooks: models/webhooks
inputModelSuffix: input
maxMethodParams: 4
outputModelSuffix: output
packageName: axiom-js
responseFormat: envelope-http
templateVersion: v2

19
.speakeasy/workflow.lock Normal file
View File

@@ -0,0 +1,19 @@
speakeasyVersion: 1.267.1
sources: {}
targets: {}
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
openapi:
inputs:
- location: openapi.yaml
targets:
axiom-go:
target: go
source: openapi
output: sdks/go
axiom-js:
target: typescript
source: openapi
output: sdks/js

15
.speakeasy/workflow.yaml Normal file
View File

@@ -0,0 +1,15 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
openapi:
inputs:
- location: openapi.yaml
targets:
axiom-go:
target: go
source: openapi
output: sdks/go
axiom-js:
target: typescript
source: openapi
output: sdks/js

257
openapi.yaml Normal file
View File

@@ -0,0 +1,257 @@
openapi: "3.0.3"
info:
title: Axiom API
version: "2"
description: |
100% of your data for every possible need: o11y, security, analytics, and new insights.
contact:
name: Axiom support
email: support@axiom.co
url: https://axiom.co
servers:
- url: https://api.axiom.co
description: Production API
security:
- BearerAuth: []
tags:
- name: Annotations
description: Annotations are used to mark important events in your data.
paths:
/annotations:
get:
operationId: getAnnotations
summary: Get annotations
description: Get all annotations and filter by datasets or timerange.
tags:
- Annotations
parameters:
- in: query
name: datasets
description: The datasets to filter by.
schema:
type: array
items:
type: string
minLength: 1
example: one-dataset,another-dataset
- in: query
name: start
description: If set, will filter to events after this date. Should be in RFC3339.
schema:
type: string
format: date-time
example: "2024-04-19T15:00:00Z"
- in: query
name: end
schema:
type: string
format: date-time
example: "2024-04-19T16:00:00Z"
description: If set, will filter to events before this date. Should be in RFC3339.
responses:
'200':
description: A list of annotations.
content:
application/json:
schema:
type: array
items:
$ref: "#/components/schemas/Annotation"
'400':
$ref: "#/components/responses/400"
'401':
$ref: "#/components/responses/401"
'403':
$ref: "#/components/responses/403"
'500':
$ref: "#/components/responses/500"
post:
operationId: createAnnotation
summary: Create a new annotation.
description: Create a new annotation.
tags:
- Annotations
requestBody:
description: The annotation to create.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/NewAnnotation"
responses:
'201':
description: The new annotation
content:
application/json:
schema:
$ref: "#/components/schemas/Annotation"
'400':
$ref: "#/components/responses/400"
'401':
$ref: "#/components/responses/401"
'403':
$ref: "#/components/responses/403"
'500':
$ref: "#/components/responses/500"
/annotations/{id}:
get:
operationId: getAnnotation
summary: Get a single annotation.
description: Get a single annotation by id.
parameters:
- $ref: '#/components/parameters/annotationId'
responses:
'200':
description: The annotation with the given id.
content:
application/json:
schema:
$ref: "#/components/schemas/Annotation"
'400':
$ref: "#/components/responses/400"
'401':
$ref: "#/components/responses/401"
'403':
$ref: "#/components/responses/403"
'500':
$ref: "#/components/responses/500"
put:
operationId: updateAnnotation
summary: Update an annotation.
description: Update an annotation.
parameters:
- $ref: '#/components/parameters/annotationId'
requestBody:
description: The fields to update.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/UpdateAnnotation"
responses:
'200':
description: The updated annotation.
content:
application/json:
schema:
$ref: "#/components/schemas/Annotation"
'400':
$ref: "#/components/responses/400"
'401':
$ref: "#/components/responses/401"
'403':
$ref: "#/components/responses/403"
'500':
$ref: "#/components/responses/500"
delete:
operationId: deleteAnnotation
summary: Delete an annotation.
description: Delete an annotation by id.
parameters:
- $ref: '#/components/parameters/annotationId'
responses:
'204':
description: Annotation was successfully deleted.
'400':
$ref: "#/components/responses/400"
'401':
$ref: "#/components/responses/401"
'403':
$ref: "#/components/responses/403"
'500':
$ref: "#/components/responses/500"
components:
securitySchemes:
BearerAuth:
type: http
scheme: bearer
responses:
'400':
description: The request is malformed, please check the parameters
# TODO: Add more details on the error
'401':
description: Unauthorized
# TODO: Add more details on the error
'403':
description: Forbidden
# TODO: Add more details on the error
'404':
description: Resource not found
# TODO: Add more details on the error
'500':
description: The server encountered an error
# TODO: Add more details on the error
schemas:
Annotation:
description: An annotation.
allOf:
- $ref: "#/components/schemas/NewAnnotation"
- type: object
required:
- id
properties:
id:
type: string
pattern: ^ann
description: The id of the annotation.
example: ann_0ebfg7cb0r9j3vc4bk4c409t48
NewAnnotation:
description: A new annotation to create.
allOf:
- $ref: "#/components/schemas/BaseAnnotation"
- required:
- id
- datasets
- type
UpdateAnnotation:
description: Fields to update on an annotation.
allOf:
- $ref: "#/components/schemas/BaseAnnotation"
BaseAnnotation:
description: The base annotation, used
type: object
properties:
title:
type: string
maxLength: 512
example: Production deployment
description:
type: string
example: A production deployment happened.
description: The description of the annotation.
time:
type: string
format: date-time
example: "2024-04-19T15:00:00Z"
description: The time of the annotation.
endTime:
type: string
format: date-time
example: "2024-04-19T16:00:00Z"
description: The end time, use for ranged annotations.
type:
type: string
example: deploy
description: The type of the annotation. Can be anything, used for filtering in the UI.
url:
type: string
description: A URL attached to the annotation.
example: https://deployments.example.com/42
datasets:
type: array
minItems: 1
items:
type: string
minLength: 1
example: one-dataset,another-dataset
description: The datasets the annotation is attached to.
parameters:
annotationId:
name: id
in: path
description: The id of the annotation.
schema:
type: string
pattern: ^ann
example: ann_0ebfg7cb0r9j3vc4bk4c409t48
required: true