René Winkelmeyer 3d97d83f7a Apex update for NamedCredentials and Salesforce DX (#5717)
* Added mustache file for namedCredentials

* Removed Basic and OAuth from Apex API in favor of NamedCredentials

* Moved old README to README for ant deployment

* Added SFDX OSS descriptor

* Removed remoteSite mustache

* Changed package.xml from RemoteSite to NamedCredential

* Update ApexClientCodegen to support SFDX and namedCredentials

* Created initial README for Salesforce DX

* Ran Petstore test for Apex commit

* Fixed error in README mustache
2017-05-29 11:16:06 +08:00

7.2 KiB

SwagUserApi

All URIs are relative to http://petstore.swagger.io/v2

Method HTTP request Description
createUser POST /user Create user
createUsersWithArrayInput POST /user/createWithArray Creates list of users with given input array
createUsersWithListInput POST /user/createWithList Creates list of users with given input array
deleteUser DELETE /user/{username} Delete user
getUserByName GET /user/{username} Get user by user name
loginUser GET /user/login Logs user into the system
logoutUser GET /user/logout Logs out current logged in user session
updateUser PUT /user/{username} Updated user

createUser

createUser(body)

Create user

This can only be done by the logged in user.

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'body' => SwagUser.getExample()
};

try {
    // cross your fingers
    api.createUser(params);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
body SwagUser Created user object

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createUsersWithArrayInput

createUsersWithArrayInput(body)

Creates list of users with given input array

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'body' => new List<SwagUser>{SwagUser.getExample()}
};

try {
    // cross your fingers
    api.createUsersWithArrayInput(params);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
body List<SwagUser> List of user object

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

createUsersWithListInput

createUsersWithListInput(body)

Creates list of users with given input array

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'body' => new List<SwagUser>{SwagUser.getExample()}
};

try {
    // cross your fingers
    api.createUsersWithListInput(params);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
body List<SwagUser> List of user object

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

deleteUser

deleteUser(username)

Delete user

This can only be done by the logged in user.

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'username' => 'username_example'
};

try {
    // cross your fingers
    api.deleteUser(params);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
username String The name that needs to be deleted

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

getUserByName

SwagUser getUserByName(username)

Get user by user name

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'username' => 'username_example'
};

try {
    // cross your fingers
    SwagUser result = api.getUserByName(params);
    System.debug(result);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
username String The name that needs to be fetched. Use user1 for testing.

Return type

SwagUser

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

loginUser

String loginUser(username, password)

Logs user into the system

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'username' => 'username_example',
    'password' => 'password_example'
};

try {
    // cross your fingers
    String result = api.loginUser(params);
    System.debug(result);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
username String The user name for login
password String The password for login in clear text

Return type

String

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

logoutUser

logoutUser()

Logs out current logged in user session

Example

SwagUserApi api = new SwagUserApi();

try {
    // cross your fingers
    api.logoutUser();
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

updateUser

updateUser(username, body)

Updated user

This can only be done by the logged in user.

Example

SwagUserApi api = new SwagUserApi();

Map<String, Object> params = new Map<String, Object>{
    'username' => 'username_example',
    'body' => SwagUser.getExample()
};

try {
    // cross your fingers
    api.updateUser(params);
} catch (Swagger.ApiException e) {
    // ...handle your exceptions
}

Parameters

Name Type Description Notes
username String name that need to be deleted
body SwagUser Updated user object

Return type

null (empty response body)

Authorization

No authorization required

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json