Skip to content

Commit

Permalink
Merge pull request #21 from merge-api/add-create-attachments
Browse files Browse the repository at this point in the history
add create_attachment
  • Loading branch information
dan-merge authored Apr 21, 2021
2 parents 047f4be + ed47c16 commit bcd628e
Show file tree
Hide file tree
Showing 12 changed files with 482 additions and 17 deletions.
14 changes: 3 additions & 11 deletions .openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ MergeATSClient/model/activity_type_enum.py
MergeATSClient/model/application.py
MergeATSClient/model/application_request.py
MergeATSClient/model/attachment.py
MergeATSClient/model/attachment_request.py
MergeATSClient/model/available_actions.py
MergeATSClient/model/candidate.py
MergeATSClient/model/candidate_request.py
Expand Down Expand Up @@ -114,6 +115,7 @@ docs/Application.md
docs/ApplicationRequest.md
docs/ApplicationsApi.md
docs/Attachment.md
docs/AttachmentRequest.md
docs/AttachmentsApi.md
docs/AvailableActions.md
docs/AvailableActionsApi.md
Expand Down Expand Up @@ -199,15 +201,5 @@ setup.cfg
setup.py
test-requirements.txt
test/__init__.py
test/test_application_request.py
test/test_candidate_request.py
test/test_email_address_request.py
test/test_generate_key_api.py
test/test_generate_remote_key_request.py
test/test_patched_application_request.py
test/test_phone_number_request.py
test/test_remote_data_request.py
test/test_sync_status.py
test/test_sync_status_api.py
test/test_url_request.py
test/test_attachment_request.py
tox.ini
145 changes: 145 additions & 0 deletions MergeATSClient/api/attachments_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
validate_and_convert_types
)
from MergeATSClient.model.attachment import Attachment
from MergeATSClient.model.attachment_request import AttachmentRequest
from MergeATSClient.model.paginated_attachment_list import PaginatedAttachmentList


Expand All @@ -38,6 +39,150 @@ def __init__(self, api_client=None):
api_client = ApiClient()
self.api_client = api_client

def __attachments_create(
self,
x_account_token,
remote_user_id,
**kwargs
):
"""attachments_create # noqa: E501
Creates an `Attachment` object with the given values. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.attachments_create(x_account_token, remote_user_id, async_req=True)
>>> result = thread.get()
Args:
x_account_token (str): Token identifying the end user.
remote_user_id (str): The ID of the RemoteUser deleting the resource. This can be found in the ID field (not remote_id) in the RemoteUser table.
Keyword Args:
run_async (bool): Whether or not third-party updates should be run asynchronously.. [optional]
attachment_request (AttachmentRequest): [optional]
_return_http_data_only (bool): response data without head status
code and headers. Default is True.
_preload_content (bool): if False, the urllib3.HTTPResponse object
will be returned without reading/decoding response data.
Default is True.
_request_timeout (float/tuple): 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.
Default is None.
_check_input_type (bool): specifies if type checking
should be done one the data sent to the server.
Default is True.
_check_return_type (bool): specifies if type checking
should be done one the data received from the server.
Default is True.
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
async_req (bool): execute request asynchronously
Returns:
Attachment
If the method is called asynchronously, returns the request
thread.
"""
kwargs['async_req'] = kwargs.get(
'async_req', False
)
kwargs['_return_http_data_only'] = kwargs.get(
'_return_http_data_only', True
)
kwargs['_preload_content'] = kwargs.get(
'_preload_content', True
)
kwargs['_request_timeout'] = kwargs.get(
'_request_timeout', None
)
kwargs['_check_input_type'] = kwargs.get(
'_check_input_type', True
)
kwargs['_check_return_type'] = kwargs.get(
'_check_return_type', True
)
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['x_account_token'] = \
x_account_token
kwargs['remote_user_id'] = \
remote_user_id
return self.call_with_http_info(**kwargs)

self.attachments_create = Endpoint(
settings={
'response_type': (Attachment,),
'auth': [
'tokenAuth'
],
'endpoint_path': '/attachments',
'operation_id': 'attachments_create',
'http_method': 'POST',
'servers': None,
},
params_map={
'all': [
'x_account_token',
'remote_user_id',
'run_async',
'attachment_request',
],
'required': [
'x_account_token',
'remote_user_id',
],
'nullable': [
],
'enum': [
],
'validation': [
]
},
root_map={
'validations': {
},
'allowed_values': {
},
'openapi_types': {
'x_account_token':
(str,),
'remote_user_id':
(str,),
'run_async':
(bool,),
'attachment_request':
(AttachmentRequest,),
},
'attribute_map': {
'x_account_token': 'X-Account-Token',
'remote_user_id': 'remote_user_id',
'run_async': 'run_async',
},
'location_map': {
'x_account_token': 'header',
'remote_user_id': 'query',
'run_async': 'query',
'attachment_request': 'body',
},
'collection_format_map': {
}
},
headers_map={
'accept': [
'application/json'
],
'content_type': [
'application/json',
'application/x-www-form-urlencoded',
'multipart/form-data'
]
},
api_client=api_client,
callable=__attachments_create
)

def __attachments_list(
self,
x_account_token,
Expand Down
181 changes: 181 additions & 0 deletions MergeATSClient/model/attachment_request.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
"""
Merge ATS API
The unified API for building rich integrations with multiple Applicant Tracking System platforms. # noqa: E501
The version of the OpenAPI document: 1.0
Contact: [email protected]
Generated by: https://openapi-generator.tech
"""


import re # noqa: F401
import sys # noqa: F401

import nulltype # noqa: F401

from MergeATSClient.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
)


class AttachmentRequest(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""

allowed_values = {
}

validations = {
('file_url',): {
'max_length': 2000,
},
}

additional_properties_type = None

_nullable = False

@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
return {
'remote_id': (str, none_type,), # noqa: E501
'file_name': (str, none_type,), # noqa: E501
'file_url': (str, none_type,), # noqa: E501
'candidate': (str, none_type,), # noqa: E501
}

@cached_property
def discriminator():
return None


attribute_map = {
'remote_id': 'remote_id', # noqa: E501
'file_name': 'file_name', # noqa: E501
'file_url': 'file_url', # noqa: E501
'candidate': 'candidate', # noqa: E501
}

_composed_schemas = {}

required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])

@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""AttachmentRequest - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
remote_id (str, none_type): The third-party API ID of the matching object.. [optional] # noqa: E501
file_name (str, none_type): The attachment's name.. [optional] # noqa: E501
file_url (str, none_type): The attachment's url.. [optional] # noqa: E501
candidate (str, none_type): [optional] # noqa: E501
"""

_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())

if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)

self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)

for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
4 changes: 2 additions & 2 deletions MergeATSClient/model/data_passthrough_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def openapi_types():
return {
'method': (object,), # noqa: E501
'path': (str,), # noqa: E501
'base_url_override': (str,), # noqa: E501
'base_url_override': (str, none_type,), # noqa: E501
'data': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501
'headers': ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type,), # noqa: E501
}
Expand Down Expand Up @@ -145,7 +145,7 @@ def __init__(self, method, path, *args, **kwargs): # noqa: E501
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
base_url_override (str): [optional] # noqa: E501
base_url_override (str, none_type): [optional] # noqa: E501
data ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501
headers ({str: (bool, date, datetime, dict, float, int, list, str, none_type)}, none_type): [optional] # noqa: E501
"""
Expand Down
Loading

0 comments on commit bcd628e

Please sign in to comment.