init commit

This commit is contained in:
Struchkov Mark 2024-08-23 23:37:58 +03:00
commit dd6d7b56fe
No known key found for this signature in database
GPG Key ID: A3F0AC3F0FA52F3C
43 changed files with 2550 additions and 0 deletions

109
.drone.yml Normal file
View File

@ -0,0 +1,109 @@
---
kind: pipeline
type: docker
name: snapshot-publish
trigger:
branch:
- develop
volumes:
- name: m2
host:
path: /drone/volume/m2
steps:
- name: publish
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
privileged: true
volumes:
- name: m2
path: /root/.m2/repository
environment:
MAVEN_SETTINGS:
from_secret: MAVEN_SETTINGS
commands:
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
- mvn --settings maven-settings.xml -U -P snapshot clean deploy
image_pull_secrets:
- DOCKER_AUTH
---
kind: pipeline
type: docker
name: release-maven-central
trigger:
ref:
- refs/tags/v.*.*.*
volumes:
- name: m2
host:
path: /drone/volume/m2
steps:
- name: publish maven central
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
privileged: true
volumes:
- name: m2
path: /root/.m2/repository
environment:
GPG_PRIVATE_KEY:
from_secret: GPG_PRIVATE_KEY
MAVEN_SETTINGS:
from_secret: MAVEN_SETTINGS
GPG_PASSPHRASE:
from_secret: GPG_PASSPHRASE
commands:
- apk add --no-cache gnupg
- echo "$GPG_PRIVATE_KEY" >> gpg.key
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
- mvn --settings maven-settings.xml -U -P ossrh,release clean deploy
image_pull_secrets:
- DOCKER_AUTH
---
kind: pipeline
type: docker
name: release-struchkov-nexus
trigger:
ref:
- refs/tags/v.*.*.*
volumes:
- name: m2
host:
path: /drone/volume/m2
steps:
- name: publish struchkov nexus
image: hub.docker.struchkov.dev/maven:3.9.5-eclipse-temurin-17-alpine
privileged: true
volumes:
- name: m2
path: /root/.m2/repository
environment:
GPG_PRIVATE_KEY:
from_secret: GPG_PRIVATE_KEY
MAVEN_SETTINGS:
from_secret: MAVEN_SETTINGS
GPG_PASSPHRASE:
from_secret: GPG_PASSPHRASE
commands:
- apk add --no-cache gnupg
- echo "$GPG_PRIVATE_KEY" >> gpg.key
- echo "$MAVEN_SETTINGS" >> maven-settings.xml
- gpg --pinentry-mode loopback --passphrase $GPG_PASSPHRASE --import gpg.key
- mvn --settings maven-settings.xml -U -P ossrh,release-struchkov-nexus clean deploy
image_pull_secrets:
- DOCKER_AUTH
---
kind: signature
hmac: af8e179fe00b1dfd731421af268fcd63b5aa4c78e1552f608e7613e2382bb2d5
...

38
.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

13
.idea/encodings.xml Normal file
View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/gitlab-core/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gitlab-core/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gitlab-domain/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gitlab-domain/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gitlab-schema/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/gitlab-schema/src/main/resources" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
</component>
</project>

15
.idea/misc.xml Normal file
View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
<option name="workspaceImportForciblyTurnedOn" value="true" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_21" project-jdk-name="corretto-21" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
.idea/uiDesigner.xml Normal file
View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

154
.idea/workspace.xml Normal file
View File

@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<list default="true" id="eb949ca5-8296-4076-affc-3ae964f31755" name="Changes" comment="">
<change afterPath="$PROJECT_DIR$/.drone.yml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.gitignore" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/encodings.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/uiDesigner.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/vcs.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/GitlabSdkManager.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/client/HttpHeader.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/client/HttpParse.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/client/HttpParseNew.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/client/OkHttpUtil.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/client/StringUtils.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/forktask/GetAllDiscussionForMergeRequestTask.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/forktask/GetAllMergeRequestForProjectTask.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/forktask/GetPipelineShortTask.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/forktask/GetPipelineTask.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core/forktask/GetSingleMergeRequestTask.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-domain/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-domain/src/main/java/dev/struchkov/sdk/gitlab/domain/GitlabProjectParam.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-domain/src/main/java/dev/struchkov/sdk/gitlab/domain/GitlabProperty.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-domain/src/main/java/dev/struchkov/sdk/gitlab/domain/GitlabUrl.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/pom.xml" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/approval/ApprovalContainerJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/approval/ApprovalJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/common/MilestoneJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/common/PersonJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/common/UserJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/mergerequest/MergeRequestJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/mergerequest/MergeRequestStateJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/note/DiscussionJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/note/NoteJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/pipeline/PipelineJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/pipeline/PipelineShortJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/pipeline/PipelineStatusJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/repository/CommitJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema/repository/ProjectJson.java" afterDir="false" />
<change afterPath="$PROJECT_DIR$/pom.xml" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 2
}]]></component>
<component name="ProjectId" id="2l4ZXda7ZVGkw841Y11IUmT4pBt" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"Maven.Publish M2.executor": "Run",
"RunOnceActivity.OpenProjectViewOnStart": "true",
"RunOnceActivity.ShowReadmeOnStart": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "main",
"jdk.selected.JAVA_MODULE": "corretto-21",
"kotlin-language-version-configured": "true",
"last_opened_file_path": "/Users/struchkov/Documents/IdeaProjects/struchkov/sdk/gitlab-sdk/gitlab-sdk",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"project.structure.last.edited": "Project",
"project.structure.proportion": "0.15",
"project.structure.side.proportion": "0.2",
"settings.editor.selected.configurable": "MavenSettings",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RecentsManager">
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/gitlab-core/src/main/java/dev/struchkov/sdk/gitlab/core" />
<recent name="$PROJECT_DIR$/gitlab-domain/src/main/java/dev/struchkov/sdk/gitlab/domain" />
<recent name="$PROJECT_DIR$/gitlab-schema/src/main/java/dev/struchkov/sdk/gitlab/schema" />
</key>
</component>
<component name="RunManager">
<configuration name="Publish M2" type="MavenRunConfiguration" factoryName="Maven">
<MavenSettings>
<option name="myGeneralSettings" />
<option name="myRunnerSettings" />
<option name="myRunnerParameters">
<MavenRunnerParameters>
<option name="cmdOptions" />
<option name="profiles">
<set />
</option>
<option name="goals">
<list>
<option value="clean" />
<option value="install" />
</list>
</option>
<option name="multimoduleDir" />
<option name="pomFileName" />
<option name="profilesMap">
<map />
</option>
<option name="projectsCmdOptionValues">
<list />
</option>
<option name="resolveToWorkspace" value="false" />
<option name="workingDirPath" value="$PROJECT_DIR$" />
</MavenRunnerParameters>
</option>
</MavenSettings>
<method v="2" />
</configuration>
</component>
<component name="SharedIndexes">
<attachedChunks>
<set>
<option value="jdk-17.0.9-corretto-17.0.9-f644763e9732-203781b8" />
<option value="jdk-21.0.1-corretto-21.0.1-f644763e9732-557044da" />
<option value="jdk-21.0.2-corretto-21.0.2-f644763e9732-d6553c93" />
</set>
</attachedChunks>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="eb949ca5-8296-4076-affc-3ae964f31755" name="Changes" comment="" />
<created>1724441351469</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1724441351469</updated>
<workItem from="1724441352586" duration="1843000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
</project>

