package app import ( "fmt" "time" ) // InjectResponseMeta takes a ResopnseMeta instance and injects additional metadata func InjectResponseMeta(r *ResponseMeta) *ResponseMeta { theResponseMeta := ResponseMeta{ Contact: "Contact Taxnexus at https://taxnexus.net/, info@taxnexus.net or +1-510-679-1900", Copyright: "Taxnexus API and all Taxnexus content is Copyright (c) 2018-2020 by Taxnexus, Inc. All Rights Reserved.", //nolint:lll // response text License: "Proprietary - Do Not Copy", Pagination: r.Pagination, TaxnexusAccount: r.TaxnexusAccount, ServerInfo: r.ServerInfo, ServerResponseTime: r.ServerResponseTime, ServerTimestamp: r.ServerTimestamp, RequestType: r.RequestType, RequestIP: r.RequestIP, RequestURL: r.RequestURL, } return &theResponseMeta } // NewResponseMeta creates a template meta response func NewResponseMeta() *ResponseMeta { return &ResponseMeta{ Contact: "Contact Taxnexus at https://taxnexus.net/, info@taxnexus.net or +1-510-679-1900", Copyright: "Taxnexus API and all Taxnexus content is Copyright (c) 2018-2020 by Taxnexus, Inc. All Rights Reserved.", //nolint:lll // response text License: "Proprietary - Do Not Copy", Pagination: &Pagination{ Limit: 1, Pagesize: 1, Poffset: 0, Setsize: 1, }, ServerInfo: "Taxnexus v1.3.0 - Go", ServerTimestamp: fmt.Sprint(time.Now().Local()), } } // NewResponseMetaWithPagination creates a template meta response with pagination func NewResponseMetaWithPagination(p *Pagination) *ResponseMeta { return &ResponseMeta{ Contact: "Contact Taxnexus at https://taxnexus.net/, info@taxnexus.net or +1-510-679-1900", Copyright: "Taxnexus API and all Taxnexus content is Copyright (c) 2018-2020 by Taxnexus, Inc. All Rights Reserved.", //nolint:lll // response text License: "Proprietary - Do Not Copy", ServerInfo: "Taxnexus v1.3.0 - Go", ServerTimestamp: fmt.Sprint(time.Now()), Pagination: p, } } // ResponseMeta is a struct type ResponseMeta struct { Contact string Copyright string License string OperationID string Pagination *Pagination RequestIP string RequestType string RequestURL string ServerInfo string ServerResponseTime string ServerTimestamp string TaxnexusAccount string } // Pagination is a struct type Pagination struct { Limit int64 Pagesize int64 Poffset int64 Setsize int64 }