Skip to content

Commit

Permalink
Merge pull request #375 from permitio/raz/per-10081-golang-sdk-local-…
Browse files Browse the repository at this point in the history
…facts-uploader

add go to local-facts-uploader.mdx
  • Loading branch information
RazcoDev authored Jun 27, 2024
2 parents 16b0c7e + b7d32a9 commit c8917a2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions docs/how-to/manage-data/local-facts-uploader.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@ const permit = new Permit({
});
```

</TabItem>
<TabItem value="go" label="Go">

```go
package main

import "github.com/permitio/permit-golang/pkg/permit"
import "github.com/permitio/permit-golang/pkg/config"

func main() {
PermitConfig := config.NewConfigBuilder("<YOUR_API_TOKEN>").
WithPdpUrl("http://localhost:7766").
WithProxyFactsViaPdp().
Build()
Permit := permit.New(PermitConfig)
}
```

</TabItem>
</Tabs>

Expand Down Expand Up @@ -163,8 +181,34 @@ await permit.api.users.sync({
// or you can use the waitForSync function to customize the timeout for a specific call
await permit.api.users.waitForSync(10).create({ key: "auth0|elon" });
```
</TabItem>
<TabItem value="go" label="Go">

```go
package main

import "github.com/permitio/permit-golang/pkg/permit"
import "github.com/permitio/permit-golang/pkg/config"

func main() {
PermitConfig := config.NewConfigBuilder("<YOUR_API_TOKEN>").
WithPdpUrl("http://localhost:7766").
WithProxyFactsViaPdp().
WithFactsSyncTimeout().
Build()
Permit := permit.New(PermitConfig)

newUser := models.NewUserCreate("new_user")
user, _ := Permit.Api.Users.SyncUser(ctx, *newUser)

// or you can use the WaitForSync function to customize the timeout for a specific call
user, _ := Permit.Api.Users.WaitForSync(10).CreateUser(ctx, *newUser)

}
```

</TabItem>

</Tabs>

:::note Supported APIs
Expand Down

0 comments on commit c8917a2

Please sign in to comment.