54
gitlab-core/pom.xml Normal file
View File

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>gitlab-core</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-schema</artifactId>
</dependency>
<dependency>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-domain</artifactId>
</dependency>
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-utils</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
</dependencies>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<url>https://mark.struchkov.dev</url>
</developer>
</developers>
</project>

View File

@ -0,0 +1,216 @@
package dev.struchkov.sdk.gitlab.core;
import dev.struchkov.haiti.utils.container.Pair;
import dev.struchkov.sdk.gitlab.core.client.HttpParse;
import dev.struchkov.sdk.gitlab.core.client.StringUtils;
import dev.struchkov.sdk.gitlab.core.forktask.GetAllMergeRequestForProjectTask;
import dev.struchkov.sdk.gitlab.core.forktask.GetPipelineShortTask;
import dev.struchkov.sdk.gitlab.core.forktask.GetPipelineTask;
import dev.struchkov.sdk.gitlab.core.forktask.GetSingleMergeRequestTask;
import dev.struchkov.sdk.gitlab.domain.GitlabProjectParam;
import dev.struchkov.sdk.gitlab.domain.GitlabProperty;
import dev.struchkov.sdk.gitlab.domain.GitlabUrl;
import dev.struchkov.sdk.gitlab.schema.approval.ApprovalContainerJson;
import dev.struchkov.sdk.gitlab.schema.approval.ApprovalJson;
import dev.struchkov.sdk.gitlab.schema.common.PersonJson;
import dev.struchkov.sdk.gitlab.schema.mergerequest.MergeRequestJson;
import dev.struchkov.sdk.gitlab.schema.note.DiscussionJson;
import dev.struchkov.sdk.gitlab.schema.pipeline.PipelineJson;
import dev.struchkov.sdk.gitlab.schema.pipeline.PipelineShortJson;
import dev.struchkov.sdk.gitlab.schema.repository.CommitJson;
import dev.struchkov.sdk.gitlab.schema.repository.ProjectJson;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import okhttp3.FormBody;
import okhttp3.Request;
import okhttp3.RequestBody;
import java.io.IOException;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.ForkJoinTask;
import java.util.stream.Collectors;
import static dev.struchkov.haiti.context.exception.NotFoundException.notFoundException;
import static dev.struchkov.haiti.utils.concurrent.ForkJoinUtils.pullTaskResult;
import static dev.struchkov.haiti.utils.concurrent.ForkJoinUtils.pullTaskResults;
import static dev.struchkov.sdk.gitlab.core.client.HttpParse.ACCEPT;
import static java.util.Collections.emptyList;
import static java.util.stream.Collectors.toList;
@Slf4j
@RequiredArgsConstructor
public class GitlabSdkManager {
private final ForkJoinPool forkJoinPool;
private final GitlabUrl gitlabUrl;
private final GitlabProperty gitlabProperty;
public PersonJson getAuthPerson() {
return HttpParse.request(gitlabUrl.getUser())
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.execute(PersonJson.class)
.orElseThrow(notFoundException("Пользователь не найден"));
}
public Optional<PersonJson> getPersonById(Long userId) {
return HttpParse.request(gitlabUrl.getUsers() + "/" + userId)
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.execute(PersonJson.class);
}
public List<ProjectJson> getAllProject(int pageNumber, GitlabProjectParam... params) {
String param = Arrays.stream(params)
.map(GitlabProjectParam::getUrl)
.collect(Collectors.joining());
final String url = MessageFormat.format(gitlabUrl.getProjects(), pageNumber);
return HttpParse.request(url + param)
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.executeList(ProjectJson.class);
}
public Optional<ProjectJson> getProjectByUrl(String projectUrl) {
return HttpParse.request(projectUrl)
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.execute(ProjectJson.class);
}
/**
* Позволяет получить MR для переданных идентификаторов проектов.
*
* @param projectIds идентификаторы проектов
* @return полученные у GitLab MergeRequests
*/
public List<MergeRequestJson> getAllMergeRequestByProjectIds(Set<Long> projectIds) {
final List<ForkJoinTask<List<MergeRequestJson>>> tasks = projectIds.stream()
.map(projectId -> new GetAllMergeRequestForProjectTask(projectId, gitlabUrl.getOpenMergeRequests(), gitlabProperty.getAccessToken()))
.map(forkJoinPool::submit)
.collect(Collectors.toList());
return pullTaskResults(tasks);
}
public List<CommitJson> getAllCommitByProjectId(Long projectId, Long mergeRequestIdForProject) {
return HttpParse.request(
MessageFormat.format(gitlabUrl.getLastCommitOfMergeRequest(), projectId, mergeRequestIdForProject)
)
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.executeList(CommitJson.class);
}
public List<ApprovalJson> getAllApprovalForMergeRequest(Long projectId, Long mergeRequestIdForProject) {
return HttpParse.request(
MessageFormat.format(gitlabUrl.getMergeRequestApproval(), projectId, mergeRequestIdForProject)
)
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.execute(ApprovalContainerJson.class)
.map(ApprovalContainerJson::getApprovals)
.orElse(emptyList());
}
/**
* projectId + mrTwoId
*/
public List<MergeRequestJson> getAllMergeRequestById(Collection<Pair<Long, Long>> projectIdAndMrIdForProject) {
final List<ForkJoinTask<Optional<MergeRequestJson>>> tasks = projectIdAndMrIdForProject.stream()
.map(
pair -> new GetSingleMergeRequestTask(
gitlabUrl.getMergeRequest(),
pair.getKey(),
pair.getValue(),
gitlabProperty.getAccessToken()
)
).map(forkJoinPool::submit)
.collect(toList());
return pullTaskResult(tasks).stream()
.flatMap(Optional::stream)
.collect(toList());
}
public List<PipelineJson> getAllPipelineForProject(Collection<Pair<Long, Long>> projectIdAndPipelineId) {
final List<ForkJoinTask<Optional<PipelineJson>>> tasks = projectIdAndPipelineId.stream()
.map(
pair -> GetPipelineTask.builder()
.pipelineId(pair.getValue())
.projectId(pair.getKey())
.urlPipeline(gitlabUrl.getPipeline())
.gitlabToken(gitlabProperty.getAccessToken())
.build()
)
.map(forkJoinPool::submit)
.collect(Collectors.toList());
return pullTaskResult(tasks).stream()
.flatMap(Optional::stream)
.collect(toList());
}
public List<PipelineShortJson> getAllPipeline(Collection<Long> projectIds, LocalDateTime updatedAfter) {
final List<ForkJoinTask<List<PipelineShortJson>>> tasks = projectIds.stream()
.map(projectId -> new GetPipelineShortTask(
gitlabUrl.getPipelines(),
projectId,
updatedAfter,
gitlabProperty.getAccessToken()
))
.map(forkJoinPool::submit)
.collect(Collectors.toList());
return pullTaskResults(tasks);
}
public List<DiscussionJson> getDiscussionForMergeRequest(Long projectId, Long mergeRequestIdForProject, int pageNumber) {
return HttpParse.request(MessageFormat.format(gitlabUrl.getDiscussions(), projectId, mergeRequestIdForProject, pageNumber, pageNumber))
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.executeList(DiscussionJson.class);
}
public Optional<DiscussionJson> getDiscussionById(Long projectId, Long mergeRequestIdForProject, String discussionId) {
return HttpParse.request(createLinkOldDiscussion(projectId, mergeRequestIdForProject, discussionId))
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.execute(DiscussionJson.class);
}
private String createLinkOldDiscussion(Long projectId, Long mergeRequestIdForProject, String discussionId) {
return MessageFormat.format(
gitlabUrl.getDiscussion(),
projectId,
mergeRequestIdForProject,
discussionId
);
}
public void sendMessageToDiscussion(Long projectId, Long mergeRequestIdForProject, String discussionId, String message) {
final String requestUrl = MessageFormat.format(gitlabUrl.getNewNote(), projectId, mergeRequestIdForProject, discussionId, message);
final RequestBody formBody = new FormBody.Builder().build();
final Request request = new Request.Builder()
.post(formBody)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabProperty.getAccessToken())
.url(requestUrl)
.build();
try {
HttpParse.getNewClient().newCall(request).execute();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
}
}

