hydros

package module
v0.0.0-...-a96dbd5 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2021 License: MIT Imports: 13 Imported by: 0

README

HYDROS API Go Client

While older versions of go should work, we only support builds using go versions >= 11.

Build Status

NOTICE! Must update the following services when this package changes:

ms-ws-companies
ms-ws-contacts
ms-ws-event-actions
ms-ws-meter-readings
ms-ws-meters
ms-ws-permits
ms-ws-scheduler
ms-ws-systems
ms-ws-water-levels
ms-ws-water-quality

Example

To use client, import:

import "github.com/collierconsulting/hydros-api-go"

Initializing the client

client, err := hydros.NewClient(
	hydros.SetHost("https://the.apihost.com"), 
	hydros.SetAccessToken("[your access token]"))

Test Mocking

This library contains helper functions to assist in mocking of service methods for testing.

Service Method Mocking

For example, you could mock out the driller service's Get() routine to return a driller with the same ID passed in:

err = MockServiceMethod(
	client,
	"Driller.Get",
	func(ID uint) (*DrillerModel, error) {
		return &DrillerModel{DefaultModelBase: &DefaultModelBase{ID: ID}}, nil
	})
Model Service Mocking

To mock service methods on the payload model such as Delete() and Save():

err = MockModelServiceMethod(
	client.Driller,
	"Save",
	func(model *DrillerModel) (*DrillerModel, error) {
		return model, nil
	})

Note: There is one exception to the above. If you have mocked a service method, the model returned by that service method will not contain service method implementations or mocks. If you need to mock a service method that returns a model with its own mocked service methods you can define them both at the same time by mocking defining a ServiceSpec with ModelServiceCallMocks and initializing it on the returned model.

The following mocks the Well.Search method that returned a Well model with a mocked Delete method.

err := hydros.MockServiceMethod(
	app.APIClient,
	"Well.Search",
	func(query string, filters []string, from int, size int, sort []hydros.Sort) (*hydros.WellSearchResults, error) {
		wells := make([]*hydros.WellModel, 1)
		wells[0] = (&hydros.WellModel{
			DefaultModelBase: &hydros.DefaultModelBase{ID: 1}}).Init(
			&hydros.ServiceSpec{
				ServiceName:      "wells",
				Client:           app.APIClient.Client,
				PayloadModelType: reflect.TypeOf(hydros.WellModel{}),
				ModelServiceCallMocks: map[string]*hydros.ModelServiceCallMock{
					"Delete": {
						MockFunc: func(model *hydros.WellModel) error {
							return nil
						}}},
			})
		return &hydros.WellSearchResults{Total: 1, Results: wells}, nil
	})

Documentation

Index

Constants

View Source
const (
	// DefaultURL default URL
	DefaultURL = "https://localhost"
	// DefaultAuthType default authentication type
	DefaultAuthType = AuthTypeOpenID
)

Variables

This section is empty.

Functions

func MockModelServiceMethod

func MockModelServiceMethod(service interface{}, targetModelMethod string, mockFunc interface{}) error

MockModelServiceMethod mock a service method on a payload model

func MockServiceMethod

func MockServiceMethod(client interface{}, targetServiceMethod string, mockFunc interface{}) error

MockServiceMethod mock a method on a service

Types

type AmendWellPermitsRequest

type AmendWellPermitsRequest struct {
	HistoryUpdateID string `json:"historyUpdateId"`
	Patch           string `json:"patch"`
}

type AuthType

type AuthType string

AuthType client authentication type

const (
	AuthTypeOpenID AuthType = "openID"
)

AuthType constants

type Client

type Client struct {
	AuthType          AuthType
	AccessToken       string
	CreateHeadersFunc func() []RequestHeader
	URL               *url.URL
	HTTPClient        http.Client
	Driller           DrillerService
	History           HistoryService
	Meter             MeterService
	MeterReading      MeterReadingService
	Permit            PermitService
	Well              WellService
}

Client Hydros API client

func NewClient

func NewClient(options ...ClientOptionFunc) (*Client, error)

NewClient Creates instance of *Client

type ClientOptionFunc

type ClientOptionFunc func(*Client) error

ClientOptionFunc Hydros API client option

func SetAccessToken

func SetAccessToken(accessToken string) ClientOptionFunc

SetAccessToken sets a global access token to be used for client for duration of session

func SetHost

func SetHost(host string) ClientOptionFunc

SetHost updates host URL API calls are made against. Otherwise, the default URL is used

type ConstructionModel

type ConstructionModel struct {
	ID                  uint            `json:"id,omitempty"`
	CasingLimit         null.String     `json:"casingLimit"`
	CasingSize          null.Float      `json:"casingSize,omitempty"`
	CasingMaterial      null.String     `json:"casingMaterial,omitempty"`
	InsideDiameter      null.Float      `json:"insideDiameter,omitempty"`
	Depth               null.Float      `json:"depth,omitempty"`
	MaxPumpProduction   null.Int        `json:"maxPumpProduction,omitempty"`
	WithdrawalMethod    null.String     `json:"withdrawalMethod,omitempty"`
	PumpingCapacity     null.Float      `json:"pumpingCapacity,omitempty"`
	PumpMotorSize       null.String     `json:"pumpMotorSize,omitempty"`
	PumpPowerSource     null.String     `json:"pumpPowerSource,omitempty"`
	PumpBowlSize        null.Float      `json:"pumpBowlSize,omitempty"`
	PumpBowlStages      null.Int        `json:"pumpBowlNumStages,omitempty"`
	PumpColumnLength    null.Float      `json:"pumpColumnLength,omitempty"`
	PumpDepth           null.Float      `json:"pumpDepth,omitempty"`
	ServiceConnections  null.Int        `json:"serviceConnections,omitempty"`
	IndividualsServiced null.Int        `json:"individualsServiced,omitempty"`
	DaysServicedPerYear null.Int        `json:"daysServicedPerYear,omitempty"`
	Confined            bool            `json:"confined,omitempty"`
	Screens             []*ScreenRecord `json:"screens,omitempty"`
	GamLayerAlias       *GamLayerAlias  `json:"gamLayerAlias,omitempty"`
	GamLayer            *GamLayerRecord `json:"gamLayer,omitempty"`
}

