Ejemplo n.º 1
0
        public async Task <MemoryStream> GetTaskResult(string task, MimeTypeEnum format)
        {
            string url = baseAddress + $"v2/actor-tasks/{task}/runs/last/dataset/items?token={_appSettingsSecrets.Value.Token}&status=SUCCEEDED&format={format}";

            Log.Debug($"Querying: {url}");
            MemoryStream memStream = await _transport.GetDataStream(url);

            // string test = Encoding.ASCII.GetString(memStream.ToArray());
            return(memStream);
        }
Ejemplo n.º 2
0
        public VideoMetadata(string contentId, string contentTitle, MediaQualityEnum quality, string downloadUrl)
        {
            ContentId    = contentId;
            ContentTitle = contentTitle;
            Quality      = quality;
            Itag         = (int)Quality;
            MimeType     = Quality.GetMimeType();
            FileType     = Quality.GetFileType();
            FileExt      = Quality.GetShortName();

            DownloadUrl = downloadUrl;
        }
Ejemplo n.º 3
0
        public async Task <ApifyTaskResult> GetApifyTaskResult(string task, MimeTypeEnum format)
        {
            ApifyTaskResult atr = new ApifyTaskResult();

            atr.TaskResult = await GetTaskResult(task, format);

            atr.MimeType = format;
            var taskObject = await GetTaskObject(task);

            atr.Name = taskObject.data.name;

            return(atr);
        }
Ejemplo n.º 4
0
        public ArchiveModel(Guid?archiveId, MimeTypeEnum mimeType, ArchiveBase64BindingModel bindingModel)
        {
            this.ArchiveId   = archiveId?.ToString();
            this.ArchiveName = bindingModel?.ArchiveName;
            this.UserToken   = bindingModel?.UserToken;

            switch (mimeType)
            {
            case MimeTypeEnum.IMAGE: this.ContentType = "image/png"; break;

            case MimeTypeEnum.PDF: this.ContentType = "application/pdf"; break;

            case MimeTypeEnum.DOCX: this.ContentType = "application/msword"; break;

            case MimeTypeEnum.PPT: this.ContentType = "application/vnd.ms-powerpoint"; break;
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NewEventType" /> class.
        /// </summary>
        /// <param name="applicationIds">The IDs of the applications that are related to this entity. (required).</param>
        /// <param name="title">The human-friendly display name for this event type. Use a short, past-tense, description of the event. (required).</param>
        /// <param name="name">The machine-friendly canonical name for this event type. This will be used in URLs, and cannot be changed after an event type has been created. (required).</param>
        /// <param name="description">An explanation of when the event type is triggered. Write this with a campaign manager in mind. For example:  &gt; The \&quot;Payment Accepted\&quot; event is triggered after successful processing of a payment by our payment gateway.  (required).</param>
        /// <param name="mimeType">This defines how the request payload will be parsed before your handler code is run. (required).</param>
        /// <param name="examplePayload">It is often helpful to include an example payload with the event type definition for documentation purposes..</param>
        /// <param name="schema">It is strongly recommended to define a JSON schema that will be used to perform structural validation of request payloads after parsing. .</param>
        /// <param name="handlerLanguage">The language of the handler code. Currently only &#x60;\&quot;talang\&quot;&#x60; is supported..</param>
        /// <param name="handler">Code that will be run after successful parsing &amp; validation of the payload for this event. This code _may_ choose to evaluate campaign rules.  (required).</param>
        /// <param name="version">The version of this event type. When updating an existing event type this must be **exactly** &#x60;currentVersion + 1&#x60;.  (required).</param>
        public NewEventType(List <int> applicationIds = default(List <int>), string title = default(string), string name = default(string), string description = default(string), MimeTypeEnum mimeType = default(MimeTypeEnum), string examplePayload = default(string), Object schema = default(Object), HandlerLanguageEnum?handlerLanguage = default(HandlerLanguageEnum?), string handler = default(string), int version = default(int))
        {
            // to ensure "applicationIds" is required (not null)
            if (applicationIds == null)
            {
                throw new InvalidDataException("applicationIds is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.ApplicationIds = applicationIds;
            }

            // to ensure "title" is required (not null)
            if (title == null)
            {
                throw new InvalidDataException("title is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.Title = title;
            }

            // to ensure "name" is required (not null)
            if (name == null)
            {
                throw new InvalidDataException("name is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.Name = name;
            }

            // to ensure "description" is required (not null)
            if (description == null)
            {
                throw new InvalidDataException("description is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.Description = description;
            }

            // to ensure "mimeType" is required (not null)
            if (mimeType == null)
            {
                throw new InvalidDataException("mimeType is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.MimeType = mimeType;
            }

            // to ensure "handler" is required (not null)
            if (handler == null)
            {
                throw new InvalidDataException("handler is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.Handler = handler;
            }

            // to ensure "version" is required (not null)
            if (version == null)
            {
                throw new InvalidDataException("version is a required property for NewEventType and cannot be null");
            }
            else
            {
                this.Version = version;
            }

            this.ExamplePayload  = examplePayload;
            this.Schema          = schema;
            this.HandlerLanguage = handlerLanguage;
        }