Chore: initial commit

This commit is contained in:
Dorian Zedler 2022-07-07 23:19:20 +02:00
parent 2464c150c6
commit b94e0db406
Signed by: dorian
GPG key ID: 989DE36109AFA354
177 changed files with 76779 additions and 0 deletions

2
.gitignore vendored
View file

@ -160,3 +160,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
# Config
gitlab-config.yml

191
gitea/__init__.py Normal file
View file

@ -0,0 +1,191 @@
# coding: utf-8
# flake8: noqa
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import apis into sdk package
from gitea.api.admin_api import AdminApi
from gitea.api.issue_api import IssueApi
from gitea.api.miscellaneous_api import MiscellaneousApi
from gitea.api.notification_api import NotificationApi
from gitea.api.organization_api import OrganizationApi
from gitea.api.package_api import PackageApi
from gitea.api.repository_api import RepositoryApi
from gitea.api.settings_api import SettingsApi
from gitea.api.user_api import UserApi
# import ApiClient
from gitea.api_client import ApiClient
from gitea.configuration import Configuration
# import models into sdk package
from gitea.models.api_error import APIError
from gitea.models.access_token import AccessToken
from gitea.models.add_collaborator_option import AddCollaboratorOption
from gitea.models.add_time_option import AddTimeOption
from gitea.models.annotated_tag import AnnotatedTag
from gitea.models.annotated_tag_object import AnnotatedTagObject
from gitea.models.attachment import Attachment
from gitea.models.branch import Branch
from gitea.models.branch_protection import BranchProtection
from gitea.models.combined_status import CombinedStatus
from gitea.models.comment import Comment
from gitea.models.commit import Commit
from gitea.models.commit_affected_files import CommitAffectedFiles
from gitea.models.commit_date_options import CommitDateOptions
from gitea.models.commit_meta import CommitMeta
from gitea.models.commit_stats import CommitStats
from gitea.models.commit_status import CommitStatus
from gitea.models.commit_status_state import CommitStatusState
from gitea.models.commit_user import CommitUser
from gitea.models.contents_response import ContentsResponse
from gitea.models.create_access_token_option import CreateAccessTokenOption
from gitea.models.create_branch_protection_option import CreateBranchProtectionOption
from gitea.models.create_branch_repo_option import CreateBranchRepoOption
from gitea.models.create_email_option import CreateEmailOption
from gitea.models.create_file_options import CreateFileOptions
from gitea.models.create_fork_option import CreateForkOption
from gitea.models.create_gpg_key_option import CreateGPGKeyOption
from gitea.models.create_hook_option import CreateHookOption
from gitea.models.create_hook_option_config import CreateHookOptionConfig
from gitea.models.create_issue_comment_option import CreateIssueCommentOption
from gitea.models.create_issue_option import CreateIssueOption
from gitea.models.create_key_option import CreateKeyOption
from gitea.models.create_label_option import CreateLabelOption
from gitea.models.create_milestone_option import CreateMilestoneOption
from gitea.models.create_o_auth2_application_options import CreateOAuth2ApplicationOptions
from gitea.models.create_org_option import CreateOrgOption
from gitea.models.create_pull_request_option import CreatePullRequestOption
from gitea.models.create_pull_review_comment import CreatePullReviewComment
from gitea.models.create_pull_review_options import CreatePullReviewOptions
from gitea.models.create_release_option import CreateReleaseOption
from gitea.models.create_repo_option import CreateRepoOption
from gitea.models.create_status_option import CreateStatusOption
from gitea.models.create_tag_option import CreateTagOption
from gitea.models.create_team_option import CreateTeamOption
from gitea.models.create_user_option import CreateUserOption
from gitea.models.create_wiki_page_options import CreateWikiPageOptions
from gitea.models.cron import Cron
from gitea.models.delete_email_option import DeleteEmailOption
from gitea.models.delete_file_options import DeleteFileOptions
from gitea.models.deploy_key import DeployKey
from gitea.models.dismiss_pull_review_options import DismissPullReviewOptions
from gitea.models.edit_attachment_options import EditAttachmentOptions
from gitea.models.edit_branch_protection_option import EditBranchProtectionOption
from gitea.models.edit_deadline_option import EditDeadlineOption
from gitea.models.edit_git_hook_option import EditGitHookOption
from gitea.models.edit_hook_option import EditHookOption
from gitea.models.edit_issue_comment_option import EditIssueCommentOption
from gitea.models.edit_issue_option import EditIssueOption
from gitea.models.edit_label_option import EditLabelOption
from gitea.models.edit_milestone_option import EditMilestoneOption
from gitea.models.edit_org_option import EditOrgOption
from gitea.models.edit_pull_request_option import EditPullRequestOption
from gitea.models.edit_reaction_option import EditReactionOption
from gitea.models.edit_release_option import EditReleaseOption
from gitea.models.edit_repo_option import EditRepoOption
from gitea.models.edit_team_option import EditTeamOption
from gitea.models.edit_user_option import EditUserOption
from gitea.models.email import Email
from gitea.models.external_tracker import ExternalTracker
from gitea.models.external_wiki import ExternalWiki
from gitea.models.file_commit_response import FileCommitResponse
from gitea.models.file_delete_response import FileDeleteResponse
from gitea.models.file_links_response import FileLinksResponse
from gitea.models.file_response import FileResponse
from gitea.models.gpg_key import GPGKey
from gitea.models.gpg_key_email import GPGKeyEmail
from gitea.models.general_api_settings import GeneralAPISettings
from gitea.models.general_attachment_settings import GeneralAttachmentSettings
from gitea.models.general_repo_settings import GeneralRepoSettings
from gitea.models.general_ui_settings import GeneralUISettings
from gitea.models.generate_repo_option import GenerateRepoOption
from gitea.models.git_blob_response import GitBlobResponse
from gitea.models.git_entry import GitEntry
from gitea.models.git_hook import GitHook
from gitea.models.git_object import GitObject
from gitea.models.git_service_type import GitServiceType
from gitea.models.git_tree_response import GitTreeResponse
from gitea.models.hook import Hook
from gitea.models.identity import Identity
from gitea.models.internal_tracker import InternalTracker
from gitea.models.issue import Issue
from gitea.models.issue_deadline import IssueDeadline
from gitea.models.issue_labels_option import IssueLabelsOption
from gitea.models.issue_template import IssueTemplate
from gitea.models.label import Label
from gitea.models.markdown_option import MarkdownOption
from gitea.models.merge_pull_request_option import MergePullRequestOption
from gitea.models.migrate_repo_form import MigrateRepoForm
from gitea.models.migrate_repo_options import MigrateRepoOptions
from gitea.models.milestone import Milestone
from gitea.models.node_info import NodeInfo
from gitea.models.node_info_services import NodeInfoServices
from gitea.models.node_info_software import NodeInfoSoftware
from gitea.models.node_info_usage import NodeInfoUsage
from gitea.models.node_info_usage_users import NodeInfoUsageUsers
from gitea.models.note import Note
from gitea.models.notification_count import NotificationCount
from gitea.models.notification_subject import NotificationSubject
from gitea.models.notification_thread import NotificationThread
from gitea.models.notify_subject_type import NotifySubjectType
from gitea.models.o_auth2_application import OAuth2Application
from gitea.models.organization import Organization
from gitea.models.organization_permissions import OrganizationPermissions
from gitea.models.pr_branch_info import PRBranchInfo
from gitea.models.package import Package
from gitea.models.package_file import PackageFile
from gitea.models.payload_commit import PayloadCommit
from gitea.models.payload_commit_verification import PayloadCommitVerification
from gitea.models.payload_user import PayloadUser
from gitea.models.permission import Permission
from gitea.models.public_key import PublicKey
from gitea.models.pull_request import PullRequest
from gitea.models.pull_request_meta import PullRequestMeta
from gitea.models.pull_review import PullReview
from gitea.models.pull_review_comment import PullReviewComment
from gitea.models.pull_review_request_options import PullReviewRequestOptions
from gitea.models.reaction import Reaction
from gitea.models.reference import Reference
from gitea.models.release import Release
from gitea.models.repo_collaborator_permission import RepoCollaboratorPermission
from gitea.models.repo_commit import RepoCommit
from gitea.models.repo_topic_options import RepoTopicOptions
from gitea.models.repo_transfer import RepoTransfer
from gitea.models.repository import Repository
from gitea.models.repository_meta import RepositoryMeta
from gitea.models.review_state_type import ReviewStateType
from gitea.models.search_results import SearchResults
from gitea.models.server_version import ServerVersion
from gitea.models.state_type import StateType
from gitea.models.stop_watch import StopWatch
from gitea.models.submit_pull_review_options import SubmitPullReviewOptions
from gitea.models.tag import Tag
from gitea.models.team import Team
from gitea.models.time_stamp import TimeStamp
from gitea.models.timeline_comment import TimelineComment
from gitea.models.topic_name import TopicName
from gitea.models.topic_response import TopicResponse
from gitea.models.tracked_time import TrackedTime
from gitea.models.transfer_repo_option import TransferRepoOption
from gitea.models.update_file_options import UpdateFileOptions
from gitea.models.user import User
from gitea.models.user_heatmap_data import UserHeatmapData
from gitea.models.user_settings import UserSettings
from gitea.models.user_settings_options import UserSettingsOptions
from gitea.models.watch_info import WatchInfo
from gitea.models.wiki_commit import WikiCommit
from gitea.models.wiki_commit_list import WikiCommitList
from gitea.models.wiki_page import WikiPage
from gitea.models.wiki_page_meta_data import WikiPageMetaData

14
gitea/api/__init__.py Normal file
View file

@ -0,0 +1,14 @@
from __future__ import absolute_import
# flake8: noqa
# import apis into api package
from gitea.api.admin_api import AdminApi
from gitea.api.issue_api import IssueApi
from gitea.api.miscellaneous_api import MiscellaneousApi
from gitea.api.notification_api import NotificationApi
from gitea.api.organization_api import OrganizationApi
from gitea.api.package_api import PackageApi
from gitea.api.repository_api import RepositoryApi
from gitea.api.settings_api import SettingsApi
from gitea.api.user_api import UserApi

1440
gitea/api/admin_api.py Normal file

File diff suppressed because it is too large Load diff

