coreapi

package
v0.0.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2023 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PersonsRead               = "persons#read"
	PersonsNameRead           = "persons.name#read"
	PersonsBirthDateRead      = "persons.birth_date#read"
	PersonsDeceasedDateRead   = "persons.deceased_date#read"
	PersonsNationalIdsRead    = "persons.national_ids#read"
	PersonsGenderRead         = "persons.gender#read"
	PersonsEmailRead          = "persons.email#read"
	PersonsPhoneRead          = "persons.phone#read"
	PersonsPreferencesRead    = "persons.preferences#read"
	PersonsAddressRead        = "persons.address#read"
	PersonsProfilePictureRead = "persons.profile_picture#read"
	PersonAffiliationsRead    = "persons.affiliations#read"
	PersonRelationsRead       = "persons.relations#read"
	PersonConsentsRead        = "persons.consents#read"
	PersonRoleAssignmentsRead = "persons.role_assignments#read"
	PersonPersonIdRead        = "persons.person_id#read"
	OrgsRead                  = "orgs#read"
	CountriesRead             = "countries#read"
	RolesRead                 = "roles#read"
	GroupsRead                = "groups#read"
)
View Source
const UrlDev = "https://dev-api.bcc.no"
View Source
const UrlProd = "https://api.bcc.no"
View Source
const UrlSandbox = "https://sandbox-api.bcc.no"

Variables

View Source
var AffiliationPath = "/affiliations"
View Source
var ConsentPath = "/consents"
View Source
var CountryPath = "/countries"
View Source
var CredEnvDev = ClientCredentialsEnv{
	TokenUrl: "https://bcc-sso-dev.eu.auth0.com/oauth/token",
	Audience: "dev-api.bcc.no",
}
View Source
var CredEnvProd = ClientCredentialsEnv{
	TokenUrl: "https://bcc-sso.eu.auth0.com/oauth/token",
	Audience: "api.bcc.no",
}
View Source
var CredEnvSandbox = ClientCredentialsEnv{
	TokenUrl: "https://bcc-sso-sandbox.eu.auth0.com/oauth/token",
	Audience: "sandbox-api.bcc.no",
}
View Source
var DefaultAgent = fmt.Sprintf("Go-Coreapi/%s", Version)
View Source
var ErrInvalidAffiliationType = errors.New("not a valid AffiliationType")
View Source
var ErrInvalidConsentPurpose = errors.New("not a valid ConsentPurpose")
View Source
var ErrInvalidErrorCode = errors.New("not a valid ErrorCode")
View Source
var ErrInvalidGender = errors.New("not a valid Gender")
View Source
var ErrInvalidGrant = errors.New("not a valid Grant")
View Source
var ErrInvalidGroupType = errors.New("not a valid GroupType")
View Source
var ErrInvalidMaritalStatus = errors.New("not a valid MaritalStatus")
View Source
var ErrInvalidOrgActiveStatus = errors.New("not a valid OrgActiveStatus")
View Source
var ErrInvalidOrgType = errors.New("not a valid OrgType")
View Source
var ErrInvalidPersonRelationType = errors.New("not a valid PersonRelationType")
View Source
var ErrInvalidRelationType = errors.New("not a valid RelationType")
View Source
var ErrInvalidRoleScope = errors.New("not a valid RoleScope")
View Source
var ErrInvalidSearchVisibility = errors.New("not a valid SearchVisibility")
View Source
var GroupPath = "/groups"
View Source
var MemberPath = "/members"
View Source
var OrgPath = "/v2/orgs"
View Source
var PersonPath = "/v2/persons"
View Source
var RelationPath = "/relations"
View Source
var RoleAssignmentPath = "/roleAssignments"
View Source
var RolePath = "/roles"
View Source
var Version = "0.0.0-alpha.6"

Functions

This section is empty.

Types

type Address

