textserialization

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2023 License: MIT Imports: 9 Imported by: 21

README

Kiota Text Serialization Library for Go

Go Serialization Text

The text Serialization Library for Go is the Go text serialization library implementation.

A Kiota generated project will need a reference to a text serialization package to handle text payloads from an API endpoint.

Read more about Kiota here.

Using the Kiota Text Serialization Library

go get github.com/microsoft/kiota-serialization-text-go

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

Documentation

Overview

Package textserialization is the default Kiota serialization implementation for text.

Index

Constants

This section is empty.

Variables

View Source
var NoStructuredDataError = errors.New("text does not support structured data")
View Source
var OnlyOneValue = errors.New("text serialization writer can only write one value")

Functions

func TestSerializationWriterFactoryHonoursInterface added in v0.4.0

func TestSerializationWriterFactoryHonoursInterface(t *testing.T)

func TestTextParseFactoryNodeHonoursInterface added in v0.4.0

func TestTextParseFactoryNodeHonoursInterface(t *testing.T)

Types

type TextParseNode

type TextParseNode struct {
	// contains filtered or unexported fields
}

TextParseNode is a ParseNode implementation for JSON.

func NewTextParseNode

func NewTextParseNode(content []byte) (*TextParseNode, error)

NewTextParseNode creates a new TextParseNode.

func (*TextParseNode) GetBoolValue

func (n *TextParseNode) GetBoolValue() (*bool, error)

GetBoolValue returns a Bool value from the nodes.

func (*TextParseNode) GetByteArrayValue

func (n *TextParseNode) GetByteArrayValue() ([]byte, error)

GetByteArrayValue returns a ByteArray value from the nodes.

func (*TextParseNode) GetByteValue

func (n *TextParseNode) GetByteValue() (*byte, error)

GetBoolValue returns a Bool value from the nodes.

func (*TextParseNode) GetChildNode

func (n *TextParseNode) GetChildNode(index string) (absser.ParseNode, error)

GetChildNode returns a new parse node for the given identifier.

func (*TextParseNode) GetCollectionOfEnumValues

func (n *TextParseNode) GetCollectionOfEnumValues(parser absser.EnumFactory) ([]interface{}, error)

GetCollectionOfEnumValues returns the collection of Enum values from the node.

func (*TextParseNode) GetCollectionOfObjectValues

func (n *TextParseNode) GetCollectionOfObjectValues(ctor absser.ParsableFactory) ([]absser.Parsable, error)

GetCollectionOfObjectValues returns the collection of Parsable values from the node.

func (*TextParseNode) GetCollectionOfPrimitiveValues

func (n *TextParseNode) GetCollectionOfPrimitiveValues(targetType string) ([]interface{}, error)

GetCollectionOfPrimitiveValues returns the collection of primitive values from the node.

func (*TextParseNode) GetDateOnlyValue

func (n *TextParseNode) GetDateOnlyValue() (*absser.DateOnly, error)

GetDateOnlyValue returns a DateOnly value from the nodes.

func (*TextParseNode) GetEnumValue

func (n *TextParseNode) GetEnumValue(parser absser.EnumFactory) (interface{}, error)

GetEnumValue returns a Enum value from the nodes.

func (*TextParseNode) GetFloat32Value

func (n *TextParseNode) GetFloat32Value() (*float32, error)

GetFloat32Value returns a Float32 value from the nodes.

func (*TextParseNode) GetFloat64Value

func (n *TextParseNode) GetFloat64Value() (*float64, error)

GetFloat64Value returns a Float64 value from the nodes.

func (*TextParseNode) GetISODurationValue

func (n *TextParseNode) GetISODurationValue() (*absser.ISODuration, error)

GetISODurationValue returns a ISODuration value from the nodes.

func (*TextParseNode) GetInt32Value

func (n *TextParseNode) GetInt32Value() (*int32, error)

GetInt32Value returns a Int32 value from the nodes.

func (*TextParseNode) GetInt64Value

func (n *TextParseNode) GetInt64Value() (*int64, error)

GetInt64Value returns a Int64 value from the nodes.