ConstructionModel construction model for well association

type ContactModel

type ContactModel struct {
	*DefaultModelBase
	FirstName      null.String                `json:"firstName"`
	LastName       null.String                `json:"lastName"`
	CompanyName    null.String                `json:"companyName"`
	Email          null.String                `json:"email"`
	Address1       null.String                `json:"streetAddress1"`
	Address2       null.String                `json:"streetAddress2"`
	City           null.String                `json:"city"`
	State          null.String                `json:"state"`
	PostalCode     null.String                `json:"postalCode"`
	Classification null.String                `json:"classification"`
	PhoneNumbers   []*ContactPhoneNumberModel `json:"phoneNumbers,omitempty"`
	Verified       bool                       `json:"verified"`
}

ContactModel Contact response payload

type ContactPhoneNumberModel

type ContactPhoneNumberModel struct {
	*PhoneNumberModel
}

ContactPhoneNumberModel phone number model for contact association

type DefaultDrillerService

type DefaultDrillerService struct {
	*DefaultService
	GetFunc    func(ID uint) (*DrillerModel, error)
	CountFunc  func() (int, error)
	ListFunc   func(from int, size int, sort []Sort, ids []uint) ([]*DrillerModel, error)
	CreateFunc func(model *DrillerModel) (*DrillerModel, error)
}

DefaultDrillerService default driller service struct that contains backing functions

func (*DefaultDrillerService) Count

func (service *DefaultDrillerService) Count() (int, error)

Count Get a total number of objects

func (*DefaultDrillerService) Create

func (service *DefaultDrillerService) Create(model *DrillerModel) (*DrillerModel, error)

Create Create new

func (*DefaultDrillerService) Get

func (service *DefaultDrillerService) Get(ID uint) (*DrillerModel, error)

Get Get payload object by id

func (*DefaultDrillerService) Init

Init Initializes spec and default backing functions for service

func (*DefaultDrillerService) List

func (service *DefaultDrillerService) List(from int, size int, sort []Sort, ids []uint) ([]*DrillerModel, error)

List List objects for service

type DefaultHistoryService

type DefaultHistoryService struct {
	*DefaultService
	GetFunc   func(updateID string) (*HistoryModel, error)
	CountFunc func() (int, error)
	ListFunc  func(from int, size int, sort []Sort, updateIds []string, modelType string) ([]*HistoryModel, error)
}

DefaultHistoryService default history service struct that contains backing functions

func (*DefaultHistoryService) Count

func (service *DefaultHistoryService) Count() (int, error)

Count get a total number of objects

func (*DefaultHistoryService) Get

func (service *DefaultHistoryService) Get(updateID string) (*HistoryModel, error)

Get payload object by id

func (*DefaultHistoryService) Init

Init initialized spec and default backing functions for service

func (*DefaultHistoryService) List

func (service *DefaultHistoryService) List(from int, size int, sort []Sort, updateIds []string, modelType string) ([]*HistoryModel, error)

List object for service

type DefaultMeterReadingService

type DefaultMeterReadingService struct {
	*DefaultService
	GetFunc                         func(wellID uint, meterID uint, ID uint) (*MeterReadingModel, error)
	CountByWellFunc                 func(wellID uint) (int, error)
	CountByWellAndMeterFunc         func(wellID uint, meterID uint) (int, error)
	ListByWellFunc                  func(wellID uint, from int, size int, sort []Sort, startDate *time.Time, endDate *time.Time) ([]MeterReadingModel, error)
	ListByWellAndMeterFunc          func(wellID uint, meterID uint, from int, size int, sort []Sort, startDate *time.Time, endDate *time.Time) ([]MeterReadingModel, error)
	GetProductionByWellFunc         func(wellID uint, fromDate *time.Time, toDate *time.Time, estimateBounds bool) ([]ProductionModel, error)
	GetProductionByWellAndMeterFunc func(wellID uint, meterID uint, fromDate *time.Time, toDate *time.Time, estimateBounds bool) (*ProductionModel, error)
}

DefaultMeterReadingService default meter reading service struct that contains backing functions

func (*DefaultMeterReadingService) CountByWell

func (service *DefaultMeterReadingService) CountByWell(wellID uint) (int, error)

Get meter reading count by well id

func (*DefaultMeterReadingService) CountByWellAndMeter

func (service *DefaultMeterReadingService) CountByWellAndMeter(wellID uint, meterID uint) (int, error)

Get meter reading count by well id and meter id

func (*DefaultMeterReadingService) Get