type Address struct {
	Address1    string `json:"address1"`
	Address2    string `json:"address2"`
	Address3    string `json:"address3"`
	Region      string `json:"region"`
	City        string `json:"city"`
	PostalCode  string `json:"postalCode"`
	CountryCode string `json:"countryCode"`
}

type Affiliation

type Affiliation struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`
	Org             *Org      `json:"org"`
	Person          *Person   `json:"person"`

	PersonUid uuid.UUID       `json:"personUid"`
	OrgUid    uuid.UUID       `json:"orgUid"`
	Type      AffiliationType `json:"type"`
	ValidFrom time.Time       `json:"validFrom"`
	ValidTo   *time.Time      `json:"validTo"`
}

type AffiliationManager

type AffiliationManager managerBase

func (*AffiliationManager) Find

func (*AffiliationManager) Get

type AffiliationType

type AffiliationType string

ENUM(Member, Affiliate, Participant)

const (
	// AffiliationTypeMember is a AffiliationType of type Member.
	AffiliationTypeMember AffiliationType = "Member"
	// AffiliationTypeAffiliate is a AffiliationType of type Affiliate.
	AffiliationTypeAffiliate AffiliationType = "Affiliate"
	// AffiliationTypeParticipant is a AffiliationType of type Participant.
	AffiliationTypeParticipant AffiliationType = "Participant"
)

func ParseAffiliationType

func ParseAffiliationType(name string) (AffiliationType, error)

ParseAffiliationType attempts to convert a string to a AffiliationType.

func (AffiliationType) IsValid

func (x AffiliationType) IsValid() bool

String implements the Stringer interface.

func (AffiliationType) MarshalText

func (x AffiliationType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (AffiliationType) String

func (x AffiliationType) String() string

String implements the Stringer interface.

func (*AffiliationType) UnmarshalText

func (x *AffiliationType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Client

type Client struct {
	Affiliation    *AffiliationManager
	Consent        *ConsentManager
	Country        *CountryManager
	Group          *GroupManager
	Org            *OrgManager
	Person         *PersonManager
	Relation       *RelationManager
	RoleAssignment *RoleAssignmentManager
	Role           *RoleManager
	// contains filtered or unexported fields
}

func New

func New(url string, options ...ClientOption) *Client

func (*Client) Do

func (m *Client) Do(req *http.Request) (*http.Response, error)

Do triggers an HTTP request and returns an HTTP response, handling any context cancellations or timeouts.

func (*Client) NewRequest

func (c *Client) NewRequest(
	ctx context.Context,
	method,
	uri string,
	payload any,
	options ...RequestOption,
) (*http.Request, error)

func (*Client) Request

func (m *Client) Request(ctx context.Context, method, uri string, payload any, result any, options ...RequestOption) error

Request combines NewRequest and Do, while also handling decoding of response payload.

func (*Client) URL

func (c *Client) URL(parts ...string) string

type ClientCredentialsEnv

type ClientCredentialsEnv struct {
	TokenUrl string
	Audience string
}

type ClientOption

type ClientOption func(*Client)

func WithClient

func WithClient(client *http.Client) ClientOption

WithClient configures the SDK to use the provided client.

func WithClientCredentials

func WithClientCredentials(ctx context.Context, credEnv ClientCredentialsEnv, clientID, clientSecret string, scopes ...string) ClientOption

WithClientCredentials configures the SDK to authenticate using the client credentials authentication flow.

func WithEmulator

func WithEmulator(ctx context.Context, credEnv ClientCredentialsEnv, scopes ...string) ClientOption

WithClientCredentials configures the SDK to authenticate using the client credentials authentication flow against the emulator.

func WithStaticToken

func WithStaticToken(token string) ClientOption

WithClientCredentials configures the SDK to authenticate using the provided token

func WithTokenSource

func WithTokenSource(tokenSource oauth2.TokenSource) ClientOption

WithClientCredentials configures the SDK to authenticate using the provided token source

type Consent struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`
	Person          *Person   `json:"person"`
	Org             *Org      `json:"org"`

	PersonUid uuid.UUID      `json:"personUid"`
	OrgUid    uuid.UUID      `json:"orgUid"`
	Purpose   ConsentPurpose `json:"purpose"`
	ValidFrom time.Time      `json:"validFrom"`
	ValidTo   *time.Time     `json:"validTo"`
}

