Skip to content

Latest commit

 

History

History
359 lines (227 loc) · 9.39 KB

File metadata and controls

359 lines (227 loc) · 9.39 KB

\PostAPI

All URIs are relative to https://api.sendx.io/api/v1/rest

Method HTTP request Description
CreatePost Post /post Create blog post
DeletePost Delete /post/{identifier} Delete post
GetAllPosts Get /post Get all posts
GetPost Get /post/{identifier} Get post by ID
UpdatePost Put /post/{identifier} Update post

CreatePost

RestRPost CreatePost(ctx).RestEPost(restEPost).Execute()

Create blog post

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/sendx/sendx-go-sdk"
)

func main() {
	restEPost := *openapiclient.NewRestEPost("Summer Product Launch", "Introducing Our New Summer Collection") // RestEPost | 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PostAPI.CreatePost(context.Background()).RestEPost(restEPost).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PostAPI.CreatePost``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `CreatePost`: RestRPost
	fmt.Fprintf(os.Stdout, "Response from `PostAPI.CreatePost`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiCreatePostRequest struct via the builder pattern

Name Type Description Notes
restEPost RestEPost

Return type

RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DeletePost

MessageResponse DeletePost(ctx, identifier).Execute()

Delete post

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/sendx/sendx-go-sdk"
)

func main() {
	identifier := "contact_BnKjkbBBS500CoBCP0oChQ" // string | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PostAPI.DeletePost(context.Background(), identifier).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PostAPI.DeletePost``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `DeletePost`: MessageResponse
	fmt.Fprintf(os.Stdout, "Response from `PostAPI.DeletePost`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
identifier string Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Other Parameters

Other parameters are passed through a pointer to a apiDeletePostRequest struct via the builder pattern

Name Type Description Notes

Return type

MessageResponse

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetAllPosts

[]RestRPost GetAllPosts(ctx).Offset(offset).Limit(limit).Execute()

Get all posts

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/sendx/sendx-go-sdk"
)

func main() {
	offset := int32(56) // int32 | Number of posts to skip (optional) (default to 0)
	limit := int32(56) // int32 | Maximum number of posts to return (optional) (default to 10)

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PostAPI.GetAllPosts(context.Background()).Offset(offset).Limit(limit).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PostAPI.GetAllPosts``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetAllPosts`: []RestRPost
	fmt.Fprintf(os.Stdout, "Response from `PostAPI.GetAllPosts`: %v\n", resp)
}

Path Parameters

Other Parameters

Other parameters are passed through a pointer to a apiGetAllPostsRequest struct via the builder pattern

Name Type Description Notes
offset int32 Number of posts to skip [default to 0]
limit int32 Maximum number of posts to return [default to 10]

Return type

[]RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

GetPost

RestRPost GetPost(ctx, identifier).Execute()

Get post by ID

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/sendx/sendx-go-sdk"
)

func main() {
	identifier := "contact_BnKjkbBBS500CoBCP0oChQ" // string | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PostAPI.GetPost(context.Background(), identifier).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PostAPI.GetPost``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `GetPost`: RestRPost
	fmt.Fprintf(os.Stdout, "Response from `PostAPI.GetPost`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
identifier string Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Other Parameters

Other parameters are passed through a pointer to a apiGetPostRequest struct via the builder pattern

Name Type Description Notes

Return type

RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdatePost

RestRPost UpdatePost(ctx, identifier).RestEPost(restEPost).Execute()

Update post

Example

package main

import (
	"context"
	"fmt"
	"os"
	openapiclient "github.com/sendx/sendx-go-sdk"
)

func main() {
	restEPost := *openapiclient.NewRestEPost("Summer Product Launch", "Introducing Our New Summer Collection") // RestEPost | 
	identifier := "contact_BnKjkbBBS500CoBCP0oChQ" // string | Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`)  **Format:** `<prefix>_<22-character-id>` 

	configuration := openapiclient.NewConfiguration()
	apiClient := openapiclient.NewAPIClient(configuration)
	resp, r, err := apiClient.PostAPI.UpdatePost(context.Background(), identifier).RestEPost(restEPost).Execute()
	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `PostAPI.UpdatePost``: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}
	// response from `UpdatePost`: RestRPost
	fmt.Fprintf(os.Stdout, "Response from `PostAPI.UpdatePost`: %v\n", resp)
}

Path Parameters

Name Type Description Notes
ctx context.Context context for authentication, logging, cancellation, deadlines, tracing, etc.
identifier string Resource identifier with prefix (e.g., `contact_BnKjkbBBS500CoBCP0oChQ`) Format: `<prefix>_<22-character-id>`

Other Parameters

Other parameters are passed through a pointer to a apiUpdatePostRequest struct via the builder pattern

Name Type Description Notes
restEPost RestEPost

Return type

RestRPost

Authorization

TeamApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]