func (service *DefaultMeterReadingService) Get(wellID uint, meterID uint, ID uint) (*MeterReadingModel, error)

Get meter reading by id

func (*DefaultMeterReadingService) GetProductionByWell

func (service *DefaultMeterReadingService) GetProductionByWell(wellID uint, fromDate *time.Time, toDate *time.Time, estimateBounds bool) ([]ProductionModel, error)

Get production by well id

func (*DefaultMeterReadingService) GetProductionByWellAndMeter

func (service *DefaultMeterReadingService) GetProductionByWellAndMeter(wellID uint, meterID uint, fromDate *time.Time, toDate *time.Time, estimateBounds bool) (*ProductionModel, error)

Get production by well id and meter id

func (*DefaultMeterReadingService) Init

Init initalized spec and default backing functions for service

func (*DefaultMeterReadingService) ListByWell

func (service *DefaultMeterReadingService) ListByWell(wellID uint, from int, size int, sort []Sort, startDate *time.Time, endDate *time.Time) ([]MeterReadingModel, error)

Get meter readings by well id

func (*DefaultMeterReadingService) ListByWellAndMeter

func (service *DefaultMeterReadingService) ListByWellAndMeter(wellID uint, meterID uint, from int, size int, sort []Sort, startDate *time.Time, endDate *time.Time) ([]MeterReadingModel, error)

Get meter readings by well id and meter id

type DefaultMeterService

type DefaultMeterService struct {
	*DefaultService
	GetFunc          func(wellID uint, ID uint) (*MeterModel, error)
	ListByWellIDFunc func(wellID uint) ([]MeterModel, error)
	CreateFunc       func(model *MeterModel) (*MeterModel, error)
	UpdateFunc       func(model *MeterModel) (*MeterModel, error)
	DecommissionFunc func(id uint, decommissionTime time.Time) (*MeterModel, error)
}

DefaultMeterService default meter service struct that contains backing functions

func (*DefaultMeterService) Create

func (service *DefaultMeterService) Create(model *MeterModel) (*MeterModel, error)

Create Create new

func (*DefaultMeterService) Decommission

func (service *DefaultMeterService) Decommission(id uint, decommissionDate time.Time) (*MeterModel, error)

Decommission Decommission model

func (*DefaultMeterService) Get

func (service *DefaultMeterService) Get(wellID uint, ID uint) (*MeterModel, error)

Get Get payload object by id

func (*DefaultMeterService) Init

func (service *DefaultMeterService) Init(spec *ServiceSpec) *DefaultMeterService

Init initialized spec and default backing functions for service

func (*DefaultMeterService) ListByWellID

func (service *DefaultMeterService) ListByWellID(wellID uint) ([]MeterModel, error)

List Get list of meters for well

func (*DefaultMeterService) Update

func (service *DefaultMeterService) Update(model *MeterModel) (*MeterModel, error)

Update Update model

type DefaultModelBase

type DefaultModelBase struct {
	Spec      *ServiceSpec `json:"-"`
	ID        uint         `json:"id"`
	CreatedAt time.Time    `json:"createdAt"`
	UpdatedAt time.Time    `json:"updatedAt"`
}

DefaultModelBase Standard model base struct

type DefaultPermitService

type DefaultPermitService struct {
	*DefaultService
	GetFunc              func(ID uint) (*PermitModel, error)
	CountFunc            func() (int, error)
	ListFunc             func(from int, size int, sort []Sort, ids []uint, aggregate bool) ([]*PermitModel, error)
	AmendWellPermitsFunc func(wellID uint, amendWellPermitsRequest AmendWellPermitsRequest) ([]PermitModel, error)
}

DefaultPermitService default permit service struct that contains backing functions

func (*DefaultPermitService) AmendWellPermits

func (service *DefaultPermitService) AmendWellPermits(wellID uint, amendWellPermitsRequest AmendWellPermitsRequest) ([]PermitModel, error)

AmendWellPermits amend well's permits

func (*DefaultPermitService) Count

func (service *DefaultPermitService) Count() (int, error)

AmendWellPermits amend well's permits

func (*DefaultPermitService) Get

func (service *DefaultPermitService) Get(ID uint) (*PermitModel, error)

Get permit by id

func (*DefaultPermitService) Init

Init initialized spec and default backing functions for service

func (*DefaultPermitService) List

func (service *DefaultPermitService) List(from int, size int, sort []Sort, ids []uint, aggregate bool) ([]*PermitModel, error)

AmendWellPermits amend well's permits

type DefaultService

type DefaultService struct {
	Spec *ServiceSpec
}

DefaultService Standard service base struct that implements Service

type DefaultWellService

type DefaultWellService struct {
	*DefaultService
	GetFunc           func(ID uint) (*WellModel, error)
	GetWellsByIDsFunc func(ids []uint) ([]WellModel, error)
	CountFunc         func() (int, error)
	ListFunc          func(from int, size int, sort []Sort, ids []uint) ([]*WellModel, error)
	SearchFunc        func(query string, filters []string, from int, size int, sort []Sort) (*WellSearchResults, error)
	CreateFunc        func(model *WellModel) (*WellModel, error)
}

DefaultWellService default well service struct that contains backing functions

func (*DefaultWellService) Count

func (service *DefaultWellService) Count() (int, error)

Count Get a total number of objects

func (*DefaultWellService) Create

func (service *DefaultWellService) Create(model *WellModel) (*WellModel, error)