type ConsentManager

type ConsentManager managerBase

func (*ConsentManager) Find

func (*ConsentManager) Get

func (m *ConsentManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Consent], error)

type ConsentPurpose

type ConsentPurpose string

ENUM(DataSharing, Tracking)

const (
	// ConsentPurposeDataSharing is a ConsentPurpose of type DataSharing.
	ConsentPurposeDataSharing ConsentPurpose = "DataSharing"
	// ConsentPurposeTracking is a ConsentPurpose of type Tracking.
	ConsentPurposeTracking ConsentPurpose = "Tracking"
)

func ParseConsentPurpose

func ParseConsentPurpose(name string) (ConsentPurpose, error)

ParseConsentPurpose attempts to convert a string to a ConsentPurpose.

func (ConsentPurpose) IsValid

func (x ConsentPurpose) IsValid() bool

String implements the Stringer interface.

func (ConsentPurpose) MarshalText

func (x ConsentPurpose) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ConsentPurpose) String

func (x ConsentPurpose) String() string

String implements the Stringer interface.

func (*ConsentPurpose) UnmarshalText

func (x *ConsentPurpose) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Country

type Country struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`

	Iso2Code   string `json:"iso2Code"`
	NameEn     string `json:"nameEn"`
	NameNative string `json:"nameNative"`
	NameNo     string `json:"nameNo"`
}

type CountryManager

type CountryManager managerBase

func (*CountryManager) Find

func (*CountryManager) Get

func (m *CountryManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Country], error)

type Error

type Error struct {
	Code    ErrorCode `json:"code"`
	Message string    `json:"message"`
}

func (*Error) Error

func (m *Error) Error() string

Error formats the error into a string representation.

type ErrorCode

type ErrorCode string //@name ErrorCode

ENUM(

not-found
invalid-query,
invalid-body,
invalid-key-reference,
duplicate-unique-key,
cannot-parse-token,
invalid-token,
missing-scopes,
internal-error,
unauthorized,
invalid-app-uid,
unknown-error-response,

)

const (
	// ErrorCodeNotFound is a ErrorCode of type not-found.
	ErrorCodeNotFound ErrorCode = "not-found"
	// ErrorCodeInvalidQuery is a ErrorCode of type invalid-query.
	ErrorCodeInvalidQuery ErrorCode = "invalid-query"
	// ErrorCodeInvalidBody is a ErrorCode of type invalid-body.
	ErrorCodeInvalidBody ErrorCode = "invalid-body"
	// ErrorCodeInvalidKeyReference is a ErrorCode of type invalid-key-reference.
	ErrorCodeInvalidKeyReference ErrorCode = "invalid-key-reference"
	// ErrorCodeDuplicateUniqueKey is a ErrorCode of type duplicate-unique-key.
	ErrorCodeDuplicateUniqueKey ErrorCode = "duplicate-unique-key"
	// ErrorCodeCannotParseToken is a ErrorCode of type cannot-parse-token.
	ErrorCodeCannotParseToken ErrorCode = "cannot-parse-token"
	// ErrorCodeInvalidToken is a ErrorCode of type invalid-token.
	ErrorCodeInvalidToken ErrorCode = "invalid-token"
	// ErrorCodeMissingScopes is a ErrorCode of type missing-scopes.
	ErrorCodeMissingScopes ErrorCode = "missing-scopes"
	// ErrorCodeInternalError is a ErrorCode of type internal-error.
	ErrorCodeInternalError ErrorCode = "internal-error"
	// ErrorCodeUnauthorized is a ErrorCode of type unauthorized.
	ErrorCodeUnauthorized ErrorCode = "unauthorized"
	// ErrorCodeInvalidAppUid is a ErrorCode of type invalid-app-uid.
	ErrorCodeInvalidAppUid ErrorCode = "invalid-app-uid"
	// ErrorCodeUnknownErrorResponse is a ErrorCode of type unknown-error-response.
	ErrorCodeUnknownErrorResponse ErrorCode = "unknown-error-response"
)

func ParseErrorCode

func ParseErrorCode(name string) (ErrorCode, error)

ParseErrorCode attempts to convert a string to a ErrorCode.

func (ErrorCode) IsValid

func (x ErrorCode) IsValid() bool

String implements the Stringer interface.

func (ErrorCode) MarshalText

func (x ErrorCode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (ErrorCode) String

func (x ErrorCode) String() string

String implements the Stringer interface.

func (*ErrorCode) UnmarshalText

func (x *ErrorCode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type ErrorResponse

type ErrorResponse struct {
	Error Error `json:"error"`
}

type Gender

type Gender string

ENUM(Male, Female, Unknown)

const (
	// GenderMale is a Gender of type Male.
	GenderMale Gender = "Male"
	// GenderFemale is a Gender of type Female.
	GenderFemale Gender = "Female"
	// GenderUnknown is a Gender of type Unknown.
	GenderUnknown Gender = "Unknown"
)

func ParseGender

func ParseGender(name string) (Gender, error)

ParseGender attempts to convert a string to a Gender.

func (Gender) IsValid

func (x Gender) IsValid() bool

String implements the Stringer interface.

func (Gender) MarshalText

func (x Gender) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Gender) String

func (x Gender) String() string

String implements the Stringer interface.

func (*Gender) UnmarshalText

func (x *Gender) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Grant

type Grant string //@name GrantType

ENUM(Default, View, Administrate, Represent, None)

const (
	// GrantDefault is a Grant of type Default.
	GrantDefault Grant = "Default"
	// GrantView is a Grant of type View.
	GrantView Grant = "View"
	// GrantAdministrate is a Grant of type Administrate.
	GrantAdministrate Grant = "Administrate"
	// GrantRepresent is a Grant of type Represent.
	GrantRepresent Grant = "Represent"
	// GrantNone is a Grant of type None.
	GrantNone Grant = "None"
)

func ParseGrant

func ParseGrant(name string) (Grant, error)

ParseGrant attempts to convert a string to a Grant.

func (Grant) IsValid

func (x Grant) IsValid() bool

String implements the Stringer interface.

func (Grant) MarshalText

func (x Grant) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (Grant) String

func (x Grant) String() string

String implements the Stringer interface.

func (*Grant) UnmarshalText

func (x *Grant) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Group

type Group struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`

	AppUid uuid.UUID `json:"appUid"`

	OrgUid *uuid.UUID `json:"orgUid"`
	Name   string     `json:"name"`
	Type   GroupType  `json:"type"`
	Rule   string     `json:"rule"`
	Tags   []string   `json:"tags"`
}