View File

@ -0,0 +1,33 @@
package dev.struchkov.sdk.gitlab.core.client;
import dev.struchkov.haiti.utils.Inspector;
/**
* Утилитарная сущность для {@link HttpParse}. Упрощает сохранения в константы заголовков для запроса.
*
* @author upagge 23.12.2020
*/
public class HttpHeader {
private final String name;
private final String value;
private HttpHeader(String name, String value) {
this.name = name;
this.value = value;
}
public static HttpHeader of(String name, String value) {
Inspector.isNotNull(name, value);
return new HttpHeader(name, value);
}
public String getName() {
return name;
}
public String getValue() {
return value;
}
}

View File

@ -0,0 +1,121 @@
package dev.struchkov.sdk.gitlab.core.client;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.struchkov.haiti.utils.Checker;
import dev.struchkov.haiti.utils.Inspector;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.ResponseBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
/**
* Утилитарный класс для работы с web.
*
* @author upagge 30.09.2020
*/
public class HttpParse {
private static final Logger log = LoggerFactory.getLogger(HttpParse.class);
public static final HttpHeader ACCEPT = HttpHeader.of("Accept", "text/html,application/xhtml+xml,application/json");
private static final ObjectMapper objectMapper;
private final Request.Builder requestBuilder = new Request.Builder();
private final HttpUrl.Builder httpUrlBuilder;
static {
objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
public HttpParse(String url) {
Inspector.isNotNull(url);
httpUrlBuilder = HttpUrl.parse(url).newBuilder();
}
public static HttpParse request(String url) {
Inspector.isNotNull(url);
return new HttpParse(url);
}
public HttpParse header(String name, String value) {
Inspector.isNotNull(name);
if (value != null) {
requestBuilder.header(name, value);
}
return this;
}
public HttpParse header(HttpHeader header) {
Inspector.isNotNull(header);
requestBuilder.header(header.getName(), header.getValue());
return this;
}
public HttpParse getParameter(String name, String value) {
Inspector.isNotNull(name);
if (value != null) {
httpUrlBuilder.addQueryParameter(name, value);
}
return this;
}
public <T> Optional<T> execute(Class<T> classOfT) {
Inspector.isNotNull(classOfT);
final HttpUrl url = httpUrlBuilder.build();
final Request request = requestBuilder.url(url).build();
log.trace("Выполняется okhttp3 запрос | {}", url);
final OkHttpClient httpClient = getNewClient();
try (final Response execute = httpClient.newCall(request).execute()) {
log.trace("Запрос выполнен | {}", url);
if (execute.isSuccessful() && Checker.checkNotNull(execute.body())) {
final String string = execute.body().string();
return Optional.ofNullable(objectMapper.readValue(string, classOfT));
}
} catch (IOException e) {
log.error("Ошибка выполнения okhttp3", e);
}
return Optional.empty();
}
//TODO [16.01.2023|uPagge]: Okhttp Client создается на каждый запрос, что не рационально по потреблению ресурсов и производительности, но позволяет обойти ограничение со стороны гитлаба, при котором один и тот же клиент отбрасывался спустя 1000 запросов. Возможно стоит заменить OkHttp на что-то другое, например, RestTemplate
public <T> List<T> executeList(Class<T> classOfT) {
Inspector.isNotNull(classOfT);
final HttpUrl url = httpUrlBuilder.build();
final Request request = requestBuilder.url(url).build();
log.trace("Выполняется okhttp3 запрос | {}", url);
final OkHttpClient httpClient = getNewClient();
try (Response execute = httpClient.newCall(request).execute()) {
log.trace("Запрос выполнен | {}", url);
ResponseBody body = execute.body();
if (execute.isSuccessful() && Checker.checkNotNull(body)) {
final String stringBody = body.string();
final List<T> list = objectMapper.readValue(stringBody, objectMapper.getTypeFactory().constructCollectionType(List.class, classOfT));
return (list == null || list.isEmpty()) ? Collections.emptyList() : list;
}
} catch (IOException e) {
log.error("Ошибка выполнения okhttp3", e);
}
return Collections.emptyList();
}
public static OkHttpClient getNewClient() {
return new OkHttpClient().newBuilder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.build();
}
}

View File

@ -0,0 +1,100 @@
//package dev.struchkov.bot.gitlab.core.utils;
//
//import com.fasterxml.jackson.databind.DeserializationFeature;
//import com.fasterxml.jackson.databind.ObjectMapper;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.http.HttpEntity;
//import org.springframework.http.HttpHeaders;
//import org.springframework.http.HttpMethod;
//import org.springframework.http.ResponseEntity;
//import org.springframework.stereotype.Component;
//import org.springframework.web.client.RestTemplate;
//import org.springframework.web.util.UriComponentsBuilder;
//
//import java.io.IOException;
//import java.util.Collections;
//import java.util.List;
//import java.util.Optional;
//
//@Component
//public class HttpParse {
//
// private static final Logger log = LoggerFactory.getLogger(HttpParse.class);
// private static final ObjectMapper objectMapper;
//
// static {
// objectMapper = new ObjectMapper();
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
// }
//
// private final RestTemplate restTemplate;
// private final HttpHeaders headers = new HttpHeaders();
// private UriComponentsBuilder uriBuilder;
//
// public HttpParse(RestTemplate restTemplate) {
// this.restTemplate = restTemplate;
// }
//
// public HttpParse url(String url) {
// this.uriBuilder = UriComponentsBuilder.fromHttpUrl(url);
// return this;
// }
//
// public HttpParse header(String name, String value) {
// if (name != null && value != null) {
// headers.add(name, value);
// }
// return this;
// }
//
// public HttpParse header(HttpHeader header) {
// if (header != null) {
// headers.add(header.getName(), header.getValue());
// }
// return this;
// }
//
// public HttpParse getParameter(String name, String value) {
// if (name != null && value != null) {
// uriBuilder.queryParam(name, value);
// }
// return this;
// }
//
// public <T> Optional<T> execute(Class<T> classOfT) {
// try {
// String url = uriBuilder.toUriString();
// log.trace("Выполняется RestTemplate запрос | {}", url);
// HttpEntity<String> entity = new HttpEntity<>(headers);
// ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
// log.trace("Запрос выполнен | {}", url);
// if (response.getStatusCode().is2xxSuccessful() && response.hasBody()) {
// String body = response.getBody();
// return Optional.ofNullable(objectMapper.readValue(body, classOfT));
// }
// } catch (IOException e) {
// log.error("Ошибка выполнения RestTemplate", e);
// }
// return Optional.empty();
// }
//
// public <T> List<T> executeList(Class<T> classOfT) {
// try {
// String url = uriBuilder.toUriString();
// log.trace("Выполняется RestTemplate запрос | {}", url);
// HttpEntity<String> entity = new HttpEntity<>(headers);
// ResponseEntity<String> response = restTemplate.exchange(url, HttpMethod.GET, entity, String.class);
// log.trace("Запрос выполнен | {}", url);
// if (response.getStatusCode().is2xxSuccessful() && response.hasBody()) {
// String body = response.getBody();
// return objectMapper.readValue(body, objectMapper.getTypeFactory().constructCollectionType(List.class, classOfT));
// }
// } catch (IOException e) {
// log.error("Ошибка выполнения RestTemplate", e);
// }
// return Collections.emptyList();
// }
//
//}

View File

@ -0,0 +1,60 @@
package dev.struchkov.sdk.gitlab.core.client;
import dev.struchkov.haiti.utils.Exceptions;
import okhttp3.OkHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
public class OkHttpUtil {
private static final Logger log = LoggerFactory.getLogger(OkHttpUtil.class);
public OkHttpUtil() {
Exceptions.utilityClass();
}
public static void ignoreCertificate(OkHttpClient.Builder builder) {
log.info("Initialising httpUtil with default configuration");
configureToIgnoreCertificate(builder);
}
//Setting testMode configuration. If set as testMode, the connection will skip certification check
private static void configureToIgnoreCertificate(OkHttpClient.Builder builder) {
log.warn("Ignore Ssl Certificate");
try {
// Create a trust manager that does not validate certificate chains
final TrustManager[] trustAllCerts = new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(java.security.cert.X509Certificate[] chain, String authType) {
}
@Override
public void checkServerTrusted(java.security.cert.X509Certificate[] chain, String authType) {
}
@Override
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
return new java.security.cert.X509Certificate[]{};
}
}
};
final SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, trustAllCerts, new java.security.SecureRandom());
final SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
builder.sslSocketFactory(sslSocketFactory, (X509TrustManager) trustAllCerts[0]);
builder.hostnameVerifier((hostname, session) -> true);
} catch (Exception e) {
log.warn("Exception while configuring IgnoreSslCertificate" + e, e);
}
}
}