Create Create new

func (*DefaultWellService) Get

func (service *DefaultWellService) Get(ID uint) (*WellModel, error)

Get Get payload object by id

func (*DefaultWellService) GetWellsByIDs

func (service *DefaultWellService) GetWellsByIDs(ids []uint) ([]WellModel, error)

Get Get wells by ids

func (*DefaultWellService) Init

func (service *DefaultWellService) Init(spec *ServiceSpec) *DefaultWellService

Init Initializes spec and default backing functions for service

func (*DefaultWellService) List

func (service *DefaultWellService) List(from int, size int, sort []Sort, ids []uint) ([]*WellModel, error)

List List objects for service

func (*DefaultWellService) Search

func (service *DefaultWellService) Search(query string, filters []string, from int, size int, sort []Sort) (*WellSearchResults, error)

Search wells

type DrillerModel

type DrillerModel struct {
	*DefaultModelBase
	LicenseNumber          null.String         `json:"licenseNumber"`
	LicenseExpirationDate  null.String         `json:"licenseExpirationDate"`
	LicenseIssuerTerritory null.String         `json:"licenseIssuerTerritory"`
	CompanyName            null.String         `json:"companyName"`
	FirstName              null.String         `json:"firstName"`
	LastName               null.String         `json:"lastName"`
	Email                  null.String         `json:"email"`
	StreetAddress1         null.String         `json:"streetAddress1"`
	StreetAddress2         null.String         `json:"streetAddress2"`
	City                   null.String         `json:"city"`
	State                  null.String         `json:"state"`
	PostalCode             null.String         `json:"postalCode"`
	PhoneNumbers           []*PhoneNumberModel `json:"phoneNumbers"`
	// contains filtered or unexported fields
}

DrillerModel Driller response payload

func (*DrillerModel) Delete

func (model *DrillerModel) Delete() error

Delete model

func (*DrillerModel) GetID

func (model *DrillerModel) GetID() uint

GetID getter for id attribute

func (*DrillerModel) Init

func (model *DrillerModel) Init(spec *ServiceSpec) *DrillerModel

Init Initializes spec and default backing functions for model instance

func (*DrillerModel) Save

func (model *DrillerModel) Save() (*DrillerModel, error)

Save changed model

type DrillerPhoneNumberModel

type DrillerPhoneNumberModel struct {
	*PhoneNumberModel
}

DrillerPhoneNumberModel phone number model for driller association

type DrillerService

type DrillerService interface {
	Service

	Get(ID uint) (*DrillerModel, error)
	Count() (int, error)
	List(from int, size int, sort []Sort, ids []uint) ([]*DrillerModel, error)
	Create(model *DrillerModel) (*DrillerModel, error)
}

DrillerService Driller service interface

func NewDrillerService

func NewDrillerService(client *Client) DrillerService

NewDrillerService creates & initializes new driller service

type DrillingCompanyModel

type DrillingCompanyModel struct {
	*DefaultModelBase
	City           null.String         `json:"city"`
	CompanyID      uint                `json:"companyId"`
	CompanyName    null.String         `json:"companyName"`
	CreatedAt      time.Time           `json:"createdAt"`
	CreatedBy      string              `json:"createdBy"`
	DeletedAt      *time.Time          `json:"deletedAt"`
	Email          null.String         `json:"email"`
	FirstName      null.String         `json:"firstName"`
	LastName       null.String         `json:"lastName"`
	Notes          null.String         `json:"notes"`
	PhoneNumbers   []*PhoneNumberModel `json:"phoneNumbers"`
	Pinned         bool                `json:"pinned"`
	PostalCode     null.String         `json:"postalCode"`
	State          null.String         `json:"state"`
	StreetAddress1 null.String         `json:"streetAddress1"`
	StreetAddress2 null.String         `json:"streetAddress2"`
	UpdatedAt      time.Time           `json:"updatedAt"`
	UpdatedBy      string              `json:"updatedBy"`
	// contains filtered or unexported fields
}

DrillingCompanyModel Drilling Company response payload

func (*DrillingCompanyModel) Delete

func (model *DrillingCompanyModel) Delete() error

Delete model

func (*DrillingCompanyModel) GetID

func (model *DrillingCompanyModel) GetID() uint

GetID getter for id attribute

func (*DrillingCompanyModel) Init

Init Initializes spec and default backing functions for model instance

func (*DrillingCompanyModel) Save

Save changed model

type DrillingCompanyPhoneNumberModel

type DrillingCompanyPhoneNumberModel struct {
	*PhoneNumberModel
}

DrillingCompanyPhoneNumberModel phone number model for drilling company association

type ErrorResponse

type ErrorResponse struct {
	Message     string `json:"message"`
	Description string `json:"description"`
}

ErrorResponse error response payload

type GamLayerAlias

type GamLayerAlias struct {
	ID        uint   `json:"id,omitempty"`
	LayerID   uint   `json:"layerId,omitempty"`
	Alias     string `json:"alias,omitempty"`
	LongAlias string `json:"longAlias,omitempty"`
}

GamLayerAlias payload

type GamLayerRecord

type GamLayerRecord struct {
	ID   uint        `json:"id,omitempty"`
	Name null.String `json:"name,omitempty"`
}

GamLayerRecord model

type HistoryModel

type HistoryModel struct {
	*DefaultModelBase
	UpdateID  string `json:"updateId"`
	CompanyID string `json:"companyId"`
	Type      string `json:"type"`
	Operation string `json:"operation"`
	Patch     string `json:"patch"`
	Snapshot  string `json:"snapshot"`
}

HistoryModel History response payload

func (*HistoryModel) GetID

func (model *HistoryModel) GetID() uint

GetID getter for id attribute

func (*HistoryModel) GetUpdateID

func (model *HistoryModel) GetUpdateID() string

GetUpdateID getter for Update ID attributes

func (*HistoryModel) Init

func (model *HistoryModel) Init(spec *ServiceSpec) *HistoryModel

Init Initialized spec and default backing functions for model instance

type HistoryService

type HistoryService interface {
	Service

	Get(updateID string) (*HistoryModel, error)
	Count() (int, error)
	List(from int, size int, sort []Sort, updateIds []string, modelType string) ([]*HistoryModel, error)
}

HistoryService History service interface

func NewHistoryService

func NewHistoryService(client *Client) HistoryService

NewHistoryService creates & initialized new history service

type LocationModel

type LocationModel struct {
	ID                          uint        `json:"id,omitempty"`
	Latitude                    null.Float  `json:"latitude,omitempty"`
	Longitude                   null.Float  `json:"longitude,omitempty"`
	LatLonSource                null.String `json:"latLonSource,omitempty"`
	Section                     null.String `json:"section,omitempty"`
	Block                       null.String `json:"block,omitempty"`
	Elevation                   null.Float  `json:"elevation,omitempty"`
	PhysicalLocation            null.String `json:"physicalLocation"`
	Address1                    null.String `json:"address1,omitempty"`
	Address2                    null.String `json:"address2,omitempty"`
	County                      null.String `json:"county,omitempty"`
	City                        null.String `json:"city,omitempty"`
	State                       null.String `json:"state,omitempty"`
	PostalCode                  null.String `json:"postalCode,omitempty"`
	ParcelId                    null.Int    `json:"parcelId"`
	Grid25TexasId               null.String `json:"grid25TexasId,omitempty"`
	GpsManufacturer             null.String `json:"gpsManufacturer,omitempty"`
	GpsModel                    null.String `json:"gpsModel,omitempty"`
	QuarterQuad                 null.String `json:"quarterQuad,omitempty"`
	DistanceToPropertyLine1     null.Int    `json:"distanceToPropertyLine1,omitempty"`
	DistanceToPropertyLine2     null.Int    `json:"distanceToPropertyLine2,omitempty"`
	DistanceToPropertyLine1Type null.String `json:"distanceToPropertyLine1Type,omitempty"`
	DistanceToPropertyLine2Type null.String `json:"distanceToPropertyLine2Type,omitempty"`
	ContinuousAcredTotal        null.Float  `json:"continuousAcredTotal,omitempty"`
	DistNearestWellOnProperty   null.Float  `json:"distNearestWellOnProperty,omitempty"`
}

LocationModel location model for well association

type MeterModel

type MeterModel struct {
	*DefaultModelBase
	Name            string      `json:"name"`
	Make            string      `json:"make"`
	Model           string      `json:"model"`
	SerialNumber    string      `json:"serialNumber"`
	StartReading    int         `json:"startReading"`
	Unit            string      `json:"unit"`
	Active          bool        `json:"active"`
	DateInService   time.Time   `json:"dateInService"`
	DecomissionDate *time.Time  `json:"decomissionDate,omitempty"`
	Wells           []WellModel `json:"wells"`
}

MeterModel Meter response payload

func (*MeterModel) Init

func (model *MeterModel) Init(spec *ServiceSpec) *MeterModel

Init Initalized spec and default backing functions for model instance

type MeterReadingModel

type MeterReadingModel struct {
	*DefaultModelBase
	MeterID     uint           `json:"meterId"`
	Reading     float64        `json:"reading"`
	ReadingDate *time.Time     `json:"readingDate"`
	Notes       null.String    `json:"notes"`
	ExtraData   postgres.Jsonb `json:"extraData"`
}

MeterReadingModel Meter Reading response payload

func (*MeterReadingModel) GetID

func (model *MeterReadingModel) GetID() uint

GetID getter for id attribute

func (*MeterReadingModel) Init

func (model *MeterReadingModel) Init(spec *ServiceSpec) *MeterReadingModel

Init Initialized spec and default backing functions for model instance

type MeterReadingService

type MeterReadingService interface {
	Service
	Get(wellID uint, meterID uint, ID uint) (*MeterReadingModel, error)
	CountByWell(wellID uint) (int, error)
	CountByWellAndMeter(wellID uint, meterID uint) (int, error)
	ListByWell(wellID uint, from int, size int, sort []Sort, startDate *time.Time, endDate *time.Time) ([]MeterReadingModel, error)
	ListByWellAndMeter(wellID uint, meterID uint, from int, size int, sort []Sort, startDate *time.Time, endDate *time.Time) ([]MeterReadingModel, error)
	GetProductionByWell(wellID uint, fromDate *time.Time, toDate *time.Time, estimateBounds bool) ([]ProductionModel, error)
	GetProductionByWellAndMeter(wellID uint, meterID uint, fromDate *time.Time, toDate *time.Time, estimateBounds bool) (*ProductionModel, error)
}

MeterReadingService Meter Reading service interface

func NewMeterReadingService

func NewMeterReadingService(client *Client) MeterReadingService

NewMeterReadingService creates initalized new meter reading service

type MeterService

type MeterService interface {
	Service

	Get(wellID uint, ID uint) (*MeterModel, error)
	ListByWellID(wellID uint) ([]MeterModel, error)
	Create(model *MeterModel) (*MeterModel, error)
	Update(model *MeterModel) (*MeterModel, error)
	Decommission(id uint, decommissionTime time.Time) (*MeterModel, error)
}

MeterService Meter service interface

func NewMeterService

func NewMeterService(client *Client) MeterService

NewMeterService creates & initialized new meter service

type ModelServiceCallMock

type ModelServiceCallMock struct {
	MockFunc interface{}
}

ModelServiceCallMock holds mock definition for service instance

type PermitMetricsModel

type PermitMetricsModel struct {
	PermitsCount                        int        `json:"permitsCount"`
	WellsCount                          int        `json:"wellsCount"`
	MetersCount                         int        `json:"metersCount"`
	OverPermittedProduction             bool       `json:"overPermittedProduction"`
	TotalEstimatedAnnualWaterProduction float32    `json:"totalEstimatedAnnualWaterProduction"`
	TotalVolumeProduced                 float32    `json:"totalVolumeProduced"`
	FromDate                            *time.Time `json:"fromDate"`
	ToDate                              *time.Time `json:"toDate"`
	Estimated                           bool       `json:"estimated"`
}

PermitTemplateModel PermitMetricsModel response payload

type PermitModel

type PermitModel struct {
	*DefaultModelBase
	CompanyID                    uint                `json:"companyId"`
	WellID                       uint                `json:"wellId"`
	HistoryUpdateID              string              `json:"historyUpdateId"`
	PermitTemplateID             uint                `json:"permitTemplateId"`
	PermitTemplate               PermitTemplateModel `json:"permitTemplate"`
	SystemID                     uint                `json:"systemId"`
	IssuedDate                   *time.Time          `json:"issuedDate"`
	ExpirationDate               *time.Time          `json:"expirationDate"`
	TerminationDate              *time.Time          `json:"terminationDate"`
	AdministrativelyComplete     bool                `json:"administrativelyComplete"`
	AdministrativelyCompleteDate *time.Time          `json:"administrativelyCompleteDate"`
	Aggregate                    bool                `json:"aggregate"`
	AggregatePermitID            null.Int            `json:"aggregatePermitId"`
	AggregatedPermits            []PermitModel       `json:"aggregatedPermits"`
	AmendedBy                    null.Int            `json:"amendedBy"`
	RequestedAmendPermitID       null.Int            `json:"requestedAmendPermitID"`
	RequestedAggregatePermitID   null.Int            `json:"requestedAggregatePermitID"`
	OperatorFirstName            null.String         `json:"operatorFirstName"`
	OperatorLastName             null.String         `json:"operatorLastName"`
	OperatorCompanyName          null.String         `json:"operatorCompanyName"`
	OperatorEmail                null.String         `json:"operatorEmail"`
	OperatorPhoneNumber1         null.String         `json:"operatorPhoneNumber1"`
	OperatorPhoneNumber2         null.String         `json:"operatorPhoneNumber2"`
	OperatorStreetAddress1       null.String         `json:"operatorStreetAddress1"`
	OperatorStreetAddress2       null.String         `json:"operatorStreetAddress2"`
	OperatorCity                 null.String         `json:"operatorCity"`
	OperatorState                null.String         `json:"operatorState"`
	OperatorPostalCode           null.String         `json:"operatorPostalCode"`
	PendingBoardApproval         bool                `json:"pendingBoardApproval"`
	SpecialTermsAndConditions    null.String         `json:"specialTermsAndConditions"`
	// contains filtered or unexported fields
}

PermitModel Permit response payload

func (*PermitModel) GetID

func (model *PermitModel) GetID() uint

GetID getter for id attribute

func (*PermitModel) Init

func (model *PermitModel) Init(spec *ServiceSpec) *PermitModel

Init Initialized spec and default backing functions for model instance

func (*PermitModel) Metrics

func (model *PermitModel) Metrics(fromDate *time.Time, toDate *time.Time, estimateBounds bool) (*PermitMetricsModel, error)

Metrics get permit metrics

type PermitService

type PermitService interface {
	Service
	Get(ID uint) (*PermitModel, error)
	Count() (int, error)
	List(from int, size int, sort []Sort, ids []uint, aggregate bool) ([]*PermitModel, error)
	AmendWellPermits(wellID uint, amendWellPermitsRequest AmendWellPermitsRequest) ([]PermitModel, error)
}

PermitService Permit service interface

func NewPermitService

func NewPermitService(client *Client) PermitService

NewPermitService creates * initialized new permit service

type PermitTemplateModel

type PermitTemplateModel struct {
	ID              uint   `json:"id"`
	CompanyID       uint   `json:"companyId"`
	PermitName      string `json:"permitName"`
	Condition       string `json:"condition"`
	RequiredFields  string `json:"requiredFields"`
	DurationDays    int    `json:"durationDays"`
	CanAggregate    bool   `json:"canAggregate"`
	AggregateFields string `json:"aggregateFields"`
}

PermitTemplateModel PermitTemplate response payload

type PhoneNumberModel

type PhoneNumberModel struct {
	*DefaultModelBase
	Type        null.String `json:"numberType"`
	PhoneNumber null.String `json:"phoneNumber"`
	Primary     null.Bool   `json:"isPrimary"`
}

PhoneNumberModel phone number payload model

type ProductionModel

type ProductionModel struct {
	MeterID   uint       `json:"meterId"`
	Volume    float64    `json:"volume"`
	FromDate  *time.Time `json:"fromDate"`
	ToDate    *time.Time `json:"toDate"`
	Estimated bool       `json:"estimated"`
}

ProductionModel Production response payload

type RequestHeader

type RequestHeader struct {
	Key   string
	Value string
}

RequestHeader hold key value pairs

type ScreenRecord

type ScreenRecord struct {
	ID          uint       `json:"id,omitempty"`
	TopDepth    null.Float `json:"topDepth,omitempty"`
	BottomDepth null.Float `json:"bottomDepth,omitempty"`
}

ScreenRecord model

type SecondaryStatusModel

type SecondaryStatusModel struct {
	ID              uint   `json:"id,omitempty"`
	SecondaryStatus string `json:"secondaryStatus,omitempty"`
}

SecondaryStatusModel model

type Service

type Service interface {
	// contains filtered or unexported methods
}

Service Base interface for services

type ServiceSpec

type ServiceSpec struct {
	ServiceName           string
	Client                *Client
	PayloadModelType      reflect.Type
	ModelServiceCallMocks map[string]*ModelServiceCallMock
}

ServiceSpec individual service instance metadata

type Sort

type Sort struct {
	Field     string        `json:"field"`
	Direction SortDirection `json:"direction"`
}

Sort struct representing sort parameter of search query

type SortDirection

type SortDirection string

SortDirection the sort direction of the query

const (
	Asc  SortDirection = "asc"
	Desc SortDirection = "desc"
)

Sort direction constants

type StatusModel

type StatusModel struct {
	ID     uint   `json:"id,omitempty"`
	Status string `json:"status,omitempty"`
}

StatusModel status model for well association

type SystemModel

type SystemModel struct {
	ID          uint        `json:"id,omitempty"`
	Name        null.String `json:"name,omitempty"`
	Description null.String `json:"description,omitempty"`
	CreatedAt   time.Time   `json:"createdAt,omitempty"`
	UpdatedAt   time.Time   `json:"updatedAt,omitempty"`
	DeletedAt   *time.Time  `json:"deletedAt,omitempty"`
}

SystemModel model

type WellModel