type GroupManager

type GroupManager managerBase

func (*GroupManager) Find

func (*GroupManager) FindMembers

func (m *GroupManager) FindMembers(ctx context.Context, groupUid uuid.UUID, opts ...RequestOption) (ResponseWithMeta[[]GroupMember], error)

func (*GroupManager) Get

func (m *GroupManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Group], error)

func (*GroupManager) GetMember

func (m *GroupManager) GetMember(ctx context.Context, groupUid uuid.UUID, memberUid uuid.UUID, opts ...RequestOption) (Response[GroupMember], error)

type GroupMember

type GroupMember struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`

	Person    *Person   `json:"person"`
	GroupUid  uuid.UUID `json:"groupUid"`
	PersonUid uuid.UUID `json:"personUid"`
}

type GroupType

type GroupType string // @name GroupType

ENUM( Static, Dynamic )

const (
	// GroupTypeStatic is a GroupType of type Static.
	GroupTypeStatic GroupType = "Static"
	// GroupTypeDynamic is a GroupType of type Dynamic.
	GroupTypeDynamic GroupType = "Dynamic"
)

func ParseGroupType

func ParseGroupType(name string) (GroupType, error)

ParseGroupType attempts to convert a string to a GroupType.

func (GroupType) IsValid

func (x GroupType) IsValid() bool

String implements the Stringer interface.

func (GroupType) MarshalText

func (x GroupType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (GroupType) String

func (x GroupType) String() string

String implements the Stringer interface.

func (*GroupType) UnmarshalText

func (x *GroupType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type MaritalStatus

type MaritalStatus string

ENUM(Single, Married, Widowed, Separated, SingleParent, Unknown)

const (
	// MaritalStatusSingle is a MaritalStatus of type Single.
	MaritalStatusSingle MaritalStatus = "Single"
	// MaritalStatusMarried is a MaritalStatus of type Married.
	MaritalStatusMarried MaritalStatus = "Married"
	// MaritalStatusWidowed is a MaritalStatus of type Widowed.
	MaritalStatusWidowed MaritalStatus = "Widowed"
	// MaritalStatusSeparated is a MaritalStatus of type Separated.
	MaritalStatusSeparated MaritalStatus = "Separated"
	// MaritalStatusSingleParent is a MaritalStatus of type SingleParent.
	MaritalStatusSingleParent MaritalStatus = "SingleParent"
	// MaritalStatusUnknown is a MaritalStatus of type Unknown.
	MaritalStatusUnknown MaritalStatus = "Unknown"
)

func ParseMaritalStatus

func ParseMaritalStatus(name string) (MaritalStatus, error)

ParseMaritalStatus attempts to convert a string to a MaritalStatus.

func (MaritalStatus) IsValid

func (x MaritalStatus) IsValid() bool

String implements the Stringer interface.

func (MaritalStatus) MarshalText

func (x MaritalStatus) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (MaritalStatus) String

func (x MaritalStatus) String() string

String implements the Stringer interface.

func (*MaritalStatus) UnmarshalText

func (x *MaritalStatus) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Meta

type Meta struct {
	Limit   int `json:"limit"`
	Skipped int `json:"skipped"`
	Total   int `json:"total"`
}

type NationalId

type NationalId struct {
	CountryIso2Code string `json:"countryIso2Code"`
	Id              string `json:"id"`
}

type Org

type Org struct {
	Uid             uuid.UUID       `json:"uid"`
	OrgID           int             `json:"orgID"`
	LastChangedDate time.Time       `json:"lastChangedDate"`
	Name            string          `json:"name"`
	DistrictName    string          `json:"districtName"`
	Type            OrgType         `json:"type"`
	ActiveStatus    OrgActiveStatus `json:"activeStatus"`
	PostalAddress   Address         `json:"postalAddress"`
	BillingAddress  Address         `json:"billingAddress"`
	VisitingAddress Address         `json:"visitingAddress"`
}

type OrgActiveStatus

type OrgActiveStatus string

ENUM(Active, Inactive)

const (
	// OrgActiveStatusActive is a OrgActiveStatus of type Active.
	OrgActiveStatusActive OrgActiveStatus = "Active"
	// OrgActiveStatusInactive is a OrgActiveStatus of type Inactive.
	OrgActiveStatusInactive OrgActiveStatus = "Inactive"
)

func ParseOrgActiveStatus

func ParseOrgActiveStatus(name string) (OrgActiveStatus, error)

ParseOrgActiveStatus attempts to convert a string to a OrgActiveStatus.

func (OrgActiveStatus) IsValid

func (x OrgActiveStatus) IsValid() bool

String implements the Stringer interface.

func (OrgActiveStatus) MarshalText

func (x OrgActiveStatus) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (OrgActiveStatus) String

func (x OrgActiveStatus) String() string

String implements the Stringer interface.

func (*OrgActiveStatus) UnmarshalText

func (x *OrgActiveStatus) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type OrgManager

type OrgManager managerBase

func (*OrgManager) Find

func (m *OrgManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Org], error)

func (*OrgManager) Get

func (m *OrgManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Org], error)

type OrgType

type OrgType string

ENUM(Church, Club, Org)

const (
	// OrgTypeChurch is a OrgType of type Church.
	OrgTypeChurch OrgType = "Church"
	// OrgTypeClub is a OrgType of type Club.
	OrgTypeClub OrgType = "Club"
	// OrgTypeOrg is a OrgType of type Org.
	OrgTypeOrg OrgType = "Org"
)

func ParseOrgType

func ParseOrgType(name string) (OrgType, error)

ParseOrgType attempts to convert a string to a OrgType.

func (OrgType) IsValid

func (x OrgType) IsValid() bool

String implements the Stringer interface.

func (OrgType) MarshalText

func (x OrgType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (OrgType) String

func (x OrgType) String() string

String implements the Stringer interface.

func (*OrgType) UnmarshalText

func (x *OrgType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Person

type Person struct {
	Uid             uuid.UUID        `json:"uid"`
	PersonID        int              `json:"personID"`
	Affiliations    []Affiliation    `json:"affiliations"`
	Relations       []PersonRelation `json:"relations"`
	Consents        []Consent        `json:"consents"`
	RoleAssignments []RoleAssignment `json:"roleAssignments"`
	LastChangedDate time.Time        `json:"lastChangedDate"`

	FirstName         string        `json:"firstName"`
	MiddleName        string        `json:"middleName"`
	LastName          string        `json:"lastName"`
	DisplayName       string        `json:"displayName"`
	BirthDate         civil.Date    `json:"birthDate"`
	DeceasedDate      civil.Date    `json:"deceasedDate"`
	Gender            Gender        `json:"gender"`
	MaritalStatus     MaritalStatus `json:"maritalStatus"`
	Email             string        `json:"email"`
	EmailVerified     bool          `json:"emailVerified"`
	CellPhone         string        `json:"cellPhone"`
	CellPhoneVerified bool          `json:"cellPhoneVerified"`
	HomePhone         string        `json:"homePhone"`
	Preferences       Preferences   `json:"preferences"`
	Address           Address       `json:"address"`
	NationalIds       []NationalId  `json:"nationalIds"`

	// URL of person's profile picture
	ProfilePicture string `json:"profilePicture"`
}

type PersonManager

type PersonManager managerBase

func (*PersonManager) Find

func (*PersonManager) Get

func (m *PersonManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Person], error)

type PersonRelation

type PersonRelation struct {
	TargetUid uuid.UUID `json:"targetUid"`
	Target    *Person   `json:"target"`

	// Permission of origin on target
	GrantToTarget Grant `json:"grantToTarget"`
	// Permission of target on origin
	GrantToOrigin Grant `json:"grantToOrigin"`

	// Type of relation, defined as {target} is {type} of {origin}
	Type      PersonRelationType `json:"type"`
	ValidFrom time.Time          `json:"validFrom"`
	ValidTo   *time.Time         `json:"validTo"`

} //@name PersonRelation

type PersonRelationType

type PersonRelationType string //@name PersonRelationType

ENUM(Child, Parent, Spouse, LegalDependent, LegalGuardian, FosterChild, FosterParent, ContactDependent, ContactPerson)

const (
	// PersonRelationTypeChild is a PersonRelationType of type Child.
	PersonRelationTypeChild PersonRelationType = "Child"
	// PersonRelationTypeParent is a PersonRelationType of type Parent.
	PersonRelationTypeParent PersonRelationType = "Parent"
	// PersonRelationTypeSpouse is a PersonRelationType of type Spouse.
	PersonRelationTypeSpouse PersonRelationType = "Spouse"
	// PersonRelationTypeLegalDependent is a PersonRelationType of type LegalDependent.
	PersonRelationTypeLegalDependent PersonRelationType = "LegalDependent"
	// PersonRelationTypeLegalGuardian is a PersonRelationType of type LegalGuardian.
	PersonRelationTypeLegalGuardian PersonRelationType = "LegalGuardian"
	// PersonRelationTypeFosterChild is a PersonRelationType of type FosterChild.
	PersonRelationTypeFosterChild PersonRelationType = "FosterChild"
	// PersonRelationTypeFosterParent is a PersonRelationType of type FosterParent.
	PersonRelationTypeFosterParent PersonRelationType = "FosterParent"
	// PersonRelationTypeContactDependent is a PersonRelationType of type ContactDependent.
	PersonRelationTypeContactDependent PersonRelationType = "ContactDependent"
	// PersonRelationTypeContactPerson is a PersonRelationType of type ContactPerson.
	PersonRelationTypeContactPerson PersonRelationType = "ContactPerson"
)

func ParsePersonRelationType

func ParsePersonRelationType(name string) (PersonRelationType, error)

ParsePersonRelationType attempts to convert a string to a PersonRelationType.

func (PersonRelationType) IsValid

func (x PersonRelationType) IsValid() bool

String implements the Stringer interface.

func (PersonRelationType) MarshalText

func (x PersonRelationType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (PersonRelationType) String

func (x PersonRelationType) String() string

String implements the Stringer interface.

func (*PersonRelationType) UnmarshalText

func (x *PersonRelationType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type Preferences

type Preferences struct {
	ContentLanguages []string              `json:"contentLanguages"`
	UiLanguages      []string              `json:"uiLanguages"`
	Visibility       VisibilityPreferences `json:"visibility"`
}

type QueryOpts

type QueryOpts struct {
	IncludePersonsWithoutChurchAffiliation bool     `json:"includePersonsWithoutChurchAffiliation"`
	IncludeInactive                        []string `json:"includeInactive"`
	OrgUids                                []uuid.UUID
}

type Relation

type Relation struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`
	Origin          *Person   `json:"origin"`
	Target          *Person   `json:"target"`

	OriginUid uuid.UUID `json:"originUid"`
	TargetUid uuid.UUID `json:"targetUid"`

	// Type of the relation, defined as {origin} is {type} (of) {target}
	Type RelationType `json:"type"`

	// Permission of origin on target
	GrantToTarget Grant `json:"grantToTarget"`
	// Permission of target on origin
	GrantToOrigin Grant `json:"grantToOrigin"`

	ValidFrom time.Time  `json:"validFrom"`
	ValidTo   *time.Time `json:"validTo"`
}