func (*TextParseNode) GetInt8Value

func (n *TextParseNode) GetInt8Value() (*int8, error)

GetInt8Value returns a int8 value from the nodes.

func (*TextParseNode) GetObjectValue

func (n *TextParseNode) GetObjectValue(ctor absser.ParsableFactory) (absser.Parsable, error)

GetObjectValue returns the Parsable value from the node.

func (*TextParseNode) GetOnAfterAssignFieldValues added in v0.7.0

func (n *TextParseNode) GetOnAfterAssignFieldValues() absser.ParsableAction

GetOnAfterAssignFieldValues returns a ByteArray value from the nodes.

func (*TextParseNode) GetOnBeforeAssignFieldValues added in v0.7.0

func (n *TextParseNode) GetOnBeforeAssignFieldValues() absser.ParsableAction

GetOnBeforeAssignFieldValues returns a ByteArray value from the nodes.

func (*TextParseNode) GetRawValue added in v0.6.0

func (n *TextParseNode) GetRawValue() (interface{}, error)

GetRawValue returns a ByteArray value from the nodes.

func (*TextParseNode) GetStringValue

func (n *TextParseNode) GetStringValue() (*string, error)

GetStringValue returns a String value from the nodes.

func (*TextParseNode) GetTimeOnlyValue

func (n *TextParseNode) GetTimeOnlyValue() (*absser.TimeOnly, error)

GetTimeOnlyValue returns a TimeOnly value from the nodes.

func (*TextParseNode) GetTimeValue

func (n *TextParseNode) GetTimeValue() (*time.Time, error)

GetTimeValue returns a Time value from the nodes.

func (*TextParseNode) GetUUIDValue

func (n *TextParseNode) GetUUIDValue() (*uuid.UUID, error)

GetUUIDValue returns a UUID value from the nodes.

func (*TextParseNode) SetOnAfterAssignFieldValues added in v0.7.0

func (n *TextParseNode) SetOnAfterAssignFieldValues(action absser.ParsableAction) error

SetOnAfterAssignFieldValues returns a ByteArray value from the nodes.

func (*TextParseNode) SetOnBeforeAssignFieldValues added in v0.7.0

func (n *TextParseNode) SetOnBeforeAssignFieldValues(action absser.ParsableAction) error

SetOnBeforeAssignFieldValues returns a ByteArray value from the nodes.

type TextParseNodeFactory

type TextParseNodeFactory struct {
}

TextParseNodeFactory is a ParseNodeFactory implementation for text

func NewTextParseNodeFactory

func NewTextParseNodeFactory() *TextParseNodeFactory

Creates a new TextParseNodeFactory

func (*TextParseNodeFactory) GetRootParseNode

func (f *TextParseNodeFactory) GetRootParseNode(contentType string, content []byte) (absser.ParseNode, error)

GetRootParseNode return a new ParseNode instance that is the root of the content

func (*TextParseNodeFactory) GetValidContentType

func (f *TextParseNodeFactory) GetValidContentType() (string, error)

GetValidContentType returns the content type this factory's parse nodes can deserialize.

type TextSerializationWriter

type TextSerializationWriter struct {
	// contains filtered or unexported fields
}

TextSerializationWriter implements SerializationWriter for JSON.

func NewTextSerializationWriter

func NewTextSerializationWriter() *TextSerializationWriter

NewTextSerializationWriter creates a new instance of the TextSerializationWriter.

func (*TextSerializationWriter) Close

func (w *TextSerializationWriter) Close() error

Close clears the internal buffer.

func (*TextSerializationWriter) GetOnAfterObjectSerialization added in v0.7.0

func (w *TextSerializationWriter) GetOnAfterObjectSerialization() absser.ParsableAction

func (*TextSerializationWriter) GetOnBeforeSerialization added in v0.7.0

func (w *TextSerializationWriter) GetOnBeforeSerialization() absser.ParsableAction

func (*TextSerializationWriter) GetOnStartObjectSerialization added in v0.7.0

func (w *TextSerializationWriter) GetOnStartObjectSerialization() absser.ParsableWriter

func (*TextSerializationWriter) GetSerializedContent

