{"modulePath":"github.com/bcc-code/bcc-core-api-go","version":"v0.1.0-alpha.2","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package coreapi\n\n## Constants\n\n```go\nconst (\n\tAffiliationsPath    = \"/affiliations\"\n\tConsentsPath        = \"/consents\"\n\tCountriesPath       = \"/countries\"\n\tGroupsPath          = \"/groups\"\n\tOrgsPath            = \"/v2/orgs\"\n\tPersonsPath         = \"/v2/persons\"\n\tRelationsPath       = \"/relations\"\n\tRoleAssignmentsPath = \"/roleAssignments\"\n\tRolesPath           = \"/roles\"\n)\n```\n\n```go\nconst MemberPath = \"/members\"\n```\n\n```go\nconst UrlDev = \"https://dev-api.bcc.no\"\n```\n\n```go\nconst UrlProd = \"https://api.bcc.no\"\n```\n\n```go\nconst UrlSandbox = \"https://sandbox-api.bcc.no\"\n```\n\n## Variables\n\n```go\nvar CredEnvDev = ClientCredentialsEnv{\n\tTokenUrl: \"https://bcc-sso-dev.eu.auth0.com/oauth/token\",\n\tAudience: \"dev-api.bcc.no\",\n}\n```\n\n```go\nvar CredEnvProd = ClientCredentialsEnv{\n\tTokenUrl: \"https://bcc-sso.eu.auth0.com/oauth/token\",\n\tAudience: \"api.bcc.no\",\n}\n```\n\n```go\nvar CredEnvSandbox = ClientCredentialsEnv{\n\tTokenUrl: \"https://bcc-sso-sandbox.eu.auth0.com/oauth/token\",\n\tAudience: \"sandbox-api.bcc.no\",\n}\n```\n\n```go\nvar DefaultAgent = fmt.Sprintf(\"Go-Coreapi/%s\", Version)\n```\n\n```go\nvar GroupPath = \"/groups\"\n```\n\n```go\nvar Version = \"0.1.0-alpha.2\"\n```\n\n## Types\n\n```go\ntype Client struct {\n\tAffiliation    *genericClient[models.Affiliation, models.AffiliationWrite]\n\tConsent        *genericClient[models.Consent, models.ConsentWrite]\n\tCountry        *genericClient[models.Country, models.CountryWrite]\n\tGroup          *GroupClient\n\tOrg            *genericClient[models.Org, models.OrgWrite]\n\tPerson         *genericClient[models.Person, models.PersonWrite]\n\tRelation       *genericClient[models.Relation, models.RelationWrite]\n\tRoleAssignment *genericClient[models.RoleAssignment, models.RoleAssignmentWrite]\n\tRole           *genericClient[models.Role, models.RoleWrite]\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(url string, options ...ClientOption) *Client\n```\n\n```go\nfunc (m *Client) Do(req *http.Request) (*http.Response, error)\n```\nDo triggers an HTTP request and returns an HTTP response, handling any context cancellations or timeouts.\n\n```go\nfunc (c *Client) NewRequest(\n\tctx context.Context,\n\tmethod,\n\turi string,\n\tpayload any,\n\toptions ...RequestOption,\n) (*http.Request, error)\n```\n\n```go\nfunc (c *Client) RefreshTestData() error\n```\nResets test data, only available if the SDK is run against the emulator\n\n```go\nfunc (m *Client) Request(ctx context.Context, method, uri string, payload any, result any, options ...RequestOption) error\n```\nRequest combines NewRequest and Do, while also handling decoding of response payload.\n\nCan be used to provide a custom payload type for a request\n\n```go\nfunc (c *Client) URL(parts ...string) string\n```\nJoins provided url parts with the base url to build the endpoint for calling\n\n```go\ntype ClientCredentialsEnv struct {\n\tTokenUrl string\n\tAudience string\n}\n```\n\n```go\ntype ClientOption func(*Client)\n```\n\n```go\nfunc WithClient(client *http.Client) ClientOption\n```\nWithClient configures the SDK to use the provided client.\n\n```go\nfunc WithClientCredentials(ctx context.Context, credEnv ClientCredentialsEnv, clientID, clientSecret string, scopes ...Scope) ClientOption\n```\nWithClientCredentials configures the SDK to authenticate using the client credentials authentication flow.\n\n```go\nfunc WithEmulator(ctx context.Context, credEnv ClientCredentialsEnv, scopes ...Scope) ClientOption\n```\nWithClientCredentials configures the SDK to authenticate using the client credentials authentication flow against the emulator.\n\n```go\nfunc WithStaticToken(token string) ClientOption\n```\nWithClientCredentials configures the SDK to authenticate using the provided token\n\n```go\nfunc WithTokenSource(tokenSource oauth2.TokenSource) ClientOption\n```\nWithClientCredentials configures the SDK to authenticate using the provided token source\n\n```go\ntype Error struct {\n\tCode    ErrorCode `json:\"code\"`\n\tMessage string    `json:\"message\"`\n}\n```\n\n```go\nfunc (m *Error) Error() string\n```\nError formats the error into a string representation.\n\n```go\ntype ErrorCode string\n```\n\n```go\nconst (\n\tErrorCodeNotFound             ErrorCode = \"not-found\"\n\tErrorCodeInvalidQuery         ErrorCode = \"invalid-query\"\n\tErrorCodeInvalidBody          ErrorCode = \"invalid-body\"\n\tErrorCodeInvalidKeyReference  ErrorCode = \"invalid-key-reference\"\n\tErrorCodeDuplicateUniqueKey   ErrorCode = \"duplicate-unique-key\"\n\tErrorCodeCannotParseToken     ErrorCode = \"cannot-parse-token\"\n\tErrorCodeInvalidToken         ErrorCode = \"invalid-token\"\n\tErrorCodeMissingScopes        ErrorCode = \"missing-scopes\"\n\tErrorCodeInternalError        ErrorCode = \"internal-error\"\n\tErrorCodeUnauthorized         ErrorCode = \"unauthorized\"\n\tErrorCodeInvalidAppUID        ErrorCode = \"invalid-app-uid\"\n\tErrorCodeUnknownErrorResponse ErrorCode = \"unknown-error-response\"\n)\n```\n\n```go\ntype ErrorResponse struct {\n\tError Error `json:\"error\"`\n}\n```\n\n```go\ntype GroupClient struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (m *GroupClient) AddMember(ctx context.Context, groupUID strfmt.UUID, member models.GroupMemberWrite, opts ...RequestOption) (models.Wrapped[models.GroupMember], error)\n```\n\n```go\nfunc (c *GroupClient) Create(ctx context.Context, aff W) (models.Wrapped[R], error)\n```\n\n```go\nfunc (c *GroupClient) Find(ctx context.Context, opts ...RequestOption) (models.WrappedWithMeta[[]R], error)\n```\n\n```go\nfunc (m *GroupClient) FindMembers(ctx context.Context, groupUID strfmt.UUID, opts ...RequestOption) (models.WrappedWithMeta[[]models.GroupMember], error)\n```\n\n```go\nfunc (c *GroupClient) Get(ctx context.Context, uid strfmt.UUID, opts ...RequestOption) (models.Wrapped[R], error)\n```\n\n```go\nfunc (m *GroupClient) GetMember(ctx context.Context, groupUID strfmt.UUID, memberUID strfmt.UUID, opts ...RequestOption) (models.Wrapped[models.GroupMember], error)\n```\n\n```go\nfunc (c *GroupClient) Remove(ctx context.Context, uid strfmt.UUID) (models.Wrapped[R], error)\n```\n\n```go\nfunc (m *GroupClient) RemoveMember(ctx context.Context, groupUID strfmt.UUID, memberUID strfmt.UUID, opts ...RequestOption) (models.Wrapped[models.GroupMember], error)\n```\n\n```go\nfunc (c *GroupClient) Update(ctx context.Context, uid strfmt.UUID, aff W) (models.Wrapped[R], error)\n```\n\n```go\ntype QueryOpts struct {\n\tIncludePersonsWithoutChurchAffiliation bool     `json:\"includePersonsWithoutChurchAffiliation\"`\n\tIncludeInactive                        []string `json:\"includeInactive\"`\n\tOrgUIDs                                []uuid.UUID\n}\n```\n\n```go\ntype RequestOption func(*http.Request)\n```\n\n```go\nfunc Fields(fields ...string) RequestOption\n```\n\n```go\nfunc Filter(filter string) RequestOption\n```\n\n```go\nfunc Limit(n int) RequestOption\n```\n\n```go\nfunc Page(n int) RequestOption\n```\n\n```go\nfunc QueryOptions(q QueryOpts) RequestOption\n```\n\n```go\nfunc Search(s string) RequestOption\n```\n\n```go\nfunc Skip(n int) RequestOption\n```\n\n```go\nfunc Sort(sortFields ...string) RequestOption\n```\n\n```go\ntype Scope string\n```\n\n```go\nconst (\n\tScopePersonsRead               Scope = \"persons#read\"\n\tScopePersonsNameRead           Scope = \"persons.name#read\"\n\tScopePersonsBirthDateRead      Scope = \"persons.birth_date#read\"\n\tScopePersonsDeceasedDateRead   Scope = \"persons.deceased_date#read\"\n\tScopePersonsNationalIdsRead    Scope = \"persons.national_ids#read\"\n\tScopePersonsGenderRead         Scope = \"persons.gender#read\"\n\tScopePersonsEmailRead          Scope = \"persons.email#read\"\n\tScopePersonsPhoneRead          Scope = \"persons.phone#read\"\n\tScopePersonsPreferencesRead    Scope = \"persons.preferences#read\"\n\tScopePersonsAddressRead        Scope = \"persons.address#read\"\n\tScopePersonsProfilePictureRead Scope = \"persons.profile_picture#read\"\n\tScopePersonAffiliationsRead    Scope = \"persons.affiliations#read\"\n\tScopePersonRelationsRead       Scope = \"persons.relations#read\"\n\tScopePersonConsentsRead        Scope = \"persons.consents#read\"\n\tScopePersonRoleAssignmentsRead Scope = \"persons.role_assignments#read\"\n\tScopePersonPersonIdRead        Scope = \"persons.person_id#read\"\n\tScopeOrgsRead                  Scope = \"orgs#read\"\n\tScopeCountriesRead             Scope = \"countries#read\"\n\tScopeRolesRead                 Scope = \"roles#read\"\n\tScopeGroupsRead                Scope = \"groups#read\"\n\n\tScopePersonsWrite               Scope = \"persons#write\"\n\tScopePersonAffiliationsWrite    Scope = \"persons.affiliations#write\"\n\tScopePersonRelationsWrite       Scope = \"persons.relations#write\"\n\tScopePersonConsentsWrite        Scope = \"persons.consents#write\"\n\tScopePersonRoleAssignmentsWrite Scope = \"persons.role_assignments#write\"\n\tScopeOrgsWrite                  Scope = \"orgs#write\"\n\tScopeCountriesWrite             Scope = \"countries#write\"\n\tScopeRolesWrite                 Scope = \"roles#write\"\n\tScopeGroupsWrite                Scope = \"groups#write\"\n)\n```\n\n","path":"github.com/bcc-code/bcc-core-api-go/coreapi","name":"coreapi","synopsis":"","isRedistributable":true}