5706
gitea/api/issue_api.py Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,491 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from gitea.api_client import ApiClient
class MiscellaneousApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_node_info(self, **kwargs): # noqa: E501
"""Returns the nodeinfo of the Gitea application # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: NodeInfo
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_node_info_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_node_info_with_http_info(**kwargs) # noqa: E501
return data
def get_node_info_with_http_info(self, **kwargs): # noqa: E501
"""Returns the nodeinfo of the Gitea application # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_node_info_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: NodeInfo
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_node_info" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/nodeinfo', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='NodeInfo', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_signing_key(self, **kwargs): # noqa: E501
"""Get default signing-key.gpg # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_signing_key(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_signing_key_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_signing_key_with_http_info(**kwargs) # noqa: E501
return data
def get_signing_key_with_http_info(self, **kwargs): # noqa: E501
"""Get default signing-key.gpg # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_signing_key_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_signing_key" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/signing-key.gpg', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_version(self, **kwargs): # noqa: E501
"""Returns the version of the Gitea application # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_version(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: ServerVersion
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_version_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_version_with_http_info(**kwargs) # noqa: E501
return data
def get_version_with_http_info(self, **kwargs): # noqa: E501
"""Returns the version of the Gitea application # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_version_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: ServerVersion
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_version" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/version', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='ServerVersion', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def render_markdown(self, **kwargs): # noqa: E501
"""Render a markdown document as HTML # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.render_markdown(async_req=True)
>>> result = thread.get()
:param async_req bool
:param MarkdownOption body:
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.render_markdown_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.render_markdown_with_http_info(**kwargs) # noqa: E501
return data
def render_markdown_with_http_info(self, **kwargs): # noqa: E501
"""Render a markdown document as HTML # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.render_markdown_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param MarkdownOption body:
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method render_markdown" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/html']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/markdown', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def render_markdown_raw(self, body, **kwargs): # noqa: E501
"""Render raw markdown as HTML # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.render_markdown_raw(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str body: Request body to render (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.render_markdown_raw_with_http_info(body, **kwargs) # noqa: E501
else:
(data) = self.render_markdown_raw_with_http_info(body, **kwargs) # noqa: E501
return data
def render_markdown_raw_with_http_info(self, body, **kwargs): # noqa: E501
"""Render raw markdown as HTML # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.render_markdown_raw_with_http_info(body, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str body: Request body to render (required)
:return: str
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['body'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method render_markdown_raw" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'body' is set
if self.api_client.client_side_validation and ('body' not in params or
params['body'] is None): # noqa: E501
raise ValueError("Missing the required parameter `body` when calling `render_markdown_raw`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'body' in params:
body_params = params['body']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/html']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/markdown/raw', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='str', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

View file

@ -0,0 +1,803 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from gitea.api_client import ApiClient
class NotificationApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def notify_get_list(self, **kwargs): # noqa: E501
"""List users's notification threads # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_get_list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param bool all: If true, show notifications marked as read. Default value is false
:param list[str] status_types: Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned.
:param list[str] subject_type: filter notifications by subject type
:param datetime since: Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
:param datetime before: Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
:param int page: page number of results to return (1-based)
:param int limit: page size of results
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_get_list_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.notify_get_list_with_http_info(**kwargs) # noqa: E501
return data
def notify_get_list_with_http_info(self, **kwargs): # noqa: E501
"""List users's notification threads # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_get_list_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param bool all: If true, show notifications marked as read. Default value is false
:param list[str] status_types: Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned.
:param list[str] subject_type: filter notifications by subject type
:param datetime since: Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
:param datetime before: Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
:param int page: page number of results to return (1-based)
:param int limit: page size of results
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['all', 'status_types', 'subject_type', 'since', 'before', 'page', 'limit'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_get_list" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'all' in params:
query_params.append(('all', params['all'])) # noqa: E501
if 'status_types' in params:
query_params.append(('status-types', params['status_types'])) # noqa: E501
collection_formats['status-types'] = 'multi' # noqa: E501
if 'subject_type' in params:
query_params.append(('subject-type', params['subject_type'])) # noqa: E501
collection_formats['subject-type'] = 'multi' # noqa: E501
if 'since' in params:
query_params.append(('since', params['since'])) # noqa: E501
if 'before' in params:
query_params.append(('before', params['before'])) # noqa: E501
if 'page' in params:
query_params.append(('page', params['page'])) # noqa: E501
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/notifications', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[NotificationThread]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def notify_get_repo_list(self, owner, repo, **kwargs): # noqa: E501
"""List users's notification threads on a specific repo # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_get_repo_list(owner, repo, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the repo (required)
:param str repo: name of the repo (required)
:param bool all: If true, show notifications marked as read. Default value is false
:param list[str] status_types: Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned
:param list[str] subject_type: filter notifications by subject type
:param datetime since: Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
:param datetime before: Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
:param int page: page number of results to return (1-based)
:param int limit: page size of results
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_get_repo_list_with_http_info(owner, repo, **kwargs) # noqa: E501
else:
(data) = self.notify_get_repo_list_with_http_info(owner, repo, **kwargs) # noqa: E501
return data
def notify_get_repo_list_with_http_info(self, owner, repo, **kwargs): # noqa: E501
"""List users's notification threads on a specific repo # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_get_repo_list_with_http_info(owner, repo, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the repo (required)
:param str repo: name of the repo (required)
:param bool all: If true, show notifications marked as read. Default value is false
:param list[str] status_types: Show notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread & pinned
:param list[str] subject_type: filter notifications by subject type
:param datetime since: Only show notifications updated after the given time. This is a timestamp in RFC 3339 format
:param datetime before: Only show notifications updated before the given time. This is a timestamp in RFC 3339 format
:param int page: page number of results to return (1-based)
:param int limit: page size of results
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['owner', 'repo', 'all', 'status_types', 'subject_type', 'since', 'before', 'page', 'limit'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_get_repo_list" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'owner' is set
if self.api_client.client_side_validation and ('owner' not in params or
params['owner'] is None): # noqa: E501
raise ValueError("Missing the required parameter `owner` when calling `notify_get_repo_list`") # noqa: E501
# verify the required parameter 'repo' is set
if self.api_client.client_side_validation and ('repo' not in params or
params['repo'] is None): # noqa: E501
raise ValueError("Missing the required parameter `repo` when calling `notify_get_repo_list`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in params:
path_params['owner'] = params['owner'] # noqa: E501
if 'repo' in params:
path_params['repo'] = params['repo'] # noqa: E501
query_params = []
if 'all' in params:
query_params.append(('all', params['all'])) # noqa: E501
if 'status_types' in params:
query_params.append(('status-types', params['status_types'])) # noqa: E501
collection_formats['status-types'] = 'multi' # noqa: E501
if 'subject_type' in params:
query_params.append(('subject-type', params['subject_type'])) # noqa: E501
collection_formats['subject-type'] = 'multi' # noqa: E501
if 'since' in params:
query_params.append(('since', params['since'])) # noqa: E501
if 'before' in params:
query_params.append(('before', params['before'])) # noqa: E501
if 'page' in params:
query_params.append(('page', params['page'])) # noqa: E501
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/repos/{owner}/{repo}/notifications', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[NotificationThread]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def notify_get_thread(self, id, **kwargs): # noqa: E501
"""Get notification thread by ID # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_get_thread(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: id of notification thread (required)
:return: NotificationThread
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_get_thread_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.notify_get_thread_with_http_info(id, **kwargs) # noqa: E501
return data
def notify_get_thread_with_http_info(self, id, **kwargs): # noqa: E501
"""Get notification thread by ID # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_get_thread_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: id of notification thread (required)
:return: NotificationThread
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_get_thread" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if self.api_client.client_side_validation and ('id' not in params or
params['id'] is None): # noqa: E501
raise ValueError("Missing the required parameter `id` when calling `notify_get_thread`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/notifications/threads/{id}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='NotificationThread', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def notify_new_available(self, **kwargs): # noqa: E501
"""Check if unread notifications exist # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_new_available(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: NotificationCount
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_new_available_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.notify_new_available_with_http_info(**kwargs) # noqa: E501
return data
def notify_new_available_with_http_info(self, **kwargs): # noqa: E501
"""Check if unread notifications exist # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_new_available_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: NotificationCount
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_new_available" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'text/html']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/notifications/new', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='NotificationCount', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def notify_read_list(self, **kwargs): # noqa: E501
"""Mark notification threads as read, pinned or unread # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_read_list(async_req=True)
>>> result = thread.get()
:param async_req bool
:param datetime last_read_at: Describes the last point that notifications were checked. Anything updated since this time will not be updated.
:param str all: If true, mark all notifications on this repo. Default value is false
:param list[str] status_types: Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
:param str to_status: Status to mark notifications as, Defaults to read.
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_read_list_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.notify_read_list_with_http_info(**kwargs) # noqa: E501
return data
def notify_read_list_with_http_info(self, **kwargs): # noqa: E501
"""Mark notification threads as read, pinned or unread # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_read_list_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:param datetime last_read_at: Describes the last point that notifications were checked. Anything updated since this time will not be updated.
:param str all: If true, mark all notifications on this repo. Default value is false
:param list[str] status_types: Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
:param str to_status: Status to mark notifications as, Defaults to read.
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['last_read_at', 'all', 'status_types', 'to_status'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_read_list" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
if 'last_read_at' in params:
query_params.append(('last_read_at', params['last_read_at'])) # noqa: E501
if 'all' in params:
query_params.append(('all', params['all'])) # noqa: E501
if 'status_types' in params:
query_params.append(('status-types', params['status_types'])) # noqa: E501
collection_formats['status-types'] = 'multi' # noqa: E501
if 'to_status' in params:
query_params.append(('to-status', params['to_status'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/notifications', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[NotificationThread]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def notify_read_repo_list(self, owner, repo, **kwargs): # noqa: E501
"""Mark notification threads as read, pinned or unread on a specific repo # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_read_repo_list(owner, repo, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the repo (required)
:param str repo: name of the repo (required)
:param str all: If true, mark all notifications on this repo. Default value is false
:param list[str] status_types: Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
:param str to_status: Status to mark notifications as. Defaults to read.
:param datetime last_read_at: Describes the last point that notifications were checked. Anything updated since this time will not be updated.
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_read_repo_list_with_http_info(owner, repo, **kwargs) # noqa: E501
else:
(data) = self.notify_read_repo_list_with_http_info(owner, repo, **kwargs) # noqa: E501
return data
def notify_read_repo_list_with_http_info(self, owner, repo, **kwargs): # noqa: E501
"""Mark notification threads as read, pinned or unread on a specific repo # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_read_repo_list_with_http_info(owner, repo, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the repo (required)
:param str repo: name of the repo (required)
:param str all: If true, mark all notifications on this repo. Default value is false
:param list[str] status_types: Mark notifications with the provided status types. Options are: unread, read and/or pinned. Defaults to unread.
:param str to_status: Status to mark notifications as. Defaults to read.
:param datetime last_read_at: Describes the last point that notifications were checked. Anything updated since this time will not be updated.
:return: list[NotificationThread]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['owner', 'repo', 'all', 'status_types', 'to_status', 'last_read_at'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_read_repo_list" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'owner' is set
if self.api_client.client_side_validation and ('owner' not in params or
params['owner'] is None): # noqa: E501
raise ValueError("Missing the required parameter `owner` when calling `notify_read_repo_list`") # noqa: E501
# verify the required parameter 'repo' is set
if self.api_client.client_side_validation and ('repo' not in params or
params['repo'] is None): # noqa: E501
raise ValueError("Missing the required parameter `repo` when calling `notify_read_repo_list`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in params:
path_params['owner'] = params['owner'] # noqa: E501
if 'repo' in params:
path_params['repo'] = params['repo'] # noqa: E501
query_params = []
if 'all' in params:
query_params.append(('all', params['all'])) # noqa: E501
if 'status_types' in params:
query_params.append(('status-types', params['status_types'])) # noqa: E501
collection_formats['status-types'] = 'multi' # noqa: E501
if 'to_status' in params:
query_params.append(('to-status', params['to_status'])) # noqa: E501
if 'last_read_at' in params:
query_params.append(('last_read_at', params['last_read_at'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/repos/{owner}/{repo}/notifications', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[NotificationThread]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def notify_read_thread(self, id, **kwargs): # noqa: E501
"""Mark notification thread as read by ID # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_read_thread(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: id of notification thread (required)
:param str to_status: Status to mark notifications as
:return: NotificationThread
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.notify_read_thread_with_http_info(id, **kwargs) # noqa: E501
else:
(data) = self.notify_read_thread_with_http_info(id, **kwargs) # noqa: E501
return data
def notify_read_thread_with_http_info(self, id, **kwargs): # noqa: E501
"""Mark notification thread as read by ID # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.notify_read_thread_with_http_info(id, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str id: id of notification thread (required)
:param str to_status: Status to mark notifications as
:return: NotificationThread
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['id', 'to_status'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method notify_read_thread" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'id' is set
if self.api_client.client_side_validation and ('id' not in params or
params['id'] is None): # noqa: E501
raise ValueError("Missing the required parameter `id` when calling `notify_read_thread`") # noqa: E501
collection_formats = {}
path_params = {}
if 'id' in params:
path_params['id'] = params['id'] # noqa: E501
query_params = []
if 'to_status' in params:
query_params.append(('to-status', params['to_status'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/notifications/threads/{id}', 'PATCH',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='NotificationThread', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

File diff suppressed because it is too large Load diff

510
gitea/api/package_api.py Normal file
View file

@ -0,0 +1,510 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from gitea.api_client import ApiClient
class PackageApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def delete_package(self, owner, type, name, version, **kwargs): # noqa: E501
"""Delete a package # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_package(owner, type, name, version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the package (required)
:param str type: type of the package (required)
:param str name: name of the package (required)
:param str version: version of the package (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.delete_package_with_http_info(owner, type, name, version, **kwargs) # noqa: E501
else:
(data) = self.delete_package_with_http_info(owner, type, name, version, **kwargs) # noqa: E501
return data
def delete_package_with_http_info(self, owner, type, name, version, **kwargs): # noqa: E501
"""Delete a package # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.delete_package_with_http_info(owner, type, name, version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the package (required)
:param str type: type of the package (required)
:param str name: name of the package (required)
:param str version: version of the package (required)
:return: None
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['owner', 'type', 'name', 'version'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method delete_package" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'owner' is set
if self.api_client.client_side_validation and ('owner' not in params or
params['owner'] is None): # noqa: E501
raise ValueError("Missing the required parameter `owner` when calling `delete_package`") # noqa: E501
# verify the required parameter 'type' is set
if self.api_client.client_side_validation and ('type' not in params or
params['type'] is None): # noqa: E501
raise ValueError("Missing the required parameter `type` when calling `delete_package`") # noqa: E501
# verify the required parameter 'name' is set
if self.api_client.client_side_validation and ('name' not in params or
params['name'] is None): # noqa: E501
raise ValueError("Missing the required parameter `name` when calling `delete_package`") # noqa: E501
# verify the required parameter 'version' is set
if self.api_client.client_side_validation and ('version' not in params or
params['version'] is None): # noqa: E501
raise ValueError("Missing the required parameter `version` when calling `delete_package`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in params:
path_params['owner'] = params['owner'] # noqa: E501
if 'type' in params:
path_params['type'] = params['type'] # noqa: E501
if 'name' in params:
path_params['name'] = params['name'] # noqa: E501
if 'version' in params:
path_params['version'] = params['version'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json', 'text/html']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/packages/{owner}/{type}/{name}/{version}', 'DELETE',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type=None, # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_package(self, owner, type, name, version, **kwargs): # noqa: E501
"""Gets a package # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_package(owner, type, name, version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the package (required)
:param str type: type of the package (required)
:param str name: name of the package (required)
:param str version: version of the package (required)
:return: Package
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_package_with_http_info(owner, type, name, version, **kwargs) # noqa: E501
else:
(data) = self.get_package_with_http_info(owner, type, name, version, **kwargs) # noqa: E501
return data
def get_package_with_http_info(self, owner, type, name, version, **kwargs): # noqa: E501
"""Gets a package # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_package_with_http_info(owner, type, name, version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the package (required)
:param str type: type of the package (required)
:param str name: name of the package (required)
:param str version: version of the package (required)
:return: Package
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['owner', 'type', 'name', 'version'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_package" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'owner' is set
if self.api_client.client_side_validation and ('owner' not in params or
params['owner'] is None): # noqa: E501
raise ValueError("Missing the required parameter `owner` when calling `get_package`") # noqa: E501
# verify the required parameter 'type' is set
if self.api_client.client_side_validation and ('type' not in params or
params['type'] is None): # noqa: E501
raise ValueError("Missing the required parameter `type` when calling `get_package`") # noqa: E501
# verify the required parameter 'name' is set
if self.api_client.client_side_validation and ('name' not in params or
params['name'] is None): # noqa: E501
raise ValueError("Missing the required parameter `name` when calling `get_package`") # noqa: E501
# verify the required parameter 'version' is set
if self.api_client.client_side_validation and ('version' not in params or
params['version'] is None): # noqa: E501
raise ValueError("Missing the required parameter `version` when calling `get_package`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in params:
path_params['owner'] = params['owner'] # noqa: E501
if 'type' in params:
path_params['type'] = params['type'] # noqa: E501
if 'name' in params:
path_params['name'] = params['name'] # noqa: E501
if 'version' in params:
path_params['version'] = params['version'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/packages/{owner}/{type}/{name}/{version}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='Package', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_package_files(self, owner, type, name, version, **kwargs): # noqa: E501
"""Gets all files of a package # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_package_files(owner, type, name, version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the package (required)
:param str type: type of the package (required)
:param str name: name of the package (required)
:param str version: version of the package (required)
:return: list[PackageFile]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_package_files_with_http_info(owner, type, name, version, **kwargs) # noqa: E501
else:
(data) = self.list_package_files_with_http_info(owner, type, name, version, **kwargs) # noqa: E501
return data
def list_package_files_with_http_info(self, owner, type, name, version, **kwargs): # noqa: E501
"""Gets all files of a package # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_package_files_with_http_info(owner, type, name, version, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the package (required)
:param str type: type of the package (required)
:param str name: name of the package (required)
:param str version: version of the package (required)
:return: list[PackageFile]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['owner', 'type', 'name', 'version'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_package_files" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'owner' is set
if self.api_client.client_side_validation and ('owner' not in params or
params['owner'] is None): # noqa: E501
raise ValueError("Missing the required parameter `owner` when calling `list_package_files`") # noqa: E501
# verify the required parameter 'type' is set
if self.api_client.client_side_validation and ('type' not in params or
params['type'] is None): # noqa: E501
raise ValueError("Missing the required parameter `type` when calling `list_package_files`") # noqa: E501
# verify the required parameter 'name' is set
if self.api_client.client_side_validation and ('name' not in params or
params['name'] is None): # noqa: E501
raise ValueError("Missing the required parameter `name` when calling `list_package_files`") # noqa: E501
# verify the required parameter 'version' is set
if self.api_client.client_side_validation and ('version' not in params or
params['version'] is None): # noqa: E501
raise ValueError("Missing the required parameter `version` when calling `list_package_files`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in params:
path_params['owner'] = params['owner'] # noqa: E501
if 'type' in params:
path_params['type'] = params['type'] # noqa: E501
if 'name' in params:
path_params['name'] = params['name'] # noqa: E501
if 'version' in params:
path_params['version'] = params['version'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/packages/{owner}/{type}/{name}/{version}/files', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[PackageFile]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def list_packages(self, owner, **kwargs): # noqa: E501
"""Gets all packages of an owner # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_packages(owner, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the packages (required)
:param int page: page number of results to return (1-based)
:param int limit: page size of results
:param str type: package type filter
:param str q: name filter
:return: list[Package]
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.list_packages_with_http_info(owner, **kwargs) # noqa: E501
else:
(data) = self.list_packages_with_http_info(owner, **kwargs) # noqa: E501
return data
def list_packages_with_http_info(self, owner, **kwargs): # noqa: E501
"""Gets all packages of an owner # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_packages_with_http_info(owner, async_req=True)
>>> result = thread.get()
:param async_req bool
:param str owner: owner of the packages (required)
:param int page: page number of results to return (1-based)
:param int limit: page size of results
:param str type: package type filter
:param str q: name filter
:return: list[Package]
If the method is called asynchronously,
returns the request thread.
"""
all_params = ['owner', 'page', 'limit', 'type', 'q'] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method list_packages" % key
)
params[key] = val
del params['kwargs']
# verify the required parameter 'owner' is set
if self.api_client.client_side_validation and ('owner' not in params or
params['owner'] is None): # noqa: E501
raise ValueError("Missing the required parameter `owner` when calling `list_packages`") # noqa: E501
collection_formats = {}
path_params = {}
if 'owner' in params:
path_params['owner'] = params['owner'] # noqa: E501
query_params = []
if 'page' in params:
query_params.append(('page', params['page'])) # noqa: E501
if 'limit' in params:
query_params.append(('limit', params['limit'])) # noqa: E501
if 'type' in params:
query_params.append(('type', params['type'])) # noqa: E501
if 'q' in params:
query_params.append(('q', params['q'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/packages/{owner}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='list[Package]', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

14653
gitea/api/repository_api.py Normal file

File diff suppressed because it is too large Load diff

390
gitea/api/settings_api.py Normal file
View file

@ -0,0 +1,390 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from gitea.api_client import ApiClient
class SettingsApi(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
Ref: https://github.com/swagger-api/swagger-codegen
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def get_general_api_settings(self, **kwargs): # noqa: E501
"""Get instance's global settings for api # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_api_settings(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralAPISettings
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_general_api_settings_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_general_api_settings_with_http_info(**kwargs) # noqa: E501
return data
def get_general_api_settings_with_http_info(self, **kwargs): # noqa: E501
"""Get instance's global settings for api # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_api_settings_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralAPISettings
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_general_api_settings" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/settings/api', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GeneralAPISettings', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_general_attachment_settings(self, **kwargs): # noqa: E501
"""Get instance's global settings for Attachment # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_attachment_settings(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralAttachmentSettings
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_general_attachment_settings_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_general_attachment_settings_with_http_info(**kwargs) # noqa: E501
return data
def get_general_attachment_settings_with_http_info(self, **kwargs): # noqa: E501
"""Get instance's global settings for Attachment # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_attachment_settings_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralAttachmentSettings
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_general_attachment_settings" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/settings/attachment', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GeneralAttachmentSettings', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_general_repository_settings(self, **kwargs): # noqa: E501
"""Get instance's global settings for repositories # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_repository_settings(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralRepoSettings
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_general_repository_settings_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_general_repository_settings_with_http_info(**kwargs) # noqa: E501
return data
def get_general_repository_settings_with_http_info(self, **kwargs): # noqa: E501
"""Get instance's global settings for repositories # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_repository_settings_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralRepoSettings
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_general_repository_settings" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/settings/repository', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GeneralRepoSettings', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)
def get_general_ui_settings(self, **kwargs): # noqa: E501
"""Get instance's global settings for ui # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_ui_settings(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralUISettings
If the method is called asynchronously,
returns the request thread.
"""
kwargs['_return_http_data_only'] = True
if kwargs.get('async_req'):
return self.get_general_ui_settings_with_http_info(**kwargs) # noqa: E501
else:
(data) = self.get_general_ui_settings_with_http_info(**kwargs) # noqa: E501
return data
def get_general_ui_settings_with_http_info(self, **kwargs): # noqa: E501
"""Get instance's global settings for ui # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_general_ui_settings_with_http_info(async_req=True)
>>> result = thread.get()
:param async_req bool
:return: GeneralUISettings
If the method is called asynchronously,
returns the request thread.
"""
all_params = [] # noqa: E501
all_params.append('async_req')
all_params.append('_return_http_data_only')
all_params.append('_preload_content')
all_params.append('_request_timeout')
params = locals()
for key, val in six.iteritems(params['kwargs']):
if key not in all_params:
raise TypeError(
"Got an unexpected keyword argument '%s'"
" to method get_general_ui_settings" % key
)
params[key] = val
del params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['application/json']) # noqa: E501
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json', 'text/plain']) # noqa: E501
# Authentication setting
auth_settings = ['AccessToken', 'AuthorizationHeaderToken', 'BasicAuth', 'SudoHeader', 'SudoParam', 'TOTPHeader', 'Token'] # noqa: E501
return self.api_client.call_api(
'/settings/ui', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_type='GeneralUISettings', # noqa: E501
auth_settings=auth_settings,
async_req=params.get('async_req'),
_return_http_data_only=params.get('_return_http_data_only'),
_preload_content=params.get('_preload_content', True),
_request_timeout=params.get('_request_timeout'),
collection_formats=collection_formats)

4952
gitea/api/user_api.py Normal file

File diff suppressed because it is too large Load diff

640
gitea/api_client.py Normal file
View file

@ -0,0 +1,640 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import datetime
import json
import mimetypes
from multiprocessing.pool import ThreadPool
import os
import re
import tempfile
# python 2 and python 3 compatibility library
import six
from six.moves.urllib.parse import quote
from gitea.configuration import Configuration
import gitea.models
from gitea import rest
class ApiClient(object):
"""Generic API client for Swagger client library builds.
Swagger generic API client. This client handles the client-
server communication, and is invariant across implementations. Specifics of
the methods and models for each application are generated from the Swagger
templates.
NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
:param configuration: .Configuration object for this client
:param header_name: a header to pass when making calls to the API.
:param header_value: a header value to pass when making calls to
the API.
:param cookie: a cookie to include in the header when making calls
to the API
"""
PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types
NATIVE_TYPES_MAPPING = {
'int': int,
'long': int if six.PY3 else long, # noqa: F821
'float': float,
'str': str,
'bool': bool,
'date': datetime.date,
'datetime': datetime.datetime,
'object': object,
}
def __init__(self, configuration=None, header_name=None, header_value=None,
cookie=None):
if configuration is None:
configuration = Configuration()
self.configuration = configuration
# Use the pool property to lazily initialize the ThreadPool.
self._pool = None
self.rest_client = rest.RESTClientObject(configuration)
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/1.0.0/python'
self.client_side_validation = configuration.client_side_validation
def __del__(self):
if self._pool is not None:
self._pool.close()
self._pool.join()
@property
def pool(self):
if self._pool is None:
self._pool = ThreadPool()
return self._pool
@property
def user_agent(self):
"""User agent for this API client"""
return self.default_headers['User-Agent']
@user_agent.setter
def user_agent(self, value):
self.default_headers['User-Agent'] = value
def set_default_header(self, header_name, header_value):
self.default_headers[header_name] = header_value
def __call_api(
self, resource_path, method, path_params=None,
query_params=None, header_params=None, body=None, post_params=None,
files=None, response_type=None, auth_settings=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
config = self.configuration
# header parameters
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
header_params['Cookie'] = self.cookie
if header_params:
header_params = self.sanitize_for_serialization(header_params)
header_params = dict(self.parameters_to_tuples(header_params,
collection_formats))
# path parameters
if path_params:
path_params = self.sanitize_for_serialization(path_params)
path_params = self.parameters_to_tuples(path_params,
collection_formats)
for k, v in path_params:
# specified safe chars, encode everything
resource_path = resource_path.replace(
'{%s}' % k,
quote(str(v), safe=config.safe_chars_for_path_param)
)
# query parameters
if query_params:
query_params = self.sanitize_for_serialization(query_params)
query_params = self.parameters_to_tuples(query_params,
collection_formats)
# post parameters
if post_params or files:
post_params = self.prepare_post_parameters(post_params, files)
post_params = self.sanitize_for_serialization(post_params)
post_params = self.parameters_to_tuples(post_params,
collection_formats)
# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
body = self.sanitize_for_serialization(body)
# request url
url = self.configuration.host + resource_path
# perform request and return response
response_data = self.request(
method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body,
_preload_content=_preload_content,
_request_timeout=_request_timeout)
self.last_response = response_data
return_data = response_data
if _preload_content:
# deserialize response data
if response_type:
return_data = self.deserialize(response_data, response_type)
else:
return_data = None
if _return_http_data_only:
return (return_data)
else:
return (return_data, response_data.status,
response_data.getheaders())
def sanitize_for_serialization(self, obj):
"""Builds a JSON POST object.
If obj is None, return None.
If obj is str, int, long, float, bool, return directly.
If obj is datetime.datetime, datetime.date
convert to string in iso8601 format.
If obj is list, sanitize each element in the list.
If obj is dict, return the dict.
If obj is swagger model, return the properties dict.
:param obj: The data to serialize.
:return: The serialized form of data.
"""
if obj is None:
return None
elif isinstance(obj, self.PRIMITIVE_TYPES):
return obj
elif isinstance(obj, list):
return [self.sanitize_for_serialization(sub_obj)
for sub_obj in obj]
elif isinstance(obj, tuple):
return tuple(self.sanitize_for_serialization(sub_obj)
for sub_obj in obj)
elif isinstance(obj, (datetime.datetime, datetime.date)):
return obj.isoformat()
if isinstance(obj, dict):
obj_dict = obj
else:
# Convert model obj to dict except
# attributes `swagger_types`, `attribute_map`
# and attributes which value is not None.
# Convert attribute name to json key in
# model definition for request.
obj_dict = {obj.attribute_map[attr]: getattr(obj, attr)
for attr, _ in six.iteritems(obj.swagger_types)
if getattr(obj, attr) is not None}
return {key: self.sanitize_for_serialization(val)
for key, val in six.iteritems(obj_dict)}
def deserialize(self, response, response_type):
"""Deserializes response into an object.
:param response: RESTResponse object to be deserialized.
:param response_type: class literal for
deserialized object, or string of class name.
:return: deserialized object.
"""
# handle file downloading
# save response body into a tmp file and return the instance
if response_type == "file":
return self.__deserialize_file(response)
# fetch data from response object
try:
data = json.loads(response.data)
except ValueError:
data = response.data
return self.__deserialize(data, response_type)
def __deserialize(self, data, klass):
"""Deserializes dict, list, str into an object.
:param data: dict, list or str.
:param klass: class literal, or string of class name.
:return: object.
"""
if data is None:
return None
if type(klass) == str:
if klass.startswith('list['):
sub_kls = re.match(r'list\[(.*)\]', klass).group(1)
return [self.__deserialize(sub_data, sub_kls)
for sub_data in data]
if klass.startswith('dict('):
sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2)
return {k: self.__deserialize(v, sub_kls)
for k, v in six.iteritems(data)}
# convert str to class
if klass in self.NATIVE_TYPES_MAPPING:
klass = self.NATIVE_TYPES_MAPPING[klass]
else:
klass = getattr(gitea.models, klass)
if klass in self.PRIMITIVE_TYPES:
return self.__deserialize_primitive(data, klass)
elif klass == object:
return self.__deserialize_object(data)
elif klass == datetime.date:
return self.__deserialize_date(data)
elif klass == datetime.datetime:
return self.__deserialize_datatime(data)
else:
return self.__deserialize_model(data, klass)
def call_api(self, resource_path, method,
path_params=None, query_params=None, header_params=None,
body=None, post_params=None, files=None,
response_type=None, auth_settings=None, async_req=None,
_return_http_data_only=None, collection_formats=None,
_preload_content=True, _request_timeout=None):
"""Makes the HTTP request (synchronous) and returns deserialized data.
To make an async request, set the async_req parameter.
:param resource_path: Path to method endpoint.
:param method: Method to call.
:param path_params: Path parameters in the url.
:param query_params: Query parameters in the url.
:param header_params: Header parameters to be
placed in the request header.
:param body: Request body.
:param post_params dict: Request post form parameters,
for `application/x-www-form-urlencoded`, `multipart/form-data`.
:param auth_settings list: Auth Settings names for the request.
:param response: Response data type.
:param files dict: key -> filename, value -> filepath,
for `multipart/form-data`.
:param async_req bool: execute request asynchronously
:param _return_http_data_only: response data without head status code
and headers
:param collection_formats: dict of collection formats for path, query,
header, and post parameters.
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return:
If async_req parameter is True,
the request will be called asynchronously.
The method will return the request thread.
If parameter async_req is False or missing,
then the method will return the response directly.
"""
if not async_req:
return self.__call_api(resource_path, method,
path_params, query_params, header_params,
body, post_params, files,
response_type, auth_settings,
_return_http_data_only, collection_formats,
_preload_content, _request_timeout)
else:
thread = self.pool.apply_async(self.__call_api, (resource_path,
method, path_params, query_params,
header_params, body,
post_params, files,
response_type, auth_settings,
_return_http_data_only,
collection_formats,
_preload_content, _request_timeout))
return thread
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
_request_timeout=None):
#print(url, headers)
"""Makes the HTTP request using RESTClient."""
if method == "GET":
return self.rest_client.GET(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "HEAD":
return self.rest_client.HEAD(url,
query_params=query_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
headers=headers)
elif method == "OPTIONS":
return self.rest_client.OPTIONS(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "POST":
return self.rest_client.POST(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PUT":
return self.rest_client.PUT(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "PATCH":
return self.rest_client.PATCH(url,
query_params=query_params,
headers=headers,
post_params=post_params,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
elif method == "DELETE":
return self.rest_client.DELETE(url,
query_params=query_params,
headers=headers,
_preload_content=_preload_content,
_request_timeout=_request_timeout,
body=body)
else:
raise ValueError(
"http method must be `GET`, `HEAD`, `OPTIONS`,"
" `POST`, `PATCH`, `PUT` or `DELETE`."
)
def parameters_to_tuples(self, params, collection_formats):
"""Get parameters as list of tuples, formatting collections.
:param params: Parameters as dict or list of two-tuples
:param dict collection_formats: Parameter collection formats
:return: Parameters as list of tuples, collections formatted
"""
new_params = []
if collection_formats is None:
collection_formats = {}
for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501
if k in collection_formats:
collection_format = collection_formats[k]
if collection_format == 'multi':
new_params.extend((k, value) for value in v)
else:
if collection_format == 'ssv':
delimiter = ' '
elif collection_format == 'tsv':
delimiter = '\t'
elif collection_format == 'pipes':
delimiter = '|'
else: # csv is the default
delimiter = ','
new_params.append(
(k, delimiter.join(str(value) for value in v)))
else:
new_params.append((k, v))
return new_params
def prepare_post_parameters(self, post_params=None, files=None):
"""Builds form parameters.
:param post_params: Normal form parameters.
:param files: File parameters.
:return: Form parameters with files.
"""
params = []
if post_params:
params = post_params
if files:
for k, v in six.iteritems(files):
if not v:
continue
file_names = v if type(v) is list else [v]
for n in file_names:
with open(n, 'rb') as f:
filename = os.path.basename(f.name)
filedata = f.read()
mimetype = (mimetypes.guess_type(filename)[0] or
'application/octet-stream')
params.append(
tuple([k, tuple([filename, filedata, mimetype])]))
return params
def select_header_accept(self, accepts):
"""Returns `Accept` based on an array of accepts provided.
:param accepts: List of headers.
:return: Accept (e.g. application/json).
"""
if not accepts:
return
accepts = [x.lower() for x in accepts]
if 'application/json' in accepts:
return 'application/json'
else:
return ', '.join(accepts)
def select_header_content_type(self, content_types):
"""Returns `Content-Type` based on an array of content_types provided.
:param content_types: List of content-types.
:return: Content-Type (e.g. application/json).
"""
if not content_types:
return 'application/json'
content_types = [x.lower() for x in content_types]
if 'application/json' in content_types or '*/*' in content_types:
return 'application/json'
else:
return content_types[0]
def update_params_for_auth(self, headers, querys, auth_settings):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
:param querys: Query parameters tuple list to be updated.
:param auth_settings: Authentication setting identifiers list.
"""
if not auth_settings:
return
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
querys.append((auth_setting['key'], auth_setting['value']))
else:
raise ValueError(
'Authentication token must be in `query` or `header`'
)
def __deserialize_file(self, response):
"""Deserializes body to file
Saves response body into a file in a temporary folder,
using the filename from the `Content-Disposition` header if provided.
:param response: RESTResponse.
:return: file path.
"""
fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path)
os.close(fd)
os.remove(path)
content_disposition = response.getheader("Content-Disposition")
if content_disposition:
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)
with open(path, "w") as f:
f.write(response.data)
return path
def __deserialize_primitive(self, data, klass):
"""Deserializes string to primitive type.
:param data: str.
:param klass: class literal.
:return: int, long, float, str, bool.
"""
try:
return klass(data)
except UnicodeEncodeError:
return six.text_type(data)
except TypeError:
return data
def __deserialize_object(self, value):
"""Return a original value.
:return: object.
"""
return value
def __deserialize_date(self, string):
"""Deserializes string to date.
:param string: str.
:return: date.
"""
try:
from dateutil.parser import parse
return parse(string).date()
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason="Failed to parse `{0}` as date object".format(string)
)
def __deserialize_datatime(self, string):
"""Deserializes string to datetime.
The string should be in iso8601 datetime format.
:param string: str.
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
except ImportError:
return string
except ValueError:
raise rest.ApiException(
status=0,
reason=(
"Failed to parse `{0}` as datetime object"
.format(string)
)
)
def __hasattr(self, object, name):
return name in object.__class__.__dict__
def __deserialize_model(self, data, klass):
"""Deserializes list or dict to model.
:param data: dict, list.
:param klass: class literal.
:return: model object.
"""
if (not klass.swagger_types and
not self.__hasattr(klass, 'get_real_child_model')):
return data
kwargs = {}
if klass.swagger_types is not None:
for attr, attr_type in six.iteritems(klass.swagger_types):
if (data is not None and
klass.attribute_map[attr] in data and
isinstance(data, (list, dict))):
value = data[klass.attribute_map[attr]]
kwargs[attr] = self.__deserialize(value, attr_type)
instance = klass(**kwargs)
if (isinstance(instance, dict) and
klass.swagger_types is not None and
isinstance(data, dict)):
for key, value in data.items():
if key not in klass.swagger_types:
instance[key] = value
if self.__hasattr(instance, 'get_real_child_model'):
klass_name = instance.get_real_child_model(data)
if klass_name:
instance = self.__deserialize(data, klass_name)
return instance

297
gitea/configuration.py Normal file
View file

@ -0,0 +1,297 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
import copy
import logging
import multiprocessing
import sys
import urllib3
import six
from six.moves import http_client as httplib
class Configuration(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Ref: https://github.com/swagger-api/swagger-codegen
Do not edit the class manually.
"""
_default = None
def __init__(self):
"""Constructor"""
if self._default:
for key in self._default.__dict__.keys():
self.__dict__[key] = copy.copy(self._default.__dict__[key])
return
# Default Base url
self.host = "http://localhost/api/v1"
# Temp file folder for downloading files
self.temp_folder_path = None
# Authentication Settings
# dict to store API key(s)
self.api_key = {}
# dict to store API prefix (e.g. Bearer)
self.api_key_prefix = {}
# function to refresh API key if expired
self.refresh_api_key_hook = None
# Username for HTTP basic authentication
self.username = ""
# Password for HTTP basic authentication
self.password = ""
# Logging Settings
self.logger = {}
self.logger["package_logger"] = logging.getLogger("swagger_client")
self.logger["urllib3_logger"] = logging.getLogger("urllib3")
# Log format
self.logger_format = '%(asctime)s %(levelname)s %(message)s'
# Log stream handler
self.logger_stream_handler = None
# Log file handler
self.logger_file_handler = None
# Debug file location
self.logger_file = None
# Debug switch
self.debug = False
# SSL/TLS verification
# Set this to false to skip verifying SSL certificate when calling API
# from https server.
self.verify_ssl = True
# Set this to customize the certificate file to verify the peer.
self.ssl_ca_cert = None
# client certificate file
self.cert_file = None
# client key file
self.key_file = None
# Set this to True/False to enable/disable SSL hostname verification.
self.assert_hostname = None
# urllib3 connection pool's maximum number of connections saved
# per pool. urllib3 uses 1 connection as default value, but this is
# not the best value when you are making a lot of possibly parallel
# requests to the same host, which is often the case here.
# cpu_count * 5 is used as default value to increase performance.
self.connection_pool_maxsize = multiprocessing.cpu_count() * 5
# Proxy URL
self.proxy = None
# Safe chars for path_param
self.safe_chars_for_path_param = ''
# Disable client side validation
self.client_side_validation = True
@classmethod
def set_default(cls, default):
cls._default = default
@property
def logger_file(self):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
return self.__logger_file
@logger_file.setter
def logger_file(self, value):
"""The logger file.
If the logger_file is None, then add stream handler and remove file
handler. Otherwise, add file handler and remove stream handler.
:param value: The logger_file path.
:type: str
"""
self.__logger_file = value
if self.__logger_file:
# If set logging file,
# then add file handler and remove stream handler.
self.logger_file_handler = logging.FileHandler(self.__logger_file)
self.logger_file_handler.setFormatter(self.logger_formatter)
for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_file_handler)
if self.logger_stream_handler:
logger.removeHandler(self.logger_stream_handler)
else:
# If not set logging file,
# then add stream handler and remove file handler.
self.logger_stream_handler = logging.StreamHandler()
self.logger_stream_handler.setFormatter(self.logger_formatter)
for _, logger in six.iteritems(self.logger):
logger.addHandler(self.logger_stream_handler)
if self.logger_file_handler:
logger.removeHandler(self.logger_file_handler)
@property
def debug(self):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
return self.__debug
@debug.setter
def debug(self, value):
"""Debug status
:param value: The debug status, True or False.
:type: bool
"""
self.__debug = value
if self.__debug:
# if debug status is True, turn on debug logging
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.DEBUG)
# turn on httplib debug
httplib.HTTPConnection.debuglevel = 1
else:
# if debug status is False, turn off debug logging,
# setting log level to default `logging.WARNING`
for _, logger in six.iteritems(self.logger):
logger.setLevel(logging.WARNING)
# turn off httplib debug
httplib.HTTPConnection.debuglevel = 0
@property
def logger_format(self):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
return self.__logger_format
@logger_format.setter
def logger_format(self, value):
"""The logger format.
The logger_formatter will be updated when sets logger_format.
:param value: The format string.
:type: str
"""
self.__logger_format = value
self.logger_formatter = logging.Formatter(self.__logger_format)
def get_api_key_with_prefix(self, identifier):
"""Gets API key (with prefix if set).
:param identifier: The identifier of apiKey.
:return: The token for api key authentication.
"""
if self.refresh_api_key_hook:
self.refresh_api_key_hook(self)
key = self.api_key.get(identifier)
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
else:
return key
def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).
:return: The token for basic HTTP authentication.
"""
return urllib3.util.make_headers(
basic_auth=self.username + ':' + self.password
).get('authorization')
def auth_settings(self):
"""Gets Auth Settings dict for api client.
:return: The Auth Settings information dict.
"""
return {
'AccessToken':
{
'type': 'api_key',
'in': 'query',
'key': 'access_token',
'value': self.get_api_key_with_prefix('access_token')
},
'AuthorizationHeaderToken':
{
'type': 'api_key',
'in': 'header',
'key': 'Authorization',
'value': self.get_api_key_with_prefix('Authorization')
},
'BasicAuth':
{
'type': 'basic',
'in': 'header',
'key': 'Authorization',
'value': self.get_basic_auth_token()
},
'SudoHeader':
{
'type': 'api_key',
'in': 'header',
'key': 'Sudo',
'value': self.get_api_key_with_prefix('Sudo')
},
'SudoParam':
{
'type': 'api_key',
'in': 'query',
'key': 'sudo',
'value': self.get_api_key_with_prefix('sudo')
},
'TOTPHeader':
{
'type': 'api_key',
'in': 'header',
'key': 'X-GITEA-OTP',
'value': self.get_api_key_with_prefix('X-GITEA-OTP')
},
'Token':
{
'type': 'api_key',
'in': 'query',
'key': 'token',
'value': self.get_api_key_with_prefix('token')
},
}
def to_debug_report(self):
"""Gets the essential information for debugging.
:return: The report for debugging.
"""
return "Python SDK Debug Report:\n"\
"OS: {env}\n"\
"Python Version: {pyversion}\n"\
"Version of the API: 1.17.0+rc1\n"\
"SDK Package Version: 1.0.0".\
format(env=sys.platform, pyversion=sys.version)

176
gitea/models/__init__.py Normal file
View file

@ -0,0 +1,176 @@
# coding: utf-8
# flake8: noqa
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from gitea.models.api_error import APIError
from gitea.models.access_token import AccessToken
from gitea.models.add_collaborator_option import AddCollaboratorOption
from gitea.models.add_time_option import AddTimeOption
from gitea.models.annotated_tag import AnnotatedTag
from gitea.models.annotated_tag_object import AnnotatedTagObject
from gitea.models.attachment import Attachment
from gitea.models.branch import Branch
from gitea.models.branch_protection import BranchProtection
from gitea.models.combined_status import CombinedStatus
from gitea.models.comment import Comment
from gitea.models.commit import Commit
from gitea.models.commit_affected_files import CommitAffectedFiles
from gitea.models.commit_date_options import CommitDateOptions
from gitea.models.commit_meta import CommitMeta
from gitea.models.commit_stats import CommitStats
from gitea.models.commit_status import CommitStatus
from gitea.models.commit_status_state import CommitStatusState
from gitea.models.commit_user import CommitUser
from gitea.models.contents_response import ContentsResponse
from gitea.models.create_access_token_option import CreateAccessTokenOption
from gitea.models.create_branch_protection_option import CreateBranchProtectionOption
from gitea.models.create_branch_repo_option import CreateBranchRepoOption
from gitea.models.create_email_option import CreateEmailOption
from gitea.models.create_file_options import CreateFileOptions
from gitea.models.create_fork_option import CreateForkOption
from gitea.models.create_gpg_key_option import CreateGPGKeyOption
from gitea.models.create_hook_option import CreateHookOption
from gitea.models.create_hook_option_config import CreateHookOptionConfig
from gitea.models.create_issue_comment_option import CreateIssueCommentOption
from gitea.models.create_issue_option import CreateIssueOption
from gitea.models.create_key_option import CreateKeyOption
from gitea.models.create_label_option import CreateLabelOption
from gitea.models.create_milestone_option import CreateMilestoneOption
from gitea.models.create_o_auth2_application_options import CreateOAuth2ApplicationOptions
from gitea.models.create_org_option import CreateOrgOption
from gitea.models.create_pull_request_option import CreatePullRequestOption
from gitea.models.create_pull_review_comment import CreatePullReviewComment
from gitea.models.create_pull_review_options import CreatePullReviewOptions
from gitea.models.create_release_option import CreateReleaseOption
from gitea.models.create_repo_option import CreateRepoOption
from gitea.models.create_status_option import CreateStatusOption
from gitea.models.create_tag_option import CreateTagOption
from gitea.models.create_team_option import CreateTeamOption
from gitea.models.create_user_option import CreateUserOption
from gitea.models.create_wiki_page_options import CreateWikiPageOptions
from gitea.models.cron import Cron
from gitea.models.delete_email_option import DeleteEmailOption
from gitea.models.delete_file_options import DeleteFileOptions
from gitea.models.deploy_key import DeployKey
from gitea.models.dismiss_pull_review_options import DismissPullReviewOptions
from gitea.models.edit_attachment_options import EditAttachmentOptions
from gitea.models.edit_branch_protection_option import EditBranchProtectionOption
from gitea.models.edit_deadline_option import EditDeadlineOption
from gitea.models.edit_git_hook_option import EditGitHookOption
from gitea.models.edit_hook_option import EditHookOption
from gitea.models.edit_issue_comment_option import EditIssueCommentOption
from gitea.models.edit_issue_option import EditIssueOption
from gitea.models.edit_label_option import EditLabelOption
from gitea.models.edit_milestone_option import EditMilestoneOption
from gitea.models.edit_org_option import EditOrgOption
from gitea.models.edit_pull_request_option import EditPullRequestOption
from gitea.models.edit_reaction_option import EditReactionOption
from gitea.models.edit_release_option import EditReleaseOption
from gitea.models.edit_repo_option import EditRepoOption
from gitea.models.edit_team_option import EditTeamOption
from gitea.models.edit_user_option import EditUserOption
from gitea.models.email import Email
from gitea.models.external_tracker import ExternalTracker
from gitea.models.external_wiki import ExternalWiki
from gitea.models.file_commit_response import FileCommitResponse
from gitea.models.file_delete_response import FileDeleteResponse
from gitea.models.file_links_response import FileLinksResponse
from gitea.models.file_response import FileResponse
from gitea.models.gpg_key import GPGKey
from gitea.models.gpg_key_email import GPGKeyEmail
from gitea.models.general_api_settings import GeneralAPISettings
from gitea.models.general_attachment_settings import GeneralAttachmentSettings
from gitea.models.general_repo_settings import GeneralRepoSettings
from gitea.models.general_ui_settings import GeneralUISettings
from gitea.models.generate_repo_option import GenerateRepoOption
from gitea.models.git_blob_response import GitBlobResponse
from gitea.models.git_entry import GitEntry
from gitea.models.git_hook import GitHook
from gitea.models.git_object import GitObject
from gitea.models.git_service_type import GitServiceType
from gitea.models.git_tree_response import GitTreeResponse
from gitea.models.hook import Hook
from gitea.models.identity import Identity
from gitea.models.internal_tracker import InternalTracker
from gitea.models.issue import Issue
from gitea.models.issue_deadline import IssueDeadline
from gitea.models.issue_labels_option import IssueLabelsOption
from gitea.models.issue_template import IssueTemplate
from gitea.models.label import Label
from gitea.models.markdown_option import MarkdownOption
from gitea.models.merge_pull_request_option import MergePullRequestOption
from gitea.models.migrate_repo_form import MigrateRepoForm
from gitea.models.migrate_repo_options import MigrateRepoOptions
from gitea.models.milestone import Milestone
from gitea.models.node_info import NodeInfo
from gitea.models.node_info_services import NodeInfoServices
from gitea.models.node_info_software import NodeInfoSoftware
from gitea.models.node_info_usage import NodeInfoUsage
from gitea.models.node_info_usage_users import NodeInfoUsageUsers
from gitea.models.note import Note
from gitea.models.notification_count import NotificationCount
from gitea.models.notification_subject import NotificationSubject
from gitea.models.notification_thread import NotificationThread
from gitea.models.notify_subject_type import NotifySubjectType
from gitea.models.o_auth2_application import OAuth2Application
from gitea.models.organization import Organization
from gitea.models.organization_permissions import OrganizationPermissions
from gitea.models.pr_branch_info import PRBranchInfo
from gitea.models.package import Package
from gitea.models.package_file import PackageFile
from gitea.models.payload_commit import PayloadCommit
from gitea.models.payload_commit_verification import PayloadCommitVerification
from gitea.models.payload_user import PayloadUser
from gitea.models.permission import Permission
from gitea.models.public_key import PublicKey
from gitea.models.pull_request import PullRequest
from gitea.models.pull_request_meta import PullRequestMeta
from gitea.models.pull_review import PullReview
from gitea.models.pull_review_comment import PullReviewComment
from gitea.models.pull_review_request_options import PullReviewRequestOptions
from gitea.models.reaction import Reaction
from gitea.models.reference import Reference
from gitea.models.release import Release
from gitea.models.repo_collaborator_permission import RepoCollaboratorPermission
from gitea.models.repo_commit import RepoCommit
from gitea.models.repo_topic_options import RepoTopicOptions
from gitea.models.repo_transfer import RepoTransfer
from gitea.models.repository import Repository
from gitea.models.repository_meta import RepositoryMeta
from gitea.models.review_state_type import ReviewStateType
from gitea.models.search_results import SearchResults
from gitea.models.server_version import ServerVersion
from gitea.models.state_type import StateType
from gitea.models.stop_watch import StopWatch
from gitea.models.submit_pull_review_options import SubmitPullReviewOptions
from gitea.models.tag import Tag
from gitea.models.team import Team
from gitea.models.time_stamp import TimeStamp
from gitea.models.timeline_comment import TimelineComment
from gitea.models.topic_name import TopicName
from gitea.models.topic_response import TopicResponse
from gitea.models.tracked_time import TrackedTime
from gitea.models.transfer_repo_option import TransferRepoOption
from gitea.models.update_file_options import UpdateFileOptions
from gitea.models.user import User
from gitea.models.user_heatmap_data import UserHeatmapData
from gitea.models.user_settings import UserSettings
from gitea.models.user_settings_options import UserSettingsOptions
from gitea.models.watch_info import WatchInfo
from gitea.models.wiki_commit import WikiCommit
from gitea.models.wiki_commit_list import WikiCommitList
from gitea.models.wiki_page import WikiPage
from gitea.models.wiki_page_meta_data import WikiPageMetaData

View file

@ -0,0 +1,201 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class AccessToken(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'id': 'int',
'name': 'str',
'sha1': 'str',
'token_last_eight': 'str'
}
attribute_map = {
'id': 'id',
'name': 'name',
'sha1': 'sha1',
'token_last_eight': 'token_last_eight'
}
def __init__(self, id=None, name=None, sha1=None, token_last_eight=None, _configuration=None): # noqa: E501
"""AccessToken - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._id = None
self._name = None
self._sha1 = None
self._token_last_eight = None
self.discriminator = None
if id is not None:
self.id = id
if name is not None:
self.name = name
if sha1 is not None:
self.sha1 = sha1
if token_last_eight is not None:
self.token_last_eight = token_last_eight
@property
def id(self):
"""Gets the id of this AccessToken. # noqa: E501
:return: The id of this AccessToken. # noqa: E501
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this AccessToken.
:param id: The id of this AccessToken. # noqa: E501
:type: int
"""
self._id = id
@property
def name(self):
"""Gets the name of this AccessToken. # noqa: E501
:return: The name of this AccessToken. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this AccessToken.
:param name: The name of this AccessToken. # noqa: E501
:type: str
"""
self._name = name
@property
def sha1(self):
"""Gets the sha1 of this AccessToken. # noqa: E501
:return: The sha1 of this AccessToken. # noqa: E501
:rtype: str
"""
return self._sha1
@sha1.setter
def sha1(self, sha1):
"""Sets the sha1 of this AccessToken.
:param sha1: The sha1 of this AccessToken. # noqa: E501
:type: str
"""
self._sha1 = sha1
@property
def token_last_eight(self):
"""Gets the token_last_eight of this AccessToken. # noqa: E501
:return: The token_last_eight of this AccessToken. # noqa: E501
:rtype: str
"""
return self._token_last_eight
@token_last_eight.setter
def token_last_eight(self, token_last_eight):
"""Sets the token_last_eight of this AccessToken.
:param token_last_eight: The token_last_eight of this AccessToken. # noqa: E501
:type: str
"""
self._token_last_eight = token_last_eight
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(AccessToken, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, AccessToken):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, AccessToken):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,123 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class AddCollaboratorOption(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'permission': 'str'
}
attribute_map = {
'permission': 'permission'
}
def __init__(self, permission=None, _configuration=None): # noqa: E501
"""AddCollaboratorOption - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._permission = None
self.discriminator = None
if permission is not None:
self.permission = permission
@property
def permission(self):
"""Gets the permission of this AddCollaboratorOption. # noqa: E501
:return: The permission of this AddCollaboratorOption. # noqa: E501
:rtype: str
"""
return self._permission
@permission.setter
def permission(self, permission):
"""Sets the permission of this AddCollaboratorOption.
:param permission: The permission of this AddCollaboratorOption. # noqa: E501
:type: str
"""
self._permission = permission
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(AddCollaboratorOption, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, AddCollaboratorOption):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, AddCollaboratorOption):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,180 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class AddTimeOption(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'created': 'datetime',
'time': 'int',
'user_name': 'str'
}
attribute_map = {
'created': 'created',
'time': 'time',
'user_name': 'user_name'
}
def __init__(self, created=None, time=None, user_name=None, _configuration=None): # noqa: E501
"""AddTimeOption - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._created = None
self._time = None
self._user_name = None
self.discriminator = None
if created is not None:
self.created = created
self.time = time
if user_name is not None:
self.user_name = user_name
@property
def created(self):
"""Gets the created of this AddTimeOption. # noqa: E501
:return: The created of this AddTimeOption. # noqa: E501
:rtype: datetime
"""
return self._created
@created.setter
def created(self, created):
"""Sets the created of this AddTimeOption.
:param created: The created of this AddTimeOption. # noqa: E501
:type: datetime
"""
self._created = created
@property
def time(self):
"""Gets the time of this AddTimeOption. # noqa: E501
time in seconds # noqa: E501
:return: The time of this AddTimeOption. # noqa: E501
:rtype: int
"""
return self._time
@time.setter
def time(self, time):
"""Sets the time of this AddTimeOption.
time in seconds # noqa: E501
:param time: The time of this AddTimeOption. # noqa: E501
:type: int
"""
if self._configuration.client_side_validation and time is None:
raise ValueError("Invalid value for `time`, must not be `None`") # noqa: E501
self._time = time
@property
def user_name(self):
"""Gets the user_name of this AddTimeOption. # noqa: E501
User who spent the time (optional) # noqa: E501
:return: The user_name of this AddTimeOption. # noqa: E501
:rtype: str
"""
return self._user_name
@user_name.setter
def user_name(self, user_name):
"""Sets the user_name of this AddTimeOption.
User who spent the time (optional) # noqa: E501
:param user_name: The user_name of this AddTimeOption. # noqa: E501
:type: str
"""
self._user_name = user_name
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(AddTimeOption, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, AddTimeOption):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, AddTimeOption):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,279 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class AnnotatedTag(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'message': 'str',
'object': 'AnnotatedTagObject',
'sha': 'str',
'tag': 'str',
'tagger': 'CommitUser',
'url': 'str',
'verification': 'PayloadCommitVerification'
}
attribute_map = {
'message': 'message',
'object': 'object',
'sha': 'sha',
'tag': 'tag',
'tagger': 'tagger',
'url': 'url',
'verification': 'verification'
}
def __init__(self, message=None, object=None, sha=None, tag=None, tagger=None, url=None, verification=None, _configuration=None): # noqa: E501
"""AnnotatedTag - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._message = None
self._object = None
self._sha = None
self._tag = None
self._tagger = None
self._url = None
self._verification = None
self.discriminator = None
if message is not None:
self.message = message
if object is not None:
self.object = object
if sha is not None:
self.sha = sha
if tag is not None:
self.tag = tag
if tagger is not None:
self.tagger = tagger
if url is not None:
self.url = url
if verification is not None:
self.verification = verification
@property
def message(self):
"""Gets the message of this AnnotatedTag. # noqa: E501
:return: The message of this AnnotatedTag. # noqa: E501
:rtype: str
"""
return self._message
@message.setter
def message(self, message):
"""Sets the message of this AnnotatedTag.
:param message: The message of this AnnotatedTag. # noqa: E501
:type: str
"""
self._message = message
@property
def object(self):
"""Gets the object of this AnnotatedTag. # noqa: E501
:return: The object of this AnnotatedTag. # noqa: E501
:rtype: AnnotatedTagObject
"""
return self._object
@object.setter
def object(self, object):
"""Sets the object of this AnnotatedTag.
:param object: The object of this AnnotatedTag. # noqa: E501
:type: AnnotatedTagObject
"""
self._object = object
@property
def sha(self):
"""Gets the sha of this AnnotatedTag. # noqa: E501
:return: The sha of this AnnotatedTag. # noqa: E501
:rtype: str
"""
return self._sha
@sha.setter
def sha(self, sha):
"""Sets the sha of this AnnotatedTag.
:param sha: The sha of this AnnotatedTag. # noqa: E501
:type: str
"""
self._sha = sha
@property
def tag(self):
"""Gets the tag of this AnnotatedTag. # noqa: E501
:return: The tag of this AnnotatedTag. # noqa: E501
:rtype: str
"""
return self._tag
@tag.setter
def tag(self, tag):
"""Sets the tag of this AnnotatedTag.
:param tag: The tag of this AnnotatedTag. # noqa: E501
:type: str
"""
self._tag = tag
@property
def tagger(self):
"""Gets the tagger of this AnnotatedTag. # noqa: E501
:return: The tagger of this AnnotatedTag. # noqa: E501
:rtype: CommitUser
"""
return self._tagger
@tagger.setter
def tagger(self, tagger):
"""Sets the tagger of this AnnotatedTag.
:param tagger: The tagger of this AnnotatedTag. # noqa: E501
:type: CommitUser
"""
self._tagger = tagger
@property
def url(self):
"""Gets the url of this AnnotatedTag. # noqa: E501
:return: The url of this AnnotatedTag. # noqa: E501
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this AnnotatedTag.
:param url: The url of this AnnotatedTag. # noqa: E501
:type: str
"""
self._url = url
@property
def verification(self):
"""Gets the verification of this AnnotatedTag. # noqa: E501
:return: The verification of this AnnotatedTag. # noqa: E501
:rtype: PayloadCommitVerification
"""
return self._verification
@verification.setter
def verification(self, verification):
"""Sets the verification of this AnnotatedTag.
:param verification: The verification of this AnnotatedTag. # noqa: E501
:type: PayloadCommitVerification
"""
self._verification = verification
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(AnnotatedTag, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, AnnotatedTag):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, AnnotatedTag):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,175 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class AnnotatedTagObject(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'sha': 'str',
'type': 'str',
'url': 'str'
}
attribute_map = {
'sha': 'sha',
'type': 'type',
'url': 'url'
}
def __init__(self, sha=None, type=None, url=None, _configuration=None): # noqa: E501
"""AnnotatedTagObject - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._sha = None
self._type = None
self._url = None
self.discriminator = None
if sha is not None:
self.sha = sha
if type is not None:
self.type = type
if url is not None:
self.url = url
@property
def sha(self):
"""Gets the sha of this AnnotatedTagObject. # noqa: E501
:return: The sha of this AnnotatedTagObject. # noqa: E501
:rtype: str
"""
return self._sha
@sha.setter
def sha(self, sha):
"""Sets the sha of this AnnotatedTagObject.
:param sha: The sha of this AnnotatedTagObject. # noqa: E501
:type: str
"""
self._sha = sha
@property
def type(self):
"""Gets the type of this AnnotatedTagObject. # noqa: E501
:return: The type of this AnnotatedTagObject. # noqa: E501
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this AnnotatedTagObject.
:param type: The type of this AnnotatedTagObject. # noqa: E501
:type: str
"""
self._type = type
@property
def url(self):
"""Gets the url of this AnnotatedTagObject. # noqa: E501
:return: The url of this AnnotatedTagObject. # noqa: E501
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this AnnotatedTagObject.
:param url: The url of this AnnotatedTagObject. # noqa: E501
:type: str
"""
self._url = url
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(AnnotatedTagObject, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, AnnotatedTagObject):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, AnnotatedTagObject):
return True
return self.to_dict() != other.to_dict()

149
gitea/models/api_error.py Normal file
View file

@ -0,0 +1,149 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class APIError(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'message': 'str',
'url': 'str'
}
attribute_map = {
'message': 'message',
'url': 'url'
}
def __init__(self, message=None, url=None, _configuration=None): # noqa: E501
"""APIError - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._message = None
self._url = None
self.discriminator = None
if message is not None:
self.message = message
if url is not None:
self.url = url
@property
def message(self):
"""Gets the message of this APIError. # noqa: E501
:return: The message of this APIError. # noqa: E501
:rtype: str
"""
return self._message
@message.setter
def message(self, message):
"""Sets the message of this APIError.
:param message: The message of this APIError. # noqa: E501
:type: str
"""
self._message = message
@property
def url(self):
"""Gets the url of this APIError. # noqa: E501
:return: The url of this APIError. # noqa: E501
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this APIError.
:param url: The url of this APIError. # noqa: E501
:type: str
"""
self._url = url
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(APIError, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, APIError):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, APIError):
return True
return self.to_dict() != other.to_dict()

279
gitea/models/attachment.py Normal file
View file

@ -0,0 +1,279 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class Attachment(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'browser_download_url': 'str',
'created_at': 'datetime',
'download_count': 'int',
'id': 'int',
'name': 'str',
'size': 'int',
'uuid': 'str'
}
attribute_map = {
'browser_download_url': 'browser_download_url',
'created_at': 'created_at',
'download_count': 'download_count',
'id': 'id',
'name': 'name',
'size': 'size',
'uuid': 'uuid'
}
def __init__(self, browser_download_url=None, created_at=None, download_count=None, id=None, name=None, size=None, uuid=None, _configuration=None): # noqa: E501
"""Attachment - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._browser_download_url = None
self._created_at = None
self._download_count = None
self._id = None
self._name = None
self._size = None
self._uuid = None
self.discriminator = None
if browser_download_url is not None:
self.browser_download_url = browser_download_url
if created_at is not None:
self.created_at = created_at
if download_count is not None:
self.download_count = download_count
if id is not None:
self.id = id
if name is not None:
self.name = name
if size is not None:
self.size = size
if uuid is not None:
self.uuid = uuid
@property
def browser_download_url(self):
"""Gets the browser_download_url of this Attachment. # noqa: E501
:return: The browser_download_url of this Attachment. # noqa: E501
:rtype: str
"""
return self._browser_download_url
@browser_download_url.setter
def browser_download_url(self, browser_download_url):
"""Sets the browser_download_url of this Attachment.
:param browser_download_url: The browser_download_url of this Attachment. # noqa: E501
:type: str
"""
self._browser_download_url = browser_download_url
@property
def created_at(self):
"""Gets the created_at of this Attachment. # noqa: E501
:return: The created_at of this Attachment. # noqa: E501
:rtype: datetime
"""
return self._created_at
@created_at.setter
def created_at(self, created_at):
"""Sets the created_at of this Attachment.
:param created_at: The created_at of this Attachment. # noqa: E501
:type: datetime
"""
self._created_at = created_at
@property
def download_count(self):
"""Gets the download_count of this Attachment. # noqa: E501
:return: The download_count of this Attachment. # noqa: E501
:rtype: int
"""
return self._download_count
@download_count.setter
def download_count(self, download_count):
"""Sets the download_count of this Attachment.
:param download_count: The download_count of this Attachment. # noqa: E501
:type: int
"""
self._download_count = download_count
@property
def id(self):
"""Gets the id of this Attachment. # noqa: E501
:return: The id of this Attachment. # noqa: E501
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this Attachment.
:param id: The id of this Attachment. # noqa: E501
:type: int
"""
self._id = id
@property
def name(self):
"""Gets the name of this Attachment. # noqa: E501
:return: The name of this Attachment. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this Attachment.
:param name: The name of this Attachment. # noqa: E501
:type: str
"""
self._name = name
@property
def size(self):
"""Gets the size of this Attachment. # noqa: E501
:return: The size of this Attachment. # noqa: E501
:rtype: int
"""
return self._size
@size.setter
def size(self, size):
"""Sets the size of this Attachment.
:param size: The size of this Attachment. # noqa: E501
:type: int
"""
self._size = size
@property
def uuid(self):
"""Gets the uuid of this Attachment. # noqa: E501
:return: The uuid of this Attachment. # noqa: E501
:rtype: str
"""
return self._uuid
@uuid.setter
def uuid(self, uuid):
"""Sets the uuid of this Attachment.
:param uuid: The uuid of this Attachment. # noqa: E501
:type: str
"""
self._uuid = uuid
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(Attachment, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Attachment):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Attachment):
return True
return self.to_dict() != other.to_dict()

331
gitea/models/branch.py Normal file
View file

@ -0,0 +1,331 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class Branch(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'commit': 'PayloadCommit',
'effective_branch_protection_name': 'str',
'enable_status_check': 'bool',
'name': 'str',
'protected': 'bool',
'required_approvals': 'int',
'status_check_contexts': 'list[str]',
'user_can_merge': 'bool',
'user_can_push': 'bool'
}
attribute_map = {
'commit': 'commit',
'effective_branch_protection_name': 'effective_branch_protection_name',
'enable_status_check': 'enable_status_check',
'name': 'name',
'protected': 'protected',
'required_approvals': 'required_approvals',
'status_check_contexts': 'status_check_contexts',
'user_can_merge': 'user_can_merge',
'user_can_push': 'user_can_push'
}
def __init__(self, commit=None, effective_branch_protection_name=None, enable_status_check=None, name=None, protected=None, required_approvals=None, status_check_contexts=None, user_can_merge=None, user_can_push=None, _configuration=None): # noqa: E501
"""Branch - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._commit = None
self._effective_branch_protection_name = None
self._enable_status_check = None
self._name = None
self._protected = None
self._required_approvals = None
self._status_check_contexts = None
self._user_can_merge = None
self._user_can_push = None
self.discriminator = None
if commit is not None:
self.commit = commit
if effective_branch_protection_name is not None:
self.effective_branch_protection_name = effective_branch_protection_name
if enable_status_check is not None:
self.enable_status_check = enable_status_check
if name is not None:
self.name = name
if protected is not None:
self.protected = protected
if required_approvals is not None:
self.required_approvals = required_approvals
if status_check_contexts is not None:
self.status_check_contexts = status_check_contexts
if user_can_merge is not None:
self.user_can_merge = user_can_merge
if user_can_push is not None:
self.user_can_push = user_can_push
@property
def commit(self):
"""Gets the commit of this Branch. # noqa: E501
:return: The commit of this Branch. # noqa: E501
:rtype: PayloadCommit
"""
return self._commit
@commit.setter
def commit(self, commit):
"""Sets the commit of this Branch.
:param commit: The commit of this Branch. # noqa: E501
:type: PayloadCommit
"""
self._commit = commit
@property
def effective_branch_protection_name(self):
"""Gets the effective_branch_protection_name of this Branch. # noqa: E501
:return: The effective_branch_protection_name of this Branch. # noqa: E501
:rtype: str
"""
return self._effective_branch_protection_name
@effective_branch_protection_name.setter
def effective_branch_protection_name(self, effective_branch_protection_name):
"""Sets the effective_branch_protection_name of this Branch.
:param effective_branch_protection_name: The effective_branch_protection_name of this Branch. # noqa: E501
:type: str
"""
self._effective_branch_protection_name = effective_branch_protection_name
@property
def enable_status_check(self):
"""Gets the enable_status_check of this Branch. # noqa: E501
:return: The enable_status_check of this Branch. # noqa: E501
:rtype: bool
"""
return self._enable_status_check
@enable_status_check.setter
def enable_status_check(self, enable_status_check):
"""Sets the enable_status_check of this Branch.
:param enable_status_check: The enable_status_check of this Branch. # noqa: E501
:type: bool
"""
self._enable_status_check = enable_status_check
@property
def name(self):
"""Gets the name of this Branch. # noqa: E501
:return: The name of this Branch. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this Branch.
:param name: The name of this Branch. # noqa: E501
:type: str
"""
self._name = name
@property
def protected(self):
"""Gets the protected of this Branch. # noqa: E501
:return: The protected of this Branch. # noqa: E501
:rtype: bool
"""
return self._protected
@protected.setter
def protected(self, protected):
"""Sets the protected of this Branch.
:param protected: The protected of this Branch. # noqa: E501
:type: bool
"""
self._protected = protected
@property
def required_approvals(self):
"""Gets the required_approvals of this Branch. # noqa: E501
:return: The required_approvals of this Branch. # noqa: E501
:rtype: int
"""
return self._required_approvals
@required_approvals.setter
def required_approvals(self, required_approvals):
"""Sets the required_approvals of this Branch.
:param required_approvals: The required_approvals of this Branch. # noqa: E501
:type: int
"""
self._required_approvals = required_approvals
@property
def status_check_contexts(self):
"""Gets the status_check_contexts of this Branch. # noqa: E501
:return: The status_check_contexts of this Branch. # noqa: E501
:rtype: list[str]
"""
return self._status_check_contexts
@status_check_contexts.setter
def status_check_contexts(self, status_check_contexts):
"""Sets the status_check_contexts of this Branch.
:param status_check_contexts: The status_check_contexts of this Branch. # noqa: E501
:type: list[str]
"""
self._status_check_contexts = status_check_contexts
@property
def user_can_merge(self):
"""Gets the user_can_merge of this Branch. # noqa: E501
:return: The user_can_merge of this Branch. # noqa: E501
:rtype: bool
"""
return self._user_can_merge
@user_can_merge.setter
def user_can_merge(self, user_can_merge):
"""Sets the user_can_merge of this Branch.
:param user_can_merge: The user_can_merge of this Branch. # noqa: E501
:type: bool
"""
self._user_can_merge = user_can_merge
@property
def user_can_push(self):
"""Gets the user_can_push of this Branch. # noqa: E501
:return: The user_can_push of this Branch. # noqa: E501
:rtype: bool
"""
return self._user_can_push
@user_can_push.setter
def user_can_push(self, user_can_push):
"""Sets the user_can_push of this Branch.
:param user_can_push: The user_can_push of this Branch. # noqa: E501
:type: bool
"""
self._user_can_push = user_can_push
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(Branch, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Branch):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Branch):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,721 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class BranchProtection(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'approvals_whitelist_teams': 'list[str]',
'approvals_whitelist_username': 'list[str]',
'block_on_official_review_requests': 'bool',
'block_on_outdated_branch': 'bool',
'block_on_rejected_reviews': 'bool',
'branch_name': 'str',
'created_at': 'datetime',
'dismiss_stale_approvals': 'bool',
'enable_approvals_whitelist': 'bool',
'enable_merge_whitelist': 'bool',
'enable_push': 'bool',
'enable_push_whitelist': 'bool',
'enable_status_check': 'bool',
'merge_whitelist_teams': 'list[str]',
'merge_whitelist_usernames': 'list[str]',
'protected_file_patterns': 'str',
'push_whitelist_deploy_keys': 'bool',
'push_whitelist_teams': 'list[str]',
'push_whitelist_usernames': 'list[str]',
'require_signed_commits': 'bool',
'required_approvals': 'int',
'status_check_contexts': 'list[str]',
'unprotected_file_patterns': 'str',
'updated_at': 'datetime'
}
attribute_map = {
'approvals_whitelist_teams': 'approvals_whitelist_teams',
'approvals_whitelist_username': 'approvals_whitelist_username',
'block_on_official_review_requests': 'block_on_official_review_requests',
'block_on_outdated_branch': 'block_on_outdated_branch',
'block_on_rejected_reviews': 'block_on_rejected_reviews',
'branch_name': 'branch_name',
'created_at': 'created_at',
'dismiss_stale_approvals': 'dismiss_stale_approvals',
'enable_approvals_whitelist': 'enable_approvals_whitelist',
'enable_merge_whitelist': 'enable_merge_whitelist',
'enable_push': 'enable_push',
'enable_push_whitelist': 'enable_push_whitelist',
'enable_status_check': 'enable_status_check',
'merge_whitelist_teams': 'merge_whitelist_teams',
'merge_whitelist_usernames': 'merge_whitelist_usernames',
'protected_file_patterns': 'protected_file_patterns',
'push_whitelist_deploy_keys': 'push_whitelist_deploy_keys',
'push_whitelist_teams': 'push_whitelist_teams',
'push_whitelist_usernames': 'push_whitelist_usernames',
'require_signed_commits': 'require_signed_commits',
'required_approvals': 'required_approvals',
'status_check_contexts': 'status_check_contexts',
'unprotected_file_patterns': 'unprotected_file_patterns',
'updated_at': 'updated_at'
}
def __init__(self, approvals_whitelist_teams=None, approvals_whitelist_username=None, block_on_official_review_requests=None, block_on_outdated_branch=None, block_on_rejected_reviews=None, branch_name=None, created_at=None, dismiss_stale_approvals=None, enable_approvals_whitelist=None, enable_merge_whitelist=None, enable_push=None, enable_push_whitelist=None, enable_status_check=None, merge_whitelist_teams=None, merge_whitelist_usernames=None, protected_file_patterns=None, push_whitelist_deploy_keys=None, push_whitelist_teams=None, push_whitelist_usernames=None, require_signed_commits=None, required_approvals=None, status_check_contexts=None, unprotected_file_patterns=None, updated_at=None, _configuration=None): # noqa: E501
"""BranchProtection - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._approvals_whitelist_teams = None
self._approvals_whitelist_username = None
self._block_on_official_review_requests = None
self._block_on_outdated_branch = None
self._block_on_rejected_reviews = None
self._branch_name = None
self._created_at = None
self._dismiss_stale_approvals = None
self._enable_approvals_whitelist = None
self._enable_merge_whitelist = None
self._enable_push = None
self._enable_push_whitelist = None
self._enable_status_check = None
self._merge_whitelist_teams = None
self._merge_whitelist_usernames = None
self._protected_file_patterns = None
self._push_whitelist_deploy_keys = None
self._push_whitelist_teams = None
self._push_whitelist_usernames = None
self._require_signed_commits = None
self._required_approvals = None
self._status_check_contexts = None
self._unprotected_file_patterns = None
self._updated_at = None
self.discriminator = None
if approvals_whitelist_teams is not None:
self.approvals_whitelist_teams = approvals_whitelist_teams
if approvals_whitelist_username is not None:
self.approvals_whitelist_username = approvals_whitelist_username
if block_on_official_review_requests is not None:
self.block_on_official_review_requests = block_on_official_review_requests
if block_on_outdated_branch is not None:
self.block_on_outdated_branch = block_on_outdated_branch
if block_on_rejected_reviews is not None:
self.block_on_rejected_reviews = block_on_rejected_reviews
if branch_name is not None:
self.branch_name = branch_name
if created_at is not None:
self.created_at = created_at
if dismiss_stale_approvals is not None:
self.dismiss_stale_approvals = dismiss_stale_approvals
if enable_approvals_whitelist is not None:
self.enable_approvals_whitelist = enable_approvals_whitelist
if enable_merge_whitelist is not None:
self.enable_merge_whitelist = enable_merge_whitelist
if enable_push is not None:
self.enable_push = enable_push
if enable_push_whitelist is not None:
self.enable_push_whitelist = enable_push_whitelist
if enable_status_check is not None:
self.enable_status_check = enable_status_check
if merge_whitelist_teams is not None:
self.merge_whitelist_teams = merge_whitelist_teams
if merge_whitelist_usernames is not None:
self.merge_whitelist_usernames = merge_whitelist_usernames
if protected_file_patterns is not None:
self.protected_file_patterns = protected_file_patterns
if push_whitelist_deploy_keys is not None:
self.push_whitelist_deploy_keys = push_whitelist_deploy_keys
if push_whitelist_teams is not None:
self.push_whitelist_teams = push_whitelist_teams
if push_whitelist_usernames is not None:
self.push_whitelist_usernames = push_whitelist_usernames
if require_signed_commits is not None:
self.require_signed_commits = require_signed_commits
if required_approvals is not None:
self.required_approvals = required_approvals
if status_check_contexts is not None:
self.status_check_contexts = status_check_contexts
if unprotected_file_patterns is not None:
self.unprotected_file_patterns = unprotected_file_patterns
if updated_at is not None:
self.updated_at = updated_at
@property
def approvals_whitelist_teams(self):
"""Gets the approvals_whitelist_teams of this BranchProtection. # noqa: E501
:return: The approvals_whitelist_teams of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._approvals_whitelist_teams
@approvals_whitelist_teams.setter
def approvals_whitelist_teams(self, approvals_whitelist_teams):
"""Sets the approvals_whitelist_teams of this BranchProtection.
:param approvals_whitelist_teams: The approvals_whitelist_teams of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._approvals_whitelist_teams = approvals_whitelist_teams
@property
def approvals_whitelist_username(self):
"""Gets the approvals_whitelist_username of this BranchProtection. # noqa: E501
:return: The approvals_whitelist_username of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._approvals_whitelist_username
@approvals_whitelist_username.setter
def approvals_whitelist_username(self, approvals_whitelist_username):
"""Sets the approvals_whitelist_username of this BranchProtection.
:param approvals_whitelist_username: The approvals_whitelist_username of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._approvals_whitelist_username = approvals_whitelist_username
@property
def block_on_official_review_requests(self):
"""Gets the block_on_official_review_requests of this BranchProtection. # noqa: E501
:return: The block_on_official_review_requests of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._block_on_official_review_requests
@block_on_official_review_requests.setter
def block_on_official_review_requests(self, block_on_official_review_requests):
"""Sets the block_on_official_review_requests of this BranchProtection.
:param block_on_official_review_requests: The block_on_official_review_requests of this BranchProtection. # noqa: E501
:type: bool
"""
self._block_on_official_review_requests = block_on_official_review_requests
@property
def block_on_outdated_branch(self):
"""Gets the block_on_outdated_branch of this BranchProtection. # noqa: E501
:return: The block_on_outdated_branch of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._block_on_outdated_branch
@block_on_outdated_branch.setter
def block_on_outdated_branch(self, block_on_outdated_branch):
"""Sets the block_on_outdated_branch of this BranchProtection.
:param block_on_outdated_branch: The block_on_outdated_branch of this BranchProtection. # noqa: E501
:type: bool
"""
self._block_on_outdated_branch = block_on_outdated_branch
@property
def block_on_rejected_reviews(self):
"""Gets the block_on_rejected_reviews of this BranchProtection. # noqa: E501
:return: The block_on_rejected_reviews of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._block_on_rejected_reviews
@block_on_rejected_reviews.setter
def block_on_rejected_reviews(self, block_on_rejected_reviews):
"""Sets the block_on_rejected_reviews of this BranchProtection.
:param block_on_rejected_reviews: The block_on_rejected_reviews of this BranchProtection. # noqa: E501
:type: bool
"""
self._block_on_rejected_reviews = block_on_rejected_reviews
@property
def branch_name(self):
"""Gets the branch_name of this BranchProtection. # noqa: E501
:return: The branch_name of this BranchProtection. # noqa: E501
:rtype: str
"""
return self._branch_name
@branch_name.setter
def branch_name(self, branch_name):
"""Sets the branch_name of this BranchProtection.
:param branch_name: The branch_name of this BranchProtection. # noqa: E501
:type: str
"""
self._branch_name = branch_name
@property
def created_at(self):
"""Gets the created_at of this BranchProtection. # noqa: E501
:return: The created_at of this BranchProtection. # noqa: E501
:rtype: datetime
"""
return self._created_at
@created_at.setter
def created_at(self, created_at):
"""Sets the created_at of this BranchProtection.
:param created_at: The created_at of this BranchProtection. # noqa: E501
:type: datetime
"""
self._created_at = created_at
@property
def dismiss_stale_approvals(self):
"""Gets the dismiss_stale_approvals of this BranchProtection. # noqa: E501
:return: The dismiss_stale_approvals of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._dismiss_stale_approvals
@dismiss_stale_approvals.setter
def dismiss_stale_approvals(self, dismiss_stale_approvals):
"""Sets the dismiss_stale_approvals of this BranchProtection.
:param dismiss_stale_approvals: The dismiss_stale_approvals of this BranchProtection. # noqa: E501
:type: bool
"""
self._dismiss_stale_approvals = dismiss_stale_approvals
@property
def enable_approvals_whitelist(self):
"""Gets the enable_approvals_whitelist of this BranchProtection. # noqa: E501
:return: The enable_approvals_whitelist of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._enable_approvals_whitelist
@enable_approvals_whitelist.setter
def enable_approvals_whitelist(self, enable_approvals_whitelist):
"""Sets the enable_approvals_whitelist of this BranchProtection.
:param enable_approvals_whitelist: The enable_approvals_whitelist of this BranchProtection. # noqa: E501
:type: bool
"""
self._enable_approvals_whitelist = enable_approvals_whitelist
@property
def enable_merge_whitelist(self):
"""Gets the enable_merge_whitelist of this BranchProtection. # noqa: E501
:return: The enable_merge_whitelist of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._enable_merge_whitelist
@enable_merge_whitelist.setter
def enable_merge_whitelist(self, enable_merge_whitelist):
"""Sets the enable_merge_whitelist of this BranchProtection.
:param enable_merge_whitelist: The enable_merge_whitelist of this BranchProtection. # noqa: E501
:type: bool
"""
self._enable_merge_whitelist = enable_merge_whitelist
@property
def enable_push(self):
"""Gets the enable_push of this BranchProtection. # noqa: E501
:return: The enable_push of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._enable_push
@enable_push.setter
def enable_push(self, enable_push):
"""Sets the enable_push of this BranchProtection.
:param enable_push: The enable_push of this BranchProtection. # noqa: E501
:type: bool
"""
self._enable_push = enable_push
@property
def enable_push_whitelist(self):
"""Gets the enable_push_whitelist of this BranchProtection. # noqa: E501
:return: The enable_push_whitelist of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._enable_push_whitelist
@enable_push_whitelist.setter
def enable_push_whitelist(self, enable_push_whitelist):
"""Sets the enable_push_whitelist of this BranchProtection.
:param enable_push_whitelist: The enable_push_whitelist of this BranchProtection. # noqa: E501
:type: bool
"""
self._enable_push_whitelist = enable_push_whitelist
@property
def enable_status_check(self):
"""Gets the enable_status_check of this BranchProtection. # noqa: E501
:return: The enable_status_check of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._enable_status_check
@enable_status_check.setter
def enable_status_check(self, enable_status_check):
"""Sets the enable_status_check of this BranchProtection.
:param enable_status_check: The enable_status_check of this BranchProtection. # noqa: E501
:type: bool
"""
self._enable_status_check = enable_status_check
@property
def merge_whitelist_teams(self):
"""Gets the merge_whitelist_teams of this BranchProtection. # noqa: E501
:return: The merge_whitelist_teams of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._merge_whitelist_teams
@merge_whitelist_teams.setter
def merge_whitelist_teams(self, merge_whitelist_teams):
"""Sets the merge_whitelist_teams of this BranchProtection.
:param merge_whitelist_teams: The merge_whitelist_teams of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._merge_whitelist_teams = merge_whitelist_teams
@property
def merge_whitelist_usernames(self):
"""Gets the merge_whitelist_usernames of this BranchProtection. # noqa: E501
:return: The merge_whitelist_usernames of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._merge_whitelist_usernames
@merge_whitelist_usernames.setter
def merge_whitelist_usernames(self, merge_whitelist_usernames):
"""Sets the merge_whitelist_usernames of this BranchProtection.
:param merge_whitelist_usernames: The merge_whitelist_usernames of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._merge_whitelist_usernames = merge_whitelist_usernames
@property
def protected_file_patterns(self):
"""Gets the protected_file_patterns of this BranchProtection. # noqa: E501
:return: The protected_file_patterns of this BranchProtection. # noqa: E501
:rtype: str
"""
return self._protected_file_patterns
@protected_file_patterns.setter
def protected_file_patterns(self, protected_file_patterns):
"""Sets the protected_file_patterns of this BranchProtection.
:param protected_file_patterns: The protected_file_patterns of this BranchProtection. # noqa: E501
:type: str
"""
self._protected_file_patterns = protected_file_patterns
@property
def push_whitelist_deploy_keys(self):
"""Gets the push_whitelist_deploy_keys of this BranchProtection. # noqa: E501
:return: The push_whitelist_deploy_keys of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._push_whitelist_deploy_keys
@push_whitelist_deploy_keys.setter
def push_whitelist_deploy_keys(self, push_whitelist_deploy_keys):
"""Sets the push_whitelist_deploy_keys of this BranchProtection.
:param push_whitelist_deploy_keys: The push_whitelist_deploy_keys of this BranchProtection. # noqa: E501
:type: bool
"""
self._push_whitelist_deploy_keys = push_whitelist_deploy_keys
@property
def push_whitelist_teams(self):
"""Gets the push_whitelist_teams of this BranchProtection. # noqa: E501
:return: The push_whitelist_teams of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._push_whitelist_teams
@push_whitelist_teams.setter
def push_whitelist_teams(self, push_whitelist_teams):
"""Sets the push_whitelist_teams of this BranchProtection.
:param push_whitelist_teams: The push_whitelist_teams of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._push_whitelist_teams = push_whitelist_teams
@property
def push_whitelist_usernames(self):
"""Gets the push_whitelist_usernames of this BranchProtection. # noqa: E501
:return: The push_whitelist_usernames of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._push_whitelist_usernames
@push_whitelist_usernames.setter
def push_whitelist_usernames(self, push_whitelist_usernames):
"""Sets the push_whitelist_usernames of this BranchProtection.
:param push_whitelist_usernames: The push_whitelist_usernames of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._push_whitelist_usernames = push_whitelist_usernames
@property
def require_signed_commits(self):
"""Gets the require_signed_commits of this BranchProtection. # noqa: E501
:return: The require_signed_commits of this BranchProtection. # noqa: E501
:rtype: bool
"""
return self._require_signed_commits
@require_signed_commits.setter
def require_signed_commits(self, require_signed_commits):
"""Sets the require_signed_commits of this BranchProtection.
:param require_signed_commits: The require_signed_commits of this BranchProtection. # noqa: E501
:type: bool
"""
self._require_signed_commits = require_signed_commits
@property
def required_approvals(self):
"""Gets the required_approvals of this BranchProtection. # noqa: E501
:return: The required_approvals of this BranchProtection. # noqa: E501
:rtype: int
"""
return self._required_approvals
@required_approvals.setter
def required_approvals(self, required_approvals):
"""Sets the required_approvals of this BranchProtection.
:param required_approvals: The required_approvals of this BranchProtection. # noqa: E501
:type: int
"""
self._required_approvals = required_approvals
@property
def status_check_contexts(self):
"""Gets the status_check_contexts of this BranchProtection. # noqa: E501
:return: The status_check_contexts of this BranchProtection. # noqa: E501
:rtype: list[str]
"""
return self._status_check_contexts
@status_check_contexts.setter
def status_check_contexts(self, status_check_contexts):
"""Sets the status_check_contexts of this BranchProtection.
:param status_check_contexts: The status_check_contexts of this BranchProtection. # noqa: E501
:type: list[str]
"""
self._status_check_contexts = status_check_contexts
@property
def unprotected_file_patterns(self):
"""Gets the unprotected_file_patterns of this BranchProtection. # noqa: E501
:return: The unprotected_file_patterns of this BranchProtection. # noqa: E501
:rtype: str
"""
return self._unprotected_file_patterns
@unprotected_file_patterns.setter
def unprotected_file_patterns(self, unprotected_file_patterns):
"""Sets the unprotected_file_patterns of this BranchProtection.
:param unprotected_file_patterns: The unprotected_file_patterns of this BranchProtection. # noqa: E501
:type: str
"""
self._unprotected_file_patterns = unprotected_file_patterns
@property
def updated_at(self):
"""Gets the updated_at of this BranchProtection. # noqa: E501
:return: The updated_at of this BranchProtection. # noqa: E501
:rtype: datetime
"""
return self._updated_at
@updated_at.setter
def updated_at(self, updated_at):
"""Sets the updated_at of this BranchProtection.
:param updated_at: The updated_at of this BranchProtection. # noqa: E501
:type: datetime
"""
self._updated_at = updated_at
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(BranchProtection, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, BranchProtection):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, BranchProtection):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,279 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class CombinedStatus(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'commit_url': 'str',
'repository': 'Repository',
'sha': 'str',
'state': 'CommitStatusState',
'statuses': 'list[CommitStatus]',
'total_count': 'int',
'url': 'str'
}
attribute_map = {
'commit_url': 'commit_url',
'repository': 'repository',
'sha': 'sha',
'state': 'state',
'statuses': 'statuses',
'total_count': 'total_count',
'url': 'url'
}
def __init__(self, commit_url=None, repository=None, sha=None, state=None, statuses=None, total_count=None, url=None, _configuration=None): # noqa: E501
"""CombinedStatus - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._commit_url = None
self._repository = None
self._sha = None
self._state = None
self._statuses = None
self._total_count = None
self._url = None
self.discriminator = None
if commit_url is not None:
self.commit_url = commit_url
if repository is not None:
self.repository = repository
if sha is not None:
self.sha = sha
if state is not None:
self.state = state
if statuses is not None:
self.statuses = statuses
if total_count is not None:
self.total_count = total_count
if url is not None:
self.url = url
@property
def commit_url(self):
"""Gets the commit_url of this CombinedStatus. # noqa: E501
:return: The commit_url of this CombinedStatus. # noqa: E501
:rtype: str
"""
return self._commit_url
@commit_url.setter
def commit_url(self, commit_url):
"""Sets the commit_url of this CombinedStatus.
:param commit_url: The commit_url of this CombinedStatus. # noqa: E501
:type: str
"""
self._commit_url = commit_url
@property
def repository(self):
"""Gets the repository of this CombinedStatus. # noqa: E501
:return: The repository of this CombinedStatus. # noqa: E501
:rtype: Repository
"""
return self._repository
@repository.setter
def repository(self, repository):
"""Sets the repository of this CombinedStatus.
:param repository: The repository of this CombinedStatus. # noqa: E501
:type: Repository
"""
self._repository = repository
@property
def sha(self):
"""Gets the sha of this CombinedStatus. # noqa: E501
:return: The sha of this CombinedStatus. # noqa: E501
:rtype: str
"""
return self._sha
@sha.setter
def sha(self, sha):
"""Sets the sha of this CombinedStatus.
:param sha: The sha of this CombinedStatus. # noqa: E501
:type: str
"""
self._sha = sha
@property
def state(self):
"""Gets the state of this CombinedStatus. # noqa: E501
:return: The state of this CombinedStatus. # noqa: E501
:rtype: CommitStatusState
"""
return self._state
@state.setter
def state(self, state):
"""Sets the state of this CombinedStatus.
:param state: The state of this CombinedStatus. # noqa: E501
:type: CommitStatusState
"""
self._state = state
@property
def statuses(self):
"""Gets the statuses of this CombinedStatus. # noqa: E501
:return: The statuses of this CombinedStatus. # noqa: E501
:rtype: list[CommitStatus]
"""
return self._statuses
@statuses.setter
def statuses(self, statuses):
"""Sets the statuses of this CombinedStatus.
:param statuses: The statuses of this CombinedStatus. # noqa: E501
:type: list[CommitStatus]
"""
self._statuses = statuses
@property
def total_count(self):
"""Gets the total_count of this CombinedStatus. # noqa: E501
:return: The total_count of this CombinedStatus. # noqa: E501
:rtype: int
"""
return self._total_count
@total_count.setter
def total_count(self, total_count):
"""Sets the total_count of this CombinedStatus.
:param total_count: The total_count of this CombinedStatus. # noqa: E501
:type: int
"""
self._total_count = total_count
@property
def url(self):
"""Gets the url of this CombinedStatus. # noqa: E501
:return: The url of this CombinedStatus. # noqa: E501
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this CombinedStatus.
:param url: The url of this CombinedStatus. # noqa: E501
:type: str
"""
self._url = url
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(CombinedStatus, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, CombinedStatus):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, CombinedStatus):
return True
return self.to_dict() != other.to_dict()

357
gitea/models/comment.py Normal file
View file

@ -0,0 +1,357 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class Comment(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'body': 'str',
'created_at': 'datetime',
'html_url': 'str',
'id': 'int',
'issue_url': 'str',
'original_author': 'str',
'original_author_id': 'int',
'pull_request_url': 'str',
'updated_at': 'datetime',
'user': 'User'
}
attribute_map = {
'body': 'body',
'created_at': 'created_at',
'html_url': 'html_url',
'id': 'id',
'issue_url': 'issue_url',
'original_author': 'original_author',
'original_author_id': 'original_author_id',
'pull_request_url': 'pull_request_url',
'updated_at': 'updated_at',
'user': 'user'
}
def __init__(self, body=None, created_at=None, html_url=None, id=None, issue_url=None, original_author=None, original_author_id=None, pull_request_url=None, updated_at=None, user=None, _configuration=None): # noqa: E501
"""Comment - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._body = None
self._created_at = None
self._html_url = None
self._id = None
self._issue_url = None
self._original_author = None
self._original_author_id = None
self._pull_request_url = None
self._updated_at = None
self._user = None
self.discriminator = None
if body is not None:
self.body = body
if created_at is not None:
self.created_at = created_at
if html_url is not None:
self.html_url = html_url
if id is not None:
self.id = id
if issue_url is not None:
self.issue_url = issue_url
if original_author is not None:
self.original_author = original_author
if original_author_id is not None:
self.original_author_id = original_author_id
if pull_request_url is not None:
self.pull_request_url = pull_request_url
if updated_at is not None:
self.updated_at = updated_at
if user is not None:
self.user = user
@property
def body(self):
"""Gets the body of this Comment. # noqa: E501
:return: The body of this Comment. # noqa: E501
:rtype: str
"""
return self._body
@body.setter
def body(self, body):
"""Sets the body of this Comment.
:param body: The body of this Comment. # noqa: E501
:type: str
"""
self._body = body
@property
def created_at(self):
"""Gets the created_at of this Comment. # noqa: E501
:return: The created_at of this Comment. # noqa: E501
:rtype: datetime
"""
return self._created_at
@created_at.setter
def created_at(self, created_at):
"""Sets the created_at of this Comment.
:param created_at: The created_at of this Comment. # noqa: E501
:type: datetime
"""
self._created_at = created_at
@property
def html_url(self):
"""Gets the html_url of this Comment. # noqa: E501
:return: The html_url of this Comment. # noqa: E501
:rtype: str
"""
return self._html_url
@html_url.setter
def html_url(self, html_url):
"""Sets the html_url of this Comment.
:param html_url: The html_url of this Comment. # noqa: E501
:type: str
"""
self._html_url = html_url
@property
def id(self):
"""Gets the id of this Comment. # noqa: E501
:return: The id of this Comment. # noqa: E501
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this Comment.
:param id: The id of this Comment. # noqa: E501
:type: int
"""
self._id = id
@property
def issue_url(self):
"""Gets the issue_url of this Comment. # noqa: E501
:return: The issue_url of this Comment. # noqa: E501
:rtype: str
"""
return self._issue_url
@issue_url.setter
def issue_url(self, issue_url):
"""Sets the issue_url of this Comment.
:param issue_url: The issue_url of this Comment. # noqa: E501
:type: str
"""
self._issue_url = issue_url
@property
def original_author(self):
"""Gets the original_author of this Comment. # noqa: E501
:return: The original_author of this Comment. # noqa: E501
:rtype: str
"""
return self._original_author
@original_author.setter
def original_author(self, original_author):
"""Sets the original_author of this Comment.
:param original_author: The original_author of this Comment. # noqa: E501
:type: str
"""
self._original_author = original_author
@property
def original_author_id(self):
"""Gets the original_author_id of this Comment. # noqa: E501
:return: The original_author_id of this Comment. # noqa: E501
:rtype: int
"""
return self._original_author_id
@original_author_id.setter
def original_author_id(self, original_author_id):
"""Sets the original_author_id of this Comment.
:param original_author_id: The original_author_id of this Comment. # noqa: E501
:type: int
"""
self._original_author_id = original_author_id
@property
def pull_request_url(self):
"""Gets the pull_request_url of this Comment. # noqa: E501
:return: The pull_request_url of this Comment. # noqa: E501
:rtype: str
"""
return self._pull_request_url
@pull_request_url.setter
def pull_request_url(self, pull_request_url):
"""Sets the pull_request_url of this Comment.
:param pull_request_url: The pull_request_url of this Comment. # noqa: E501
:type: str
"""
self._pull_request_url = pull_request_url
@property
def updated_at(self):
"""Gets the updated_at of this Comment. # noqa: E501
:return: The updated_at of this Comment. # noqa: E501
:rtype: datetime
"""
return self._updated_at
@updated_at.setter
def updated_at(self, updated_at):
"""Sets the updated_at of this Comment.
:param updated_at: The updated_at of this Comment. # noqa: E501
:type: datetime
"""
self._updated_at = updated_at
@property
def user(self):
"""Gets the user of this Comment. # noqa: E501
:return: The user of this Comment. # noqa: E501
:rtype: User
"""
return self._user
@user.setter
def user(self, user):
"""Sets the user of this Comment.
:param user: The user of this Comment. # noqa: E501
:type: User
"""
self._user = user
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(Comment, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Comment):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Comment):
return True
return self.to_dict() != other.to_dict()

357
gitea/models/commit.py Normal file
View file

@ -0,0 +1,357 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class Commit(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'author': 'User',
'commit': 'RepoCommit',
'committer': 'User',
'created': 'datetime',
'files': 'list[CommitAffectedFiles]',
'html_url': 'str',
'parents': 'list[CommitMeta]',
'sha': 'str',
'stats': 'CommitStats',
'url': 'str'
}
attribute_map = {
'author': 'author',
'commit': 'commit',
'committer': 'committer',
'created': 'created',
'files': 'files',
'html_url': 'html_url',
'parents': 'parents',
'sha': 'sha',
'stats': 'stats',
'url': 'url'
}
def __init__(self, author=None, commit=None, committer=None, created=None, files=None, html_url=None, parents=None, sha=None, stats=None, url=None, _configuration=None): # noqa: E501
"""Commit - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._author = None
self._commit = None
self._committer = None
self._created = None
self._files = None
self._html_url = None
self._parents = None
self._sha = None
self._stats = None
self._url = None
self.discriminator = None
if author is not None:
self.author = author
if commit is not None:
self.commit = commit
if committer is not None:
self.committer = committer
if created is not None:
self.created = created
if files is not None:
self.files = files
if html_url is not None:
self.html_url = html_url
if parents is not None:
self.parents = parents
if sha is not None:
self.sha = sha
if stats is not None:
self.stats = stats
if url is not None:
self.url = url
@property
def author(self):
"""Gets the author of this Commit. # noqa: E501
:return: The author of this Commit. # noqa: E501
:rtype: User
"""
return self._author
@author.setter
def author(self, author):
"""Sets the author of this Commit.
:param author: The author of this Commit. # noqa: E501
:type: User
"""
self._author = author
@property
def commit(self):
"""Gets the commit of this Commit. # noqa: E501
:return: The commit of this Commit. # noqa: E501
:rtype: RepoCommit
"""
return self._commit
@commit.setter
def commit(self, commit):
"""Sets the commit of this Commit.
:param commit: The commit of this Commit. # noqa: E501
:type: RepoCommit
"""
self._commit = commit
@property
def committer(self):
"""Gets the committer of this Commit. # noqa: E501
:return: The committer of this Commit. # noqa: E501
:rtype: User
"""
return self._committer
@committer.setter
def committer(self, committer):
"""Sets the committer of this Commit.
:param committer: The committer of this Commit. # noqa: E501
:type: User
"""
self._committer = committer
@property
def created(self):
"""Gets the created of this Commit. # noqa: E501
:return: The created of this Commit. # noqa: E501
:rtype: datetime
"""
return self._created
@created.setter
def created(self, created):
"""Sets the created of this Commit.
:param created: The created of this Commit. # noqa: E501
:type: datetime
"""
self._created = created
@property
def files(self):
"""Gets the files of this Commit. # noqa: E501
:return: The files of this Commit. # noqa: E501
:rtype: list[CommitAffectedFiles]
"""
return self._files
@files.setter
def files(self, files):
"""Sets the files of this Commit.
:param files: The files of this Commit. # noqa: E501
:type: list[CommitAffectedFiles]
"""
self._files = files
@property
def html_url(self):
"""Gets the html_url of this Commit. # noqa: E501
:return: The html_url of this Commit. # noqa: E501
:rtype: str
"""
return self._html_url
@html_url.setter
def html_url(self, html_url):
"""Sets the html_url of this Commit.
:param html_url: The html_url of this Commit. # noqa: E501
:type: str
"""
self._html_url = html_url
@property
def parents(self):
"""Gets the parents of this Commit. # noqa: E501
:return: The parents of this Commit. # noqa: E501
:rtype: list[CommitMeta]
"""
return self._parents
@parents.setter
def parents(self, parents):
"""Sets the parents of this Commit.
:param parents: The parents of this Commit. # noqa: E501
:type: list[CommitMeta]
"""
self._parents = parents
@property
def sha(self):
"""Gets the sha of this Commit. # noqa: E501
:return: The sha of this Commit. # noqa: E501
:rtype: str
"""
return self._sha
@sha.setter
def sha(self, sha):
"""Sets the sha of this Commit.
:param sha: The sha of this Commit. # noqa: E501
:type: str
"""
self._sha = sha
@property
def stats(self):
"""Gets the stats of this Commit. # noqa: E501
:return: The stats of this Commit. # noqa: E501
:rtype: CommitStats
"""
return self._stats
@stats.setter
def stats(self, stats):
"""Sets the stats of this Commit.
:param stats: The stats of this Commit. # noqa: E501
:type: CommitStats
"""
self._stats = stats
@property
def url(self):
"""Gets the url of this Commit. # noqa: E501
:return: The url of this Commit. # noqa: E501
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this Commit.
:param url: The url of this Commit. # noqa: E501
:type: str
"""
self._url = url
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(Commit, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, Commit):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, Commit):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,123 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class CommitAffectedFiles(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'filename': 'str'
}
attribute_map = {
'filename': 'filename'
}
def __init__(self, filename=None, _configuration=None): # noqa: E501
"""CommitAffectedFiles - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._filename = None
self.discriminator = None
if filename is not None:
self.filename = filename
@property
def filename(self):
"""Gets the filename of this CommitAffectedFiles. # noqa: E501
:return: The filename of this CommitAffectedFiles. # noqa: E501
:rtype: str
"""
return self._filename
@filename.setter
def filename(self, filename):
"""Sets the filename of this CommitAffectedFiles.
:param filename: The filename of this CommitAffectedFiles. # noqa: E501
:type: str
"""
self._filename = filename
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(CommitAffectedFiles, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, CommitAffectedFiles):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, CommitAffectedFiles):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,149 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class CommitDateOptions(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'author': 'datetime',
'committer': 'datetime'
}
attribute_map = {
'author': 'author',
'committer': 'committer'
}
def __init__(self, author=None, committer=None, _configuration=None): # noqa: E501
"""CommitDateOptions - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._author = None
self._committer = None
self.discriminator = None
if author is not None:
self.author = author
if committer is not None:
self.committer = committer
@property
def author(self):
"""Gets the author of this CommitDateOptions. # noqa: E501
:return: The author of this CommitDateOptions. # noqa: E501
:rtype: datetime
"""
return self._author
@author.setter
def author(self, author):
"""Sets the author of this CommitDateOptions.
:param author: The author of this CommitDateOptions. # noqa: E501
:type: datetime
"""
self._author = author
@property
def committer(self):
"""Gets the committer of this CommitDateOptions. # noqa: E501
:return: The committer of this CommitDateOptions. # noqa: E501
:rtype: datetime
"""
return self._committer
@committer.setter
def committer(self, committer):
"""Sets the committer of this CommitDateOptions.
:param committer: The committer of this CommitDateOptions. # noqa: E501
:type: datetime
"""
self._committer = committer
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(CommitDateOptions, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, CommitDateOptions):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, CommitDateOptions):
return True
return self.to_dict() != other.to_dict()

175
gitea/models/commit_meta.py Normal file
View file

@ -0,0 +1,175 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class CommitMeta(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'created': 'datetime',
'sha': 'str',
'url': 'str'
}
attribute_map = {
'created': 'created',
'sha': 'sha',
'url': 'url'
}
def __init__(self, created=None, sha=None, url=None, _configuration=None): # noqa: E501
"""CommitMeta - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._created = None
self._sha = None
self._url = None
self.discriminator = None
if created is not None:
self.created = created
if sha is not None:
self.sha = sha
if url is not None:
self.url = url
@property
def created(self):
"""Gets the created of this CommitMeta. # noqa: E501
:return: The created of this CommitMeta. # noqa: E501
:rtype: datetime
"""
return self._created
@created.setter
def created(self, created):
"""Sets the created of this CommitMeta.
:param created: The created of this CommitMeta. # noqa: E501
:type: datetime
"""
self._created = created
@property
def sha(self):
"""Gets the sha of this CommitMeta. # noqa: E501
:return: The sha of this CommitMeta. # noqa: E501
:rtype: str
"""
return self._sha
@sha.setter
def sha(self, sha):
"""Sets the sha of this CommitMeta.
:param sha: The sha of this CommitMeta. # noqa: E501
:type: str
"""
self._sha = sha
@property
def url(self):
"""Gets the url of this CommitMeta. # noqa: E501
:return: The url of this CommitMeta. # noqa: E501
:rtype: str
"""
return self._url
@url.setter
def url(self, url):
"""Sets the url of this CommitMeta.
:param url: The url of this CommitMeta. # noqa: E501
:type: str
"""
self._url = url
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(CommitMeta, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, CommitMeta):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, CommitMeta):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,175 @@
# coding: utf-8
"""
Gitea API.
This documentation describes the Gitea API. # noqa: E501
OpenAPI spec version: 1.17.0+rc1
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
from gitea.configuration import Configuration
class CommitStats(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Do not edit the class manually.
"""
"""
Attributes:
swagger_types (dict): The key is attribute name
and the value is attribute type.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
"""
swagger_types = {
'additions': 'int',
'deletions': 'int',
'total': 'int'
}
attribute_map = {
'additions': 'additions',
'deletions': 'deletions',
'total': 'total'
}
def __init__(self, additions=None, deletions=None, total=None, _configuration=None): # noqa: E501
"""CommitStats - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration
self._additions = None
self._deletions = None
self._total = None
self.discriminator = None
if additions is not None:
self.additions = additions
if deletions is not None:
self.deletions = deletions
if total is not None:
self.total = total
@property
def additions(self):
"""Gets the additions of this CommitStats. # noqa: E501
:return: The additions of this CommitStats. # noqa: E501
:rtype: int
"""
return self._additions
@additions.setter
def additions(self, additions):
"""Sets the additions of this CommitStats.
:param additions: The additions of this CommitStats. # noqa: E501
:type: int
"""
self._additions = additions
@property
def deletions(self):
"""Gets the deletions of this CommitStats. # noqa: E501
:return: The deletions of this CommitStats. # noqa: E501
:rtype: int
"""
return self._deletions
@deletions.setter
def deletions(self, deletions):
"""Sets the deletions of this CommitStats.
:param deletions: The deletions of this CommitStats. # noqa: E501
:type: int
"""
self._deletions = deletions
@property
def total(self):
"""Gets the total of this CommitStats. # noqa: E501
:return: The total of this CommitStats. # noqa: E501
:rtype: int
"""
return self._total
@total.setter
def total(self, total):
"""Sets the total of this CommitStats.
:param total: The total of this CommitStats. # noqa: E501
:type: int
"""
self._total = total
def to_dict(self):
"""Returns the model properties as a dict"""
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
else:
result[attr] = value
if issubclass(CommitStats, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
"""Returns the string representation of the model"""
return pprint.pformat(self.to_dict())
def __repr__(self):
"""For `print` and `pprint`"""
return self.to_str()
def __eq__(self, other):
"""Returns true if both objects are equal"""
if not isinstance(other, CommitStats):
return False
return self.to_dict() == other.to_dict()
def __ne__(self, other):
"""Returns true if both objects are not equal"""
if not isinstance(other, CommitStats):
return True
return self.to_dict() != other.to_dict()

View file

@ -0,0 +1,331 @@
# coding: utf-8
"""