func (w *TextSerializationWriter) GetSerializedContent() ([]byte, error)

GetSerializedContent returns the resulting byte array from the serialization writer.

func (*TextSerializationWriter) SetOnAfterObjectSerialization added in v0.7.0

func (w *TextSerializationWriter) SetOnAfterObjectSerialization(action absser.ParsableAction) error

func (*TextSerializationWriter) SetOnBeforeSerialization added in v0.7.0

func (w *TextSerializationWriter) SetOnBeforeSerialization(action absser.ParsableAction) error

func (*TextSerializationWriter) SetOnStartObjectSerialization added in v0.7.0

func (w *TextSerializationWriter) SetOnStartObjectSerialization(writer absser.ParsableWriter) error

func (*TextSerializationWriter) WriteAdditionalData

func (w *TextSerializationWriter) WriteAdditionalData(value map[string]interface{}) error

WriteAdditionalData writes additional data to underlying the byte array.

func (*TextSerializationWriter) WriteAnyValue added in v0.6.0

func (w *TextSerializationWriter) WriteAnyValue(key string, value interface{}) error

WriteAnyValue an unknown value as a parameter.

func (*TextSerializationWriter) WriteBoolValue

func (w *TextSerializationWriter) WriteBoolValue(key string, value *bool) error

WriteBoolValue writes a Bool value to underlying the byte array.

func (*TextSerializationWriter) WriteByteArrayValue

func (w *TextSerializationWriter) WriteByteArrayValue(key string, value []byte) error

WriteByteArrayValue writes a ByteArray value to underlying the byte array.

func (*TextSerializationWriter) WriteByteValue

func (w *TextSerializationWriter) WriteByteValue(key string, value *byte) error

WriteByteValue writes a Byte value to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfBoolValues

func (w *TextSerializationWriter) WriteCollectionOfBoolValues(key string, collection []bool) error

WriteCollectionOfBoolValues writes a collection of Bool values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfByteValues

func (w *TextSerializationWriter) WriteCollectionOfByteValues(key string, collection []byte) error

WriteCollectionOfByteValues writes a collection of Byte values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfDateOnlyValues

func (w *TextSerializationWriter) WriteCollectionOfDateOnlyValues(key string, collection []absser.DateOnly) error

WriteCollectionOfDateOnlyValues writes a collection of DateOnly values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfFloat32Values

func (w *TextSerializationWriter) WriteCollectionOfFloat32Values(key string, collection []float32) error

WriteCollectionOfFloat32Values writes a collection of Float32 values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfFloat64Values

func (w *TextSerializationWriter) WriteCollectionOfFloat64Values(key string, collection []float64) error

WriteCollectionOfFloat64Values writes a collection of Float64 values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfISODurationValues

func (w *TextSerializationWriter) WriteCollectionOfISODurationValues(key string, collection []absser.ISODuration) error

WriteCollectionOfISODurationValues writes a collection of ISODuration values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfInt32Values

func (w *TextSerializationWriter) WriteCollectionOfInt32Values(key string, collection []int32) error

WriteCollectionOfInt32Values writes a collection of Int32 values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfInt64Values

func (w *TextSerializationWriter) WriteCollectionOfInt64Values(key string, collection []int64) error

WriteCollectionOfInt64Values writes a collection of Int64 values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfInt8Values

func (w *TextSerializationWriter) WriteCollectionOfInt8Values(key string, collection []int8) error

WriteCollectionOfInt8Values writes a collection of int8 values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfObjectValues

func (w *TextSerializationWriter) WriteCollectionOfObjectValues(key string, collection []absser.Parsable) error

WriteCollectionOfObjectValues writes a collection of Parsable values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfStringValues

func (w *TextSerializationWriter) WriteCollectionOfStringValues(key string, collection []string) error

WriteCollectionOfStringValues writes a collection of String values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfTimeOnlyValues

func (w *TextSerializationWriter) WriteCollectionOfTimeOnlyValues(key string, collection []absser.TimeOnly) error

WriteCollectionOfTimeOnlyValues writes a collection of TimeOnly values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfTimeValues

func (w *TextSerializationWriter) WriteCollectionOfTimeValues(key string, collection []time.Time) error

WriteCollectionOfTimeValues writes a collection of Time values to underlying the byte array.

func (*TextSerializationWriter) WriteCollectionOfUUIDValues

func (w *TextSerializationWriter) WriteCollectionOfUUIDValues(key string, collection []uuid.UUID) error

WriteCollectionOfUUIDValues writes a collection of UUID values to underlying the byte array.

func (*TextSerializationWriter) WriteDateOnlyValue

func (w *TextSerializationWriter) WriteDateOnlyValue(key string, value *absser.DateOnly) error

WriteDateOnlyValue writes a DateOnly value to underlying the byte array.

func (*TextSerializationWriter) WriteFloat32Value

func (w *TextSerializationWriter) WriteFloat32Value(key string, value *float32) error

WriteFloat32Value writes a Float32 value to underlying the byte array.

func (*TextSerializationWriter) WriteFloat64Value

func (w *TextSerializationWriter) WriteFloat64Value(key string, value *float64) error

WriteFloat64Value writes a Float64 value to underlying the byte array.

func (*TextSerializationWriter) WriteISODurationValue

func (w *TextSerializationWriter) WriteISODurationValue(key string, value *absser.ISODuration) error

WriteISODurationValue writes a ISODuration value to underlying the byte array.

func (*TextSerializationWriter) WriteInt32Value

func (w *TextSerializationWriter) WriteInt32Value(key string, value *int32) error

WriteInt32Value writes a Int32 value to underlying the byte array.

func (*TextSerializationWriter) WriteInt64Value

func (w *TextSerializationWriter) WriteInt64Value(key string, value *int64) error

WriteInt64Value writes a Int64 value to underlying the byte array.

func (*TextSerializationWriter) WriteInt8Value

func (w *TextSerializationWriter) WriteInt8Value(key string, value *int8) error

WriteInt8Value writes a int8 value to underlying the byte array.

func (*TextSerializationWriter) WriteNullValue added in v0.7.0

func (w *TextSerializationWriter) WriteNullValue(key string) error

func (*TextSerializationWriter) WriteObjectValue

func (w *TextSerializationWriter) WriteObjectValue(key string, item absser.Parsable, additionalValuesToMerge ...absser.Parsable) error

WriteObjectValue writes a Parsable value to underlying the byte array.

func (*TextSerializationWriter) WriteStringValue

func (w *TextSerializationWriter) WriteStringValue(key string, value *string) error

WriteStringValue writes a String value to underlying the byte array.

func (*TextSerializationWriter) WriteTimeOnlyValue

func (w *TextSerializationWriter) WriteTimeOnlyValue(key string, value *absser.TimeOnly) error

WriteTimeOnlyValue writes a TimeOnly value to underlying the byte array.

func (*TextSerializationWriter) WriteTimeValue

func (w *TextSerializationWriter) WriteTimeValue(key string, value *time.Time) error

WriteTimeValue writes a Time value to underlying the byte array.

func (*TextSerializationWriter) WriteUUIDValue

func (w *TextSerializationWriter) WriteUUIDValue(key string, value *uuid.UUID) error

WriteUUIDValue writes a UUID value to underlying the byte array.

type TextSerializationWriterFactory

type TextSerializationWriterFactory struct {
}

TextSerializationWriterFactory implements SerializationWriterFactory for text.

func NewTextSerializationWriterFactory

func NewTextSerializationWriterFactory() *TextSerializationWriterFactory

NewTextSerializationWriterFactory creates a new instance of the TextSerializationWriterFactory.

func (*TextSerializationWriterFactory) GetSerializationWriter

func (f *TextSerializationWriterFactory) GetSerializationWriter(contentType string) (absser.SerializationWriter, error)

GetSerializationWriter returns the relevant SerializationWriter instance for the given content type

func (*TextSerializationWriterFactory) GetValidContentType

func (f *TextSerializationWriterFactory) GetValidContentType() (string, error)

GetValidContentType returns the valid content type for the SerializationWriterFactoryRegistry

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL