rescode

package
v0.1.68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package rescode holds the IATA reservation action and status code vocabulary.

The same two-letter codes appear in teletype AIRIMP segment elements and in EDIFACT RPI segments. They live in their own package because a code table duplicated across two decoders is a table that drifts, and a decoder that disagrees with its sibling about whether US means "waitlisted" produces bookings that quietly disagree with the partner holding the other copy.

Index

Constants

This section is empty.

Variables

View Source
var Codes = map[ActionCode]CodeInfo{

	"NN": {"NN", "need, sell and report", CatRequest, false, false},
	"LL": {"LL", "add to waitlist", CatRequest, false, false},
	"SS": {"SS", "sold, segment sold from availability", CatRequest, true, false},
	"DS": {"DS", "need, do not sell if unable", CatRequest, false, false},
	"GN": {"GN", "group request, name list to follow", CatRequest, false, false},
	"PE": {"PE", "priority waitlist request", CatRequest, false, false},
	"RQ": {"RQ", "requested", CatRequest, false, false},

	"KK": {"KK", "confirming", CatReply, true, false},
	"KL": {"KL", "confirming from waitlist", CatReply, true, false},
	"UC": {"UC", "unable, flight closed, waitlist closed", CatReply, false, false},
	"UN": {"UN", "unable, flight does not operate", CatReply, false, false},
	"US": {"US", "unable, have waitlisted", CatReply, false, true},
	"UU": {"UU", "unable, have waitlisted", CatReply, false, true},
	"NO": {"NO", "no action taken", CatReply, false, false},
	"TK": {"TK", "confirming, advise times changed", CatReply, true, false},
	"TL": {"TL", "waitlisted, advise times changed", CatReply, false, true},

	"HK": {"HK", "holding confirmed", CatHolding, true, false},
	"HL": {"HL", "holding waitlisted", CatHolding, false, true},
	"HN": {"HN", "holding need, requested", CatHolding, false, false},
	"RR": {"RR", "reconfirmed", CatHolding, true, false},
	"PN": {"PN", "pending, request not yet processed", CatHolding, false, false},

	"XX": {"XX", "cancel", CatCancel, false, false},
	"XK": {"XK", "cancel, no action required", CatCancel, false, false},
	"HX": {"HX", "have cancelled", CatCancel, false, false},

	"SC": {"SC", "schedule change", CatAdvice, false, false},
	"WK": {"WK", "was confirmed, schedule change", CatAdvice, false, false},
	"WL": {"WL", "was waitlisted, schedule change", CatAdvice, false, false},
	"WN": {"WN", "was need, schedule change", CatAdvice, false, false},
	"IX": {"IX", "cancelled, if holding", CatAdvice, false, false},
	"DL": {"DL", "received deletion", CatAdvice, false, false},
	"MM": {"MM", "meet and assist", CatAdvice, false, false},
}

Codes is the interline action and status code vocabulary.

Functions

This section is empty.

Types

type ActionCode

type ActionCode string

ActionCode is a two-letter reservation action or status code. The codes below are the interline vocabulary; carriers also use private codes bilaterally, which parse fine and simply return an unknown Meaning.

const (
	// Cancel withdraws a segment. It is the action that lets a booking be
	// called off, and without a message carrying it a record can only be
	// cancelled locally, which diverges from what the carrier still holds.
	Cancel ActionCode = "XX"
	// CancelNoAction withdraws a segment the recipient need not act on.
	CancelNoAction ActionCode = "XK"
	// Need asks a carrier to sell and report.
	Need ActionCode = "NN"
	// Sold reports a sale made from availability under free sale.
	Sold ActionCode = "SS"
	// HoldingConfirmed states a confirmed holding.
	HoldingConfirmed ActionCode = "HK"
)

Codes callers name rather than spell. Only the ones a builder has to reach for directly are here; the full vocabulary is in Codes below.

func ReplyTo

func ReplyTo(reply ActionCode) (holding ActionCode, ok bool)

ReplyTo returns the holding status a requester should record after receiving reply. It reports ok=false when reply is not a reply code.

func (ActionCode) Category

func (a ActionCode) Category() Category

Category returns the code's category, CatUnknown for private codes.

func (ActionCode) Confirmed

func (a ActionCode) Confirmed() bool

Confirmed reports whether the code represents a held, confirmed seat.

func (ActionCode) Info

func (a ActionCode) Info() (CodeInfo, bool)

Info returns the code description, and whether the code is known.

func (ActionCode) NeedsReply

func (a ActionCode) NeedsReply() bool

NeedsReply reports whether receiving this code obliges the receiver to answer.

func (ActionCode) Waitlisted

func (a ActionCode) Waitlisted() bool

Waitlisted reports whether the code represents a waitlist holding.

type Category

type Category int

Category classifies what a code does, which is what response logic branches on.

const (
	// CatUnknown covers private or unrecognised codes.
	CatUnknown Category = iota
	// CatRequest asks the receiving carrier to do something and expects a reply.
	CatRequest
	// CatReply answers a request.
	CatReply
	// CatHolding states the sender's current holding without asking anything.
	CatHolding
	// CatCancel withdraws a previously requested or held segment.
	CatCancel
	// CatAdvice notifies of a change with no reply expected.
	CatAdvice
)

func (Category) String

func (c Category) String() string

type CodeInfo

type CodeInfo struct {
	Code     ActionCode
	Meaning  string
	Category Category
	// Confirmed reports whether the code represents a held, confirmed seat.
	Confirmed bool
	// Waitlisted reports whether the code represents a waitlist holding.
	Waitlisted bool
}

CodeInfo describes an action code.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL