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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: bug
assignees: You nickname # TODO: add you github nickname
assignees: ThCompiler

---

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Question
about: Describe your question about the project
title: "[INFO]"
labels: question
assignees: You nickname # TODO: add you github nickname
assignees: ThCompiler

---

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Base CI

env:
GO_VERSION: 1.21
BIN_NAME: you_app # TODO: set you app executable name
GO_VERSION: 1.19
BIN_NAME: beget

on:
push:
Expand Down Expand Up @@ -38,13 +38,13 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: 1.19
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
version: v1.55.2
vet:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Release new version

env:
GO_VERSION: 1.21
GO_VERSION: 1.19

permissions:
contents: write
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@

# Go workspace file
go.work
.idea
74 changes: 56 additions & 18 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ run:
# Default: [].
skip-dirs:
- version
- src
- workflow
modules-download-mode: readonly
allow-parallel-runners: true
go: '1.21'
go: '1.19'
# output configuration option
output:
# Format: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml|github-actions
Expand All @@ -39,12 +40,51 @@ output:
uniq-by-line: true
# Add a prefix to the output file references.
# Default is no prefix.
path-prefix: ""
path-prefix: "./"
# Sort results by: filepath, line and column.
sort-results: false
sort-results: true
linters-settings:
revive:
# Maximum number of open files at the same time.
# See https://github.com/mgechev/revive#command-line-flags
# Defaults to unlimited.
max-open-files: 2048
# When set to false, ignores files with "GENERATED" header, similar to golint.
# See https://github.com/mgechev/revive#available-rules for details.
# Default: false
ignore-generated-header: true
# Sets the default severity.
# See https://github.com/mgechev/revive#configuration
# Default: warning
severity: error
# Enable all available rules.
# Default: false
enable-all-rules: true
# Sets the default failure confidence.
# This means that linting errors with less than 0.8 confidence will be ignored.
# Default: 0.8
confidence: 0.1
rules:
- name: add-constant
severity: warning
disabled: false
arguments:
- maxLitCount: "3"
allowStrs: '""'
allowInts: "0,1,2"
allowFloats: "0.0,0.,1.0,1.,2.0,2."
- name: confusing-naming
disabled: true
- name: line-length-limit
severity: warning
disabled: false
arguments: [ 120 ]
- name: max-public-structs
disabled: true
- name: errorf
disabled: true
gci:
local-prefixes: github.com/ThCompiler/go_game_constractor
local-prefixes: github.com/ThCompiler/go.beget.api
dupl:
threshold: 100
errorlint:
Expand Down Expand Up @@ -157,21 +197,19 @@ linters-settings:
# This logic overrides force-err-cuddling among others.
force-short-decl-cuddling: false
linters:
presets:
- bugs
- comment
- complexity
- error
- format
- import
- module
- performance
- sql
- style
- test
- unused
enable-all: true
disable:
- gocritic
- deadcode
- scopelint
- varcheck
- golint
- ifshort
- structcheck
- maligned
- depguard
- interfacer
- tagliatelle
- noctx
- gci
- wrapcheck
- varnamelen
Expand Down
26 changes: 21 additions & 5 deletions CHANGELOG-RU.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
[//]: # (TODO: описание изменений в указанной версии)
## 0.0.0
## 0.0.1

Добавлен шаблон репозитория
## Добавлено

## 0.0.1
### Библиотека

#### Ядро

* Добавлены типы ошибок, форматы и статусы (раздел core/info).
* Добавлена структура описание ответа от сервисом api.
* Добавлено обобщённое выполнения запросов по api и получение результатов.
* Добавлен интерфейс ApiMethod описывающий требования к методом api.

#### Api

* Добавлен базовый метод описывающий запрос по api.
* Добавлены методы взаимодействия с DNS: *getData*, *changeRecords*.
* Реализован создатель записей для запроса на изменение dns записей через метод *changeRecords*.

### Репозиторий

Добавлен шаблон репозитория
* Добавлено описание README на русском и английском языке.
* Настроена работа CI.
* Добавлен пример применения библиотеки в другом репозитории.
27 changes: 22 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
[//]: # (TODO: add description of changes in version)
## 0.0.0
## 0.0.1

Add repository template
## Added

## 0.0.1
### Library

#### Core

* Added error types, formats and statuses (core/info section).
* The structure of the response description from the api service has been added.
* Added generalized execution of api requests and getting results.
* Added the `ApiMethod` interface describing the requirements for the api method.

#### Api

* Added a basic method describing the api request.
* Added methods for interacting with DNS: *getData*, *changeRecords*.
* Implemented a record creator for requesting dns record changes via the *changeRecords* method.

### Repository

* Added a description of the README in Russian and English.
* CI operation is configured.
* Added an example of using the library in another repository.

Add repository template
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BIN_DIR=bin
BIN=you_app # TODO: set you app executable name
PATH_TO_ENTER_POINT=go-project/src # TODO: set path to main file of you repository
BIN=beget
PATH_TO_ENTER_POINT=github.com/ThCompiler/go.beget.api/src

.PHONY: local-build
local-build: bin-dir
Expand Down Expand Up @@ -30,4 +30,8 @@ changelog:
.PHONY: clean
clean:
echo "Cleaning..."; \
rm -Rf $(BIN_DIR)
rm -Rf $(BIN_DIR)

.PHONY: fmt
fmt:
gofumpt -e -w -d -extra .
36 changes: 36 additions & 0 deletions README-RU.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Go.beget.api

Простая библиотека реализующая открытое API сервиса [beget.com](https://beget.com/) для выполнения функций панели управления.

### Установка

Для работы с библиотекой необходима версия golang: ```1.19```. Сама установка может быть произведена с помощью команды:

```cmd
go get github.com/ThCompiler/github.com/ThCompiler/go.beget.api
```

### Поддерживаемые Beget.API функции

* Получить информацию о хостинг-аккаунте;
* Управлять резервными копиями;
* Управлять планировщиком заданий;
* Производить настройку DNS;
* Управлять базами данных;
* Создавать и удалять сайты на аккаунте;
* Управлять настройками доменов;
* Управлять почтовыми ящиками.

Детальная информация об API представлена на [сайте документации](https://beget.com/ru/kb/api/beget-api) **Beget**.

### Документация

В [документации](https://thcompiler.github.io/beget.api/) представлено описание функций библиотеки. А в репозитории
[update_hostname](https://github.com/ThCompiler/update_hostname) представлен пример использования
библиотеки для обновления данные ip для hostname на основе текущего ip системы.

### P.S.

Вопросы и предложения можно указывать в issue данного репозитория.

Реализованное API представлено в [TODO](./TODO.md)
38 changes: 26 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,35 @@
# go-ci-release-repository
# Go.beget.api

Simple template of go repository with workflow for ci and release
A simple library that implements the open API of the service [baget.com](https://beget.com/)
to perform the functions of the control panel.

## Usage
### Install

In ``main`` branch contains base repository without workflow of release artifacts and docs.
To work with the library, you need the golang version: ``1.19``. The installation can be done using the command:

In ``docs`` branch add workflow for generating mkdocs.
```cmd
go get github.com/ThCompiler/github.com/ThCompiler/go.beget.api
```

In ``artifacts`` branch add workflow for generating release with artifacts as binaries.
### Functions supported by the Beget.API

You can merge needed branches to main to add new workflow functional.
* Get information about your hosting account;
* Manage backups;
* Manage the task scheduler;
* Configure DNS;
* Manage databases;
* Create and delete websites on your account;
* Manage domain settings;
* Manage mailboxes.

Version expected start with ``v[n].[n].[n]*``, where ``[n]`` is any digit. Example ``v0.0.1-alpha``.
Detailed information about the API is provided on the **Beget`s** [documentation site](https://beget.com/ru/kb/api/beget-api).

## Artifacts
### Documentation

If you want to print version from your app with `--version` flag, you can use version from file `version\version.go`.
When artifacts will build, information about the build platform will be added to the version in this file.
Example it will be `v0.0.1 darwin/arm`.
The [documentation](https://thcompiler.github.io/beget.api/) provides a description of the library's functions.
And the [update_hostname](https://github.com/ThCompiler/update_hostname) repository provides an example of usage libraries
for updating ip for hostname based on the current ip of the server.

### P.S.

Questions and suggestions can be specified in the issue of this repository.
Loading