ENUM

HaapiModel.ProblemFactory

Contents

enum ProblemFactory

Provides functionality to build instances of Problem.

Methods

problem(type:metadata:title:messages:links:)

public static func problem(type: ProblemType,
                           metadata: Metadata?,
                           title: Message?,
                           messages: [UserMessage],
                           links: [Link]) -> Problem

Creates an instance of Problem model.

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.

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 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:)

public static func invalidInput(invalidFields: [InvalidInputProblem.InvalidField], // swiftlint:disable:this function_parameter_count line_length
                                errorDescription: String?,
                                type: ProblemType,
                                metadata: Metadata?,
                                title: Message?,
                                messages: [UserMessage],
                                links: [Link]) -> InvalidInputProblem

Creates an instance of InvalidInputProblem model.

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.

authorization(error:errorDescription:type:metadata:title:messages:links:)

public static func authorization(error: String,  // swiftlint:disable:this function_parameter_count
                                 errorDescription: String?,
                                 type: ProblemType,
                                 metadata: Metadata?,
                                 title: Message?,
                                 messages: [UserMessage],
                                 links: [Link]) -> AuthorizationProblem

Creates an instance of AuthorizationProblem model.

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.