type WellModel struct {
	*DefaultModelBase
	Serial                            string                  `json:"serial,omitempty"`
	Name                              null.String             `json:"name,omitempty"`
	StateWellID                       null.String             `json:"stateWellId,omitempty"`
	TCEQ                              null.String             `json:"tceq,omitempty"`
	Approved                          bool                    `json:"approved,omitempty"`
	Status                            *StatusModel            `json:"status,omitempty"`
	SystemID                          uint                    `json:"systemId,omitempty"`
	System                            *SystemModel            `json:"system,omitempty"`
	Location                          *LocationModel          `json:"location,omitempty"`
	SecondaryStatuses                 []*SecondaryStatusModel `json:"secondaryStatuses,omitempty"`
	Contacts                          []*ContactModel         `json:"contacts"`
	Owner                             *ContactModel           `json:"owner,omitempty"`
	Applicant                         *ContactModel           `json:"applicant,omitempty"`
	DrillingCompany                   *DrillingCompanyModel   `json:"drillingCompany,omitempty"`
	Driller                           *DrillerModel           `json:"driller,omitempty"`
	DrillerIsContact                  bool                    `json:"drillerIsContact,omitempty"`
	PumpInstaller                     *DrillerModel           `json:"pumpInstaller,omitempty"`
	PumpInstallerIsContact            bool                    `json:"pumpInstallerIsContact,omitempty"`
	Tank                              *WellTankModel          `json:"tank,omitempty"`
	Construction                      *ConstructionModel      `json:"construction,omitempty"`
	WellReplacementID                 uint                    `json:"wellReplacementId,omitempty"`
	EstimatedDrillingDate             null.Time               `json:"estimatedDrillingDate,omitempty"`
	DrillingDate                      null.Time               `json:"drillingDate,omitempty"`
	CompletionDate                    null.Time               `json:"completionDate,omitempty"`
	ApprovedDate                      null.Time               `json:"approvedDate,omitempty"`
	Confidential                      bool                    `json:"confidential,omitempty"`
	Exempt                            bool                    `json:"exempt,omitempty"`
	ExemptionType                     string                  `json:"exemptionType,omitempty"`
	ApplicationType                   string                  `json:"applicationType,omitempty"`
	InstalledByDriller                bool                    `json:"installedByDriller,omitempty"`
	UsedByOtherThanOwner              bool                    `json:"usedByOtherThanOwner,omitempty"`
	TransportedOutOfGCD               bool                    `json:"transportedOutOfGCD,omitempty"`
	TransportedOutOfGCDDescription    null.String             `json:"transportedOutOfGCDDescription,omitempty"`
	UsedByPublicWaterSystem           bool                    `json:"usedByPublicWaterSystem,omitempty"`
	RequestedMonitoring               bool                    `json:"requestedMonitoring,omitempty"`
	RequestedGrandfathered            bool                    `json:"requestedGrandfathered,omitempty"`
	RequestedExtension                bool                    `json:"requestedExtension,omitempty"`
	UseBasedExemption                 bool                    `json:"useBasedExemption,omitempty"`
	PcbExemptionIndividual            bool                    `json:"pcbExemptionIndividual,omitempty"`
	PcbExemptionWellSystem            bool                    `json:"pcbExemptionWellSystem,omitempty"`
	CertifiedBeneficial               bool                    `json:"certifiedBeneficial,omitempty"`
	CertifiedRules                    bool                    `json:"certifiedRules,omitempty"`
	LocationTransported               null.String             `json:"locationTransported,omitempty"`
	PreferredPayment                  string                  `json:"preferredPayment,omitempty"`
	BeneficialUseAgreement            bool                    `json:"beneficialUseAgreement,omitempty"`
	DistrictRulesAgreement            bool                    `json:"districtRulesAgreement,omitempty"`
	AbideRules                        bool                    `json:"abideRules,omitempty"`
	MeetsSpacing                      bool                    `json:"meetsSpacing,omitempty"`
	NeedsProduction                   bool                    `json:"needsProduction,omitempty"`
	Notes                             null.String             `json:"notes,omitempty"`
	WellReportTrackingNumber          null.Int                `json:"wellReportTrackingNumber,omitempty"`
	PluggingReportTrackingNumber      null.Int                `json:"pluggingReportTrackingNumber,omitempty"`
	CertifiedInfoCorrect              bool                    `json:"certifiedInfoCorrect,omitempty"`
	MonitoringWellID                  null.String             `json:"monitoringWellId,omitempty"`
	ElevationInFeet                   null.Float              `json:"elevationInFeet,omitempty"`
	RequestedRescind                  bool                    `json:"requestedRescind,omitempty"`
	CertifiedMinTractSize             bool                    `json:"certifiedMinTractSize,omitempty"`
	CertifiedDistPropertyLine         bool                    `json:"certifiedDistPropertyLine,omitempty"`
	CertifiedDistExistingWaterWell    bool                    `json:"certifiedDistExistingWaterWell,omitempty"`
	CertifiedLocation                 bool                    `json:"certifiedLocation,omitempty"`
	CertifiedPluggedCappedGuidelines  bool                    `json:"certifiedPluggedCappedGuidelines,omitempty"`
	CertifiedProvideReports           bool                    `json:"certifiedProvideReports,omitempty"`
	EstimatedAnnualTransportedGallons null.Int                `json:"estimatedAnnualTransportedGallons,omitempty"`
	EstimatedAnnualWaterProduction    null.Int                `json:"estimatedAnnualWaterProduction,omitempty"`
	WellLogReceived                   null.Time               `json:"wellLogReceived,omitempty"`
	WellUses                          []WellUse               `json:"wellUses"`
	StaticAtDrillingDate              null.Float              `json:"staticAtDrillingDate"`
	InUseExplain                      null.String             `json:"inUseExplain"`
	OtherWellList                     null.String             `json:"otherWellList"`
	PluggedBy                         *DrillerModel           `json:"pluggedBy,omitempty"`
	Precinct                          null.String             `json:"precinct"`
	PumpInstallationDate              null.Time               `json:"pumpInstallationDate"`
	CreatedAt                         time.Time               `json:"createdAt,omitempty"`
	UpdatedAt                         time.Time               `json:"updatedAt,omitempty"`
	// contains filtered or unexported fields
}

WellModel Well response payload

func (*WellModel) Delete

func (model *WellModel) Delete() error

Delete model

func (*WellModel) Init

func (model *WellModel) Init(spec *ServiceSpec) *WellModel

Init Initializes spec and default backing functions for model instance

func (*WellModel) Permits

func (model *WellModel) Permits() ([]*PermitModel, error)

Permits fetch permits

func (*WellModel) Save

func (model *WellModel) Save() (*WellModel, error)

Save changed model

func (*WellModel) TriggerUpdate

func (model *WellModel) TriggerUpdate() (*WellModel, error)

TriggerUpdate update well entry in search DB and take snapshot of well state

func (*WellModel) Update

func (model *WellModel) Update(JSONMergePatch []byte) (*WellModel, error)

Update old model with patch data

type WellSearchResults

type WellSearchResults struct {
	Total   int          `json:"total"`
	Results []*WellModel `json:"results"`
}

WellSearchResults total and result list of found wells

type WellService

type WellService interface {
	Service

	Get(ID uint) (*WellModel, error)
	GetWellsByIDs(ids []uint) ([]WellModel, error)
	Count() (int, error)
	List(from int, size int, sort []Sort, ids []uint) ([]*WellModel, error)
	Search(query string, filters []string, from int, size int, sort []Sort) (*WellSearchResults, error)
	Create(model *WellModel) (*WellModel, error)
}

WellService Well service interface

func NewWellService

func NewWellService(client *Client) WellService

NewWellService creates & initializes new well service

type WellTankModel

type WellTankModel struct {
	ID     uint        `json:"id,omitempty"`
	Size   null.Int    `json:"size,omitempty"`
	Volume null.Float  `json:"volume,omitempty"`
	Design null.String `json:"design,omitempty"`
}

WellTankModel model

type WellUse

type WellUse struct {
	ID      uint   `json:"id"`
	WellUse string `json:"wellUse"`
	Exempt  bool   `json:"exempt"`
}

WellUse model

Jump to

Keyboard shortcuts

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