{"modulePath":"github.com/bcc-code/bcc-core-api-go","version":"v0.2.0-alpha","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package bcccoreapi\n\n## Variables\n\n```go\nvar DefaultAgent = fmt.Sprintf(\"Go-BCCCoreApi/%s\", Version)\n```\n\n```go\nvar Version = \"0.2.0-alpha\"\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 NewClient(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 ClientOption func(*Client)\n```\n\n```go\nfunc WithClientCredentials(ctx context.Context, clientID, clientSecret string, scopes ...Scope) ClientOption\n```\nWithClientCredentials configures the SDK to authenticate using the client credentials authentication flow.\n\n```go\nfunc WithCustomEnvironment(envConfig EnvironmentConfig) ClientOption\n```\nWithCustomEnvironment sets a custom environment config for the SDK to use. Can be used to if you want to pass your requests thorugh a proxy, or to connect to an emulator\n\n```go\nfunc WithEmulator(ctx context.Context, envConfig EnvironmentConfig, scopes ...Scope) ClientOption\n```\nWithEmulator configures the SDK to authenticate using the client credentials authentication flow against the emulator.\n\n```go\nfunc WithEnvironment(env Environment) ClientOption\n```\nWithEnvironment configures the SDK to override the used environment (by default Prod is used)\n\n```go\nfunc WithHTTPClient(client *http.Client) ClientOption\n```\nWithHTTPClient configures the SDK to use the provided HTTP client.\n\n```go\nfunc WithStaticToken(token string) ClientOption\n```\nWithStaticToken configures the SDK to authenticate using the provided token\n\n```go\nfunc WithTokenSource(tokenSource oauth2.TokenSource) ClientOption\n```\nWithTokenSource configures the SDK to authenticate using the provided token source\n\n```go\ntype Environment int\n```\n\n```go\nconst (\n\tEnvironmentProd Environment = iota\n\tEnvironmentSandbox\n\tEnvironmentDev\n)\n```\n\n```go\ntype EnvironmentConfig struct {\n\tBaseUrl  string\n\tTokenUrl string\n\tAudience string\n}\n```\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 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```\nFields allows to specify the fields returned by the SDK See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#fields](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#fields) Works for Find and Get endpoints\n\n```go\nfunc Filter(filter string) RequestOption\n```\nFilter the result based on the provided condition See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#filter](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#filter) Only works for Find endpoints\n\n```go\nfunc Limit(n int) RequestOption\n```\nLimit will restrict the number of returned results to n See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#limit](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#limit) Only works for Find endpoints\n\n```go\nfunc Page(n int) RequestOption\n```\nSkip will skip the first (n - 1) \\* Limit rows from the results See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#page](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#page) Only works for Find endpoints\n\n```go\nfunc QueryOptions(q QueryOpts) RequestOption\n```\nSets additional query options See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#options](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#options) Works for Find and Get endpoints\n\n```go\nfunc Search(s string) RequestOption\n```\nPerforms a fuzzy search See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#search](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#search) Only works for Find Person endpoint\n\n```go\nfunc Skip(n int) RequestOption\n```\nSkip will skip the first n rows from the results See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#skip](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#skip) Only works for Find endpoints\n\n```go\nfunc Sort(sortFields ...string) RequestOption\n```\nSorts the result by a given field See more here [https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#sort](https://developer.bcc.no/bcc-core-api/crud/query-parameters.html#sort) Only works for Find endpoints\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/bcccoreapi","name":"bcccoreapi","synopsis":"","isRedistributable":true}