View File

@ -0,0 +1,16 @@
package dev.struchkov.sdk.gitlab.core.client;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
/**
* Утилитарный класс для работы со сторками.
*
* @author upagge 29.09.2020
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class StringUtils {
public static final String H_PRIVATE_TOKEN = "PRIVATE-TOKEN";
}

View File

@ -0,0 +1,49 @@
package dev.struchkov.sdk.gitlab.core.forktask;
import dev.struchkov.sdk.gitlab.core.client.HttpParse;
import dev.struchkov.sdk.gitlab.schema.note.DiscussionJson;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import java.text.MessageFormat;
import java.util.List;
import java.util.concurrent.RecursiveTask;
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
import static dev.struchkov.sdk.gitlab.core.client.HttpParse.ACCEPT;
import static dev.struchkov.sdk.gitlab.core.client.StringUtils.H_PRIVATE_TOKEN;
@AllArgsConstructor
@RequiredArgsConstructor
public class GetAllDiscussionForMergeRequestTask extends RecursiveTask<List<DiscussionJson>> {
private static final int PAGE_COUNT = 100;
private final String discussionsUrl;
private final long projectId;
private final long mergeRequestTwoId;
private final String personalGitlabToken;
private int page = 1;
@Override
@SneakyThrows
protected List<DiscussionJson> compute() {
Thread.sleep(100);
final List<DiscussionJson> jsons = getDiscussionJson();
if (checkNotEmpty(jsons) && jsons.size() == PAGE_COUNT) {
final var newTask = new GetAllDiscussionForMergeRequestTask(discussionsUrl, projectId, mergeRequestTwoId, personalGitlabToken, page + 1);
newTask.fork();
jsons.addAll(newTask.join());
}
return jsons;
}
private List<DiscussionJson> getDiscussionJson() {
return HttpParse.request(MessageFormat.format(discussionsUrl, projectId, mergeRequestTwoId, page, PAGE_COUNT))
.header(ACCEPT)
.header(H_PRIVATE_TOKEN, personalGitlabToken)
.executeList(DiscussionJson.class);
}
}

View File

@ -0,0 +1,52 @@
package dev.struchkov.sdk.gitlab.core.forktask;
import dev.struchkov.sdk.gitlab.core.client.HttpParse;
import dev.struchkov.sdk.gitlab.core.client.StringUtils;
import dev.struchkov.sdk.gitlab.schema.mergerequest.MergeRequestJson;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
import java.util.List;
import java.util.concurrent.RecursiveTask;
import static dev.struchkov.haiti.utils.Checker.checkNotEmpty;
import static dev.struchkov.sdk.gitlab.core.client.HttpParse.ACCEPT;
@Slf4j
@AllArgsConstructor
@RequiredArgsConstructor
public class GetAllMergeRequestForProjectTask extends RecursiveTask<List<MergeRequestJson>> {
private static final int PAGE_COUNT = 100;
private final long projectId;
private int pageNumber = 1;
private final String urlMrOpen;
private final String gitlabToken;
@Override
@SneakyThrows
protected List<MergeRequestJson> compute() {
Thread.sleep(100);
final List<MergeRequestJson> mergeRequestJsons = getMergeRequestJsons();
if (checkNotEmpty(mergeRequestJsons) && mergeRequestJsons.size() == PAGE_COUNT) {
final GetAllMergeRequestForProjectTask newTask = new GetAllMergeRequestForProjectTask(projectId, pageNumber + 1, urlMrOpen, gitlabToken);
newTask.fork();
mergeRequestJsons.addAll(newTask.join());
}
return mergeRequestJsons;
}
private List<MergeRequestJson> getMergeRequestJsons() {
final List<MergeRequestJson> jsons = HttpParse.request(MessageFormat.format(urlMrOpen, projectId, pageNumber, PAGE_COUNT))
.header(StringUtils.H_PRIVATE_TOKEN, gitlabToken)
.header(ACCEPT)
.executeList(MergeRequestJson.class);
log.trace("Получено {} шт потенциально новых MR для проекта id:'{}' ", jsons.size(), projectId);
return jsons;
}
}

View File

@ -0,0 +1,55 @@
package dev.struchkov.sdk.gitlab.core.forktask;
import dev.struchkov.sdk.gitlab.core.client.HttpParse;
import dev.struchkov.sdk.gitlab.core.client.StringUtils;
import dev.struchkov.sdk.gitlab.schema.pipeline.PipelineShortJson;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
import java.time.LocalDateTime;
import java.util.List;
import java.util.concurrent.RecursiveTask;
import static dev.struchkov.sdk.gitlab.core.client.HttpParse.ACCEPT;
@Slf4j
@AllArgsConstructor
@RequiredArgsConstructor
public class GetPipelineShortTask extends RecursiveTask<List<PipelineShortJson>> {
private static final int PAGE_COUNT = 100;
private final String urlPipelines;
private final long projectId;
private int pageNumber = 1;
private final LocalDateTime lastUpdate;
private final String gitlabToken;
@Override
@SneakyThrows
protected List<PipelineShortJson> compute() {
Thread.sleep(100);
final List<PipelineShortJson> jsons = getPipelineJsons();
if (jsons.size() == PAGE_COUNT) {
final GetPipelineShortTask newTask = new GetPipelineShortTask(urlPipelines, projectId, pageNumber + 1, lastUpdate, gitlabToken);
newTask.fork();
jsons.addAll(newTask.join());
}
jsons.forEach(pipelineJson -> pipelineJson.setProjectId(projectId));
return jsons;
}
private List<PipelineShortJson> getPipelineJsons() {
final List<PipelineShortJson> jsons = HttpParse.request(MessageFormat.format(urlPipelines, projectId, pageNumber, PAGE_COUNT))
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabToken)
.getParameter("updated_after", lastUpdate.toString())
.executeList(PipelineShortJson.class);
log.trace("Получено {} шт потенциально новых пайплайнов для проекта id:'{}' ", jsons.size(), projectId);
return jsons;
}
}

View File

@ -0,0 +1,45 @@
package dev.struchkov.sdk.gitlab.core.forktask;
import dev.struchkov.sdk.gitlab.core.client.HttpParse;
import dev.struchkov.sdk.gitlab.core.client.StringUtils;
import dev.struchkov.sdk.gitlab.schema.pipeline.PipelineJson;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.NoArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
import java.util.Optional;
import java.util.concurrent.RecursiveTask;
import static dev.struchkov.sdk.gitlab.core.client.HttpParse.ACCEPT;
@Slf4j
@Builder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
public class GetPipelineTask extends RecursiveTask<Optional<PipelineJson>> {
private String urlPipeline;
private long projectId;
private long pipelineId;
private String gitlabToken;
@Override
@SneakyThrows
protected Optional<PipelineJson> compute() {
Thread.sleep(100);
return HttpParse.request(MessageFormat.format(urlPipeline, projectId, pipelineId))
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabToken)
.execute(PipelineJson.class)
.map(json -> {
json.setProjectId(projectId);
return json;
});
}
}

View File

@ -0,0 +1,36 @@
package dev.struchkov.sdk.gitlab.core.forktask;
import dev.struchkov.sdk.gitlab.core.client.HttpParse;
import dev.struchkov.sdk.gitlab.core.client.StringUtils;
import dev.struchkov.sdk.gitlab.schema.mergerequest.MergeRequestJson;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import java.text.MessageFormat;
import java.util.Optional;
import java.util.concurrent.RecursiveTask;
import static dev.struchkov.sdk.gitlab.core.client.HttpParse.ACCEPT;
@Slf4j
@RequiredArgsConstructor
public class GetSingleMergeRequestTask extends RecursiveTask<Optional<MergeRequestJson>> {
private final String urlMr;
private final long projectId;
private final long mrTwoId;
private final String gitlabToken;
@Override
@SneakyThrows
protected Optional<MergeRequestJson> compute() {
Thread.sleep(100);
final String mrUrl = MessageFormat.format(urlMr, projectId, mrTwoId);
return HttpParse.request(mrUrl)
.header(ACCEPT)
.header(StringUtils.H_PRIVATE_TOKEN, gitlabToken)
.execute(MergeRequestJson.class);
}
}

27
gitlab-domain/pom.xml Normal file
View File

@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>gitlab-domain</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,14 @@
package dev.struchkov.sdk.gitlab.domain;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum GitlabProjectParam {
OWNER("&owned=true"),
PRIVATE("&visibility=private");
private final String url;
}

View File

@ -0,0 +1,21 @@
package dev.struchkov.sdk.gitlab.domain;
import lombok.Getter;
import lombok.Setter;
/**
* Данные необходимые для взаимодействия с API GitLab.
*
* @author upagge [31.01.2020]
*/
@Getter
@Setter
public class GitlabProperty {
private String baseUrl;
private String accessToken;
private String replaceUrl;
}

