ENUM
HaapiModel.ProblemFactory
Contents
- Methods
problem(type:metadata:title:messages:links:rawJsonString:)invalidInputField(name:reason:detail:)invalidInput(invalidFields:errorDescription:type:metadata:title:messages:links:rawJsonString:)authorization(error:errorDescription:type:metadata:title:messages:links:rawJsonString:)
 
enum ProblemFactory
Provides functionality to build instances of Problem for testing purposes.
Methods
problem(type:metadata:title:messages:links:rawJsonString:)
public static func problem(type: ProblemType,
                           metadata: Metadata?,
                           title: Message?,
                           messages: [UserMessage],
                           links: [Link],
                           rawJsonString: String? = nil) -> Problem
Creates an instance of Problem model.
- 
Parameters:
- type: The represented 
ProblemTypevalue. - metadata: Additional information about the problem.
 - title: The title of the error.
 - messages: An array of messages to be displayed to the user.
 - links: An array of 
Linkinstances that can be used to choose an alternate path for the flow. - rawJsonString: A string representation of the parameters provided to the method. Default value is nil.
 
 - type: The represented 
 - 
Returns: A built instance of
Problem. 
Parameters
| Name | Description | 
|---|---|
| type | The represented ProblemType value. | 
| metadata | Additional information about the problem. | 
| title | The title of the error. | 
| messages | An array of messages to be displayed to the user. | 
| links | An array of Link instances that can be used to choose an alternate path for the flow. | 
| rawJsonString | A string representation of the parameters provided to the method. Default value is nil. | 
invalidInputField(name:reason:detail:)
public static func invalidInputField(name: String,
                                     reason: String?,
                                     detail: Message) -> InvalidInputProblem.InvalidField
Creates an instance of InvalidInputProblem.InvalidField model.
- 
Parameters:
- name: The name of the invalid field
 - reason: The reason for the field to be invalid
 - detail: Additional details about why the field is invalid
 
 - 
Returns: A built instance of
InvalidInputProblem.InvalidField. 
Parameters
| Name | Description | 
|---|---|
| name | The name of the invalid field | 
| reason | The reason for the field to be invalid | 
| detail | Additional details about why the field is invalid | 
invalidInput(invalidFields:errorDescription:type:metadata:title:messages:links:rawJsonString:)
public static func invalidInput( // swiftlint:disable:this function_parameter_count
    invalidFields: [InvalidInputProblem.InvalidField],
    errorDescription: String?,
    type: ProblemType,
    metadata: Metadata?,
    title: Message?,
    messages: [UserMessage],
    links: [Link],
    rawJsonString: String? = nil
) -> InvalidInputProblem
Creates an instance of InvalidInputProblem model.
- 
Parameters:
- invalidFields: An array of 
InvalidInputProblem.InvalidFieldinstances to match the errors to the appropriate fields. - errorDescription: A human readable error description. Provides additional error information.
 - type: The represented 
ProblemTypevalue. - metadata: Additional information about the problem.
 - title: The title of the error.
 - messages: An array of messages to be displayed to the user.
 - links: An array of 
Linkinstances that can be used to choose an alternate path for the flow. - rawJsonString: A string representation of the parameters provided to the method. Default value is nil.
 
 - invalidFields: An array of 
 - 
Returns: A built instance of
InvalidInputProblem. 
Parameters
| Name | Description | 
|---|---|
| invalidFields | An array of InvalidInputProblem.InvalidField instances to match the errors to the appropriate fields. | 
| errorDescription | A human readable error description. Provides additional error information. | 
| type | The represented ProblemType value. | 
| metadata | Additional information about the problem. | 
| title | The title of the error. | 
| messages | An array of messages to be displayed to the user. | 
| links | An array of Link instances that can be used to choose an alternate path for the flow. | 
| rawJsonString | A string representation of the parameters provided to the method. Default value is nil. | 
authorization(error:errorDescription:type:metadata:title:messages:links:rawJsonString:)
public static func authorization(error: String,  // swiftlint:disable:this function_parameter_count
                                 errorDescription: String?,
                                 type: ProblemType,
                                 metadata: Metadata?,
                                 title: Message?,
                                 messages: [UserMessage],
                                 links: [Link],
                                 rawJsonString: String? = nil) -> AuthorizationProblem
Creates an instance of AuthorizationProblem model.
- 
Parameters:
- error: The error code.
 - errorDescription: A human readable error description. Provides additional error information.
 - type: The represented 
ProblemTypevalue. - metadata: Additional information about the problem.
 - title: The title of the error.
 - messages: An array of messages to be displayed to the user.
 - links: An array of 
Linkinstances that can be used to choose an alternate path for the flow. - rawJsonString: A string representation of the parameters provided to the method. Default value is nil.
 
 - 
Returns: A built instance of
AuthorizationProblem. 
Parameters
| Name | Description | 
|---|---|
| error | The error code. | 
| errorDescription | A human readable error description. Provides additional error information. | 
| type | The represented ProblemType value. | 
| metadata | Additional information about the problem. | 
| title | The title of the error. | 
| messages | An array of messages to be displayed to the user. | 
| links | An array of Link instances that can be used to choose an alternate path for the flow. | 
| rawJsonString | A string representation of the parameters provided to the method. Default value is nil. |