type RelationManager

type RelationManager managerBase

func (*RelationManager) Find

func (*RelationManager) Get

type RelationType

type RelationType string

ENUM(ChildOf, SpouseOf, LegalDependentOf, FosterChildOf, ContactDependentOf)

const (
	// RelationTypeChildOf is a RelationType of type ChildOf.
	RelationTypeChildOf RelationType = "ChildOf"
	// RelationTypeSpouseOf is a RelationType of type SpouseOf.
	RelationTypeSpouseOf RelationType = "SpouseOf"
	// RelationTypeLegalDependentOf is a RelationType of type LegalDependentOf.
	RelationTypeLegalDependentOf RelationType = "LegalDependentOf"
	// RelationTypeFosterChildOf is a RelationType of type FosterChildOf.
	RelationTypeFosterChildOf RelationType = "FosterChildOf"
	// RelationTypeContactDependentOf is a RelationType of type ContactDependentOf.
	RelationTypeContactDependentOf RelationType = "ContactDependentOf"
)

func ParseRelationType

func ParseRelationType(name string) (RelationType, error)

ParseRelationType attempts to convert a string to a RelationType.

func (RelationType) IsValid

func (x RelationType) IsValid() bool

String implements the Stringer interface.

func (RelationType) MarshalText

func (x RelationType) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (RelationType) String