View File

@ -0,0 +1,47 @@
package dev.struchkov.sdk.gitlab.domain;
import lombok.Getter;
@Getter
public class GitlabUrl {
private final String users;
private final String user;
private final String projects;
private final String openMergeRequests;
private final String closeMergeRequests;
private final String commentsOfMergeRequest;
private final String mergeRequest;
private final String mergeRequestApproval;
private final String projectAdd;
private final String note;
private final String noteOfMergeRequest;
private final String pipelines;
private final String pipeline;
private final String lastCommitOfMergeRequest;
private final String newNote;
private final String discussions;
private final String discussion;
public GitlabUrl(GitlabProperty gitlabProperty) {
final String baseUrl = gitlabProperty.getBaseUrl();
this.users = baseUrl + "/api/v4/users";
this.user = baseUrl + "/api/v4/user";
this.projects = baseUrl + "/api/v4/projects?page={0, number, integer}&per_page=100";
this.openMergeRequests = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests?state=opened&page={1, number, integer}&per_page={2, number, integer}";
this.closeMergeRequests = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests?state=closed&page={1, number, integer}&per_page=100";
this.commentsOfMergeRequest = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes?&page={2,number,#}&per_page=100";
this.mergeRequest = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}";
this.mergeRequestApproval = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/approvals";
this.projectAdd = baseUrl + "/api/v4/projects/";
this.note = baseUrl + "{0}#note_{1,number,#}";
this.noteOfMergeRequest = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/notes/{2,number,#}";
this.pipelines = baseUrl + "/api/v4/projects/{0,number,#}/pipelines?&page={1,number,#}&per_page={2,number,#}";
this.pipeline = baseUrl + "/api/v4/projects/{0,number,#}/pipelines/{1,number,#}";
this.lastCommitOfMergeRequest = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/commits?&page=1&per_page=1";
this.newNote = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}/notes?body={3}";
this.discussions = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions?&page={2,number,#}&per_page={3,number,#}";
this.discussion = baseUrl + "/api/v4/projects/{0,number,#}/merge_requests/{1,number,#}/discussions/{2}";
}
}

45
gitlab-schema/pom.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>gitlab-schema</artifactId>
<properties>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
</dependencies>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<url>https://mark.struchkov.dev</url>
</developer>
</developers>
</project>

View File

@ -0,0 +1,14 @@
package dev.struchkov.sdk.gitlab.schema.approval;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class ApprovalContainerJson {
@JsonProperty("approved_by")
private List<ApprovalJson> approvals;
}

View File

@ -0,0 +1,11 @@
package dev.struchkov.sdk.gitlab.schema.approval;
import dev.struchkov.sdk.gitlab.schema.common.PersonJson;
import lombok.Data;
@Data
public class ApprovalJson {
private PersonJson user;
}

View File

@ -0,0 +1,9 @@
package dev.struchkov.sdk.gitlab.schema.common;
import lombok.Data;
@Data
public class MilestoneJson {
private Long id;
private String title;
}

View File

@ -0,0 +1,19 @@
package dev.struchkov.sdk.gitlab.schema.common;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
/**
* @author upagge [31.01.2020]
*/
@Data
public class PersonJson {
private Long id;
private String name;
private String username;
@JsonProperty("web_url")
private String webUrl;
}

View File

@ -0,0 +1,14 @@
package dev.struchkov.sdk.gitlab.schema.common;
import lombok.Data;
/**
* @author upagge [31.01.2020]
*/
@Data
public class UserJson {
private String name;
private String displayName;
}

View File

@ -0,0 +1,63 @@
package dev.struchkov.sdk.gitlab.schema.mergerequest;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import dev.struchkov.sdk.gitlab.schema.common.MilestoneJson;
import dev.struchkov.sdk.gitlab.schema.common.PersonJson;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Set;
/**
* @author upagge [30.01.2020]
*/
@Data
public class MergeRequestJson {
private Long id;
@JsonProperty("iid")
private Long twoId;
@JsonProperty("project_id")
private Long projectId;
private String title;
private String description;
private MergeRequestStateJson state;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("created_at")
private LocalDateTime createdDate;
@JsonProperty("updated_at")
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
private LocalDateTime updatedDate;
private PersonJson author;
private PersonJson assignee;
private MilestoneJson milestone;
private List<PersonJson> reviewers;
@JsonProperty("web_url")
private String webUrl;
@JsonProperty("has_conflicts")
private boolean conflicts;
@JsonProperty("target_branch")
private String targetBranch;
@JsonProperty("source_branch")
private String sourceBranch;
private Set<String> labels;
}

View File

@ -0,0 +1,19 @@
package dev.struchkov.sdk.gitlab.schema.mergerequest;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @author upagge [01.02.2020]
*/
public enum MergeRequestStateJson {
@JsonProperty("opened")
OPENED,
@JsonProperty("closed")
CLOSED,
@JsonProperty("locked")
LOCKED,
@JsonProperty("merged")
MERGED
}

View File

@ -0,0 +1,18 @@
package dev.struchkov.sdk.gitlab.schema.note;
import lombok.Getter;
import lombok.Setter;
import java.util.List;
/**
* @author upagge 11.02.2021
*/
@Getter
@Setter
public class DiscussionJson {
private String id;
private List<NoteJson> notes;
}

View File

@ -0,0 +1,50 @@
package dev.struchkov.sdk.gitlab.schema.note;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import dev.struchkov.sdk.gitlab.schema.common.PersonJson;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class NoteJson {
private Long id;
private String type;
private String body;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("created_at")
private LocalDateTime created;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("updated_at")
private LocalDateTime updated;
private PersonJson author;
private boolean system;
@JsonProperty("noteable_id")
private Long noteableId;
@JsonProperty("noteable_type")
private String noteableType;
private boolean resolvable;
private Boolean resolved;
@JsonProperty("resolved_by")
private PersonJson resolvedBy;
@JsonProperty("noteable_iid")
private Long noteableIid;
}

View File

@ -0,0 +1,44 @@
package dev.struchkov.sdk.gitlab.schema.pipeline;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import dev.struchkov.sdk.gitlab.schema.common.PersonJson;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author upagge 17.01.2021
*/
@Data
public class PipelineJson {
private Long id;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("created_at")
private LocalDateTime created;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("updated_at")
private LocalDateTime updated;
private PipelineStatusJson status;
private String ref;
private PersonJson user;
@JsonProperty("web_url")
private String webUrl;
// Поля ниже не отдаются гитлабом, а заполняются вручную
private Long projectId;
}

View File

@ -0,0 +1,41 @@
package dev.struchkov.sdk.gitlab.schema.pipeline;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author upagge 17.01.2021
*/
@Data
public class PipelineShortJson {
private Long id;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("created_at")
private LocalDateTime created;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("updated_at")
private LocalDateTime updated;
private PipelineStatusJson status;
private String ref;
@JsonProperty("web_url")
private String webUrl;
// Поля ниже не отдаются гитлабом, а заполняются вручную
private Long projectId;
}

View File

@ -0,0 +1,43 @@
package dev.struchkov.sdk.gitlab.schema.pipeline;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* @author upagge 17.01.2021
*/
public enum PipelineStatusJson {
@JsonProperty("created")
CREATED,
@JsonProperty("waiting_for_resource")
WAITING_FOR_RESOURCE,
@JsonProperty("preparing")
PREPARING,
@JsonProperty("pending")
PENDING,
@JsonProperty("running")
RUNNING,
@JsonProperty("success")
SUCCESS,
@JsonProperty("failed")
FAILED,
@JsonProperty("canceled")
CANCELED,
@JsonProperty("skipped")
SKIPPED,
@JsonProperty("manual")
MANUAL,
@JsonProperty("scheduled")
SCHEDULED
}

View File

@ -0,0 +1,25 @@
package dev.struchkov.sdk.gitlab.schema.repository;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author upagge 19.01.2021
*/
@Data
public class CommitJson {
private String id;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("created_at")
private LocalDateTime createdDate;
}

View File

@ -0,0 +1,39 @@
package dev.struchkov.sdk.gitlab.schema.repository;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import java.time.LocalDateTime;
/**
* @author upagge 14.01.2021
*/
@Data
public class ProjectJson {
private Long id;
private String name;
private String description;
@JsonSerialize(using = LocalDateTimeSerializer.class)
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonProperty("created_at")
private LocalDateTime createdDate;
@JsonProperty("web_url")
private String webUrl;
@JsonProperty("ssh_url_to_repo")
private String sshUrlToRepo;
@JsonProperty("http_url_to_repo")
private String httpUrlToRepo;
@JsonProperty("creator_id")
private Long creatorId;
}

View File

@ -0,0 +1,309 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.3</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-sdk-spring-boot-starter</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>GitLab SDK Spring Boot Starter</name>
<description>Spring Boot GitLab SDK для упрощения вызовов к Gitlab API.</description>
<url>https://git.struchkov.dev/SDK/gitlab-sdk</url>
<licenses>
<license>
<name>BSD 3-Clause "New" or "Revised" License</name>
<url>https://git.struchkov.dev/SDK/gitlab-sdk/blob/master/LICENSE</url>
</license>
</licenses>
<properties>
<java.version>21</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- https://mvnrepository.com/artifact/dev.struchkov.godfather/bot-data-simple -->
<godfather.version>1.3.1</godfather.version>
<!-- https://mvnrepository.com/artifact/dev.struchkov.godfather.telegram/telegram-consumer-simple -->
<telegram.bot.version>1.5.2</telegram.bot.version>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin.maven.compiler.ver>3.13.0</plugin.maven.compiler.ver>
<!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
<plugin.nexus.staging.ver>1.7.0</plugin.nexus.staging.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
<plugin.maven.source.ver>3.3.1</plugin.maven.source.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
<plugin.maven.javadoc.ver>3.8.0</plugin.maven.javadoc.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
<plugin.maven.gpg.ver>3.2.5</plugin.maven.gpg.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
<plugin.maven.release.ver>3.1.1</plugin.maven.release.ver>
</properties>
<dependencies>
<dependency>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${plugin.nexus.staging.ver}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${plugin.maven.source.ver}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.maven.javadoc.ver}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${plugin.maven.gpg.ver}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.maven.compiler.ver}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${plugin.maven.release.ver}</version>
<configuration>
<preparationGoals>clean install</preparationGoals>
<tagNameFormat>v.@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
<signTag>true</signTag>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release-struchkov-nexus</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>struchkov-nexus</serverId>
<nexusUrl>https://nexus.struchkov.dev/nexus/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>snapshot</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>struchkov-nexus</serverId>
<nexusUrl>https://nexus.struchkov.dev/nexus/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>struchkov-nexus-release</id>
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>struchkov-nexus-snapshot</id>
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>struchkov-nexus-release</id>
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>struchkov-nexus-snapshot</id>
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:git:ssh://git@git.struchkov.dev:222/SDK/gitlab-sdk.git</connection>
<url>https://git.struchkov.dev/SDK/gitlab-sdk</url>
<developerConnection>scm:git:ssh://git@git.struchkov.dev:222/SDK/gitlab-sdk.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<url>https://mark.struchkov.dev</url>
</developer>
</developers>
</project>

