Documentation ¶
Overview ¶
Package abra provides a Go wrapper for the Australian Business Register
Index ¶
- Constants
- Variables
- func ValidateABN(abn string) (bool, error)
- func ValidateACN(acn string) (bool, error)
- type ABN
- type ACN
- type Abra
- type AddressDetails
- type BusinessEntity
- type BusinessName
- type Client
- func (c *Client) Search(text string) (*BusinessEntity, error)
- func (c *Client) SearchByABN(abn string, hist bool) (*BusinessEntity, error)
- func (c *Client) SearchByABNv201408(abn string, hist bool) (*BusinessEntity, error)
- func (c *Client) SearchByACN(abn string, hist bool) (*BusinessEntity, error)
- func (c *Client) SearchByASIC(abn string, hist bool) (*BusinessEntity, error)
- func (c *Client) SearchByASICv201408(acn string, hist bool) (*BusinessEntity, error)
- func (c *Client) SearchByName(name string, params *NameSearchParams) (*ResponseSearchResultsList, error)
- func (c *Client) SearchByNameAdvancedSimpleProtocol2017(name string, params *NameSearchParams) (*ResponseSearchResultsList, error)
- func (c *Client) SearchByNameBestGuess(name string, params *NameSearchParams) (*BusinessEntity, error)
- type ClientAPI
- type EntityStatus
- type EntityType
- type GSTRegisteredPeriod
- type HumanName
- type MainBusinessPhysicalAddress
- type NameSearchParams
- type Payload
- type Response
- type ResponseABNList
- type ResponseException
- type ResponseSearchResultsList
- type SearchResultName
- type SearchResultsRecord
- type State
Constants ¶
const ( BaseURL = "https://www.abn.business.gov.au/abrxmlsearch/ABRXMLSearch.asmx/" GUIDEnvName = "ABR_GUID" MissingGUIDError = "The ABR_GUID environment variable must be set" )
Variables ¶
var States = []State{ State{Title: "Australian Capital Territory", ShortTitle: "ACT"}, State{Title: "New South Wales", ShortTitle: "NSW"}, State{Title: "Northern Territory", ShortTitle: "NT"}, State{Title: "Queensland", ShortTitle: "QLD"}, State{Title: "South Australia", ShortTitle: "SA"}, State{Title: "Tasmania", ShortTitle: "TAS"}, State{Title: "Victoria", ShortTitle: "VIC"}, State{Title: "Western Australia", ShortTitle: "WA"}, }
var (
// @TODO update this using linker flags during build
Version = "dev"
)
Functions ¶
func ValidateABN ¶
ValidateABN tests a string to see if it is a valid ABN
func ValidateACN ¶
ValidateACN tests a string to see if it is a valid ACN
Types ¶
type ABN ¶
type ABN struct { IdentifierValue string `xml:"identifierValue,omitempty"` IdentifierStatus string `xml:"identifierStatus,omitempty"` IsCurrentIndicator string `xml:"isCurrentIndicator,omitempty"` ReplacedIdentifierValue string `xml:"replacedIdentifierValue,omitempty"` ReplacedFrom abnDate `xml:"replacedFrom,omitempty"` }
ABN represents an actual Australian Business Number
func (*ABN) IsValid ¶
IsValid checks whether your ABN has a valid identifier (https://www.abr.business.gov.au/HelpAbnFormat.aspx)
type ACN ¶
type ACN struct { IdentifierValue string `xml:"identifierValue,omitempty"` IsCurrentIndicator string `xml:"isCurrentIndicator,omitempty"` ReplacedIdentifierValue string `xml:"replacedIdentifierValue,omitempty"` ReplacedFrom abnDate `xml:"replacedFrom,omitempty"` }
ACN represents an actual Australian Company Number
type Abra ¶
type Abra interface { Search(string) (*BusinessEntity, error) SearchByABN(string, bool) (*BusinessEntity, error) SearchByABNv201408(string, bool) (*BusinessEntity, error) SearchByACN(string, bool) (*BusinessEntity, error) SearchByASIC(string, bool) (*BusinessEntity, error) SearchByASICv201408(string, bool) (*BusinessEntity, error) SearchByName(string, *NameSearchParams) (*ResponseSearchResultsList, error) SearchByNameAdvancedSimpleProtocol2017(string, *NameSearchParams) (*ResponseSearchResultsList, error) SearchByNameBestGuess(string, *NameSearchParams) (*BusinessEntity, error) }
Abra is the interface implemented by Client
type AddressDetails ¶
type AddressDetails struct { StateCode string `xml:"stateCode,omitempty"` Postcode string `xml:"postcode,omitempty"` EffectiveFrom abnDate `xml:"effectiveFrom,omitempty"` EffectiveTo abnDate `xml:"effectiveTo,omitempty"` }
Address details represents an address used by a BusinessEntity for a period of time
type BusinessEntity ¶
type BusinessEntity struct { RecordLastUpdatedDate abnDate `xml:"recordLastUpdatedDate,omitempty"` // So many ways of naming a business! BusinessNames []*BusinessName `xml:"businessName,omitempty"` HumanNames []*HumanName `xml:"legalName,omitempty"` MainNames []*BusinessName `xml:"mainName,omitempty"` MainTradingNames []*BusinessName `xml:"mainTradingName,omitempty"` OtherTradingNames []*BusinessName `xml:"otherTradingName,omitempty"` // Other details ABNs []*ABN `xml:"ABN,omitempty"` ASICNumber string `xml:"ASICNumber,omitempty"` EntityStatuses []*EntityStatus `xml:"entityStatus,omitempty"` EntityType *EntityType `xml:"entityType,omitempty"` GSTRegisteredPeriods []*GSTRegisteredPeriod `xml:"goodsAndServicesTax,omitempty"` PhysicalAddresses []*AddressDetails `xml:"mainBusinessPhysicalAddress,omitempty"` }
BusinessEntity represents a legal entity and encapsulates everything that the ABR knows about such an entity
func (*BusinessEntity) Name ¶
func (b *BusinessEntity) Name() string
Name returns the most relevant name that is available
type BusinessName ¶
type BusinessName struct { OrganisationName string `xml:"organisationName"` EffectiveFrom abnDate `xml:"effectiveFrom"` EffectiveTo abnDate `xml:"effectiveTo"` }
BusinessName represents some kind of name that was in use by a BusinessEntity at some point in history
type Client ¶
Client provides a client connection to the ABR
func NewWithGuid ¶
NewWithGuid returns a pointer to an initalized instance of a Client, configured with a `guid`
func (*Client) Search ¶
func (c *Client) Search(text string) (*BusinessEntity, error)
Search attempts to intelligently work out what you're looking for
func (*Client) SearchByABN ¶
func (c *Client) SearchByABN(abn string, hist bool) (*BusinessEntity, error)
SearchByABN is an alias for SearchByABNv201408
func (*Client) SearchByABNv201408 ¶
func (c *Client) SearchByABNv201408(abn string, hist bool) (*BusinessEntity, error)
SearchByABNv201408 wraps the API call to query an ABN
func (*Client) SearchByACN ¶
func (c *Client) SearchByACN(abn string, hist bool) (*BusinessEntity, error)
SearchByACN is an alias for SearchByASICv201408
func (*Client) SearchByASIC ¶
func (c *Client) SearchByASIC(abn string, hist bool) (*BusinessEntity, error)
SearchByASIC is an alias for SearchByASICv201408
func (*Client) SearchByASICv201408 ¶
func (c *Client) SearchByASICv201408(acn string, hist bool) (*BusinessEntity, error)
SearchByASICv201408 wraps the API call to query an ACN
func (*Client) SearchByName ¶
func (c *Client) SearchByName(name string, params *NameSearchParams) (*ResponseSearchResultsList, error)
SearchByName wraps the API call to query by `name` and other optional details
func (*Client) SearchByNameAdvancedSimpleProtocol2017 ¶
func (c *Client) SearchByNameAdvancedSimpleProtocol2017(name string, params *NameSearchParams) (*ResponseSearchResultsList, error)
SearchByNameAdvancedSimpleProtocol2017 wraps the SearchByNameAdvancedSimpleProtocol2017
func (*Client) SearchByNameBestGuess ¶
func (c *Client) SearchByNameBestGuess(name string, params *NameSearchParams) (*BusinessEntity, error)
SearchByNameBestGuess takes the first result from the name search and returns an ABN search
type ClientAPI ¶
type ClientAPI interface { SearchByABN(string, bool) (*BusinessEntity, error) SearchByABNv201408(string, bool) (*BusinessEntity, error) SearchByACN(string, bool) (*BusinessEntity, error) SearchByASIC(string, bool) (*BusinessEntity, error) SearchByASICv201408(string, bool) (*BusinessEntity, error) SearchByName(string, params *NameSearchParams) (*ResponseSearchResultsList, error) SearchByNameAdvancedSimpleProtocol2017(string, params *NameSearchParams) (*ResponseSearchResultsList, error) }
ClientAPI provides and interface to enable mocking the service client's API operation.
type EntityStatus ¶
type EntityStatus struct { EntityStatusCode string `xml:"entityStatusCode,omitempty"` EffectiveFrom abnDate `xml:"effectiveFrom,omitempty"` EffectiveTo abnDate `xml:"effectiveTo,omitempty"` }
EntityStatus represents the status of an entity (Active or Cancelled)
type EntityType ¶
type EntityType struct { EntityTypeCode string `xml:"entityTypeCode,omitempty"` EntityDescription string `xml:"entityDescription,omitempty"` }
EntityType represents the type of an entity - individal, pty ltd, etc.
type GSTRegisteredPeriod ¶
type GSTRegisteredPeriod struct { EffectiveFrom abnDate `xml:"effectiveFrom,omitempty"` EffectiveTo abnDate `xml:"effectiveTo,omitempty"` }
GSTRegisteredPeriod represents a period during which the entity was registered for GST
type HumanName ¶
type HumanName struct { GivenName string `xml:"givenName"` OtherGivenName string `xml:"otherGivenName"` FamilyName string `xml:"familyName"` EffectiveFrom abnDate `xml:"effectiveFrom"` EffectiveTo abnDate `xml:"effectiveTo"` }
HumanName represents the name of a human that was in use by a BusinessEntity at some point in history
type MainBusinessPhysicalAddress ¶
type MainBusinessPhysicalAddress struct { StateCode string `xml:"stateCode,omitempty"` Postcode string `xml:"postcode,omitempty"` IsCurrentIndicator string `xml:"isCurrentIndicator,omitempty"` }
MainBusinessPhysicalAddress
type NameSearchParams ¶
type NameSearchParams struct { ActiveABNsOnly bool BusinessName bool LegalName bool MaxSearchResults int32 MinimumScore int32 Postcode string States []State TradingName bool TypicalSearch bool }
NameSearchParams
type Payload ¶
type Payload struct {
Response *Response `xml:"response,omitempty"`
}
Payload encapsulates a Response from the API
type Response ¶
type Response struct { UsageStatement string `xml:"usageStatement,omitempty"` DateRegisterLastUpdated abnDate `xml:"dateRegisterLastUpdated,omitempty"` DateTimeRetrieved time.Time `xml:"dateTimeRetrieved,omitempty"` BusinessEntity *BusinessEntity `xml:"businessEntity,omitempty"` BusinessEntity200506 *BusinessEntity `xml:"businessEntity200506,omitempty"` BusinessEntity200709 *BusinessEntity `xml:"businessEntity200709,omitempty"` BusinessEntity201205 *BusinessEntity `xml:"businessEntity201205,omitempty"` BusinessEntity201408 *BusinessEntity `xml:"businessEntity201408,omitempty"` Exception *ResponseException `xml:"exception,omitempty"` AbnList *ResponseABNList `xml:"abnList,omitempty"` SearchResultsList *ResponseSearchResultsList `xml:"searchResultsList,omitempty"` }
Response represents the XML responses available via the ABRXMLSearch
type ResponseABNList ¶
type ResponseABNList struct { NumberOfRecords int32 `xml:"numberOfRecords,omitempty"` Abn []string `xml:"abn,omitempty"` }
ResponseABNList
type ResponseException ¶
type ResponseException struct { ExceptionDescription string `xml:"exceptionDescription,omitempty"` ExceptionCode string `xml:"exceptionCode,omitempty"` }
ResponseException returns the exception
type ResponseSearchResultsList ¶
type ResponseSearchResultsList struct { NumberOfRecords int32 `xml:"numberOfRecords,omitempty"` ExceedsMaximum string `xml:"exceedsMaximum,omitempty"` SearchResultsRecord []*SearchResultsRecord `xml:"searchResultsRecord,omitempty"` }
ResponseSearchResultsList
type SearchResultName ¶
type SearchResultName struct { OrganisationName string `xml:"organisationName,omitempty"` FullName string `xml:"fullName,omitempty"` Score int32 `xml:"score,omitempty"` IsCurrentIndicator string `xml:"isCurrentIndicator,omitempty"` }
MainName
type SearchResultsRecord ¶
type SearchResultsRecord struct { ABN ABN `xml:"ABN,omitempty"` BusinessName *SearchResultName `xml:"businessName,omitempty"` LegalName *SearchResultName `xml:"legalName,omitempty"` MainName *SearchResultName `xml:"mainName,omitempty"` MainTradingName *SearchResultName `xml:"mainTradingName,omitempty"` OtherTradingName *SearchResultName `xml:"otherTradingName,omitempty"` MainBusinessPhysicalAddress *MainBusinessPhysicalAddress `xml:"mainBusinessPhysicalAddress,omitempty"` }
SearchResultsRecord
func (*SearchResultsRecord) IsCurrentIndicator ¶
func (r *SearchResultsRecord) IsCurrentIndicator() string
IsCurrentIndicator returns the IsCurrentIndicator flag for the Name returned in the search
func (*SearchResultsRecord) Name ¶
func (r *SearchResultsRecord) Name() string
Name provides a Name for a `SearchResultName` based on the available types
func (*SearchResultsRecord) Score ¶
func (r *SearchResultsRecord) Score() int32
Score returns the score for the Name returned in the search