Skip to content

Commit c5efee6

Browse files
committed
use openapi-generator for Python client
1 parent d8b3600 commit c5efee6

83 files changed

Lines changed: 1424 additions & 3864 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

rest_client_python/.swagger-codegen-ignore renamed to rest_client_python/.openapi-generator-ignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# Swagger Codegen Ignore
2-
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
33

44
# Use this file to prevent files from being overwritten by the generator.
55
# The patterns follow closely to .gitignore or .dockerignore.
66

77
# As an example, the C# client generator defines ApiClient.cs.
8-
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
99
#ApiClient.cs
1010

1111
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4.0.2

rest_client_python/.swagger-codegen/VERSION

Lines changed: 0 additions & 1 deletion
This file was deleted.

rest_client_python/.travis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# ref: https://docs.travis-ci.com/user/languages/python
2+
language: python
3+
python:
4+
- "2.7"
5+
- "3.2"
6+
- "3.3"
7+
- "3.4"
8+
- "3.5"
9+
#- "3.5-dev" # 3.5 development branch
10+
#- "nightly" # points to the latest development branch e.g. 3.6-dev
11+
# command to install dependencies
12+
install: "pip install -r requirements.txt"
13+
# command to run tests
14+
script: nosetests

rest_client_python/README.md

Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
# openapi-client
2+
The MDES APIs are designed as RPC style stateless web services where each API endpoint represents an operation to be performed. All request and response payloads are sent in the JSON (JavaScript Object Notation) data-interchange format. Each endpoint in the API specifies the HTTP Method used to access it. All strings in request and response objects are to be UTF-8 encoded. Each API URI includes the major and minor version of API that it conforms to. This will allow multiple concurrent versions of the API to be deployed simultaneously.
3+
4+
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
5+
6+
- API version: 1.2.7
7+
- Package version: 1.0.0
8+
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
9+
10+
## Requirements.
11+
12+
Python 2.7 and 3.4+
13+
14+
## Installation & Usage
15+
### pip install
16+
17+
If the python package is hosted on Github, you can install directly from Github
18+
19+
```sh
20+
pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git
21+
```
22+
(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`)
23+
24+
Then import the package:
25+
```python
26+
import openapi_client
27+
```
28+
29+
### Setuptools
30+
31+
Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
32+
33+
```sh
34+
python setup.py install --user
35+
```
36+
(or `sudo python setup.py install` to install the package for all users)
37+
38+
Then import the package:
39+
```python
40+
import openapi_client
41+
```
42+
43+
## Getting Started
44+
45+
Please follow the [installation procedure](#installation--usage) and then run the following:
46+
47+
```python
48+
from __future__ import print_function
49+
import time
50+
import openapi_client
51+
from openapi_client.rest import ApiException
52+
from pprint import pprint
53+
54+
55+
# create an instance of the API class
56+
api_instance = openapi_client.DeleteApi(openapi_client.ApiClient(configuration))
57+
delete_request_schema = openapi_client.DeleteRequestSchema() # DeleteRequestSchema | Contains the details of the request message. (optional)
58+
59+
try:
60+
# Used to delete one or more Tokens. The API is limited to 10 Tokens per request.
61+
api_response = api_instance.delete_digitization(delete_request_schema=delete_request_schema)
62+
pprint(api_response)
63+
except ApiException as e:
64+
print("Exception when calling DeleteApi->delete_digitization: %s\n" % e)
65+
66+
```
67+
68+
## Documentation for API Endpoints
69+
70+
All URIs are relative to *https://api.mastercard.com/mdes*
71+
72+
Class | Method | HTTP request | Description
73+
------------ | ------------- | ------------- | -------------
74+
*DeleteApi* | [**delete_digitization**](docs/DeleteApi.md#delete_digitization) | **POST** /digitization/static/1/0/delete | Used to delete one or more Tokens. The API is limited to 10 Tokens per request.
75+
*GetAssetApi* | [**get_asset**](docs/GetAssetApi.md#get_asset) | **GET** /assets/static/1/0/asset/{AssetId} | Used to retrieve static Assets from MDES�s repository, such as Card art, MasterCard brand logos, Issuer logos, and Terms and Conditions.
76+
*GetTaskStatusApi* | [**get_task_status**](docs/GetTaskStatusApi.md#get_task_status) | **POST** /digitization/static/1/0/getTaskStatus | Used to check the status of any asynchronous task that was previously requested.
77+
*GetTokenApi* | [**get_token**](docs/GetTokenApi.md#get_token) | **POST** /digitization/static/1/0/getToken | Used to get the status and details of a single given Token.
78+
*SearchTokensApi* | [**search_tokens**](docs/SearchTokensApi.md#search_tokens) | **POST** /digitization/static/1/0/searchTokens | Used to get basic token information for all tokens on a specified device, or all tokens mapped to the given Account PAN.
79+
*SuspendApi* | [**create_suspend**](docs/SuspendApi.md#create_suspend) | **POST** /digitization/static/1/0/suspend | Used to temporarily suspend one or more Tokens (for example, suspending all Tokens on a device in response to the device being lost). The API is limited to 10 Tokens per request.
80+
*TokenizeApi* | [**create_tokenize**](docs/TokenizeApi.md#create_tokenize) | **POST** /digitization/static/1/0/tokenize | Used to digitize a card to create a server-based Token.
81+
*TransactApi* | [**create_transact**](docs/TransactApi.md#create_transact) | **POST** /remotetransaction/static/1/0/transact | Used by the Token Requestor to create a Digital Secure Remote Payment (\"DSRP\") transaction cryptogram using the credentials stored within MDES in order to perform a DSRP transaction.
82+
*UnsuspendApi* | [**create_unsuspend**](docs/UnsuspendApi.md#create_unsuspend) | **POST** /digitization/static/1/0/unsuspend | Used to unsuspend one or more previously suspended Tokens. The API is limited to 10 Tokens per request.
83+
*NotifyTokenUpdatedApi* | [**notify_token_update__for_token_state_change**](docs/NotifyTokenUpdatedApi.md#notify_token_update__for_token_state_change) | **POST** /digitization/static/1/0/notifyTokenUpdated | Outbound API used by MDES to notify the Token Requestor of significant Token updates, such as when the Token is activated, suspended, unsuspended or deleted; or when information about the Token or its product configuration has changed.
84+
85+
86+
## Documentation For Models
87+
88+
- [AssetResponseSchema](docs/AssetResponseSchema.md)
89+
- [AuthenticationMethods](docs/AuthenticationMethods.md)
90+
- [BillingAddress](docs/BillingAddress.md)
91+
- [CardInfo](docs/CardInfo.md)
92+
- [CardInfoData](docs/CardInfoData.md)
93+
- [DecisioningData](docs/DecisioningData.md)
94+
- [DeleteRequestSchema](docs/DeleteRequestSchema.md)
95+
- [DeleteResponseSchema](docs/DeleteResponseSchema.md)
96+
- [EncryptedPayload](docs/EncryptedPayload.md)
97+
- [EncryptedPayloadTransact](docs/EncryptedPayloadTransact.md)
98+
- [Error](docs/Error.md)
99+
- [ErrorsResponse](docs/ErrorsResponse.md)
100+
- [GetTaskStatusRequestSchema](docs/GetTaskStatusRequestSchema.md)
101+
- [GetTaskStatusResponseSchema](docs/GetTaskStatusResponseSchema.md)
102+
- [GetTokenRequestSchema](docs/GetTokenRequestSchema.md)
103+
- [GetTokenResponseSchema](docs/GetTokenResponseSchema.md)
104+
- [MediaContent](docs/MediaContent.md)
105+
- [NotifyTokenEncryptedPayload](docs/NotifyTokenEncryptedPayload.md)
106+
- [NotifyTokenUpdatedRequestSchema](docs/NotifyTokenUpdatedRequestSchema.md)
107+
- [NotifyTokenUpdatedResponseSchema](docs/NotifyTokenUpdatedResponseSchema.md)
108+
- [ProductConfig](docs/ProductConfig.md)
109+
- [SearchTokensRequestSchema](docs/SearchTokensRequestSchema.md)
110+
- [SearchTokensResponseSchema](docs/SearchTokensResponseSchema.md)
111+
- [SuspendRequestSchema](docs/SuspendRequestSchema.md)
112+
- [SuspendResponseSchema](docs/SuspendResponseSchema.md)
113+
- [Token](docs/Token.md)
114+
- [TokenDetail](docs/TokenDetail.md)
115+
- [TokenDetailData](docs/TokenDetailData.md)
116+
- [TokenDetailDataPAR](docs/TokenDetailDataPAR.md)
117+
- [TokenDetailTokenizeResponse](docs/TokenDetailTokenizeResponse.md)
118+
- [TokenForLCM](docs/TokenForLCM.md)
119+
- [TokenInfo](docs/TokenInfo.md)
120+
- [TokenizeRequestSchema](docs/TokenizeRequestSchema.md)
121+
- [TokenizeResponseSchema](docs/TokenizeResponseSchema.md)
122+
- [TransactEncryptedData](docs/TransactEncryptedData.md)
123+
- [TransactError](docs/TransactError.md)
124+
- [TransactRequestSchema](docs/TransactRequestSchema.md)
125+
- [TransactResponseSchema](docs/TransactResponseSchema.md)
126+
- [UnSuspendRequestSchema](docs/UnSuspendRequestSchema.md)
127+
- [UnSuspendResponseSchema](docs/UnSuspendResponseSchema.md)
128+
129+
130+
## Documentation For Authorization
131+
132+
All endpoints do not require authorization.
133+
134+
## Author
135+
136+
137+
138+

rest_client_python/git_push.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/sh
2+
# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3+
#
4+
# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update"
5+
6+
git_user_id=$1
7+
git_repo_id=$2
8+
release_note=$3
9+
10+
if [ "$git_user_id" = "" ]; then
11+
git_user_id="GIT_USER_ID"
12+
echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
13+
fi
14+
15+
if [ "$git_repo_id" = "" ]; then
16+
git_repo_id="GIT_REPO_ID"
17+
echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
18+
fi
19+
20+
if [ "$release_note" = "" ]; then
21+
release_note="Minor update"
22+
echo "[INFO] No command line input provided. Set \$release_note to $release_note"
23+
fi
24+
25+
# Initialize the local directory as a Git repository
26+
git init
27+
28+
# Adds the files in the local repository and stages them for commit.
29+
git add .
30+
31+
# Commits the tracked changes and prepares them to be pushed to a remote repository.
32+
git commit -m "$release_note"
33+
34+
# Sets the new remote
35+
git_remote=`git remote`
36+
if [ "$git_remote" = "" ]; then # git remote not defined
37+
38+
if [ "$GIT_TOKEN" = "" ]; then
39+
echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment."
40+
git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
41+
else
42+
git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
43+
fi
44+
45+
fi
46+
47+
git pull origin master
48+
49+
# Pushes (Forces) the changes in the local repository up to the remote repository
50+
echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
51+
git push origin master 2>&1 | grep -v 'To https'
52+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# coding: utf-8
2+
3+
# flake8: noqa
4+
5+
"""
6+
MDES for Merchants
7+
8+
The MDES APIs are designed as RPC style stateless web services where each API endpoint represents an operation to be performed. All request and response payloads are sent in the JSON (JavaScript Object Notation) data-interchange format. Each endpoint in the API specifies the HTTP Method used to access it. All strings in request and response objects are to be UTF-8 encoded. Each API URI includes the major and minor version of API that it conforms to. This will allow multiple concurrent versions of the API to be deployed simultaneously. # noqa: E501
9+
10+
The version of the OpenAPI document: 1.2.7
11+
Generated by: https://openapi-generator.tech
12+
"""
13+
14+
15+
from __future__ import absolute_import
16+
17+
__version__ = "1.0.0"
18+
19+
# import apis into sdk package
20+
from openapi_client.api.delete_api import DeleteApi
21+
from openapi_client.api.get_asset_api import GetAssetApi
22+
from openapi_client.api.get_task_status_api import GetTaskStatusApi
23+
from openapi_client.api.get_token_api import GetTokenApi
24+
from openapi_client.api.search_tokens_api import SearchTokensApi
25+
from openapi_client.api.suspend_api import SuspendApi
26+
from openapi_client.api.tokenize_api import TokenizeApi
27+
from openapi_client.api.transact_api import TransactApi
28+
from openapi_client.api.unsuspend_api import UnsuspendApi
29+
from openapi_client.api.notify_token_updated_api import NotifyTokenUpdatedApi
30+
31+
# import ApiClient
32+
from openapi_client.api_client import ApiClient
33+
from openapi_client.configuration import Configuration
34+
from openapi_client.exceptions import OpenApiException
35+
from openapi_client.exceptions import ApiTypeError
36+
from openapi_client.exceptions import ApiValueError
37+
from openapi_client.exceptions import ApiKeyError
38+
from openapi_client.exceptions import ApiException
39+
# import models into sdk package
40+
from openapi_client.models.asset_response_schema import AssetResponseSchema
41+
from openapi_client.models.authentication_methods import AuthenticationMethods
42+
from openapi_client.models.billing_address import BillingAddress
43+
from openapi_client.models.card_info import CardInfo
44+
from openapi_client.models.card_info_data import CardInfoData
45+
from openapi_client.models.decisioning_data import DecisioningData
46+
from openapi_client.models.delete_request_schema import DeleteRequestSchema
47+
from openapi_client.models.delete_response_schema import DeleteResponseSchema
48+
from openapi_client.models.encrypted_payload import EncryptedPayload
49+
from openapi_client.models.encrypted_payload_transact import EncryptedPayloadTransact
50+
from openapi_client.models.error import Error
51+
from openapi_client.models.errors_response import ErrorsResponse
52+
from openapi_client.models.get_task_status_request_schema import GetTaskStatusRequestSchema
53+
from openapi_client.models.get_task_status_response_schema import GetTaskStatusResponseSchema
54+
from openapi_client.models.get_token_request_schema import GetTokenRequestSchema
55+
from openapi_client.models.get_token_response_schema import GetTokenResponseSchema
56+
from openapi_client.models.media_content import MediaContent
57+
from openapi_client.models.notify_token_encrypted_payload import NotifyTokenEncryptedPayload
58+
from openapi_client.models.notify_token_updated_request_schema import NotifyTokenUpdatedRequestSchema
59+
from openapi_client.models.notify_token_updated_response_schema import NotifyTokenUpdatedResponseSchema
60+
from openapi_client.models.product_config import ProductConfig
61+
from openapi_client.models.search_tokens_request_schema import SearchTokensRequestSchema
62+
from openapi_client.models.search_tokens_response_schema import SearchTokensResponseSchema
63+
from openapi_client.models.suspend_request_schema import SuspendRequestSchema
64+
from openapi_client.models.suspend_response_schema import SuspendResponseSchema
65+
from openapi_client.models.token import Token
66+
from openapi_client.models.token_detail import TokenDetail
67+
from openapi_client.models.token_detail_data import TokenDetailData
68+
from openapi_client.models.token_detail_data_par import TokenDetailDataPAR
69+
from openapi_client.models.token_detail_tokenize_response import TokenDetailTokenizeResponse
70+
from openapi_client.models.token_for_lcm import TokenForLCM
71+
from openapi_client.models.token_info import TokenInfo
72+
from openapi_client.models.tokenize_request_schema import TokenizeRequestSchema
73+
from openapi_client.models.tokenize_response_schema import TokenizeResponseSchema
74+
from openapi_client.models.transact_encrypted_data import TransactEncryptedData
75+
from openapi_client.models.transact_error import TransactError
76+
from openapi_client.models.transact_request_schema import TransactRequestSchema
77+
from openapi_client.models.transact_response_schema import TransactResponseSchema
78+
from openapi_client.models.un_suspend_request_schema import UnSuspendRequestSchema
79+
from openapi_client.models.un_suspend_response_schema import UnSuspendResponseSchema
80+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from __future__ import absolute_import
2+
3+
# flake8: noqa
4+
5+
# import apis into api package
6+
from openapi_client.api.delete_api import DeleteApi
7+
from openapi_client.api.get_asset_api import GetAssetApi
8+
from openapi_client.api.get_task_status_api import GetTaskStatusApi
9+
from openapi_client.api.get_token_api import GetTokenApi
10+
from openapi_client.api.search_tokens_api import SearchTokensApi
11+
from openapi_client.api.suspend_api import SuspendApi
12+
from openapi_client.api.tokenize_api import TokenizeApi
13+
from openapi_client.api.transact_api import TransactApi
14+
from openapi_client.api.unsuspend_api import UnsuspendApi
15+
from openapi_client.api.notify_token_updated_api import NotifyTokenUpdatedApi

0 commit comments

Comments
 (0)