View File

@ -0,0 +1,24 @@
package dev.struchkov.sdk.gitlab.spring.starter;
import dev.struchkov.sdk.gitlab.core.GitlabSdkManager;
import dev.struchkov.sdk.gitlab.domain.GitlabProperty;
import dev.struchkov.sdk.gitlab.domain.GitlabUrl;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.concurrent.ForkJoinPool;
@Configuration
@AutoConfigureAfter(GitlabSdkPropertyAutoconfiguration.class)
public class GitlabSdkAutoconfiguration {
@Bean
public GitlabSdkManager gitlabSdkManager(
ForkJoinPool forkJoinPool, GitlabUrl gitlabUrl, GitlabProperty gitlabProperty
) {
return new GitlabSdkManager(forkJoinPool, gitlabUrl, gitlabProperty);
}
}

View File

@ -0,0 +1,27 @@
package dev.struchkov.sdk.gitlab.spring.starter;
import dev.struchkov.sdk.gitlab.domain.GitlabProperty;
import dev.struchkov.sdk.gitlab.domain.GitlabUrl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class GitlabSdkPropertyAutoconfiguration {
@Bean
@ConfigurationProperties("gitlab-sdk")
@ConditionalOnProperty(prefix = "gitlab-sdk", name = "access-token")
public GitlabProperty gitlabProperty() {
return new GitlabProperty();
}
@Bean
@ConditionalOnBean(GitlabProperty.class)
public GitlabUrl gitlabUrl(GitlabProperty gitlabProperty) {
return new GitlabUrl(gitlabProperty);
}
}