func (x RelationType) String() string

String implements the Stringer interface.

func (*RelationType) UnmarshalText

func (x *RelationType) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type RequestOption

type RequestOption func(*http.Request)

func Fields

func Fields(fields ...string) RequestOption

func Filter

func Filter(filter string) RequestOption

func Limit

func Limit(n int) RequestOption

func Page

func Page(n int) RequestOption

func QueryOptions

func QueryOptions(q QueryOpts) RequestOption
func Search(s string) RequestOption

func Skip

func Skip(n int) RequestOption

func Sort

func Sort(sortFields ...string) RequestOption

type Response

type Response[T any] struct {
	Data T `json:"data"`
}

type ResponseWithMeta

type ResponseWithMeta[T any] struct {
	Data T    `json:"data"`
	Meta Meta `json:"meta"`
}

type Role

type Role struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`

	Name  string    `json:"name"`
	Scope RoleScope `json:"scope"`
}

type RoleAssignment

type RoleAssignment struct {
	Uid             uuid.UUID `json:"uid"`
	LastChangedDate time.Time `json:"lastChangedDate"`
	Person          *Person   `json:"person"`
	Role            *Role     `json:"role"`
	Org             *Org      `json:"org"`

	PersonUid uuid.UUID  `json:"personUid"`
	RoleUid   uuid.UUID  `json:"roleUid"`
	OrgUid    *uuid.UUID `json:"orgUid"`
	ValidFrom time.Time  `json:"validFrom"`
	ValidTo   *time.Time `json:"validTo"`
}

type RoleAssignmentManager

type RoleAssignmentManager managerBase

func (*RoleAssignmentManager) Find

func (*RoleAssignmentManager) Get

type RoleManager

type RoleManager managerBase

func (*RoleManager) Find

func (m *RoleManager) Find(ctx context.Context, opts ...RequestOption) (ResponseWithMeta[[]Role], error)

func (*RoleManager) Get

func (m *RoleManager) Get(ctx context.Context, uid uuid.UUID, opts ...RequestOption) (Response[Role], error)

type RoleScope

type RoleScope string //@name RoleScope

ENUM(Global, Org)

const (
	// RoleScopeGlobal is a RoleScope of type Global.
	RoleScopeGlobal RoleScope = "Global"
	// RoleScopeOrg is a RoleScope of type Org.
	RoleScopeOrg RoleScope = "Org"
)

func ParseRoleScope

func ParseRoleScope(name string) (RoleScope, error)

ParseRoleScope attempts to convert a string to a RoleScope.

func (RoleScope) IsValid

func (x RoleScope) IsValid() bool

String implements the Stringer interface.

func (RoleScope) MarshalText

func (x RoleScope) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (RoleScope) String

func (x RoleScope) String() string

String implements the Stringer interface.

func (*RoleScope) UnmarshalText

func (x *RoleScope) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type SearchVisibility

type SearchVisibility string

ENUM(Global, District, Hidden)

const (
	// SearchVisibilityGlobal is a SearchVisibility of type Global.
	SearchVisibilityGlobal SearchVisibility = "Global"
	// SearchVisibilityDistrict is a SearchVisibility of type District.
	SearchVisibilityDistrict SearchVisibility = "District"
	// SearchVisibilityHidden is a SearchVisibility of type Hidden.
	SearchVisibilityHidden SearchVisibility = "Hidden"
)

func ParseSearchVisibility

func ParseSearchVisibility(name string) (SearchVisibility, error)

ParseSearchVisibility attempts to convert a string to a SearchVisibility.

func (SearchVisibility) IsValid

func (x SearchVisibility) IsValid() bool

String implements the Stringer interface.

func (SearchVisibility) MarshalText

func (x SearchVisibility) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (SearchVisibility) String

func (x SearchVisibility) String() string

String implements the Stringer interface.

func (*SearchVisibility) UnmarshalText

func (x *SearchVisibility) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type VisibilityPreferences

type VisibilityPreferences struct {
	BirthdayList bool             `json:"birthdayList"`
	Search       SearchVisibility `json:"search"`
}

Jump to

Keyboard shortcuts

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