Skip to content

Commit

Permalink
move client base code to a central place
Browse files Browse the repository at this point in the history
  • Loading branch information
pitabwire committed Jan 26, 2024
1 parent 951fdfe commit d16f864
Show file tree
Hide file tree
Showing 56 changed files with 544 additions and 892 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Changelog CI

on:
pull_request:
types: [opened, reopened]
types: [ opened, reopened ]

jobs:
build:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
# pull_request event is required only for autolabeler
pull_request:
# Only following types are handled by the action, but one can default to all as well
types: [opened, reopened, synchronize]
types: [ opened, reopened, synchronize ]
# pull_request_target event is required for autolabeler to support PRs from forks
# pull_request_target:
# types: [opened, reopened, synchronize]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Test Api

on: [push]
on: [ push ]

jobs:

Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

[![Tests](https://github.com/antinvestor/apis/actions/workflows/run_tests.yml/badge.svg?branch=main)](https://github.com/antinvestor/apis/actions/workflows/run_tests.yml) [![Buf Build Status](https://github.com/antinvestor/apis/actions/workflows/buf_build.yaml/badge.svg?branch=main)](https://github.com/antinvestor/apis/actions/workflows/buf_build.yaml)


The repository holds the common grpc api library that other clients extend

# requirements
Install
- protoc
- https://github.com/golang/mock

Install
- protoc

- https://github.com/golang/mock

- Installing buf

Expand All @@ -20,7 +20,6 @@ Install
-o "${BIN}/buf" && \
chmod +x "${BIN}/buf"


# proto generation

protoc -I ./service common/common.proto --go_out=./
Expand Down
33 changes: 17 additions & 16 deletions go/files/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
An openAPI 3.0 specification that defines how files are stored and accessed on ant investor products

## 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.

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: 1.0.0
- Package version: 1.0.0
- Build package: org.openapitools.codegen.languages.GoClientCodegen
For more information, please visit [https://antinvestor.com](https://antinvestor.com)
For more information, please visit [https://antinvestor.com](https://antinvestor.com)

## Installation

Expand Down Expand Up @@ -45,7 +47,8 @@ ctx := context.WithValue(context.Background(), file_v1.ContextServerIndex, 1)

### Templated Server URL

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

```go
ctx := context.WithValue(context.Background(), file_v1.ContextServerVariables, map[string]string{
Expand All @@ -59,7 +62,8 @@ Note, enum values are always validated and all unused variables are silently ign

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 `file_v1.ContextOperationServerIndices` and `file_v1.ContextOperationServerVariables` context maps.
Similar rules for overriding default operation server index and variables applies by
using `file_v1.ContextOperationServerIndices` and `file_v1.ContextOperationServerVariables` context maps.

```go
ctx := context.WithValue(context.Background(), file_v1.ContextOperationServerIndices, map[string]int{
Expand All @@ -76,24 +80,22 @@ ctx = context.WithValue(context.Background(), file_v1.ContextOperationServerVari

All URIs are relative to *https://files.api.antinvestor.com*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*DefaultAPI* | [**AddFile**](docs/DefaultAPI.md#addfile) | **Post** / |
*DefaultAPI* | [**DeleteFile**](docs/DefaultAPI.md#deletefile) | **Delete** /{id} |
*DefaultAPI* | [**FindFileById**](docs/DefaultAPI.md#findfilebyid) | **Get** /{id} |
*DefaultAPI* | [**FindFiles**](docs/DefaultAPI.md#findfiles) | **Get** / |

Class | Method | HTTP request | Description
--------------|-----------------------------------------------------|------------------|-------------
*DefaultAPI* | [**AddFile**](docs/DefaultAPI.md#addfile) | **Post** / |
*DefaultAPI* | [**DeleteFile**](docs/DefaultAPI.md#deletefile) | **Delete** /{id} |
*DefaultAPI* | [**FindFileById**](docs/DefaultAPI.md#findfilebyid) | **Get** /{id} |
*DefaultAPI* | [**FindFiles**](docs/DefaultAPI.md#findfiles) | **Get** / |

## Documentation For Models

- [Error](docs/Error.md)
- [File](docs/File.md)

- [Error](docs/Error.md)
- [File](docs/File.md)

## Documentation For Authorization


Authentication schemes defined for the API:

### bearerAuth

- **Type**: HTTP Bearer token authentication
Expand All @@ -105,7 +107,6 @@ auth := context.WithValue(context.Background(), file_v1.ContextAccessToken, "BEA
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
Expand Down
140 changes: 70 additions & 70 deletions go/files/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,61 +13,61 @@ info:
title: Ant Investor Files
version: 1.0.0
servers:
- url: https://files.api.antinvestor.com
- url: https://files.api.antinvestor.com
security:
- bearerAuth: []
- bearerAuth: [ ]
paths:
/:
get:
description: |
Returns all files from the system that the user has access to
operationId: findFiles
parameters:
- description: filters the files by the subscription by
explode: true
in: query
name: owner_id
required: false
schema:
example: 9bsv0s09a5j002njlpvg
pattern: "[0-9a-z_-]{3,20}"
type: string
style: form
- description: filters the files by the grouping id
explode: true
in: query
name: group_id
required: false
schema:
example: 9bsv0s09a5j002njlptg
pattern: "[0-9a-z_-]{3,20}"
type: string
style: form
- description: filters the files by the sub grouping id
explode: true
in: query
name: sub_group_id
required: false
schema:
example: front side
type: string
style: form
- description: maximum number of results to return
explode: true
in: query
name: limit
required: false
schema:
type: integer
style: form
- description: maximum number of results to return
explode: true
in: query
name: page
required: false
schema:
type: integer
style: form
- description: filters the files by the subscription by
explode: true
in: query
name: owner_id
required: false
schema:
example: 9bsv0s09a5j002njlpvg
pattern: "[0-9a-z_-]{3,20}"
type: string
style: form
- description: filters the files by the grouping id
explode: true
in: query
name: group_id
required: false
schema:
example: 9bsv0s09a5j002njlptg
pattern: "[0-9a-z_-]{3,20}"
type: string
style: form
- description: filters the files by the sub grouping id
explode: true
in: query
name: sub_group_id
required: false
schema:
example: front side
type: string
style: form
- description: maximum number of results to return
explode: true
in: query
name: limit
required: false
schema:
type: integer
style: form
- description: maximum number of results to return
explode: true
in: query
name: page
required: false
schema:
type: integer
style: form
responses:
"200":
content:
Expand Down Expand Up @@ -123,16 +123,16 @@ paths:
description: deletes a single file based on the ID supplied
operationId: deleteFile
parameters:
- description: ID of file to delete
explode: false
in: path
name: id
required: true
schema:
example: 9bsv0s09a5j002njlq20
pattern: "[0-9a-z_-]{3,20}"
type: string
style: simple
- description: ID of file to delete
explode: false
in: path
name: id
required: true
schema:
example: 9bsv0s09a5j002njlq20
pattern: "[0-9a-z_-]{3,20}"
type: string
style: simple
responses:
"204":
description: file deleted
Expand All @@ -152,16 +152,16 @@ paths:
description: Returns a file based on supplied ID
operationId: find file by id
parameters:
- description: ID of file to fetch
explode: false
in: path
name: id
required: true
schema:
example: 9bsv0s09a5j002njlq30
pattern: "[0-9a-z_-]{3,20}"
type: string
style: simple
- description: ID of file to fetch
explode: false
in: path
name: id
required: true
schema:
example: 9bsv0s09a5j002njlq30
pattern: "[0-9a-z_-]{3,20}"
type: string
style: simple
responses:
"200":
content:
Expand Down Expand Up @@ -219,7 +219,7 @@ components:
url:
type: string
required:
- name
- name
Error:
properties:
code:
Expand All @@ -228,8 +228,8 @@ components:
message:
type: string
required:
- code
- message
- code
- message
UnauthorizedError:
description: Access token is missing or invalid
addFile_request:
Expand Down
1 change: 1 addition & 0 deletions go/files/client_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package file_v1

import (
"context"
"github.com/antinvestor/apis/go/common"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
)
Expand Down
Loading

0 comments on commit d16f864

Please sign in to comment.