View File

@ -0,0 +1,2 @@
dev.struchkov.sdk.gitlab.spring.starter.GitlabSdkPropertyAutoconfiguration
dev.struchkov.sdk.gitlab.spring.starter.GitlabSdkAutoconfiguration

329
pom.xml Normal file
View File

@ -0,0 +1,329 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-sdk</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>gitlab-schema</module>
<module>gitlab-domain</module>
<module>gitlab-core</module>
</modules>
<name>GitLab SDK</name>
<description>SDK для упрощения вызовов к Gitlab API.</description>
<url>https://git.struchkov.dev/SDK/gitlab-sdk</url>
<licenses>
<license>
<name>BSD 3-Clause "New" or "Revised" License</name>
<url>https://git.struchkov.dev/SDK/gitlab-sdk/blob/master/LICENSE</url>
</license>
</licenses>
<properties>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
<plugin.maven.compiler.ver>3.13.0</plugin.maven.compiler.ver>
<!-- https://mvnrepository.com/artifact/org.sonatype.plugins/nexus-staging-maven-plugin -->
<plugin.nexus.staging.ver>1.7.0</plugin.nexus.staging.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-source-plugin -->
<plugin.maven.source.ver>3.3.1</plugin.maven.source.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-javadoc-plugin -->
<plugin.maven.javadoc.ver>3.7.0</plugin.maven.javadoc.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-gpg-plugin -->
<plugin.maven.gpg.ver>3.2.4</plugin.maven.gpg.ver>
<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-release-plugin -->
<plugin.maven.release.ver>3.1.0</plugin.maven.release.ver>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-schema</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>dev.struchkov.sdk.gitlab</groupId>
<artifactId>gitlab-domain</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.34</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.17.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310 -->
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>2.17.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/dev.struchkov.haiti/haiti-utils -->
<dependency>
<groupId>dev.struchkov.haiti</groupId>
<artifactId>haiti-utils</artifactId>
<version>3.0.3</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${plugin.nexus.staging.ver}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.maven.compiler.ver}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>${plugin.maven.source.ver}</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${plugin.maven.javadoc.ver}</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${plugin.maven.gpg.ver}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${plugin.maven.release.ver}</version>
<configuration>
<preparationGoals>clean install</preparationGoals>
<tagNameFormat>v.@{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
<pushChanges>false</pushChanges>
<localCheckout>true</localCheckout>
<signTag>true</signTag>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release-struchkov-nexus</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>struchkov-nexus</serverId>
<nexusUrl>https://nexus.struchkov.dev/nexus/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>snapshot</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<configuration>
<serverId>struchkov-nexus</serverId>
<nexusUrl>https://nexus.struchkov.dev/nexus/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<repositories>
<repository>
<id>struchkov-nexus-release</id>
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>fail</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>struchkov-nexus-snapshot</id>
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>struchkov-nexus-release</id>
<url>https://nexus.struchkov.dev/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>struchkov-nexus-snapshot</id>
<url>https://nexus.struchkov.dev/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:git:ssh://git@git.struchkov.dev:222/SDK/gitlab-sdk.git</connection>
<url>https://git.struchkov.dev/SDK/gitlab-sdk</url>
<developerConnection>scm:git:ssh://git@git.struchkov.dev:222/SDK/gitlab-sdk.git</developerConnection>
<tag>HEAD</tag>
</scm>
<developers>
<developer>
<id>uPagge</id>
<name>Struchkov Mark</name>
<email>mark@struchkov.dev</email>
<url>https://mark.struchkov.dev</url>
</developer>
</developers>
</project>