Skip to content

Commit

Permalink
qase-api-v2-client: add a new V2 client
Browse files Browse the repository at this point in the history
Add Qase API V2 client
  • Loading branch information
gibiw committed May 9, 2024
1 parent c60d085 commit a0cfcdc
Show file tree
Hide file tree
Showing 40 changed files with 7,046 additions and 0 deletions.
182 changes: 182 additions & 0 deletions qase-api-v2-client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Go API client for api_v2_client

Qase TestOps API v2 Specification.

## Overview

This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using
the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client.

- API version: 2.0.0
- Package version: 1.0.0
- Generator version: 7.4.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit [https://qase.io](https://qase.io)

## Installation

Install the following dependencies:

```sh
go get github.com/stretchr/testify/assert
go get golang.org/x/net/context
```

Put the package under your project folder and add the following in import:

```go
import api_v2_client "github.com/qase-tms/qase-go/qase-api-v2-client"
```

To use a proxy, set the environment variable `HTTP_PROXY`:

```go
os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")
```

## Configuration of Server URL

Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification.

### Select Server Configuration

For using other server than the one defined on index 0 set context value `api_v2_client.ContextServerIndex` of
type `int`.

```go
ctx := context.WithValue(context.Background(), api_v2_client.ContextServerIndex, 1)
```

### Templated Server URL

Templated server URL is formatted using default variables from configuration or from context
value `api_v2_client.ContextServerVariables` of type `map[string]string`.

```go
ctx := context.WithValue(context.Background(), api_v2_client.ContextServerVariables, map[string]string{
"basePath": "v2",
})
```

Note, enum values are always validated and all unused variables are silently ignored.

### URLs Configuration per Operation

Each operation can use different server URL defined using `OperationServers` map in the `Configuration`.
An operation is uniquely identified by `"{classname}Service.{nickname}"` string.
Similar rules for overriding default operation server index and variables applies by
using `api_v2_client.ContextOperationServerIndices` and `api_v2_client.ContextOperationServerVariables` context maps.

```go
ctx := context.WithValue(context.Background(), api_v2_client.ContextOperationServerIndices, map[string]int{
"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), api_v2_client.ContextOperationServerVariables, map[string]map[string]string{
"{classname}Service.{nickname}": {
"port": "8443",
},
})
```

## Example

```go
package main

import (
"context"
"fmt"

api_v2_client "github.com/qase-tms/qase-go/qase-api-v2-client"
)

func main() {
ctx := context.WithValue(context.Background(), api_v2_client.ContextAPIKeys, map[string]api_v2_client.APIKey{
"TokenAuth": {
Key: "<TOKEN>",
},
})

configuration := api_v2_client.NewConfiguration()
apiClient := api_v2_client.NewAPIClient(configuration)

_, err := apiClient.ResultsAPI.ResultCreate(ctx, ResultCreate{}).Execute()
if err != nil {
fmt.Println(err)
return
}
}
```

## Documentation for API Endpoints

All URIs are relative to *<https://api.qase.io/v2>*

Class | Method | HTTP request | Description
--------------|-----------------------------------------------------------|-----------------------------------------------|------------------------------------
*ResultsAPI* | [**CreateResultV2**](docs/ResultsAPI.md#createresultv2) | **Post** /{project_code}/run/{run_id}/result | (Beta) Create test run result
*ResultsAPI* | [**CreateResultsV2**](docs/ResultsAPI.md#createresultsv2) | **Post** /{project_code}/run/{run_id}/results | (Beta) Bulk create test run result

## Documentation For Models

- [BaseErrorFieldResponse](docs/BaseErrorFieldResponse.md)
- [BaseErrorFieldResponseErrorFieldsInner](docs/BaseErrorFieldResponseErrorFieldsInner.md)
- [BaseErrorResponse](docs/BaseErrorResponse.md)
- [CreateResultV2422Response](docs/CreateResultV2422Response.md)
- [CreateResultsRequestV2](docs/CreateResultsRequestV2.md)
- [RelationSuite](docs/RelationSuite.md)
- [RelationSuiteItem](docs/RelationSuiteItem.md)
- [ResultCreate](docs/ResultCreate.md)
- [ResultExecution](docs/ResultExecution.md)
- [ResultRelations](docs/ResultRelations.md)
- [ResultStep](docs/ResultStep.md)
- [ResultStepData](docs/ResultStepData.md)
- [ResultStepExecution](docs/ResultStepExecution.md)
- [ResultStepStatus](docs/ResultStepStatus.md)
- [ResultStepsType](docs/ResultStepsType.md)

## Documentation For Authorization

Authentication schemes defined for the API:

### TokenAuth

- **Type**: API key
- **API key parameter name**: Token
- **Location**: HTTP header

Note, each API key must be added to a map of `map[string]APIKey` where the key is: Token and passed in as the auth
context for each request.

Example

```go
auth := context.WithValue(
context.Background(),
api_v2_client.ContextAPIKeys,
map[string]api_v2_client.APIKey{
"Token": {Key: "API_KEY_STRING"},
},
)
r, err := client.Service.Operation(auth, args)
```

## Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains
a number of utility functions to easily obtain pointers to values of basic types.
Each of these functions takes a value of the given basic type and returns a pointer to it:

- `PtrBool`
- `PtrInt`
- `PtrInt32`
- `PtrInt64`
- `PtrFloat`
- `PtrFloat32`
- `PtrFloat64`
- `PtrString`
- `PtrTime`

## Author

<[email protected]>
Loading

0 comments on commit a0cfcdc

Please sign in to comment.