- Archive - Archive a source
- Create - Create a source
- Delete - Delete a source
- Get - Get a source
- Unarchive - Unarchive a source
- Update - Update a source
- Upsert - Update or create a source
Archive a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "voluptas"
ctx := context.Background()
res, err := s.Source.Archive(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Source != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.ArchiveSourceResponse, error
Create a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Source.Create(ctx, operations.CreateSourceRequestBody{
AllowedHTTPMethods: []shared.SourceAllowedHTTPMethod{
shared.SourceAllowedHTTPMethodGet,
shared.SourceAllowedHTTPMethodPut,
shared.SourceAllowedHTTPMethodGet,
},
CustomResponse: &shared.SourceCustomResponse{
Body: "fugiat",
ContentType: shared.SourceCustomResponseContentTypeJSON,
},
Name: "Omar Kris",
})
if err != nil {
log.Fatal(err)
}
if res.Source != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateSourceRequestBody | ✔️ | The request object to use for the request. |
*operations.CreateSourceResponse, error
Delete a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "deleniti"
ctx := context.Background()
res, err := s.Source.Delete(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.DeleteSource200ApplicationJSONObject != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.DeleteSourceResponse, error
Get a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "omnis"
ctx := context.Background()
res, err := s.Source.Get(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Source != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.GetSourceResponse, error
Unarchive a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
id := "necessitatibus"
ctx := context.Background()
res, err := s.Source.Unarchive(ctx, id)
if err != nil {
log.Fatal(err)
}
if res.Source != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
id |
string | ✔️ | N/A |
*operations.UnarchiveSourceResponse, error
Update a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
requestBody := operations.UpdateSourceRequestBody{
AllowedHTTPMethods: []shared.SourceAllowedHTTPMethod{
shared.SourceAllowedHTTPMethodDelete,
shared.SourceAllowedHTTPMethodPut,
shared.SourceAllowedHTTPMethodPost,
},
CustomResponse: &shared.SourceCustomResponse{
Body: "voluptate",
ContentType: shared.SourceCustomResponseContentTypeText,
},
Name: hookdeck.String("Mrs. Ray Collins"),
}
id := "accusamus"
ctx := context.Background()
res, err := s.Source.Update(ctx, requestBody, id)
if err != nil {
log.Fatal(err)
}
if res.Source != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
requestBody |
operations.UpdateSourceRequestBody | ✔️ | N/A |
id |
string | ✔️ | N/A |
*operations.UpdateSourceResponse, error
Update or create a source
package main
import(
"context"
"log"
"github.com/speakeasy-sdks/hookdeck-go"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/shared"
"github.com/speakeasy-sdks/hookdeck-go/pkg/models/operations"
)
func main() {
s := hookdeck.New(
hookdeck.WithSecurity(shared.Security{
BasicAuth: &shared.SchemeBasicAuth{
Password: "",
Username: "",
},
}),
)
ctx := context.Background()
res, err := s.Source.Upsert(ctx, operations.UpsertSourceRequestBody{
AllowedHTTPMethods: []shared.SourceAllowedHTTPMethod{
shared.SourceAllowedHTTPMethodDelete,
shared.SourceAllowedHTTPMethodPost,
},
CustomResponse: &shared.SourceCustomResponse{
Body: "deserunt",
ContentType: shared.SourceCustomResponseContentTypeText,
},
Name: "Kari Leannon PhD",
})
if err != nil {
log.Fatal(err)
}
if res.Source != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpsertSourceRequestBody | ✔️ | The request object to use for the request. |